
function loadCheckOpenInTopLocation(){
	/* thickbox is present (id = "#TB_iframeContent". prevents thickbox of being opened in top location */
	if(jQuery(window.top.document).find("#TB_iframeContent, #TB_ajaxContent, .paragraph div:hidden iframe[src*=" + self.location.href + "]").length){
		return false;
	}
	else{
		return true;
	}
}
	
if(loadCheckOpenInTopLocation()){
	/* iframe context check*/
	$selfLocation = self.location.href;
	$trimmedSelfLocation = "";
	$topLocation = top.location.href;
	
	 if($selfLocation.indexOf("#") != -1){
		 $trimmedSelfLocation = $selfLocation.substr(0,$selfLocation.indexOf('#'));
	 }
	 
	 if (($selfLocation != $topLocation)) {
		 if($trimmedSelfLocation != ""){
			 top.location.href = $trimmedSelfLocation;
		 }else{
			 top.location.href = $selfLocation;
		 }
	 };
}
/*
 * touchSwipe - jQuery Plugin
 * http://plugins.jquery.com/project/touchSwipe
 * http://labs.skinkers.com/touchSwipe/
 *
 * Copyright (c) 2010 Matt Bryson (www.skinkers.com)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 * $version: 1.2.5
 *
 * Changelog
 * $Date: 2010-12-12 (Wed, 12 Dec 2010) $
 * $version: 1.0.0 
 * $version: 1.0.1 - removed multibyte comments
 *
 * $Date: 2011-21-02 (Mon, 21 Feb 2011) $
 * $version: 1.1.0 	- added allowPageScroll property to allow swiping and scrolling of page
 *					- changed handler signatures so one handler can be used for multiple events
 * $Date: 2011-23-02 (Wed, 23 Feb 2011) $
 * $version: 1.2.0 	- added click handler. This is fired if the user simply clicks and does not swipe. The event object and click target are passed to handler.
 *					- If you use the http://code.google.com/p/jquery-ui-for-ipad-and-iphone/ plugin, you can also assign jQuery mouse events to children of a touchSwipe object.
 * $version: 1.2.1 	- removed console log!
 *
 * $version: 1.2.2 	- Fixed bug where scope was not preserved in callback methods. 
 *
 * $Date: 2011-28-04 (Thurs, 28 April 2011) $
 * $version: 1.2.4 	- Changed licence terms to be MIT or GPL inline with jQuery. Added check for support of touch events to stop non compatible browsers erroring.
 *
 * $Date: 2011-27-09 (Tues, 27 September 2011) $
 * $version: 1.2.5 	- Added support for testing swipes with mouse on desktop browser (thanks to https://github.com/joelhy)

 * A jQuery plugin to capture left, right, up and down swipes on touch devices.
 * You can capture 2 finger or 1 finger swipes, set the threshold and define either a catch all handler, or individual direction handlers.
 * Options:
 * 		swipe 		Function 	A catch all handler that is triggered for all swipe directions. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeLeft	Function 	A handler that is triggered for "left" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeRight	Function 	A handler that is triggered for "right" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeUp		Function 	A handler that is triggered for "up" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeDown	Function 	A handler that is triggered for "down" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 *		swipeStatus Function 	A handler triggered for every phase of the swipe. Handler is passed 4 arguments: event : The original event object, phase:The current swipe face, either "start?, "move?, "end? or "cancel?. direction : The swipe direction, either "up?, "down?, "left " or "right?.distance : The distance of the swipe.
 *		click		Function	A handler triggered when a user just clicks on the item, rather than swipes it. If they do not move, click is triggered, if they do move, it is not.
 *
 * 		fingers 	int 		Default 1. 	The number of fingers to trigger the swipe, 1 or 2.
 * 		threshold 	int  		Default 75.	The number of pixels that the user must move their finger by before it is considered a swipe.
 *		triggerOnTouchEnd Boolean Default true If true, the swipe events are triggered when the touch end event is received (user releases finger).  If false, it will be triggered on reaching the threshold, and then cancel the touch event automatically.
 *		allowPageScroll String Default "auto". How the browser handles page scrolls when the user is swiping on a touchSwipe object. 
 *										"auto" : all undefined swipes will cause the page to scroll in that direction.
 *										"none" : the page will not scroll when user swipes.
 *										"horizontal" : will force page to scroll on horizontal swipes.
 *										"vertical" : will force page to scroll on vertical swipes.
 *
 * This jQuery plugin will only run on devices running Mobile Webkit based browsers (iOS 2.0+, android 2.2+)
 */
(function($) 
{
	$.fn.swipe = function(options) 
	{
		if (!this) return false;
		
		// Default thresholds & swipe functions
		var defaults = {
					
			fingers 		: 1,								// int - The number of fingers to trigger the swipe, 1 or 2. Default is 1.
			threshold 		: 75,								// int - The number of pixels that the user must move their finger by before it is considered a swipe. Default is 75.
			
			swipe 			: null,		// Function - A catch all handler that is triggered for all swipe directions. Accepts 2 arguments, the original event object and the direction of the swipe : "left", "right", "up", "down".
			swipeLeft		: null,		// Function - A handler that is triggered for "left" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeRight		: null,		// Function - A handler that is triggered for "right" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeUp			: null,		// Function - A handler that is triggered for "up" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeDown		: null,		// Function - A handler that is triggered for "down" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeStatus		: null,		// Function - A handler triggered for every phase of the swipe. Handler is passed 4 arguments: event : The original event object, phase:The current swipe face, either "start?, "move?, "end? or "cancel?. direction : The swipe direction, either "up?, "down?, "left " or "right?.distance : The distance of the swipe.
			click			: null,		// Function	- A handler triggered when a user just clicks on the item, rather than swipes it. If they do not move, click is triggered, if they do move, it is not.
			
			triggerOnTouchEnd : true,	// Boolean, if true, the swipe events are triggered when the touch end event is received (user releases finger).  If false, it will be triggered on reaching the threshold, and then cancel the touch event automatically.
			allowPageScroll : "auto" 	/* How the browser handles page scrolls when the user is swiping on a touchSwipe object. 
											"auto" : all undefined swipes will cause the page to scroll in that direction.
 											"none" : the page will not scroll when user swipes.
 											"horizontal" : will force page to scroll on horizontal swipes.
 											"vertical" : will force page to scroll on vertical swipes.
										*/
		};
		
		
		//Constants
		var LEFT = "left";
		var RIGHT = "right";
		var UP = "up";
		var DOWN = "down";
		var NONE = "none";
		var HORIZONTAL = "horizontal";
		var VERTICAL = "vertical";
		var AUTO = "auto";
		
		var PHASE_START="start";
		var PHASE_MOVE="move";
		var PHASE_END="end";
		var PHASE_CANCEL="cancel";
		
	    var hasTouch = 'ontouchstart' in window,
        START_EV = hasTouch ? 'touchstart' : 'mousedown',
        MOVE_EV = hasTouch ? 'touchmove' : 'mousemove',
        END_EV = hasTouch ? 'touchend' : 'mouseup',
        CANCEL_EV = 'touchcancel';
		
		var phase="start";
		
		if (options.allowPageScroll==undefined && (options.swipe!=undefined || options.swipeStatus!=undefined))
			options.allowPageScroll=NONE;
		
		if (options)
			$.extend(defaults, options);
		
		
		/**
		 * Setup each object to detect swipe gestures
		 */
		return this.each(function() 
		{
            var that = this;
			var $this = $(this);
			
			var triggerElementID = null; 	// this variable is used to identity the triggering element
			var fingerCount = 0;			// the current number of fingers being used.	
			
			//track mouse points / delta
			var start={x:0, y:0};
			var end={x:0, y:0};
			var delta={x:0, y:0};
			
			
			/**
			* Event handler for a touch start event. 
			* Stops the default click event from triggering and stores where we touched
			*/
			function touchStart(event) 
			{
                var evt = hasTouch ? event.touches[0] : event; 
				phase = PHASE_START;
		
                if (hasTouch) {
                    // get the total number of fingers touching the screen
                    fingerCount = event.touches.length;
                }
				
				//clear vars..
				distance=0;
				direction=null;
				
				// check the number of fingers is what we are looking for
				if (fingerCount == defaults.fingers || !hasTouch) 
				{
					// get the coordinates of the touch
					start.x = end.x = evt.pageX;
					start.y = end.y = evt.pageY;
					
					if (defaults.swipeStatus)
						triggerHandler(event, phase);
				} 
				else 
				{
					//touch with more/less than the fingers we are looking for
					touchCancel(event);
				}

				that.addEventListener(MOVE_EV, touchMove, false);
				that.addEventListener(END_EV, touchEnd, false);
			}

			/**
			* Event handler for a touch move event. 
			* If we change fingers during move, then cancel the event
			*/
			function touchMove(event) 
			{
				if (phase == PHASE_END || phase == PHASE_CANCEL)
					return;
                
                var evt = hasTouch ? event.touches[0] : event; 
				
				end.x = evt.pageX;
				end.y = evt.pageY;
					
				direction = caluculateDirection();
                if (hasTouch) {
                    fingerCount = event.touches.length;
                }
				
				phase = PHASE_MOVE
				
				//Check if we need to prevent default evnet (page scroll) or not
				validateDefaultEvent(event, direction);
		
				if ( fingerCount == defaults.fingers || !hasTouch) 
				{
					distance = caluculateDistance();
					
					if (defaults.swipeStatus)
						triggerHandler(event, phase, direction, distance);
					
					//If we trigger whilst dragging, not on touch end, then calculate now...
					if (!defaults.triggerOnTouchEnd)
					{
						// if the user swiped more than the minimum length, perform the appropriate action
						if ( distance >= defaults.threshold ) 
						{
							phase = PHASE_END;
							triggerHandler(event, phase);
							touchCancel(event); // reset the variables
						}
					}
				} 
				else 
				{
					phase = PHASE_CANCEL;
					triggerHandler(event, phase); 
					touchCancel(event);
				}
			}
			
			/**
			* Event handler for a touch end event. 
			* Calculate the direction and trigger events
			*/
			function touchEnd(event) 
			{
				event.preventDefault();
				
				distance = caluculateDistance();
				direction = caluculateDirection();
						
				if (defaults.triggerOnTouchEnd)
				{
					phase = PHASE_END;
					// check to see if more than one finger was used and that there is an ending coordinate
					if ( (fingerCount == defaults.fingers  || !hasTouch) && end.x != 0 ) 
					{
						// if the user swiped more than the minimum length, perform the appropriate action
						if ( distance >= defaults.threshold ) 
						{
							triggerHandler(event, phase);
							touchCancel(event); // reset the variables
						} 
						else 
						{
							phase = PHASE_CANCEL;
							triggerHandler(event, phase); 
							touchCancel(event);
						}	
					} 
					else 
					{
						phase = PHASE_CANCEL;
						triggerHandler(event, phase); 
						touchCancel(event);
					}
				}
				else if (phase == PHASE_MOVE)
				{
					phase = PHASE_CANCEL;
					triggerHandler(event, phase); 
					touchCancel(event);
				}
				that.removeEventListener(MOVE_EV, touchMove, false);
				that.removeEventListener(END_EV, touchEnd, false);
			}
			
			/**
			* Event handler for a touch cancel event. 
			* Clears current vars
			*/
			function touchCancel(event) 
			{
				// reset the variables back to default values
				fingerCount = 0;
				
				start.x = 0;
				start.y = 0;
				end.x = 0;
				end.y = 0;
				delta.x = 0;
				delta.y = 0;
			}
			
			
			/**
			* Trigger the relevant event handler
			* The handlers are passed the original event, the element that was swiped, and in the case of the catch all handler, the direction that was swiped, "left", "right", "up", or "down"
			*/
			function triggerHandler(event, phase) 
			{
				//update status
				if (defaults.swipeStatus)
					defaults.swipeStatus.call($this,event, phase, direction || null, distance || 0);
				
				
				if (phase == PHASE_CANCEL)
				{
					if (defaults.click && (fingerCount==1 || !hasTouch) && (isNaN(distance) || distance==0))
						defaults.click.call($this,event, event.target);
				}
				
				if (phase == PHASE_END)
				{
					//trigger catch all event handler
					if (defaults.swipe)
				{
						
						defaults.swipe.call($this,event, direction, distance);
						
				}
					//trigger direction specific event handlers	
					switch(direction)
					{
						case LEFT :
							if (defaults.swipeLeft)
								defaults.swipeLeft.call($this,event, direction, distance);
							break;
						
						case RIGHT :
							if (defaults.swipeRight)
								defaults.swipeRight.call($this,event, direction, distance);
							break;

						case UP :
							if (defaults.swipeUp)
								defaults.swipeUp.call($this,event, direction, distance);
							break;
						
						case DOWN :	
							if (defaults.swipeDown)
								defaults.swipeDown.call($this,event, direction, distance);
							break;
					}
				}
			}
			
			
			/**
			 * Checks direction of the swipe and the value allowPageScroll to see if we should allow or prevent the default behaviour from occurring.
			 * This will essentially allow page scrolling or not when the user is swiping on a touchSwipe object.
			 */
			function validateDefaultEvent(event, direction)
			{
				if( defaults.allowPageScroll==NONE )
				{
					event.preventDefault();
				}
				else 
				{
					var auto=defaults.allowPageScroll==AUTO;
					
					switch(direction)
					{
						case LEFT :
							if ( (defaults.swipeLeft && auto) || (!auto && defaults.allowPageScroll!=HORIZONTAL))
								event.preventDefault();
							break;
						
						case RIGHT :
							if ( (defaults.swipeRight && auto) || (!auto && defaults.allowPageScroll!=HORIZONTAL))
								event.preventDefault();
							break;

						case UP :
							if ( (defaults.swipeUp && auto) || (!auto && defaults.allowPageScroll!=VERTICAL))
								event.preventDefault();
							break;
						
						case DOWN :	
							if ( (defaults.swipeDown && auto) || (!auto && defaults.allowPageScroll!=VERTICAL))
								event.preventDefault();
							break;
					}
				}
				
			}
			
			
			
			/**
			* Calcualte the length / distance of the swipe
			*/
			function caluculateDistance()
			{
				return Math.round(Math.sqrt(Math.pow(end.x - start.x,2) + Math.pow(end.y - start.y,2)));
			}
			
			/**
			* Calcualte the angle of the swipe
			*/
			function caluculateAngle() 
			{
				var X = start.x-end.x;
				var Y = end.y-start.y;
				var r = Math.atan2(Y,X); //radians
				var angle = Math.round(r*180/Math.PI); //degrees
				
				//ensure value is positive
				if (angle < 0) 
					angle = 360 - Math.abs(angle);
					
				return angle;
			}
			
			/**
			* Calcualte the direction of the swipe
			* This will also call caluculateAngle to get the latest angle of swipe
			*/
			function caluculateDirection() 
			{
				var angle = caluculateAngle();
				
				if ( (angle <= 45) && (angle >= 0) ) 
					return LEFT;
				
				else if ( (angle <= 360) && (angle >= 315) )
					return LEFT;
				
				else if ( (angle >= 135) && (angle <= 225) )
					return RIGHT;
				
				else if ( (angle > 45) && (angle < 135) )
					return DOWN;
				
				else
					return UP;
			}
			
			

			// Add gestures to all swipable areas if supported
			try
			{

				this.addEventListener(START_EV, touchStart, false);
				this.addEventListener(CANCEL_EV, touchCancel);
			}
			catch(e)
			{
				//touch not supported
			}
				
		});
	};
	
	
})(jQuery);




