/*
 * Open source under the BSD License. 
 * 
 * Copyright (c) 2008 George McGinley Smith
*/
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend(jQuery.easing, {
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d)
    },
    easeInQuad: function (x, t, b, c, d) {
        return c * (t /= d) * t + b
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c * (t /= d) * (t - 2) + b
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t + b;
        return -c / 2 * ((--t) * (t - 2) - 1) + b
    },
    easeInCubic: function (x, t, b, c, d) {
        return c * (t /= d) * t * t + b
    },
    easeOutCubic: function (x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t + 1) + b
    },
    easeInOutCubic: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t + 2) + b
    },
    easeInQuart: function (x, t, b, c, d) {
        return c * (t /= d) * t * t * t + b
    },
    easeOutQuart: function (x, t, b, c, d) {
        return -c * ((t = t / d - 1) * t * t * t - 1) + b
    },
    easeInOutQuart: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
        return -c / 2 * ((t -= 2) * t * t * t - 2) + b
    },
    easeInQuint: function (x, t, b, c, d) {
        return c * (t /= d) * t * t * t * t + b
    },
    easeOutQuint: function (x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t * t * t + 1) + b
    },
    easeInOutQuint: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t * t * t + 2) + b
    },
    easeInSine: function (x, t, b, c, d) {
        return -c * Math.cos(t / d * (Math.PI / 2)) + c + b
    },
    easeOutSine: function (x, t, b, c, d) {
        return c * Math.sin(t / d * (Math.PI / 2)) + b
    },
    easeInOutSine: function (x, t, b, c, d) {
        return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b
    },
    easeInExpo: function (x, t, b, c, d) {
        return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b
    },
    easeOutExpo: function (x, t, b, c, d) {
        return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b
    },
    easeInOutExpo: function (x, t, b, c, d) {
        if (t == 0) return b;
        if (t == d) return b + c;
        if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
        return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b
    },
    easeInCirc: function (x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b
    },
    easeOutCirc: function (x, t, b, c, d) {
        return c * Math.sqrt(1 - (t = t / d - 1) * t) + b
    },
    easeInOutCirc: function (x, t, b, c, d) {
        if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
        return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b
    },
    easeInElastic: function (x, t, b, c, d) {
        var s = 1.70158;
        var p = 0;
        var a = c;
        if (t == 0) return b;
        if ((t /= d) == 1) return b + c;
        if (!p) p = d * .3;
        if (a < Math.abs(c)) {
            a = c;
            var s = p / 4
        } else var s = p / (2 * Math.PI) * Math.asin(c / a);
        return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b
    },
    easeOutElastic: function (x, t, b, c, d) {
        var s = 1.70158;
        var p = 0;
        var a = c;
        if (t == 0) return b;
        if ((t /= d) == 1) return b + c;
        if (!p) p = d * .3;
        if (a < Math.abs(c)) {
            a = c;
            var s = p / 4
        } else var s = p / (2 * Math.PI) * Math.asin(c / a);
        return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b
    },
    easeInOutElastic: function (x, t, b, c, d) {
        var s = 1.70158;
        var p = 0;
        var a = c;
        if (t == 0) return b;
        if ((t /= d / 2) == 2) return b + c;
        if (!p) p = d * (.3 * 1.5);
        if (a < Math.abs(c)) {
            a = c;
            var s = p / 4
        } else var s = p / (2 * Math.PI) * Math.asin(c / a);
        if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
        return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b
    },
    easeInBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c * (t /= d) * t * ((s + 1) * t - s) + b
    },
    easeOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b
    },
    easeInOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
        return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b
    },
    easeInBounce: function (x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b
    },
    easeOutBounce: function (x, t, b, c, d) {
        if ((t /= d) < (1 / 2.75)) {
            return c * (7.5625 * t * t) + b
        } else if (t < (2 / 2.75)) {
            return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b
        } else if (t < (2.5 / 2.75)) {
            return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b
        } else {
            return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b
        }
    },
    easeInOutBounce: function (x, t, b, c, d) {
        if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b
    }
});


/*
 * Copyright (c) 2008 Joel Birch
 * 
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 */
;
(function ($) {
    $.fn.superfish = function (d) {
        var e = $.fn.superfish,
            c = e.c,
            $arrow = $(['<span class="', c.arrowClass, '"> &#187;</span>'].join('')),
            over = function () {
                var a = $(this),
                    menu = getMenu(a);
                clearTimeout(menu.sfTimer);
                a.showSuperfishUl().siblings().hideSuperfishUl()
            },
            out = function () {
                var a = $(this),
                    menu = getMenu(a),
                    o = e.op;
                clearTimeout(menu.sfTimer);
                menu.sfTimer = setTimeout(function () {
                    o.retainPath = ($.inArray(a[0], o.$path) > -1);
                    a.hideSuperfishUl();
                    if (o.$path.length && a.parents(['li.', o.hoverClass].join('')).length < 1) {
                        over.call(o.$path)
                    }
                }, o.delay)
            },
            getMenu = function (a) {
                var b = a.parents(['ul.', c.menuClass, ':first'].join(''))[0];
                e.op = e.o[b.serial];
                return b
            },
            addArrow = function (a) {
                a.addClass(c.anchorClass).append($arrow.clone())
            };
        return this.each(function () {
            var s = this.serial = e.o.length;
            var o = $.extend({}, e.defaults, d);
            o.$path = $('li.' + o.pathClass, this).slice(0, o.pathLevels).each(function () {
                $(this).addClass([o.hoverClass, c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass)
            });
            e.o[s] = e.op = o;
            $('li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function () {
                if (o.autoArrows) addArrow($('>a:first-child', this))
            }).not('.' + c.bcClass).hideSuperfishUl();
            var b = $('a', this);
            b.each(function (i) {
                var a = b.eq(i).parents('li');
                b.eq(i).focus(function () {
                    over.call(a)
                }).blur(function () {
                    out.call(a)
                })
            });
            o.onInit.call(this)
        }).each(function () {
            var a = [c.menuClass];
            if (e.op.dropShadows && !($.browser.msie && $.browser.version < 7)) a.push(c.shadowClass);
            $(this).addClass(a.join(' '))
        })
    };
    var f = $.fn.superfish;
    f.o = [];
    f.op = {};
    f.IE7fix = function () {
        var o = f.op;
        if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined) this.toggleClass(f.c.shadowClass + '-off')
    };
    f.c = {
        bcClass: 'sf-breadcrumb',
        menuClass: 'sf-js-enabled',
        anchorClass: 'sf-with-ul',
        arrowClass: 'sf-sub-indicator',
        shadowClass: 'sf-shadow'
    };
    f.defaults = {
        hoverClass: 'sfHover',
        pathClass: 'overideThisToUse',
        pathLevels: 1,
        delay: 800,
        animation: {
            opacity: 'show'
        },
        speed: 'normal',
        autoArrows: true,
        dropShadows: true,
        disableHI: false,
        onInit: function () {},
        onBeforeShow: function () {},
        onShow: function () {},
        onHide: function () {}
    };
    $.fn.extend({
        hideSuperfishUl: function () {
            var o = f.op,
                not = (o.retainPath === true) ? o.$path : '';
            o.retainPath = false;
            var a = $(['li.', o.hoverClass].join(''), this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility', 'hidden');
            o.onHide.call(a);
            return this
        },
        showSuperfishUl: function () {
            var o = f.op,
                sh = f.c.shadowClass + '-off',
                $ul = this.addClass(o.hoverClass).find('>ul:hidden').css('visibility', 'visible');
            f.IE7fix.call($ul);
            o.onBeforeShow.call($ul);
            $ul.animate(o.animation, o.speed, function () {
                f.IE7fix.call($ul);
                o.onShow.call($ul)
            });
            return this
        }
    })
})(jQuery);

;
(function ($) {
    $.fn.supersubs = function (k) {
        var l = $.extend({}, $.fn.supersubs.defaults, k);
        return this.each(function () {
            var h = $(this);
            var o = $.meta ? $.extend({}, l, h.data()) : l;
            var j = $('<li id="menu-fontsize">&#8212;</li>').css({
                'padding': 0,
                'position': 'absolute',
                'top': '-999em',
                'width': 'auto'
            }).appendTo(h).width();
            $('#menu-fontsize').remove();
            $ULs = h.find('ul');
            $ULs.each(function (i) {
                var c = $ULs.eq(i);
                var d = c.children();
                var e = d.children('a');
                var f = d.css('white-space', 'nowrap').css('float');
                var g = c.add(d).add(e).css({
                    'float': 'none',
                    'width': 'auto'
                }).end().end()[0].clientWidth / j;
                g += o.extraWidth;
                if (g > o.maxWidth) {
                    g = o.maxWidth
                } else if (g < o.minWidth) {
                    g = o.minWidth
                }
                g += 'em';
                c.css('width', g);
                d.css({
                    'float': f,
                    'width': '100%',
                    'white-space': 'normal'
                }).each(function () {
                    var a = $('>ul', this);
                    var b = a.css('left') !== undefined ? 'left' : 'right';
                    a.css(b, g)
                })
            })
        })
    };
    $.fn.supersubs.defaults = {
        minWidth: 9,
        maxWidth: 25,
        extraWidth: 0
    }
})(jQuery);

(function ($) {
    $.fn.hoverIntent = function (f, g) {
        var c = {
            sensitivity: 7,
            interval: 100,
            timeout: 0
        };
        c = $.extend(c, g ? {
            over: f,
            out: g
        } : f);
        var d, cY, pX, pY;
        var h = function (a) {
                d = a.pageX;
                cY = a.pageY
            };
        var i = function (a, b) {
                b.hoverIntent_t = clearTimeout(b.hoverIntent_t);
                if ((Math.abs(pX - d) + Math.abs(pY - cY)) < c.sensitivity) {
                    $(b).unbind("mousemove", h);
                    b.hoverIntent_s = 1;
                    return c.over.apply(b, [a])
                } else {
                    pX = d;
                    pY = cY;
                    b.hoverIntent_t = setTimeout(function () {
                        i(a, b)
                    }, c.interval)
                }
            };
        var j = function (a, b) {
                b.hoverIntent_t = clearTimeout(b.hoverIntent_t);
                b.hoverIntent_s = 0;
                return c.out.apply(b, [a])
            };
        var k = function (e) {
                var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
                while (p && p != this) {
                    try {
                        p = p.parentNode
                    } catch (e) {
                        p = this
                    }
                }
                if (p == this) {
                    return false
                }
                var a = jQuery.extend({}, e);
                var b = this;
                if (b.hoverIntent_t) {
                    b.hoverIntent_t = clearTimeout(b.hoverIntent_t)
                }
                if (e.type == "mouseover") {
                    pX = a.pageX;
                    pY = a.pageY;
                    $(b).bind("mousemove", h);
                    if (b.hoverIntent_s != 1) {
                        b.hoverIntent_t = setTimeout(function () {
                            i(a, b)
                        }, c.interval)
                    }
                } else {
                    $(b).unbind("mousemove", h);
                    if (b.hoverIntent_s == 1) {
                        b.hoverIntent_t = setTimeout(function () {
                            j(a, b)
                        }, c.timeout)
                    }
                }
            };
        return this.mouseover(k).mouseout(k)
    }
})(jQuery);

jQuery(document).ready(function(){
	jQuery('ul#navigation').superfish({
		delay:500, 
		animation:{opacity:'show', height:'show'}, 
		speed:'fast', 
		autoArrows:false, 
		dropShadows:false 
	}); 
}); 



/*
 * Slides, A Slideshow Plugin for jQuery
 * By: Nathan Searles, http://nathansearles.com
 * Updated: March 7th, 2011
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
(function($){$.fn.slides=function(g){g=$.extend({},$.fn.slides.option,g);return this.each(function(){$('.'+g.container,$(this)).children().wrapAll('<div class="slides_control"/>');var d=$(this),control=$('.slides_control',d),total=control.children().size(),width=control.children().outerWidth(),height=control.children().outerHeight(),start=g.start-1,effect=g.effect.indexOf(',')<0?g.effect:g.effect.replace(' ','').split(',')[0],paginationEffect=g.effect.indexOf(',')<0?effect:g.effect.replace(' ','').split(',')[1],next=0,prev=0,number=0,current=0,loaded,active,clicked,position,direction,imageParent,pauseTimeout,playInterval;function animate(a,b,c){if(!active&&loaded){active=true;g.animationStart(current+1);switch(a){case'next':prev=current;next=current+1;next=total===next?0:next;position=width*2;a=-width*2;current=next;break;case'prev':prev=current;next=current-1;next=next===-1?total-1:next;position=0;a=0;current=next;break;case'pagination':next=parseInt(c,10);prev=$('.'+g.paginationClass+' li.current a',d).attr('href').match('[^#/]+$');if(next>prev){position=width*2;a=-width*2}else{position=0;a=0}current=next;break}if(b==='fade'){if(g.crossfade){control.children(':eq('+next+')',d).css({zIndex:10}).fadeIn(g.fadeSpeed,g.fadeEasing,function(){if(g.autoHeight){control.animate({height:control.children(':eq('+next+')',d).outerHeight()},g.autoHeightSpeed,function(){control.children(':eq('+prev+')',d).css({display:'none',zIndex:0});control.children(':eq('+next+')',d).css({zIndex:0});g.animationComplete(next+1);active=false})}else{control.children(':eq('+prev+')',d).css({display:'none',zIndex:0});control.children(':eq('+next+')',d).css({zIndex:0});g.animationComplete(next+1);active=false}})}else{control.children(':eq('+prev+')',d).fadeOut(g.fadeSpeed,g.fadeEasing,function(){if(g.autoHeight){control.animate({height:control.children(':eq('+next+')',d).outerHeight()},g.autoHeightSpeed,function(){control.children(':eq('+next+')',d).fadeIn(g.fadeSpeed,g.fadeEasing)})}else{control.children(':eq('+next+')',d).fadeIn(g.fadeSpeed,g.fadeEasing,function(){if($.browser.msie){$(this).get(0).style.removeAttribute('filter')}})}g.animationComplete(next+1);active=false})}}else{control.children(':eq('+next+')').css({left:position,display:'block'});if(g.autoHeight){control.animate({left:a,height:control.children(':eq('+next+')').outerHeight()},g.slideSpeed,g.slideEasing,function(){control.css({left:-width});control.children(':eq('+next+')').css({left:width,zIndex:5});control.children(':eq('+prev+')').css({left:width,display:'none',zIndex:0});g.animationComplete(next+1);active=false})}else{control.animate({left:a},g.slideSpeed,g.slideEasing,function(){control.css({left:-width});control.children(':eq('+next+')').css({left:width,zIndex:5});control.children(':eq('+prev+')').css({left:width,display:'none',zIndex:0});g.animationComplete(next+1);active=false})}}if(g.pagination){$('.'+g.paginationClass+' li.current',d).removeClass('current');$('.'+g.paginationClass+' li:eq('+next+')',d).addClass('current')}}}function stop(){clearInterval(d.data('interval'))}function pause(){if(g.pause){clearTimeout(d.data('pause'));clearInterval(d.data('interval'));pauseTimeout=setTimeout(function(){clearTimeout(d.data('pause'));playInterval=setInterval(function(){animate("next",effect)},g.play);d.data('interval',playInterval)},g.pause);d.data('pause',pauseTimeout)}else{stop()}}if(total<2){return}if(start<0){start=0}if(start>total){start=total-1}if(g.start){current=start}if(g.randomize){control.randomize()}$('.'+g.container,d).css({overflow:'hidden',position:'relative'});control.children().css({position:'absolute',top:0,left:control.children().outerWidth(),zIndex:0,display:'none'});control.css({position:'relative',width:(width*3),height:height,left:-width});$('.'+g.container,d).css({display:'block'});if(g.autoHeight){control.children().css({height:'auto'});control.animate({height:control.children(':eq('+start+')').outerHeight()},g.autoHeightSpeed)}if(g.preload&&control.find('img').length){$('.'+g.container,d).css({background:'url('+g.preloadImage+') no-repeat 50% 50%'});var f=control.find('img:eq('+start+')').attr('src')+'?'+(new Date()).getTime();if($('img',d).parent().attr('class')!='slides_control'){imageParent=control.children(':eq(0)')[0].tagName.toLowerCase()}else{imageParent=control.find('img:eq('+start+')')}control.find('img:eq('+start+')').attr('src',f).load(function(){control.find(imageParent+':eq('+start+')').fadeIn(g.fadeSpeed,g.fadeEasing,function(){$(this).css({zIndex:5});$('.'+g.container,d).css({background:''});loaded=true;g.slidesLoaded()})})}else{control.children(':eq('+start+')').fadeIn(g.fadeSpeed,g.fadeEasing,function(){loaded=true;g.slidesLoaded()})}if(g.bigTarget){control.children().css({cursor:'pointer'});control.children().click(function(){animate('next',effect);return false})}if(g.hoverPause&&g.play){control.bind('mouseover',function(){stop()});control.bind('mouseleave',function(){pause()})}if(g.generateNextPrev){$('.'+g.container,d).after('<a href="#" class="'+g.prev+'">Prev</a>');$('.'+g.prev,d).after('<a href="#" class="'+g.next+'">Next</a>')}$('.'+g.next,d).click(function(e){e.preventDefault();if(g.play){pause()}animate('next',effect)});$('.'+g.prev,d).click(function(e){e.preventDefault();if(g.play){pause()}animate('prev',effect)});if(g.generatePagination){d.append('<ul class='+g.paginationClass+'></ul>');control.children().each(function(){$('.'+g.paginationClass,d).append('<li><a href="#'+number+'">'+(number+1)+'</a></li>');number++})}else{$('.'+g.paginationClass+' li a',d).each(function(){$(this).attr('href','#'+number);number++})}$('.'+g.paginationClass+' li:eq('+start+')',d).addClass('current');$('.'+g.paginationClass+' li a',d).click(function(){if(g.play){pause()}clicked=$(this).attr('href').match('[^#/]+$');if(current!=clicked){animate('pagination',paginationEffect,clicked)}return false});$('a.link',d).click(function(){if(g.play){pause()}clicked=$(this).attr('href').match('[^#/]+$')-1;if(current!=clicked){animate('pagination',paginationEffect,clicked)}return false});if(g.play){playInterval=setInterval(function(){animate('next',effect)},g.play);d.data('interval',playInterval)}})};$.fn.slides.option={preload:false,preloadImage:'/img/loading.gif',container:'slides_container',generateNextPrev:false,next:'next',prev:'prev',pagination:true,generatePagination:true,paginationClass:'pagination',fadeSpeed:350,fadeEasing:'',slideSpeed:350,slideEasing:'',start:1,effect:'slide',crossfade:false,randomize:false,play:0,pause:0,hoverPause:false,autoHeight:false,autoHeightSpeed:350,bigTarget:false,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}};$.fn.randomize=function(c){function randomizeOrder(){return(Math.round(Math.random())-0.5)}return($(this).each(function(){var $this=$(this);var $children=$this.children();var a=$children.length;if(a>1){$children.hide();var b=[];for(i=0;i<a;i++){b[b.length]=i}b=b.sort(randomizeOrder);$.each(b,function(j,k){var $child=$children.eq(k);var $clone=$child.clone(true);$clone.show().appendTo($this);if(c!==undefined){c($child,$clone)}$child.remove()})}}))}})(jQuery);



/*
 * Copyright 2011, Gilbert Pellegrom
 * 
 * Free to use and abuse under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 */
