/*
 * Poshy Tip jQuery plugin v1.0
 * http://vadikom.com/tools/poshy-tip-jquery-plugin-for-stylish-tooltips/
 * Copyright 2010, Vasil Dinkov, http://vadikom.com/
 */

(function(e){var a=[],d=/^url\(["']?([^"'\)]*)["']?\);?$/i,c=/\.png$/i,b=e.browser.msie&&e.browser.version==6;function f(){e.each(a,function(){this.refresh(true)})}e(window).resize(f);e.Poshytip=function(h,g){this.$elm=e(h);this.opts=e.extend({},e.fn.poshytip.defaults,g);this.$tip=e(['<div class="',this.opts.className,'">','<div class="tip-inner tip-bg-image"></div>','<div class="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left"></div>',"</div>"].join(""));this.$arrow=this.$tip.find("div.tip-arrow");this.$inner=this.$tip.find("div.tip-inner");this.disabled=false;this.init()};e.Poshytip.prototype={init:function(){a.push(this);this.$elm.data("title.poshytip",this.$elm.attr("title")).data("poshytip",this);switch(this.opts.showOn){case"hover":this.$elm.bind({"mouseenter.poshytip":e.proxy(this.mouseenter,this),"mouseleave.poshytip":e.proxy(this.mouseleave,this)});if(this.opts.alignTo=="cursor"){this.$elm.bind("mousemove.poshytip",e.proxy(this.mousemove,this))}if(this.opts.allowTipHover){this.$tip.hover(e.proxy(this.clearTimeouts,this),e.proxy(this.hide,this))}break;case"focus":this.$elm.bind({"focus.poshytip":e.proxy(this.show,this),"blur.poshytip":e.proxy(this.hide,this)});break}},mouseenter:function(g){if(this.disabled){return true}this.clearTimeouts();this.$elm.attr("title","");this.showTimeout=setTimeout(e.proxy(this.show,this),this.opts.showTimeout)},mouseleave:function(){if(this.disabled){return true}this.clearTimeouts();this.$elm.attr("title",this.$elm.data("title.poshytip"));this.hideTimeout=setTimeout(e.proxy(this.hide,this),this.opts.hideTimeout)},mousemove:function(g){if(this.disabled){return true}this.eventX=g.pageX;this.eventY=g.pageY;if(this.opts.followCursor&&this.$tip.data("active")){this.calcPos();this.$tip.css({left:this.pos.l,top:this.pos.t});if(this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow}}},show:function(){if(this.disabled||this.$tip.data("active")){return}this.reset();this.update();this.display()},hide:function(){if(this.disabled||!this.$tip.data("active")){return}this.display(true)},reset:function(){this.$tip.queue([]).detach().css("visibility","hidden").data("active",false);this.$inner.find("*").poshytip("hide");if(this.opts.fade){this.$tip.css("opacity",this.opacity)}this.$arrow[0].className="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left"},update:function(i){if(this.disabled){return}var h=i!==undefined;if(h){if(!this.$tip.data("active")){return}}else{i=this.opts.content}this.$inner.contents().detach();var g=this;this.$inner.append(typeof i=="function"?i.call(this.$elm[0],function(j){g.update(j)}):i=="[title]"?this.$elm.data("title.poshytip"):i);this.refresh(h)},refresh:function(h){if(this.disabled){return}if(h){if(!this.$tip.data("active")){return}var k={left:this.$tip.css("left"),top:this.$tip.css("top")}}this.$tip.css({left:0,top:0}).appendTo(document.body);if(this.opacity===undefined){this.opacity=this.$tip.css("opacity")}var l=this.$tip.css("background-image").match(d),m=this.$arrow.css("background-image").match(d);if(l){var i=c.test(l[1]);if(b&&i){this.$tip.css("background-image","none");this.$inner.css({margin:0,border:0,padding:0});l=i=false}else{this.$tip.prepend('<table border="0" cellpadding="0" cellspacing="0"><tr><td class="tip-top tip-bg-image" colspan="2"><span></span></td><td class="tip-right tip-bg-image" rowspan="2"><span></span></td></tr><tr><td class="tip-left tip-bg-image" rowspan="2"><span></span></td><td></td></tr><tr><td class="tip-bottom tip-bg-image" colspan="2"><span></span></td></tr></table>').css({border:0,padding:0,"background-image":"none","background-color":"transparent"}).find(".tip-bg-image").css("background-image",'url("'+l[1]+'")').end().find("td").eq(3).append(this.$inner)}if(i&&!e.support.opacity){this.opts.fade=false}}if(m&&!e.support.opacity){if(b&&c.test(m[1])){m=false;this.$arrow.css("background-image","none")}this.opts.fade=false}var o=this.$tip.find("table");if(b){this.$tip[0].style.width="";o.width("auto").find("td").eq(3).width("auto");var n=this.$tip.width(),j=parseInt(this.$tip.css("min-width")),g=parseInt(this.$tip.css("max-width"));if(!isNaN(j)&&n<j){n=j}else{if(!isNaN(g)&&n>g){n=g}}this.$tip.add(o).width(n).eq(0).find("td").eq(3).width("100%")}else{if(o[0]){o.width("auto").find("td").eq(3).width("auto").end().end().width(this.$tip.width()).find("td").eq(3).width("100%")}}this.tipOuterW=this.$tip.outerWidth();this.tipOuterH=this.$tip.outerHeight();this.calcPos();if(m&&this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow;this.$arrow.css("visibility","inherit")}if(h){this.$tip.css(k).animate({left:this.pos.l,top:this.pos.t},200)}else{this.$tip.css({left:this.pos.l,top:this.pos.t})}},display:function(h){var i=this.$tip.data("active");if(i&&!h||!i&&h){return}this.$tip.stop();if((this.opts.slide&&this.pos.arrow||this.opts.fade)&&(h&&this.opts.hideAniDuration||!h&&this.opts.showAniDuration)){var m={},l={};if(this.opts.slide&&this.pos.arrow){var k,g;if(this.pos.arrow=="bottom"||this.pos.arrow=="top"){k="top";g="bottom"}else{k="left";g="right"}var j=parseInt(this.$tip.css(k));m[k]=j+(h?0:this.opts.slideOffset*(this.pos.arrow==g?-1:1));l[k]=j+(h?this.opts.slideOffset*(this.pos.arrow==g?1:-1):0)}if(this.opts.fade){m.opacity=h?this.$tip.css("opacity"):0;l.opacity=h?0:this.opacity}this.$tip.css(m).animate(l,this.opts[h?"hideAniDuration":"showAniDuration"])}h?this.$tip.queue(e.proxy(this.reset,this)):this.$tip.css("visibility","inherit");this.$tip.data("active",!i)},disable:function(){this.reset();this.disabled=true},enable:function(){this.disabled=false},destroy:function(){this.reset();this.$tip.remove();this.$elm.unbind("poshytip").removeData("title.poshytip").removeData("poshytip");a.splice(e.inArray(this,a),1)},clearTimeouts:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}},calcPos:function(){var n={l:0,t:0,arrow:""},h=e(window),k={l:h.scrollLeft(),t:h.scrollTop(),w:h.width(),h:h.height()},p,j,m,i,q,g;if(this.opts.alignTo=="cursor"){p=j=m=this.eventX;i=q=g=this.eventY}else{var o=this.$elm.offset(),l={l:o.left,t:o.top,w:this.$elm.outerWidth(),h:this.$elm.outerHeight()};p=l.l+(this.opts.alignX!="inner-right"?0:l.w);j=p+Math.floor(l.w/2);m=p+(this.opts.alignX!="inner-left"?l.w:0);i=l.t+(this.opts.alignY!="inner-bottom"?0:l.h);q=i+Math.floor(l.h/2);g=i+(this.opts.alignY!="inner-top"?l.h:0)}switch(this.opts.alignX){case"right":case"inner-left":n.l=m+this.opts.offsetX;if(n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}if(this.opts.alignX=="right"||this.opts.alignY=="center"){n.arrow="left"}break;case"center":n.l=j-Math.floor(this.tipOuterW/2);if(n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}else{if(n.l<k.l){n.l=k.l}}break;default:n.l=p-this.tipOuterW-this.opts.offsetX;if(n.l<k.l){n.l=k.l}if(this.opts.alignX=="left"||this.opts.alignY=="center"){n.arrow="right"}}switch(this.opts.alignY){case"bottom":case"inner-top":n.t=g+this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="top"}if(n.t+this.tipOuterH>k.t+k.h){n.t=i-this.tipOuterH-this.opts.offsetY;if(n.arrow=="top"){n.arrow="bottom"}}break;case"center":n.t=q-Math.floor(this.tipOuterH/2);if(n.t+this.tipOuterH>k.t+k.h){n.t=k.t+k.h-this.tipOuterH}else{if(n.t<k.t){n.t=k.t}}break;default:n.t=i-this.tipOuterH-this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="bottom"}if(n.t<k.t){n.t=g+this.opts.offsetY;if(n.arrow=="bottom"){n.arrow="top"}}}this.pos=n}};e.fn.poshytip=function(g){if(typeof g=="string"){return this.each(function(){var i=e(this).data("poshytip");if(i&&i[g]){i[g]()}})}var h=e.extend({},e.fn.poshytip.defaults,g);if(!e("#poshytip-css-"+h.className)[0]){e(['<style id="poshytip-css-',h.className,'" type="text/css">',"div.",h.className,"{visibility:hidden;position:absolute;top:0;left:0;}","div.",h.className," table, div.",h.className," td{margin:0;font-family:inherit;font-size:inherit;font-weight:inherit;font-style:inherit;font-variant:inherit;}","div.",h.className," td.tip-bg-image span{display:block;font:1px/1px sans-serif;height:",h.bgImageFrameSize,"px;width:",h.bgImageFrameSize,"px;overflow:hidden;}","div.",h.className," td.tip-right{background-position:100% 0;}","div.",h.className," td.tip-bottom{background-position:100% 100%;}","div.",h.className," td.tip-left{background-position:0 100%;}","div.",h.className," div.tip-inner{background-position:-",h.bgImageFrameSize,"px -",h.bgImageFrameSize,"px;}","div.",h.className," div.tip-arrow{visibility:hidden;position:absolute;overflow:hidden;font:1px/1px sans-serif;}","</style>"].join("")).appendTo("head")}return this.each(function(){new e.Poshytip(this,h)})};e.fn.poshytip.defaults={content:"[title]",className:"tip-yellow",bgImageFrameSize:10,showTimeout:500,hideTimeout:100,showOn:"hover",alignTo:"cursor",alignX:"right",alignY:"top",offsetX:-22,offsetY:18,allowTipHover:true,followCursor:false,fade:true,slide:true,slideOffset:8,showAniDuration:300,hideAniDuration:300}})(jQuery);