/**
 * jQuery ui.core.pack.js
 */
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('(3(C){C.8={1L:{14:3(F,G,I){6 H=C.8[F].y;Y(6 E 1M I){H.q[E]=H.q[E]||[];H.q[E].1N([G,I[E]])}},18:3(E,G,F){6 I=E.q[G];5(!I){4}Y(6 H=0;H<I.1K;H++){5(E.c[I[H][0]]){I[H][1].m(E.a,F)}}}},j:{},e:3(E){5(C.8.j[E]){4 C.8.j[E]}6 F=C(\'<1J 1F="8-1G-1H">\').1I(E).e({1O:"1P",P:"-W",1V:"-W",1W:"1X"}).1U("V");C.8.j[E]=!!((!(/1T|1E/).f(F.e("1Q"))||(/^[1-9]/).f(F.e("1R"))||(/^[1-9]/).f(F.e("1S"))||!(/17/).f(F.e("1Y"))||!(/1A|1w\\(0, 0, 0, 0\\)/).f(F.e("1u"))));1t{C("V").Z(0).1y(F.Z(0))}1z(G){}4 C.8.j[E]},1D:3(E){E.i="U";E.13=3(){4 7};5(E.o){E.o.19="17"}},1B:3(E){E.i="1C";E.13=3(){4 h};5(E.o){E.o.19=""}},1v:3(H,F){6 E=/P/.f(F||"P")?"2i":"1Z",G=7;5(H[E]>0){4 h}H[E]=1;G=H[E]>0?h:7;H[E]=0;4 G}};6 B=C.O.p;C.O.p=3(){C("*",2).14(2).2g("p");4 B.m(2,1c)};3 A(F,G,H){6 E=C[F][G].2f||[];E=(1a E=="12"?E.w(/,?\\s+/):E);4(C.2p(H,E)!=-1)}6 D={10:3(){},X:3(){2.a.2o(2.b)},z:3(E){4 2.c[E]},l:3(E,F){2.c[E]=F},2n:3(){2.l("16",7)},2m:3(){2.l("16",h)}};C.2l=3(F,E){6 G=F.w(".")[0];F=F.w(".")[1];C.O[F]=3(K){6 I=(1a K=="12"),J=22.y.20.18(1c,1);5(I&&A(G,F,K)){6 H=C.x(2[0],F);4(H?H[K].m(H,J):2a)}4 2.29(3(){6 L=C.x(2,F);5(!L){C.x(2,F,27 C[G][F](2,K))}28{5(I){L[K].m(L,J)}}})};C[G][F]=3(J,I){6 H=2;2.b=F;2.c=C.11({},C[G][F].1k,I);2.a=C(J).g("l."+F,3(M,K,L){4 H.l(K,L)}).g("z."+F,3(L,K){4 H.z(K)}).g("p",3(){4 H.X()});2.10()};C[G][F].y=C.11({},D,E)};C.8.1i={24:3(){6 E=2;2.a.g("2d."+2.b,3(F){4 E.1m(F)});5(C.t.v){2.1n=2.a.u("i");2.a.u("i","U")}2.2j=7},2k:3(){2.a.T("."+2.b);(C.t.v&&2.a.u("i",2.1n))},1m:3(G){(2.d&&2.k(G));2.r=G;6 F=2,H=(G.26==1),E=(C(G.2b).2c(2.c.1o));5(!H||E){4 h}2.n=!2.c.R;5(!2.n){2.25=21(3(){F.n=h},2.c.R)}2.N=3(I){4 F.1h(I)};2.S=3(I){4 F.k(I)};C(1j).g("1p."+2.b,2.N).g("1s."+2.b,2.S);4 7},1h:3(E){5(C.t.v&&!E.2h){4 2.k(E)}5(2.d){2.1l(E);4 7}5(2.1d(E)&&2.1b(E)){2.d=(2.1e(2.r,E)!==7);(2.d||2.k(E))}4!2.d},k:3(E){C(1j).T("1p."+2.b,2.N).T("1s."+2.b,2.S);5(2.d){2.d=7;2.1f(E)}4 7},1d:3(E){4(Q.1x(Q.1q(2.r.1g-E.1g),Q.1q(2.r.1r-E.1r))>=2.c.15)},1b:3(E){4 2.n},1e:3(E){},1l:3(E){},1f:3(E){}};C.8.1i.1k={1o:2e,15:0,R:0}})(23);',62,150,'||this|function|return|if|var|false|ui||element|widgetName|options|_mouseStarted|css|test|bind|true|unselectable|cssCache|mouseUp|setData|apply|_mouseDelayMet|style|remove|plugins|_mouseDownEvent||browser|attr|msie|split|data|prototype|getData||||||||||||||_mouseMoveDelegate|fn|top|Math|delay|_mouseUpDelegate|unbind|on|body|5000px|destroy|for|get|init|extend|string|onselectstart|add|distance|disabled|none|call|MozUserSelect|typeof|mouseDelayMet|arguments|mouseDistanceMet|mouseStart|mouseStop|pageX|mouseMove|mouse|document|defaults|mouseDrag|mouseDown|_mouseUnselectable|cancel|mousemove|abs|pageY|mouseup|try|backgroundColor|hasScroll|rgba|max|removeChild|catch|transparent|enableSelection|off|disableSelection|default|class|resizable|gen|addClass|div|length|plugin|in|push|position|absolute|cursor|height|width|auto|appendTo|left|display|block|backgroundImage|scrollLeft|slice|setTimeout|Array|jQuery|mouseInit|_mouseDelayTimer|which|new|else|each|undefined|target|is|mousedown|null|getter|trigger|button|scrollTop|started|mouseDestroy|widget|disable|enable|removeData|inArray'.split('|'),0,{}));

/**
 * jQuery ui.mouse.js
 */