/*
 * Copyright 2011, Gilbert Pellegrom
 * 
 * Free to use and abuse under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 */
(function($){var NivoSlider=function(element,options){var settings=$.extend({},$.fn.nivoSlider.defaults,options);var vars={currentSlide:0,currentImage:'',totalSlides:0,randAnim:'',running:false,paused:false,stop:false};var slider=$(element);slider.data('nivo:vars',vars);slider.css('position','relative');slider.addClass('nivoSlider');var kids=slider.children();kids.each(function(){var child=$(this);var link='';if(!child.is('img.nivo_slide')){if(child.is('a')){child.addClass('nivo-imageLink');link=child;}
child=child.find('img.nivo_slide:first');}
var childWidth=child.width();if(childWidth==0)childWidth=child.attr('width');var childHeight=child.height();if(childHeight==0)childHeight=child.attr('height');if(childWidth>slider.width()){slider.width(childWidth);}
if(childHeight>slider.height()){slider.height(childHeight);}
if(link!=''){link.css('display','none');}
child.css('display','none');vars.totalSlides++;});if(settings.startSlide>0){if(settings.startSlide>=vars.totalSlides)settings.startSlide=vars.totalSlides-1;vars.currentSlide=settings.startSlide;}
if($(kids[vars.currentSlide]).is('img.nivo_slide')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img.nivo_slide:first');}
if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');}
slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');slider.append($('<div class="nivo-caption"><p></p></div>').css({display:'none',opacity:settings.captionOpacity}));var processCaption=function(settings){var nivoCaption=$('.nivo-caption',slider);if(vars.currentImage.attr('title')!=''&&vars.currentImage.attr('title')!=undefined){var title=vars.currentImage.attr('title');if(title.substr(0,1)=='#')title=$(title).html();if(nivoCaption.css('display')=='block'){nivoCaption.fadeOut(settings.animSpeed,function(){$(this).html(title);$(this).fadeIn(settings.animSpeed);});}else{nivoCaption.html(title);}
nivoCaption.fadeIn(settings.animSpeed);}else{nivoCaption.fadeOut(settings.animSpeed);}}
processCaption(settings);var timer=0;if(!settings.manualAdvance&&kids.length>1){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}
if(settings.directionNav){slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+settings.prevText+'</a><a class="nivo-nextNav">'+settings.nextText+'</a></div>');if(settings.directionNavHide){$('.nivo-directionNav',slider).hide();slider.hover(function(){$('.nivo-directionNav',slider).show();},function(){$('.nivo-directionNav',slider).hide();});}
$('a.nivo-prevNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');});$('a.nivo-nextNav',slider).live('click',function(){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');});}
if(settings.controlNav){if(settings.controlNavThumbs){var nivoControl=$('<div class="nivo-controlNav"></div>');}else{var nivoControl=$('<div class="nivo-controlNav"></div>');}slider.append(nivoControl);for(var i=0;i<kids.length;i++){if(settings.controlNavThumbs){var child=kids.eq(i);if(!child.is('img')){child=child.find('img:first');}
if(settings.controlNavThumbsFromRel){nivoControl.append('<a class="nivo-control" rel="'+i+'"><img src="'+child.attr('rel')+'" alt="" /></a>');}else{nivoControl.append('<a class="nivo-control" rel="'+i+'"><img src="'+child.attr('src').replace(settings.controlNavThumbsSearch,settings.controlNavThumbsReplace)+'" alt="" /></a>');}}else{nivoControl.append('<a class="nivo-control" rel="'+i+'">'+(i+1)+'</a>');}}
$('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');$('.nivo-controlNav a',slider).live('click',function(){if(vars.running)return false;if($(this).hasClass('active'))return false;clearInterval(timer);timer='';slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');vars.currentSlide=$(this).attr('rel')-1;nivoRun(slider,kids,settings,'control');});}
if(settings.keyboardNav){$(window).keypress(function(event){if(event.keyCode=='37'){if(vars.running)return false;clearInterval(timer);timer='';vars.currentSlide-=2;nivoRun(slider,kids,settings,'prev');}
if(event.keyCode=='39'){if(vars.running)return false;clearInterval(timer);timer='';nivoRun(slider,kids,settings,'next');}});}
if(settings.pauseOnHover){slider.hover(function(){vars.paused=true;clearInterval(timer);timer='';},function(){vars.paused=false;if(timer==''&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}});}
slider.bind('nivo:animFinished',function(){vars.running=false;$(kids).each(function(){if($(this).is('a')){$(this).css('display','none');}});if($(kids[vars.currentSlide]).is('a')){$(kids[vars.currentSlide]).css('display','block');}
if(timer==''&&!vars.paused&&!settings.manualAdvance){timer=setInterval(function(){nivoRun(slider,kids,settings,false);},settings.pauseTime);}
settings.afterChange.call(this);});var createSlices=function(slider,settings,vars){for(var i=0;i<settings.slices;i++){var sliceWidth=Math.round(slider.width()/settings.slices);if(i==settings.slices-1){slider.append($('<div class="nivo-slice"></div>').css({left:(sliceWidth*i)+'px',width:(slider.width()-(sliceWidth*i))+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}else{slider.append($('<div class="nivo-slice"></div>').css({left:(sliceWidth*i)+'px',width:sliceWidth+'px',height:'0px',opacity:'0',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((sliceWidth+(i*sliceWidth))-sliceWidth)+'px 0%'}));}}}
var createBoxes=function(slider,settings,vars){var boxWidth=Math.round(slider.width()/settings.boxCols);var boxHeight=Math.round(slider.height()/settings.boxRows);for(var rows=0;rows<settings.boxRows;rows++){for(var cols=0;cols<settings.boxCols;cols++){if(cols==settings.boxCols-1){slider.append($('<div class="nivo-box"></div>').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:(slider.width()-(boxWidth*cols))+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}else{slider.append($('<div class="nivo-box"></div>').css({opacity:0,left:(boxWidth*cols)+'px',top:(boxHeight*rows)+'px',width:boxWidth+'px',height:boxHeight+'px',background:'url("'+vars.currentImage.attr('src')+'") no-repeat -'+((boxWidth+(cols*boxWidth))-boxWidth)+'px -'+((boxHeight+(rows*boxHeight))-boxHeight)+'px'}));}}}}
var nivoRun=function(slider,kids,settings,nudge){var vars=slider.data('nivo:vars');if(vars&&(vars.currentSlide==vars.totalSlides-1)){settings.lastSlide.call(this);}
if((!vars||vars.stop)&&!nudge)return false;settings.beforeChange.call(this);if(!nudge){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}else{if(nudge=='prev'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}
if(nudge=='next'){slider.css('background','url("'+vars.currentImage.attr('src')+'") no-repeat');}}
vars.currentSlide++;if(vars.currentSlide==vars.totalSlides){vars.currentSlide=0;settings.slideshowEnd.call(this);}
if(vars.currentSlide<0)vars.currentSlide=(vars.totalSlides-1);if($(kids[vars.currentSlide]).is('img.nivo_slide')){vars.currentImage=$(kids[vars.currentSlide]);}else{vars.currentImage=$(kids[vars.currentSlide]).find('img.nivo_slide:first');}
if(settings.controlNav){$('.nivo-controlNav a',slider).removeClass('active');$('.nivo-controlNav a:eq('+vars.currentSlide+')',slider).addClass('active');}
processCaption(settings);$('.nivo-slice',slider).remove();$('.nivo-box',slider).remove();if(settings.effect=='random'){var anims=new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade','boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');vars.randAnim=anims[Math.floor(Math.random()*(anims.length+1))];if(vars.randAnim==undefined)vars.randAnim='fade';}
if(settings.effect.indexOf(',')!=-1){var anims=settings.effect.split(',');vars.randAnim=anims[Math.floor(Math.random()*(anims.length))];if(vars.randAnim==undefined)vars.randAnim='fade';}
vars.running=true;if(settings.effect=='sliceDown'||settings.effect=='sliceDownRight'||vars.randAnim=='sliceDownRight'||settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceDownLeft'||vars.randAnim=='sliceDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'top':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;i++;});}
else if(settings.effect=='sliceUp'||settings.effect=='sliceUpRight'||vars.randAnim=='sliceUpRight'||settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpLeft'||vars.randAnim=='sliceUpLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);slice.css({'bottom':'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;i++;});}
else if(settings.effect=='sliceUpDown'||settings.effect=='sliceUpDownRight'||vars.randAnim=='sliceUpDown'||settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;var v=0;var slices=$('.nivo-slice',slider);if(settings.effect=='sliceUpDownLeft'||vars.randAnim=='sliceUpDownLeft')slices=$('.nivo-slice',slider)._reverse();slices.each(function(){var slice=$(this);if(i==0){slice.css('top','0px');i++;}else{slice.css('bottom','0px');i=0;}
if(v==settings.slices-1){setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({height:'100%',opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;v++;});}
else if(settings.effect=='fold'||vars.randAnim=='fold'){createSlices(slider,settings,vars);var timeBuff=0;var i=0;$('.nivo-slice',slider).each(function(){var slice=$(this);var origWidth=slice.width();slice.css({top:'0px',height:'100%',width:'0px'});if(i==settings.slices-1){setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){slice.animate({width:origWidth,opacity:'1.0'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=50;i++;});}
else if(settings.effect=='fade'||vars.randAnim=='fade'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':slider.width()+'px'});firstSlice.animate({opacity:'1.0'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});}
else if(settings.effect=='slideInRight'||vars.randAnim=='slideInRight'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){slider.trigger('nivo:animFinished');});}
else if(settings.effect=='slideInLeft'||vars.randAnim=='slideInLeft'){createSlices(slider,settings,vars);var firstSlice=$('.nivo-slice:first',slider);firstSlice.css({'height':'100%','width':'0px','opacity':'1','left':'','right':'0px'});firstSlice.animate({width:slider.width()+'px'},(settings.animSpeed*2),'',function(){firstSlice.css({'left':'0px','right':''});slider.trigger('nivo:animFinished');});}
else if(settings.effect=='boxRandom'||vars.randAnim=='boxRandom'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var boxes=shuffle($('.nivo-box',slider));boxes.each(function(){var box=$(this);if(i==totalBoxes-1){setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed,'',function(){slider.trigger('nivo:animFinished');});},(100+timeBuff));}else{setTimeout(function(){box.animate({opacity:'1'},settings.animSpeed);},(100+timeBuff));}
timeBuff+=20;i++;});}
else if(settings.effect=='boxRain'||vars.randAnim=='boxRain'||settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrow'||vars.randAnim=='boxRainGrow'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){createBoxes(slider,settings,vars);var totalBoxes=settings.boxCols*settings.boxRows;var i=0;var timeBuff=0;var rowIndex=0;var colIndex=0;var box2Darr=new Array();box2Darr[rowIndex]=new Array();var boxes=$('.nivo-box',slider);if(settings.effect=='boxRainReverse'||vars.randAnim=='boxRainReverse'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){boxes=$('.nivo-box',slider)._reverse();}
boxes.each(function(){box2Darr[rowIndex][colIndex]=$(this);colIndex++;if(colIndex==settings.boxCols){rowIndex++;colIndex=0;box2Darr[rowIndex]=new Array();}});for(var cols=0;cols<(settings.boxCols*2);cols++){var prevCol=cols;for(var rows=0;rows<settings.boxRows;rows++){if(prevCol>=0&&prevCol<settings.boxCols){(function(row,col,time,i,totalBoxes){var box=$(box2Darr[row][col]);var w=box.width();var h=box.height();if(settings.effect=='boxRainGrow'||vars.randAnim=='boxRainGrow'||settings.effect=='boxRainGrowReverse'||vars.randAnim=='boxRainGrowReverse'){box.width(0).height(0);}
if(i==totalBoxes-1){setTimeout(function(){box.animate({opacity:'1',width:w,height:h},settings.animSpeed/1.3,'',function(){slider.trigger('nivo:animFinished');});},(100+time));}else{setTimeout(function(){box.animate({opacity:'1',width:w,height:h},settings.animSpeed/1.3);},(100+time));}})(rows,prevCol,timeBuff,i,totalBoxes);i++;}
prevCol--;}
timeBuff+=100;}}}
var shuffle=function(arr){for(var j,x,i=arr.length;i;j=parseInt(Math.random()*i),x=arr[--i],arr[i]=arr[j],arr[j]=x);return arr;}
var trace=function(msg){if(this.console&&typeof console.log!="undefined")
console.log(msg);}
this.stop=function(){if(!$(element).data('nivo:vars').stop){$(element).data('nivo:vars').stop=true;trace('Stop Slider');}}
this.start=function(){if($(element).data('nivo:vars').stop){$(element).data('nivo:vars').stop=false;trace('Start Slider');}}
settings.afterLoad.call(this);return this;};$.fn.nivoSlider=function(options){return this.each(function(key,value){var element=$(this);if(element.data('nivoslider'))return element.data('nivoslider');var nivoslider=new NivoSlider(this,options);element.data('nivoslider',nivoslider);});};$.fn.nivoSlider.defaults={effect:'random',slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:3000,startSlide:0,directionNav:true,directionNavHide:true,controlNav:true,controlNavThumbs:false,controlNavThumbsFromRel:false,controlNavThumbsSearch:'.jpg',controlNavThumbsReplace:'_thumb.jpg',keyboardNav:true,pauseOnHover:true,manualAdvance:false,captionOpacity:0.8,prevText:'Prev',nextText:'Next',beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};$.fn._reverse=[].reverse;})(jQuery);



/* 
 * jQuery Accordion Slider
 * 
 * Writed by Architector
 * Based on Kwicks Accordion Slider
 * 
 * All Rights Reserved (c) 2011
 */
(function($){$.fn.kwicks=function(v){var w={isVertical:false,sticky:false,defaultKwick:0,event:'mouseover',spacing:0,duration:1000,descrAnim:500,descrOpacity:0.8};var o=$.extend(w,v);var x=(o.isVertical?'height':'width');var y=(o.isVertical?'top':'left');return this.each(function(){var k=$(this);var l=k.children('li');var m=k.find('li').find('.slide-description');var n=k.find('li').find('.slide-description-short');var p=l.length;var q=(k.css(x).replace(/px/,''))/p;k.addClass('sliderActive');if(o.isVertical){k.addClass('vertical')}else{k.addClass('horizontal')}k.find('li').prepend('<span class="overlay"></span>');var r=l.height();var s=l.width();var t=k.find('li').find('.overlay');if(!o.max){o.max=(q*l.size())-(o.min*(l.size()-1))}else{o.min=((q*l.size())-o.max)/(l.size()-1)}if(!o.isVertical){n.css({width:q-40,opacity:o.descrOpacity,paddingRight:(q*l.size())-o.min});m.css({width:o.max-40,opacity:0,paddingRight:(q*l.size())-o.max});t.css({height:r})}else{t.css({width:s});n.css({width:s-20,opacity:o.descrOpacity});m.css({width:s-40,opacity:0})}if(o.sticky){n.css({opacity:0});l.eq(o.defaultKwick).find('.slide-description').css({opacity:o.descrOpacity})}if(o.isVertical){k.css({width:l.eq(0).css('width'),height:(q*l.size())+(o.spacing*(l.size()-1))+'px'})}else{k.css({width:(q*l.size())+(o.spacing*(l.size()-1))+'px',height:l.eq(0).css('height')})}var u=[];for(i=0;i<l.size();i++){u[i]=[];for(j=1;j<l.size()-1;j++){if(i==j){u[i][j]=o.isVertical?j*o.min+(j*o.spacing):j*o.min+(j*o.spacing)}else{u[i][j]=(j<=i?(j*o.min):(j-1)*o.min+o.max)+(j*o.spacing)}}}l.each(function(i){var h=$(this);if(i===0){h.css(y,'0px')}else if(i==l.size()-1){h.css(o.isVertical?'bottom':'right','0px')}else{if(o.sticky){h.css(y,u[o.defaultKwick][i])}else{h.css(y,(i*q)+(i*o.spacing))}}if(x=='width'){h.css({margin:0,position:'absolute',width:q})}else{h.css({margin:0,position:'absolute',height:q})}if(o.sticky){if(o.defaultKwick==i){h.css(x,o.max+'px');h.addClass('active')}else{h.css(x,o.min+'px')}}h.bind(o.event,function(){var c=[];var d=[];l.stop().removeClass('active');for(j=0;j<l.size();j++){c[j]=l.eq(j).css(x).replace(/px/,'');d[j]=l.eq(j).css(y).replace(/px/,'')}var e={};e[x]=o.max;var f=o.max-c[i];var g=c[i]/f;h.addClass('active').animate(e,{step:function(a){var b=f!=0?a/f-g:1;l.each(function(j){if(j!=i){l.eq(j).css(x,c[j]-((c[j]-o.min)*b)+'px')}if(j>0&&j<l.size()-1){l.eq(j).css(y,d[j]-((d[j]-u[i][j])*b)+'px')}})},duration:o.duration,easing:o.easing});n.stop().animate({opacity:0},o.descrAnim/2);m.stop().animate({opacity:o.descrOpacity},o.descrAnim/2);l.not('.active').find('.slide-description').stop().animate({opacity:0},o.descrAnim)})});if(!o.sticky){k.bind("mouseleave",function(){var c=[];var d=[];l.removeClass('active').stop();for(i=0;i<l.size();i++){c[i]=l.eq(i).css(x).replace(/px/,'');d[i]=l.eq(i).css(y).replace(/px/,'')}var e={};e[x]=q;var f=q-c[0];l.eq(0).animate(e,{step:function(a){var b=f!=0?(a-c[0])/f:1;for(i=1;i<l.size();i++){l.eq(i).css(x,c[i]-((c[i]-q)*b)+'px');if(i<l.size()-1){l.eq(i).css(y,d[i]-((d[i]-((i*q)+(i*o.spacing)))*b)+'px')}}},duration:o.duration,easing:o.easing});m.stop().animate({opacity:0},o.descrAnim/2);n.stop().animate({opacity:o.descrOpacity},o.descrAnim)})}})}})(jQuery);



/*
 * jQuery Tools 1.2.5 Tooltip - UI essentials
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * Since: November 2008
 */
(function($){$.tools=$.tools||{version:'1.2.5'};$.tools.tooltip={conf:{effect:'toggle',fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:['top','center'],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:'<div/>',tipClass:'tooltip'},addEffect:function(a,b,c){g[a]=[b,c]}};var g={toggle:[function(a){var b=this.getConf(),tip=this.getTip(),o=b.opacity;if(o<1){tip.css({opacity:o})}tip.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};function getPosition(a,b,c){var d=c.relative?a.position().top:a.offset().top,left=c.relative?a.position().left:a.offset().left,pos=c.position[0];d-=b.outerHeight()-c.offset[0];left+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent)){d-=$(window).scrollTop()}var e=b.outerHeight()+a.outerHeight();if(pos=='center'){d+=e/2}if(pos=='bottom'){d+=e}pos=c.position[1];var f=b.outerWidth()+a.outerWidth();if(pos=='center'){left-=f/2}if(pos=='left'){left-=f}return{top:d,left:left}}function Tooltip(c,d){var f=this,fire=c.add(f),tip,timer=0,pretimer=0,title=c.attr("title"),tipAttr=c.attr("data-tooltip"),effect=g[d.effect],shown,isInput=c.is(":input"),isWidget=isInput&&c.is(":checkbox, :radio, select, :button, :submit"),type=c.attr("type"),evt=d.events[type]||d.events[isInput?(isWidget?'widget':'input'):'def'];if(!effect){throw"Nonexistent effect \""+d.effect+"\"";}evt=evt.split(/,\s*/);if(evt.length!=2){throw"Tooltip: bad events configuration for "+type;}c.bind(evt[0],function(e){clearTimeout(timer);if(d.predelay){pretimer=setTimeout(function(){f.show(e)},d.predelay)}else{f.show(e)}}).bind(evt[1],function(e){clearTimeout(pretimer);if(d.delay){timer=setTimeout(function(){f.hide(e)},d.delay)}else{f.hide(e)}});if(title&&d.cancelDefault){c.removeAttr("title");c.data("title",title)}$.extend(f,{show:function(e){if(!tip){if(tipAttr){tip=$(tipAttr)}else if(d.tip){tip=$(d.tip).eq(0)}else if(title){tip=$(d.layout).addClass(d.tipClass).appendTo(document.body).hide().append(title)}else{tip=c.next();if(!tip.length){tip=c.parent().next()}}if(!tip.length){throw"Cannot find tooltip for "+c;}}if(f.isShown()){return f}tip.stop(true,true);var a=getPosition(c,tip,d);if(d.tip){tip.html(c.data("title"))}e=e||$.Event();e.type="onBeforeShow";fire.trigger(e,[a]);if($.browser.mozilla){}else{if(e.isDefaultPrevented()){return f}}a=getPosition(c,tip,d);tip.css({position:'absolute',top:a.top,left:a.left});shown=true;effect[0].call(f,function(){e.type="onShow";shown='full';fire.trigger(e)});var b=d.events.tooltip.split(/,\s*/);if(!tip.data("__set")){tip.bind(b[0],function(){clearTimeout(timer);clearTimeout(pretimer)});if(b[1]&&!c.is("input:not(:checkbox, :radio), textarea")){tip.bind(b[1],function(e){if(e.relatedTarget!=c[0]){c.trigger(evt[1].split(" ")[0])}})}tip.data("__set",true)}return f},hide:function(e){if(!tip||!f.isShown()){return f}e=e||$.Event();e.type="onBeforeHide";fire.trigger(e);if($.browser.mozilla){}else{if(e.isDefaultPrevented()){return}}shown=false;g[d.effect][1].call(f,function(){e.type="onHide";fire.trigger(e)});return f},isShown:function(a){return a?shown=='full':shown},getConf:function(){return d},getTip:function(){return tip},getTrigger:function(){return c}});$.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(i,b){if($.isFunction(d[b])){$(f).bind(b,d[b])}f[b]=function(a){if(a){$(f).bind(b,a)}return f}})}$.fn.tooltip=function(a){var b=this.data("tooltip");if(b){return b}a=$.extend(true,{},$.tools.tooltip.conf,a);if(typeof a.position=='string'){a.position=a.position.split(/,?\s/)}this.each(function(){b=new Tooltip($(this),a);$(this).data("tooltip",b)});return a.api?b:this}})(jQuery);

(function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);

(function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);

jQuery(document).ready(function(){
	jQuery('.link_tooltip').tooltip({
		effect:'slide',
		direction:'up',
		slideOffset:15,
		slideInSpeed:300,
		slideOutSpeed:300,
		position:'bottom center'
	});
});



/* Social Icons Scripts */
(function($){$.fn.socicons=function(c){var d={icons:'digg,stumbleupon,delicious,facebook,yahoo',imagesurl:'images/',imageformat:'png',light:true,targetblank:true,shorturl:''};var e=$.extend({},d,c);var f=this;var g=e.targetblank?'target="_blank"':'';var h=e.icons.split(',');for(key in h){var j=h[key];var k=socformat[h[key]];if(k!=undefined){k=k.replace('{TITLE}',urlencode(socicons_title()));k=k.replace('{URL}',urlencode(socicons_url()));k=k.replace('{SHORTURL}',urlencode(socicons_shorturl()));k=k.replace('{KEYWORDS}',urlencode(socicons_metawords()));k=k.replace('{DESCRIPTION}',urlencode(socicons_metadescript()));var l='<a '+g+' href="'+k+'" class="socicons_icon" title="'+j+'"><img src="'+e.imagesurl+j+'.'+e.imageformat+'" alt="'+j+'" /></a>';this.append(l)}}if(e.light){this.find('.socicons_icon').bind('mouseover',function(){$(this).siblings().stop().animate({'opacity':0.3},500)});this.find('.socicons_icon').bind('mouseout',function(){$(this).siblings().stop().animate({'opacity':1},500)})}var m;function socicons_metawords(){if(n==undefined){metaCollection=document.getElementsByTagName('meta');for(i=0;i<metaCollection.length;i++){nameAttribute=metaCollection[i].name.search(/keywords/);if(nameAttribute!=-1){m=metaCollection[i].content;return m}}}else{return m}}var n;function socicons_metadescript(){if(n==undefined){metaCollection=document.getElementsByTagName('meta');for(i=0;i<metaCollection.length;i++){nameAttribute=metaCollection[i].name.search(/description/);if(nameAttribute!=-1){n=metaCollection[i].content;return n}}}else{return n}}function socicons_title(){return document.title}function socicons_url(){var a=document.location.href;return a}function socicons_shorturl(){if(e.shorturl==''){return socicons_url()}else{return e.shorturl}}function urlencode(a){if(a==undefined){return''}return a.replace(/\s/g,'%20').replace('+','%2B').replace('/%20/g','+').replace('*','%2A').replace('/','%2F').replace('@','%40')}function light(a,b){if(b){a.style.opacity=1;a.childNodes[0].style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity=100);'}else{a.style.opacity=light_opacity/100;a.style.filter='alpha(opacity=20)';a.childNodes[0].style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+light_opacity+');'}}return this}})(jQuery);

var socformat = Array();
socformat['nujij'] = 'http://nujij.nl/jij.lynkx?t={TITLE}&u={URL}&b={DESCRIPTION}'
socformat['ekudos'] = 'http://www.ekudos.nl/artikel/nieuw?url={URL}&title={TITLE}&desc={DESCRIPTION}';
socformat['digg'] = 'http://digg.com/submit?phase=2&url={URL}&title={TITLE}';
socformat['linkedin'] = 'http://www.linkedin.com/shareArticle?mini=true&url={URL}&title={TITLE}&summary={DESCRIPTION}&source=';
socformat['sphere'] = 'http://www.sphere.com/search?q=sphereit:{URL}';
socformat['technorati'] = 'http://www.technorati.com/faves?add={URL}';
socformat['delicious'] = 'http://del.icio.us/post?url={URL}&title={TITLE}';
socformat['furl'] = 'http://furl.net/storeIt.jsp?u={URL}&t={TITLE}';
socformat['netscape'] = 'http://www.netscape.com/submit/?U={URL}&T={TITLE}';
socformat['yahoo'] = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u={URL}&t={TITLE}';
socformat['google'] = 'http://www.google.com/bookmarks/mark?op=edit&bkmk={URL}&title={TITLE}';
socformat['newsvine'] = 'http://www.newsvine.com/_wine/save?u={URL}&h={TITLE}';
socformat['reddit'] = 'http://reddit.com/submit?url={URL}&title={TITLE}';
socformat['blogmarks'] = 'http://blogmarks.net/my/new.php?mini=1&url={URL}&title={TITLE}';
socformat['magnolia'] = 'http://ma.gnolia.com/bookmarklet/add?url={URL}&title={TITLE}';
socformat['live'] = 'https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url={URL}&title={TITLE}&top=1';
socformat['tailrank'] = 'http://tailrank.com/share/?link_href={URL}&title={TITLE}';
socformat['facebook'] = 'http://www.facebook.com/share.php?u={URL}';
socformat['twitter'] = 'http://twitter.com/?status={TITLE}%20-%20{SHORTURL}';
socformat['stumbleupon'] = 'http://www.stumbleupon.com/submit?url={URL}&title={TITLE}';
socformat['bligg'] = 'http://www.bligg.nl/submit.php?url={URL}';
socformat['symbaloo'] = 'http://www.symbaloo.com/en/add/url={URL}&title={TITLE}';
socformat['misterwong'] = 'http://www.mister-wong.com/add_url/?bm_url={URL}&bm_title={TITLE}&bm_comment=&bm_tags={KEYWORDS}';
socformat['buzz']	= 'http://www.google.com/reader/link?url={URL}&title={TITLE}&snippet={DESCRIPTION}&srcURL={URL}&srcTitle={TITLE}';
socformat['myspace'] = 'http://www.myspace.com/Modules/PostTo/Pages/?u={URL}';
socformat['mail']	= 'mailto:to@email.com?SUBJECT={TITLE}&BODY={DESCRIPTION}-{URL}';

jQuery(document).ready(function() { 
	jQuery('.social').socicons({
		icons:'nujij,linkedin,ekudos,digg,sphere,technorati,delicious,furl,netscape,yahoo,google,newsvine,reddit,blogmarks,magnolia,live,tailrank,facebook,twitter,stumbleupon,bligg,symbaloo,misterwong,mail',
		imagesurl:'images/socicons/'
	});
});

jQuery(document).ready(function(){
	jQuery('h6.share').toggle(function(){
		jQuery(this).parent().find('.social').show('slow');
		return false;
	}, function(){
		jQuery(this).parent().find('.social').hide('slow');
		return false;
	});
});



/*
 * Copyright (c) 2009 - 2010 Happyworm Ltd
 * 
 * Dual licensed under the MIT and GPL licenses.
 *  http://www.opensource.org/licenses/mit-license.php
 *  http://www.gnu.org/copyleft/gpl.html
 */
(function (c, h) {
    c.fn.jPlayer = function (a) {
        var b = typeof a === "string",
            d = Array.prototype.slice.call(arguments, 1),
            f = this;
        a = !b && d.length ? c.extend.apply(null, [true, a].concat(d)) : a;
        if (b && a.charAt(0) === "_") return f;
        b ? this.each(function () {
            var e = c.data(this, "jPlayer"),
                g = e && c.isFunction(e[a]) ? e[a].apply(e, d) : e;
            if (g !== e && g !== h) {
                f = g;
                return false
            }
        }) : this.each(function () {
            var e = c.data(this, "jPlayer");
            if (e) {
                e.option(a || {})._init();
                e.option(a || {})
            } else c.data(this, "jPlayer", new c.jPlayer(a, this))
        });
        return f
    };
    c.jPlayer = function (a, b) {
        if (arguments.length) {
            this.element = c(b);
            this.options = c.extend(true, {}, this.options, a);
            var d = this;
            this.element.bind("remove.jPlayer", function () {
                d.destroy()
            });
            this._init()
        }
    };
    c.jPlayer.event = {
        ready: "jPlayer_ready",
        resize: "jPlayer_resize",
        error: "jPlayer_error",
        warning: "jPlayer_warning",
        loadstart: "jPlayer_loadstart",
        progress: "jPlayer_progress",
        suspend: "jPlayer_suspend",
        abort: "jPlayer_abort",
        emptied: "jPlayer_emptied",
        stalled: "jPlayer_stalled",
        play: "jPlayer_play",
        pause: "jPlayer_pause",
        loadedmetadata: "jPlayer_loadedmetadata",
        loadeddata: "jPlayer_loadeddata",
        waiting: "jPlayer_waiting",
        playing: "jPlayer_playing",
        canplay: "jPlayer_canplay",
        canplaythrough: "jPlayer_canplaythrough",
        seeking: "jPlayer_seeking",
        seeked: "jPlayer_seeked",
        timeupdate: "jPlayer_timeupdate",
        ended: "jPlayer_ended",
        ratechange: "jPlayer_ratechange",
        durationchange: "jPlayer_durationchange",
        volumechange: "jPlayer_volumechange"
    };
    c.jPlayer.htmlEvent = ["loadstart", "abort", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplaythrough", "ratechange"];
    c.jPlayer.pause = function () {
        c.each(c.jPlayer.prototype.instances, function (a, b) {
            b.data("jPlayer").status.srcSet && b.jPlayer("pause")
        })
    };
    c.jPlayer.timeFormat = {
        showHour: false,
        showMin: true,
        showSec: true,
        padHour: false,
        padMin: true,
        padSec: true,
        sepHour: ":",
        sepMin: ":",
        sepSec: ""
    };
    c.jPlayer.convertTime = function (a) {
        a = new Date(a * 1E3);
        var b = a.getUTCHours(),
            d = a.getUTCMinutes();
        a = a.getUTCSeconds();
        b = c.jPlayer.timeFormat.padHour && b < 10 ? "0" + b : b;
        d = c.jPlayer.timeFormat.padMin && d < 10 ? "0" + d : d;
        a = c.jPlayer.timeFormat.padSec && a < 10 ? "0" + a : a;
        return (c.jPlayer.timeFormat.showHour ? b + c.jPlayer.timeFormat.sepHour : "") + (c.jPlayer.timeFormat.showMin ? d + c.jPlayer.timeFormat.sepMin : "") + (c.jPlayer.timeFormat.showSec ? a + c.jPlayer.timeFormat.sepSec : "")
    };
    c.jPlayer.uaMatch = function (a) {
        a = a.toLowerCase();
        var b = /(opera)(?:.*version)?[ \/]([\w.]+)/,
            d = /(msie) ([\w.]+)/,
            f = /(mozilla)(?:.*? rv:([\w.]+))?/;
        a = /(webkit)[ \/]([\w.]+)/.exec(a) || b.exec(a) || d.exec(a) || a.indexOf("compatible") < 0 && f.exec(a) || [];
        return {
            browser: a[1] || "",
            version: a[2] || "0"
        }
    };
    c.jPlayer.browser = {};
    var m = c.jPlayer.uaMatch(navigator.userAgent);
    if (m.browser) {
        c.jPlayer.browser[m.browser] = true;
        c.jPlayer.browser.version = m.version
    }
    c.jPlayer.prototype = {
        count: 0,
        version: {
            script: "2.0.0",
            needFlash: "2.0.0",
            flash: "unknown"
        },
        options: {
            swfPath: "js",
            solution: "html, flash",
            supplied: "mp3",
            preload: "metadata",
            volume: 0.8,
            muted: false,
            backgroundColor: "",
            cssSelectorAncestor: "#jp_interface_1",
            cssSelector: {
                videoPlay: ".jp-video-play",
                play: ".jp-play",
                pause: ".jp-pause",
                stop: ".jp-stop",
                seekBar: ".jp-seek-bar",
                playBar: ".jp-play-bar",
                mute: ".jp-mute",
                unmute: ".jp-unmute",
                volumeBar: ".jp-volume-bar",
                volumeBarValue: ".jp-volume-bar-value",
                currentTime: ".jp-current-time",
                duration: ".jp-duration"
            },
            idPrefix: "jp",
            errorAlerts: false,
            warningAlerts: false
        },
        instances: {},
        status: {
            src: "",
            media: {},
            paused: true,
            format: {},
            formatType: "",
            waitForPlay: true,
            waitForLoad: true,
            srcSet: false,
            video: false,
            seekPercent: 0,
            currentPercentRelative: 0,
            currentPercentAbsolute: 0,
            currentTime: 0,
            duration: 0
        },
        _status: {
            volume: h,
            muted: false,
            width: 0,
            height: 0
        },
        internal: {
            ready: false,
            instance: h,
            htmlDlyCmdId: h
        },
        solution: {
            html: true,
            flash: true
        },
        format: {
            mp3: {
                codec: 'audio/mpeg; codecs="mp3"',
                flashCanPlay: true,
                media: "audio"
            },
            m4a: {
                codec: 'audio/mp4; codecs="mp4a.40.2"',
                flashCanPlay: true,
                media: "audio"
            },
            oga: {
                codec: 'audio/ogg; codecs="vorbis"',
                flashCanPlay: false,
                media: "audio"
            },
            wav: {
                codec: 'audio/wav; codecs="1"',
                flashCanPlay: false,
                media: "audio"
            },
            webma: {
                codec: 'audio/webm; codecs="vorbis"',
                flashCanPlay: false,
                media: "audio"
            },
            m4v: {
                codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
                flashCanPlay: true,
                media: "video"
            },
            ogv: {
                codec: 'video/ogg; codecs="theora, vorbis"',
                flashCanPlay: false,
                media: "video"
            },
            webmv: {
                codec: 'video/webm; codecs="vorbis, vp8"',
                flashCanPlay: false,
                media: "video"
            }
        },
        _init: function () {
            var a = this;
            this.element.empty();
            this.status = c.extend({}, this.status, this._status);
            this.internal = c.extend({}, this.internal);
            this.formats = [];
            this.solutions = [];
            this.require = {};
            this.htmlElement = {};
            this.html = {};
            this.html.audio = {};
            this.html.video = {};
            this.flash = {};
            this.css = {};
            this.css.cs = {};
            this.css.jq = {};
            this.status.volume = this._limitValue(this.options.volume, 0, 1);
            this.status.muted = this.options.muted;
            this.status.width = this.element.css("width");
            this.status.height = this.element.css("height");
            this.element.css({
                "background-color": this.options.backgroundColor
            });
            c.each(this.options.supplied.toLowerCase().split(","), function (e, g) {
                var i = g.replace(/^\s+|\s+$/g, "");
                if (a.format[i]) {
                    var j = false;
                    c.each(a.formats, function (n, k) {
                        if (i === k) {
                            j = true;
                            return false
                        }
                    });
                    j || a.formats.push(i)
                }
            });
            c.each(this.options.solution.toLowerCase().split(","), function (e, g) {
                var i = g.replace(/^\s+|\s+$/g, "");
                if (a.solution[i]) {
                    var j = false;
                    c.each(a.solutions, function (n, k) {
                        if (i === k) {
                            j = true;
                            return false
                        }
                    });
                    j || a.solutions.push(i)
                }
            });
            this.internal.instance = "jp_" + this.count;
            this.instances[this.internal.instance] = this.element;
            this.element.attr("id") === "" && this.element.attr("id", this.options.idPrefix + "_jplayer_" + this.count);
            this.internal.self = c.extend({}, {
                id: this.element.attr("id"),
                jq: this.element
            });
            this.internal.audio = c.extend({}, {
                id: this.options.idPrefix + "_audio_" + this.count,
                jq: h
            });
            this.internal.video = c.extend({}, {
                id: this.options.idPrefix + "_video_" + this.count,
                jq: h
            });
            this.internal.flash = c.extend({}, {
                id: this.options.idPrefix + "_flash_" + this.count,
                jq: h,
                swf: this.options.swfPath + (this.options.swfPath !== "" && this.options.swfPath.slice(-1) !== "/" ? "/" : "") + "Jplayer.swf"
            });
            this.internal.poster = c.extend({}, {
                id: this.options.idPrefix + "_poster_" + this.count,
                jq: h
            });
            c.each(c.jPlayer.event, function (e, g) {
                if (a.options[e] !== h) {
                    a.element.bind(g + ".jPlayer", a.options[e]);
                    a.options[e] = h
                }
            });
            this.htmlElement.poster = document.createElement("img");
            this.htmlElement.poster.id = this.internal.poster.id;
            this.htmlElement.poster.onload = function () {
                if (!a.status.video || a.status.waitForPlay) a.internal.poster.jq.show()
            };
            this.element.append(this.htmlElement.poster);
            this.internal.poster.jq = c("#" + this.internal.poster.id);
            this.internal.poster.jq.css({
                width: this.status.width,
                height: this.status.height
            });
            this.internal.poster.jq.hide();
            this.require.audio = false;
            this.require.video = false;
            c.each(this.formats, function (e, g) {
                a.require[a.format[g].media] = true
            });
            this.html.audio.available = false;
            if (this.require.audio) {
                this.htmlElement.audio = document.createElement("audio");
                this.htmlElement.audio.id = this.internal.audio.id;
                this.html.audio.available = !! this.htmlElement.audio.canPlayType
            }
            this.html.video.available = false;
            if (this.require.video) {
                this.htmlElement.video = document.createElement("video");
                this.htmlElement.video.id = this.internal.video.id;
                this.html.video.available = !! this.htmlElement.video.canPlayType
            }
            this.flash.available = this._checkForFlash(10);
            this.html.canPlay = {};
            this.flash.canPlay = {};
            c.each(this.formats, function (e, g) {
                a.html.canPlay[g] = a.html[a.format[g].media].available && "" !== a.htmlElement[a.format[g].media].canPlayType(a.format[g].codec);
                a.flash.canPlay[g] = a.format[g].flashCanPlay && a.flash.available
            });
            this.html.desired = false;
            this.flash.desired = false;
            c.each(this.solutions, function (e, g) {
                if (e === 0) a[g].desired = true;
                else {
                    var i = false,
                        j = false;
                    c.each(a.formats, function (n, k) {
                        if (a[a.solutions[0]].canPlay[k]) if (a.format[k].media === "video") j = true;
                        else i = true
                    });
                    a[g].desired = a.require.audio && !i || a.require.video && !j
                }
            });
            this.html.support = {};
            this.flash.support = {};
            c.each(this.formats, function (e, g) {
                a.html.support[g] = a.html.canPlay[g] && a.html.desired;
                a.flash.support[g] = a.flash.canPlay[g] && a.flash.desired
            });
            this.html.used = false;
            this.flash.used = false;
            c.each(this.solutions, function (e, g) {
                c.each(a.formats, function (i, j) {
                    if (a[g].support[j]) {
                        a[g].used = true;
                        return false
                    }
                })
            });
            this.html.used || this.flash.used || this._error({
                type: c.jPlayer.error.NO_SOLUTION,
                context: "{solution:'" + this.options.solution + "', supplied:'" + this.options.supplied + "'}",
                message: c.jPlayer.errorMsg.NO_SOLUTION,
                hint: c.jPlayer.errorHint.NO_SOLUTION
            });
            this.html.active = false;
            this.html.audio.gate = false;
            this.html.video.gate = false;
            this.flash.active = false;
            this.flash.gate = false;
            if (this.flash.used) {
                var b = "id=" + escape(this.internal.self.id) + "&vol=" + this.status.volume + "&muted=" + this.status.muted;
                if (c.browser.msie && Number(c.browser.version) <= 8) {
                    var d = '<object id="' + this.internal.flash.id + '"';
                    d += ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
                    d += ' codebase="' + document.URL.substring(0, document.URL.indexOf(":")) + '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"';
                    d += ' type="application/x-shockwave-flash"';
                    d += ' width="0" height="0">';
                    d += "</object>";
                    var f = [];
                    f[0] = '<param name="movie" value="' + this.internal.flash.swf + '" />';
                    f[1] = '<param name="quality" value="high" />';
                    f[2] = '<param name="FlashVars" value="' + b + '" />';
                    f[3] = '<param name="allowScriptAccess" value="always" />';
                    f[4] = '<param name="bgcolor" value="' + this.options.backgroundColor + '" />';
                    b = document.createElement(d);
                    for (d = 0; d < f.length; d++) b.appendChild(document.createElement(f[d]));
                    this.element.append(b)
                } else {
                    f = '<embed name="' + this.internal.flash.id + '" id="' + this.internal.flash.id + '" src="' + this.internal.flash.swf + '"';
                    f += ' width="0" height="0" bgcolor="' + this.options.backgroundColor + '"';
                    f += ' quality="high" FlashVars="' + b + '"';
                    f += ' allowScriptAccess="always"';
                    f += ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
                    this.element.append(f)
                }
                this.internal.flash.jq = c("#" + this.internal.flash.id);
                this.internal.flash.jq.css({
                    width: "0px",
                    height: "0px"
                })
            }
            if (this.html.used) {
                if (this.html.audio.available) {
                    this._addHtmlEventListeners(this.htmlElement.audio, this.html.audio);
                    this.element.append(this.htmlElement.audio);
                    this.internal.audio.jq = c("#" + this.internal.audio.id)
                }
                if (this.html.video.available) {
                    this._addHtmlEventListeners(this.htmlElement.video, this.html.video);
                    this.element.append(this.htmlElement.video);
                    this.internal.video.jq = c("#" + this.internal.video.id);
                    this.internal.video.jq.css({
                        width: "0px",
                        height: "0px"
                    })
                }
            }
            this.html.used && !this.flash.used && window.setTimeout(function () {
                a.internal.ready = true;
                a.version.flash = "n/a";
                a._trigger(c.jPlayer.event.ready)
            }, 100);
            c.each(this.options.cssSelector, function (e, g) {
                a._cssSelector(e, g)
            });
            this._updateInterface();
            this._updateButtons(false);
            this._updateVolume(this.status.volume);
            this._updateMute(this.status.muted);
            this.css.jq.videoPlay.length && this.css.jq.videoPlay.hide();
            c.jPlayer.prototype.count++
        },
        destroy: function () {
            this._resetStatus();
            this._updateInterface();
            this._seeked();
            this.css.jq.currentTime.length && this.css.jq.currentTime.text("");
            this.css.jq.duration.length && this.css.jq.duration.text("");
            this.status.srcSet && this.pause();
            c.each(this.css.jq, function (a, b) {
                b.unbind(".jPlayer")
            });
            this.element.removeData("jPlayer");
            this.element.unbind(".jPlayer");
            this.element.empty();
            this.instances[this.internal.instance] = h
        },
        enable: function () {},
        disable: function () {},
        _addHtmlEventListeners: function (a, b) {
            var d = this;
            a.preload = this.options.preload;
            a.muted = this.options.muted;
            a.addEventListener("progress", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._getHtmlStatus(a);
                    d._updateInterface();
                    d._trigger(c.jPlayer.event.progress)
                }
            }, false);
            a.addEventListener("timeupdate", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._getHtmlStatus(a);
                    d._updateInterface();
                    d._trigger(c.jPlayer.event.timeupdate)
                }
            }, false);
            a.addEventListener("durationchange", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d.status.duration = this.duration;
                    d._getHtmlStatus(a);
                    d._updateInterface();
                    d._trigger(c.jPlayer.event.durationchange)
                }
            }, false);
            a.addEventListener("play", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._updateButtons(true);
                    d._trigger(c.jPlayer.event.play)
                }
            }, false);
            a.addEventListener("playing", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._updateButtons(true);
                    d._seeked();
                    d._trigger(c.jPlayer.event.playing)
                }
            }, false);
            a.addEventListener("pause", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._updateButtons(false);
                    d._trigger(c.jPlayer.event.pause)
                }
            }, false);
            a.addEventListener("waiting", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._seeking();
                    d._trigger(c.jPlayer.event.waiting)
                }
            }, false);
            a.addEventListener("canplay", function () {
                if (b.gate && !d.status.waitForLoad) {
                    a.volume = d._volumeFix(d.status.volume);
                    d._trigger(c.jPlayer.event.canplay)
                }
            }, false);
            a.addEventListener("seeking", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._seeking();
                    d._trigger(c.jPlayer.event.seeking)
                }
            }, false);
            a.addEventListener("seeked", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._seeked();
                    d._trigger(c.jPlayer.event.seeked)
                }
            }, false);
            a.addEventListener("suspend", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._seeked();
                    d._trigger(c.jPlayer.event.suspend)
                }
            }, false);
            a.addEventListener("ended", function () {
                if (b.gate && !d.status.waitForLoad) {
                    if (!c.jPlayer.browser.webkit) d.htmlElement.media.currentTime = 0;
                    d.htmlElement.media.pause();
                    d._updateButtons(false);
                    d._getHtmlStatus(a, true);
                    d._updateInterface();
                    d._trigger(c.jPlayer.event.ended)
                }
            }, false);
            a.addEventListener("error", function () {
                if (b.gate && !d.status.waitForLoad) {
                    d._updateButtons(false);
                    d._seeked();
                    if (d.status.srcSet) {
                        d.status.waitForLoad = true;
                        d.status.waitForPlay = true;
                        d.status.video && d.internal.video.jq.css({
                            width: "0px",
                            height: "0px"
                        });
                        d._validString(d.status.media.poster) && d.internal.poster.jq.show();
                        d.css.jq.videoPlay.length && d.css.jq.videoPlay.show();
                        d._error({
                            type: c.jPlayer.error.URL,
                            context: d.status.src,
                            message: c.jPlayer.errorMsg.URL,
                            hint: c.jPlayer.errorHint.URL
                        })
                    }
                }
            }, false);
            c.each(c.jPlayer.htmlEvent, function (f, e) {
                a.addEventListener(this, function () {
                    b.gate && !d.status.waitForLoad && d._trigger(c.jPlayer.event[e])
                }, false)
            })
        },
        _getHtmlStatus: function (a, b) {
            var d = 0,
                f = 0,
                e = 0,
                g = 0;
            d = a.currentTime;
            f = this.status.duration > 0 ? 100 * d / this.status.duration : 0;
            if (typeof a.seekable === "object" && a.seekable.length > 0) {
                e = this.status.duration > 0 ? 100 * a.seekable.end(a.seekable.length - 1) / this.status.duration : 100;
                g = 100 * a.currentTime / a.seekable.end(a.seekable.length - 1)
            } else {
                e = 100;
                g = f
            }
            if (b) f = g = d = 0;
            this.status.seekPercent = e;
            this.status.currentPercentRelative = g;
            this.status.currentPercentAbsolute = f;
            this.status.currentTime = d
        },
        _resetStatus: function () {
            this.status = c.extend({}, this.status, c.jPlayer.prototype.status)
        },
        _trigger: function (a, b, d) {
            a = c.Event(a);
            a.jPlayer = {};
            a.jPlayer.version = c.extend({}, this.version);
            a.jPlayer.status = c.extend(true, {}, this.status);
            a.jPlayer.html = c.extend(true, {}, this.html);
            a.jPlayer.flash = c.extend(true, {}, this.flash);
            if (b) a.jPlayer.error = c.extend({}, b);
            if (d) a.jPlayer.warning = c.extend({}, d);
            this.element.trigger(a)
        },
        jPlayerFlashEvent: function (a, b) {
            if (a === c.jPlayer.event.ready && !this.internal.ready) {
                this.internal.ready = true;
                this.version.flash = b.version;
                this.version.needFlash !== this.version.flash && this._error({
                    type: c.jPlayer.error.VERSION,
                    context: this.version.flash,
                    message: c.jPlayer.errorMsg.VERSION + this.version.flash,
                    hint: c.jPlayer.errorHint.VERSION
                });
                this._trigger(a)
            }
            if (this.flash.gate) switch (a) {
            case c.jPlayer.event.progress:
                this._getFlashStatus(b);
                this._updateInterface();
                this._trigger(a);
                break;
            case c.jPlayer.event.timeupdate:
                this._getFlashStatus(b);
                this._updateInterface();
                this._trigger(a);
                break;
            case c.jPlayer.event.play:
                this._seeked();
                this._updateButtons(true);
                this._trigger(a);
                break;
            case c.jPlayer.event.pause:
                this._updateButtons(false);
                this._trigger(a);
                break;
            case c.jPlayer.event.ended:
                this._updateButtons(false);
                this._trigger(a);
                break;
            case c.jPlayer.event.error:
                this.status.waitForLoad = true;
                this.status.waitForPlay = true;
                this.status.video && this.internal.flash.jq.css({
                    width: "0px",
                    height: "0px"
                });
                this._validString(this.status.media.poster) && this.internal.poster.jq.show();
                this.css.jq.videoPlay.length && this.css.jq.videoPlay.show();
                this.status.video ? this._flash_setVideo(this.status.media) : this._flash_setAudio(this.status.media);
                this._error({
                    type: c.jPlayer.error.URL,
                    context: b.src,
                    message: c.jPlayer.errorMsg.URL,
                    hint: c.jPlayer.errorHint.URL
                });
                break;
            case c.jPlayer.event.seeking:
                this._seeking();
                this._trigger(a);
                break;
            case c.jPlayer.event.seeked:
                this._seeked();
                this._trigger(a);
                break;
            default:
                this._trigger(a)
            }
            return false
        },
        _getFlashStatus: function (a) {
            this.status.seekPercent = a.seekPercent;
            this.status.currentPercentRelative = a.currentPercentRelative;
            this.status.currentPercentAbsolute = a.currentPercentAbsolute;
            this.status.currentTime = a.currentTime;
            this.status.duration = a.duration
        },
        _updateButtons: function (a) {
            this.status.paused = !a;
            if (this.css.jq.play.length && this.css.jq.pause.length) if (a) {
                this.css.jq.play.hide();
                this.css.jq.pause.show()
            } else {
                this.css.jq.play.show();
                this.css.jq.pause.hide()
            }
        },
        _updateInterface: function () {
            this.css.jq.seekBar.length && this.css.jq.seekBar.width(this.status.seekPercent + "%");
            this.css.jq.playBar.length && this.css.jq.playBar.width(this.status.currentPercentRelative + "%");
            this.css.jq.currentTime.length && this.css.jq.currentTime.text(c.jPlayer.convertTime(this.status.currentTime));
            this.css.jq.duration.length && this.css.jq.duration.text(c.jPlayer.convertTime(this.status.duration))
        },
        _seeking: function () {
            this.css.jq.seekBar.length && this.css.jq.seekBar.addClass("jp-seeking-bg")
        },
        _seeked: function () {
            this.css.jq.seekBar.length && this.css.jq.seekBar.removeClass("jp-seeking-bg")
        },
        setMedia: function (a) {
            var b = this;
            this._seeked();
            clearTimeout(this.internal.htmlDlyCmdId);
            var d = this.html.audio.gate,
                f = this.html.video.gate,
                e = false;
            c.each(this.formats, function (g, i) {
                var j = b.format[i].media === "video";
                c.each(b.solutions, function (n, k) {
                    if (b[k].support[i] && b._validString(a[i])) {
                        var l = k === "html";
                        if (j) if (l) {
                            b.html.audio.gate = false;
                            b.html.video.gate = true;
                            b.flash.gate = false
                        } else {
                            b.html.audio.gate = false;
                            b.html.video.gate = false;
                            b.flash.gate = true
                        } else if (l) {
                            b.html.audio.gate = true;
                            b.html.video.gate = false;
                            b.flash.gate = false
                        } else {
                            b.html.audio.gate = false;
                            b.html.video.gate = false;
                            b.flash.gate = true
                        }
                        if (b.flash.active || b.html.active && b.flash.gate || d === b.html.audio.gate && f === b.html.video.gate) b.clearMedia();
                        else if (d !== b.html.audio.gate && f !== b.html.video.gate) {
                            b._html_pause();
                            b.status.video && b.internal.video.jq.css({
                                width: "0px",
                                height: "0px"
                            });
                            b._resetStatus()
                        }
                        if (j) {
                            if (l) {
                                b._html_setVideo(a);
                                b.html.active = true;
                                b.flash.active = false
                            } else {
                                b._flash_setVideo(a);
                                b.html.active = false;
                                b.flash.active = true
                            }
                            b.css.jq.videoPlay.length && b.css.jq.videoPlay.show();
                            b.status.video = true
                        } else {
                            if (l) {
                                b._html_setAudio(a);
                                b.html.active = true;
                                b.flash.active = false
                            } else {
                                b._flash_setAudio(a);
                                b.html.active = false;
                                b.flash.active = true
                            }
                            b.css.jq.videoPlay.length && b.css.jq.videoPlay.hide();
                            b.status.video = false
                        }
                        e = true;
                        return false
                    }
                });
                if (e) return false
            });
            if (e) {
                if (this._validString(a.poster)) if (this.htmlElement.poster.src !== a.poster) this.htmlElement.poster.src = a.poster;
                else this.internal.poster.jq.show();
                else this.internal.poster.jq.hide();
                this.status.srcSet = true;
                this.status.media = c.extend({}, a);
                this._updateButtons(false);
                this._updateInterface()
            } else {
                this.status.srcSet && !this.status.waitForPlay && this.pause();
                this.html.audio.gate = false;
                this.html.video.gate = false;
                this.flash.gate = false;
                this.html.active = false;
                this.flash.active = false;
                this._resetStatus();
                this._updateInterface();
                this._updateButtons(false);
                this.internal.poster.jq.hide();
                this.html.used && this.require.video && this.internal.video.jq.css({
                    width: "0px",
                    height: "0px"
                });
                this.flash.used && this.internal.flash.jq.css({
                    width: "0px",
                    height: "0px"
                });
                this._error({
                    type: c.jPlayer.error.NO_SUPPORT,
                    context: "{supplied:'" + this.options.supplied + "'}",
                    message: c.jPlayer.errorMsg.NO_SUPPORT,
                    hint: c.jPlayer.errorHint.NO_SUPPORT
                })
            }
        },
        clearMedia: function () {
            this._resetStatus();
            this._updateButtons(false);
            this.internal.poster.jq.hide();
            clearTimeout(this.internal.htmlDlyCmdId);
            if (this.html.active) this._html_clearMedia();
            else this.flash.active && this._flash_clearMedia()
        },
        load: function () {
            if (this.status.srcSet) if (this.html.active) this._html_load();
            else this.flash.active && this._flash_load();
            else this._urlNotSetError("load")
        },
        play: function (a) {
            a = typeof a === "number" ? a : NaN;
            if (this.status.srcSet) if (this.html.active) this._html_play(a);
            else this.flash.active && this._flash_play(a);
            else this._urlNotSetError("play")
        },
        videoPlay: function () {
            this.play()
        },
        pause: function (a) {
            a = typeof a === "number" ? a : NaN;
            if (this.status.srcSet) if (this.html.active) this._html_pause(a);
            else this.flash.active && this._flash_pause(a);
            else this._urlNotSetError("pause")
        },
        pauseOthers: function () {
            var a = this;
            c.each(this.instances, function (b, d) {
                a.element !== d && d.data("jPlayer").status.srcSet && d.jPlayer("pause")
            })
        },
        stop: function () {
            if (this.status.srcSet) if (this.html.active) this._html_pause(0);
            else this.flash.active && this._flash_pause(0);
            else this._urlNotSetError("stop")
        },
        playHead: function (a) {
            a = this._limitValue(a, 0, 100);
            if (this.status.srcSet) if (this.html.active) this._html_playHead(a);
            else this.flash.active && this._flash_playHead(a);
            else this._urlNotSetError("playHead")
        },
        mute: function () {
            this.status.muted = true;
            this.html.used && this._html_mute(true);
            this.flash.used && this._flash_mute(true);
            this._updateMute(true);
            this._updateVolume(0);
            this._trigger(c.jPlayer.event.volumechange)
        },
        unmute: function () {
            this.status.muted = false;
            this.html.used && this._html_mute(false);
            this.flash.used && this._flash_mute(false);
            this._updateMute(false);
            this._updateVolume(this.status.volume);
            this._trigger(c.jPlayer.event.volumechange)
        },
        _updateMute: function (a) {
            if (this.css.jq.mute.length && this.css.jq.unmute.length) if (a) {
                this.css.jq.mute.hide();
                this.css.jq.unmute.show()
            } else {
                this.css.jq.mute.show();
                this.css.jq.unmute.hide()
            }
        },
        volume: function (a) {
            a = this._limitValue(a, 0, 1);
            this.status.volume = a;
            this.html.used && this._html_volume(a);
            this.flash.used && this._flash_volume(a);
            this.status.muted || this._updateVolume(a);
            this._trigger(c.jPlayer.event.volumechange)
        },
        volumeBar: function (a) {
            if (!this.status.muted && this.css.jq.volumeBar) {
                var b = this.css.jq.volumeBar.offset();
                a = a.pageX - b.left;
                b = this.css.jq.volumeBar.width();
                this.volume(a / b)
            }
        },
        volumeBarValue: function (a) {
            this.volumeBar(a)
        },
        _updateVolume: function (a) {
            this.css.jq.volumeBarValue.length && this.css.jq.volumeBarValue.width(a * 100 + "%")
        },
        _volumeFix: function (a) {
            var b = 0.0010 * Math.random();
            return a + (a < 0.5 ? b : -b)
        },
        _cssSelectorAncestor: function (a, b) {
            this.options.cssSelectorAncestor = a;
            b && c.each(this.options.cssSelector, function (d, f) {
                self._cssSelector(d, f)
            })
        },
        _cssSelector: function (a, b) {
            var d = this;
            if (typeof b === "string") if (c.jPlayer.prototype.options.cssSelector[a]) {
                this.css.jq[a] && this.css.jq[a].length && this.css.jq[a].unbind(".jPlayer");
                this.options.cssSelector[a] = b;
                this.css.cs[a] = this.options.cssSelectorAncestor + " " + b;
                this.css.jq[a] = b ? c(this.css.cs[a]) : [];
                this.css.jq[a].length && this.css.jq[a].bind("click.jPlayer", function (f) {
                    d[a](f);
                    c(this).blur();
                    return false
                });
                b && this.css.jq[a].length !== 1 && this._warning({
                    type: c.jPlayer.warning.CSS_SELECTOR_COUNT,
                    context: this.css.cs[a],
                    message: c.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.css.jq[a].length + " found for " + a + " method.",
                    hint: c.jPlayer.warningHint.CSS_SELECTOR_COUNT
                })
            } else this._warning({
                type: c.jPlayer.warning.CSS_SELECTOR_METHOD,
                context: a,
                message: c.jPlayer.warningMsg.CSS_SELECTOR_METHOD,
                hint: c.jPlayer.warningHint.CSS_SELECTOR_METHOD
            });
            else this._warning({
                type: c.jPlayer.warning.CSS_SELECTOR_STRING,
                context: b,
                message: c.jPlayer.warningMsg.CSS_SELECTOR_STRING,
                hint: c.jPlayer.warningHint.CSS_SELECTOR_STRING
            })
        },
        seekBar: function (a) {
            if (this.css.jq.seekBar) {
                var b = this.css.jq.seekBar.offset();
                a = a.pageX - b.left;
                b = this.css.jq.seekBar.width();
                this.playHead(100 * a / b)
            }
        },
        playBar: function (a) {
            this.seekBar(a)
        },
        currentTime: function () {},
        duration: function () {},
        option: function (a, b) {
            var d = a;
            if (arguments.length === 0) return c.extend(true, {}, this.options);
            if (typeof a === "string") {
                var f = a.split(".");
                if (b === h) {
                    for (var e = c.extend(true, {}, this.options), g = 0; g < f.length; g++) if (e[f[g]] !== h) e = e[f[g]];
                    else {
                        this._warning({
                            type: c.jPlayer.warning.OPTION_KEY,
                            context: a,
                            message: c.jPlayer.warningMsg.OPTION_KEY,
                            hint: c.jPlayer.warningHint.OPTION_KEY
                        });
                        return h
                    }
                    return e
                }
                e = d = {};
                for (g = 0; g < f.length; g++) if (g < f.length - 1) {
                    e[f[g]] = {};
                    e = e[f[g]]
                } else e[f[g]] = b
            }
            this._setOptions(d);
            return this
        },
        _setOptions: function (a) {
            var b = this;
            c.each(a, function (d, f) {
                b._setOption(d, f)
            });
            return this
        },
        _setOption: function (a, b) {
            var d = this;
            switch (a) {
            case "cssSelectorAncestor":
                this.options[a] = b;
                c.each(d.options.cssSelector, function (f, e) {
                    d._cssSelector(f, e)
                });
                break;
            case "cssSelector":
                c.each(b, function (f, e) {
                    d._cssSelector(f, e)
                })
            }
            return this
        },
        resize: function (a) {
            this.html.active && this._resizeHtml(a);
            this.flash.active && this._resizeFlash(a);
            this._trigger(c.jPlayer.event.resize)
        },
        _resizePoster: function () {},
        _resizeHtml: function () {},
        _resizeFlash: function (a) {
            this.internal.flash.jq.css({
                width: a.width,
                height: a.height
            })
        },
        _html_initMedia: function () {
            this.status.srcSet && !this.status.waitForPlay && this.htmlElement.media.pause();
            this.options.preload !== "none" && this._html_load();
            this._trigger(c.jPlayer.event.timeupdate)
        },
        _html_setAudio: function (a) {
            var b = this;
            c.each(this.formats, function (d, f) {
                if (b.html.support[f] && a[f]) {
                    b.status.src = a[f];
                    b.status.format[f] = true;
                    b.status.formatType = f;
                    return false
                }
            });
            this.htmlElement.media = this.htmlElement.audio;
            this._html_initMedia()
        },
        _html_setVideo: function (a) {
            var b = this;
            c.each(this.formats, function (d, f) {
                if (b.html.support[f] && a[f]) {
                    b.status.src = a[f];
                    b.status.format[f] = true;
                    b.status.formatType = f;
                    return false
                }
            });
            this.htmlElement.media = this.htmlElement.video;
            this._html_initMedia()
        },
        _html_clearMedia: function () {
            if (this.htmlElement.media) {
                this.htmlElement.media.id === this.internal.video.id && this.internal.video.jq.css({
                    width: "0px",
                    height: "0px"
                });
                this.htmlElement.media.pause();
                this.htmlElement.media.src = "";
                c.browser.msie && Number(c.browser.version) >= 9 || this.htmlElement.media.load()
            }
        },
        _html_load: function () {
            if (this.status.waitForLoad) {
                this.status.waitForLoad = false;
                this.htmlElement.media.src = this.status.src;
                try {
                    this.htmlElement.media.load()
                } catch (a) {}
            }
            clearTimeout(this.internal.htmlDlyCmdId)
        },
        _html_play: function (a) {
            var b = this;
            this._html_load();
            this.htmlElement.media.play();
            if (!isNaN(a)) try {
                this.htmlElement.media.currentTime = a
            } catch (d) {
                this.internal.htmlDlyCmdId = setTimeout(function () {
                    b.play(a)
                }, 100);
                return
            }
            this._html_checkWaitForPlay()
        },
        _html_pause: function (a) {
            var b = this;
            a > 0 ? this._html_load() : clearTimeout(this.internal.htmlDlyCmdId);
            this.htmlElement.media.pause();
            if (!isNaN(a)) try {
                this.htmlElement.media.currentTime = a
            } catch (d) {
                this.internal.htmlDlyCmdId = setTimeout(function () {
                    b.pause(a)
                }, 100);
                return
            }
            a > 0 && this._html_checkWaitForPlay()
        },
        _html_playHead: function (a) {
            var b = this;
            this._html_load();
            try {
                if (typeof this.htmlElement.media.seekable === "object" && this.htmlElement.media.seekable.length > 0) this.htmlElement.media.currentTime = a * this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length - 1) / 100;
                else if (this.htmlElement.media.duration > 0 && !isNaN(this.htmlElement.media.duration)) this.htmlElement.media.currentTime = a * this.htmlElement.media.duration / 100;
                else throw "e";
            } catch (d) {
                this.internal.htmlDlyCmdId = setTimeout(function () {
                    b.playHead(a)
                }, 100);
                return
            }
            this.status.waitForLoad || this._html_checkWaitForPlay()
        },
        _html_checkWaitForPlay: function () {
            if (this.status.waitForPlay) {
                this.status.waitForPlay = false;
                this.css.jq.videoPlay.length && this.css.jq.videoPlay.hide();
                if (this.status.video) {
                    this.internal.poster.jq.hide();
                    this.internal.video.jq.css({
                        width: this.status.width,
                        height: this.status.height
                    })
                }
            }
        },
        _html_volume: function (a) {
            if (this.html.audio.available) this.htmlElement.audio.volume = a;
            if (this.html.video.available) this.htmlElement.video.volume = a
        },
        _html_mute: function (a) {
            if (this.html.audio.available) this.htmlElement.audio.muted = a;
            if (this.html.video.available) this.htmlElement.video.muted = a
        },
        _flash_setAudio: function (a) {
            var b = this;
            try {
                c.each(this.formats, function (f, e) {
                    if (b.flash.support[e] && a[e]) {
                        switch (e) {
                        case "m4a":
                            b._getMovie().fl_setAudio_m4a(a[e]);
                            break;
                        case "mp3":
                            b._getMovie().fl_setAudio_mp3(a[e])
                        }
                        b.status.src = a[e];
                        b.status.format[e] = true;
                        b.status.formatType = e;
                        return false
                    }
                });
                if (this.options.preload === "auto") {
                    this._flash_load();
                    this.status.waitForLoad = false
                }
            } catch (d) {
                this._flashError(d)
            }
        },
        _flash_setVideo: function (a) {
            var b = this;
            try {
                c.each(this.formats, function (f, e) {
                    if (b.flash.support[e] && a[e]) {
                        switch (e) {
                        case "m4v":
                            b._getMovie().fl_setVideo_m4v(a[e])
                        }
                        b.status.src = a[e];
                        b.status.format[e] = true;
                        b.status.formatType = e;
                        return false
                    }
                });
                if (this.options.preload === "auto") {
                    this._flash_load();
                    this.status.waitForLoad = false
                }
            } catch (d) {
                this._flashError(d)
            }
        },
        _flash_clearMedia: function () {
            this.internal.flash.jq.css({
                width: "0px",
                height: "0px"
            });
            try {
                this._getMovie().fl_clearMedia()
            } catch (a) {
                this._flashError(a)
            }
        },
        _flash_load: function () {
            try {
                this._getMovie().fl_load()
            } catch (a) {
                this._flashError(a)
            }
            this.status.waitForLoad = false
        },
        _flash_play: function (a) {
            try {
                this._getMovie().fl_play(a)
            } catch (b) {
                this._flashError(b)
            }
            this.status.waitForLoad = false;
            this._flash_checkWaitForPlay()
        },
        _flash_pause: function (a) {
            try {
                this._getMovie().fl_pause(a)
            } catch (b) {
                this._flashError(b)
            }
            if (a > 0) {
                this.status.waitForLoad = false;
                this._flash_checkWaitForPlay()
            }
        },
        _flash_playHead: function (a) {
            try {
                this._getMovie().fl_play_head(a)
            } catch (b) {
                this._flashError(b)
            }
            this.status.waitForLoad || this._flash_checkWaitForPlay()
        },
        _flash_checkWaitForPlay: function () {
            if (this.status.waitForPlay) {
                this.status.waitForPlay = false;
                this.css.jq.videoPlay.length && this.css.jq.videoPlay.hide();
                if (this.status.video) {
                    this.internal.poster.jq.hide();
                    this.internal.flash.jq.css({
                        width: this.status.width,
                        height: this.status.height
                    })
                }
            }
        },
        _flash_volume: function (a) {
            try {
                this._getMovie().fl_volume(a)
            } catch (b) {
                this._flashError(b)
            }
        },
        _flash_mute: function (a) {
            try {
                this._getMovie().fl_mute(a)
            } catch (b) {
                this._flashError(b)
            }
        },
        _getMovie: function () {
            return document[this.internal.flash.id]
        },
        _checkForFlash: function (a) {
            var b = false,
                d;
            if (window.ActiveXObject) try {
                new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + a);
                b = true
            } catch (f) {} else if (navigator.plugins && navigator.mimeTypes.length > 0) if (d = navigator.plugins["Shockwave Flash"]) if (navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1") >= a) b = true;
            return c.browser.msie && Number(c.browser.version) >= 9 ? false : b
        },
        _validString: function (a) {
            return a && typeof a === "string"
        },
        _limitValue: function (a, b, d) {
            return a < b ? b : a > d ? d : a
        },
        _urlNotSetError: function (a) {
            this._error({
                type: c.jPlayer.error.URL_NOT_SET,
                context: a,
                message: c.jPlayer.errorMsg.URL_NOT_SET,
                hint: c.jPlayer.errorHint.URL_NOT_SET
            })
        },
        _flashError: function (a) {
            this._error({
                type: c.jPlayer.error.FLASH,
                context: this.internal.flash.swf,
                message: c.jPlayer.errorMsg.FLASH + a.message,
                hint: c.jPlayer.errorHint.FLASH
            })
        },
        _error: function (a) {
            this._trigger(c.jPlayer.event.error, a);
            if (this.options.errorAlerts) this._alert("Error!" + (a.message ? "\n\n" + a.message : "") + (a.hint ? "\n\n" + a.hint : "") + "\n\nContext: " + a.context)
        },
        _warning: function (a) {
            this._trigger(c.jPlayer.event.warning, h, a);
            if (this.options.errorAlerts) this._alert("Warning!" + (a.message ? "\n\n" + a.message : "") + (a.hint ? "\n\n" + a.hint : "") + "\n\nContext: " + a.context)
        },
        _alert: function (a) {
            alert("jPlayer " + this.version.script + " : id='" + this.internal.self.id + "' : " + a)
        }
    };
    c.jPlayer.error = {
        FLASH: "e_flash",
        NO_SOLUTION: "e_no_solution",
        NO_SUPPORT: "e_no_support",
        URL: "e_url",
        URL_NOT_SET: "e_url_not_set",
        VERSION: "e_version"
    };
    c.jPlayer.errorMsg = {
        FLASH: "jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",
        NO_SOLUTION: "No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",
        NO_SUPPORT: "It is not possible to play any media format provided in setMedia() on this browser using your current options.",
        URL: "Media URL could not be loaded.",
        URL_NOT_SET: "Attempt to issue media playback commands, while no media url is set.",
        VERSION: "jPlayer " + c.jPlayer.prototype.version.script + " needs Jplayer.swf version " + c.jPlayer.prototype.version.needFlash + " but found "
    };
    c.jPlayer.errorHint = {
        FLASH: "Check your swfPath option and that Jplayer.swf is there.",
        NO_SOLUTION: "Review the jPlayer options: support and supplied.",
        NO_SUPPORT: "Video or audio formats defined in the supplied option are missing.",
        URL: "Check media URL is valid.",
        URL_NOT_SET: "Use setMedia() to set the media URL.",
        VERSION: "Update jPlayer files."
    };
    c.jPlayer.warning = {
        CSS_SELECTOR_COUNT: "e_css_selector_count",
        CSS_SELECTOR_METHOD: "e_css_selector_method",
        CSS_SELECTOR_STRING: "e_css_selector_string",
        OPTION_KEY: "e_option_key"
    };
    c.jPlayer.warningMsg = {
        CSS_SELECTOR_COUNT: "The number of methodCssSelectors found did not equal one: ",
        CSS_SELECTOR_METHOD: "The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",
        CSS_SELECTOR_STRING: "The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",
        OPTION_KEY: "The option requested in jPlayer('option') is undefined."
    };
    c.jPlayer.warningHint = {
        CSS_SELECTOR_COUNT: "Check your css selector and the ancestor.",
        CSS_SELECTOR_METHOD: "Check your method name.",
        CSS_SELECTOR_STRING: "Check your css selector is a string.",
        OPTION_KEY: "Check your option name."
    }
})(jQuery);


