var Jarallax=function(){this.FPS=24,this.FPS_INTERVAL=1e3/this.FPS,this.FRAME_DATA_SAMPLE=24,this.FRAME_DATA_REFRESH=12,this.fpsTop=0,this.fpsBottom=1e3,this.animations=[],this.defaultValues=[],this.progress=0,this.properties={},this.prevProgress=0,this.controllers=[],this.maxProgress=1,this.timer=void 0,this.allowWeakProgress=!0,this.frameRate=this.FPS,this.stepSize=0,this.jumping=!1;for(var a in arguments)arguments[a]instanceof Array?this.controllers=arguments[a]:arguments[a].isController?this.controllers.push(arguments[a]):arguments[a]instanceof Object?this.properties=arguments[a]:console.log("WARNING: bad argument "+a);this.controller||($.browser.iDevice?this.controllers.push(new ControllerApple(!1)):$.browser.mozilla?this.controllers.push(new ControllerScroll(!1,this.properties.horizontal,this.properties.disableVertical)):this.controllers.push(new ControllerScroll(!0,this.properties.horizontal,this.properties.disableVertical)));for(var b in this.controllers)this.controllers[b].activate(this);this.frameChart=[];for(var c=1;600>=c;c++)this.frameChart[c]=1e3/c};Jarallax.prototype.setProgress=function(a,b){if(a>1?a=1:0>a&&(a=0),this.progress!=a&&(this.progress=a,this.allowWeakProgress||!c)){this.previousTime=new Date,this.currentTime=new Date;var c=b||!1;for(var d in this.defaultValues)this.defaultValues[d].activate(this.progress);for(var e in this.animations)this.animations[e].activate(this.progress);for(var f in this.controllers)this.controllers[f].update(this.progress);this.currentTime=new Date,this.stepSize=Math.max(this.currentTime-this.previousTime,this.stepSize)}},Jarallax.prototype.clearAnimations=function(){this.animations=[]},Jarallax.prototype.clearDefaults=function(){this.defaultValues=[]},Jarallax.prototype.clearControllers=function(){this.controllers=[]},Jarallax.prototype.jumpToProgress=function(a,b,c){return a.indexOf?-1!=a.indexOf("%")&&(a=parseFloat(a)/100):a/=this.maxProgress,a==this.progress?!1:(a>1?a=1:0>a&&(a=0),this.smoothProperties={},this.smoothProperties.timeStep=1e3/c,this.smoothProperties.steps=b/this.smoothProperties.timeStep,this.smoothProperties.currentStep=0,this.smoothProperties.startProgress=this.progress,this.smoothProperties.diffProgress=a-this.progress,this.smoothProperties.previousValue=this.progress,this.smooth(),this.allowWeakProgress=!1,!1)},Jarallax.prototype.smooth=function(a){var b;if(b=a?a:this,b.smoothProperties.currentStep++,clearTimeout(b.timer),b.smoothProperties.currentStep<b.smoothProperties.steps){var c=b.smoothProperties.currentStep/b.smoothProperties.steps,d=Jarallax.EASING.easeOut(c,b.smoothProperties.startProgress,b.smoothProperties.diffProgress,1,5);b.jumpingAllowed=!0,b.setProgress(d),b.jumpingAllowed=!1,b.timer=window.setTimeout(function(){b.smooth(b)},b.smoothProperties.timeStep),b.smoothProperties.previousValue=d,b.allowWeakProgress=!1}else b.jumpingAllowed=!0,b.setProgress(b.smoothProperties.startProgress+b.smoothProperties.diffProgress),b.jumpingAllowed=!1,b.clearSmooth(b)},Jarallax.prototype.clearSmooth=function(a){a.allowWeakProgress=!0,clearTimeout(a.timer),delete a.smoothProperties},Jarallax.prototype.setDefault=function(a,b){if(!a)throw new Error("no selector defined.");if(JarallaxTools.isValues(b)){var c=new JarallaxObject(a,b);c.activate(),this.defaultValues.push(c)}},Jarallax.prototype.addStatic=function(a,b){if(!a)throw new Error("no selector defined.");if(JarallaxTools.isValues(b)){var c=new JarallaxStatic(a,b[0],b[1]);this.defaultValues.push(c)}},Jarallax.prototype.addCounter=function(a){this.animations.push(new JarallaxCounter(this,a))},Jarallax.prototype.addController=function(a,b){this.controllers.push(a),b&&a.activate(this)},Jarallax.prototype.addAnimation=function(a,b,c,d){if(c=c?c.substring?[c]:c||[JarallaxTools.Platform.Any]:["any"],JarallaxTools.PlatformAllowed(c,d)){var e;if(!a)throw new Error("no selector defined.");var f=[];if(JarallaxTools.isValues(b))if(b.length)for(var g=0;g<b.length-1;g++){if(!b[g]||!b[g+1])throw new Error("bad animation data.");if(!b[g].progress||!b[g+1].progress)throw new Error("no animation boundry found.");-1==b[g+1].progress.indexOf("%")&&this.maxProgress<b[g+1].progress&&(this.maxProgress=b[g+1].progress),e=new JarallaxAnimation(a,b[g],b[g+1],this),this.animations.push(e),f.push(e)}else{b.progress||(b.progress="100%");var h={};for(var i in b)h[i]=$(a).css(i);h.progress="0%",e=new JarallaxAnimation(a,h,b,this),this.animations.push(e),f.push(e)}return f}return!1},Jarallax.prototype.cloneAnimation=function(a,b,c){if(!a)throw new Error("no selector defined.");for(var d=[],e=[],f=0;f<c.length+1;f++)b instanceof Array?e.push(b[f]):e.push(b);for(f=0;f<c.length;f++){var g=c[f],h=JarallaxTools.clone(g.startValues),i=JarallaxTools.clone(g.endValues),j=e[f],k=e[f+1];for(var l in h)j[l]&&(h[l]=JarallaxTools.calculateNewValue(j[l],h[l]));for(var m in i)k[m]&&(i[m]=JarallaxTools.calculateNewValue(k[m],i[m]));d.push(this.addAnimation(a,[h,i])[0])}return d},Jarallax.EASING={linear:function(a,b,c,d){return a/d*c+b},easeOut:function(a,b,c,d,e){return void 0===e&&(e=2),(-1*Math.pow((d-a)/d,e)+1)*c+b},easeIn:function(a,b,c,d,e){return void 0===e&&(e=2),Math.pow(a/d,e)*c+b},easeInOut:function(a,b,c,d,e){return void 0===e&&(e=2),c/=2,a*=2,d>a?Math.pow(a/d,e)*c+b:(a-=d,(-1*Math.pow((d-a)/d,e)+1)*c+b+c)}},Jarallax.EASING.none=Jarallax.EASING.linear,JarallaxTools={},JarallaxTools.hasNumbers=function(a){var b=new RegExp("\\d");return b.test(a)},JarallaxTools.isValues=function(a){if(!a)throw new Error("no values set.");if("object"!=typeof a)throw new Error('wrong data type values. expected: "object", got: "'+typeof a+'"');if(0===a.size)throw new Error("Got an empty values object");return!0},JarallaxTools.PlatformAllowed=function(a,b,c){b=b||!1,c=c||!1;for(var d=0;d<a.length;d++){if("any"==a[d])return!c;if(jQuery.browser[a[d]]){if(!b)return!c}else if(b)return c}return c?!b:b},JarallaxTools.calculateNewValue=function(a,b){var c,d=JarallaxTools.getUnits(b);return c=0===a.indexOf("+")?String(parseFloat(b)+parseFloat(a)+d):0===a.indexOf("-")?String(parseFloat(b)+parseFloat(a)+d):0===a.indexOf("*")?String(parseFloat(b)*parseFloat(a.substr(1))+d):0===a.indexOf("/")?String(parseFloat(b)/parseFloat(a.substr(1))+d):a,b.indexOf&&b.indexOf("%")>0?c+"%":c},JarallaxTools.getUnits=function(a){return a.replace(/\d+/g,"")},JarallaxTools.clone=function(a){var b={};for(var c in a)b[c]=a[c];return b},Position=function(a,b){this.x=a,this.y=b},Position.prototype.add=function(a){return new Position(this.x+a.x,this.y+a.y)},Position.prototype.subract=function(a){return new Position(this.x-a.x,this.y-a.y)},JarallaxTools.Platforms=["webkit","opera","msie","mozilla","android","blackBerry","webOs","windowsPhone","iDevice","iPad","iPhone","iPod","msie","mobile","nonMobile"],jQuery.browser.android=/android/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.blackBerry=/blackberry/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.webOs=/webos/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.windowsPhone=/windows phone/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.iDevice=/ipad|iphone|ipod/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.iPad=/ipad/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.iPhone=/iphone/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.iPod=/ipod/i.test(navigator.userAgent.toLowerCase()),jQuery.browser.mobile=jQuery.browser.android||jQuery.browser.blackBerry||jQuery.browser.webOs||jQuery.browser.windowsPhone||jQuery.browser.iDevice,jQuery.browser.nonMobile=!jQuery.browser.mobile,jQuery.platform={},jQuery.platform.windows=-1!=navigator.appVersion.indexOf("Win"),jQuery.platform.macOs=-1!=navigator.appVersion.indexOf("Mac"),jQuery.platform.unix=-1!=navigator.appVersion.indexOf("X11"),jQuery.platform.linux=-1!=navigator.appVersion.indexOf("Linux"),jQuery.platform.unknown=!(jQuery.platform.windows||jQuery.platform.macOs||jQuery.platform.unix||jQuery.platform.linux),JarallaxController=function(){this.isActive=!1,this.bindings=[],this.isController=!0},JarallaxController.prototype.activate=function(a){this.isActive=!0,this.jarallax&&this.jarallax===a||(this.jarallax=a)},JarallaxController.prototype.deactivate=function(){this.isActive=!1},JarallaxController.prototype.update=function(){},JarallaxCounter=function(a,b){if(!b)throw new Error("No properties defined.");if(!b.selector)throw new Error("No selector defined. properties.selector.");this.jarallax=a,this.selector=b.selector,this.startNumber=b.startNumber||0,this.endNumber=b.endNumber||100,this.startProgress=b.startProgress||"0%",this.endProgress=b.endProgress||"100%",this.decimals=b.decimals||0,this.stepSize=b.stepSize,0===this.decimals&&this.stepSize<1&&(tmp=this.stepSize.toString().split("."),this.decimals=tmp[1].length)},JarallaxCounter.prototype.activate=function(){var a=this.endNumber-this.startNumber;if(a*this.jarallax.progress+this.startNumber,this.startProgress.indexOf("%")>=0?start=parseInt(this.startProgress,10)/100:JarallaxTools.hasNumbers(this.startProgress)&&(start=parseInt(this.startProgress,10)/this.jarallax.maxProgress),this.endProgress.indexOf("%")>=0?end=parseInt(this.endProgress,10)/100:JarallaxTools.hasNumbers(this.endProgress)&&(end=parseInt(this.endProgress,10)/this.jarallax.maxProgress),this.jarallax.progress<start)$(this.selector).html(this.startNumber);else if(this.jarallax.progress>end)$(this.selector).html(this.endNumber);else{var b=end-start,c=this.jarallax.progress-start,d=this.endNumber-this.startNumber,e=Jarallax.EASING.none(c,this.startNumber,d,b);this.stepSize&&(e=Math.round(e/this.stepSize)*this.stepSize),this.decimals>0&&(e=e.toFixed(this.decimals)),$(this.selector).html(e)}},JarallaxObject=function(a,b){this.selector=a,this.values=b},JarallaxObject.prototype.activate=function(){for(var a in this.values)$(this.selector).css(a,this.values[a])},JarallaxAnimation=function(a,b,c,d){this.progress=-1,this.selector=a,this.startValues=b,this.endValues=c,this.jarallax=d},JarallaxAnimation.prototype.activate=function(a){if(this.progress!=a){var b,c,d;if(d=void 0===this.startValues.style?{easing:"linear"}:this.startValues.style,this.startValues.progress.indexOf("%")>=0?b=parseInt(this.startValues.progress,10)/100:JarallaxTools.hasNumbers(this.startValues.progress)&&(b=parseInt(this.startValues.progress,10)/this.jarallax.maxProgress),this.endValues.progress.indexOf("%")>=0?c=parseInt(this.endValues.progress,10)/100:JarallaxTools.hasNumbers(this.endValues.progress)&&(c=parseInt(this.endValues.progress,10)/this.jarallax.maxProgress),this.startValues.event&&this.dispatchEvent(this.progress,a,b,c),a>=b&&c>=a)for(var e in this.startValues)if("progress"!==e&&"style"!==e&&"event"!==e)if(void 0!==this.endValues[e]&&"display"!==e&&"backgroundImage"!==e){var f=JarallaxTools.getUnits(this.startValues[e]+"");f=f.replace("-","");var g=parseFloat(this.startValues[e]),h=parseFloat(this.endValues[e]),i=c-b,j=a-b,k=h-g,l=Jarallax.EASING[d.easing](j,g,k,i,d.power);"px"==f&&(l=parseInt(l,10)),"."!==f&&(l+=f),"rotate"!==e?$(this.selector).css(e,l):$(this.selector).rotate(Math.round(l))}else"rotate"!==e?$(this.selector).css(e,this.startValues[e]):$(this.selector).rotate(Math.round(this.startValues[e]));this.progress=a}},JarallaxAnimation.prototype.dispatchEvent=function(a,b,c,d){var e=this.startValues.event,f={};f.animation=this,f.selector=this.selector,b>=c&&d>=b?(e.start&&c>a&&(f.type="start",e.start(f)),e.start&&a>d&&(f.type="rewind",e.start(f)),e.animating&&(f.type="animating",e.animating(f)),e.forward&&b>a&&(f.type="forward",e.forward(f)),e.reverse&&a>b&&(f.type="reverse",e.reverse(f))):(e.complete&&d>a&&b>d&&(f.type="complete",e.complete(f)),e.rewinded&&a>c&&c>b&&(f.type="rewind",e.rewinded(f)))},ControllerApple=function(a){this.scrollPage=void 0===a?!0:a,this.target=$("body"),this.scrollPostion=new Position(0,0)},ControllerApple.prototype=new JarallaxController,ControllerApple.prototype.activate=function(a){JarallaxController.prototype.activate.call(this,a),this.scrollSpace=$("body").height()-$(window).height(),this.target.bind("touchmove",{scope:this},this.onMove),this.target.bind("touchstart",{scope:this},this.onTouch)},ControllerApple.prototype.deactivate=function(a){JarallaxController.prototype.deactivate.call(this,a),this.target.unbind("touchmove"),this.target.unbind("touchstart")},ControllerApple.prototype.onTouch=function(a){var b=a.data.scope,c=a.originalEvent.touches.item(0);b.startPosition=new Position(c.clientX,c.clientY),a.preventDefault()},ControllerApple.prototype.onMove=function(a){var b=a.data.scope,c=a.originalEvent.touches.item(0),d=new Position(c.clientX,c.clientY),e=d.subract(b.startPosition);b.startPosition=d,b.scrollPostion=e.add(b.scrollPostion),b.scrollPostion.y=Math.max(Math.min(b.scrollPostion.y,0),-b.scrollSpace),b.jarallax.setProgress(-b.scrollPostion.y/b.scrollSpace,!1),$("body").scrollTop(b.scrollSpace*b.jarallax.progress),b.scrollPage||a.preventDefault()},ControllerApple.prototype.update=function(a){this.position.y=Math.round(a*this.scrollSpace)},ControllerDrag=function(a,b,c){this.object=$(a),this.start=b,this.end=c,this.container="",this.width=0,this.startX=0,this.startY=0},ControllerDrag.prototype=new JarallaxController,ControllerDrag.prototype.activate=function(a){JarallaxController.prototype.activate.call(this,a),this.container="#scrollbar",this.object.draggable({containment:this.container,axis:"x"}),this.object.bind("drag",{scope:this},this.onDrag),this.container=$(this.container),this.width=$(this.container).innerWidth()-this.object.outerWidth()},ControllerDrag.prototype.onDrag=function(a){var b=a.data.scope;if(b.isActive){var c=parseInt($(this).css("left"),10),d=c/a.data.scope.width;a.data.scope.jarallax.setProgress(d)}},ControllerDrag.prototype.deactivate=function(a){JarallaxController.prototype.deactivate.call(this,a),this.object.unbind("drag"),this.object.draggable("destroy")},ControllerDrag.prototype.update=function(a){this.object.css("left",a*this.width)},ControllerKeyboard=function(a,b,c){this.repetitiveInput=c,this.preventDefault=b||!1,this.keys=a||{38:-.01,40:.01},this.keysState={}},ControllerKeyboard.prototype=new JarallaxController,ControllerKeyboard.prototype.activate=function(a){JarallaxController.prototype.activate.call(this,a),$(document.documentElement).keydown({scope:this},this.keyDown),$(document.documentElement).keyup({scope:this},this.keyUp);for(var b in this.keys)this.keysState[b]=!1},ControllerKeyboard.prototype.deactivate=function(a){JarallaxController.prototype.deactivate.call(this,a)},ControllerKeyboard.prototype.keyDown=function(a){var b=a.data.scope;if(b.isActive)for(var c in b.keys)c==a.keyCode&&((b.keysState[c]!==!0||b.repetitiveInput)&&b.jarallax.setProgress(b.jarallax.progress+b.keys[c]),b.keysState[c]=!0,b.preventDefault&&a.preventDefault())},ControllerKeyboard.prototype.keyUp=function(a){if(this.isActive){var b=a.data.scope;for(var c in b.keys)c==a.keyCode&&(b.keysState[c]=!1)}},ControllerKeyboard.prototype.update=function(){},ControllerMobile=function(a,b){this.disableDefault=a||!1,this.y=0,this.previousY=void 0,this.height=b},ControllerMobile.prototype=new JarallaxController,ControllerMobile.prototype.activate=function(a){JarallaxController.prototype.activate.call(this,a),this.height||(this.height=this.height=parseInt($("body").css("height"),10),this.height==$(window).height&&(this.height=parseInt($("#wrapper").css("height"),10))),$("body").bind("touchmove",{scope:this},this.onTouchMove),$("body").bind("touchend",{scope:this},this.onTouchEnd)},ControllerMobile.prototype.onTouchEnd=function(){this.previousY=void 0},ControllerMobile.prototype.onTouchMove=function(a,b){if(this.isActive){this.disableDefault&&a.preventDefault();var c=a.data.scope,d=b?a:a.originalEvent.touches.item(0);void 0===c.previousY?c.previousY=d.clientY:(c.y+=d.clientY-c.previousY,c.y=c.y<c.height?c.y:c.height,c.y=c.y>0?c.y:0,c.previousY=d.clientY,c.y/c.height,c.jarallax.setProgress(c.y/c.height))}},ControllerMobile.prototype.deactivate=function(a){JarallaxController.prototype.deactivate.call(this,a),$("body").unbind("touchmove")},ControllerMobile.prototype.update=function(){},ControllerMousewheel=function(a,b){this.sensitivity=-a,this.preventDefault=b||!1},ControllerMousewheel.prototype=new JarallaxController,ControllerMousewheel.prototype.activate=function(a){JarallaxController.prototype.activate.call(this,a),$("body").bind("mousewheel",{scope:this},this.onScroll)},ControllerMousewheel.prototype.deactivate=function(a){$("body").unbind("mousewheel"),JarallaxController.prototype.deactivate(this,a)},ControllerMousewheel.prototype.onScroll=function(a,b){var c=a.data.scope;c.isActive&&(c.jarallax.setProgress(c.jarallax.progress+c.sensitivity*b),c.preventDefault&&a.preventDefault())},ControllerMousewheel.prototype.update=function(){},ControllerScroll=function(a,b,c){if(this.target=$(window),this.horizontal=b,this.convertScroll=c,$(window).scrollTop(0),$(window).scrollLeft(0),b){var d=parseInt($("body").css("width"),10);this.scrollSpace=d-this.target.width()}else{var e=parseInt($("body").css("height"),10);this.scrollSpace=e-this.target.height()}this.smoothing=a||!1,this.targetProgress=0},ControllerScroll.prototype=new JarallaxController,ControllerScroll.prototype.activate=function(a){JarallaxController.prototype.activate.call(this,a),this.convertScroll&&scrollConverter.activate(),this.target.bind("scroll",{scope:this},this.onScroll)},ControllerScroll.prototype.deactivate=function(a){JarallaxController.prototype.deactivate.call(this,a),this.convertScroll&&scrollConverter.deactivate(),this.target.unbind("scroll")},ControllerScroll.prototype.onScroll=function(a){var b=a.data.scope;if(b.jarallax.jumping&&(b.jarallax.jumpingAllowed||b.jarallax.clearSmooth(b.jarallax)),b.isActive){var c;if(b.horizontal){var d=a.data.x||b.target.scrollLeft();c=d/b.scrollSpace}else{var e=a.data.y||b.target.scrollTop();c=e/b.scrollSpace}b.smoothing?(b.targetProgress=Math.min(c,1),b.smooth()):b.jarallax.setProgress(c,!0)}},ControllerScroll.prototype.smooth=function(a){var b;b=a?a:this;var c=b.jarallax.progress,d=b.targetProgress-c;if(clearTimeout(b.timer),d>1e-4||-1e-4>d){var e=c+d/5;b.timer=window.setTimeout(function(){b.smooth(b)},b.jarallax.FPS_INTERVAL),b.jarallax.setProgress(e,!0)}else b.jarallax.setProgress(b.targetProgress,!0)},ControllerScroll.prototype.update=function(a){var b=parseInt(a*this.scrollSpace,10);this.jarallax.allowWeakProgress||(this.horizontal?$(window).scrollLeft(b):$(window).scrollTop(b))},ControllerTime=function(a,b,c){this.interval=b,this.speed=a,this.playForward=!0,this.type=c||ControllerTime.TYPES.NORMAL},ControllerTime.prototype=new JarallaxController,ControllerTime.prototype.activate=function(a){JarallaxController.prototype.activate.call(this,a),this.progress=0,this.timer=setInterval(this.onInterval.bind(this,{scope:this}),this.interval)},ControllerTime.prototype.deactivate=function(a){JarallaxController.prototype.deactivate.call(this,a),clearInterval(this.timer)},ControllerTime.prototype.onInterval=function(a){if(a.scope,this.isActive){if(this.playForward?this.progress+=this.speed:this.progress-=this.speed,this.progress>=1)switch(this.type){case ControllerTime.TYPES.NORMAL:this.progress=1,this.deactivate(this.jarallax);break;case ControllerTime.TYPES.LOOP:this.progress=0;break;case ControllerTime.TYPES.BOUNCE:this.progress=1-this.speed,this.playForward=!1}else this.progress<=0&&(this.progress=0+this.speed,this.playForward=!0);this.jarallax.setProgress(this.progress)}},ControllerTime.TYPES={NORMAL:0,LOOP:1,BOUNCE:2},ControllerTime.prototype.update=function(a){this.progress=a},function($){for(var supportedCSS,styles=document.getElementsByTagName("head")[0].style,toCheck="transformProperty WebkitTransform OTransform msTransform MozTransform".split(" "),a=0;a<toCheck.length;a++)void 0!==styles[toCheck[a]]&&(supportedCSS=toCheck[a]);var IE=eval('"v"==""');jQuery.fn.extend({rotate:function(a){if(0!==this.length&&"undefined"!=typeof a){"number"==typeof a&&(a={angle:a});for(var b=[],c=0,d=this.length;d>c;c++){var e=this.get(c);if(e.Wilq32&&e.Wilq32.PhotoEffect)e.Wilq32.PhotoEffect._handleRotation(a);else{var f=$.extend(!0,{},a),g=new Wilq32.PhotoEffect(e,f)._rootObj;b.push($(g))}}return b}},getRotateAngle:function(){for(var a=[],b=0,c=this.length;c>b;b++){var d=this.get(b);d.Wilq32&&d.Wilq32.PhotoEffect&&(a[b]=d.Wilq32.PhotoEffect._angle)}return a},stopRotate:function(){for(var a=0,b=this.length;b>a;a++){var c=this.get(a);c.Wilq32&&c.Wilq32.PhotoEffect&&clearTimeout(c.Wilq32.PhotoEffect._timer)}}}),Wilq32=window.Wilq32||{},Wilq32.PhotoEffect=function(){return supportedCSS?function(a,b){a.Wilq32={PhotoEffect:this},this._img=this._rootObj=this._eventObj=a,this._handleRotation(b)}:function(a,b){if(this._img=a,this._rootObj=document.createElement("span"),this._rootObj.style.display="inline-block",this._rootObj.Wilq32={PhotoEffect:this},a.parentNode.insertBefore(this._rootObj,a),a.complete)this._Loader(b);else{var c=this;jQuery(this._img).bind("load",function(){c._Loader(b)})}}}(),Wilq32.PhotoEffect.prototype={_setupParameters:function(a){this._parameters=this._parameters||{},"number"!=typeof this._angle&&(this._angle=0),"number"==typeof a.angle&&(this._angle=a.angle),this._parameters.animateTo="number"==typeof a.animateTo?a.animateTo:this._angle,this._parameters.step=a.step||this._parameters.step||null,this._parameters.easing=a.easing||this._parameters.easing||function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},this._parameters.duration=a.duration||this._parameters.duration||1e3,this._parameters.callback=a.callback||this._parameters.callback||function(){},a.bind&&a.bind!=this._parameters.bind&&this._BindEvents(a.bind)},_handleRotation:function(a){this._setupParameters(a),this._angle==this._parameters.animateTo?this._rotate(this._angle):this._animateStart()},_BindEvents:function(a){if(a&&this._eventObj){if(this._parameters.bind){var b=this._parameters.bind;for(var c in b)b.hasOwnProperty(c)&&jQuery(this._eventObj).unbind(c,b[c])}this._parameters.bind=a;for(var c in a)a.hasOwnProperty(c)&&jQuery(this._eventObj).bind(c,a[c])}},_Loader:function(){return IE?function(a){var b=this._img.width,c=this._img.height;this._img.parentNode.removeChild(this._img),this._vimage=this.createVMLNode("image"),this._vimage.src=this._img.src,this._vimage.style.height=c+"px",this._vimage.style.width=b+"px",this._vimage.style.position="absolute",this._vimage.style.top="0px",this._vimage.style.left="0px",this._container=this.createVMLNode("group"),this._container.style.width=b,this._container.style.height=c,this._container.style.position="absolute",this._container.setAttribute("coordsize",b-1+","+(c-1)),this._container.appendChild(this._vimage),this._rootObj.appendChild(this._container),this._rootObj.style.position="relative",this._rootObj.style.width=b+"px",this._rootObj.style.height=c+"px",this._rootObj.setAttribute("id",this._img.getAttribute("id")),this._rootObj.className=this._img.className,this._eventObj=this._rootObj,this._handleRotation(a)}:function(a){this._rootObj.setAttribute("id",this._img.getAttribute("id")),this._rootObj.className=this._img.className,this._width=this._img.width,this._height=this._img.height,this._widthHalf=this._width/2,this._heightHalf=this._height/2;var b=Math.sqrt(this._height*this._height+this._width*this._width);this._widthAdd=b-this._width,this._heightAdd=b-this._height,this._widthAddHalf=this._widthAdd/2,this._heightAddHalf=this._heightAdd/2,this._img.parentNode.removeChild(this._img),this._aspectW=(parseInt(this._img.style.width,10)||this._width)/this._img.width,this._aspectH=(parseInt(this._img.style.height,10)||this._height)/this._img.height,this._canvas=document.createElement("canvas"),this._canvas.setAttribute("width",this._width),this._canvas.style.position="relative",this._canvas.style.left=-this._widthAddHalf+"px",this._canvas.style.top=-this._heightAddHalf+"px",this._canvas.Wilq32=this._rootObj.Wilq32,this._rootObj.appendChild(this._canvas),this._rootObj.style.width=this._width+"px",this._rootObj.style.height=this._height+"px",this._eventObj=this._canvas,this._cnv=this._canvas.getContext("2d"),this._handleRotation(a)}}(),_animateStart:function(){this._timer&&clearTimeout(this._timer),this._animateStartTime=+new Date,this._animateStartAngle=this._angle,this._animate()},_animate:function(){var a=+new Date,b=a-this._animateStartTime>this._parameters.duration;if(b&&!this._parameters.animatedGif)clearTimeout(this._timer);else{if(this._canvas||this._vimage||this._img){var c=this._parameters.easing(0,a-this._animateStartTime,this._animateStartAngle,this._parameters.animateTo-this._animateStartAngle,this._parameters.duration);this._rotate(~~(10*c)/10)}this._parameters.step&&this._parameters.step(this._angle);var d=this;this._timer=setTimeout(function(){d._animate.call(d)},10)}this._parameters.callback&&b&&(this._angle=this._parameters.animateTo,this._rotate(this._angle),this._parameters.callback.call(this._rootObj))},_rotate:function(){var a=Math.PI/180;return IE?function(a){this._angle=a,this._container.style.rotation=a%360+"deg"}:supportedCSS?function(a){this._angle=a,this._img.style[supportedCSS]="rotate("+a%360+"deg)"}:function(b){this._angle=b,b=b%360*a,this._canvas.width=this._width+this._widthAdd,this._canvas.height=this._height+this._heightAdd,this._cnv.translate(this._widthAddHalf,this._heightAddHalf),this._cnv.translate(this._widthHalf,this._heightHalf),this._cnv.rotate(b),this._cnv.translate(-this._widthHalf,-this._heightHalf),this._cnv.scale(this._aspectW,this._aspectH),this._cnv.drawImage(this._img,0,0)}}()},IE&&(Wilq32.PhotoEffect.prototype.createVMLNode=function(){document.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{return!document.namespaces.rvml&&document.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),function(a){return document.createElement("<rvml:"+a+' class="rvml">')}}catch(a){return function(a){return document.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}}())}(jQuery),window.scrollConverter=function(a,b){var c=b.documentElement,d=!1,e=!1,f=!1,g=function(e,f,g){if(d){var h,i,j,k,l,m,n,o;h=0,i=10,l=(c?c.offsetWidth:0)||0,m=b.body.scrollWidth||0,n=c?c.clientWidth:0,o=Math.max(l,m)-n,f.detail?h=-240*f.detail:f.wheelDelta&&(h=5*f.wheelDelta),j=h/120*i,k=e.x-j,k>=0&&o>=k?(e.x=k,e.setByScript=!0,a.scrollTo(e.x,e.y)):0!==e.x&&e.x!==o&&(e.x=k>o?o:0,e.setByScript=!0,a.scrollTo(e.x,e.y)),"function"==typeof g&&g(e)}},h=function(c){c=c.toUpperCase();var d="page"+c+"Offset",e="scroll"+c,f="scroll"+("X"===c?"Left":"Top");return a[d]||a[e]||function(){var a=b.documentElement||b.body.parentNode;return("number"==typeof a[f]?a:b.body)[f]}()},i=function(c,d){var e=function(b){return b=b||a.event,g(c,b,d),b.preventDefault&&b.stopPropagation?(b.preventDefault(),b.stopPropagation(),void 0):!1},f=function(){c.setByScript||(c.x=h("x"),c.y=h("y")),c.setByScript=!1};a.addEventListener?"onmousewheel"in a?(a.addEventListener("mousewheel",e,!1),a.addEventListener("scroll",f,!1)):(a.addEventListener("DOMMouseScroll",e,!1),a.addEventListener("scroll",f,!1)):(b.attachEvent("onmousewheel",e),a.attachEvent("onscroll",f))},j=function(a){return a.preventDefault(),a.stopPropagation(),!1};return{activate:function(b){if(d=!0,!f){var c={x:0,y:0};i(c,b),f=!0}e&&(a.addEventListener?a.removeEventListener("scroll",j,!0):a.detachEvent("onscroll",j),e=!1)},deactivate:function(){d=!1},deactivateAllScrolling:function(){d=!1,e=!0,a.addEventListener?a.addEventListener("scroll",j,!0):a.attachEvent("onscroll",j)}}}(window,document);