/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 * 
 * Requires: 1.2.2+
 */

(function($) {

var types = ['DOMMouseScroll', 'mousewheel'];

$.event.special.mousewheel = {
    setup: function() {
        if ( this.addEventListener ) {
            for ( var i=types.length; i; ) {
                this.addEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = handler;
        }
    },
    
    teardown: function() {
        if ( this.removeEventListener ) {
            for ( var i=types.length; i; ) {
                this.removeEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = null;
        }
    }
};

$.fn.extend({
    mousewheel: function(fn) {
        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
    },
    
    unmousewheel: function(fn) {
        return this.unbind("mousewheel", fn);
    }
});


function handler(event) {
    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
    event = $.event.fix(orgEvent);
    event.type = "mousewheel";
    
    // Old school scrollwheel delta
    if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
    if ( event.detail     ) { delta = -event.detail/3; }
    
    // New school multidimensional scroll (touchpads) deltas
    deltaY = delta;
    
    // Gecko
    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
        deltaY = 0;
        deltaX = -1*delta;
    }
    
    // Webkit
    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
    
    // Add event and delta to the front of the arguments
    args.unshift(event, delta, deltaX, deltaY);
    
    return $.event.handle.apply(this, args);
}

})(jQuery);

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=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 ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/*
 * jQuery UI Effects Slide 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function( $, undefined ) {

$.effects.slide = function(o) {

	return this.queue(function() {

		// Create element
		var el = $(this), props = ['position','top','left'];

		// Set options
		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
		var direction = o.options.direction || 'left'; // Default Direction

		// Adjust
		$.effects.save(el, props); el.show(); // Save & Show
		$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
		if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift

		// Animation
		var animation = {};
		animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;

		// Animate
		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
			if(mode == 'hide') el.hide(); // Hide
			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
			if(o.callback) o.callback.apply(this, arguments); // Callback
			el.dequeue();
		}});

	});

};

})(jQuery);

/*
 * jQuery UI Effects 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/
 */
;jQuery.effects || (function($, undefined) {

$.effects = {};



/******************************************************************************/
/****************************** COLOR ANIMATIONS ******************************/
/******************************************************************************/

// override the animation for color styles
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
	'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],
function(i, attr) {
	$.fx.step[attr] = function(fx) {
		if (!fx.colorInit) {
			fx.start = getColor(fx.elem, attr);
			fx.end = getRGB(fx.end);
			fx.colorInit = true;
		}

		fx.elem.style[attr] = 'rgb(' +
			Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
			Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
			Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
	};
});

// Color Conversion functions from highlightFade
// By Blair Mitchelmore
// http://jquery.offput.ca/highlightFade/

// Parse strings looking for color tuples [255,255,255]
function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
				return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
				return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
				return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
				return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
				return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
		if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
				return colors['transparent'];

		// Otherwise, we're most likely dealing with a named color
		return colors[$.trim(color).toLowerCase()];
}

function getColor(elem, attr) {
		var color;

		do {
				color = $.curCSS(elem, attr);

				// Keep going until we find an element that has color, or we hit the body
				if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
						break;

				attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
};

// Some named colors to work with
// From Interface by Stefan Petre
// http://interface.eyecon.ro/

var colors = {
	aqua:[0,255,255],
	azure:[240,255,255],
	beige:[245,245,220],
	black:[0,0,0],
	blue:[0,0,255],
	brown:[165,42,42],
	cyan:[0,255,255],
	darkblue:[0,0,139],
	darkcyan:[0,139,139],
	darkgrey:[169,169,169],
	darkgreen:[0,100,0],
	darkkhaki:[189,183,107],
	darkmagenta:[139,0,139],
	darkolivegreen:[85,107,47],
	darkorange:[255,140,0],
	darkorchid:[153,50,204],
	darkred:[139,0,0],
	darksalmon:[233,150,122],
	darkviolet:[148,0,211],
	fuchsia:[255,0,255],
	gold:[255,215,0],
	green:[0,128,0],
	indigo:[75,0,130],
	khaki:[240,230,140],
	lightblue:[173,216,230],
	lightcyan:[224,255,255],
	lightgreen:[144,238,144],
	lightgrey:[211,211,211],
	lightpink:[255,182,193],
	lightyellow:[255,255,224],
	lime:[0,255,0],
	magenta:[255,0,255],
	maroon:[128,0,0],
	navy:[0,0,128],
	olive:[128,128,0],
	orange:[255,165,0],
	pink:[255,192,203],
	purple:[128,0,128],
	violet:[128,0,128],
	red:[255,0,0],
	silver:[192,192,192],
	white:[255,255,255],
	yellow:[255,255,0],
	transparent: [255,255,255]
};



/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/

var classAnimationActions = ['add', 'remove', 'toggle'],
	shorthandStyles = {

		border: 1,
		borderBottom: 1,
		borderColor: 1,
		borderLeft: 1,
		borderRight: 1,
		borderTop: 1,
		borderWidth: 1,
		margin: 1,
		padding: 1
	};

function getElementStyles() {
	var style = document.defaultView
			? document.defaultView.getComputedStyle(this, null)
			: this.currentStyle,
		newStyle = {},
		key,
		camelCase;

	// webkit enumerates style porperties
	if (style && style.length && style[0] && style[style[0]]) {
		var len = style.length;
		while (len--) {
			key = style[len];
			if (typeof style[key] == 'string') {
				camelCase = key.replace(/\-(\w)/g, function(all, letter){
					return letter.toUpperCase();
				});
				newStyle[camelCase] = style[key];
			}
		}
	} else {
		for (key in style) {
			if (typeof style[key] === 'string') {
				newStyle[key] = style[key];
			}
		}
	}
	
	return newStyle;
}

function filterStyles(styles) {
	var name, value;
	for (name in styles) {
		value = styles[name];
		if (
			// ignore null and undefined values
			value == null ||
			// ignore functions (when does this occur?)
			$.isFunction(value) ||
			// shorthand styles that need to be expanded
			name in shorthandStyles ||
			// ignore scrollbars (break in IE)
			(/scrollbar/).test(name) ||

			// only colors or values that can be converted to numbers
			(!(/color/i).test(name) && isNaN(parseFloat(value)))
		) {
			delete styles[name];
		}
	}
	
	return styles;
}

function styleDifference(oldStyle, newStyle) {
	var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
		name;

	for (name in newStyle) {
		if (oldStyle[name] != newStyle[name]) {
			diff[name] = newStyle[name];
		}
	}

	return diff;
}

$.effects.animateClass = function(value, duration, easing, callback) {
	if ($.isFunction(easing)) {
		callback = easing;
		easing = null;
	}

	return this.each(function() {

		var that = $(this),
			originalStyleAttr = that.attr('style') || ' ',
			originalStyle = filterStyles(getElementStyles.call(this)),
			newStyle,
			className = that.attr('className');

		$.each(classAnimationActions, function(i, action) {
			if (value[action]) {
				that[action + 'Class'](value[action]);
			}
		});
		newStyle = filterStyles(getElementStyles.call(this));
		that.attr('className', className);

		that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
			$.each(classAnimationActions, function(i, action) {
				if (value[action]) { that[action + 'Class'](value[action]); }
			});
			// work around bug in IE by clearing the cssText before setting it
			if (typeof that.attr('style') == 'object') {
				that.attr('style').cssText = '';
				that.attr('style').cssText = originalStyleAttr;
			} else {
				that.attr('style', originalStyleAttr);
			}
			if (callback) { callback.apply(this, arguments); }
		});
	});
};

$.fn.extend({
	_addClass: $.fn.addClass,
	addClass: function(classNames, speed, easing, callback) {
		return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
	},

	_removeClass: $.fn.removeClass,
	removeClass: function(classNames,speed,easing,callback) {
		return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
	},

	_toggleClass: $.fn.toggleClass,
	toggleClass: function(classNames, force, speed, easing, callback) {
		if ( typeof force == "boolean" || force === undefined ) {
			if ( !speed ) {
				// without speed parameter;
				return this._toggleClass(classNames, force);
			} else {
				return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
			}
		} else {
			// without switch parameter;
			return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
		}
	},

	switchClass: function(remove,add,speed,easing,callback) {
		return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
	}
});



/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/