/*
 * @author Alexander Farkas
 * v. 1.22
 */
(function ($) {
    if (!document.defaultView || !document.defaultView.getComputedStyle) {
        var e = $.curCSS;
        $.curCSS = function (a, b, c) {
            if (b === 'background-position') {
                b = 'backgroundPosition'
            }
            if (b !== 'backgroundPosition' || !a.currentStyle || a.currentStyle[b]) {
                return e.apply(this, arguments)
            }
            var d = a.style;
            if (!c && d && d[b]) {
                return d[b]
            }
            return e(a, 'backgroundPositionX', c) + ' ' + e(a, 'backgroundPositionY', c)
        }
    }
    var f = $.fn.animate;
    $.fn.animate = function (a) {
        if ('background-position' in a) {
            a.backgroundPosition = a['background-position'];
            delete a['background-position']
        }
        if ('backgroundPosition' in a) {
            a.backgroundPosition = '(' + a.backgroundPosition
        }
        return f.apply(this, arguments)
    };

    function toArray(a) {
        a = a.replace(/left|top/g, '0px');
        a = a.replace(/right|bottom/g, '100%');
        a = a.replace(/([0-9\.]+)(\s|\)|$)/g, "$1px$2");
        var b = a.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
        return [parseFloat(b[1], 10), b[2], parseFloat(b[3], 10), b[4]]
    }
    $.fx.step.backgroundPosition = function (a) {
        if (!a.bgPosReady) {
            var b = $.curCSS(a.elem, 'backgroundPosition');
            if (!b) {
                b = '0px 0px'
            }
            b = toArray(b);
            a.start = [b[0], b[2]];
            var c = toArray(a.end);
            a.end = [c[0], c[2]];
            a.unit = [c[1], c[3]];
            a.bgPosReady = true
        }
        var d = [];
        d[0] = ((a.end[0] - a.start[0]) * a.pos) + a.start[0] + a.unit[0];
        d[1] = ((a.end[1] - a.start[1]) * a.pos) + a.start[1] + a.unit[1];
        a.elem.style.backgroundPosition = d[0] + ' ' + d[1]
    }
})(jQuery);