(function($){$.ui=$.ui||{};$.extend($.ui,{plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,arguments){var set=instance.plugins[name];if(!set)return;for(var i=0;i<set.length;i++){if(instance.options[set[i][0]])set[i][1].apply(instance.element,arguments)}}},cssCache:{},css:function(name){if($.ui.cssCache[name])return $.ui.cssCache[name];var tmp=$('<div class="ui-resizable-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!(((/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0))}catch(e){}return $.ui.cssCache[name]},disableSelection:function(e){if(!e)return;e.unselectable="on";e.onselectstart=function(){return false};if(e.style)e.style.MozUserSelect="none"},enableSelection:function(e){if(!e)return;e.unselectable="off";e.onselectstart=function(){return true};if(e.style)e.style.MozUserSelect=""}});$.fn.extend({mouseInteraction:function(o){return this.each(function(){new $.ui.mouseInteraction(this,o)})},removeMouseInteraction:function(o){return this.each(function(){if($.data(this,"ui-mouse"))$.data(this,"ui-mouse").destroy()})}});$.ui.mouseInteraction=function(element,options){var self=this;this.element=element;$.data(this.element,"ui-mouse",this);this.options=$.extend({},options);$(element).bind('mousedown.draggable',function(){return self.click.apply(self,arguments)});if($.browser.msie)$(element).attr('unselectable','on')};$.extend($.ui.mouseInteraction.prototype,{destroy:function(){$(this.element).unbind('mousedown.draggable')},trigger:function(){return this.click.apply(this,arguments)},click:function(e){if(e.which!=1||$.inArray(e.target.nodeName.toLowerCase(),this.options.dragPrevention)!=-1||(this.options.condition&&!this.options.condition.apply(this.options.executor||this,[e,this.element])))return true;var self=this;var initialize=function(){self._MP={left:e.pageX,top:e.pageY};$(document).bind('mouseup.draggable',function(){return self.stop.apply(self,arguments)});$(document).bind('mousemove.draggable',function(){return self.drag.apply(self,arguments)})};if(this.options.delay){if(this.timer)clearInterval(this.timer);this.timer=setTimeout(initialize,this.options.delay)}else{initialize()}return false},stop:function(e){var o=this.options;if(!this.initialized)return $(document).unbind('mouseup.draggable').unbind('mousemove.draggable');if(this.options.stop)this.options.stop.call(this.options.executor||this,e,this.element);$(document).unbind('mouseup.draggable').unbind('mousemove.draggable');this.initialized=false;return false},drag:function(e){var o=this.options;if($.browser.msie&&!e.button)return this.stop.apply(this,[e]);if(!this.initialized&&(Math.abs(this._MP.left-e.pageX)>=o.distance||Math.abs(this._MP.top-e.pageY)>=o.distance)){if(this.options.start)this.options.start.call(this.options.executor||this,e,this.element);this.initialized=true}else{if(!this.initialized)return false}if(o.drag)o.drag.call(this.options.executor||this,e,this.element);return false}})})(jQuery);
/**
 * jQuery ui.slider.js
 */
(function($){$.ui=$.ui||{};$.fn.extend({slider:function(options){var args=Array.prototype.slice.call(arguments,1);if(options=="value")return $.data(this[0],"ui-slider").value(arguments[1]);return this.each(function(){if(typeof options=="string"){var slider=$.data(this,"ui-slider");slider[options].apply(slider,args)}else if(!$.data(this,"ui-slider"))new $.ui.slider(this,options)})}});$.ui.slider=function(element,options){var self=this;this.element=$(element);$.data(element,"ui-slider",this);this.element.addClass("ui-slider");this.options=$.extend({},options);var o=this.options;$.extend(o,{axis:o.axis||(element.offsetWidth<element.offsetHeight?'vertical':'horizontal'),maxValue:!isNaN(parseInt(o.maxValue,10))?parseInt(o.maxValue,10):100,minValue:parseInt(o.minValue,10)||0,startValue:parseInt(o.startValue,10)||'none'});o.realMaxValue=o.maxValue-o.minValue;o.stepping=parseInt(o.stepping,10)||(o.steps?o.realMaxValue/o.steps:0);$(element).bind("setData.slider",function(event,key,value){self.options[key]=value}).bind("getData.slider",function(event,key){return self.options[key]});this.handle=o.handle?$(o.handle,element):$('> *',element);$(this.handle).mouseInteraction({executor:this,delay:o.delay,distance:o.distance||0,dragPrevention:o.prevention?o.prevention.toLowerCase().split(','):['input','textarea','button','select','option'],start:this.start,stop:this.stop,drag:this.drag,condition:function(e,handle){if(!this.disabled){if(this.currentHandle)this.blur(this.currentHandle);this.focus(handle,1);return!this.disabled}}}).wrap('<a href="javascript:void(0)"></a>').parent().bind('focus',function(e){self.focus(this.firstChild)}).bind('blur',function(e){self.blur(this.firstChild)}).bind('keydown',function(e){if(/(37|39)/.test(e.keyCode))self.moveTo((e.keyCode==37?'-':'+')+'='+(self.options.stepping?self.options.stepping:(self.options.realMaxValue/self.size)*5),this.firstChild)});if(o.helper=='original'&&(this.element.css('position')=='static'||this.element.css('position')==''))this.element.css('position','relative');if(o.axis=='horizontal'){this.size=this.element.outerWidth();this.properties=['left','width']}else{this.size=this.element.outerHeight();this.properties=['top','height']}this.element.bind('click',function(e){self.click.apply(self,[e])});if(!isNaN(o.startValue))this.moveTo(o.startValue,0);if(this.handle.length==1)this.previousHandle=this.handle;if(this.handle.length==2&&o.range)this.createRange()};$.extend($.ui.slider.prototype,{plugins:{},createRange:function(){this.rangeElement=$('<div></div>').addClass('ui-slider-range').css({position:'absolute'}).css(this.properties[0],parseInt($(this.handle[0]).css(this.properties[0]),10)+this.handleSize(0)/2).css(this.properties[1],parseInt($(this.handle[1]).css(this.properties[0]),10)-parseInt($(this.handle[0]).css(this.properties[0]),10)).appendTo(this.element)},updateRange:function(){this.rangeElement.css(this.properties[0],parseInt($(this.handle[0]).css(this.properties[0]),10)+this.handleSize(0)/2);this.rangeElement.css(this.properties[1],parseInt($(this.handle[1]).css(this.properties[0]),10)-parseInt($(this.handle[0]).css(this.properties[0]),10))},getRange:function(){return this.rangeElement?this.convertValue(parseInt(this.rangeElement.css(this.properties[1]),10)):null},ui:function(e){return{instance:this,options:this.options,handle:this.currentHandle,value:this.value(),range:this.getRange()}},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.ui()]);this.element.triggerHandler(n=="slide"?n:"slide"+n,[e,this.ui()],this.options[n])},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("ul-slider").unbind(".slider");this.handles.removeMouseInteraction()},enable:function(){this.element.removeClass("ui-slider-disabled");this.disabled=false},disable:function(){this.element.addClass("ui-slider-disabled");this.disabled=true},focus:function(handle,hard){this.currentHandle=$(handle).addClass('ui-slider-handle-active');if(hard)this.currentHandle.parent()[0].focus()},blur:function(handle){$(handle).removeClass('ui-slider-handle-active');if(this.currentHandle&&this.currentHandle[0]==handle){this.previousHandle=this.currentHandle;this.currentHandle=null}},value:function(handle){if(this.handle.length==1)this.currentHandle=this.handle;return((parseInt($(handle!=undefined?this.handle[handle]||handle:this.currentHandle).css(this.properties[0]),10)/(this.size-this.handleSize()))*this.options.realMaxValue)+this.options.minValue},convertValue:function(value){return(value/(this.size-this.handleSize()))*this.options.realMaxValue},translateValue:function(value){return((value-this.options.minValue)/this.options.realMaxValue)*(this.size-this.handleSize())},handleSize:function(handle){return $(handle!=undefined?this.handle[handle]:this.currentHandle)['outer'+this.properties[1].substr(0,1).toUpperCase()+this.properties[1].substr(1)]()},click:function(e){var pointer=[e.pageX,e.pageY];var clickedHandle=false;this.handle.each(function(){if(this==e.target)clickedHandle=true});if(clickedHandle||this.disabled||!(this.currentHandle||this.previousHandle))return;if(this.previousHandle)this.focus(this.previousHandle,1);this.offset=this.element.offset();this.moveTo(this.convertValue(e[this.properties[0]=='top'?'pageY':'pageX']-this.offset[this.properties[0]]-this.handleSize()/2))},start:function(e,handle){var o=this.options;this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:e.pageY-this.handleOffset.top,left:e.pageX-this.handleOffset.left};this.firstValue=this.value();this.propagate('start',e);return false},stop:function(e){this.propagate('stop',e);if(this.firstValue!=this.value())this.propagate('change',e);return false},drag:function(e,handle){var o=this.options;var position={top:e.pageY-this.offset.top-this.clickOffset.top,left:e.pageX-this.offset.left-this.clickOffset.left};var modifier=position[this.properties[0]];if(modifier>=this.size-this.handleSize())modifier=this.size-this.handleSize();if(modifier<=0)modifier=0;if(o.stepping){var value=this.convertValue(modifier);value=Math.round(value/o.stepping)*o.stepping;modifier=this.translateValue(value)}if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&modifier>=this.translateValue(this.value(1)))modifier=this.translateValue(this.value(1));if(this.currentHandle[0]==this.handle[1]&&modifier<=this.translateValue(this.value(0)))modifier=this.translateValue(this.value(0))}this.currentHandle.css(this.properties[0],modifier);if(this.rangeElement)this.updateRange();this.propagate('slide',e);return false},moveTo:function(value,handle){var o=this.options;if(handle==undefined&&!this.currentHandle&&this.handle.length!=1)return false;if(handle==undefined&&!this.currentHandle)handle=0;if(handle!=undefined)this.currentHandle=this.previousHandle=$(this.handle[handle]||handle);if(value.constructor==String)value=/\-\=/.test(value)?this.value()-parseInt(value.replace('-=',''),10):this.value()+parseInt(value.replace('+=',''),10);if(o.stepping)value=Math.round(value/o.stepping)*o.stepping;value=this.translateValue(value);if(value>=this.size-this.handleSize())value=this.size-this.handleSize();if(value<=0)value=0;if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&value>=this.translateValue(this.value(1)))value=this.translateValue(this.value(1));if(this.currentHandle[0]==this.handle[1]&&value<=this.translateValue(this.value(0)))value=this.translateValue(this.value(0))}this.currentHandle.css(this.properties[0],value);if(this.rangeElement)this.updateRange();this.propagate('start',null);this.propagate('stop',null);this.propagate('change',null)}})})(jQuery);

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4257 $
 *
 * Version: 1.2
 *
 * Requires: jQuery 1.2+
 */
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}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{}));

/*
 * 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.
*/
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}});

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};

/**
 * jquery.scrollFollow.js
 * Copyright (c) 2008 Net Perspective (net-perspective.com)
 * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
 * 
 * @author R.A. Ray
 *
 * @projectDescription	jQuery plugin for allowing an element to animate down as the user scrolls the page.
 * 
 * @version 0.1.0
 */
(function($){$.scrollFollow=function(box,options){function ani(box,iTop){$(box).dequeue();var pageScroll=$(document).scrollTop();var parentTop=$(cont).offset().top;var parentHeight=$(cont).height();var boxTop=$(box).offset().top;var boxHeight=box.offsetHeight;var aniTop;if(isActive){aniTop=Math.min((Math.max((parentTop+iTop),(pageScroll+options.offset))-parentTop),(parentHeight-boxHeight));$(box).animate({top:aniTop},options.speed,options.easing)}};var isActive=true;if($.cookie('scrollFollowSetting'+$(box).attr('id'))=='false'){var isActive=false;$('#'+options.killSwitch).text(options.offText).toggle(function(){isActive=true;$(this).text(options.onText);$.cookie('scrollFollowSetting'+$(box).attr('id'),true,{expires:365,path:'/'})},function(){isActive=false;$(this).text(options.offText);$(box).animate({top:initialTop},0);$.cookie('scrollFollowSetting'+$(box).attr('id'),false,{expires:365,path:'/'})})}else{$('#'+options.killSwitch).text(options.onText).toggle(function(){isActive=false;$(this).text(options.offText);$(box).animate({top:initialTop},0);$.cookie('scrollFollowSetting'+$(box).attr('id'),false,{expires:365,path:'/'})},function(){isActive=true;$(this).text(options.onText);$.cookie('scrollFollowSetting'+$(box).attr('id'),true,{expires:365,path:'/'})})}var cont;if(options.container==''){cont=$(box).parent()}else{cont=document.getElementById(options.container)}var initialTop=$(box).css('top');if(initialTop=='auto'){initialTop=0}else{initialTop=parseInt(initialTop.substr(0,initialTop.indexOf('p')))}$(window).scroll(function(){ani(box,initialTop)})};$.fn.scrollFollow=function(options){options=options||{};options.speed=options.speed||500;options.offset=options.offset||0;options.easing=options.easing||'easeOutBack';options.container=options.container||this.parent().attr('id');options.killSwitch=options.killSwitch||'killSwitch';options.onText=options.onText||'Turn Slide Off';options.offText=options.offText||'Turn Slide On';this.each(function(){new $.scrollFollow(this,options)});return this}})(jQuery);

