//Smooth Scroll Plugin
(function(a){jQuery.fn.smoothDivScroll=function(b){var c={scrollingHotSpotLeft:"div.scrollingHotSpotLeft",scrollingHotSpotRight:"div.scrollingHotSpotRight",scrollWrapper:"div.scrollWrapper",scrollableArea:"div.scrollableArea",hiddenOnStart:false,ajaxContentURL:"",countOnlyClass:"",scrollingSpeed:25,mouseDownSpeedBooster:3,autoScroll:"",autoScrollDirection:"right",autoScrollSpeed:1,pauseAutoScroll:"",visibleHotSpots:"",hotSpotsVisibleTime:5,startAtElementId:""};b=a.extend(c,b);return this.each(function(){var e=a(this);if(b.ajaxContentURL.length!==0){e.scrollableAreaWidth=0;e.find(b.scrollableArea).load((b.ajaxContentURL),function(){e.find(b.scrollableArea).children((b.countOnlyClass)).each(function(){e.scrollableAreaWidth=e.scrollableAreaWidth+a(this).outerWidth(true)});e.find(b.scrollableArea).css("width",(e.scrollableAreaWidth+"px"));if(b.hiddenOnStart){e.hide()}q();n()})}var k;var j;var t=e.offset().left;var u=0;j=1;var o=false;a(window).one("load",function(){if(b.ajaxContentURL.length===0){e.scrollableAreaWidth=0;e.tempStartingPosition=0;e.find(b.scrollableArea).children((b.countOnlyClass)).each(function(){if((b.startAtElementId.length!==0)&&((a(this).attr("id"))==b.startAtElementId)){e.tempStartingPosition=e.scrollableAreaWidth}e.scrollableAreaWidth=e.scrollableAreaWidth+a(this).outerWidth(true)});e.find(b.scrollableArea).css("width",e.scrollableAreaWidth+"px");if(b.hiddenOnStart){e.hide()}}e.find(b.scrollWrapper).scrollLeft(e.tempStartingPosition);if(b.autoScroll!==""){e.autoScrollInterval=setInterval(h,6)}if(b.autoScroll=="always"){p();l()}switch(b.visibleHotSpots){case"always":i();break;case"onstart":i();e.hideHotSpotBackgroundsInterval=setInterval(d,(b.hotSpotsVisibleTime*1000));break;default:break}});e.find(b.scrollingHotSpotRight,b.scrollingHotSpotLeft).one("mouseover",function(){if(b.autoScroll=="onstart"){clearInterval(e.autoScrollInterval)}});a(window).bind("resize",function(){q()});function q(){if(!(b.hiddenOnStart)){e.scrollableAreaWidth=0;e.find(b.scrollableArea).children((b.countOnlyClass)).each(function(){e.scrollableAreaWidth=e.scrollableAreaWidth+a(this).outerWidth(true)});e.find(b.scrollableArea).css("width",e.scrollableAreaWidth+"px")}e.find(b.scrollWrapper).scrollLeft("0");var v=a("body").innerWidth();if(b.autoScroll!=="always"){if(e.scrollableAreaWidth<v){p();l()}else{m()}}}function p(){e.find(b.scrollingHotSpotLeft).hide()}function l(){e.find(b.scrollingHotSpotRight).hide()}function s(){e.find(b.scrollingHotSpotLeft).show();if(u<=0){u=e.find(b.scrollingHotSpotLeft).width()}}function r(){e.find(b.scrollingHotSpotRight).show();if(u<=0){u=e.find(b.scrollingHotSpotRight).width()}}function n(){jQuery.each(jQuery.browser,function(v,w){if(v=="msie"&&jQuery.browser.version.substr(0,1)=="6"){e.find(b.scrollingHotSpotLeft).css("height",(e.find(b.scrollableArea).innerHeight()));e.find(b.scrollingHotSpotRight).css("height",(e.find(b.scrollableArea).innerHeight()))}})}e.find(b.scrollingHotSpotRight).bind("mousemove",function(w){var v=w.pageX-(this.offsetLeft+t);k=Math.round((v/u)*b.scrollingSpeed);if(k===Infinity){k=0}});e.find(b.scrollingHotSpotRight).bind("mouseover",function(){if(b.autoScroll=="onstart"){clearInterval(e.autoScrollInterval)}e.rightScrollInterval=setInterval(g,6)});e.find(b.scrollingHotSpotRight).bind("mouseout",function(){clearInterval(e.rightScrollInterval);k=0});e.find(b.scrollingHotSpotRight).bind("mousedown",function(){j=b.mouseDownSpeedBooster});a("*").bind("mouseup",function(){j=1});var g=function(){if(k>0){e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+(k*j))}m()};if(b.pauseAutoScroll=="mousedown"&&b.autoScroll=="always"){e.find(b.scrollWrapper).bind("mousedown",function(){clearInterval(e.autoScrollInterval)});e.find(b.scrollWrapper).bind("mouseup",function(){e.autoScrollInterval=setInterval(h,6)})}else{if(b.pauseAutoScroll=="mouseover"&&b.autoScroll=="always"){e.find(b.scrollWrapper).bind("mouseover",function(){clearInterval(e.autoScrollInterval)});e.find(b.scrollWrapper).bind("mouseout",function(){e.autoScrollInterval=setInterval(h,6)})}}e.previousScrollLeft=0;e.pingPongDirection="right";e.swapAt;e.getNextElementWidth=true;var h=function(){if(b.autoScroll=="onstart"){m()}switch(b.autoScrollDirection){case"right":e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+b.autoScrollSpeed);break;case"left":e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()-b.autoScrollSpeed);break;case"backandforth":e.previousScrollLeft=e.find(b.scrollWrapper).scrollLeft();if(e.pingPongDirection=="right"){e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+b.autoScrollSpeed)}else{e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()-b.autoScrollSpeed)}if(e.previousScrollLeft===e.find(b.scrollWrapper).scrollLeft()){if(e.pingPongDirection=="right"){e.pingPongDirection="left"}else{e.pingPongDirection="right"}}break;case"endlessloop":if(e.getNextElementWidth){if(b.startAtElementId!==""){e.swapAt=a("#"+b.startAtElementId).outerWidth()}else{e.swapAt=e.find(b.scrollableArea).children(":first-child").outerWidth()}e.getNextElementWidth=false}e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+b.autoScrollSpeed);if((e.swapAt<=e.find(b.scrollWrapper).scrollLeft())){e.find(b.scrollableArea).append(e.find(b.scrollableArea).children(":first-child").clone());e.find(b.scrollWrapper).scrollLeft((e.find(b.scrollWrapper).scrollLeft()-e.find(b.scrollableArea).children(":first-child").outerWidth()));e.find(b.scrollableArea).children(":first-child").remove();e.getNextElementWidth=true}break;default:break}};e.find(b.scrollingHotSpotLeft).bind("mousemove",function(w){var v=e.find(b.scrollingHotSpotLeft).innerWidth()-(w.pageX-t);k=Math.round((v/u)*b.scrollingSpeed);if(k===Infinity){k=0}});e.find(b.scrollingHotSpotLeft).bind("mouseover",function(){if(b.autoScroll=="onstart"){clearInterval(e.autoScrollInterval)}e.leftScrollInterval=setInterval(f,6)});e.find(b.scrollingHotSpotLeft).bind("mouseout",function(){clearInterval(e.leftScrollInterval);k=0});e.find(b.scrollingHotSpotLeft).bind("mousedown",function(){j=b.mouseDownSpeedBooster});var f=function(){if(k>0){e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()-(k*j))}m()};function m(){if(e.find(b.scrollWrapper).scrollLeft()===0){p();r()}else{if((e.scrollableAreaWidth)<=(e.find(b.scrollWrapper).innerWidth()+e.find(b.scrollWrapper).scrollLeft())){l();s()}else{r();s()}}}function i(){e.find(b.scrollingHotSpotLeft).addClass("scrollingHotSpotLeftVisible");e.find(b.scrollingHotSpotRight).addClass("scrollingHotSpotRightVisible")}function d(){clearInterval(e.hideHotSpotBackgroundsInterval);e.find(b.scrollingHotSpotLeft).fadeTo("slow",0,function(){e.find(b.scrollingHotSpotLeft).removeClass("scrollingHotSpotLeftVisible")});e.find(b.scrollingHotSpotRight).fadeTo("slow",0,function(){e.find(b.scrollingHotSpotRight).removeClass("scrollingHotSpotRightVisible")})}})}})(jQuery);

//ScrollTo Plugin
;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);

/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

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

	// 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]), parseInt(result[2]), parseInt(result[3])];

		// 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)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	
	function getColor(elem, attr) {
		var color;

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

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.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]
	};
	
})(jQuery);