/* Theme Scripts */
jQuery(document).ready(function(){
	jQuery('.search_line input:text').each(function(i){
		jQuery(this).focus(function(){
			if (jQuery(this).val() == 'enter keywords'){
				jQuery(this).val('');
			}
		});
		jQuery(this).blur(function(){
			if (jQuery(this).val() == '' || jQuery(this).val() == ' '){
				jQuery(this).val('enter keywords');
			}
		});
	}); //Search
	
	jQuery('#contactwidget input#wname').each(function(i){
		jQuery(this).focus(function(){
			if (jQuery(this).val() == 'Name'){
				jQuery(this).val('');
			}
		});
		jQuery(this).blur(function(){
			if (jQuery(this).val() == '' || jQuery(this).val() == ' '){
				jQuery(this).val('Name');
			}
		});
	}); //Contact Widget Name
	
	jQuery('#contactwidget input#wemail').each(function(i){
		jQuery(this).focus(function(){
			if (jQuery(this).val() == 'Email'){
				jQuery(this).val('');
			}
		});
		jQuery(this).blur(function(){
			if (jQuery(this).val() == '' || jQuery(this).val() == ' '){
				jQuery(this).val('Email');
			}
		});
	}); //Contact Widget Email
	
	jQuery('#contactwidget textarea#wmessage').each(function(i){
		jQuery(this).focus(function(){
			if (jQuery(this).val() == 'Quick Message'){
				jQuery(this).val('');
			}
		});
		jQuery(this).blur(function(){
			if (jQuery(this).val() == '' || jQuery(this).val() == ' '){
				jQuery(this).val('Quick Message');
			}
		});
	}); //Contact Widget Message
	
	jQuery('ul.sitemap>li>a').css('background', 'none').wrap('<h6>');
	jQuery('a.marker').hover(function(){
		jQuery(this).stop().animate({paddingRight:'20px'}, 150);
	}, function(){
		jQuery(this).stop().animate({paddingRight:'15px'}, 150);
	});
	
	jQuery('ul.tour a').hover(function(){
		jQuery(this).stop().animate({paddingRight:'5px'}, 200);
	}, function(){
		jQuery(this).stop().animate({paddingRight:'0px'}, 200);
	});
	
	jQuery('.widget_links li a').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'5px 13px'}, 200);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 13px'}, 200);
	});
	
	jQuery('ul.marker_left li').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'5px 13px'}, 200);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 13px'}, 200);
	});
	
	jQuery('.widget_custom_tweets_entries li').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'5px 9px'}, 200);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 9px'}, 200);
	});
	
	jQuery('h6.marker').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'4px 9px'}, 150);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 9px'}, 150);
	});
	
	jQuery('a.marker_left').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'5px 6px'}, 200);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 6px'}, 200);
	});
	
	jQuery('.map li a').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'5px 5px'}, 200);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 5px'}, 200);
	});
	
	jQuery('a.marker_2').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 5px'}, 150);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'3px 5px'}, 150);
	});
	
	jQuery('div.jp-type-playlist div.jp-playlist li').hover(function(){
		jQuery(this).stop().animate({backgroundPosition:'5px 17px'}, 200);
	}, function(){
		jQuery(this).stop().animate({backgroundPosition:'0px 17px'}, 200);
	});
});