/*
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007 M. Alsup
 * Version: 2.10
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
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}('(3($){7 n=\'2.10\';7 q=$.2p.2i&&/3c 6.0/.2I(2w.2s);$.y.x=3(m){I 8.18(3(){m=m||{};4(m.2a==28){2N(m){1Z\'2B\':4(8.Z)1J(8.Z);8.Z=0;I;1Z\'1I\':8.1b=1;I;1Z\'3r\':8.1b=0;I;3q:m={1n:m}}}7 c=$(8);7 d=m.1T?$(m.1T,8):c.3i();7 e=d.3a();4(e.E<2)I;7 f=$.31({},$.y.x.2b,m||{},$.29?c.29():$.2V?c.2T():{});4(f.1P)f.26=f.2K||e.E;f.D=f.D?[f.D]:[];f.12=f.12?[f.12]:[];f.12.25(3(){f.1M=0});4(q&&f.1L&&!f.2u)24(d);7 g=8.2r;7 w=1h((g.1s(/w:(\\d+)/)||[])[1])||f.J;7 h=1h((g.1s(/h:(\\d+)/)||[])[1])||f.K;f.O=1h((g.1s(/t:(\\d+)/)||[])[1])||f.O;4(c.A(\'1Y\')==\'3o\')c.A(\'1Y\',\'3l\');4(w)c.J(w);4(h&&h!=\'1W\')c.K(h);4(f.19){f.1a=[];1j(7 i=0;i<e.E;i++)f.1a.L(i);f.1a.3e(3(a,b){I 39.19()-0.5});f.14=0;f.T=f.1a[0]}13 4(f.T>=e.E)f.T=0;7 j=f.T||0;d.A(\'1Y\',\'30\').1y().18(3(i){7 z=j?i>=j?e.E-(i-j):j-i:e.E-i;$(8).A(\'z-1x\',z)});$(e[j]).N();4(f.1k&&w)d.J(w);4(f.1k&&h&&h!=\'1W\')d.K(h);4(f.1I)c.2U(3(){8.1b=1},3(){8.1b=0});7 k=$.y.x.M[f.1n];4($.27(k))k(c,d,f);d.18(3(){7 a=$(8);8.W=(f.1k&&h)?h:a.K();8.V=(f.1k&&w)?w:a.J()});f.G=f.G||{};f.C=f.C||{};f.F=f.F||{};d.1B(\':1C(\'+j+\')\').A(f.G);4(f.S)$(d[j]).A(f.S);4(f.O){4(f.R.2a==28)f.R={2C:2A,2z:2y}[f.R]||2x;4(!f.1v)f.R=f.R/2;2v((f.O-f.R)<2t)f.O+=f.R}4(f.1K)f.1u=f.1F=f.1K;4(!f.1i)f.1i=f.R;4(!f.1o)f.1o=f.R;f.2q=e.E;f.11=j;4(f.19){f.B=f.11;4(++f.14==e.E)f.14=0;f.B=f.1a[f.14]}13 f.B=f.T>=(e.E-1)?0:f.T+1;7 l=d[j];4(f.D.E)f.D[0].1t(l,[l,l,f,23]);4(f.12.E>1)f.12[1].1t(l,[l,l,f,23]);4(f.1d&&!f.Q)f.Q=f.1d;4(f.Q)$(f.Q).22(\'1d\',3(){I 21(e,f,f.1r?-1:1)});4(f.20)$(f.20).22(\'1d\',3(){I 21(e,f,f.1r?1:-1)});4(f.1q)2o(e,f);4(f.O)8.Z=2n(3(){1p(e,f,0,!f.1r)},f.O+(f.2m||0))})};3 1p(a,b,c,d){4(b.1M)I;7 p=a[0].1H,1g=a[b.11],Q=a[b.B];4(p.Z===0&&!c)I;4(!c&&!p.1b&&((b.1P&&(--b.26<=0))||(b.1G&&!b.19&&b.B<b.11)))I;4(c||!p.1b){4(b.D.E)$.18(b.D,3(i,o){o.1t(Q,[1g,Q,b,d])});7 e=3(){4($.2p.2i&&b.1L)8.3n.3m(\'1X\');$.18(b.12,3(i,o){o.1t(Q,[1g,Q,b,d])})};4(b.B!=b.11){b.1M=1;4(b.1E)b.1E(1g,Q,b,e,d);13 4($.27($.y.x[b.1n]))$.y.x[b.1n](1g,Q,b,e);13 $.y.x.2k(1g,Q,b,e)}4(b.19){b.11=b.B;4(++b.14==a.E)b.14=0;b.B=b.1a[b.14]}13{7 f=(b.B+1)==a.E;b.B=f?0:b.B+1;b.11=f?a.E-1:b.B-1}4(b.1q)$(b.1q).2j(\'a\').3k(\'1V\').1X(\'a:1C(\'+b.11+\')\').2h(\'1V\')}4(b.O)p.Z=2n(3(){1p(a,b,0,!b.1r)},b.O)};3 21(a,b,c){7 p=a[0].1H,O=p.Z;4(O){1J(O);p.Z=0}b.B=b.11+c;4(b.B<0){4(b.1G)I 1w;b.B=a.E-1}13 4(b.B>=a.E){4(b.1G)I 1w;b.B=0}4(b.1D&&1U b.1D==\'3\')b.1D(c>0,b.B,a[b.B]);1p(a,b,1,c>=0);I 1w};3 2o(b,c){7 d=$(c.1q);$.18(b,3(i,o){7 a=(1U c.1O==\'3\')?$(c.1O(i,o)):$(\'<a 3j="#">\'+(i+1)+\'</a>\');4(a.3h(\'3g\').E==0)a.3d(d);a.22(\'1d\',3(){c.B=i;7 p=b[0].1H,O=p.Z;4(O){1J(O);p.Z=0}4(1U c.1S==\'3\')c.1S(c.B,b[c.B]);1p(b,c,1,!c.1r);I 1w})});d.2j(\'a\').1X(\'a:1C(\'+c.T+\')\').2h(\'1V\')};3 24(b){3 1A(s){7 s=1h(s).3b(16);I s.E<2?\'0\'+s:s};3 2f(e){1j(;e&&e.38.37()!=\'36\';e=e.1H){7 v=$.A(e,\'2e-2d\');4(v.35(\'34\')>=0){7 a=v.1s(/\\d+/g);I\'#\'+1A(a[0])+1A(a[1])+1A(a[2])}4(v&&v!=\'33\')I v}I\'#32\'};b.18(3(){$(8).A(\'2e-2d\',2f(8))})};$.y.x.2k=3(a,b,c,d){7 e=$(a),$n=$(b);$n.A(c.G);7 f=3(){$n.1z(c.C,c.1i,c.1u,d)};e.1z(c.F,c.1o,c.1F,3(){4(c.P)e.A(c.P);4(!c.1v)f()});4(c.1v)f()};$.y.x.M={2c:3(a,b,c){b.1B(\':1C(\'+c.T+\')\').A(\'1m\',0);c.D.L(3(){$(8).N()});c.C={1m:1};c.F={1m:0};c.P={X:\'Y\'}}};$.y.x.2Z=3(){I n};$.y.x.2b={1n:\'2c\',O:2Y,R:2X,1i:H,1o:H,1d:H,Q:H,20:H,1D:H,1q:H,1S:H,1O:H,D:H,12:H,1K:H,1u:H,1F:H,1l:H,C:H,F:H,G:H,P:H,1E:H,K:\'1W\',T:0,1v:1,19:0,1k:0,1I:0,1P:0,2m:0,1T:H,1L:0,1G:0}})(9);9.y.x.M.2W=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.r=b.1e;c.F.r=0-a.1e});f.S={r:0};f.C={r:0};f.P={X:\'Y\'}};9.y.x.M.2S=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.r=0-b.1e;c.F.r=a.1e});f.S={r:0};f.C={r:0};f.P={X:\'Y\'}};9.y.x.M.2R=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.u=b.1f;c.F.u=0-a.1f});f.S={u:0};f.C={u:0}};9.y.x.M.2Q=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.u=0-b.1f;c.F.u=a.1f});f.S={u:0};f.C={u:0}};9.y.x.M.2P=3(f,g,h){f.A(\'17\',\'1c\').J();h.D.L(3(a,b,c,d){9(8).N();7 e=a.1f,1Q=b.1f;c.G=d?{u:1Q}:{u:-1Q};c.C.u=0;c.F.u=d?-e:e;g.1B(a).A(c.G)});h.S={u:0};h.P={X:\'Y\'}};9.y.x.M.2O=3(f,g,h){f.A(\'17\',\'1c\');h.D.L(3(a,b,c,d){9(8).N();7 e=a.1e,1R=b.1e;c.G=d?{r:-1R}:{r:1R};c.C.r=0;c.F.r=d?e:-e;g.1B(a).A(c.G)});h.S={r:0};h.P={X:\'Y\'}};9.y.x.M.2M=3(a,b,c){c.C={J:\'N\'};c.F={J:\'1y\'}};9.y.x.M.2L=3(a,b,c){c.C={K:\'N\'};c.F={K:\'1y\'}};9.y.x.M.1l=3(g,h,j){7 w=g.A(\'17\',\'3f\').J();h.A({u:0,r:0});j.D.L(3(){9(8).N()});j.R=j.R/2;j.19=0;j.1l=j.1l||{u:-w,r:15};j.U=[];1j(7 i=0;i<h.E;i++)j.U.L(h[i]);1j(7 i=0;i<j.T;i++)j.U.L(j.U.2g());j.1E=3(a,b,c,d,e){7 f=e?9(a):9(b);f.1z(c.1l,c.1i,c.1u,3(){e?c.U.L(c.U.2g()):c.U.25(c.U.2J());4(e)1j(7 i=0,1N=c.U.E;i<1N;i++)9(c.U[i]).A(\'z-1x\',1N-i);13{7 z=9(a).A(\'z-1x\');f.A(\'z-1x\',1h(z)+1)}f.1z({u:0,r:0},c.1o,c.1F,3(){9(e?8:a).1y();4(d)d()})})}};9.y.x.M.2H=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.G.r=b.W;c.C.K=b.W});f.S={r:0};f.G={K:0};f.C={r:0};f.F={K:0};f.P={X:\'Y\'}};9.y.x.M.2G=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.C.K=b.W;c.F.r=a.W});f.S={r:0};f.G={r:0,K:0};f.F={K:0};f.P={X:\'Y\'}};9.y.x.M.2F=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.G.u=b.V;c.C.J=b.V});f.G={J:0};f.C={u:0};f.F={J:0};f.P={X:\'Y\'}};9.y.x.M.2E=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.C.J=b.V;c.F.u=a.V});f.G={u:0,J:0};f.C={u:0};f.F={J:0};f.P={X:\'Y\'}};9.y.x.M.2D=3(d,e,f){f.S={r:0,u:0};f.P={X:\'Y\'};f.D.L(3(a,b,c){9(8).N();c.G={J:0,K:0,r:b.W/2,u:b.V/2};c.C={r:0,u:0,J:b.V,K:b.W};c.F={J:0,K:0,r:a.W/2,u:a.V/2}})};9.y.x.M.3p=3(d,e,f){f.D.L(3(a,b,c){c.G={J:0,K:0,1m:1,u:b.V/2,r:b.W/2,2l:1};c.C={r:0,u:0,J:b.V,K:b.W}});f.F={1m:0};f.P={2l:0}};',62,214,'|||function|if|||var|this|jQuery||||||||||||||||||top|||left|||cycle|fn||css|nextSlide|animIn|before|length|animOut|cssBefore|null|return|width|height|push|transitions|show|timeout|cssAfter|next|speed|cssFirst|startingSlide|els|cycleW|cycleH|display|none|cycleTimeout||currSlide|after|else|randomIndex|||overflow|each|random|randomMap|cyclePause|hidden|click|offsetHeight|offsetWidth|curr|parseInt|speedIn|for|fit|shuffle|opacity|fx|speedOut|go|pager|rev|match|apply|easeIn|sync|false|index|hide|animate|hex|not|eq|prevNextClick|fxFn|easeOut|nowrap|parentNode|pause|clearTimeout|easing|cleartype|busy|len|pagerAnchorBuilder|autostop|nextW|nextH|pagerClick|slideExpr|typeof|activeSlide|auto|filter|position|case|prev|advance|bind|true|clearTypeFix|unshift|countdown|isFunction|String|metadata|constructor|defaults|fade|color|background|getBg|shift|addClass|msie|find|custom|zIndex|delay|setTimeout|buildPager|browser|slideCount|className|userAgent|250|cleartypeNoBg|while|navigator|400|200|fast|600|stop|slow|zoom|turnRight|turnLeft|turnDown|turnUp|test|pop|autostopCount|slideY|slideX|switch|scrollVert|scrollHorz|scrollRight|scrollLeft|scrollDown|data|hover|meta|scrollUp|1000|4000|ver|absolute|extend|ffffff|transparent|rgb|indexOf|html|toLowerCase|nodeName|Math|get|toString|MSIE|appendTo|sort|visible|body|parents|children|href|removeClass|relative|removeAttribute|style|static|fadeZoom|default|resume'.split('|'),0,{}))

/*
 * jQuery Tooltip plugin 1.2
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 J?rn Zaefferer, Changed by Thomas Jaggi
 *
 * $Id: jquery.tooltip.js 4569 2008-01-31 19:36:35Z joern.zaefferer $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip-settings",settings);this.tooltipText=this.title;$(this).removeAttr("title");this.alt=""}).hover(save,hide).click(hide)},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative')})}})}:function(){return this},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''})})}:function(){return this},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]()})},url:function(){return this.attr('href')||this.attr('src')}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent)}function settings(element){return $.data(element,"tooltip-settings")}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event)}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent)}helper.body.show()}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();if(settings(this).showPrice){if(parts[1]){helper.body.append(parts[0]);helper.body.append("<span class='price'>"+parts[1]+"</span>")}}else{for(var i=0,part;part=parts[i];i++){if(i>0)helper.body.append("<br/>");helper.body.append(part)}}helper.body.hideWhenEmpty()}else{helper.title.html(title).show();helper.body.hide()}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments)}function show(){tID=null;helper.parent.show();update()}function update(event){if($.tooltip.blocked)return;if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;helper.parent.css({left:left+'px',top:top+'px'})}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right")}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom")}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()}}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;helper.parent.hide().removeClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.unfixPNG()}$.fn.Tooltip=$.fn.tooltip})(jQuery);

/**
 * jQuery.LocalScroll - Animated scrolling navigation, using anchors.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 6/3/2008
 * @author Ariel Flesler
 * @version 1.2.6
 **/