$.extend($.effects, {
	version: "1.8.5",

	// Saves a set of properties in a data storage
	save: function(element, set) {
		for(var i=0; i < set.length; i++) {
			if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
		}
	},

	// Restores a set of previously saved properties from a data storage
	restore: function(element, set) {
		for(var i=0; i < set.length; i++) {
			if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
		}
	},

	setMode: function(el, mode) {
		if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
		return mode;
	},

	getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
		// this should be a little more flexible in the future to handle a string & hash
		var y, x;
		switch (origin[0]) {
			case 'top': y = 0; break;
			case 'middle': y = 0.5; break;
			case 'bottom': y = 1; break;
			default: y = origin[0] / original.height;
		};
		switch (origin[1]) {
			case 'left': x = 0; break;
			case 'center': x = 0.5; break;
			case 'right': x = 1; break;
			default: x = origin[1] / original.width;
		};
		return {x: x, y: y};
	},

	// Wraps the element around a wrapper that copies position properties
	createWrapper: function(element) {

		// if the element is already wrapped, return it
		if (element.parent().is('.ui-effects-wrapper')) {
			return element.parent();
		}

		// wrap the element
		var props = {
				width: element.outerWidth(true),
				height: element.outerHeight(true),
				'float': element.css('float')
			},
			wrapper = $('<div></div>')
				.addClass('ui-effects-wrapper')
				.css({
					fontSize: '100%',
					background: 'transparent',
					border: 'none',
					margin: 0,
					padding: 0
				});

		element.wrap(wrapper);
		wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element

		// transfer positioning properties to the wrapper
		if (element.css('position') == 'static') {
			wrapper.css({ position: 'relative' });
			element.css({ position: 'relative' });
		} else {
			$.extend(props, {
				position: element.css('position'),
				zIndex: element.css('z-index')
			});
			$.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
				props[pos] = element.css(pos);
				if (isNaN(parseInt(props[pos], 10))) {
					props[pos] = 'auto';
				}
			});
			element.css({position: 'relative', top: 0, left: 0 });
		}

		return wrapper.css(props).show();
	},

	removeWrapper: function(element) {
		if (element.parent().is('.ui-effects-wrapper'))
			return element.parent().replaceWith(element);
		return element;
	},

	setTransition: function(element, list, factor, value) {
		value = value || {};
		$.each(list, function(i, x){
			unit = element.cssUnit(x);
			if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
		});
		return value;
	}
});


function _normalizeArguments(effect, options, speed, callback) {
	// shift params for method overloading
	if (typeof effect == 'object') {
		callback = options;
		speed = null;
		options = effect;
		effect = options.effect;
	}
	if ($.isFunction(options)) {
		callback = options;
		speed = null;
		options = {};
	}
        if (typeof options == 'number' || $.fx.speeds[options]) {
		callback = speed;
		speed = options;
		options = {};
	}
	if ($.isFunction(speed)) {
		callback = speed;
		speed = null;
	}

	options = options || {};

	speed = speed || options.duration;
	speed = $.fx.off ? 0 : typeof speed == 'number'
		? speed : $.fx.speeds[speed] || $.fx.speeds._default;

	callback = callback || options.complete;

	return [effect, options, speed, callback];
}

$.fn.extend({
	effect: function(effect, options, speed, callback) {
		var args = _normalizeArguments.apply(this, arguments),
			// TODO: make effects takes actual parameters instead of a hash
			args2 = {
				options: args[1],
				duration: args[2],
				callback: args[3]
			},
			effectMethod = $.effects[effect];
		
		return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
	},

	_show: $.fn.show,
	show: function(speed) {
		if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] ) {
			return this._show.apply(this, arguments);
		} else {
			var args = _normalizeArguments.apply(this, arguments);
			args[1].mode = 'show';
			return this.effect.apply(this, args);
		}
	},

	_hide: $.fn.hide,
	hide: function(speed) {
		if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed] ) {
			return this._hide.apply(this, arguments);
		} else {
			var args = _normalizeArguments.apply(this, arguments);
			args[1].mode = 'hide';
			return this.effect.apply(this, args);
		}
	},

	// jQuery core overloads toggle and creates _toggle
	__toggle: $.fn.toggle,
	toggle: function(speed) {
		if (!speed || typeof speed == 'number' || $.fx.speeds[speed] || !$.effects[speed]  ||
			typeof speed == 'boolean' || $.isFunction(speed)) {
			return this.__toggle.apply(this, arguments);
		} else {
			var args = _normalizeArguments.apply(this, arguments);
			args[1].mode = 'toggle';
			return this.effect.apply(this, args);
		}
	},

	// helper functions
	cssUnit: function(key) {
		var style = this.css(key), val = [];
		$.each( ['em','px','%','pt'], function(i, unit){
			if(style.indexOf(unit) > 0)
				val = [parseFloat(style), unit];
		});
		return val;
	}
});



/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 *
 * Open source under the BSD License.
 *
 * Copyright 2008 George McGinley Smith
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
$.easing.jswing = $.easing.swing;

$.extend($.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert($.easing.default);
		return $.easing[$.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 - $.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 $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 *
 * Open source under the BSD License.
 *
 * Copyright 2001 Robert Penner
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

})(jQuery);


/*	
 *	jQuery carouFredSel 4.2.3
 *	Demo's and documentation:
 *	caroufredsel.frebsite.nl
 *	
 *	Copyright (c) 2010 Fred Heusschen
 *	www.frebsite.nl
 *
 *	Dual licensed under the MIT and GPL licenses.
 *	http://en.wikipedia.org/wiki/MIT_License
 *	http://en.wikipedia.org/wiki/GNU_General_Public_License
 */


eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(A($){u($.1t.1u)D;$.1t.1u=A(o){u(V.Y==0)D 1a(\'4C 4D 3l.\');u(V.Y>1){D V.1z(A(){$(V).1u(o)})}C q=V,$1e=q[0],$w=$(V);q.3m=A(o,b){C c=[\'y\',\'X\',\'I\',\'T\',\'S\',\'W\'];o=2H(o);23(C a=0;a<c.Y;a++){o[c[a]]=2H(o[c[a]])}u(B o.X==\'O\'){u(o.X<=50)o.X={y:o.X};F o.X={Z:o.X}}F{u(B o.X==\'1l\')o.X={1b:o.X}}u(B o.y==\'O\')o.y={E:o.y};F u(B o.y==\'1l\')o.y={E:o.y,24:o.y,2p:o.y};u(b){2q=$.25(J,{},$.1t.1u.3n,o)}4=$.25(J,{},$.1t.1u.3n,o);4.2r=R;1E=(4.1E==\'3M\'||4.1E==\'1F\')?\'S\':\'T\';u(4.1E==\'3N\'||4.1E==\'1F\'){4.z=[\'24\',\'3O\',\'3P\',\'2p\',\'3Q\',\'3R\',\'1F\',\'2I\',\'26\',0,1,2,3]}F{4.z=[\'2p\',\'3Q\',\'3R\',\'24\',\'3O\',\'3P\',\'2I\',\'1F\',\'27\',3,2,1,0]}C d=H($w);C e=3o(d,4,5,R);u(4[4.z[3]]==\'I\'){4[4.z[3]]=e;4.y[4.z[3]]=e}u(!4.y[4.z[0]]){4.y[4.z[0]]=(3p(d,4,2))?\'16\':d[4.z[2]](J)}u(!4.y[4.z[3]]){4.y[4.z[3]]=(3p(d,4,5))?\'16\':d[4.z[5]](J)}u(!4[4.z[3]]){4[4.z[3]]=4.y[4.z[3]]}u(!4.y.E){u(4.y[4.z[0]]==\'16\'){4.y.E=\'16\'}F{u(B 4[4.z[0]]==\'O\'){4.y.E=1A.3q(4[4.z[0]]/4.y[4.z[0]])}F{C f=3r(r.28(),4,1);4.y.E=1A.3q(f/4.y[4.z[0]]);4[4.z[0]]=4.y.E*4.y[4.z[0]];u(B 4.K==\'1c\'){4.K=0}}}}u(!4[4.z[0]]){u(4.y.E!=\'16\'&&4.y[4.z[0]]!=\'16\'){4[4.z[0]]=4.y.E*4.y[4.z[0]];u(B 4.K==\'1c\'){4.K=0}}F{4[4.z[0]]=\'16\'}}u(4.y.E==\'16\'){4.2r=J;4.3s=(4[4.z[0]]==\'16\')?3r(r.28(),4,1):4[4.z[0]];u(4.K===R||4.K===0){4[4.z[0]]=\'16\'}4.y.E=2s($w,4,0)}F{u(4.K===R){4.K=0}}u(B 4.K==\'1c\'){4.K=(4[4.z[0]]==\'16\')?0:\'I\'}4.y.1G=4.y.E;4.U=R;u(4.K==\'I\'){4.K=[0,0,0,0];u(4[4.z[0]]!=\'16\'){4.U=\'I\';C p=2J(3t($w,4),4);4.K[4.z[10]]=p[0];4.K[4.z[12]]=p[0]}u(4[4.z[3]]!=\'16\'){C p=(4[4.z[3]]-e)/2;u(p<0)p=0;4.K[4.z[9]]=p;4.K[4.z[11]]=p}}F{4.K=3S(4.K);4.U=(4.K[0]==0&&4.K[1]==0&&4.K[2]==0&&4.K[3]==0)?R:J}u(B 4.y.2K!=\'O\')4.y.2K=(4.2r)?1:4.y.E;u(B 4.X.y!=\'O\')4.X.y=(4.2r)?\'16\':4.y.E;u(B 4.X.Z!=\'O\')4.X.Z=4E;4.I=2t(4.I,R,J);4.T=2t(4.T);4.S=2t(4.S);4.W=2t(4.W,J);4.I=$.25(J,{},4.X,4.I);4.T=$.25(J,{},4.X,4.T);4.S=$.25(J,{},4.X,4.S);4.W=$.25(J,{},4.X,4.W);u(B 4.W.2L!=\'15\')4.W.2L=R;u(B 4.W.3u!=\'A\')4.W.3u=$.1t.1u.3T;u(B 4.I.13!=\'15\')4.I.13=J;u(B 4.I.2u!=\'15\')4.I.2u=J;u(B 4.I.3v!=\'O\')4.I.3v=0;u(B 4.I.1Q!=\'O\')4.I.1Q=(4.I.Z<10)?4F:4.I.Z*5};q.3U=A(){u($w.M(\'1R\')==\'3V\'||$w.M(\'1R\')==\'4G\'){1a(\'4H 4I-4J "1R" 4K 4L "4M" 4N "3W".\')}r.M({1R:\'3W\',4O:\'3X\',2v:$w.M(\'2v\'),26:$w.M(\'26\'),27:$w.M(\'27\'),2w:$w.M(\'2w\')});$w.18(\'3Y\',{24:$w.M(\'24\'),2p:$w.M(\'2p\'),2v:$w.M(\'2v\'),26:$w.M(\'26\'),27:$w.M(\'27\'),2w:$w.M(\'2w\'),\'3w\':$w.M(\'3w\'),1R:$w.M(\'1R\'),2I:$w.M(\'2I\'),1F:$w.M(\'1F\')}).M({2v:0,26:0,27:0,2w:0,\'3w\':\'3x\',1R:\'3V\'});u(4.U){H($w).1z(A(){C m=1H($(V).M(4.z[8]));u(1S(m))m=0;$(V).18(\'1m\',m)})}};q.3Z=A(){q.3y();$w.19(\'1B\',A(e,g){u(B g!=\'15\')g=R;u(g)2x=J;u(2M!=29)4P(2M);u(2N!=29)3z(2N);u(2O!=29)3z(2O);C a=4.I.1Q-2a,1T=2y-1A.2P(a*2y/4.I.1Q);u(1T!=0){u(4.I.41)4.I.41.1i($1e,1T,a)}});$w.19(\'13\',A(e,d,f,g){$w.G(\'1B\');u(!4.I.13)D;u(B g!=\'15\'){u(B f==\'15\')g=f;F u(B d==\'15\')g=d;F g=R}u(B f!=\'O\'){u(B d==\'O\')f=d;F f=0}u(d!=\'T\'&&d!=\'S\')d=1E;u(g)2x=R;u(2x)D;C a=4.I.1Q-2a,42=a+f;1T=2y-1A.2P(a*2y/4.I.1Q);2M=43(A(){u($w.1v(\':2Q\')){$w.G(\'13\',d)}F{2a=0;$w.G(d,4.I)}},42);u(4.I.2b===\'4Q\'){2N=44(A(){2a+=50},50)}u(4.I.45&&1T==0){4.I.45.1i($1e,1T,a)}u(4.I.46){2O=43(A(){4.I.46.1i($1e,1T,a)},f)}});$w.19(\'T S\',A(e){u(2x||$w.1v(\':2Q\')||$w.1v(\':3X\')){e.47();D}u(4.y.2K>=L){1a(\'2c 48 y: 2R 2S\');e.47();D}2a=0});u(4.2r){$w.19(\'T\',A(e,a,b){u(B a==\'O\')b=a;u(B a!=\'1n\')a=4.T;u(B b!=\'O\')b=(B a.y==\'O\')?a.y:4.y.E;2z=b;4.y.1G=4.y.E;C c=H($w);u(4.U){1f(c,4)}4.y.E=4a($w,4,2z);b=4.y.E-4.y.1G+2z;u(b<=0){4.y.E=2s($w,4,L-2z);b=2z}u(4.U){1f(c,4,J)}$w.G(\'2T\',[a,b])});$w.19(\'S\',A(e,a,b){u(B a==\'O\')b=a;u(B a!=\'1n\')a=4.S;u(B b!=\'O\')b=(B a.y==\'O\')?a.y:4.y.E;4.y.1G=4.y.E;C c=H($w);u(4.U){1f(c,4)}4.y.E=2s($w,4,b);u(4.y.1G-b>=4.y.E){4.y.E=2s($w,4,++b)}u(4.U){1f(c,4,J)}$w.G(\'2U\',[a,b])})}F{$w.19(\'T\',A(e,a,b){$w.G(\'2T\',[a,b])});$w.19(\'S\',A(e,a,b){$w.G(\'2U\',[a,b])})}$w.19(\'2T\',A(e,d,f){u(B d==\'O\')f=d;u(B d!=\'1n\')d=4.T;u(B f!=\'O\')f=(B d.y==\'O\')?d.y:4.y.E;u(B f!=\'O\')D 1a(\'2c a 2V O: 2R 2S\');u(d.2W&&!d.2W.1i($1e))D;u(!4.1I){C g=L-P;u(g-f<0){f=g}u(P==0){f=0}}P+=f;u(P>=L)P-=L;u(!4.1I){u(P==0&&f!=0&&d.2X)d.2X.1i($1e);u(4.2Y){u(f==0){$w.G(\'S\',L-4.y.E);D}}F 1U(4,P)}u(f==0)D;H($w,\':1J(\'+(L-f-1)+\')\').4R($w);u(L<4.y.E+f){H($w,\':1j(\'+((4.y.E+f)-L)+\')\').2Z(J).2A($w)}C h=4b($w,4,f),1o=3A($w,4),1V=H($w,\':1q(\'+(f-1)+\')\'),1w=h.1r(\':2d\'),1K=1o.1r(\':2d\');u(4.U){1f(1w,4);1f(1o,4)}u(4.U==\'I\'){C p=2J(3A($w,4,f),4)}C i=2e(H($w,\':1j(\'+f+\')\'),4,0),1L=30(2f(1o,4,J),4,!4.U);u(4.U){1f(1w,4,4.K[4.z[10]]);1f(1V,4,4.K[4.z[12]])}u(4.U==\'I\'){4.K[4.z[9]]=p[1];4.K[4.z[10]]=p[0];4.K[4.z[11]]=p[1];4.K[4.z[12]]=p[0]}C j={},3B={},2g={},2h={},N=d.Z;u(d.1p==\'3x\')N=0;F u(N==\'I\')N=4.X.Z/4.X.y*f;F u(N<=0)N=0;F u(N<10)N=i/N;C k={Z:N,1b:d.1b};u(d.31)d.31.1i($1e,h,1o,1L,N);u(4.U){C l=4.K[4.z[12]];2g[4.z[8]]=1V.18(\'1m\');3B[4.z[8]]=1K.18(\'1m\')+4.K[4.z[10]];2h[4.z[8]]=1w.18(\'1m\');1V.1W().1g(2g,k);1K.1W().1g(3B,k);1w.1W().1g(2h,k)}F{C l=0}j[4.z[6]]=l;u(4[4.z[0]]==\'16\'||4[4.z[3]]==\'16\'){r.1W().1g(1L,k)}1s(d.1p){Q\'1M\':Q\'1N\':Q\'1x\':C m=$w.2Z().2A(r);14}1s(d.1p){Q\'1x\':H(m,\':1j(\'+f+\')\').1k();Q\'1M\':Q\'1N\':H(m,\':1J(\'+(4.y.1G-1)+\')\').1k();14}1s(d.1p){Q\'2i\':1C(d,$w,0,N);14;Q\'1M\':m.M({2j:0});1C(d,m,1,N);1C(d,$w,1,N,A(){m.1k()});14;Q\'1N\':3C(d,$w,m,4,N,J);14;Q\'1x\':3D(d,m,4,N,J);14}1s(d.1p){Q\'2i\':Q\'1M\':Q\'1N\':Q\'1x\':2k=N;N=0;14}C n=f;$w.M(4.z[6],-i);$w.1g(j,{Z:N,1b:d.1b,1X:A(){C a=4.y.E+n-L;u(a>0){H($w,\':1J(\'+(L-1)+\')\').1k();h=H($w,\':1J(\'+(L-(n-a)-1)+\')\').4c().4S(H($w,\':1j(\'+a+\')\').4c())}u(4.U){C b=H($w,\':1q(\'+(4.y.E+f-1)+\')\');b.M(4.z[8],b.18(\'1m\'))}C c=(d.32)?A(){d.32.1i($1e,h,1o,1L)}:R;1s(d.1p){Q\'2i\':1C(d,$w,1,2k,c);14;Q\'1x\':$w.1g({2j:\'+=0\'},{Z:2k,1X:c});14;3E:u(c)c();14}}});$w.G(\'1Y\').G(\'13\',N)});$w.19(\'2U\',A(e,f,g){u(B f==\'O\')g=f;u(B f!=\'1n\')f=4.S;u(B g!=\'O\')g=(B f.y==\'O\')?f.y:4.y.E;u(B g!=\'O\')D 1a(\'2c a 2V O: 2R 2S\');u(f.2W&&!f.2W.1i($1e))D;u(!4.1I){u(P==0){u(g>L-4.y.E){g=L-4.y.E}}F{u(P-g<4.y.E){g=P-4.y.E}}}P-=g;u(P<0)P+=L;u(!4.1I){u(P==4.y.E&&g!=0&&f.2X)f.2X.1i($1e);u(4.2Y){u(g==0){$w.G(\'T\',L-4.y.E);D}}F 1U(4,P)}u(g==0)D;u(L<4.y.E+g)H($w,\':1j(\'+((4.y.E+g)-L)+\')\').2Z(J).2A($w);C h=4d($w,4),1o=3F($w,4,g),1V=h.1r(\':1q(\'+(g-1)+\')\'),1w=h.1r(\':2d\'),1K=1o.1r(\':2d\');u(4.U){1f(1w,4);1f(1K,4)}u(4.U==\'I\'){C p=2J(3F($w,4,g),4)}C i=2e(H($w,\':1j(\'+g+\')\'),4,0),1L=30(2f(1o,4,J),4,!4.U);u(4.U){1f(1w,4,4.K[4.z[10]]);1f(1K,4,4.K[4.z[10]])}u(4.U==\'I\'){4.K[4.z[9]]=p[1];4.K[4.z[10]]=p[0];4.K[4.z[11]]=p[1];4.K[4.z[12]]=p[0]}C j={},2h={},2g={},N=f.Z;u(f.1p==\'3x\')N=0;F u(N==\'I\')N=4.X.Z/4.X.y*g;F u(N<=0)N=0;F u(N<10)N=i/N;C k={Z:N,1b:f.1b};u(f.31)f.31.1i($1e,h,1o,1L,N);u(4.U){2h[4.z[8]]=1w.18(\'1m\');2g[4.z[8]]=1V.18(\'1m\')+4.K[4.z[12]];1K.M(4.z[8],1K.18(\'1m\')+4.K[4.z[10]]);1w.1W().1g(2h,k);1V.1W().1g(2g,k)}j[4.z[6]]=-i;u(4[4.z[0]]==\'16\'||4[4.z[3]]==\'16\'){r.1W().1g(1L,k)}1s(f.1p){Q\'1M\':Q\'1N\':Q\'1x\':C l=$w.2Z().2A(r);14}1s(f.1p){Q\'1M\':Q\'1N\':H(l,\':1j(\'+g+\')\').1k();Q\'1x\':H(l,\':1J(\'+(4.y.E-1)+\')\').1k();14}1s(f.1p){Q\'2i\':1C(f,$w,0,N);14;Q\'1M\':l.M({2j:0});1C(f,l,1,N);1C(f,$w,1,N,A(){l.1k()});14;Q\'1N\':3C(f,$w,l,4,N,R);14;Q\'1x\':3D(f,l,4,N,R);14}1s(f.1p){Q\'2i\':Q\'1M\':Q\'1N\':Q\'1x\':2k=N;N=0;14}C m=g;$w.1g(j,{Z:N,1b:f.1b,1X:A(){C a=4.y.E+m-L;$w.M(4.z[6],4.K[4.z[12]]);u(a>0){H($w,\':1J(\'+(L-1)+\')\').1k()}C b=H($w,\':1j(\'+m+\')\').2A($w).1r(\':2d\');u(a>0){1o=3t($w,4)}u(4.U){u(L<4.y.E+m){C c=H($w,\':1q(\'+(4.y.E-1)+\')\');c.M(4.z[8],c.18(\'1m\')+4.K[4.z[12]])}b.M(4.z[8],b.18(\'1m\'))}C d=(f.32)?A(){f.32.1i($1e,h,1o,1L)}:R;1s(f.1p){Q\'2i\':1C(f,$w,1,2k,d);14;Q\'1x\':$w.1g({2j:\'+=0\'},{Z:2k,1X:d});14;3E:u(d)d();14}}});$w.G(\'1Y\').G(\'13\',N)});$w.19(\'1Z\',A(e,a,b,c,d){u($w.1v(\':2Q\'))D;a=2B(a,b,c,P,L,$w);u(a==0)D;u(B d!=\'1n\')d=R;u(4.1I){u(a<L/2)$w.G(\'S\',[d,a]);F $w.G(\'T\',[d,L-a])}F{u(P==0||P>a)$w.G(\'S\',[d,a]);F $w.G(\'T\',[d,L-a])}});$w.19(\'4e\',A(e,a,b,c,d){u(B a==\'1n\'&&B a.2C==\'1c\')a=$(a);u(B a==\'1l\')a=$(a);u(B a!=\'1n\'||B a.2C==\'1c\'||a.Y==0)D 1a(\'2c a 2V 1n.\');u(B b==\'1c\'||b==\'4f\'){$w.3G(a)}F{b=2B(b,d,c,P,L,$w);C f=H($w,\':1q(\'+b+\')\');u(4.U){a.1z(A(){C m=1H($(V).M(4.z[8]));u(1S(m))m=0;$(V).18(\'1m\',m)})}u(f.Y){u(b<P)P+=a.Y;u(P>=L)P-=L;f.4T(a)}F{$w.3G(a)}}L=H($w).Y;$w.G(\'2l\');2D($w,4);2E(4,L);1U(4,P);$w.G(\'1Y\',J)});$w.19(\'4g\',A(e,a,b,c){u(B a==\'1c\'||a==\'4f\'){H($w,\':2d\').1k()}F{a=2B(a,c,b,P,L,$w);C d=H($w,\':1q(\'+a+\')\');u(d.Y){u(a<P)P-=d.Y;d.1k()}}L=H($w).Y;2D($w,4);2E(4,L);1U(4,P);$w.G(\'1Y\',J)});$w.19(\'2l\',A(e,a,b){u(B a==\'1c\'||a.Y==0)a=$(\'4U\');F u(B a==\'1l\')a=$(a);u(B a!=\'1n\')D 1a(\'2c a 2V 1n.\');u(B b!=\'1l\'||b.Y==0)b=\'a.4h\';a.4V(b).1z(A(){C h=V.4i||\'\';u(h.Y>0&&H($w).4j($(h))!=-1){$(V).1d(\'2m\').2m(A(e){e.1D();$w.G(\'1Z\',h)})}})});$w.19(\'33\',A(e,a){u(P==0)C b=0;F C b=L-P;u(B a==\'A\')a.1i($1e,b)});$w.19(\'20\',A(e,a,b,c){u($w.1v(\':2Q\')){C d=44(A(){$w.G(\'20\',[a,b,c]);3z(d)},2y);D}u(B c!=\'15\')c=J;u(B a==\'A\'){a.1i($1e,4)}F u(B b==\'A\'){C f=3H(\'4.\'+a);u(B f==\'1c\')f=\'\';b.1i($1e,f)}F u(B a!=\'1c\'&&B b!=\'1c\'){3H(\'2q.\'+a+\' = b\');u(c){1f(H($w),4);q.3m(2q);2D($w,4)}F{3H(\'4.\'+a+\' = b\')}}});$w.19(\'21\',A(e,a){u(a){$w.G(\'1Z\',[0,0,J,{Z:0}])}u(4.U){1f(H($w),4)}$w.G(\'1B\').M($w.18(\'3Y\'));q.3y();q.4k();r.4W($w)});$w.19(\'1Y\',A(e,b){u(!4.W.1h)D;u(B b==\'15\'&&b){H(4.W.1h).1k();23(C a=0;a<1A.2P(L/4.y.E);a++){C i=H($w,\':1q(\'+2B(a*4.y.E,0,J,P,L,$w)+\')\');4.W.1h.3G(4.W.3u(a+1,i))}H(4.W.1h).1d(\'2m\').1z(A(a){$(V).2m(A(e){e.1D();$w.G(\'1Z\',[a*4.y.E,0,J,4.W])})})}C c=1A.2P(L/4.y.E-1);u(P==0)C d=0;F u(P<L%4.y.E)C d=0;F u(P==4.y.E&&!4.1I)C d=c;F C d=1A.4X((L-P)/4.y.E);u(d<0)d=0;u(d>c)d=c;H(4.W.1h).2F(\'3l\').1r(\':1q(\'+d+\')\').34(\'3l\')})};q.3y=A(){$w.1d(\'1B\').1d(\'13\').1d(\'T\').1d(\'S\').1d(\'2T\').1d(\'2U\').1d(\'1Z\').1d(\'4e\').1d(\'4g\').1d(\'2l\').1d(\'21\').1d(\'1Y\').1d(\'33\').1d(\'20\')};q.4l=A(){2E(4,\'3I\');1U(4,P);u(4.I.2b&&4.I.13){r.35(A(){$w.G(\'1B\')},A(){$w.G(\'13\')})}u(4.T.17){4.T.17.2m(A(e){e.1D();$w.G(\'T\')});u(4.T.2b&&4.I.13){4.T.17.35(A(){$w.G(\'1B\')},A(){$w.G(\'13\')})}}u(4.S.17){4.S.17.2m(A(e){e.1D();$w.G(\'S\')});u(4.S.2b&&4.I.13){4.S.17.35(A(){$w.G(\'1B\')},A(){$w.G(\'13\')})}}u($.1t.1y){u(4.T.1y){r.1y(A(e,a){u(a>0){e.1D();36=(B 4.T.1y==\'O\')?4.T.1y:\'\';$w.G(\'T\',36)}})}u(4.S.1y){r.1y(A(e,a){u(a<0){e.1D();36=(B 4.S.1y==\'O\')?4.S.1y:\'\';$w.G(\'S\',36)}})}}u(4.W.1h){$w.G(\'1Y\',J);u(4.W.2b&&4.I.13){4.W.1h.35(A(){$w.G(\'1B\')},A(){$w.G(\'13\')})}}u(4.S.1O||4.T.1O){$(4m).4n(A(e){C k=e.4o;u(k==4.S.1O){e.1D();$w.G(\'S\')}u(k==4.T.1O){e.1D();$w.G(\'T\')}})}u(4.W.2L){$(4m).4n(A(e){C k=e.4o;u(k>=49&&k<58){k=(k-49)*4.y.E;u(k<=L){e.1D();$w.G(\'1Z\',[k,0,J,4.W])}}})}u(4.I.13){$w.G(\'13\',4.I.3v);u($.1t.2u&&4.I.2u){$w.2u(\'1B\',\'13\')}}};q.4k=A(){2E(4,\'3J\');1U(4,\'2F\');u(4.W.1h){H(4.W.1h).1k()}};q.20=A(a,b){1a(\'3a "20" 3b 3c 1v 3d, 3e 3f "20" 3g 3h.\');C c=R;C d=A(a){c=a};u(!a)a=d;u(!b)b=d;$w.G(\'20\',[a,b]);D c};q.4p=A(){1a(\'3a "4p" 3b 3c 1v 3d, 3e 3f "33" 3g 3h.\');C b=R;$w.G(\'33\',A(a){b=a});D b};q.21=A(){1a(\'3a "21" 3b 3c 1v 3d, 3e 3f "21" 3g 3h.\');$w.G(\'21\');D q};q.4q=A(a,b){1a(\'3a "4q" 3b 3c 1v 3d, 3e 3f "2l" 3g 3h.\');$w.G(\'2l\',[a,b]);D q};u($w.28().1v(\'.4r\')){C r=$w.28();$w.G(\'21\')}C r=$w.4Y(\'<4Z 51="4r" />\').28(),4={},2q=o,L=H($w).Y,P=0,2M=29,2N=29,2O=29,2a=0,2x=R,1E=\'S\';q.3m(2q,J);q.3U();q.3Z();q.4l();$w.G(\'2l\');2D($w,4,R);u(4.y.1P!==0&&4.y.1P!==R){C s=4.y.1P;u(s===J){s=3i.52.4i;u(!s.Y)s=0}u(s===\'4s\'){s=1A.3q(1A.4s()*L)}$w.G(\'1Z\',[s,0,J,{Z:0}])}D V};$.1t.1u.3n={2Y:J,1I:J,1E:\'1F\',y:{1P:0},X:{1b:\'53\',2b:R,1y:R}};$.1t.1u.3T=A(a,b){D\'<a 54="#"><4t>\'+a+\'</4t></a>\'};A 1C(a,c,x,d,f){C o={Z:d,1b:a.1b};u(B f==\'A\')o.1X=f;c.1g({2j:x},o)}A 3C(a,b,c,o,d,e){C f=2f(H(c),o,J)[0],3j=(e)?-f:f,22={},2n={};22[o.z[0]]=f;22[o.z[6]]=3j;2n[o.z[6]]=0;b.1g({2j:\'+=0\'},d);c.M(22).1g(2n,{Z:d,1b:a.1b,1X:A(){$(V).1k()}})}A 3D(a,c,o,d,b){C e=2f(H(c),o,J)[0],3j=(b)?e:-e,22={},2n={};22[o.z[0]]=e;2n[o.z[6]]=3j;c.M(22).1g(2n,{Z:d,1b:a.1b,1X:A(){$(V).1k()}})}A 2E(o,t){u(t==\'3I\'||t==\'3J\'){C f=t}F u(o.y.2K>=t){1a(\'2c 48 y: 2R 2S\');C f=\'3J\'}F{C f=\'3I\'}u(o.T.17)o.T.17[f]();u(o.S.17)o.S.17[f]();u(o.W.1h)o.W.1h[f]()}A 1U(o,f){u(o.1I||o.2Y)D;C a=(f==\'2F\'||f==\'34\')?f:R;u(o.S.17){C b=a||(f==o.y.E)?\'34\':\'2F\';o.S.17[b](\'4u\')}u(o.T.17){C b=a||(f==0)?\'34\':\'2F\';o.T.17[b](\'4u\')}}A 3K(k){u(k==\'3N\')D 39;u(k==\'1F\')D 37;u(k==\'3M\')D 38;u(k==\'55\')D 40;D-1}A 2H(a){u(B a==\'1c\')a={};D a}A 2t(a,b,c){u(B b!=\'15\')b=R;u(B c!=\'15\')c=R;a=2H(a);u(B a==\'1l\'){C d=3K(a);u(d==-1)a=$(a);F a=d}u(b){u(B a==\'15\')a={2L:a};u(B a.2C!=\'1c\')a={1h:a};u(B a.1h==\'1l\')a.1h=$(a.1h)}F u(c){u(B a==\'15\')a={13:a};u(B a==\'O\')a={1Q:a};u(B a.4v!=\'1n\')a.4v={}}F{u(B a.2C!=\'1c\')a={17:a};u(B a==\'O\')a={1O:a};u(B a.17==\'1l\')a.17=$(a.17);u(B a.1O==\'1l\')a.1O=3K(a.1O)}D a}A 2B(a,b,c,d,e,f){u(B a==\'1l\'){u(1S(a))a=$(a);F a=1H(a)}u(B a==\'1n\'){u(B a.2C==\'1c\')a=$(a);a=H(f).4j(a);u(a==-1)a=0;u(B c!=\'15\')c=R}F{u(B c!=\'15\')c=J}u(1S(a))a=0;F a=1H(a);u(1S(b))b=0;F b=1H(b);u(c){a+=d}a+=b;u(e>0){4w(a>=e){a-=e}4w(a<0){a+=e}}D a}A H(c,f){u(B f!=\'1l\')f=\'\';D $(\'> *\'+f,c)}A 3t(c,o){D H(c,\':1j(\'+o.y.E+\')\')}A 4b(c,o,n){D H(c,\':1j(\'+(o.y.1G+n)+\'):1J(\'+(n-1)+\')\')}A 3A(c,o){D H(c,\':1j(\'+o.y.E+\')\')}A 4d(c,o){D H(c,\':1j(\'+o.y.1G+\')\')}A 3F(c,o,n){D H(c,\':1j(\'+(o.y.E+n)+\'):1J(\'+(n-1)+\')\')}A 1f(i,o,m){C x=(B m==\'15\')?m:R;u(B m!=\'O\')m=0;i.1z(A(){C t=1H($(V).M(o.z[8]));u(1S(t))t=0;$(V).18(\'4x\',t);$(V).M(o.z[8],((x)?$(V).18(\'4x\'):m+$(V).18(\'1m\')))})}A 2f(i,o,a){4y=2e(i,o,0,a);4z=2G(i,o,3,a);D[4y,4z]}A 2G(i,o,a,b){u(B b!=\'15\')b=R;u(B o[o.z[a]]==\'O\'&&b)D o[o.z[a]];u(B o.y[o.z[a]]==\'O\')D o.y[o.z[a]];D 3o(i,o,a+2)}A 3o(i,o,a){C s=0;i.1z(A(){C m=$(V)[o.z[a]](J);u(s<m)s=m});D s}A 3r(b,o,c){C d=b[o.z[c]](),3L=(o.z[c].56().57(\'24\')>-1)?[\'59\',\'5a\']:[\'5b\',\'5c\'];23(a=0;a<3L.Y;a++){C m=1H(b.M(3L[a]));u(1S(m))m=0;d-=m}D d}A 2e(i,o,a,b){u(B b!=\'15\')b=R;u(B o[o.z[a]]==\'O\'&&b)D o[o.z[a]];u(B o.y[o.z[a]]==\'O\')D o.y[o.z[a]]*i.Y;D 4A(i,o,a+2)}A 4A(i,o,a){C s=0;i.1z(A(){s+=$(V)[o.z[a]](J)});D s}A 3p(i,o,a){C s=R,v=R;i.1z(A(){c=$(V)[o.z[a]]();u(s===R)s=c;F u(s!=c)v=J});D v}A 30(a,o,p){u(B p!=\'15\')p=J;C b=(o.U&&p)?o.K:[0,0,0,0];C c={};c[o.z[0]]=a[0]+b[1]+b[3];c[o.z[3]]=a[1]+b[0]+b[2];D c}A 2D(a,o,p){C b=a.28(),$i=H(a),$l=$i.1r(\':1q(\'+(o.y.E-1)+\')\');b.M(30(2f($i.1r(\':1j(\'+o.y.E+\')\'),o,J),o,p));u(o.U){$l.M(o.z[8],$l.18(\'1m\')+o.K[o.z[10]]);a.M(o.z[7],o.K[o.z[9]]);a.M(o.z[6],o.K[o.z[12]])}a.M(o.z[0],2e($i,o,0)*2);a.M(o.z[3],2G($i,o,3))}A 3S(p){u(B p==\'1c\')D[0,0,0,0];u(B p==\'O\')D[p,p,p,p];F u(B p==\'1l\')p=p.4B(\'5d\').5e(\'\').4B(\' \');u(B p!=\'1n\'){D[0,0,0,0]}23(i 5f p){p[i]=1H(p[i])}1s(p.Y){Q 0:D[0,0,0,0];Q 1:D[p[0],p[0],p[0],p[0]];Q 2:D[p[0],p[1],p[0],p[1]];Q 3:D[p[0],p[1],p[2],p[1]];3E:D[p[0],p[1],p[2],p[3]]}}A 2J(a,o){C b=(B o[o.z[3]]==\'O\')?o[o.z[3]]:2G(a,o,3);D[(o[o.z[0]]-2e(a,o,0))/2,(b-2G(a,o,3))/2]}A 4a(b,o,c){C d=H(b),2o=0,1P=o.y.E-c-1,x=0;u(1P<0)1P=d.Y-1;23(C a=1P;a>=0;a--){2o+=d.1r(\':1q(\'+a+\')\')[o.z[2]](J);u(2o>o.3s)D x;u(a==0)a=d.Y;x++}}A 2s(b,o,c){C d=H(b),2o=0,x=0;23(C a=c;a<=d.Y-1;a++){2o+=d.1r(\':1q(\'+a+\')\')[o.z[2]](J);u(2o>o.3s)D x;u(a==d.Y-1)a=-1;x++}}A 1a(m){u(B m==\'1l\')m=\'1u: \'+m;u(3i.3k&&3i.3k.1a)3i.3k.1a(m);F 5g{3k.1a(m)}5h(5i){}D R}$.1t.4h=A(o){D V.1u(o)}})(5j);',62,330,'||||opts||||||||||||||||||||||||||if||cfs||items|dimensions|function|typeof|var|return|visible|else|trigger|getItems|auto|true|padding|totalItems|css|a_dur|number|firstItem|case|false|next|prev|usePadding|this|pagination|scroll|length|duration||||play|break|boolean|variable|button|data|bind|log|easing|undefined|unbind|tt0|resetMargin|animate|container|call|lt|remove|string|cfs_origCssMargin|object|c_new|fx|eq|filter|switch|fn|carouFredSel|is|l_old|uncover|mousewheel|each|Math|pause|fx_fade|preventDefault|direction|left|oldVisible|parseInt|circular|gt|l_new|w_siz|crossfade|cover|key|start|pauseDuration|position|isNaN|perc|enableNavi|l_cur|stop|complete|updatePageStatus|slideTo|configuration|destroy|css_o|for|width|extend|marginRight|marginBottom|parent|null|pauseTimePassed|pauseOnHover|Not|last|getTotalSize|getSizes|a_cur|a_old|fade|opacity|f_dur|linkAnchors|click|ani_o|total|height|opts_orig|variableVisible|getVisibleItemsNext|getNaviObject|nap|marginTop|marginLeft|pausedGlobal|100|oI|appendTo|getItemIndex|jquery|setSizes|showNavi|removeClass|getLargestSize|getObject|top|getAutoPadding|minimum|keys|autoTimeout|autoInterval|timerInterval|ceil|animated|not|scrolling|slidePrev|slideNext|valid|conditions|onEnd|infinite|clone|mapWrapperSizes|onBefore|onAfter|currentPosition|addClass|hover|num||||The|public|method|deprecated|use|the|custom|event|window|cur_p|console|selected|init|defaults|getTrueLargestSize|hasVariableSizes|floor|getTrueInnerSize|maxDimention|getCurrentItems|anchorBuilder|delay|float|none|unbind_events|clearInterval|getNewItemsPrev|a_new|fx_cover|fx_uncover|default|getNewItemsNext|append|eval|show|hide|getKeyCode|arr|up|right|innerWidth|outerWidth|innerHeight|outerHeight|getPadding|pageAnchorBuilder|build|absolute|relative|hidden|cfs_origCss|bind_events||onPausePause|dur2|setTimeout|setInterval|onPauseEnd|onPauseStart|stopImmediatePropagation|enough||getVisibleItemsPrev|getOldItemsPrev|get|getOldItemsNext|insertItem|end|removeItem|caroufredsel|hash|index|unbind_buttons|bind_buttons|document|keyup|keyCode|current_position|link_anchors|caroufredsel_wrapper|random|span|disabled|timer|while|cfs_tempCssMargin|s1|s2|getTotalSizeVariable|split|No|element|500|2500|fixed|Carousels|CSS|attribute|should|be|static|or|overflow|clearTimeout|resume|prependTo|concat|before|body|find|replaceWith|round|wrap|div||class|location|swing|href|down|toLowerCase|indexOf||paddingLeft|paddingRight|paddingTop|paddingBottom|px|join|in|try|catch|err|jQuery'.split('|'),0,{}))



jQuery(document).ready(function(){
	
	/* logo dropdown */
	$('.arrow').hover( 
		function(){ $('.logo_dropdown').show(); }, 
		function(){  } 
	);
	$('.logo').hover( 
		function(){ $('.logo_dropdown').show(); }, 
		function(){ } 
	);
	$('.logo_dropdown').hover( 
		function(){  }, 
		function(){ $('.logo_dropdown').hide(); } 
	);
	
	/* logo dropdown 2 */
	$('.arrow').hover( 
		function(){ $('.logo_dropdown2').show(); }, 
		function(){  } 
	);
	$('.logo_dropdown2').hover( 
		function(){  }, 
		function(){ $('.logo_dropdown2').hide(); } 
	);
	
	/* language dropdown */
	$('a.lang').hover( 
		function(){ $('.language').show(); $('a.lang').css('borderColor', '#bdbdbd'); }, 
		function(){ $('.language').hide(); $('a.lang').css('borderColor', '#ffffff'); } 
	);
	$('.language').hover(
		function(){ $('.language').show(); $('a.lang').css('borderColor', '#bdbdbd'); }, 
		function(){ $('.language').hide(); $('a.lang').css('borderColor', '#ffffff'); } 
	);
	
	/* my-account dropdown */
	$('.top_link a.myac').hover( 
		function(){ $('.top_link .myac_cont').show(); $('.top_link a.myac').css('borderColor', '#bdbdbd'); }, 
		function(){ $('.top_link .myac_cont').hide(); $('.top_link a.myac').css('borderColor', '#ffffff'); } 
	);
	$('.top_link .myac_cont').hover( 
		function(){ $('.top_link .myac_cont').show(); $('.top_link a.myac').css('borderColor', '#bdbdbd'); }, 
		function(){ $('.top_link .myac_cont').hide(); $('.top_link a.myac').css('borderColor', '#ffffff'); } 
	);
	
	/* show submenu of mainmenu */
	$('ul.main_nav li').hover(
		function(){
			var hasSubMenu = $(this).find('.sub_nav').length;
			if( hasSubMenu > 0 ) {
				$(this).addClass('slctNav');
				$(this).find('.sub_nav').show();
			}
		},
		function(){
			$(this).removeClass('slctNav');
			$(this).find('.sub_nav').hide();
		}
	);
	
	/* shop filter */
	$('.shop2 .expand').click(function(){
		if( $(this).hasClass('collapsed') ) {
			$(this).removeClass('collapsed');
			$('.shop_top_form').slideUp();
			return false;
		} else {
			$(this).addClass('collapsed');
			$('.shop_top_form').slideDown();
			return false;
		}
	});
	/* product thumbs slide */
	
	$('.shopnav ul').carouFredSel({
		items: 6,
		scroll: 1,
		circular: true,
		infinite: false,
		auto: false,
		prev: '.shopnav .prev',
		next: '.shopnav .next'
	});
	
	
	/* Open Overlays */
	var overlayBtn = $('a[rel=overlay]');
	overlayBtn.live('click', function (){
		var $el = $(this).attr('href');
		$height = ( $($el).height() > 0 ) ? ( $($el).height() ) : 243;
		$width = ( $($el).width() > 0 ) ? ( $($el).width() ) : 386;
		$( $el ).dialog({
					minHeight: $height,
					minWidth: $width,
					resizable: false,
					show: 'scale',
					hide: 'puff',
					modal: true,
					open: function() {
						
					}
		});
		return false;
	});
	
	
	/* remove forum tag */
	if( $('.all_tags .tag').length > 0 ){
		$('.all_tags .tag a.del').click( function(){
			$(this).parent().fadeOut(300, function(){ $(this).remove();} );
		});
	}
	/* remove forum tag */
	if( $('.butn_cont4 .tag').length > 0 ){
		$('.butn_cont4 .tag a.del').click( function(){
			$(this).parent().fadeOut(300, function(){ $(this).remove();} );
		});
	}
	
	/* active/disable forum tag */
	if( $('.tag').length > 0 ){
		$('.tag a.toggle').click( function(){
			if($(this).parent().hasClass('active')){
				$(this).parent().removeClass('active')
			} else {
				$(this).parent().addClass('active')
			}
		});
	}
	
	
	/* Attached Media hover state */
	if( $('.attached_pic').length > 0 ) {
		$('.attached_pic .photo2').hover(
			function(){ $(this).parent().addClass('slctPhoto'); },
			function(){ $(this).parent().removeClass('slctPhoto'); }
		);
		$('.attached_pic .zoom').hover(
			function(){ $(this).parent().addClass('slctPhoto'); },
			function(){ $(this).parent().removeClass('slctPhoto'); }
		);
	}
	
	/* Product Tab */
	$("#prodtabs").tabs();
	
	/* TagList tab */
	$("#tag_list").tabs();
	
	/* slider */
	$("#slider").slider({ step: 100 });
	$('.slider-cont .left').click(function(){ $("#slider").slider( "option", "value", 0 ); return false; });
	$('.slider-cont .right').click(function(){ $("#slider").slider( "option", "value", 100 ); return false; });
	$('#slideLeft').click(function(){ $("#slider").slider( "option", "value", 0 ); return false; });
	$('#slideRight').click(function(){ $("#slider").slider( "option", "value", 100 ); return false; });
	
	
	/* preload images for better visualization on hover --- start */

	/* preloading logo_dropdown images */
	var img_logo_dropdown_1 = new Image(); img_logo_dropdown_1.src = "images/logo_dropdown.png";
	var img_logo_dropdown_2 = new Image(); img_logo_dropdown_2.src = "images/img_1.gif";
	var img_logo_dropdown_3 = new Image(); img_logo_dropdown_3.src = "images/logo_hover.gif";
	var img_logo_dropdown_4 = new Image(); img_logo_dropdown_4.src = "images/logo2.png";
	var img_logo_dropdown_5 = new Image(); img_logo_dropdown_5.src = "images/logo3.png";
	var img_logo_dropdown_6 = new Image(); img_logo_dropdown_6.src = "images/logo4.png";
	
	/* preloading logo_dropdown2 images */
	var img_logo_dropdown2_1 = new Image(); img_logo_dropdown2_1.src = "images/logo5.png";
	var img_logo_dropdown2_2 = new Image(); img_logo_dropdown2_2.src = "images/logo6.png";
	var img_logo_dropdown2_3 = new Image(); img_logo_dropdown2_3.src = "images/logo7.png";
	var img_logo_dropdown2_4 = new Image(); img_logo_dropdown2_4.src = "images/logo_dropdown2.png";

	/* preloading main_nav images */
	var img_main_nav_1 = new Image(); img_main_nav_1.src = "images/sub_navBgTop.png";
	var img_main_nav_2 = new Image(); img_main_nav_2.src = "images/sub_navBgBtm.png";
	var img_main_nav_3 = new Image(); img_main_nav_3.src = "images/sub_navBg.png";
	var img_main_nav_4 = new Image(); img_main_nav_4.src = "images/bullet_2.gif";
	
	/* preloading top_dropdown images */
	var img_top_dropdown_1 = new Image(); img_top_dropdown_1.src = "images/myac_contBg.gif";
	var img_top_dropdown_2 = new Image(); img_top_dropdown_2.src = "images/lang_bg.gif";
	
	/* preloading overlay images */
	var img_overlay_1 = new Image(); img_overlay_1.src = "images/icon-close.gif";
	var img_overlay_2 = new Image(); img_overlay_2.src = "images/imagepop_bg.png";
	var img_overlay_3 = new Image(); img_overlay_3.src = "images/addtag_bg.gif";
	var img_overlay_4 = new Image(); img_overlay_4.src = "images/loading_bg.gif";
	var img_overlay_5 = new Image(); img_overlay_5.src = "images/loading_bg2.gif";
	
	/* preloading tooltip images */
	var img_tooltip_1 = new Image(); img_tooltip_1.src = "scripts/tip-blue/tip-blue.png";
	var img_tooltip_2 = new Image(); img_tooltip_2.src = "scripts/tip-blue/tip-blue_arrows.png";
	
	/* preload images for better visualization on hover --- end */
	
	
	
	  // Blog post share buttons
  var $fixedEls = $('.grip');
  if ( $fixedEls.length ) {
		var h = 230;

		$fixedEls.each(function() {
			var $el = $(this);
			$el.data('grip', {
				aPos : {
					right : $el.css('right'),
					top : $el.css('top'),
					position : ''
				},
				fPos : {
					position: 'fixed',
					top: '20px',
					left: $el.offset().left
				}
			});
		});

		$(window).scroll(function() {
			var dPos = $(window).scrollTop();

			$fixedEls.each(function() {
				var $el = $(this);

				if ( dPos > h && !$el.is('.fixed') ) {
					$el.addClass('fixed').css($el.data('grip').fPos);
				}
				else if ( dPos <= h ) {
					$el.removeClass('fixed').css( $el.data('grip').aPos );
				}
			});
		});
  }
  
  
  
	// Forms
	// 1. Prettify
	$('form.forum_top').kcForm();
	$('form.forum_left').kcForm();
	$('form.reply_form').kcForm();
	$('form.wholesale').kcForm();
	$('form.join_form').kcForm();
	$('form.account_form').kcForm();
	$('form.billing').kcForm();
	$('form.shop_top').kcForm();
	$('form.shop_left_form').kcForm();
	$('form.shop_nav_form').kcForm();
	$('form.shop_top_form').kcForm();
	$('form.contact').kcForm();
	$('form.login').kcForm();
	$('form.manage_add').kcForm();
	$('form.manage_pay').kcForm();
	$('form.submit_photo').kcForm();
	$('form.follow_artist').kcForm();
	$('form.submit_idea').kcForm();
	$('form.check_form').kcForm();
	$('form.check_form2').kcForm();
	$('form.check_form3').kcForm();
	$('form.tab_main').kcForm();
    $('form.return_form').kcForm();
	
	/* tooltip */
	$('a').each(function(){
		var titleText = $(this).attr('title');
		if(titleText!='') {
			$(this).poshytip({
				className: 'tip-blue',
				bgImageFrameSize: 5,
				alignTo: 'cursor',
				showOn: 'hover',
				followCursor: true
			});
		}
	});
	
});


/**
 * Prettify form elements
 *
 * 0.2 - 20101126
 */
(function($) {
	// Dependencies
	$.fn.kcFormDep = function( open ) {
		var $input	= $(this),
				$target	= $('#' + $input.attr('name') + '-' + $input.val());

		if ( !$target.length )
			return this;

		if ( $target.is('span') )
			open && $target.show('slide', {direction: 'left'}, 200)
						|| $target.hide('slide', {direction: 'left'}, 200);
		else
			open && $target.slideDown('slow')
						|| $target.slideUp('slow');

		return this;
	}

	$.fn.kcFormClass = function(obj) {
		var $classes = '',
				$inputId = obj.attr('id'),
				$inputCl = obj.attr('class');
		if ( $inputId != undefined || $inputId != '' )
			$classes += $inputId;
		if ( $inputCl != undefined || $inputCl != '' )
			$classes += ' '+$inputCl;

		return ( $classes != '' ) ? $(this).addClass( $classes ) : $(this);
	}

	// Radio & Checkbox
	$.fn.kcFormCR = function() {
		return this.each(function() {
			var $self	 = this,
					$input = $($self),
					$type	 = $input.attr('type'),
					$name	 = $input.attr('name'),
					$label = $input.parents('label'),
					$wrap	 = $('<span class="kcf-'+$type+'"/>'),
					$nu		 = $('<a href="#" />');

			$input.hide().wrap($wrap).parent().kcFormClass($input).prepend($nu);

			$input.change(function(e) {
				if ( this.checked ) {
					$(this).kcFormDep(true);
					$nu.addClass('checked');
				} else {
					$(this).kcFormDep(false);
					$nu.removeClass('checked');
				}

				if ( $type == 'radio' ) {
					$('input[name='+$name+']', $self.form).not($input).each(function() {
						$(this).kcFormDep(false).siblings('a').removeClass('checked');
					});
				}

				return true;
			});

			$nu.click(function(e) {
				if ( $.browser.msie ) {
					$input.focus();
					$input.blur();
				}
				$input.trigger('click').trigger('change');
				return false;
			});
			
			$input.trigger('change');
		});
	}


	// Select
	$.fn.kcFormSelect = function() {
		return this.each(function() {
			var $select 	= $(this),

					$opt			= $('option:selected', $select),
					$optIdx 	= $opt.index(),
					$selector = $select.hide().wrap('<div class="selector" />')
												.parent().kcFormClass($select)
												.prepend('<ul />')
												.prepend('<span class="head" />'),
					$list			= $('ul', $selector),
					$head			= $('.head', $selector);
					
			$selector.bind('optSel', function(e, o, i) {
				var colorTagHead = '';
				$('option', $select).each(function() {
					/* extract color info from option's title attribute */
					var attrTitle = $(this).attr('title');
					var colorTag = '';
					if( attrTitle!='' && attrTitle.match(/^color:#[0-9a-fA-F]{6}$/gi)!=null ) {
						var color = attrTitle.match(/[0-9a-fA-F]{6}$/gi)
						colorTag = '<span class="selColor" style="background:#'+ color +'">'+ color +'</span>';
					}
					if ( i ) { 
						if( $(this).attr('selected') ){ colorTagHead = colorTag; }
						$list.append('<li>'+colorTag+'<a href="#">'+$(this).text()+'</a></li>');
					} else {
						if ( $(this).index() == o.index() ) {
							this.selected = true;
							$(this).change();
							$(this).kcFormDep( true );
						} else {
							this.selected = false;
							$(this).kcFormDep( false );
						}
					}
				});
				
				$head.html(colorTagHead+o.html());
				$list.children().removeClass('selected').filter(':eq('+o.index()+')').addClass('selected');
			});

			$selector.trigger('optSel', [$opt, true]);

			$head.click(function() {
				$selector.toggleClass('selector-open');
				$list.slideToggle(400);
				return false;
			});

			$('a', $list).click(function() {
				var $opt = $(this).parent();
				$selector.trigger('optSel', [$opt, false]).find('.head').trigger('click');
				$select.trigger('change');
				return false;
			});
			
		});

	}

	// The form
	$.fn.kcForm = function() {
		return $(this).addClass('kcf').each(function() {
			$('input:checkbox', this).kcFormCR();
			$('input:radio', this).kcFormCR();
			$('select', this).kcFormSelect();
		});
	}


})(jQuery);

$(document).ready(function() {
	var ideaIss = "";
	$("#submitIdea").click(function() {
		$("input.ideaIs").each(function() {
			
			ideaIss = ideaIss + $(this).val() + ", ";
			$("#ideaTypes").val(ideaIss);
		});		
		$.ajax({
			 url: "/ajax/submitIdea.ajax.php",
			 dataType: "json",
			 type: "POST", 
			 cache: "false",
			 data: { userEmail : $("#userEmail").val(), theIdea: $("#theIdea").val(), ideaIs : $("#ideaTypes").val()}, 
			 success: function(data)
			 {
				 if(data.status == "success")
				 {	
					$("#ideaOverlay").dialog("close");
				 }
			 }		  
		  });		
		
		return false;
	});
	
	$("#contactUs").click(function() {	
	
		var error = 0;
		$("#contactUsErrors").html('');
		if($("#contact-us-email").val() == "user@domain.com" || $("#contact-us-email").val() == "") 
		{
			$("#contact-us-email").parent().addClass("red");
			$("#contactUsErrors").html("Please enter an email");
			error = 1;
		}
		if($("#contact-us-name").val() == "")
		{
			$("#contact-us-name").parent().addClass("red");
			$("#contactUsErrors").html("Please enter your name");
			error = 1;
		}
		if($("#contact-us-message").val() == "")
		{
			error = 1;
			$("#contact-us-message").parent().addClass("red");	
			$("#contactUsErrors").html("Please enter a message");
		}
		
		if(error == 0)
		{
			
			$.ajax({
				 url: "/ajax/contactUs.ajax.php",
				 dataType: "json",
				 type: "POST", 
				 cache: "false",
				 data: { userEmail : $("#contact-us-email").val(), name: $("#contact-us-name").val(), message : $("#contact-us-message").val(), subject: $("#contact-us-subject").val()}, 
				 success: function(data)
				 {
					 if(data.status == "success")
					 {
						$("#contactUsOverlay").dialog("close");
					 }
				 }		  
			  });		
		}
			return false;
	});
	
	
	//coupon overlay
	$("#applyCoupon").click(function() {
	
	if($("#couponCode").val() == "") 
	{
		$("#couponError").html("Please enter a coupon code.").show();
		return false;	
	}
		$.ajax({
			 url: "/ajax/applyCoupon.php",
			 dataType: "json",
			 type: "POST", 
			 cache: "false",
			 data: { couponCode : $("#couponCode").val() }, 
			 success: function(data)
			 {
				if(data.status)
				{
					updateTrData();
					$("#addCouponOverlayCheckout").dialog("close");
				}
				else
				{
					$("#couponError").html(data.message).show();
				}
			 }		  
		  });		
		
		return false;
	});
	
});