/* Images Hover Effect */
jQuery(document).ready(function(){
	var $container = jQuery('.image_shadow_container');
	$container.each(function(){
		jQuery('a.preloader').hover(function(){
			jQuery(this).stop().animate({top:'-10px'}, 200);
		}, function(){
			jQuery(this).stop().animate({top:'0'}, 200);
		});
		jQuery('a.preloader2').hover(function(){
			jQuery(this).stop().animate({top:'-10px'}, 200);
		}, function(){
			jQuery(this).stop().animate({top:'0'}, 200);
		});
		jQuery('a img.image_shadow').hover(function(){
			jQuery(this).stop().animate({top:'-10px'}, 200);
		}, function(){
			jQuery(this).stop().animate({top:'0'}, 200);
		});
	}); 
});



/* Header Line Show/Hide */
jQuery(document).ready(function(){
	jQuery('.header_plus').toggle(function(){
		closeAnimationPositions = [0, 1, 2, 3, 4, 5, 6];
		var positions = closeAnimationPositions.slice(0);
		jQuery(positions).each(function(i, position){
			var offset = position * -18;
			setTimeout(function() {
				jQuery('.header_plus').find('span').css({ backgroundPosition: "0 " + offset + "px" });
			}, i * 75);
		});
		jQuery('ul.header_list').slideDown(500);
		return false;
	}, function(){
		closeAnimationPositions = [6, 5, 4, 3, 2, 1, 0];
		var positions = closeAnimationPositions.slice(0);
		jQuery(positions).each(function(i, position){
			var offset = position * -18;
			setTimeout(function() {
				jQuery('.header_plus').find('span').css({ backgroundPosition: "0 " + offset + "px" });
			}, i * 75);
		});
		jQuery('ul.header_list').slideUp(500);
		return false;
	});
});