;(function($){var g=location.href.replace(/#.*/,''),h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1e3,axis:'y',event:'click',stop:1};h.hash=function(a){a=$.extend({},h.defaults,a);a.hash=0;if(location.hash)setTimeout(function(){i(0,location,a)},0)};$.fn.localScroll=function(b){b=$.extend({},h.defaults,b);return(b.persistent||b.lazy)?this.bind(b.event,function(e){var a=$([e.target,e.target.parentNode]).filter(c)[0];a&&i(e,a,b)}):this.find('a,area').filter(c).bind(b.event,function(e){i(e,this,b)}).end().end();function c(){var a=this;return!!a.href&&!!a.hash&&a.href.replace(a.hash,'')==g&&(!b.filter||$(a).is(b.filter))}};function i(e,a,b){var c=a.hash.slice(1),d=document.getElementById(c)||document.getElementsByName(c)[0],f;if(d){e&&e.preventDefault();f=$(b.target||$.scrollTo.window());if(b.lock&&f.is(':animated')||b.onBefore&&b.onBefore.call(a,e,d,f)===!1)return;if(b.stop)f.queue('fx',[]).stop();f.scrollTo(d,b).trigger('notify.serialScroll',[d]);if(b.hash)f.queue(function(){location=a.hash;$(this).dequeue()})}}})(jQuery);

/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 2/19/2008
 * @author Ariel Flesler
 * @version 1.3.3
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

jQuery.noConflict();


/*-------- iPad detection -------*/
var ua = navigator.userAgent;
var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua);

jQuery("document").ready(function(){
	if( isiPad ){ jQuery("html").addClass("iPad") };
});

/*-------- mobile detection -------*/
var isMobile = /android/i.test(ua) || (/iphone/i.test(ua) && !isiPad );
jQuery("document").ready(function(){
	if(isMobile) jQuery("#yaml_footer").css("position","relative !important");
});


/*-------------------------------------------------------------------------------------------------------*/
/* Productslider */

jQuery.fn.productslider = function(){ 
	if ( jQuery(".productslider-wrapper,.outfitslider-wrapper").length ) {
		
		jQuery(".productslider-wrapper,.outfitslider-wrapper").each(function(){
		
		var container = jQuery(this).find('div.productslider-container,div.outfitslider-container'),
		    ul = jQuery('ul', container),
		    itemsWidth = ul.innerWidth() - container.outerWidth();
		
		jQuery(this).find('.slider', container).slider({
			minValue: 0,
			maxValue: itemsWidth,
			handle: '.handle',
			stop: function (event, ui) {
				ul.animate({'left' : ui.value * -1}, 400);
			},
			slide: function (event, ui) {
				ul.css('left', ui.value * -1);
			}
		});
		jQuery(this).find('#next').click(function() {
			jQuery('.slider', container).slider("moveTo","+=341");
		});
		jQuery(this).find('#prev').click(function() {
			jQuery('.slider', container).slider("moveTo","-=341");
		});
		
		/* shift right corners to the right place */
		if (jQuery.browser.safari) {
			jQuery('div.productslider-viewport,div.outfitslider-viewport').css('border-top','1px solid #444').css('margin-top','-1px');
		}
		
		/* trigger arrows */
		jQuery('.handle', container).css("left",-1);
		
		/* some fancy auto-sliding */
		//window.setTimeout(jQuery.fn.slidemetothemoon,1000);
		
		});
	}
	
};


/*-----------------------------------------------------------------------------------------------------*/
/* Enter to explore */
jQuery(document).ready(function(){
jQuery.fn.start = function(){ 
	window.clearTimeout(timer);
	
    jQuery(".enter-to-explore a").hide();
	jQuery('#yaml_main,.footer-wrapper').fadeIn('slow');

	jQuery.fn.productslider();
};

var start = jQuery.fn.start;

/*-----------------------------------------------------------------------------------------------------*/
/* Enter to explore */

jQuery(".enter-to-explore a").click(function() {
	jQuery.fn.start();
});

var get_body_class = jQuery('body').attr('id');
if (get_body_class == 'start') {
	timer = window.setTimeout(start,5000);
}

});

/*-----------------------------------------------------------------------------------------------------*/
/* Favorites */

jQuery.fn.cycleme = function(){ 
	jQuery('#cycle-prev,#cycle-next').unbind('click');
	jQuery('#cycle').cycle('stop').cycle({
		fx:      'scrollHorz',
		speed:    300,
		timeout: 0, 
		next:   '#cycle-next', 
		prev:   '#cycle-prev' 
	});
};
	
jQuery.fn.toggleBox = function(element) { 
	var jQueryparent = jQuery(element);
	if (jQuery('.toggleme',jQueryparent).is(':visible')) {
		jQuery(element).addClass('closed');
		jQuery('.toggleme',jQueryparent).slideUp('fast');
		jQuery.fn.content_height();
	}
	else {
		jQuery(element).removeClass('closed');
		jQuery('.toggleme',jQueryparent).slideDown('fast');
		jQuery.fn.content_height();
	}
}
	
jQuery.fn.content_height = function() {
	var height = jQuery('.col2-sticky').height();
	jQuery('#yaml_col3').css('min-height', height);
	if (jQuery.browser.msie && jQuery.browser.version < 7) {
		jQuery('#yaml_col3').css('height', height);
	}
}

jQuery.fn.favs_desc = function(){ 
	if (jQuery.browser.msie && jQuery.browser.version < 7) {
		jQuery('.dropped-products ul li').hover(function(){ 
			jQuery(this).children('.dropped-products-desc').show(); 
		},function(){ 
			jQuery(this).children('.dropped-products-desc').hide(); 
		}); 
	}
}


jQuery(document).ready(function(){ 

	
	/*-----------------------------------------------------------------------------------------------------*/
	
	/* Submit on enter */
	jQuery("#quicksearch_form\\:quicksearchquery").keyup(function(e) { 
		if(e.keyCode == 13) { 
			jQuery("#quicksearch_form\\:quicksearchsubmit").trigger('click');
		} 
	});  
	jQuery("#search_form\\:searchquery").keyup(function(e) { 
		if(e.keyCode == 13) { 
			jQuery("#search_form\\:searchsubmit").trigger('click');
		} 
	});  
	

	/*-----------------------------------------------------------------------------------------------------*/
	/* Sub nav */
	
	jQuery("#yaml_nav-sub span").click(function() {
		var jQueryparent = jQuery(this).parent();
		
		if (jQueryparent.attr('class')) { var state = jQueryparent.attr('class'); }
		else { var state = ''; }
		
		if ((state != '') && (state.indexOf('open') != -1)) {
			jQueryparent.removeClass('open').children('ul').slideUp('fast'); 
			jQuery('li',jQueryparent).removeClass('open');
		}
		else { 
			jQueryparent.addClass('open').children('ul').slideDown('fast');
		}
	});
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Product Detail Material */
	
	jQuery(".product-detail-material-tab-div").click(function() {
		var $this = jQuery(this);
		
		if ($this.attr('class')) { var state = $this.attr('class'); }
		else { var state = ''; }
		
		if ((state != '') && (state.indexOf('open') != -1)) {
			$this.next().slideUp('fast'); 
			$this.removeClass('open');
		}
		else { 
			$this.next().slideDown('fast');
			$this.addClass('open');
		}
	});
	

	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Toggle  */
		
	jQuery.fn.content_height();


	/*-----------------------------------------------------------------------------------------------------*/
	/* Favourites */
	jQuery('#yaml_col1').height(jQuery('#yaml_main').height());
	jQuery('#productFilterContainer').height(Math.max(jQuery('.productfilter').height(),(jQuery('#yaml_main').height()-jQuery('#yaml_nav-sub').height())));
	/* Scrolling */
	jQuery( '.col2-sticky' ).scrollFollow({ container: 'yaml_main' });
	jQuery( '.productfilter' ).scrollFollow({ container: 'productFilterContainer', offset: 35 });
	
	
	/* Cycle products */
	jQuery.fn.cycleme();


	/*-----------------------------------------------------------------------------------------------------*/
	/* Productslider */
	
	/* Look */
	jQuery('div.productslider-viewport').css('overflow','hidden');
	jQuery('div.slider,div.arrows').show();
	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Product Thumbnails Tooltip */
	
	jQuery(function() {
		jQuery('.products-img a').tooltip({
			track: true, 
			delay: 0, 
			showBody: " -- ",
			showURL: false,
			showPrice: true
		});
	});
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Product Detail Tabs */
	
	jQuery(".nav-content_text:not(:first)").hide();
	
	jQuery.fn.positionme = function() {
		jQuery(".products-detail-nav").css({"bottom":"1.01em"});
		jQuery(".products-detail-nav").css({"bottom":"1.em"});
		
		jQuery("h2.products-detail").parent().children(".corner-overlay-bl",".corner-overlay-br").css({"bottom":"0px"});
		jQuery("h2.products-detail").parent().children(".corner-overlay-bl",".corner-overlay-br").css({"bottom":"-1px"});
	}
	
	if (jQuery.browser.msie && jQuery.browser.version < 7) {
		jQuery.fn.positionme();
	}
	
	/* Hybris Code */
	jQuery(".nav-content li.toggle").click(function(){
		var myClass = jQuery(this).attr("class");
		var myId = jQuery(this).attr("id");
		if (myClass.indexOf("current") == -1) {
			var highlightId = "#productTab" + myId.substr(myId.length - 1);
			jQuery(highlightId).show();
			jQuery(highlightId).siblings().hide();
			jQuery(this).siblings().removeClass("current");
			jQuery(this).addClass("current");
	
			if (jQuery.browser.msie && jQuery.browser.version < 7) {
				jQuery.fn.positionme();
			}
		}
	});
	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Product Entrance */
	
	jQuery('table.products-entrance:last .selectbox').addClass('selectbox-up');

	jQuery('.selectbox span').click(function(){
		var el = jQuery(this).parent().children('ul');
		jQuery('.selectbox ul').not(el).hide();
		jQuery(el).toggle();
		window.setTimeout(function(){
			jQuery(el).addClass('opened');
		},100);
	});
	
	jQuery('body').click(function(){
		jQuery('.selectbox ul.opened').removeClass('opened').hide();
	});
	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Paragraphs */
	
	jQuery('div.paragraph:last').addClass('paragraph-last');
	jQuery('div.paragraph p:last-child').addClass('last');
	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Zebra tables */
	
	jQuery('table.content-bg tr:even').addClass('even');
	jQuery('table.content-bg tr:first').addClass('first');
	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Local Scrolling */
	
	jQuery.localScroll({duration:10});
	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* IE */
	
	if (jQuery.browser.msie) {
		jQuery('#yaml_nav-main li').hover(function(){ 
				if (jQuery(this).parent().parent().attr('id') == 'yaml_nav-main') {
					jQuery(this).addClass('hover');
					
					if (jQuery(this).children('ul').children('li').length > 0) {
						var mywidth = jQuery(this).children('ul').width();
						var mywidth = mywidth - 6;
						var myheight = jQuery(this).children('ul').height();
						if (jQuery.browser.version < 7) {
							var myheight = myheight - 3;
						} else {
							var myheight = myheight - 5;
						}
						jQuery(this).append('<iframe id="dropme">&nbsp;</iframe>');
						jQuery('#dropme').css({
							'position': 'absolute', 
							'border': '0',
							'width': mywidth + 'px', 
							'height': + myheight + 'px'
						});
					}	
				}
			},function(){ 
				if (jQuery(this).parent().parent().attr('id') == 'yaml_nav-main') {
					jQuery(this).removeClass('hover'); 
					jQuery("#dropme").remove(); 
				}
		}); 
	}	
	
	if (jQuery.browser.msie && jQuery.browser.version < 7) {
	
		jQuery('ul.nav-content li:not(.current) a').hover(function(){ 
			jQuery('img.current',this).show();
		},function(){ 
			jQuery('img.current',this).hide();
		}); 
		
		jQuery.fn.favs_desc();
		
		jQuery('.products-img, .products-img-detail').hover(function(){ 
				jQuery(this).children('div.overlay').show(); 
			},function(){ 
				jQuery(this).children('div.overlay').hide(); 
		});
		jQuery('ul.products li').hover(function(){ 
				jQuery(this).addClass('hover').css('z-index','10'); 
			},function(){ 
				jQuery(this).removeClass('hover').css('z-index','1'); 
		}); 
		/* Avoid flickering of backgrounds */
		try {
			document.execCommand("BackgroundImageCache",false,true);
		} catch(e) {}
	}	
    
});



/*-----------------------------------------------------------------------------------------------------*/
/* Productslider */

/* Enable */
window.onload = function () {
	var get_body_class = jQuery('body').attr('id');
	if (get_body_class != 'start') { 
		if (jQuery.browser.msie && jQuery.browser.version < 7) {
			jQuery('div.productslider-viewport').css('overflow','hidden');
			jQuery('div.slider,div.arrows').show();
		}	
		jQuery.fn.productslider(); 
	}	
	
	/*-----------------------------------------------------------------------------------------------------*/
	/* Wax Coach Formular */	
	
	if(jQuery('#wax_coach').length > 0) {
		
		jQuery('.iconradios').each(function(index) {
			//hide radio buttons
			jQuery(this).children('li').children('label').children('input').hide();
			
			
			//behavior -> label clicked
			jQuery(this).children('li').children('label').click( function() {
				var radiogroup = jQuery(this).next('input').attr('name');
				
				//reset all
				jQuery('.iconradios').children('li').each(function(index) {
					toggleRadioBtnState(false, radiogroup, jQuery(this));
				});
				
				//set clicked element active 
				toggleRadioBtnState(true, radiogroup, jQuery(this).parent('li'));
				
			});
			
			jQuery(this).children('li').children('img').each(function(index){
				var image = jQuery(this);
				if(jQuery(this).next('label').children('input').attr('checked')){
					onRadioBtn(image);
				}
			});

			//behavior -> img clicked
			jQuery(this).children('li').children('img').click( function() {
				var radiogroup = jQuery(this).nextAll('label').children('input').attr('name');
				
				//reset all
				jQuery('.iconradios').children('li').each(function(index) {
					toggleRadioBtnState(false, radiogroup, jQuery(this));
				});
				
				//set clicked element active 
				toggleRadioBtnState(true, radiogroup, jQuery(this).parent('li'));
				
			});
		});
		
		jQuery('.hide_select').each(function(index){
			jQuery(this).hide();
		});
	}
};


//slider callbacks
var myObject = function() {
    this.callback = function(cbObj) {
            var tempDiv = document.getElementById("temp");
            tempDiv.innerHTML = cbObj.value + "&deg;C";
    };
    return this;
}();

function onRadioBtn(image) {
	var src = image.attr('src');
	if(src.search(/-on/) == -1) {
		src = src.replace(/-off/g, "-on");
		image.attr('src', src);
	}
}

function toggleRadioBtnState(on, radiogroup, liElem) {
	var src = jQuery(liElem).children('img').attr('src');
	
	if(on) {
		if(src.search(/-on/) == -1) {
			//img on
			src = src.replace(/-off/g, "-on");
			jQuery(liElem).children('img').attr('src', src);
			
			//set value in hidden radio button
			jQuery(liElem).children('label').children('input').attr("checked","checked");
		}
		
	} else {
		if(radiogroup == jQuery(liElem).children('label').children('input').attr('name')) {
			if(src.search(/-off/) == -1) {
				//img off
				src = src.replace(/-on/g, "-off");
				jQuery(liElem).children('img').attr('src', src);
				
				//set value in hidden radio button
				jQuery(liElem).children('label').children('input').removeAttr("checked");
			}
		}
	}
}

/*-----------------------------------------------------------------------------------------------------*/
// check if mammuth side
function checkContext(context,$){
  return $('body').is("." + context);
}

/*-----------------------------------------------------------------------------------------------------*/
// background reseize

// resize function

function autoImageSize($img, $win){
    var wHeight, wWidth, iHeight, iWidth, iRatio, wRatio, negativeOffsetTop, negativeOffsetLeft;
    
    wHeight = $win.height();
    wWidth = $win.width();
    iHeight = $img.height();
    iWidth = $img.width();
    iRatio = iWidth / iHeight; 
    wRatio = wWidth / wHeight;
    negativeOffsetTop = function(){
     var offset = 0;
     if (iHeight > wHeight){
        offset = -1 * ((iHeight - wHeight)/2);
     }
     return offset; 
    };
    negativeOffsetLeft = function(){
     var offset = 0;
     if (iWidth > wWidth){
      offset = -1 * ((iWidth - wWidth)/2);
     }
     return offset;
    };

    if(iRatio <= wRatio){
      $img.css({width: "100%", height: "auto"});
      $img.css("top", negativeOffsetTop() + "px");
      $img.css("left", 0);
    }else{
      $img.css("top", 0);
      $img.css({width: "auto", height: "100%"});
      $img.css("left",   negativeOffsetLeft() + "px");

    }

    return {width:$img.width(),height:$img.height(), offsetTop:negativeOffsetTop(), offsetLeft:negativeOffsetLeft()};
};

// init background size
function backgroundResizler($backgroundImageContainer, img, $){
  if ($backgroundImageContainer.length && checkContext("mammut", $)){
    var $img = $backgroundImageContainer.find(img),
        $win = $(window);
                
    $win.resize(function() {
      autoImageSize($img, $win);
    });
   
    autoImageSize($img, $win); 
  }
  return false;
};

/*-----------------------------------------------------------------------------------------------------*/
// mainTeaser function
function teaserSlider( $slider,$ ){
  if($slider.length){
    var $slides, $win, $slideImgs, $controls, sliderFunc, slideTo, startSlideNbr, speed, winWidth;
    
    //global animation speed
    speed = 200;
    
    $win = $(window);
    $slides = $slider.find('div.slide');
    $controls = $slider.find('div.teaserControls');
    
    $win.resize(function() {
      resizeAll($slides, $('#megaTeaser'), $);
    });
  
    resizeAll($slides, $('#megaTeaser'), $);
    
    /*init Slider function*/
    sliderFunc = function(){
      var hideSlide, showSlide, controls, slideToPos, $nextSlide, $prevSlide, $toggleContents, $slideController;
      
      $toggleContents = $('<a class="toggleContents" href="#">toggle contents</a>').css("opacity", 0.001);
      $slideController = $('<div class="slideController"></div>');
      
      //appends the direct slide access
      $slides.each(function(i){
        $(this).data("index", i);
        var $controllElement = $('<a href="#goToSlide' + i + '"><span>Go to slide ' + i + '</span></a>').click(
          function(obj){
            obj.preventDefault();
            slideToPos(i);
            $(this).trigger("makeActive");
          }).bind("makeActive", function(){
            $(this).addClass("active").siblings("a").removeClass("active");
          });
        $slideController.append($controllElement);
      });
      
      $slideController.append("<div></div>");
      
      /* hide one or more slides, callback function can be provided */
      hideSlide = function($slide, fade, callback){
        var totalCallbacks, sendCallback;
        
        if (!callback || typeof(callback) != 'function') {
          callback = function(){};
        }
        
        totalCallbacks = $slide.length;
        
        sendCallback = function($that, i){
          if ( i === (totalCallbacks - 1) ) {
            callback($that);
          }
        };
        
        $slide.removeClass("active");


        $slide.each(function(i){
          var $hotspots, $bigTeaser, $that = $(this);
          
          $hotspots = $that.find(".hotspots");
          $bigTeaser = $("#yaml_col3-content").find("> .teaserContent");
          
          if(fade){
            $bigTeaser.fadeOut((speed / 4), function(){ $(this).remove(); });
            $toggleContents.fadeTo((speed / 4), 0.001).unbind("click");
            /*$hotspots.stop(false, true).fadeTo(50, 0.001, function(){*/
              $hotspots.css("visibility", "hidden");
              $that.stop(false, false).fadeTo((speed / 2), 0.001, function(){ $that.css("visibility", "hidden"); sendCallback( $that , i ); });
            /*})*/
            
          }else{
            $hotspots.css("visibility","hidden");
            $that.css("visibility","hidden");
            $bigTeaser.remove();
            sendCallback( $that , i ); 
          }
          
        });
      };
      
      /* shows a slide / callback function can be provided */
      showSlide = function($slide, callback){
        var $hotspots, $teaserContent;
         
        if (!callback || typeof(callback) != 'function') {
          callback = function(){};
        }
        
        $slideController.find("> a:eq(" + $slide.data("index") + ")").trigger("makeActive");

        $slide.addClass("active");
          
        $hotspots = $slide.find(".hotspots");
        $teaserContent = $slide.find(".teaserContent").clone();
          
        $toggleContents.removeClass("left");
        if($teaserContent.is(".left")){
          $toggleContents.addClass("left")
        }
        $slide.css({opacity: 0, visibility: "visible"});
        $teaserContent.css({opacity: 0, visibility: "visible"}).appendTo("#yaml_col3-content");
        $toggleContents.appendTo("#yaml_col3-content").bind("click", function(obj){
          obj.preventDefault();
          $teaserContent.toggle();
          $hotspots.toggle();
          $(this).toggleClass("mini");
        });
        
        $slide.stop(false, false).fadeTo((speed * 2), 1, function(){
          $teaserContent.stop(false, true).fadeTo((speed / 2), 1);
          $toggleContents.stop(false, true).fadeTo((speed / 2), 1);
          $('#heightFix').height($teaserContent.height()); //fixes the height of the page
          jQuery.fn.productslider();
          $hotspots.css({visibility: "visible"});
        });
        
        if(isiPad) {
        var $$prev = $teaserContent.find("#prev"),
					  $$next = $teaserContent.find("#next");

        $teaserContent.unbind("swipe").swipe({
						swipeLeft: function(event) {
		     			$$next.trigger("click");
		     		},
	     			swipeRight: function(event) {
		     			$$prev.trigger("click");
	     			}
					});

					}

        pageTracker._trackEvent('Megateaser','Anzeige',jQuery(':hidden[name=megaTeaserName]', $slide).val());
      };
      
      /* slider control butons */
      
      $nextSlide = $('<a class="nextSlide" href="#nextSlide">next slide</a>');
      $prevSlide = $('<a class="prevSlide" href="#prevSlide">prev slide</a>');
      
      /* slides to the next, prev or slideNumber */
      slideToPos = function(position, $trigger){
        var $activeSlide, $slideToGoTo;
        
        $activeSlide = $slides.filter('.active');
        
        if($prevSlide.css("display") === "none"){
          $prevSlide.stop(false, false).fadeIn(speed);
        }else if($nextSlide.css("display") === "none"){
          $nextSlide.stop(false, false).fadeIn(speed);
        }
        
        if (isNaN(position)){
          
          if(position === "next"){
            if($activeSlide.next('.slide').length){
              $slideToGoTo = $activeSlide.next('.slide:eq(0)');
              
            }
          }else{
            if($activeSlide.prev('.slide').length){
              $slideToGoTo = $activeSlide.prev('.slide:eq(0)');
            }
          }
          
        }else{
          $slideToGoTo = $slides.eq(position);
        };
        
        if(!$slideToGoTo.next('.slide').length){
          $nextSlide.stop(false, false).fadeOut(speed);
        }
        if(!$slideToGoTo.prev('.slide').length){
          $prevSlide.stop(false, false).fadeOut(speed);
        }
        
        hideSlide($activeSlide, true);
        showSlide($slideToGoTo);
        
        tb_init('a.thickbox');
      };
      
      /* appends the controls to the page and triggers the slideEvents */
      controls = function($container){
        var $overView, smallNavTrigger, largeNavigation = true;
        
        smallNavTrigger = 1124; //this is when the navigarion triggers from small to big and vis versa
        
        $nextSlide.click(function(obj){
          pageTracker._trackEvent('Megateaser','MT_Wechsel','rechts');
          obj.preventDefault();
          slideToPos('next', $(this));
          $(window).resize()
        });
        
        $prevSlide.click(function(obj){
          pageTracker._trackEvent('Megateaser','MT_Wechsel','links');
          obj.preventDefault();
          slideToPos('prev', $(this));
          $(window).resize()
        });
        
        $win.resize(function(){
          if(largeNavigation && ($win.width() < smallNavTrigger)){
            $nextSlide.toggleClass("small");
            $prevSlide.toggleClass("small");
            largeNavigation = false;
          }else if(!largeNavigation && ($win.width() > smallNavTrigger)){
            $nextSlide.toggleClass("small");
            $prevSlide.toggleClass("small");
            largeNavigation = true;
          };
        });
        
        $container.append($nextSlide, $prevSlide, $slideController);

        //ipad swipe controls
        if(isiPad && $("#megaTeaser").length) {
	        $("#megaTeaser").swipe({
	     			swipeLeft: function(event) {
		     			$nextSlide.trigger("click")
		     		},
	     			swipeRight: function(event) {
	     				$prevSlide.trigger("click")
	     			}
					});
				}
        
      };
      
      controls($controls);
      
      if ( $('body').attr("class").search("slide-id-") != -1 ) {
        startSlideNbr = $('body').attr("class").split("slide-id-")[1];
      }else{
        startSlideNbr = 0;
      }
      
      if (parseInt(startSlideNbr) === 0){
          $prevSlide.hide();
      }else if(parseInt(startSlideNbr) === ($slides.length - 1) ){
          $nextSlide.hide();
      }
      
      hideSlide($slides.not(':eq(' + startSlideNbr + ')'), false);
      showSlide($slides.filter(':eq(' + startSlideNbr + ')'), function($thing){ });
    };
    
    sliderFunc();
    setTimeout(function(){ $(window).resize() }, 3000);
    
  }
  return false;
};

//resize all slides 

function resizeAll($slides, $win, $){
  $slides.each(function(){
    var $that = $(this),
        $img = $that.find('div.slideMainImg > img'),
        $hotspots = $that.find('div.hotspots');
        offset = autoImageSize($img, $win);
        
        /*$img.load(function(){*/
          $hotspots.css({top: offset.offsetTop + "px", left: offset.offsetLeft + "px", width: offset.width + "px" , height: offset.height + "px" });
        /*});*/
  });
}

/*-----------------------------------------------------------------------------------------------------*/
// footer rollover effect

function footerHover($footer, $hoverTriggers, $){
  if($footer.length && checkContext("mammut", $)){
    var bindItAll, $footerContainer = $footer.find("div.footer-bg");


	if(!isiPad){
	    bindItAll = function(){
		    $hoverTriggers.bind("mouseenter", function(){
		      $footerContainer.stop(false, true).animate({"height": "190px"}, 300, function(){
		        $footer.unbind("mouseleave");
		        $footer.bind("mouseleave", function(){
		          $footerContainer.stop(false, true).animate({"height": "34px"}, 200);
		        });
		      })
		    
		    });
	    }
	    
	    bindItAll();
	    
	    $footer.find("form#countrygroup_form select:eq(0)").bind("focus", function(){
	        $footer.unbind("mouseleave");
	        $hoverTriggers.unbind("mouseenter");
	    }).blur(function(){
	        bindItAll();
	    });
	}
  }
  return false;
};

/* tooltips for teaser */

function teaserTips($tooltipContainer, $){
  if ($tooltipContainer.length){
    $tooltipContainer.click(function(obj){
      var $that = $(obj.target);
      
      if( $that.is("a.spot") ){
        var isLeft, $parent = $that.parent();
        if($that.is(".left")){
          isLeft = true;
        }else{
          isLeft = false;
        }
        obj.preventDefault();
        if(!$parent.is(".on")){
          if(isLeft){
            $tooltipContainer.find(".on").removeClass("on").find("div.tooltip").stop(false, true).animate({opacity: 0, left: "-=20px"},100, function(){ $(this).css("display", "none") });
            $parent.addClass("on").find("div.tooltip").css({opacity:0, display: "block"}).stop(false, true).animate({opacity: 1, right: "+=20px"},300);
          }else{
            $tooltipContainer.find(".on").removeClass("on").find("div.tooltip").stop(false, true).animate({opacity: 0, left: "-=20px"},100, function(){ $(this).css("display", "none") });
            $parent.addClass("on").find("div.tooltip").css({opacity:0, display: "block"}).stop(false, true).animate({opacity: 1, left: "+=20px"},300);
          }
          pageTracker._trackEvent('Megateaser','Hotspot_View',$that.next().find('input[name=hotspotId]').val());
        }else{
          if(isLeft){
            $parent.removeClass("on").find("div.tooltip").stop(false, true).animate({opacity: 0, right: "-=20px"},100, function(){ $(this).css("display", "none") });
          }else{
            $parent.removeClass("on").find("div.tooltip").stop(false, true).animate({opacity: 0, left: "-=20px"},100, function(){ $(this).css("display", "none") });
          }
        }
      }
    })
  };
};
/* iFrame URL parse */
function parseIframeLinks($iFrame, $){
  var $frameContents, $links;
  
  if ($.browser.msie) {
    $frameContents = $($iFrame[0].contentWindow.document.body);
  }else{
    $frameContents = $iFrame.contents().find("body");
  };
    
  $links = $frameContents.find('a');
  
 $links.each(function(){
    var address, $that = $(this),
        baseURLBasecamp =  /(.*)\/basecamp\/(.*)/i,
        baseURLAlpineSchool = /(.*)\/alpineschool(.*)/i,
        js = /(.*)\/javascript(.*)/i;
    
    if($that.attr("href")){
	    address = $that.attr("href");
	    if(address.search(baseURLBasecamp) != -1 || address.search(baseURLAlpineSchool) != -1 ){
	      $that.attr("target", "_parent");
	      
	    }else if( address.split(":")[0] == "http" || address.split(".")[0] == "www" ) {
	      $that.attr("target", "_blank");
	    };
    }
    
    /*if($that.attr("rel")){

    	if( $that.attr("rel").search("lightbox") != -1) {
    	
    	}
    }*/
    
  });
  
}


/* iFrame reseize */

function iFramler($iFrames, $, noRsize) {
  if ($iFrames.length) {	  
    var resizeiFrame, iChangeListener, idAlpineTourContentTabContainer, $AlpineTourContentTabContainer, $AlpineTourContentLinks, $registerPasswordFields, iFrameContent, $iframeForm;
    idAlpineTourContentTabContainer = "Template_ctl00_DataList1_ctl00_RadTabStrip1";

    if ($.browser.msie) {
      var plusmargin = 100;
    }
    else {
      var plusmargin = 100;
    }
    resizeiFrame = function ($iFrame) {
      if (!noRsize) {
        var height;
        var passWrapperHeight = 0;

        setTimeout(function () {
          if ($.browser.msie) {
            iFrameContent = $iFrame[0].contentWindow.document.body;
            height = iFrameContent.scrollHeight;
            iFrameContent = $(iFrameContent);
          }
          else {
            iFrameContent = $iFrame.contents().find("body");
            height = iFrameContent.height();
          }

          if (iFrameContent.find("#edit-pass-wrapper").length) {
          	passWrapperHeight = 80;
            if ($.browser.msie) {
              passWrapperHeight += 50;
            }
          }
		  
		  if (iFrameContent.find("#mammut-authenticity-eiger-extreme-profile-form").length) {
          	passWrapperHeight = 80;
            if ($.browser.msie) {
              passWrapperHeight += 50;
            }
          }

          $AlpineTourContentTabContainer = iFrameContent.find("#" + idAlpineTourContentTabContainer);
          if ($AlpineTourContentTabContainer.length) {
            $AlpineTourContentTabContainer.click(function (event) {
              var tempHeight, tempHeightSide;
              if ($(event.target).is("span")) {
                tempHeight = parseInt(iFrameContent.find("#Template_ctl00_DataList1_ctl00_RadMultiPage1").find("> div:visible").eq(0).height());
                tempHeightSide = parseInt(iFrameContent.find("#steckbrief_container").height());

                tempHeight = tempHeight < tempHeightSide ? tempHeightSide : tempHeight;
                if (tempHeight < 412) {

                  tempHeight = 500;
                }

                $iFrame.height(tempHeight + plusmargin + passWrapperHeight);
              }
            });
          }

          $AlpineTourContentLinks = iFrameContent.find('a');
          if ($AlpineTourContentLinks.length) {
            $AlpineTourContentLinks.each(function () {
              if (this.onclick) {
                $(this).click(function (event) {
                  var tempHeight, tempHeightSide;
                  tempHeight = parseInt(iFrameContent.find("#Template_ctl00_DataList1_ctl00_RadMultiPage1").find("> div:visible").eq(0).height());
                  tempHeightSide = parseInt(iFrameContent.find("#steckbrief_container").height());

                  tempHeight = tempHeight < tempHeightSide ? tempHeightSide : tempHeight;
                  if (tempHeight < 412) {

                    tempHeight = 500;
                  }

                  $iFrame.height(tempHeight + plusmargin + passWrapperHeight);
                  $iFrame.get(0).scrollTo(0, 0);

                  event.preventDefault();
                })
              }
            });
          }
          
          $iframeForm = iFrameContent.find('#openid-user-add, #inxmailprofessional-user-form');
          $iframeForm.attr('target', '_top');
          
          $iFrame.height(parseInt(height) + plusmargin + passWrapperHeight);
        }, 100);

      }
    };

    $iFrames.each(function () {
      var fallbacktimer, $that = $(this);

      fallbacktimer = setTimeout(function () {
        resizeiFrame($that);
      }, 1000);

      $that.load(function () {
        setTimeout(function () {
          parseIframeLinks($that, $);
          clearTimeout(fallbacktimer);
          resizeiFrame($that);
        }, 10);
      });
    });
  }
}

/* login links */
function handleLogin ($){
  var href, $links, $headernav;
  
  href = $("#loginurl").val();
  $headernav = $("#yaml_nav-meta ul");
  
  $.get(href, function(data){
	  
	var $content = $(data.split(/(?:<body>|<\/body>)/ig)[1]);

    $links = $content.find("a");
    
    $links.each(function(){
      var $that = $(this);
      $that.wrap("<li class='storelocator'></li>").wrap("<span class='button button-gray'></span>");
      $that.attr('target', '_parent');
      $that.parent().parent().appendTo($headernav);
      if($that.text().toLowerCase() == "login"){
    	  $(".profile-nav").hide();
      }
    });
  })
  
}

/* function reads title from inside iframe and sets on the current page */
function setExternalPageTitle($iFrame){
	var $frameTitle;
	$frameTitle = $iFrame.contents().find('title').html();
	if($frameTitle){
	document.title = $frameTitle
	jQuery('div#contentTitle').html($frameTitle);
	}
}

/* function reads meta info from iframe and sets it on the facebook sharing link */
function setFacebookSharingLinkDetails($iFrame){
	if($iFrame.contents().length){
		var link = jQuery('li.mammut_facebook a:eq(0)').attr('href');
	
		var queryString = '?s=100'
		if($iFrame.contents().find('title').html()){
			queryString += '&' + 'p[title]=' + $iFrame.contents().find('title').html();
		}
		
		if(window.location){
			queryString += '&' + 'p[url]=' + window.location;
		}
		
		if($iFrame.contents().find('img:eq(0)').attr('src')){
			queryString += '&' + 'p[images][0]=' + $iFrame.contents().find('img:eq(0)').attr('src');
		}
			
		link = link.replace(/\?.*/gi, encodeURI(queryString));
		jQuery('li.mammut_facebook a:eq(0)').attr('href', link);
	}
}

function iPadler($){
	if(isiPad) {
		//viewport fix
		$("head").prepend('<meta name="viewport" content="initial-scale=1, maximum-scale=1">');
		var $footer = $("div.footer-wrapper:eq(0)");
		var $footerContainer = $footer.find("div.footer-bg");
		
		var $turnIt;

		$turnIt = $("<div />");
		$turnIt.addClass("turnBack").html("&nbsp;");
		$turnIt.hide();
		$turnIt.click(function(){
			$turnIt.hide();
		});
		$("body").append($turnIt);

		//handle orientation
		var oriental = function(){
			var orientation = window.orientation;
			
			if ( orientation == 0 || orientation == 180 ) {
				//Portrait mode
				$turnIt.show();
			}else{
				//ladscape mode
				$turnIt.hide();	
			}
		};

		window.onorientationchange = oriental;

		oriental();

		//append iPad icons
		$("<span class='ipadIcon'>&nbsp;</span>").appendTo("#yaml_nav-main > ul > li > a, ul.footer-nav-meta li.section:last-child strong");
		
		// main navigation
		$("#yaml_nav-main > ul > li").click(function(e){
			var $that = $(e.target).parents("#yaml_nav-main li");
			
			$that.parents("#yaml_nav-main").find("li").not($that).removeClass("hover");
			$that.parents("#yaml_nav-main li").toggleClass("hover");
			
			if($(e.target).parents("li").get(0) == this){
				e.preventDefault();
			}
		});
		
		// footer navigation
		$("ul.footer-nav-meta").click(function(e){
			var height = $footer.hasClass("hover") ? "34px" : "190px";
			$footerContainer.css({"height": height});
			$footer.toggleClass("hover");
			
			if($(e.target).parents("ul").get(0) == this){
				e.preventDefault();
			}
		});
		
		$("ul.footer-nav-meta input").click(function(e){
			e.stopPropagation();
		});

		//fix for the meagaTeaser
		if( $("#megaTeaser").length ){
			var $slides, $mT = $("#megaTeaser");
			$slides = $mT.find("div.slide");
			$slides.each(function(){
				var $img, $slide, $teasers;
				$slide = $(this);
				$img = $slide.find(".slideMainImg > img");
				$img.css("opacity", 0.0001);
				$slide.css({
					"background-image": "url(" + $img.attr("src") + ")",
					"background-size": "cover" 
				});

				//remove miniteasers if there are more then two of them
				$teasers = $slide.find(".miniTeaser");

				if( $teasers.length > 2) {
					$teasers.slice(2,$teasers.length).remove();
				}
			});

		}
		
		
		//fix the footer
		$("div#yaml_footer").css("position", "relative !important");
		
		//remove hover effects
		$(".enable-hover").removeClass("enable-hover");
		
		// fix overlays
		// full product image
		$(".products-img-detail .overlay").each(function(i, el){
			var $that = $(el);
			var href = $that.find("a").attr("href");
			
			$that.parents(".products-img-detail").find("img.img-products").click(function(e){
				tb_show("", href);
			});
		});
		// product thumbnails
		var thumbs = $(".products-detail-thumbs .products-img .overlay").each(function(i, el){
			var $that = $(el);
			var href = $that.find("a").attr("href");
			
			$that.parents(".products-img").find("img").click(function(e){
				tb_show("", href);
			});
		});
		// other products
		$(".products-img .overlay").not(thumbs).each(function(i, el){
			var $that = $(el);
			var href = $that.find("a").attr("href");
			
			$that.parents(".products-img").find("img").click(function(e){
				window.location.href = href;
			});
		});
		
		// fix language and region dropdown
		$("div#yaml_footer select, div#yaml_header select").css({"background":"#fff", "color":"#686868"});
	}
};

function copyRightler($) {
  var $img, $copyRight, html;
  
  $copyRight = $("<div />").addClass("imageCopyright");
  
  if($("div#backgroundimage").length ){
    
    $img = $("div#backgroundimage").find("img");
    html = "&copy;&nbsp;&nbsp;" + $img.attr("alt") + "<a href='" + $img.attr("src") + "' target='_blank'>" + $img.attr("longdesc") + "</a>";
    $copy = $copyRight.clone();
      $copy.html(html);
      $img.parents("div#backgroundimage").eq(0).append($copy);
      marign = -1 * ($copy.width() - 8);
      $copy.css("margin-right", marign);
      if(!isiPad){
	      $copy.hover(function(){
	        $(this).css({"margin-right": 0});
	      },function(){
	        $(this).css({"margin-right": marign + "px"});
	      });
      } else {
    	  $copy.click(function(e){
    		  var mr = $(this).hasClass("hover") ? marign + "px" : 0;
    		  $(this).css({"margin-right": mr});
    		  $(this).toggleClass("hover");
    	  })
      }
    
  }else if( $("#megaTeaser").length ){
  
    $img = $("#megaTeaser").find(".slideMainImg").find("img");
    $img.each(function(){
      var $copy, marign, $that = $(this);
      html = "&copy;&nbsp;&nbsp;" + $that.attr("alt") + "<a href='" + $that.attr("src") + "' target='_blank'>" + $that.attr("longdesc") + "</a>";
      $copy = $copyRight.clone();
      $copy.html(html);
      $that.parents(".slide").eq(0).append($copy);
      marign = -1 * ($copy.width() - 8);
      $copy.css("margin-right", marign);
      if(!isiPad){
	      $copy.hover(function(){
	        $(this).css({"margin-right": 0});
	      },function(){
	        $(this).css({"margin-right": marign + "px"});
	      });
      } else {
    	  $copy.click(function(e){
    		  var mr = $(this).hasClass("hover") ? marign + "px" : 0;
    		  $(this).css({"margin-right": mr});
    		  $(this).toggleClass("hover");
    	  })
      }
    });
    
  }else{
    return false;
  }
  

  
};

window.onload = function () {
	jQuery("#centerFrame").ready(function() {
		$iFrame = jQuery("#centerFrame")
		setExternalPageTitle($iFrame);
		setFacebookSharingLinkDetails($iFrame);
     });
};

/*-----------------------------------------------------------------------------------------------------*/
/* Productdetail & document ready */

jQuery(document).ready( function(){
       
  /*only show the login if the user is in bsecamp-context*/
  handleLogin(jQuery);
  iFramler(jQuery("iframe.contentIframe"),jQuery);
  iFramler(jQuery("iframe.changeTarget"),jQuery, true);
  backgroundResizler(jQuery('div#backgroundimage'), "img:eq(0)", jQuery);
  footerHover(jQuery('div.footer-wrapper:eq(0)'), jQuery('ul.footer-nav-meta'), jQuery);

  iPadler(jQuery);
  
  teaserSlider(jQuery('div#megaTeaser'), jQuery);
  teaserTips(jQuery('div.hotspots'), jQuery);
  
  
  copyRightler(jQuery);
  
  setTimeout(function(){jQuery(window).trigger('resize')}, 20);
  
  if(!isiPad){
	jQuery('ul.colors-detail li').hover(
		function(){
			
			var colorVariant = jQuery(this).attr('id');
			var colorNumber = colorVariant.substring(6,21);
			
			jQuery('img[id^=pictureVariant]').each(
				function(){
					var variant = jQuery(this).attr('id');
					var number = variant.substring(15,30);
					if(colorNumber == number){
						jQuery(this).removeClass("hideVariant");
					} else {
						jQuery(this).addClass("hideVariant");
					}
				}
			);
		}, 
		function(){
			jQuery('img[id^=pictureVariant]').each(
				function(index){
					if(jQuery(this).hasClass("active")){
						jQuery(this).removeClass("hideVariant");
					} else {
						jQuery(this).addClass("hideVariant");
					}
				}
			);
		}
	);
  }
	if(ie7 /*&& jQuery('body').is(".home")*/){ //dirty ie fix for navigation
	 jQuery('div#yaml_header').appendTo("body");
	 if(!jQuery('body').is(".home")) {
	   jQuery('#yaml_header-bg').remove();
	 }
	}
	
	if(jQuery.browser.msie){
		var $iframes = jQuery("#yaml_nav-sub iframe, #yaml_col2 iframe"),
		    $hackyframe = jQuery(".cutmargin iframe");
		
		$iframes.load(function(){
			$iframes.contents().find("body").css("background", "#000");
			
		});	
		$hackyframe.load(function(){
			setTimeout(function(){ $hackyframe.height($hackyframe.height() - 20); }, 1500);
		});
	
		//ie 9 search button fix
//		jQuery("#quicksearch_form").each(function(){
//			jQuery(this).find("span.button:eq(0) > a").html("&nbsp;");
//			
//		});
	}
	
	jQuery("#msg-newsletter-footer").submit(function(e){
		e.preventDefault();
		jQuery("a", this).get(0).onclick();
	});

	
});

function playTrailerVideo() {
	window.open('http://www.youtube.com/watch?v=CMxNBA4bF8c');
};