/* Flickr Lightbox */
jQuery(document).ready(function() {
	jQuery('#flickr .flickr_badge_image a, .cmsmasters_flickr_widget .flickr_badge_image a').each(function(i){
		var src = jQuery(this).find('img').attr('src');
		var title = jQuery(this).find('img').attr('title');
		var src2 = src.replace(/_s.jpg/g, '.jpg');
		jQuery(this).removeAttr('href');
		jQuery(this).attr({
			href: src2,
			title: title,
			rel: 'prettyPhoto[flickr_gal]'
		});
	});
});



/* Scroll Top */
jQuery(document).ready(function(){
	jQuery('.divider a').click(function(){
		jQuery('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});
});



/* Toggle */
jQuery(document).ready(function(){
	jQuery('.togg h6.tog').click(function(i){
		var dropDown = jQuery(this).parent().find('.tab_content');
		jQuery(this).parent().find('.tab_content').not(dropDown).slideUp();
		if (jQuery(this).hasClass('current')){
			jQuery(this).removeClass('current');
		} else { 
			jQuery(this).addClass('current');
		}
		dropDown.stop(false,true).slideToggle().css({display:'block'});
		i.preventDefault();
	})
});



/* Accordion */
jQuery(document).ready(function(){
	jQuery('.accordion h6.tog').click(function(i){
		if (jQuery(this).hasClass('current')){ 
			jQuery(this).removeClass('current');
		} else { 
			jQuery(this).parent().parent().find('.tog').removeClass('current');
			jQuery(this).addClass('current');
		}
		var dropDown = jQuery(this).parent().find('.tab_content');
		jQuery(this).parent().parent().find('.tab_content').not(dropDown).slideUp();
		dropDown.stop(false,true).slideToggle().css({display:'block'});
		i.preventDefault();
	})
});



/* Tabs */
jQuery(document).ready(function(){
	jQuery('.tab ul.tabs li:first-child a').addClass('current');
	jQuery('.tab .tab_content div.tabs_tab:first-child').show();
	jQuery('.tab ul.tabs li a').click(function(e){
		$tab = jQuery(this).parent().parent().parent();
		$tab.find('ul.tabs').find('a').removeClass('current');
		jQuery(this).addClass('current');
		var $index = jQuery(this).parent().index();
		$tab.find('.tab_content').find('div.tabs_tab').not('div.tabs_tab:eq('+$index+')').slideUp();
		$tab.find('.tab_content').find('div.tabs_tab:eq('+$index+')').slideDown();
		e.preventDefault();
	})
});



/* Tour */
jQuery(document).ready(function(){
	jQuery('.tour_content ul.tour li:first-child').addClass('current');
	jQuery('.tour_content div.tour_box:first').show();
	jQuery('.tour_content ul.tour li a').click(function(e){
		$tour = jQuery(this).parent().parent().parent();
		$tour.find('ul.tour').find('li').removeClass('current');
		jQuery(this).parent().addClass('current');
		var $index = jQuery('ul.tour li').index(jQuery(this).parent());
		$tour.find('div.tour_box').not('div.tour_box:eq('+$index+')').slideUp();
		$tour.find('div.tour_box:eq('+$index+')').slideDown();
		e.preventDefault();
	})
});



/* Popular and Latest Posts */
jQuery(document).ready(function(){
	jQuery('.related_posts ul li a').click(function(e){
		$rposts = jQuery(this).parent().parent().parent();
		$rposts.find('ul').find('a').removeClass('current');
		jQuery(this).addClass('current');
		var $index = jQuery(this).parent().index();
		$rposts.find('div.related_posts_content').not('div.related_posts_content:eq('+$index+')').slideUp();
		$rposts.find('div.related_posts_content:eq('+$index+')').slideDown();
		e.preventDefault();
	})
});



/* Pretty Photo Lighbox */
jQuery(document).ready(function(){
	jQuery('a[rel^="prettyPhoto"]').prettyPhoto({ animationSpeed:'normal', deeplinking:false, social_tools:'' });
});



/* Image Preloader */
jQuery(function(){
	var $imgContainerClassG = '.portfolio.gallery .post';
	var $images = jQuery($imgContainerClassG+' a img.image_shadow');
	var $max = $images.length;
	jQuery('.image_shadow_container a.preloader2').each(function(){
		jQuery('<span class="image_shadow_container_img" />').prependTo(jQuery(this));
	});
	$images.remove();
	if ($max > 0){
		LoadImage(0, $max);
	}
	
	function LoadImage(index, $max){
		if (index < $max){
			jQuery('<span id="img'+(index+1)+'" class="p_img_container" />').each(function(){
				jQuery(this).prependTo(jQuery('.post .image_shadow_container a.preloader2 .image_shadow_container_img').eq(index));
			});
			var $img = new Image();
			var $curr = jQuery('#img'+(index+1));
			jQuery($img).load(function(){
				jQuery($curr).append(this);
				jQuery(this).animate({opacity: 1}, 200, 'easeInOutSine', function(){
					jQuery(this).parent().parent().css({backgroundImage: 'none'});
					if (index != ($max-1)){
						LoadImage(index+1, $max);
					}
				});
			}).error(function(){
				jQuery($curr).remove();
				LoadImage(index+1, $max);
			}).attr({
				src: jQuery($images[index]).attr('src'), 
				title: jQuery($images[index]).attr('title'), 
				alt: jQuery($images[index]).attr('alt')
			}).addClass(jQuery($images[index]).attr('class'));
		}
		
		if (index == ($max-1)){
			if (jQuery('#middle #home').find('.p_options_block').html() != null){
				LoadSorting2();
			}
		}
	}
	
	function LoadSorting2(){
		if (jQuery.browser.msie && jQuery.browser.version < 9){
			jQuery('.p_options_loader').css({display:'none'});
			jQuery('.p_options_block').css({display:'block'});
		} else {
			jQuery('.p_options_loader').css({display:'none'});
			jQuery('.portfolio').cmsmasters_portfolio_sort({items:'.post'});
		}
	}
});

jQuery(function(){
	var $imgContainerClass = '.portfolio';
	var $images = jQuery($imgContainerClass+':not(.gallery) .post a img.image_shadow');
	var $max = $images.length;
	jQuery('.image_shadow_container a.preloader').each(function(){
		jQuery('<span class="image_shadow_container_img" />').prependTo(jQuery(this));
	});
	$images.remove();
	if ($max > 0){
		LoadImage(0, $max);
	}
	
	function LoadImage(index, $max){
		if (index < $max){
			jQuery('<span id="img'+(index+1)+'" class="p_img_container" />').each(function(){
				jQuery(this).prependTo(jQuery('.post .image_shadow_container a.preloader .image_shadow_container_img').eq(index));
			});
			var $img = new Image();
			var $curr = jQuery('#img'+(index+1));
			jQuery($img).load(function(){
				jQuery($curr).append(this);
				jQuery(this).animate({opacity: 1}, 200, 'easeInOutSine', function(){
					jQuery(this).parent().parent().css({backgroundImage: 'none'});
					if (index != ($max-1)){
						LoadImage(index+1, $max);
					}
				});
			}).error(function(){
				jQuery($curr).remove();
				LoadImage(index+1, $max);
			}).attr({
				src: jQuery($images[index]).attr('src'), 
				title: jQuery($images[index]).attr('title'), 
				alt: jQuery($images[index]).attr('alt')
			}).addClass(jQuery($images[index]).attr('class'));
		}
		
		if (index == ($max-1)){
			if (jQuery('#middle #home').find('.p_options_block').html() != null){
				LoadSorting();
			}
		}
	}
	
	function LoadSorting(){
		if (jQuery.browser.msie && jQuery.browser.version < 9){
			jQuery('.p_options_loader').css({display:'none'});
			jQuery('.p_options_block').css({display:'block'});
		} else {
			jQuery('.p_options_loader').css({display:'none'});
			jQuery('.portfolio').cmsmasters_portfolio_sort({items:'.post'});
		}
	}
});



/* Portfolio Sorting by Browser */
if (jQuery.browser.msie && jQuery.browser.version < 9){

	/* Portfolio Filter */
	jQuery(document).ready(function(){
		var newFilter = '', $p_item_width = 0, $p_item_all_count = 0, $p_item_count = 0, $p_item_number = 0, i = 0, j = 0, newFilterText = '';
		jQuery('ul.p_filter li:first-child a').addClass('current');
		jQuery('.p_cat_filter').attr({name: jQuery('ul.p_filter li.current a').attr('name')});
		jQuery('ul.p_filter li a').click(function(){
			newFilter = jQuery(this).attr('name');
			newFilterText = jQuery(this).text();
			jQuery('.p_cat_filter').text(newFilterText).attr({name: newFilter});
			jQuery('.portfolio div.fl').each(function(i){
				jQuery(this).removeClass('fl');
			});
			jQuery('.portfolio div.cl').each(function(i){
				jQuery(this).remove();
			});
			if (jQuery('.portfolio').hasClass('four_blocks')){
				$p_item_width = 220;
				$p_item_count = 4;
			} else {
				if (jQuery('.portfolio').hasClass('three_blocks')){
					$p_item_width = 300;
					$p_item_count = 3;
				} else {
					if (jQuery('.portfolio').hasClass('two_blocks')){
						$p_item_width = 460;
						$p_item_count = 2;
					} else {
						$p_item_width = 940;
						$p_item_count = 1;
					}
				}
			}
			jQuery('ul.p_filter li a').removeClass('current').css('display', 'block');
			jQuery(this).addClass('current');
			jQuery('.post').not('.'+newFilter).animate({width: 0, paddingRight: 0}, 500, function(){
				jQuery(this).css({display: 'none'});
			});
			jQuery('.post').not('.gallery').find('a').find('img').parent().parent().not(jQuery(this).attr({rel: 'prettyPhoto[portfolio]'})).attr({rel: 'prettyPhoto[portfolio]'});
			jQuery('.'+newFilter).not('.gallery').find('a').find('img').parent().parent().attr({rel: 'prettyPhoto[portfolio'+newFilter+']'});
			jQuery('.'+newFilter).animate({width: $p_item_width, paddingRight: '20px'}, 500, function(){
				jQuery(this).css({display: 'block'});
			});
			$p_item_all_count = jQuery('.'+newFilter).length;
			j = Math.floor($p_item_all_count/$p_item_count)+1;
			i = 1;
			while (i < j){
				$p_item_number = ($p_item_count * i) - 1;
				jQuery('.'+newFilter).eq($p_item_number).after('<div class="cl" />');
				i++
			}
			return false;
		});
		
		var $p_filter_height = '';
		jQuery('.p_filter_container').hover(function(){
			jQuery(this).find('.p_cat_filter').addClass('hover');
			$p_filter_height = jQuery(this).find('ul.p_filter li').length * 28;
			jQuery(this).find('ul.p_filter').stop().animate({height: $p_filter_height + 'px', paddingTop: '5px', paddingBottom: '5px'}, 250);
		}, function(){
			jQuery(this).find('ul.p_filter').stop().animate({height: 0, paddingTop: 0, paddingBottom: 0}, 250);
			jQuery(this).find('.p_cat_filter').removeClass('hover');
		});
		
		jQuery('.p_cat_filter').click(function(){
			return false;
		});
	});



	/* Portfolio Sort */
	jQuery.fn.sort = (function(){
		var sort = [].sort;
		return function(comparator, getSortable){
			getSortable = getSortable || function(){ return this; };
			var placements = this.map(function(){
				var sortElement = getSortable.call(this),
				parentNode = sortElement.parentNode,
				nextSibling = parentNode.insertBefore(
					document.createTextNode(''),
					sortElement.nextSibling
				);
				return function(){
					if (parentNode === this){
						throw new Error("You can't sort elements if any one is a descendant of another.");
					}
					parentNode.insertBefore(this, nextSibling);
					parentNode.removeChild(nextSibling);
				};
			});
			return sort.call(this, comparator).each(function(i){
				placements[i].call(getSortable.call(this));
			});
		};
	})();

	jQuery(document).ready(function(){
		var $date = jQuery('.p_sort a[name="p_date"]'), $name = jQuery('.p_sort a[name="p_name"]'), $p_item = jQuery('.portfolio .post'), inverse = false;
		$name.click(function(){
			jQuery('.portfolio').fadeTo(100, 0.25, function(){
				$p_item.sort(function(a, b){
					a = jQuery(a).find('.p_name').text();
					b = jQuery(b).find('.p_name').text();
					return ( isNaN(a) || isNaN(b) ? a < b : +a < +b ) ? inverse ? -1 : 1 : inverse ? 1 : -1;
				});
				jQuery(this).fadeTo(300, 1);
			});
			$date.removeClass('current').removeClass('reversed');
			if (jQuery(this).hasClass('current') && jQuery(this).hasClass('reversed')){
				jQuery(this).removeClass('reversed');
			} else if (jQuery(this).hasClass('current')){
				jQuery(this).addClass('reversed');
			} else {
				jQuery(this).addClass('current').addClass('reversed');
			}
			inverse = !inverse;
			return false;
		});
		$date.click(function(){
			jQuery('.portfolio').fadeTo(100, 0.25, function(){
				$p_item.sort(function(a, b){
					a = jQuery(a).find('.p_date').text();
					b = jQuery(b).find('.p_date').text();
					return ( isNaN(a) || isNaN(b) ? a > b : +a < +b ) ? inverse ? -1 : 1 : inverse ? 1 : -1;
				});			
				jQuery(this).fadeTo(300, 1);
			});
			$name.removeClass('current').removeClass('reversed');
			if (jQuery(this).hasClass('current') && jQuery(this).hasClass('reversed')){
				jQuery(this).removeClass('reversed');
			} else if (jQuery(this).hasClass('current')){
				jQuery(this).addClass('reversed');
			} else {
				jQuery(this).addClass('current').addClass('reversed');
			}
			inverse = !inverse;
			return false;
		});
	});

} else {

	/* Portfolio Filter Dropdown */
	jQuery(document).ready(function(){
		var $p_filter_height = '';
		jQuery('ul.p_filter li:first-child a').addClass('current');
		jQuery('.p_cat_filter').attr({name: jQuery('ul.p_filter li a.current').attr('name')});
		
		jQuery('ul.p_filter li a').click(function(){
			newFilter = jQuery(this).attr('name');
			newFilterText = jQuery(this).text();
			jQuery('.p_cat_filter').text(newFilterText).attr({title:newFilterText}).attr({name:newFilter});
		});
		
		jQuery('.p_filter_container').hover(function(){
			jQuery(this).find('.p_cat_filter').addClass('hover');
			$p_filter_height = jQuery(this).find('ul.p_filter li').length * 28;
			jQuery(this).find('ul.p_filter').stop().animate({height: $p_filter_height + 'px', paddingTop: '5px', paddingBottom: '5px'}, 250);
		}, function(){
			jQuery(this).find('ul.p_filter').stop().animate({height: 0, paddingTop: 0, paddingBottom: 0}, 250);
			jQuery(this).find('.p_cat_filter').removeClass('hover');
		});
		
		jQuery('.p_cat_filter').click(function(){
			return false;
		});
	});



	/* Portfolio Sorting and Filtering */
	(function($){
		$.fn.cmsmasters_portfolio_sort = function(options){
			var defaults = {
				items:'.item',
				navContainer:'.p_sort_block',
				filterNav:'.p_filter',
				sortNav:'.p_sort'
			};
			var options = $.extend(defaults, options);
			
			return this.each(function(){
				var container = $(this),
					navContainer = $(options.navContainer),
					nav = navContainer.find('a:not(.p_cat_filter)'),
					items = container.find(options.items),
					itemPadding = parseInt(items.css('paddingBottom')),
					itemMargin = parseInt(items.css('marginBottom')),
					columns = 0,
					coordinates = new Array(),
					animationArray = new Array(),
					columnPlus = new Array();
					
				container.methods = {
					preloadingDone:function(){
						if (navContainer.length > 0 && !($.browser.msie && $.browser.version < 7)){	
							container.css('height',container.height());
							items.each(function(){
								var item = $(this),
									itemPos = item.position();
								
								coordinates.push(itemPos); 
							}).each(function(i){
								var item = $(this);
								
								item.css({position:'absolute', top:coordinates[i].top+'px', left:coordinates[i].left+'px'});
							});
							
							for (i = 0; i < coordinates.length; i++){
								if (coordinates[i].top == coordinates[0].top){
									columns++;
								}
							}
							
							navContainer.parent().css({opacity:0, display:'block'}).animate({opacity:1}, 500, 'easeInOutSine');
							container.methods.bindfunctions();
						}
					},
					
					bindfunctions:function(){
						nav.click(function(){
							var clickedElement = $(this),
								elementFilter = this.name;
								
							animationArray = new Array();
							if (clickedElement.parent().is(options.sortNav)){
								clickedElement.parent().find('.current').removeClass('current');
							} else {
								clickedElement.parent().parent().find('.current').removeClass('current');							
							}
							this.className += ' current';
							
							if (clickedElement.parent().parent('ul').is(options.filterNav)){
								var arrayIndex = 0,
									columnIndex = 0;
								
								columnPlus = new Array();
								items.each(function(i){
									var item = $(this);
									
									if (item.is('.'+elementFilter)){	
										animationArray.push({
											element:item, 
											animation:{ 
												opacity:1,
												top:coordinates[arrayIndex].top,
												left:coordinates[arrayIndex].left
											},
											height:item.height()
										});
										
										if (columnTop < coordinates[arrayIndex].top){
											columnTop = coordinates[arrayIndex].top;
										}
										
										columnIndex++;
										arrayIndex++;
									} else {
										animationArray.push({
											element:item,
											animation:{
												opacity:0,
												top:0
											},
											callback:true
										});
									}
									
									if (items.length == i+1 || columnIndex == columns){	
										var columnTop = 0;
										
										for (x = 0; x < columnIndex; x++){
											if (animationArray[i-x].height){
												if (columnTop < animationArray[i-x].height){
													columnTop = animationArray[i-x].height;
												}
											} else {
												columnIndex++;
											}
										}
										
										columnPlus.push(columnTop);
										columnIndex = 0;
									}
									
									if (items.length == i+1){
										container.methods.startAnimation();
									}
								});
							} else {
								var sortitems = items.get(),
									reversed = false;
								
								if (clickedElement.hasClass('reversed') && clickedElement.hasClass('current')){ 
									reversed = true;
									clickedElement.removeClass('reversed');
								} else {
									$(options.sortNav).find('a').removeClass('reversed');
									clickedElement.addClass('reversed');
								}
								
								sortitems.sort(function(a, b){
									var compA = $(a).find('.'+elementFilter).text().toUpperCase();
									var compB = $(b).find('.'+elementFilter).text().toUpperCase();
									
									if (reversed){
										return (compA < compB) ? 1 : (compA > compB) ? -1 : 0;				
									} else {
										return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
									}
								});
								
								items = $(sortitems);
								$(options.filterNav).find('.current').trigger('click');
							}
							
							return false;
						});
					},
					
					startAnimation:function(){	
						var heightmodifier = coordinates[0].top,
							visibleElement = 0,
							currentCol = 0;
						
						for (i = 0; i < animationArray.length; i++){
							
							if (animationArray[i].animation.top){
								if (visibleElement % columns == 0 && visibleElement != 0){
									heightmodifier += columnPlus[currentCol] + itemPadding + itemMargin;
									currentCol++;
								}
								
								visibleElement++;
							}
							
							animationArray[i].element.css({display:'block'}).animate(animationArray[i].animation, 800, 'easeInOutExpo', (function(i){
								return function(){
									if (animationArray[i].callback == true){
										animationArray[i].element.css({display:'none'});
									}
								}
							})(i));
						}
						
						var newContainerHeight = coordinates[0].top;
						
						for (z = 0; z < columnPlus.length; z++){
							newContainerHeight += columnPlus[z] + itemMargin;
						}
						
						container.animate({height:newContainerHeight}, 800, 'easeInOutSine');
					}
				}
				container.methods.preloadingDone();
			});
		}
	})(jQuery);

}



/* Form */
function submitform() {
    document.forms['commentform'].submit();
	return false;
};



/* Contact Form */
function checkemail(emailaddress){
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); 
	return pattern.test(emailaddress); 
}

jQuery(document).ready(function(){ 
	jQuery('#contactform a#formsend').click(function(){
		var $name 	= jQuery('#name').val();
		var $email 	= jQuery('#email').val();
		var $subject = jQuery('#subject').val();
		var $url = jQuery('#url').val();
		var $message = jQuery('#message').val();
		var $contactemail = jQuery('#contactemail').val();
		var $contacturl = jQuery('#contacturl').val();
		var $mywebsite = jQuery('#contactwebsite').val();
		
		if ($name != '' && $name.length < 3){ $nameshort = true; } else { $nameshort = false; }
		if ($name != '' && $name.length > 30){ $namelong = true; } else { $namelong = false; }
		if ($email != '' && checkemail($email)){ $emailerror = true; } else { $emailerror = false; }
		if ($subject != '' && $subject.length < 3){ $subjectshort = true; } else { $subjectshort = false; }
		if ($subject != '' && $subject.length > 100){ $subjectlong = true; } else { $subjectlong = false; }
		if ($url == ''){ $url = 'none'; }
		if ($message != '' && $message.length < 3){ $messageshort = true; } else { $messageshort = false; }
		
		jQuery('#contactform .loading').animate({opacity: 1}, 250);
		
		if ($name != '' && $nameshort != true && $namelong != true && $email != '' && $emailerror != false && $subject != '' && $subjectshort != true && $subjectlong != true && $message != '' && $messageshort != true && $contactemail != '' && $contacturl != '' && $mywebsite != ''){ 
			jQuery.post($contacturl, 
				{type: 'form', contactemail: $contactemail, name: $name, email: $email, subject: $subject, website: $url, message: $message, mywebsite: $mywebsite}, 
				function(data){
					jQuery('#contactform .loading').animate({opacity: 0}, 250);
					jQuery('.entry div.contform').fadeOut('slow');
					jQuery('#name, #subject, #url, #email, #message').val('');
					jQuery('#contactform div.form_info div.form_error').hide();
					jQuery('.entry .box').hide();
					jQuery('.entry .info_box').fadeIn('fast');
					jQuery('html, body').animate({scrollTop:250}, 'slow');
					jQuery('.entry .info_box').delay(5000).fadeOut(1000, function(){ 
						jQuery('.entry div.contform').fadeIn('slow');
					});
				}
			);
			
			return false;
		} else {
			jQuery('#contactform .loading').animate({opacity: 0}, 250);
			jQuery('.entry .box').hide();
			jQuery('.entry .error_box').fadeIn('fast');
			jQuery('html, body').animate({scrollTop:250}, 'slow');
			jQuery('.entry .error_box').delay(5000).fadeOut('slow');
			
			if ($name == ''){ 
				jQuery('#name').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#name').parent().parent().parent().find('div.defaulterror').show(); 
			} else if ($nameshort == true){ 
				jQuery('#name').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#name').parent().parent().parent().find('div.shorterror').show(); 
			} else if ($namelong == true){ 
				jQuery('#name').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#name').parent().parent().parent().find('div.longerror').show(); 
			} else { 
				jQuery('#name').parent().parent().parent().find('div.form_error').hide();
			}
			
			if ($email == ''){ 
				jQuery('#email').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#email').parent().parent().parent().find('div.defaulterror').show(); 
			} else if ($emailerror == false){ 
				jQuery('#email').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#email').parent().parent().parent().find('div.invaliderror').show(); 
			} else { 
				jQuery('#email').parent().parent().parent().find('div.form_error').hide(); 
			}
			
			if ($subject == ''){ 
				jQuery('#subject').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#subject').parent().parent().parent().find('div.defaulterror').show(); 
			} else if ($subjectshort == true){ 
				jQuery('#subject').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#subject').parent().parent().parent().find('div.shorterror').show(); 
			} else if ($subjectlong == true){ 
				jQuery('#subject').parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#subject').parent().parent().parent().find('div.longerror').show(); 
			} else { 
				jQuery('#subject').parent().parent().parent().find('div.form_error').hide(); 
			}
			
			if ($message == ''){ 
				jQuery('#message').parent().parent().parent().parent().parent().find('div.form_error').hide(); 
				jQuery('#message').parent().parent().parent().parent().parent().find('div.defaulterror').show(); 
			} else if ($messageshort == true){ 
				jQuery('#message').parent().parent().parent().parent().parent().find('div.form_error').hide();
				jQuery('#message').parent().parent().parent().parent().parent().find('div.shorterror').show(); 
			} else { 
				jQuery('#message').parent().parent().parent().parent().parent().find('div.form_error').hide();
			}
			
			return false;
		}
	});
});

jQuery(document).ready(function(){ 
	jQuery('#contactwidget a#wformsend').click(function(){ 
		var $name 	= jQuery('#wname').val();
		var $email 	= jQuery('#wemail').val();
		var $message = jQuery('#wmessage').val();
		var $contactemail = jQuery('#wcontactemail').val();
		var $contacturl = jQuery('#wcontacturl').val();
		var $mywebsite 	= jQuery('#wcontactwebsite').val();
		
		if ($name != '' && $name.length < 3){ $nameshort = true; } else { $nameshort = false; }
		if ($name != '' && $name.length > 30){ $namelong = true; } else { $namelong = false; }
		if ($email != '' && checkemail($email)){ $emailerror = true; } else { $emailerror = false; }
		if ($message != '' && $message.length < 3){ $messageshort = true; } else { $messageshort = false; }
		
		jQuery('#contactwidget .loading').animate({opacity: 1}, 250);
		
		if ($name != '' && $nameshort != true && $namelong != true && $email != '' && $emailerror != false && $message != '' && $messageshort != true && $contactemail != '' && $contacturl != '' && $mywebsite != ''){ 
			jQuery.post($contacturl, 
				{type: 'widget', contactemail: $contactemail, name: $name, email: $email, message: $message, mywebsite: $mywebsite}, 
				function(data){
					jQuery('#contactwidget .loading').animate({opacity: 0}, 250);
					jQuery('.form').fadeOut();
					jQuery('#bottom #wname, #bottom #wemail, #bottom #wmessage').css({'border-bottom':'0'});
					jQuery('.widgeterror').hide();
					jQuery('.widgetinfo').fadeIn('slow');
					jQuery('.widgetinfo').delay(5000).fadeOut(1000, function(){ 
						jQuery('#wname').val(jQuery('#wname').attr('alt'));
						jQuery('#wemail').val(jQuery('#wemail').attr('alt'));
						jQuery('#wmessage').val(jQuery('#wmessage').attr('title'));
						jQuery('.form').fadeIn('slow');
					});
				}
			);
			
			return false;
		} else {
			jQuery('#contactwidget .loading').animate({opacity: 0}, 250);
			jQuery('.widgeterror').hide();
			jQuery('.widgeterror').fadeIn('fast');
			jQuery('.widgeterror').delay(5000).fadeOut(1000);
			
			if ($name == '' || $nameshort == true || $namelong == true){ 
				jQuery('#wname').css({'border-bottom':'1px solid #dd2200'}); 
			} else { 
				jQuery('#bottom #wname').css({'border-bottom':'0'}); 
			}
			
			if ($email == '' || $emailerror == false){ 
				jQuery('#wemail').css({'border-bottom':'1px solid #dd2200'}); 
			} else { 
				jQuery('#bottom #wemail').css({'border-bottom':'0'}); 
			}
			
			if ($message == '' || $messageshort == true){ 
				jQuery('#wmessage').css({'border-bottom':'1px solid #dd2200'}); 
			} else { 
				jQuery('#bottom #wmessage').css({'border-bottom':'0'}); 
			}
			
			return false;
		}
	});
});



/* IE Fixes */
if (jQuery.browser.msie && jQuery.browser.version < 9){
	jQuery(document).ready(function(){
		jQuery('#ul.header_list li:last-child').css({'background':'none', 'padding-right':'0px'}); // Header Top Line
		jQuery('#navigation li:last-child').css('background-image', 'none'); // Navigation
		jQuery('#navigation li.nav_marker:last-child').css({'background-image':'url(../images/nav_marker.png)', 'background-position':'160px 13px'}); // Navigation
		jQuery('#navigation li.current_page_item.nav_marker:last-child').css({'background-image':'url(../images/nav_marker.png)', 'background-position':'160px -38px'}); // Navigation
		jQuery('#navigation li.nav_marker:last-child').hover(function(){
			jQuery(this).css({'background-position':'160px -38px'});
		}, function(){
			jQuery(this).css({'background-position':'160px 13px'});
		}); // Navigation
	});
};



if (jQuery.browser.msie && jQuery.browser.version < 8){
	jQuery(document).ready(function(){
		jQuery('blockquote').each(function(i){
			jQuery(this).wrap('<div class="blockquote_container" />');
			jQuery(this).before('<span class="blockquote_img quotation" />');
			jQuery(this).parent().find('.blockquote_img').html('&ldquo;');
		});	// Blockquote
		
		jQuery('code').each(function(i){
			jQuery(this).wrap('<div class="code" />');
			jQuery(this).before('<div class="code_inner" />');
			jQuery(this).parent().find('.code_inner').html('<span>code</span>');
		});	// Code
	});
};

