1(function($){Drupal.toggleFieldset=function(fieldset){var $fieldset=$(fieldset);if($fieldset.is(".collapsed")){var $content=$("> .fieldset-wrapper",fieldset).hide();$fieldset.removeClass("collapsed").trigger({type:"collapsed",value:false}).find("> legend span.fieldset-legend-prefix").html(Drupal.t("Hide"));$content.slideDown({duration:"fast",easing:"linear",complete:function(){Drupal.collapseScrollIntoView(fieldset);fieldset.animating=false},step:function(){Drupal.collapseScrollIntoView(fieldset)}})}else{$fieldset.trigger({type:"collapsed", 2value:true});$("> .fieldset-wrapper",fieldset).slideUp("fast",function(){$fieldset.addClass("collapsed").find("> legend span.fieldset-legend-prefix").html(Drupal.t("Show"));fieldset.animating=false})}};Drupal.collapseScrollIntoView=function(node){var h=document.documentElement.clientHeight||document.body.clientHeight||0;var offset=document.documentElement.scrollTop||document.body.scrollTop||0;var posY=$(node).offset().top;var fudge=55;if(posY+node.offsetHeight+fudge>h+offset)if(node.offsetHeight> 3h)window.scrollTo(0,posY);else window.scrollTo(0,posY+node.offsetHeight-h+fudge)};Drupal.behaviors.collapse={attach:function(context,settings){$("fieldset.collapsible",context).once("collapse",function(){var $fieldset=$(this);var anchor=location.hash&&location.hash!="#"?", "+location.hash:"";if($fieldset.find(".error"+anchor).length)$fieldset.removeClass("collapsed");var summary=$('<span class="summary"></span>');$fieldset.bind("summaryUpdated",function(){var text=$.trim($fieldset.drupalGetSummary()); 4summary.html(text?" ("+text+")":"")}).trigger("summaryUpdated");var $legend=$("> legend .fieldset-legend",this);$('<span class="fieldset-legend-prefix element-invisible"></span>').append($fieldset.hasClass("collapsed")?Drupal.t("Show"):Drupal.t("Hide")).prependTo($legend).after(" ");var $link=$('<a class="fieldset-title" href="#"></a>').prepend($legend.contents()).appendTo($legend).click(function(){var fieldset=$fieldset.get(0);if(!fieldset.animating){fieldset.animating=true;Drupal.toggleFieldset(fieldset)}return false}); 5$legend.append(summary)})}}})(jQuery); 6;/*})'"*/;/*})'"*/ 7/* 8 Stellar.js v0.6.2 | Copyright 2013, Mark Dalgleish | http://markdalgleish.com/projects/stellar.js | http://markdalgleish.mit-license.org */ 9(function(e,t,n,r){function d(t,n){this.element=t,this.options=e.extend({},s,n),this._defaults=s,this._name=i,this.init()}var i="stellar",s={scrollProperty:"scroll",positionProperty:"position",horizontalScrolling:!0,verticalScrolling:!0,horizontalOffset:0,verticalOffset:0,responsive:!1,parallaxBackgrounds:!0,parallaxElements:!0,hideDistantElements:!0,hideElement:function(e){e.hide()},showElement:function(e){e.show()}},o={scroll:{getLeft:function(e){return e.scrollLeft()},setLeft:function(e,t){e.scrollLeft(t)}, 10getTop:function(e){return e.scrollTop()},setTop:function(e,t){e.scrollTop(t)}},position:{getLeft:function(e){return parseInt(e.css("left"),10)*-1},getTop:function(e){return parseInt(e.css("top"),10)*-1}},margin:{getLeft:function(e){return parseInt(e.css("margin-left"),10)*-1},getTop:function(e){return parseInt(e.css("margin-top"),10)*-1}},transform:{getLeft:function(e){var t=getComputedStyle(e[0])[f];return t!=="none"?parseInt(t.match(/(-?[0-9]+)/g)[4],10)*-1:0},getTop:function(e){var t=getComputedStyle(e[0])[f]; 11return t!=="none"?parseInt(t.match(/(-?[0-9]+)/g)[5],10)*-1:0}}},u={position:{setLeft:function(e,t){e.css("left",t)},setTop:function(e,t){e.css("top",t)}},transform:{setPosition:function(e,t,n,r,i){e[0].style[f]="translate3d("+(t-n)+"px, "+(r-i)+"px, 0)"}}},a=function(){var t=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=e("script")[0].style,r="",i;for(i in n)if(t.test(i)){r=i.match(t)[0];break}return"WebkitOpacity"in n&&(r="Webkit"),"KhtmlOpacity"in n&&(r="Khtml"),function(e){return r+(r.length>0?e.charAt(0).toUpperCase()+ 12e.slice(1):e)}}(),f=a("transform"),l=e("<div />",{style:"background:#fff"}).css("background-position-x")!==r,c=l?function(e,t,n){e.css({"background-position-x":t,"background-position-y":n})}:function(e,t,n){e.css("background-position",t+" "+n)},h=l?function(e){return[e.css("background-position-x"),e.css("background-position-y")]}:function(e){return e.css("background-position").split(" ")},p=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame|| 13t.msRequestAnimationFrame||function(e){setTimeout(e,1E3/60)};d.prototype={init:function(){this.options.name=i+"_"+Math.floor(Math.random()*1E9),this._defineElements(),this._defineGetters(),this._defineSetters(),this._handleWindowLoadAnd
13Resize(),this._detectViewport(),this.refresh({firstLoad:!0}),this.options.scrollProperty==="scroll"?this._handleScrollEvent():this._startAnimationLoop()},_defineElements:function(){this.element===n.body&&(this.element=t),this.$scrollElement=e(this.element),this.$element= 14this.element===t?e("body"):this.$scrollElement,this.$viewportElement=this.options.viewportElement!==r?e(this.options.viewportElement):this.$scrollElement[0]===t||this.options.scrollProperty==="scroll"?this.$scrollElement:this.$scrollElement.parent()},_defineGetters:function(){var e=this,t=o[e.options.scrollProperty];this._getScrollLeft=function(){return t.getLeft(e.$scrollElement)},this._getScrollTop=function(){return t.getTop(e.$scrollElement)}},_defineSetters:function(){var t=this,n=o[t.options.scrollProperty], 15r=u[t.options.positionProperty],i=n.setLeft,s=n.setTop;this._setScrollLeft=typeof i=="function"?function(e){i(t.$scrollElement,e)}:e.noop,this._setScrollTop=typeof s=="function"?function(e){s(t.$scrollElement,e)}:e.noop,this._setPosition=r.setPosition||function(e,n,i,s,o){t.options.horizontalScrolling&&r.setLeft(e,n,i),t.options.verticalScrolling&&r.setTop(e,s,o)}},_handleWindowLoadAndResize:function(){var n=this,r=e(t);n.options.responsive&&r.bind("load."+this.name,function(){n.refresh()}),r.bind("resize."+ 16this.name,function(){n._detectViewport(),n.options.responsive&&n.refresh()})},refresh:function(n){var r=this,i=r._getScrollLeft(),s=r._getScrollTop();(!n||!n.firstLoad)&&this._reset(),this._setScrollLeft(0),this._setScrollTop(0),this._setOffsets(),this._findParticles(),this._findBackgrounds(),n&&n.firstLoad&&/WebKit/.test(navigator.userAgent)&&e(t).load(function(){var e=r._getScrollLeft(),t=r._getScrollTop();r._setScrollLeft(e+1),r._setScrollTop(t+1),r._setScrollLeft(e),r._setScrollTop(t)}),this._setScrollLeft(i), 17this._setScrollTop(s)},_detectViewport:function(){var e=this.$viewportElement.offset(),t=e!==null&&e!==r;this.viewportWidth=this.$viewportElement.width(),this.viewportHeight=this.$viewportElement.height(),this.viewportOffsetTop=t?e.top:0,this.viewportOffsetLeft=t?e.left:0},_findParticles:function(){var t=this,n=this._getScrollLeft(),i=this._getScrollTop();if(this.particles!==r)for(var s=this.particles.length-1;s>=0;s--)this.particles[s].$element.data("stellar-elementIsActive",r);this.particles=[]; 18if(!this.options.parallaxElements)return;this.$element.find("[data-stellar-ratio]").each(function(n){var i=e(this),s,o,u,a,f,l,c,h,p,d=0,v=0,m=0,g=0;if(!i.data("stellar-elementIsActive"))i.data("stellar-elementIsActive",this);else if(i.data("stellar-elementIsActive")!==this)return;t.options.showElement(i),i.data("stellar-startingLeft")?(i.css("left",i.data("stellar-startingLeft")),i.css("top",i.data("stellar-startingTop"))):(i.data("stellar-startingLeft",i.css("left")),i.data("stellar-startingTop", 19i.css("top"))),u=i.position().left,a=i.position().top,f=i.css("margin-left")==="auto"?0:parseInt(i.css("margin-left"),10),l=i.css("margin-top")==="auto"?0:parseInt(i.css("margin-top"),10),h=i.offset().left-f,p=i.offset().top-l,i.parents().each(function(){var t=e(this);if(t.data("stellar-offset-parent")===!0)return d=m,v=g,c=t,!1;m+=t.position().left,g+=t.position().top}),s=i.data("stellar-horizontal-offset")!==r?i.data("stellar-horizontal-offset"):c!==r&&c.data("stellar-horizontal-offset")!==r?c.data("stellar-horizontal-offset"): 20t.horizontalOffset,o=i.data("stellar-vertical-offset")!==r?i.data("stellar-vertical-offset"):c!==r&&c.data("stellar-vertical-offset")!==r?c.data("stellar-vertical-offset"):t.verticalOffset,t.particles.push({$element:i,$offsetParent:c,isFixed:i.css("position")==="fixed",horizontalOffset:s,verticalOffset:o,startingPositionLeft:u,startingPositionTop:a,startingOffsetLeft:h,startingOffsetTop:p,parentOffsetLeft:d,parentOffsetTop:v,stellarRatio:i.data("stellar-ratio")!==r?i.data("stellar-ratio"):1,width:i.outerWidth(!0), 21height:i.outerHeight(!0),isHidden:!1})})},_findBackgrounds:function(){var t=this,n=this._getScrollLeft(),i=this._getScrollTop(),s;this.backgrounds=[];if(!this.options.parallaxBackgrounds)return;s=this.$element.find("[data-stellar-background-ratio]"),this.$element.data("stellar-background-ratio")&&(s=s.add(this.$element)),s.each(function(){var s=e(this),o=h(s),u,a,f,l,p,d,v,m,g,y=0,b=0,w=0,E=0;if(!s.data("stellar-backgroundIsActive"))s.data("stellar-backgroundIsActive",this);else if(s.data("stellar-backgroundIsActive")!== 22this)return;s.data("stellar-backgroundStartingLeft")?c(s,s.data("stellar-backgroundStartingLeft"),s.data("stellar-backgroundStartingTop")):(s.data("stellar-backgroundStartingLeft",o[0]),s.data("stellar-backgroundStartingTop",o[1])),p=s.css("margin-left")==="auto"?0:parseInt(s.css("margin-left"),10),d=s.css("margin-top")==="auto"?0:parseInt(s.css("margin-top"),10),v=s.offset().left-p-n,m=s.offset().top-d-i,s.parents().each(function(){var t=e(this);if(t.data("stellar-offset-parent")===!0)return y=w, 23b=E,g=t,!1;w+=t.position().left,E+=t.position().top}),u=s.data("stellar-horizontal-offset")!==r?s.data("stellar-horizontal-offset"):g!==r&&g.data("stellar-horizontal-offset")!==r?g.data("stellar-horizontal-offset"):t.horizontalOffset,a=s.data("stellar-vertical-offset")!==r?s.data("stellar-vertical-offset"):g!==r&&g.data("stellar-vertical-offset")!==r?g.data("stellar-vertical-offset"):t.verticalOffset,t.backgrounds.push({$element:s,$offsetParent:g,isFixed:s.css("background-attachment")==="fixed",horizontalOffset:u, 24verticalOffset:a,startingValueLeft:o[0],startingValueTop:o[1],startingBackgroun
24dPositionLeft:isNaN(parseInt(o[0],10))?0:parseInt(o[0],10),startingBackgroundPositionTop:isNaN(parseInt(o[1],10))?0:parseInt(o[1],10),startingPositionLeft:s.position().left,startingPositionTop:s.position().top,startingOffsetLeft:v,startingOffsetTop:m,parentOffsetLeft:y,parentOffsetTop:b,stellarRatio:s.data("stellar-background-ratio")===r?1:s.data("stellar-background-ratio")})})},_reset:function(){var e,t,n,r,i;for(i=this.particles.length- 251;i>=0;i--)e=this.particles[i],t=e.$element.data("stellar-startingLeft"),n=e.$element.data("stellar-startingTop"),this._setPosition(e.$element,t,t,n,n),this.options.showElement(e.$element),e.$element.data("stellar-startingLeft",null).data("stellar-elementIsActive",null).data("stellar-backgroundIsActive",null);for(i=this.backgrounds.length-1;i>=0;i--)r=this.backgrounds[i],r.$element.data("stellar-backgroundStartingLeft",null).data("stellar-backgroundStartingTop",null),c(r.$element,r.startingValueLeft, 26r.startingValueTop)},destroy:function(){this._reset(),this.$scrollElement.unbind("resize."+this.name).unbind("scroll."+this.name),this._animationLoop=e.noop,e(t).unbind("load."+this.name).unbind("resize."+this.name)},_setOffsets:function(){var n=this,r=e(t);r.unbind("resize.horizontal-"+this.name).unbind("resize.vertical-"+this.name),typeof this.options.horizontalOffset=="function"?(this.horizontalOffset=this.options.horizontalOffset(),r.bind("resize.horizontal-"+this.name,function(){n.horizontalOffset= 27n.options.horizontalOffset()})):this.horizontalOffset=this.options.horizontalOffset,typeof this.options.verticalOffset=="function"?(this.verticalOffset=this.options.verticalOffset(),r.bind("resize.vertical-"+this.name,function(){n.verticalOffset=n.options.verticalOffset()})):this.verticalOffset=this.options.verticalOffset},_repositionElements:function(){var e=this._getScrollLeft(),t=this._getScrollTop(),n,r,i,s,o,u,a,f=!0,l=!0,h,p,d,v,m;if(this.currentScrollLeft===e&&this.currentScrollTop===t&&this.currentWidth=== 28this.viewportWidth&&this.currentHeight===this.viewportHeight)return;this.currentScrollLeft=e,this.currentScrollTop=t,this.currentWidth=this.viewportWidth,this.currentHeight=this.viewportHeight;for(m=this.particles.length-1;m>=0;m--)i=this.particles[m],s=i.isFixed?1:0,this.options.horizontalScrolling?(h=(e+i.horizontalOffset+this.viewportOffsetLeft+i.startingPositionLeft-i.startingOffsetLeft+i.parentOffsetLeft)*-(i.stellarRatio+s-1)+i.startingPositionLeft,d=h-i.startingPositionLeft+i.startingOffsetLeft): 29(h=i.startingPositionLeft,d=i.startingOffsetLeft),this.options.verticalScrolling?(p=(t+i.verticalOffset+this.viewportOffsetTop+i.startingPositionTop-i.startingOffsetTop+i.parentOffsetTop)*-(i.stellarRatio+s-1)+i.startingPositionTop,v=p-i.startingPositionTop+i.startingOffsetTop):(p=i.startingPositionTop,v=i.startingOffsetTop),this.options.hideDistantElements&&(l=!this.options.horizontalScrolling||d+i.width>(i.isFixed?0:e)&&d<(i.isFixed?0:e)+this.viewportWidth+this.viewportOffsetLeft,f=!this.options.verticalScrolling|| 30v+i.height>(i.isFixed?0:t)&&v<(i.isFixed?0:t)+this.viewportHeight+this.viewportOffsetTop),l&&f?(i.isHidden&&(this.options.showElement(i.$element),i.isHidden=!1),this._setPosition(i.$element,h,i.startingPositionLeft,p,i.startingPositionTop)):i.isHidden||(this.options.hideElement(i.$element),i.isHidden=!0);for(m=this.backgrounds.length-1;m>=0;m--)o=this.backgrounds[m],s=o.isFixed?0:1,u=this.options.horizontalScrolling?(e+o.horizontalOffset-this.viewportOffsetLeft-o.startingOffsetLeft+o.parentOffsetLeft-
31o.startingBackgroundPositionLeft)*(s-o.stellarRatio)+"px":o.startingValueLeft,a=this.options.verticalScrolling?(t+o.verticalOffset-this.viewportOffsetTop-o.startingOffsetTop+o.parentOffsetTop-o.startingBackgroundPositionTop)*(s-o.stellarRatio)+"px":o.startingValueTop,c(o.$element,u,a)},_handleScrollEvent:function(){var e=this,t=!1,n=function(){e._repositionElements(),t=!1},r=function(){t||(p(n),t=!0)};this.$scrollElement.bind("scroll."+this.name,r),r()},_startAnimationLoop:function(){var e=this;this._animationLoop= 32function(){p(e._animationLoop),e._repositionElements()},this._animationLoop()}},e.fn[i]=function(t){var n=arguments;if(t===r||typeof t=="object")return this.each(function(){e.data(this,"plugin_"+i)||e.data(this,"plugin_"+i,new d(this,t))});if(typeof t=="string"&&t[0]!=="_"&&t!=="init")return this.each(function(){var r=e.data(this,"plugin_"+i);r instanceof d&&typeof r[t]=="function"&&r[t].apply(r,Array.prototype.slice.call(n,1)),t==="destroy"&&e.data(this,"plugin_"+i,null)})},e[i]=function(n){var r= 33e(t);return r.stellar.apply(r,Array.prototype.slice.call(arguments,0))},e[i].scrollProperty=o,e[i].positionProperty=u,t.Stellar=d})(jQuery,this,document); 34;/*})'"*/;/*})'"*/ 35jQuery(document).ready(function($){var ua=navigator.userAgent,isMobileWebkit=/WebKit/.test(ua)&&/Mobile/.test(ua);if(!isMobileWebkit)$(window).stellar({responsive:true,scrollProperty:"scroll",parallaxElements:false,horizontalScrolling:false,horizontalOffset:0,verticalOffset:0})}); 36;/*})'"*/;/*})'"*/ 37var ytp=ytp||{};function onYouTubePlayerAPIReady(){if(ytp.YTAPIReady)return;ytp.YTAPIReady=true;jQuery(document).trigger("YTAPIReady")} 38(function(jQuery,ytp){var nAgt=navigator.userAgent;if(!jQuery.browser){jQuery.browser={};jQuery.browser.mozilla=!1;jQuery.browser.webkit=!1;jQuery.browser.opera=!1;jQuery.browser.safari=!1;jQuery.browser.chrome=!1;jQuery.browser.msie=!1;jQuery.browser.ua=nAgt;jQuery.browser.name=navigator.appName;jQuery.browser.fullVersion=""+parseFloat(navigator.appVersion);jQuery.browser.majorVersion=parseInt(navigator.appVersion,10);var nameOffset,verOffset,ix;if(-1!=(verOffset=nAgt.indexOf("Opera")))jQuery.browser.opera= 39!0,jQuery.browser.name="Opera",jQuery.browser.fullVersion=nAgt.substring(verOffset+6),-1!=(verOffset=nAgt.indexOf("Version"))&&(jQuery.browser.fullVersion=nAgt.substring(verOffset+8));else if(-1!=(verOffset=nAgt.indexOf("MSIE")))jQuery.browser.msie=!0,jQuery.browser.name="Microsoft Internet Explorer",jQuery.browser.fullVersion=nAgt.substring(verOffset+5);else if(-1!=nAgt.indexOf("Trident")){jQuery.browser.msie=!0;jQuery.browser.name="Microsoft Internet Explorer";var start=nAgt.indexOf("rv:")+3,end= 40start+4;jQuery.browser.fullVersion=nAgt.substring(start,end)}else-1!=(verOffset=nAgt.indexOf("Chrome"))?(jQuery.browser.webkit=!0,jQuery.browser.chrome=!0,jQuery.browser.name="Chrome",jQuery.browser.fullVersion=nAgt.substring(verOffset+7)):-1!=(verOffset=nAgt.indexOf("Safari"))?(jQuery.browser.webkit=!0,jQuery.browser.safari=!0,jQuery.browser.name="Safari",jQuery.browser.fullVersion=nAgt.substring(verOffset+7),-1!=(verOffset=nAgt.indexOf("Version"))&&(jQuery.browser.fullVersion=nAgt.substring(verOffset+ 418))):-1!=(verOffset=nAgt.indexOf("AppleWebkit"))?(jQuery.browser.webkit=!0,jQuery.browser.name="Safari",jQuery.browser.fullVersion=nAgt.substring(verOffset+7),-1!=(verOffset=nAgt.indexOf("Version"))&&(jQuery.browser.fullVersion=nAgt.substring(verOffset+8))):-1!=(verOffset=nAgt.indexOf("Firefox"))?(jQuery.browser.mozilla=!0,jQuery.browser.name="Firefox",jQuery.browser.fullVersion=nAgt.substring(verOffset+8)):(nameOffset=nAgt.lastIndexOf(" ")+1)<(verOffset=nAgt.lastIndexOf("/"))&&(jQuery.browser.name= 42nAgt.substring(nameOffset,verOffset),jQuery.browser.fullVersion=nAgt.substring(verOffset+1),jQuery.browser.name.toLowerCase()==jQuery.browser.name.toUpperCase()&&(jQuery.browser.name=navigator.appName));-1!=(ix=jQuery.browser.fullVersion.indexOf(";"))&&(jQuery.browser.fullVersion=jQuery.browser.fullVersion.substring(0,ix));-1!=(ix=jQuery.browser.fullVersion.indexOf(" "))&&(jQuery.browser.fullVersion=jQuery.browser.fullVersion.substring(0,ix));jQuery.browser.majorVersion=parseInt(""+jQuery.browser.fullVersion, 4310);isNaN(jQuery.browser.majorVersion)&&(jQuery.browser.fullVersion=""+parseFloat(navigator.appVersion),jQuery.browser.majorVersion=parseInt(navigator.appVersion,10));jQuery.browser.version=jQuery.browser.majorVersion}jQuery.browser.android=/Android/i.test(nAgt);jQuery.browser.blackberry=/BlackBerry/i.test(nAgt);jQuery.browser.ios=/iPhone|iPad|iPod/i.test(nAgt);jQuery.browser.operaMobile=/Opera Mini/i.test(nAgt);jQuery.browser.windowsMobile=/IEMobile/i.test(nAgt);jQuery.browser.mobile=jQuery.browser.android|| 44jQuery.browser.blackberry||jQuery.browser.ios||jQuery.browser.windowsMobile||jQuery.browser.operaMobile;ytp.isDevice=jQuery.browser.mobile;jQuery.fn.CSSAnimate=function(a,g,p,m,h){function r(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function f(a,f){return"string"!==typeof a||a.match(/^[\-0-9\.]+$/)?""+a+f:a}jQuery.support.CSStransition=function(){var a=(document.body||document.documentElement).style;return void 0!==a.transition||void 0!==a.WebkitTransition||void 0!==a.MozTransition|| 45void 0!==a.MsTransition||void 0!==a.OTransition}();return this.each(function(){var e=this,k=jQuery(this);e.id=e.id||"CSSA_"+(new Date).getTime();var l=l||{type:"noEvent"};if(e.CSSAIsRunning&&e.eventType==l.type)e.CSSqueue=function(){k.CSSAnimate(a,g,p,m,h)};else if(e.CSSqueue=null,e.eventType=l.type,0!==k.length&&a){e.CSSAIsRunning=!0;"function"==typeof g&&(h=g,g=jQuery.fx.speeds._default);"function"==typeof p&&(h=p,p=0);"function"==typeof m&&(h=m,m="cubic-bezier(0.65,0.03,0.36,0.72)");if("string"== 46typeof g)for(var b in jQuery.fx.speeds)if(g==b){g=jQuery.fx.speeds[b];break}else g=jQuery.fx.speeds._default;g||(g=jQuery.fx.speeds._default);if(jQuery.support.CSStransition){l={"default":"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)", 47easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1
47)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)", 48easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};l[m]&&(m=l[m]);var d="",q="transitionEnd";jQuery.browser.webkit?(d="-webkit-",q="webkitTransitionEnd"):jQuery.browser.mozilla?(d="-moz-",q="transitionend"):jQuery.browser.opera?(d="-o-",q="otransitionend"):jQuery.browser.msie&& 49(d="-ms-",q="msTransitionEnd");l=[];for(c in a){b=c;"transform"===b&&(b=d+"transform",a[b]=a[c],delete a[c]);"filter"===b&&(b=d+"filter",a[b]=a[c],delete a[c]);if("transform-origin"===b||"origin"===b)b=d+"transform-origin",a[b]=a[c],delete a[c];"x"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" translateX("+f(a[c],"px")+")",delete a[c]);"y"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" translateY("+f(a[c],"px")+")",delete a[c]);"z"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" translateZ("+f(a[c],"px")+ 50")",delete a[c]);"rotate"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" rotate("+f(a[c],"deg")+")",delete a[c]);"rotateX"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" rotateX("+f(a[c],"deg")+")",delete a[c]);"rotateY"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" rotateY("+f(a[c],"deg")+")",delete a[c]);"rotateZ"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" rotateZ("+f(a[c],"deg")+")",delete a[c]);"scale"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" scale("+f(a[c],"")+")",delete a[c]);"scaleX"===b&&(b=d+ 51"transform",a[b]=a[b]||"",a[b]+=" scaleX("+f(a[c],"")+")",delete a[c]);"scaleY"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" scaleY("+f(a[c],"")+")",delete a[c]);"scaleZ"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" scaleZ("+f(a[c],"")+")",delete a[c]);"skew"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" skew("+f(a[c],"deg")+")",delete a[c]);"skewX"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" skewX("+f(a[c],"deg")+")",delete a[c]);"skewY"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" skewY("+f(a[c],"deg")+ 52")",delete a[c]);"perspective"===b&&(b=d+"transform",a[b]=a[b]||"",a[b]+=" perspective("+f(a[c],"px")+")",delete a[c]);0>l.indexOf(b)&&l.push(r(b))}var c=l.join(","),s=function(){k.off(q+"."+e.id);clearTimeout(e.timeout);k.css(d+"transition","");"function"==typeof h&&h(k);e.called=!0;e.CSSAIsRunning=!1;"function"==typeof e.CSSqueue&&(e.CSSqueue(),e.CSSqueue=null)},n={};jQuery.extend(n,a);n[d+"transition-property"]=c;n[d+"transition-duration"]=g+"ms";n[d+"transition-delay"]=p+"ms";n[d+"transition-style"]= 53"preserve-3d";n[d+"transition-timing-function"]=m;setTimeout(function(){k.one(q+"."+e.id,s);k.css(n)},1);e.timeout=setTimeout(function(){k.called||!h?(k.called=!1,e.CSSAIsRunning=!1):(k.css(d+"transition",""),h(k),e.CSSAIsRunning=!1,"function"==typeof e.CSSqueue&&(e.CSSqueue(),e.CSSqueue=null))},g+p+100)}else{for(var c in a)"transform"===c&&delete a[c],"filter"===c&&delete a[c],"transform-origin"===c&&delete a[c],"auto"===a[c]&&delete a[c];h&&"string"!==typeof h||(h="linear");k.animate(a,g,h)}}})}; 54var getYTPVideoID=function(url){var movieURL;if(url.substr(0,16)=="http://youtu.be/")movieURL=url.replace("http://youtu.be/","");else if(url.indexOf("http")>-1)movieURL=url.match(/[\\?&]v=([^&#]*)/)[1];else movieURL=url;return movieURL};jQuery.mbYTPlayer={name:"jquery.mb.YTPlayer",version:"2.7.1",author:"Matteo Bicocchi",defaults:{containment:"body",ratio:"16/9",videoURL:null,startAt:0,stopAt:0,autoPlay:true,vol:100,addRaster:false,opacity:1,quality:"default",mute:false,loop:true,showControls:true, 55showAnnotations:false,showYTLogo:true,stopMovieOnClick:false,realfullscreen:true,gaTrack:true,onReady:function(player){},onStateChange:function(player){},onPlaybackQualityChange:function(player){},onError:function(player){}},controls:{play:"P",pause:"p",mute:"M",unmute:"A",onlyYT:"O",showSite:"R",ytLogo:"Y"},rasterImg:"images/raster.png",rasterImgRetina:"images/[email protected]",locationProtocol:"https:",buildPlayer:function(options){return this.each(function(){var YTPlayer=this;var $YTPlayer=jQuery(YTPlayer); 56YTPlayer.loop=0;YTPlayer.opt={};$YTPlayer.addClass("mb_YTVPlayer");var property=$YTPlayer.data("property")&&typeof $YTPlayer.data("property")=="str
56ing"?eval("("+$YTPlayer.data("property")+")"):$YTPlayer.data("property");if(typeof property.vol!="undefined")property.vol=property.vol==0?property.vol=1:property.vol;jQuery.extend(YTPlayer.opt,jQuery.mbYTPlayer.defaults,options,property);var canGoFullscreen=!(jQuery.browser.msie||jQuery.browser.opera);if(!canGoFullscreen)YTPlayer.opt.realfullscreen=false; 57if(!$YTPlayer.attr("id"))$YTPlayer.attr("id","YTP_"+(new Date).getTime());YTPlayer.opt.id=YTPlayer.id;YTPlayer.isAlone=false;var playerID="mbYTP_"+YTPlayer.id;var videoID=this.opt.videoURL?getYTPVideoID(this.opt.videoURL):$YTPlayer.attr("href")?getYTPVideoID($YTPlayer.attr("href")):false;YTPlayer.videoID=videoID;YTPlayer.opt.showAnnotations=YTPlayer.opt.showAnnotations?"0":"3";var playerVars={"autoplay":0,"modestbranding":1,"controls":0,"showinfo":0,"rel":0,"enablejsapi":1,"version":3,"playerapiid":playerID, 58"origin":"*","allowfullscreen":true,"wmode":"transparent","iv_load_policy":YTPlayer.opt.showAnnotations};var canPlayHTML5=false;var v=document.createElement("video");if(v.canPlayType)canPlayHTML5=true;if(canPlayHTML5)jQuery.extend(playerVars,{"html5":1});if(jQuery.browser.msie&&jQuery.browser.version<9)this.opt.opacity=1;var playerBox=jQuery("<div/>").attr("id",playerID).addClass("playerBox");var overlay=jQuery("<div/>").css({position:"absolute",top:0,left:0,width:"100%",height:"100%"}).addClass("YTPOverlay"); 59YTPlayer.isSelf=YTPlayer.opt.containment=="self";YTPlayer.opt.containment=YTPlayer.opt.containment=="self"?jQuery(this):jQuery(YTPlayer.opt.containment);YTPlayer.isBackground=YTPlayer.opt.containment.get(0).tagName.toLowerCase()=="body";if(YTPlayer.isBackground&&ytp.backgroundIsInited)return;if(!YTPlayer.opt.containment.is(jQuery(this)))$YTPlayer.hide();else YTPlayer.isPlayer=true;if(ytp.isDevice){$YTPlayer.remove();return}if(YTPlayer.opt.addRaster){var retina=window.retina||window.devicePixelRatio> 601;overlay.addClass(retina?"raster retina":"raster")}else overlay.removeClass("raster retina");var wrapper=jQuery("<div/>").addClass("mbYTP_wrapper").attr("id","wrapper_"+playerID);wrapper.css({position:"absolute",zIndex:0,minWidth:"100%",minHeight:"100%",left:0,top:0,overflow:"hidden",opacity:0});playerBox.css({position:"absolute",zIndex:0,width:"100%",height:"100%",top:0,left:0,overflow:"hidden",opacity:this.opt.opacity});wrapper.append(playerBox);YTPlayer.opt.containment.children().not("script, style").each(function(){if(jQuery(this).css("position")== 61"static")jQuery(this).css("position","relative")});if(YTPlayer.isBackground){jQuery("body").css({position:"relative",minWidth:"100%",minHeight:"100%",zIndex:1,boxSizing:"border-box"});wrapper.css({position:"fixed",top:0,left:0,zIndex:0,webkitTransform:"translateZ(0)"});$YTPlayer.hide()}else if(YTPlayer.opt.containment.css("position")=="static")YTPlayer.opt.containment.css({position:"relative"});YTPlayer.opt.containment.prepend(wrapper);YTPlayer.wrapper=wrapper;playerBox.css({opacity:1});if(!ytp.isDevice){playerBox.after(overlay); 62YTPlayer.overlay=overlay}if(!YTPlayer.isBackground)overlay.on("mouseenter",function(){$YTPlayer.find(".mb_YTVPBar").addClass("visible")}).on("mouseleave",function(){$YTPlayer.find(".mb_YTVPBar").removeClass("visible")});if(!ytp.YTAPIReady){jQuery("#YTAPI").remove();var tag=jQuery("<script>\x3c/script>").attr({"src":jQuery.mbYTPlayer.locationProtocol+"//www.youtube.com/player_api?v="+jQuery.mbYTPlayer.version,"id":"YTAPI"});jQuery("head title").after(tag)}else setTimeout(function(){jQuery(document).trigger("YTAPIReady")}, 63100);jQuery(document).on("YTAPIReady",function(){if(YTPlayer.isBackground&&ytp.backgroundIsInited||YTPlayer.isInit)return;if(YTPlayer.isBackground&&YTPlayer.opt.stopMovieOnClick)jQuery(document).off("mousedown.ytplayer").on("mousedown,.ytplayer",function(e){var target=jQuery(e.target);if(target.is("a")||target.parents().is("a"))$YTPlayer.pauseYTP()});if(YTPlayer.isBackground)ytp.backgroundIsInited=true;YTPlayer.opt.autoPlay=typeof YTPlayer.opt.autoPlay=="undefined"?YTPlayer.isBackground?true:false: 64YTPlayer.opt.autoPlay;YTPlayer.opt.vol=YTPlayer.opt.vol?YTPlayer.opt.vol:100;jQuery.mbYTPlayer.getDataFromFeed(YTPlayer.videoID,YTPlayer);jQuery(YTPlayer).on("YTPChanged",function(){if(YTPlayer.isInit)return;YTPlayer.isInit=true;
64if(ytp.isDevice&&!YTPlayer.isBackground){new YT.Player(playerID,{videoId:YTPlayer.videoID.toString(),height:"100%",width:"100%",videoId:YTPlayer.videoID,events:{"onReady":function(event){YTPlayer.player=event.target;playerBox.css({opacity:1});YTPlayer.wrapper.css({opacity:1}); 65$YTPlayer.optimizeDisplay()},"onStateChange":function(){}}});return}new YT.Player(playerID,{videoId:YTPlayer.videoID.toString(),playerVars:playerVars,events:{"onReady":function(event){YTPlayer.player=event.target;if(YTPlayer.isReady)return;YTPlayer.isReady=true;YTPlayer.playerEl=YTPlayer.player.getIframe();$YTPlayer.optimizeDisplay();YTPlayer.videoID=videoID;jQuery(window).on("resize.YTP",function(){$YTPlayer.optimizeDisplay()});if(YTPlayer.opt.showControls)jQuery(YTPlayer).buildYTPControls();var startAt= 66YTPlayer.opt.startAt?YTPlayer.opt.startAt:1;YTPlayer.player.setVolume(0);jQuery(YTPlayer).muteYTPVolume();jQuery.mbYTPlayer.checkForState(YTPlayer);YTPlayer.checkForStartAt=setInterval(function(){var canPlayVideo=YTPlayer.player.getVideoLoadedFraction()>startAt/YTPlayer.player.getDuration();if(YTPlayer.player.getCurrentTime()>=startAt&&YTPlayer.player.getDuration()>0&&canPlayVideo){clearInterval(YTPlayer.checkForStartAt);YTPlayer.player.setVolume(0);jQuery(YTPlayer).muteYTPVolume();if(typeof YTPlayer.opt.onReady== 67"function")YTPlayer.opt.onReady($YTPlayer);if(YTPlayer.opt.autoPlay)$YTPlayer.playYTP();else YTPlayer.player.pauseVideo();if(YTPlayer.opt.autoPlay)$YTPlayer.playYTP();else YTPlayer.player.pauseVideo();if(!YTPlayer.opt.mute)jQuery(YTPlayer).unmuteYTPVolume();$YTPlayer.css("background-image","none");YTPlayer.wrapper.CSSAnimate({opacity:YTPlayer.isAlone?1:YTPlayer.opt.opacity},2E3);jQuery.mbYTPlayer.checkForState(YTPlayer)}else{YTPlayer.player.playVideo();YTPlayer.player.seekTo(startAt,true)}},100)}, 68"onStateChange":function(event){if(typeof event.target.getPlayerState!="function")return;var state=event.target.getPlayerState();if(typeof YTPlayer.opt.onStateChange=="function")YTPlayer.opt.onStateChange($YTPlayer,state);var controls=jQuery("#controlBar_"+YTPlayer.id);var data=YTPlayer.opt;if(state==0){if(YTPlayer.state==state)return;YTPlayer.state=state;YTPlayer.player.pauseVideo();var startAt=YTPlayer.opt.startAt?YTPlayer.opt.startAt:1;if(data.loop){YTPlayer.wrapper.css({opacity:0});$YTPlayer.playYTP(); 69YTPlayer.player.seekTo(startAt,true)}else if(!YTPlayer.isBackground){YTPlayer.player.seekTo(startAt,true);$YTPlayer.playYTP();setTimeout(function(){$YTPlayer.pauseYTP()},10)}if(!data.loop&&YTPlayer.isBackground)YTPlayer.wrapper.CSSAnimate({opacity:0}
69,2E3);else if(data.loop){YTPlayer.wrapper.css({opacity:0});YTPlayer.loop++}controls.find(".mb_YTVPPlaypause").html(jQuery.mbYTPlayer.controls.play);jQuery(YTPlayer).trigger("YTPEnd")}if(state==3){if(YTPlayer.state==state)return;YTPlayer.state=state;YTPlayer.player.setPlaybackQuality(YTPlayer.opt.quality); 70controls.find(".mb_YTVPPlaypause").html(jQuery.mbYTPlayer.controls.play);jQuery(YTPlayer).trigger("YTPBuffering")}if(state==-1){if(YTPlayer.state==state)return;YTPlayer.state=state;YTPlayer.wrapper.css({opacity:0});jQuery(YTPlayer).trigger("YTPUnstarted")}if(state==1){if(YTPlayer.state==state)return;YTPlayer.state=state;YTPlayer.player.setPlaybackQuality(YTPlayer.opt.quality);controls.find(".mb_YTVPPlaypause").html(jQuery.mbYTPlayer.controls.pause);jQuery(YTPlayer).trigger("YTPStart");if(typeof _gaq!= 71"undefined"&&eval(YTPlayer.opt.gaTrack))_gaq.push(["_trackEvent","YTPlayer","Play",YTPlayer.title||YTPlayer.videoID.toString()]);if(typeof ga!="undefined"&&eval(YTPlayer.opt.gaTrack))ga("send","event","YTPlayer","play",YTPlayer.title||YTPlayer.videoID.toString())}if(state==2){if(YTPlayer.state==state)return;YTPlayer.state=state;controls.find(".mb_YTVPPlaypause").html(jQuery.mbYTPlayer.controls.play);jQuery(YTPlayer).trigger("YTPPause")}},"onPlaybackQualityChange":function(e){if(typeof YTPlayer.opt.onPlaybackQualityChange== 72"function")YTPlayer.opt.onPlaybackQualityChange($YTPlayer)},"onError":function(err){if(err.data==150){console.log("Embedding this video is restricted by Youtube.");if(YTPlayer.isPlayList)jQuery(YTPlayer).playNext()}if(err.data==2&&YTPlayer.isPlayList)jQuery(YTPlayer).playNext();if(typeof YTPlayer.opt.onError=="function")YTPlayer.opt.onError($YTPlayer,err)}}})})})})},getDataFromFeed:function(videoID,YTPlayer){YTPlayer.videoID=videoID;if(!jQuery.browser.msie){jQuery.getJSON(jQuery.mbYTPlayer.locationProtocol+ 73"//gdata.youtube.com/feeds/api/videos/"+videoID+"?v=2&alt=jsonc",function(data,status,xhr){YTPlayer.dataReceived=true;var videoData=data.data;YTPlayer.title=videoData.title;YTPlayer.videoData=videoData;if(YTPlayer.opt.ratio=="auto")if(videoData.aspectRatio&&videoData.aspectRatio==="widescreen")YTPlayer.opt.ratio="16/9";else YTPlayer.opt.ratio="4/3";if(!YTPlayer.hasData){YTPlayer.hasData=true;if(YTPlayer.isPlayer){var bgndURL=YTPlayer.videoData.thumbnail.hqDefault;YTPlayer.opt.containment.css({background:"rgba(0,0,0,0.5) url("+ 74bgndURL+") center center",backgroundSize:"cover"})}}jQuery(YTPlayer).trigger("YTPChanged")});setTimeout(function(){if(!YTPlayer.dataReceived&&!YTPlayer.hasData){YTPlayer.hasData=true;jQuery(YTPlayer).trigger("YTPChanged")}},1500)}else{YTPlayer.opt.ratio=="auto"?YTPlayer.opt.ratio="16/9":YTPlayer.opt.ratio;if(!YTPlayer.hasData){YTPlayer.hasData=true;setTimeout(function(){jQuery(YTPlayer).trigger("YTPChanged")},100)}}},getVideoID:function(){var YTPlayer=this.get(0);return YTPlayer.videoID||false},setVideoQuality:function(quality){var YTPlayer= 75this.get(0);YTPlayer.player.setPlaybackQuality(quality)},YTPlaylist:function(videos,shuffle,callback){var YTPlayer=this.get(0);YTPlayer.isPlayList=true;if(shuffle)videos=jQuery.shuffle(videos);if(!YTPlayer.videoID){YTPlayer.videos=videos;YTPlayer.videoCounter=0;YTPlayer.videoLength=videos.length;jQuery(YTPlayer).data("property",videos[0]);jQuery(YTPlayer).mb_YTPlayer()}if(typeof callback=="function")jQuery(YTPlayer).on("YTPChanged",function(){callback(YTPlayer)});jQuery(YTPlayer).on("YTPEnd",function(){jQuery(YTPlayer).playNext()})}, 76playNext:function(){var YTPlayer=this.get(0);YTPlayer.videoCounter++;if(YTPlayer.videoCounter>=YTPlayer.videoLength)YTPlayer.videoCounter=0;jQuery(YTPlayer.playerEl).css({opacity:0});jQuery(YTPlayer).changeMovie(YTPlayer.videos[YTPlayer.videoCounter])},playPrev:function(){var YTPlayer=this.get(0);YTPlayer.videoCounter--;if(YTPlayer.videoCounter<0)YTPlayer.videoCounter=YTPlayer.videoLength-1;jQuery(YTPlayer.playerEl).css({opacity:0});jQuery(YTPlayer).changeMovie(YTPlayer.videos[YTPlayer.videoCounter])}, 77changeMovie:function(opt){var YTPlayer=this.get(0);YTPlayer.opt.startAt=0;YTPlayer.opt.stopAt=0;YTPlayer.opt.mute=true;if(opt)jQuery.extend(YTPlayer.opt,opt);YTPlayer.videoID=getYTPVideoID(YTPlayer.opt.videoURL);jQuery(YTPlayer).pauseYTP();var timer=jQuery.browser.msie?1E3:0;jQuery(YTPlayer.playerEl).CSSAnimate({opacity:0}
77,timer);setTimeout(function(){jQuery(YTPlayer).getPlayer().cueVideoByUrl(encodeURI(jQuery.mbYTPlayer.locationProtocol+"//www.youtube.com/v/"+YTPlayer.videoID),1,YTPlayer.opt.quality); 78jQuery(YTPlayer).playYTP();jQuery(YTPlayer).one("YTPStart",function(){YTPlayer.wrapper.CSSAnimate({opacity:YTPlayer.isAlone?1:YTPlayer.opt.opacity},1E3);jQuery(YTPlayer.playerEl).CSSAnimate({opacity:1},timer);if(YTPlayer.opt.startAt)YTPlayer.player.seekTo(YTPlayer.opt.startAt);jQuery.mbYTPlayer.checkForState(YTPlayer);if(!YTPlayer.opt.autoPlay)jQuery(YTPlayer).pauseYTP()});if(YTPlayer.opt.mute)jQuery(YTPlayer).muteYTPVolume();else jQuery(YTPlayer).unmuteYTPVolume()},timer);if(YTPlayer.opt.addRaster){var retina= 79window.retina||window.devicePixelRatio>1;YTPlayer.overlay.addClass(retina?"raster retina":"raster")}else{YTPlayer.overlay.removeClass("raster");YTPlayer.overlay.removeClass("retina")}jQuery("#controlBar_"+YTPlayer.id).remove();if(YTPlayer.opt.showControls)jQuery(YTPlayer).buildYTPControls();jQuery.mbYTPlayer.getDataFromFeed(YTPlayer.videoID,YTPlayer);jQuery(YTPlayer).optimizeDisplay()},getPlayer:function(){return jQuery(this).get(0).player},playerDestroy:function(){var YTPlayer=this.get(0);ytp.YTAPIReady= 80false;ytp.backgroundIsInited=false;YTPlayer.isInit=false;YTPlayer.videoID=null;var playerBox=YTPlayer.wrapper;playerBox.remove();jQuery("#controlBar_"+YTPlayer.id).remove()},fullscreen:function(real){var YTPlayer=this.get(0);if(typeof real=="undefined")real=YTPlayer.opt.realfullscreen;real=eval(real);var controls=jQuery("#controlBar_"+YTPlayer.id);var fullScreenBtn=controls.find(".mb_OnlyYT");var videoWrapper=YTPlayer.isSelf?YTPlayer.opt.containment:YTPlayer.wrapper;if(real){var fullscreenchange= 81jQuery.browser.mozilla?"mozfullscreenchange":jQuery.browser.webkit?"webkitfullscreenchange":"fullscreenchange";jQuery(document).off(fullscreenchange).on(fullscreenchange,function(){var isFullScreen=RunPrefixMethod(document,"IsFullScreen")||RunPrefixMethod(document,"FullScreen");if(!isFullScreen){YTPlayer.isAlone=false;fullScreenBtn.html(jQuery.mbYTPlayer.controls.onlyYT);jQuery(YTPlayer).setVideoQuality(YTPlayer.opt.quality);videoWrapper.removeClass("fullscreen");videoWrapper.CSSAnimate({opacity:YTPlayer.opt.opacity}, 82500);videoWrapper.css({zIndex:0});if(YTPlayer.isBackground)jQuery("body").after(controls);else YTPlayer.wrapper.before(controls);jQuery(window).resize();jQuery(YTPlayer).trigger("YTPFullScreenEnd")}else{jQuery(YTPlayer).setVideoQuality("default");jQuery(YTPlayer).trigger("YTPFullScreenStart")}})}if(!YTPlayer.isAlone){if(real){var playerState=YTPlayer.player.getPlayerState();videoWrapper.css({opacity:0});videoWrapper.addClass("fullscreen");launchFullscreen(videoWrapper.get(0));setTimeout(function(){videoWrapper.CSSAnimate({opacity:1}, 831E3);YTPlayer.wrapper.append(controls);jQuery(YTPlayer).optimizeDisplay();YTPlayer.player.seekTo(YTPlayer.player.getCurrentTime()+.1,true)},500)}else videoWrapper.css({zIndex:1E4}).CSSAnimate({opacity:1},1E3);fullScreenBtn.html(jQuery.mbYTPlayer.controls.showSite);YTPlayer.isAlone=true}else{if(real)cancelFullscreen();else{videoWrapper.CSSAnimate({opacity:YTPlayer.opt.opacity},500);videoWrapper.css({zIndex:0})}fullScreenBtn.html(jQuery.mbYTPlayer.controls.onlyYT);YTPlayer.isAlone=false}function RunPrefixMethod(obj, 84method){var pfx=["webkit","moz","ms","o",""];var p=0,m,t;while(p<pfx.length&&!obj[m]){m=method;if(pfx[p]=="")m=m.substr(0,1).toLowerCase()+m.substr(1);m=pfx[p]+m;t=typeof obj[m];if(t!="undefined"){pfx=[pfx[p]];return t=="function"?obj[m]():obj[m]}p++}}function launchFullscreen(element){RunPrefixMethod(element,"RequestFullScreen")}function cancelFullscreen(){if(RunPrefixMethod(document,"FullScreen")||RunPrefixMethod(document,"IsFullScreen"))RunPrefixMethod(document,"CancelFullScreen")}},playYTP:function(){var YTPlayer= 85this.get(0);if(typeof YTPlayer.player==="undefined")return;var controls=jQuery("#controlBar_"+YTPlayer.id);var playBtn=controls.find(".mb_YTVPPlaypause");playBtn.html(jQuery.mbYTPlayer.controls.pause);YTPlayer.player.playVideo();YTPlayer.wrapper.CSSAnimate({opacity:YTPlayer.isAlone?1:YTPlayer.opt.opacity},2E3);jQuery(YTPlayer).on("YTPStart",function(){jQuery(YTPlayer).css("background-image","none")})},toggleLoops:function(){var YTPlayer=this.get(0);var data=YTPlayer.opt;
85if(data.loop==1)data.loop= 860;else{if(data.startAt)YTPlayer.player.seekTo(data.startAt);else YTPlayer.player.playVideo();data.loop=1}},stopYTP:function(){var YTPlayer=this.get(0);var controls=jQuery("#controlBar_"+YTPlayer.id);var playBtn=controls.find(".mb_YTVPPlaypause");playBtn.html(jQuery.mbYTPlayer.controls.play);YTPlayer.player.stopVideo()},pauseYTP:function(){var YTPlayer=this.get(0);var data=YTPlayer.opt;var controls=jQuery("#controlBar_"+YTPlayer.id);var playBtn=controls.find(".mb_YTVPPlaypause");playBtn.html(jQuery.mbYTPlayer.controls.play); 87YTPlayer.player.pauseVideo()},seekToYTP:function(val){var YTPlayer=this.get(0);YTPlayer.player.seekTo(val,true)},setYTPVolume:function(val){var YTPlayer=this.get(0);if(!val&&!YTPlayer.opt.vol&&YTPlayer.player.getVolume()==0)jQuery(YTPlayer).unmuteYTPVolume();else if(!val&&YTPlayer.player.getVolume()>0||val&&YTPlayer.player.getVolume()==val)jQuery(YTPlayer).muteYTPVolume();else YTPlayer.opt.vol=val;YTPlayer.player.setVolume(YTPlayer.opt.vol)},muteYTPVolume:function(){var YTPlayer=this.get(0);YTPlayer.player.mute(); 88YTPlayer.player.setVolume(0);var controls=jQuery("#controlBar_"+YTPlayer.id);var muteBtn=controls.find(".mb_YTVPMuteUnmute");muteBtn.html(jQuery.mbYTPlayer.controls.unmute);jQuery(YTPlayer).addClass("isMuted");jQuery(YTPlayer).trigger("YTPMuted")},unmuteYTPVolume:function(){var YTPlayer=this.get(0);YTPlayer.player.unMute();YTPlayer.player.setVolume(YTPlayer.opt.vol);var controls=jQuery("#controlBar_"+YTPlayer.id);var muteBtn=controls.find(".mb_YTVPMuteUnmute");muteBtn.html(jQuery.mbYTPlayer.controls.mute); 89jQuery(YTPlayer).removeClass("isMuted");jQuery(YTPlayer).trigger("YTPUnmuted")},manageYTPProgress:function(){var YTPlayer=this.get(0);var controls=jQuery("#controlBar_"+YTPlayer.id);var progressBar=controls.find(".mb_YTVPProgress");var loadedBar=controls.find(".mb_YTVPLoaded");var timeBar=controls.find(".mb_YTVTime");var totW=progressBar.outerWidth();var currentTime=Math.floor(YTPlayer.player.getCurrentTime());var totalTime=Math.floor(YTPlayer.player.getDuration());var timeW=currentTime*totW/totalTime; 90var startLeft=0;var loadedW=YTPlayer.player.getVideoLoadedFraction()*100;loadedBar.css({left:startLeft,width:loadedW+"%"});timeBar.css({left:0,width:timeW});return{totalTime:totalTime,currentTime:currentTime}},buildYTPControls:function(){var YTPlayer=this.get(0);var data=YTPlayer.opt;data.showYTLogo=data.showYTLogo||data.printUrl;if(jQuery("#controlBar_"+YTPlayer.id).length)return;var controlBar=jQuery("<span/>").attr("id","controlBar_"+YTPlayer.id).addClass("mb_YTVPBar").css({whiteSpace:"noWrap", 91position:YTPlayer.isBackground?"fixed":"absolute",zIndex:YTPlayer.isBackground?1E4:1E3}).hide();var buttonBar=jQuery("<div/>").addClass("buttonBar");var playpause=jQuery("<span>"+jQuery.mbYTPlayer.controls.play+"</span>").addClass("mb_YTVPPlaypause ytpicon").click(function(){if(YTPlayer.player.getPlayerState()==1)jQuery(YTPlayer).pauseYTP();else jQuery(YTPlayer).playYTP()});var MuteUnmute=jQuery("<span>"+jQuery.mbYTPlayer.controls.mute+"</span>").addClass("mb_YTVPMuteUnmute ytpicon").click(function(){if(YTPlayer.player.getVolume()== 920)jQuery(YTPlayer).unmuteYTPVolume();else jQuery(YTPlayer).muteYTPVolume()});var idx=jQuery("<span/>").addClass("mb_YTVPTime");var vURL=data.videoURL;if(vURL.indexOf("http")<0)vURL=jQuery.mbYTPlayer.locationProtocol+"//www.youtube.com/watch?v="+data.videoURL;var movieUrl=jQuery("<span/>").html(jQuery.mbYTPlayer.controls.ytLogo).addClass("mb_YTVPUrl ytpicon").attr("title","view on YouTube").on("click",function(){window.open(vURL,"viewOnYT")});var onlyVideo=jQuery("<span/>").html(jQuery.mbYTPlayer.controls.onlyYT).addClass("mb_OnlyYT ytpicon").on("click", 93function(){jQuery(YTPlayer).fullscreen(data.realfullscreen)});var progressBar=jQuery("<div/>").addClass("mb_YTVPProgress").css("position","absolute").click(function(e){timeBar.css({width:e.clientX-timeBar.offset().left});YTPlayer.timeW=e.clientX-timeBar.offset().left;controlBar.find(".mb_YTVPLoaded").css({width:0});var totalTime=Math.floor(YTPlayer.player.getDuration());YTPlayer["goto"]=timeBar.outerWidth()*totalTime/progressBar.outerWidth();YTPlayer.player.seekTo(parseFloat(YTPlayer["goto"]),true); 94controlBar.find(".mb_YTVPLoaded").css({width:0})});var loadedBar=jQuery("<div/>").addClass("mb_YTVPLoaded").css("position","absolute");var timeBar=jQuery("<div/>").addClass("mb_YTVTime").css("position","absolute");progressBar.append(loadedBar).append(timeBar);buttonBar.append(playpause).append(MuteUnmute).append(idx);if(data.showYTLogo)buttonBar.append(movieUrl);
94if(YTPlayer.isBackground||eval(YTPlayer.opt.realfullscreen)&&!YTPlayer.isBackground)buttonBar.append(onlyVideo);controlBar.append(buttonBar).append(progressBar); 95if(!YTPlayer.isBackground){controlBar.addClass("inlinePlayer");YTPlayer.wrapper.before(controlBar)}else jQuery("body").after(controlBar);controlBar.fadeIn()},checkForState:function(YTPlayer){clearInterval(YTPlayer.getState);YTPlayer.getState=setInterval(function(){var prog=jQuery(YTPlayer).manageYTPProgress();var $YTPlayer=jQuery(YTPlayer);var controlBar=jQuery("#controlBar_"+YTPlayer.id);var data=YTPlayer.opt;var startAt=YTPlayer.opt.startAt?YTPlayer.opt.startAt:1;var stopAt=YTPlayer.opt.stopAt> 96YTPlayer.opt.startAt?YTPlayer.opt.stopAt:0;stopAt=stopAt<YTPlayer.player.getDuration()?stopAt:0;if(YTPlayer.player.getVolume()==0)$YTPlayer.addClass("isMuted");else $YTPlayer.removeClass("isMuted");if(prog.totalTime)controlBar.find(".mb_YTVPTime").html(jQuery.mbYTPlayer.formatTime(prog.currentTime)+" / "+jQuery.mbYTPlayer.formatTime(prog.totalTime));else controlBar.find(".mb_YTVPTime").html("-- : -- / -- : --");if(YTPlayer.player.getPlayerState()==1&&(parseFloat(YTPlayer.player.getDuration()-3)<YTPlayer.player.getCurrentTime()|| 97stopAt>0&&parseFloat(YTPlayer.player.getCurrentTime())>stopAt)){if(YTPlayer.isEnded)return;YTPlayer.isEnded=true;setTimeout(function(){YTPlayer.isEnded=false},2E3);if(YTPlayer.isPlayList){clearInterval(YTPlayer.getState);jQuery(YTPlayer).trigger("YTPEnd");return}else if(!data.loop){YTPlayer.player.pauseVideo();YTPlayer.wrapper.CSSAnimate({opacity:0}
97,1E3,function(){jQuery(YTPlayer).trigger("YTPEnd");YTPlayer.player.seekTo(startAt,true);if(!YTPlayer.isBackground){var bgndURL=YTPlayer.videoData.thumbnail.hqDefault; 98jQuery(YTPlayer).css({background:"rgba(0,0,0,0.5) url("+bgndURL+") center center",backgroundSize:"cover"})}})}else YTPlayer.player.seekTo(startAt,true)}},1)},formatTime:function(s){var min=Math.floor(s/60);var sec=Math.floor(s-60*min);return(min<=9?"0"+min:min)+" : "+(sec<=9?"0"+sec:sec)}};jQuery.fn.toggleVolume=function(){var YTPlayer=this.get(0);if(!YTPlayer)return;if(YTPlayer.player.isMuted()){jQuery(YTPlayer).unmuteYTPVolume();return true}else{jQuery(YTPlayer).muteYTPVolume();return false}};jQuery.fn.optimizeDisplay= 99function(){var YTPlayer=this.get(0);var data=YTPlayer.opt;var playerBox=jQuery(YTPlayer.playerEl);var win={};var el=YTPlayer.wrapper;win.width=el.outerWidth();win.height=el.outerHeight();var margin=24;var overprint=100;var vid={};vid.width=win.width+win.width*margin/100;vid.height=data.ratio=="16/9"?Math.ceil(9*win.width/16):Math.ceil(3*win.width/4);vid.marginTop=-((vid.height-win.height)/2);vid.marginLeft=-(win.width*(margin/2)/100);if(vid.height<win.height){vid.height=win.height+win.height*margin/ 100100;vid.width=data.ratio=="16/9"?Math.floor(16*win.height/9):Math.floor(4*win.height/3);vid.marginTop=-(win.height*(margin/2)/100);vid.marginLeft=-((vid.width-win.width)/2)}vid.width+=overprint;vid.height+=overprint;vid.marginTop-=overprint/2;vid.marginLeft-=overprint/2;playerBox.css({width:vid.width,height:vid.height,marginTop:vid.marginTop,marginLeft:vid.marginLeft})};jQuery.shuffle=function(arr){var newArray=arr.slice();var len=newArray.length;var i=len;while(i--){var p=parseInt(Math.random()* 101len);var t=newArray[i];newArray[i]=newArray[p];newArray[p]=t}return newArray};jQuery.fn.mb_YTPlayer=jQuery.mbYTPlayer.buildPlayer;jQuery.fn.YTPlaylist=jQuery.mbYTPlayer.YTPlaylist;jQuery.fn.playNext=jQuery.mbYTPlayer.playNext;jQuery.fn.playPrev=jQuery.mbYTPlayer.playPrev;jQuery.fn.changeMovie=jQuery.mbYTPlayer.changeMovie;jQuery.fn.getVideoID=jQuery.mbYTPlayer.getVideoID;jQuery.fn.getPlayer=jQuery.mbYTPlayer.getPlayer;jQuery.fn.playerDestroy=jQuery.mbYTPlayer.playerDestroy;jQuery.fn.fullscreen=jQuery.mbYTPlayer.fullscreen; 102jQuery.fn.buildYTPControls=jQuery.mbYTPlayer.buildYTPControls;jQuery.fn.playYTP=jQuery.mbYTPlayer.playYTP;jQuery.fn.toggleLoops=jQuery.mbYTPlayer.toggleLoops;jQuery.fn.stopYTP=jQuery.mbYTPlayer.stopYTP;jQuery.fn.pauseYTP=jQuery.mbYTPlayer.pauseYTP;jQuery.fn.seekToYTP=jQuery.mbYTPlayer.seekToYTP;jQuery.fn.muteYTPVolume=jQuery.mbYTPlayer.muteYTPVolume;jQuery.fn.unmuteYTPVolume=jQuery.mbYTPlayer.unmuteYTPVolume;jQuery.fn.setYTPVolume=jQuery.mbYTPlayer.setYTPVolume;jQuery.fn.setVideoQuality=jQuery.mbYTPlayer.setVideoQuality; 103jQuery.fn.manageYTPProgress=jQuery.mbYTPlayer.manageYTPProgress})(jQuery,ytp); 104;/*})'"*/;/*})'"*/ 105jQuery(document).ready(function(jQuery){jQuery(".tm_video_bg").mb_YTPlayer()}); 106;/*})'"*/;/*})'"*/ 107(function ($) { 108 109/** 110 * A progressbar object. Initialized with the given id. Must be inserted into 111 * the DOM afterwards through progressBar.element. 112 * 113 * method is the function which will perform the HTTP request to get the 114 * progress bar state. Either "GET" or "POST". 115 * 116 * e.g. pb = new progressBar('myProgressBar'); 117 * some_element.appendChild(pb.element); 118 */ 119Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 120 var pb = this; 121 this.id = id; 122 this.method = method || 'GET'; 123 this.updateCallback = updateCallback; 124 this.errorCallback = errorCallback; 125 126 // The WAI-ARIA setting aria-live="polite" will announce changes after users 127 // have completed their current activity and not interrupt the screen reader. 128 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 129 this.element.html('<div class="bar"><div class="filled"></div></div>' + 130 '<div class="percentage"></div>' + 131 '<div class="message"> </div>'); 132}; 133 134/** 135 * Set the percentage and status message for the progressbar. 136 */ 137Drupal.progressBar.prototype.setProgress = function (percentage, message) { 138 if (percentage >= 0 && percentage <= 100) { 139 $('div.filled', this.element).css('width', percentage + '%'); 140 $('div.percentage', this.element).html(percentage + '%'); 141 } 142 $('div.message', this.element).html(message); 143 if (this.updateCallback) { 144 this.updateCallback(percentage, message, this); 145 } 146}; 147 148/** 149 * Start monitoring progress via Ajax. 150 */ 151Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 152 this.delay = delay; 153 this.uri = uri; 154 this.sendPing(); 155}; 156 157/** 158 * Stop monitoring progress via Ajax. 159 */ 160Drupal.progressBar.prototype.stopMonitoring = function () { 161 clearTimeout(this.timer); 162 // This allows monitoring to be stopped from within the callback. 163 this.uri = null; 164}; 165 166/** 167 * Request progress data from server. 168 */ 169Drupal.progressBar.prototype.sendPing = function () { 170 if (this.timer) { 171 clearTimeout(this.timer); 172 } 173 if (this.uri) { 174 var pb = this; 175 // When doing a post request, you need non-null data. Otherwise a 176 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 177 $.ajax({ 178 type: this.method, 179 url: this.uri, 180 data: '', 181 dataType: 'json', 182 success: function (progress) { 183 // Display errors. 184 if (progress.status == 0) { 185 pb.displayError(progress.data); 186 return; 187 } 188 // Update display. 189 pb.setProgress(progress.percentage, progress.message); 190 // Schedule next timer.
191 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 192 }, 193 error: function (xmlhttp) { 194 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 195 } 196 }); 197 } 198}; 199 200/** 201 * Display errors on the page. 202 */ 203Drupal.progressBar.prototype.displayError = function (string) { 204 var error = $('<div class="messages error"></div>').html(string); 205 $(this.element).before(error).hide(); 206 207 if (this.errorCallback) { 208 this.errorCallback(this); 209 } 210}; 211 212})(jQuery); 213;/*})'"*/;/*})'"*/ 214/* 215 * @file 216 * Integration with the colorbox library/module 217 */ 218 219(function ($) { 220 Drupal.ajax.prototype.commands.colorboxNodeReload = function (ajax, response) { 221 location.reload(); 222 }; 223 224 Drupal.ajax.prototype.commands.colorboxNodeRedirect = function (ajax, response) { 225 window.location.replace(response.data); 226 }; 227 228 Drupal.behaviors.colorboxNode = { 229 // Lets find our class name and change our URL to 230 // our defined menu path to open in a colorbox modal. 231 attach: function (context, settings) { 232 // Make sure colorbox exists. 233 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 234 return; 235 } 236 237 // Mobile detection extracted from the colorbox module. 238 // If the mobile setting is turned on, it will turn off the colorbox modal for mobile devices. 239 if (settings.colorbox.mobiledetect && window.matchMedia) { 240 // Disable Colorbox for small screens. 241 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 242 if (mq.matches) { 243 return; 244 } 245 } 246 247 $('.colorbox-node', context).once('init-colorbox-node-processed', function () { 248 $(this).colorboxNode({'launch': false}); 249 }); 250 251 // When using contextual links and clicking from within the colorbox 252 // we need to close down colorbox when opening the built in overlay. 253 $('ul.contextual-links a', context).once('colorboxNodeContextual').click(function () { 254 $.colorbox.close(); 255 }); 256 } 257 }; 258 259 $.fn.colorboxNodeLaunch = function (settings) { 260 var $this = $(this).clone(); 261 262 // Clear out the rel to prevent any confusion if not using the gallery class. 263 if(!$this.hasClass('colorbox-node-gallery')) { 264 $this.attr('rel', ''); 265 } 266 267 if (!hrefIsSafe(settings.href)) { 268 return; 269 } 270 // Lets extract our width and height giving priority to the data attributes. 271 var innerWidth = $this.data('inner-width'); 272 var innerHeight = $this.data('inner-height'); 273 if (typeof innerWidth != 'undefined' && typeof innerHeight != 'undefined') { 274 var params = $.urlDataParams(innerWidth, innerHeight); 275 } else { 276 var params = $.urlParams(settings.href); 277 } 278 279 // If we did not find a width or height, lets use the default. 280 if (params.innerHeight == undefined) { 281 params.innerHeight = settings.height; 282 } 283 if (params.innerWidth == undefined) { 284 params.innerWidth = settings.width; 285 } 286 287 params.html = '<div id="colorboxNodeLoading"></div>'; 288 params.onComplete = function () { 289 $this.colorboxNodeGroup(); 290 }; 291 params.open = true; 292 293 // Launch our colorbox with the provided settings 294 $this.colorbox($.extend({}, Drupal.settings.colorbox, params)); 295 }; 296 297 // Bind our colorbox node functionality to an anchor 298 $.fn.colorboxNode = function (options) { 299 var $this = this; 300 options = options || {}; 301 302 var settings = { 303 'launch': true, 304 'width': Drupal.settings.colorbox_node.width, 305 'height': Drupal.settings.colorbox_node.height 306 }; 307 308 $.extend(settings, options); 309 310 settings.href = $this.attr('data-href'); 311 if (typeof settings.href == 'undefined' || settings.href == false) { 312 settings.href = $this.attr('href'); 313 } 314 settings.href = Drupal.checkPlain(settings.href).replaceAll('&', '&'); 315 316 // Create an element so we can parse our a URL no matter if its internal or external. 317 var parse = document.createElement('a'); 318 parse.href = settings.href; 319 320 if(!settings.href) { 321 alert(Drupal.t('No url found on element')); 322 } 323 324 // Lets add our colorbox link after the base path if necessary. 325 var base_path = Drupal.settings.basePath; 326 var path_prefix = Drupal.settings.pathPrefix; 327 var pathname = parse.pathname; 328 329 // Lets check to see if the pathname has a forward slash. 330 // This problem happens in IE7/IE8 331 if (pathname.charAt(0) != '/') { 332 pathname = '/' + parse.pathname; 333 } 334 335 // If clean URL's are not turned on, lets check for that. 336 var cleanURLs = $.getParameterByName('q', settings.href); 337 if (base_path != '/') { 338 if (cleanURLs != '') { 339 settings.link = pathname.replace(base_path, base_path + parse.search.replace('?q=', '?q=/' + path_prefix + 'colorbox/')); 340 } else { 341 settings.link = pathname.replace(base_path, base_path + path_prefix + 'colorbox/') + parse.search; 342 } 343 } else { 344 if (cleanURLs != '') { 345 settings.link = base_path + parse.search.replace('?q=', '?q=/' + path_prefix + 'colorbox/'); 346 } else { 347 settings.link = base_path + path_prefix + 'colorbox' + pathname + parse.search; 348 } 349 } 350 351 // Bind Ajax behaviors to the element 352 var element_settings = {}; 353 element_settings.async = true; 354 355 // This removes any loading/progress bar on the clicked link 356 // and displays the colorbox loading screen instead. 357 element_settings.progress = { 'type': 'none' }; 358 // For anchor tags, these will go to the target of the anch
358or rather 359 // than the usual location. 360 if (settings.link) { 361 element_settings.url = settings.link; 362 element_settings.event = 'click'; 363 } 364 365 // Log our click handler to our ajax object 366 var base = Drupal.checkPlain($(this).attr('id')); 367 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 368 369 // Default to auto click for manual call to this function. 370 if (settings.launch) { 371 Drupal.ajax[base].eventResponse(this, 'click'); 372 $(this).colorboxNodeLaunch(settings); 373 } 374 else { 375 $(this).click(function () { 376 $(this).colorboxNodeLaunch(settings); 377 }); 378 } 379 }; 380 381 // Allow for grouping on links to showcase a gallery with left/right arrows. 382 // This function will find the next index of each link on the page by the rel 383 // and manually force a click on the link to call that AJAX and update the 384 // modal window. 385 $.fn.colorboxNodeGroup = function () { 386 // Lets do setup our gallery type of functions. 387 var $this = $(this); 388 var rel = Drupal.checkPlain($this.attr('rel')); 389 if (rel && $this.hasClass('colorbox-node-gallery')) { 390 if ($('a.colorbox-node-gallery[rel="' + rel + '"]:not(#colorbox a[rel="' + rel + '"])').length > 1) { 391 $related = $('a.colorbox-node-gallery[rel="' + rel + '"]:not(#colorbox a[rel="' + rel + '"])'); 392 393 // filter $related array by href, to have mutliple colorbox links to the same target 394 // appear as one item in the gallery only 395 var $related_unique = []; 396 $related.each(function () { 397 $.findHref($related_unique, this.href); 398 if (!$.findHref($related_unique, this.href).length) { 399 $related_unique.push(this); 400 } 401 }); 402 // we have to get the actual used element from the filtered list in order to get it's relative index 403 var current = $.findHref($related_unique, $this.get(0).href); 404 $related = $($related_unique); 405 var idx = $related.index($(current)); 406 var tot = $related.length; 407 408 // Show our gallery buttons 409 $('#cboxPrevious, #cboxNext').show(); 410 $.colorbox.next = function () { 411 index = get_index(1); 412 $related[index].click(); 413 }; 414 $.colorbox.prev = function () { 415 index = get_index(-1); 416 $related[index].click(); 417 }; 418 419 // Setup our current HTML 420 $('#cboxCurrent').html(Drupal.settings.colorbox.current.replace('{current}', idx + 1).replace('{total}', tot)).show(); 421 $('#cboxNext').html(Drupal.settings.colorbox.next).show(); 422 $('#cboxPrevious').html(Drupal.settings.colorbox.previous).show(); 423 424 var prefix = 'colorbox'; 425 // Remove Bindings and re-add 426 // @TODO: There must be a better way? If we don't remove it causes a memory to be exhausted. 427 $(document).unbind('keydown.' + prefix); 428 429 // Add Key Bindings 430 $(document).bind('keydown.' + prefix, function (e) { 431 var key = e.keyCode; 432 if ($related[1] && !e.altKey) { 433 if (key === 37) { 434 e.preventDefault(); 435 $.colorbox.prev(); 436 } else if (key === 39) { 437 e.preventDefault(); 438 $.colorbox.next(); 439 } 440 } 441 }); 442 } 443 444 function get_index(increment) { 445 var max = $related.length; 446 var newIndex = (idx + increment) % max; 447 return (newIndex < 0) ? max + newIndex : newIndex; 448 } 449 450 } 451 }; 452 453 // Find a colorbox link by href in an array 454 $.findHref = function (items, href) { 455 return $.grep(items, function (n, i) { 456 return n.href == href; 457 }); 458 }; 459 460 // Utility function to parse out our width/height from our url params
461 $.urlParams = function (url) { 462 var p = {}, 463 e, 464 a = /\+/g, // Regex for replacing addition symbol with a space 465 r = /([^&=]+)=?([^&]*)/g, 466 d = function (s) { 467 return decodeURIComponent(s.replace(a, ' ')); 468 }, 469 q = url.split('?'); 470 while (e = r.exec(q[1])) { 471 e[1] = d(e[1]); 472 e[2] = d(e[2]); 473 switch (e[2].toLowerCase()) { 474 case 'true': 475 case 'yes': 476 e[2] = true; 477 break; 478 479 case 'false': 480 case 'no': 481 e[2] = false; 482 break; 483 } 484 if (e[1] == 'width') { 485 e[1] = 'innerWidth'; 486 } 487 if (e[1] == 'height') { 488 e[1] = 'innerHeight'; 489 } 490 p[e[1]] = e[2]; 491 } 492 return p; 493 }; 494 495 // Utility function to return our data attributes for width/height 496 $.urlDataParams = function (innerWidth, innerHeight) { 497 return {'innerWidth':innerWidth,'innerHeight':innerHeight}; 498 }; 499 500 $.getParameterByName = function (name, href) { 501 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 502 var regexString = "[\\?&]" + name + "=([^&#]*)"; 503 var regex = new RegExp(regexString); 504 var found = regex.exec(href); 505 if (found == null) { 506 return ""; 507 } 508 else { 509 return decodeURIComponent(found[1].replace(/\+/g, " ")); 510 } 511 }; 512 513 /** 514 * Returns true if the passed-in href string is safe for colorbox_load. 515 * 516 * @param href 517 * The href string to be tested. 518 * 519 * @return 520 * Boolean true if the href is safe. 521 */ 522 function hrefIsSafe(href) { 523 var normalizedUrl = Drupal.absoluteUrl(href); 524 525 // Only local, non-file-system URLs are allowed. 526 if (!Drupal.urlIsLocal(normalizedUrl)) { 527 return false; 528 } 529 530 // Reject uploaded files from the public or private file system. 531 if (normalizedUrl.indexOf(Drupal.settings.colorbox.file_public_path) !== -1 || 532 normalizedUrl.match(/\/system\/files\//) || 533 normalizedUrl.match(/[?|&]q=system\/files\//)) { 534 return false; 535 } 536 537 // All checks passed. 538 return true; 539 } 540})(jQuery); 541;/*})'"*/;/*})'"*/ 542/** 543* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+ 544* <http://cherne.net/brian/resources/jquery.hoverIntent.html> 545* 546* @param f onMouseOver function || An object with configuration options 547* @param g onMouseOut function || Nothing (use configuration options object) 548* @author Brian Cherne brian(at)cherne(dot)net 549*/ 550(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery); 551;/*})'"*/;/*})'"*/ 552/* 553 * sf-Touchscreen v1.2b - Provides touchscreen compatibility for the jQuery Superfish plugin. 554 * 555 * Developer's note: 556 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 557 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact 558 * 559 * jQuery version: 1.3.x or higher. 560 * 561 * Dual licensed under the MIT and GPL licenses: 562 * http://www.opensource.org/licenses/mit-license.php 563 * http://www.gnu.org/licenses/gpl.html 564 */ 565 566(function($){ 567 $.fn.sftouchscreen = function(options){ 568 options = $.extend({ 569 mode: 'inactive', 570 breakpoint: 768, 571 useragent: '' 572 }, options); 573 574 function activate(menu){ 575 // Select hyperlinks from parent menu items. 576 menu.find('li > ul').closest('li').children('a').each(function(){ 577 var item = $(this);
578 // No .toggle() here as it's not possible to reset it. 579 item.click(function(event){ 580 // Already clicked? proceed to the URL. 581 if (item.hasClass('sf-clicked')){ 582 window.location = item.attr('href'); 583 } 584 // Prevent it otherwise. 585 else { 586 event.preventDefault(); 587 item.addClass('sf-clicked'); 588 } 589 }).closest('li').mouseleave(function(){ 590 // Reset everything. 591 item.removeClass('sf-clicked'); 592 }); 593 }); 594 } 595 // Return original object to support chaining. 596 return this.each(function(){ 597 var menu = $(this), 598 mode = options.mode; 599 // The rest is crystal clear, isn't it? :) 600 switch (mode){ 601 case 'always_active' : 602 activate(menu); 603 break; 604 case 'window_width' : 605 if ($(window).width() < options.breakpoint){ 606 activate(menu); 607 } 608 var timer; 609 $(window).resize(function(){ 610 clearTimeout(timer); 611 timer = setTimeout(function(){ 612 if ($(window).width() < options.breakpoint){ 613 activate(menu); 614 } 615 }, 100); 616 }); 617 break; 618 case 'useragent_custom' : 619 if (options.useragent != ''){ 620 var ua = RegExp(options.useragent, 'i'); 621 if (navigator.userAgent.match(ua)){ 622 activate(menu); 623 } 624 } 625 break; 626 case 'useragent_predefined' : 627 if (navigator.userAgent.match(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i)){ 628 activate(menu); 629 } 630 break; 631 } 632 }); 633 }; 634})(jQuery); 635;/*})'"*/;/*})'"*/ 636/* 637 * Superfish v1.4.8 - jQuery menu widget 638 * Copyright (c) 2008 Joel Birch 639 * 640 * Dual licensed under the MIT and GPL licenses: 641 * http://www.opensource.org/licenses/mit-license.php 642 * http://www.gnu.org/licenses/gpl.html 643 * 644 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt 645 */ 646/* 647 * This is not the original jQuery Supersubs plugin. 648 * Please refer to the README for more information. 649 */ 650 651(function($){ 652 $.fn.superfish = function(op){ 653 var sf = $.fn.superfish, 654 c = sf.c, 655 $arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')), 656 over = function(){ 657 var $$ = $(this), menu = getMenu($$); 658 clearTimeout(menu.sfTimer); 659 $$.showSuperfishUl().siblings().hideSuperfishUl(); 660 }, 661 out = function(){ 662 var $$ = $(this), menu = getMenu($$), o = sf.op; 663 clearTimeout(menu.sfTimer); 664 menu.sfTimer=setTimeout(function(){ 665 o.retainPath=($.inArray($$[0],o.$path)>-1); 666 $$.hideSuperfishUl(); 667 if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);} 668 },o.delay); 669 }, 670 getMenu = function($menu){ 671 var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0]; 672 sf.op = sf.o[menu.serial]; 673 return menu; 674 }, 675 addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); }; 676 677 return this.each(function() { 678 var s = this.serial = sf.o.length; 679 var o = $.extend({},sf.defaults,op); 680 o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){ 681 $(this).addClass([o.hoverClass,c.bcClass].join(' ')) 682 .filter('li:has(ul)').removeClass(o.pathClass); 683 }); 684 sf.o[s] = sf.op = o; 685 686 $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() { 687 if (o.autoArrows) addArrow( $('>a:first-child',this) ); 688 }) 689 .not('.'+c.bcClass) 690 .hideSuperfishUl(); 691 692 var $a = $('a',this); 693 $a.each(function(i){ 694 var $li = $a.eq(i).parents('li'); 695 $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);}); 696 }); 697 o.onInit.call(this); 698 699 }).each(function() { 700 var menuClasses = [c.menuClass]; 701 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); 702 $(this).addClass(menuClasses.join(' ')); 703 }); 704 }; 705 706 var sf = $.fn.superfish; 707 sf.o = []; 708 sf.op = {}; 709 sf.IE7fix = function(){ 710 var o = sf.op; 711 if ($.browser.msie && $.browser.version >
vendor: 7,803 bytes, lines 711-824
711 6 && o.dropShadows && o.animation.opacity!=undefined) 712 this.toggleClass(sf.c.shadowClass+'-off'); 713 }; 714 sf.c = { 715 bcClass: 'sf-breadcrumb', 716 menuClass: 'sf-js-enabled', 717 anchorClass: 'sf-with-ul', 718 arrowClass: 'sf-sub-indicator', 719 shadowClass: 'sf-shadow' 720 }; 721 sf.defaults = { 722 hoverClass: 'sfHover', 723 pathClass: 'overideThisToUse', 724 pathLevels: 1, 725 delay: 800, 726 animation: {opacity:'show'}, 727 speed: 'normal', 728 autoArrows: true, 729 dropShadows: true, 730 disableHI: false, // true disables hoverIntent detection 731 onInit: function(){}, // callback functions 732 onBeforeShow: function(){}, 733 onShow: function(){}, 734 onHide: function(){} 735 }; 736 $.fn.extend({ 737 hideSuperfishUl : function(){ 738 var o = sf.op, 739 not = (o.retainPath===true) ? o.$path : ''; 740 o.retainPath = false; 741 var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass) 742 .find('>ul').addClass('sf-hidden'); 743 o.onHide.call($ul); 744 return this; 745 }, 746 showSuperfishUl : function(){ 747 var o = sf.op, 748 sh = sf.c.shadowClass+'-off', 749 $ul = this.addClass(o.hoverClass) 750 .find('>ul.sf-hidden').hide().removeClass('sf-hidden'); 751 sf.IE7fix.call($ul); 752 o.onBeforeShow.call($ul); 753 $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); }); 754 return this; 755 } 756 }); 757})(jQuery); 758;/*})'"*/;/*})'"*/ 759/* 760 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 761 * 762 * Uses the built in easing capabilities added In jQuery 1.1 763 * to offer multiple easing options 764 * 765 * TERMS OF USE - EASING EQUATIONS 766 * 767 * Open source under the BSD License. 768 * 769 * Copyright ÐâЩ 2001 Robert Penner 770 * All rights reserved. 771 * 772 * TERMS OF USE - jQuery Easing 773 * 774 * Open source under the BSD License. 775 * 776 * Copyright ÐâЩ 2008 George McGinley Smith 777 * All rights reserved. 778 * 779 * Redistribution and use in source and binary forms, with or without modification, 780 * are permitted provided that the following conditions are met: 781 * 782 * Redistributions of source code must retain the above copyright notice, this list of 783 * conditions and the following disclaimer. 784 * Redistributions in binary form must reproduce the above copyright notice, this list 785 * of conditions and the following disclaimer in the documentation and/or other materials 786 * provided with the distribution. 787 * 788 * Neither the name of the author nor the names of contributors may be used to endorse 789 * or promote products derived from this software without specific prior written permission. 790 * 791 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 792 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 793 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 794 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 795 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 796 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 797 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 798 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 799 * OF THE POSSIBILITY OF SUCH DAMAGE. 800 * 801*/ 802jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}}); 803;/*})'"*/;/*})'"*/ 804/* 805 * Supersubs v0.2b - jQuery plugin 806 * Copyright (c) 2008 Joel Birch 807 * 808 * Dual licensed under the MIT and GPL licenses: 809 * http://www.opensource.org/licenses/mit-license.php 810 * http://www.gnu.org/licenses/gpl.html 811 * 812 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of 813 * their longest list item children. If you use this, please expect bugs and report them 814 * to the jQuery Google Group with the word 'Superfish' in the subject line. 815 * 816 */ 817/* 818 * This is not the original jQuery Supersubs plugin. 819 * Please refer to the README for more information. 820 */ 821 822(function($){ // $ will refer to jQuery within this closure 823 $.fn.supersubs = function(options){ 824 var opts = $.extend({}, $.fn.supersubs.defaults, options);
825 // return original object to support chaining 826 return this.each(function() { 827 // cache selections 828 var $$ = $(this); 829 // support metadata 830 var o = $.meta ? $.extend({}, opts, $$.data()) : opts; 831 // get the font size of menu. 832 // .css('fontSize') returns various results cross-browser, so measure an em dash instead 833 var fontsize = $('<li id="menu-fontsize">—</li>').css({ 834 'padding' : 0, 835 'position' : 'absolute', 836 'top' : '-99999em', 837 'width' : 'auto' 838 }).appendTo($$).width(); //clientWidth is faster, but was incorrect here 839 // remove em dash 840 $('#menu-fontsize').remove(); 841 842 // Jump on level if it's a "NavBar" 843 if ($$.hasClass('sf-navbar')) { 844 $$ = $('li > ul', $$); 845 } 846 // cache all ul elements 847 $ULs = $$.find('ul:not(.sf-megamenu)'); 848 // loop through each ul in menu 849 $ULs.each(function(i) { 850 // cache this ul 851 var $ul = $ULs.eq(i); 852 // get all (li) children of this ul 853 var $LIs = $ul.children(); 854 // get all anchor grand-children 855 var $As = $LIs.children('a'); 856 // force content to one line and save current float property 857 var liFloat = $LIs.css('white-space','nowrap').css('float'); 858 // remove width restrictions and floats so elements remain vertically stacked 859 var emWidth = $ul.add($LIs).add($As).css({ 860 'float' : 'none', 861 'width' : 'auto' 862 }) 863 // this ul will now be shrink-wrapped to longest li due to position:absolute 864 // so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer 865 .end().end()[0].clientWidth / fontsize; 866 // add more width to ensure lines don't turn over at certain sizes in various browsers 867 emWidth += o.extraWidth; 868 // restrict to at least minWidth and at most maxWidth 869 if (emWidth > o.maxWidth) { emWidth = o.maxWidth; } 870 else if (emWidth < o.minWidth) { emWidth = o.minWidth; } 871 emWidth += 'em'; 872 // set ul to width in ems 873 $ul.css('width',emWidth); 874 // restore li floats to avoid IE bugs 875 // set li width to full width of this ul 876 // revert white-space to normal 877 $LIs.css({ 878 'float' : liFloat, 879 'width' : '100%', 880 'white-space' : 'normal' 881 }) 882 // update offset position of descendant ul to reflect new width of parent 883 .each(function(){ 884 var $childUl = $('>ul',this); 885 var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right'; 886 $childUl.css(offsetDirection,emWidth); 887 }); 888 }); 889 }); 890 }; 891 // expose defaults 892 $.fn.supersubs.defaults = { 893 minWidth: 9, // requires em unit. 894 maxWidth: 25, // requires em unit. 895 extraWidth: 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values 896 }; 897})(jQuery); // plugin code ends 898;/*})'"*/;/*})'"*/ 899/** 900 * @file 901 * The Superfish Drupal Behavior to apply the Superfish jQuery plugin to lists. 902 */ 903 904(function ($) { 905 Drupal.behaviors.superfish = { 906 attach: function (context, settings) { 907 // Take a look at each list to apply Superfish to. 908 $.each(settings.superfish || {}, function(index, options) { 909 // Process all Superfish lists. 910 $('#superfish-' + options.id, context).once('superfish', function() { 911 var list = $(this); 912 913 // Check if we are to apply the Supersubs plug-in to it. 914 if (options.plugins || false) { 915 if (options.plugins.supersubs || false) { 916 list.supersubs(options.plugins.supersubs); 917 } 918 } 919 920 // Apply Superfish to the list. 921 list.superfish(options.sf); 922 923 // Check if we are to apply any other plug-in to it. 924 if (options.plugins || false) { 925 if (options.plugins.touchscreen || false) { 926 list.sftouchscreen(options.plugins.touchscreen); 927 } 928 if (options.plugins.smallscreen || false) { 929 list.sfsmallscreen(options.plugins.smallscreen); 930 } 931 if (options.plugins.supposition || false) { 932 list.supposition(); 933 } 934 if (options.plugins.bgiframe || false) { 935 list.find('ul').bgIframe({opacity:false}); 936 } 937 } 938 }); 939 }); 940 } 941 }; 942})(jQuery); 943;/*})'"*/;/*})'"*/ 944/** 945 * theme948 javascript core 946 * 947 * - Provides frequently used extensions to base javascript objects 948 * - jQuery browser detection tweak 949 * - Define functions used in events 950 */ 951 952// Add String.trim() method 953String.prototype.trim = function() { 954 return this.replace(/\s+$/, '').replace(/^\s+/, ''); 955} 956 957// Add Array.indexOf() method 958if (!Array.prototype.indexOf) { 959 Array.prototype.indexOf = function (obj, fromIndex) { 960 if (fromIndex == null) { 961 fromIndex = 0; 962 } else if (fromIndex < 0) { 963 fromIndex = Math.max(0, this.length + fromIndex); 964 } 965 966 for (var i = fromIndex, j = this.length; i < j; i++) { 967 if (this[i] === obj) { 968 return i; 969 } 970 } 971 return -1; 972 }; 973} 974 975// jQuery Browser Detect Tweak For IE7
976jQuery.browser.version = jQuery.browser.msie && parseInt(jQuery.browser.version) == 6 && window["XMLHttpRequest"] ? "7.0" : jQuery.browser.version; 977 978// Console.log wrapper to avoid errors when firebug is not present 979// usage: log('inside coolFunc', this, arguments); 980// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ 981window.log = function() { 982 log.history = log.history || []; // store logs to an array for reference 983 log.history.push(arguments); 984 if (this.console) { 985 console.log(Array.prototype.slice.call(arguments)); 986 } 987}; 988 989// init object 990var theme948 = theme948 || {}; 991 992/** 993 * Image handling functions 994 */ 995theme948.image = { _cache : [] }; 996 997// preload images 998theme948.image.preload = function() { 999 for (var i = arguments.length; i--;) { 1000 var cacheImage = document.createElement('img'); 1001 cacheImage.src = arguments[i]; 1002 theme948.image._cache.push(cacheImage); 1003 } 1004} 1005;/*})'"*/;/*})'"*/ 1006jQuery(window).bind('load', function() { 1007 jQuery('.foreground').toggle('slow'); 1008}); 1009 1010jQuery(function() { 1011 jQuery('.isotope-element .views-field-field-portfolio-image a').hover(function() { 1012 jQuery(this).find('img').stop().animate({opacity:'.6'}) 1013 }, 1014 1015 function() { 1016 jQuery(this).find('img').stop().animate({opacity:'1'}) 1017 }) 1018 /* 1019 if (jQuery('html').hasClass('desktop')) { 1020 jQuery.srSmoothscroll({ 1021 step: 150, 1022 speed: 800 1023 }); 1024 }*/ 1025}); 1026 1027(function($) { 1028 jQuery(document).ready(function($) { 1029 if (jQuery(".portfolio-grid").length) { 1030 var $container = jQuery('#isotope-container'), 1031 filters = {}, 1032 items_count = jQuery(".isotope-element").size(); 1033 1034 $container.imagesLoaded( function() { 1035 setColumnWidth(); 1036 $container.isotope({ 1037 itemSelector : '.isotope-element', 1038 resizable : false, 1039 transformsEnabled : true, 1040 layoutMode : 'fitRows', 1041 }); 1042 }); 1043 1044 function getNumColumns() { 1045 var $folioWrapper = jQuery('#isotope-container').data('cols'); 1046 1047 if ($folioWrapper == '1col') { 1048 var winWidth = jQuery("#isotope-container").width(), 1049 column = 1; 1050 return column; 1051 } 1052 1053 else if ($folioWrapper == '2cols') { 1054 var winWidth = jQuery("#isotope-container").width(), 1055 column = 2; 1056 if (winWidth < 380) { 1057 column = 1; 1058 } 1059 return column; 1060 } 1061 1062 else if ($folioWrapper == '3cols') { 1063 var winWidth = jQuery("#isotope-container").width(), 1064 column = 3; 1065 if (winWidth < 380) { 1066 column = 1; 1067 } 1068 else if ((winWidth >= 380) && (winWidth < 788)) { 1069 column = 2; 1070 } 1071 else if (winWidth >= 788) { 1072 column = 3; 1073 } 1074 return column; 1075 } 1076 1077 else if ($folioWrapper == '4cols') { 1078 var winWidth = jQuery("#isotope-container").width(), 1079 column = 4; 1080 if (winWidth < 380) { 1081 column = 1; 1082 } 1083 else if ((winWidth >= 380) && (winWidth < 788)) { 1084 column = 2; 1085 } 1086 else if ((winWidth >= 788) && (winWidth < 940)) { 1087 column = 3; 1088 } 1089 else if (winWidth >= 940) { 1090 column = 4; 1091 } 1092 return column; 1093 } 1094 } 1095 1096 function setColumnWidth() { 1097 var columns = getNumColumns(), 1098 containerWidth = jQuery("#isotope-container").width(), 1099 postWidth; 1100 1101 if (columns == 1) { 1102 postWidth = containerWidth - 20; 1103 } 1104 if (columns == 2) { 1105 postWidth = (containerWidth - 40)/columns; 1106 } 1107 if (columns == 3) { 1108 postWidth = (containerWidth - 60)/columns; 1109 } 1110 if (columns == 4) { 1111 postWidth = (containerWidth - 80)/columns; 1112 } 1113 1114 postWidth = Math.floor(postWidth); 1115 1116 jQuery(".isotope-element").each(function(index) { 1117 jQuery(this).css({"width" : postWidth + "px"}); 1118 }); 1119 } 1120 1121 function arrange() { 1122 setColumnWidth(); 1123 $container.isotope('reLayout'); 1124 } 1125 1126 jQuery(window).on("debouncedresize", function(event) { 1127 arrange(); 1128 }); 1129 }; 1130 1131 if ($.cookie('the_cookie') == 0) { 1132 styleSwitch(0) 1133 } 1134 1135 function styleSwitch(cookie) { 1136 if (cookie == 0) { 1137 $('#style-mobile').remove(); 1138 $('#skeleton-mobile').remove(); 1139 $('.switcher').text("Responsive Version"); 1140 $.cookie('the_cookie', 0); 1141 } else { 1142 $('head').append('<link rel="stylesheet" href="<?php echo base_path().path_to_theme() ?>/css/style-mobile.css" media="screen" id="style-mobile">'); 1143 $('head').append('<link rel="stylesheet" href="<?php echo base_path().path_to_theme() ?>/css/skeleton-mobile.css" media="screen" id="skeleton-mobile">'); 1144 $('.switcher').text("Desktop Version only"); 1145 $.cookie('the_cookie', 1); 1146 } 1147 } 1148 1149 $('.switcher').click(function() { 1150 styleSwitch($.cookie('the_cookie') == 0 ? 1 : 0); 1151 location.reload(); 1152 }); 1153 }); 1154})(jQuery); 1155 1156jQuery(document).ready(function () { 1157 jQuery("#isotope-options .option-set li a[data-option-value='.all']").addClass("selected"); 1158 1159 /* 1160 if ((jQuery(window).width() > 995) && (jQuery('#header .stickup').length)) { 1161 jQuery('#header .stickup').tmStickUp({}); 1162 }*/ 1163 1164 // Portfolio image size 1165 jQuery('.tm-masonry-item img').each(function() { 1166 var width = jQuery(this).parents('.tm-masonry-item').width(), 1167 height = jQuery(this).parents('.tm-masonry-item').height(), 1168 h = height/width; 1169 1170 if (h > 0.5194) { 1171 jQuery(this).css({height: height, maxWidth: 'inherit'}); 1172 } else { 1173 jQuery(this).css({height: 'auto', maxWidth: '100%'}); 1174 } 1175 }) 1176 1177 // Contact form validation 1178 var my_form_id = new tFormer('contact-site-form', { 1179 fields: { 1180 name: { 1181 rules: "*" 1182 }, 1183 mail: { 1184 rules: "* @" 1185 }, 1186 subject: { 1187 rules: "*" 1188 }, 1189 message: { 1190 rules: "*" 1191 } 1192 } 1193 }); 1194 1195 // Contact form tooltips 1196 jQuery(".contact-form .form-item-name").append('<div class="error-message">This field is required!</div>'); 1197 jQuery(".contact-form .form-item-mail").append('<div class="error-message">Please enter a valid email address!</div>'); 1198 jQuery(".contact-form .form-item-subject").append('<div class="error-message">This field is required!</div>'); 1199 jQuery(".contact-form .form-item-message .form-textarea-wrapper").append('<div class="error-message">This field is required!</div>'); 1200 1201 jQuery(".contact-form input[type='reset']").on("click", function($) { 1202 jQuery(this).parents(".contact-form").find(".error").removeClass("error"); 1203 }) 1204}); 1205 1206// Tiled gallery 1207jQuery(window).bind('resize', function() { 1208 jQuery('.tm-masonry-item img').each(function() { 1209 var width = jQuery(this).parents('.tm-masonry-item').width(), 1210 height = jQuery(this).parents('.tm-masonry-item').height(), 1211 h = height/width; 1212 1213 if (h > 0.5194) { 1214 jQuery(this).css({height: height, maxWidth: 'inherit'}); 1215 } else { 1216 jQuery(this).css({height: 'auto', maxWidth: '100%'}); 1217 } 1218 }) 1219}) 1220 1221// Back to Top Button 1222jQuery(window).load(function() { 1223 /*jQuery().UItoTop({ 1224 easingType: 'easeOutQuart', 1225 containerID: 'backtotop' 1226 });*/ 1227}) 1228 1229/* 1230jQuery(window).load(function() { 1231 jQuery('#superfish-1').mobileMenu(); 1232})*/ 1233 1234//Equal height 1235jQuery.fn.equalHeights = function(minHeight, maxHeight) { 1236 tallest = (minHeight) ? minHeight : 0; 1237 this.each(function() { 1238 if (jQuery(this).height() > tallest) { 1239 tallest = jQuery(this).height() 1240 } 1241 }); 1242 if ((maxHeight) && tallest > maxHeight) { 1243 tallest = maxHeight; 1244 } 1245 return this.each(function() { 1246 jQuery(this).height(tallest) 1247 }) 1248} 1249/* 1250jQuery(window).load(function() { 1251 if (jQuery(document).width() > 767) { 1252 if (jQuery(".maxheight").length) { 1253 jQuery(".maxheight").equalHeights() 1254 } 1255 } 1256}) 1257 1258jQuery(window).resize(function(){ 1259 jQuery(".maxheight").css({height: 'auto'});
1260 if (jQuery(document).width() > 767) { 1261 if (jQuery(".maxheight").length) { 1262 jQuery(".maxheight").equalHeights() 1263 } 1264 } 1265})*/ 1266;/*})'"*/;/*})'"*/ 1267/* 1268 * debouncedresize: special jQuery event that happens once after a window resize 1269 * 1270 * latest version and complete README available on Github: 1271 * https://github.com/louisremi/jquery-smartresize 1272 * 1273 * Copyright 2012 @louis_remi 1274 * Licensed under the MIT license. 1275 * 1276 * This saved you an hour of work? 1277 * Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON 1278 */ 1279(function($) { 1280 var $event = $.event, 1281 $special, 1282 resizeTimeout; 1283 1284 $special = $event.special.debouncedresize = { 1285 setup: function() { 1286 $(this).on("resize", $special.handler); 1287 }, 1288 teardown: function() { 1289 $(this).off("resize", $special.handler); 1290 }, 1291 handler: function(event, execAsap) { 1292 // Save the context 1293 var context = this, 1294 args = arguments, 1295 dispatch = function() { 1296 // set correct event type 1297 event.type = "debouncedresize"; 1298 $event.dispatch.apply(context, args); 1299 }; 1300 1301 if (resizeTimeout) { 1302 clearTimeout(resizeTimeout); 1303 } 1304 1305 execAsap ? 1306 dispatch() : 1307 resizeTimeout = setTimeout( dispatch, $special.threshold ); 1308 }, 1309 threshold: 150 1310 }; 1311})(jQuery); 1312;/*})'"*/;/*})'"*/ 1313/** 1314 * jQuery Mobile Menu 1315 * Turn unordered list menu into dropdown select menu 1316 * version 1.1(27-JULY-2013) 1317 * 1318 * Built on top of the jQuery library 1319 * http://jquery.com 1320 * 1321 * Documentation 1322 * http://github.com/mambows/mobilemenu 1323 */ 1324(function($) { 1325 $.fn.mobileMenu = function(options) { 1326 var defaults = { 1327 defaultText : 'Navigate to...', 1328 className : 'select-menu', 1329 subMenuClass : 'sub-menu', 1330 subMenuDash : '–', 1331 }, 1332 settings = $.extend(defaults, options), 1333 el = $(this); 1334 1335 this.each(function(){ 1336 var $el = $(this), 1337 $select_menu; 1338 1339 // ad class to submenu list 1340 $el.find('ul').addClass(settings.subMenuClass); 1341 1342 // Create base menu 1343 var $select_menu = $('<select />', { 1344 'class' : settings.className + ' ' + el.get(0).className 1345 }).insertAfter( $el ); 1346 1347 // Create default option 1348 $('<option />', { 1349 "value" : '#', 1350 "text" : settings.defaultText 1351 }).appendTo( $select_menu ); 1352 1353 // Create select option from menu 1354 $el.find('a').each(function(){ 1355 var $this = $(this), 1356 optText = ' ' + $this.text(), 1357 optSub = $this.parents('.' + settings.subMenuClass), 1358 len = optSub.length, 1359 dash; 1360 1361 // if menu has sub menu 1362 if ($this.parents('ul').hasClass(settings.subMenuClass)) { 1363 dash = Array(len + 1).join(settings.subMenuDash); 1364 optText = dash + optText; 1365 } 1366 1367 // Now build menu and append it 1368 $('<option />', { 1369 "value" : this.href, 1370 "html" : optText, 1371 "selected" : (this.href == window.location.href) 1372 }).appendTo($select_menu); 1373 1374 }); // End el.find('a').each 1375 1376 // Change event on select element 1377 $select_menu.change(function(){ 1378 var locations = $(this).val(); 1379 if (locations !== '#') { 1380 window.location.href = $(this).val(); 1381 }; 1382 }); 1383 }); // End this.each 1384 return this; 1385 }; 1386})(jQuery); 1387;/*})'"*/;/*})'"*/ 1388/* 1389 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 1390 * 1391 * Uses the built in easing capabilities added In jQuery 1.1 1392 * to offer multiple easing options 1393 * 1394 * TERMS OF USE - jQuery Easing 1395 * 1396 * Open source under the BSD License. 1397 * 1398 * Copyright © 2008 George McGinley Smith 1399 * All rights reserved. 1400 * 1401 * Redistribution and use in source and binary forms, with or without modification, 1402 * are permitted provided that the following conditions are met: 1403 * 1404 * Redistributions of source code must retain the above copyright notice, this list of 1405 * conditions and the following disclaimer. 1406 * Redistributions in binary form must reproduce the above copyright notice, this list 1407 * of conditions and the following disclaimer in the documentation and/or other materials 1408 * provided with the distribution. 1409 * 1410 * Neither the name of the author nor the names of contributors may be used to endorse 1411 * or promote products derived from this software without specific prior written permission. 1412 * 1413 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 1414 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1415 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 1416 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 1417-1562
1417 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 1418 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 1419 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1420 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 1421 * OF THE POSSIBILITY OF SUCH DAMAGE. 1422 * 1423*/ 1424 1425// t: current time, b: begInnIng value, c: change In value, d: duration 1426jQuery.easing['jswing'] = jQuery.easing['swing']; 1427 1428jQuery.extend( jQuery.easing, 1429{ 1430 def: 'easeOutQuad', 1431 swing: function (x, t, b, c, d) { 1432 //alert(jQuery.easing.default); 1433 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 1434 }, 1435 easeInQuad: function (x, t, b, c, d) { 1436 return c*(t/=d)*t + b; 1437 }, 1438 easeOutQuad: function (x, t, b, c, d) { 1439 return -c *(t/=d)*(t-2) + b; 1440 }, 1441 easeInOutQuad: function (x, t, b, c, d) { 1442 if ((t/=d/2) < 1) return c/2*t*t + b; 1443 return -c/2 * ((--t)*(t-2) - 1) + b; 1444 }, 1445 easeInCubic: function (x, t, b, c, d) { 1446 return c*(t/=d)*t*t + b; 1447 }, 1448 easeOutCubic: function (x, t, b, c, d) { 1449 return c*((t=t/d-1)*t*t + 1) + b; 1450 }, 1451 easeInOutCubic: function (x, t, b, c, d) { 1452 if ((t/=d/2) < 1) return c/2*t*t*t + b; 1453 return c/2*((t-=2)*t*t + 2) + b; 1454 }, 1455 easeInQuart: function (x, t, b, c, d) { 1456 return c*(t/=d)*t*t*t + b; 1457 }, 1458 easeOutQuart: function (x, t, b, c, d) { 1459 return -c * ((t=t/d-1)*t*t*t - 1) + b; 1460 }, 1461 easeInOutQuart: function (x, t, b, c, d) { 1462 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 1463 return -c/2 * ((t-=2)*t*t*t - 2) + b; 1464 }, 1465 easeInQuint: function (x, t, b, c, d) { 1466 return c*(t/=d)*t*t*t*t + b; 1467 }, 1468 easeOutQuint: function (x, t, b, c, d) { 1469 return c*((t=t/d-1)*t*t*t*t + 1) + b; 1470 }, 1471 easeInOutQuint: function (x, t, b, c, d) { 1472 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 1473 return c/2*((t-=2)*t*t*t*t + 2) + b; 1474 }, 1475 easeInSine: function (x, t, b, c, d) { 1476 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 1477 }, 1478 easeOutSine: function (x, t, b, c, d) { 1479 return c * Math.sin(t/d * (Math.PI/2)) + b; 1480 }, 1481 easeInOutSine: function (x, t, b, c, d) { 1482 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 1483 }, 1484 easeInExpo: function (x, t, b, c, d) { 1485 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 1486 }, 1487 easeOutExpo: function (x, t, b, c, d) { 1488 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 1489 }, 1490 easeInOutExpo: function (x, t, b, c, d) { 1491 if (t==0) return b; 1492 if (t==d) return b+c; 1493 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 1494 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 1495 }, 1496 easeInCirc: function (x, t, b, c, d) { 1497 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 1498 }, 1499 easeOutCirc: function (x, t, b, c, d) { 1500 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 1501 }, 1502 easeInOutCirc: function (x, t, b, c, d) { 1503 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 1504 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 1505 }, 1506 easeInElastic: function (x, t, b, c, d) { 1507 var s=1.70158;var p=0;var a=c; 1508 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 1509 if (a < Math.abs(c)) { a=c; var s=p/4; } 1510 else var s = p/(2*Math.PI) * Math.asin (c/a); 1511 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 1512 }, 1513 easeOutElastic: function (x, t, b, c, d) { 1514 var s=1.70158;var p=0;var a=c; 1515 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 1516 if (a < Math.abs(c)) { a=c; var s=p/4; } 1517 else var s = p/(2*Math.PI) * Math.asin (c/a); 1518 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 1519 }, 1520 easeInOutElastic: function (x, t, b, c, d) { 1521 var s=1.70158;var p=0;var a=c; 1522 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 1523 if (a < Math.abs(c)) { a=c; var s=p/4; } 1524 else var s = p/(2*Math.PI) * Math.asin (c/a); 1525 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 1526 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 1527 }, 1528 easeInBack: function (x, t, b, c, d, s) { 1529 if (s == undefined) s = 1.70158; 1530 return c*(t/=d)*t*((s+1)*t - s) + b; 1531 }, 1532 easeOutBack: function (x, t, b, c, d, s) { 1533 if (s == undefined) s = 1.70158; 1534 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 1535 }, 1536 easeInOutBack: function (x, t, b, c, d, s) { 1537 if (s == undefined) s = 1.70158; 1538 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 1539 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 1540 }, 1541 easeInBounce: function (x, t, b, c, d) { 1542 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 1543 }, 1544 easeOutBounce: function (x, t, b, c, d) { 1545 if ((t/=d) < (1/2.75)) { 1546 return c*(7.5625*t*t) + b; 1547 } else if (t < (2/2.75)) { 1548 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 1549 } else if (t < (2.5/2.75)) { 1550 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 1551 } else { 1552 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 1553 } 1554 }, 1555 easeInOutBounce: function (x, t, b, c, d) { 1556 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 1557 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 1558 } 1559}); 1560 1561/* 1562 *
1563 * TERMS OF USE - EASING EQUATIONS 1564 * 1565 * Open source under the BSD License. 1566 * 1567 * Copyright © 2001 Robert Penner 1568 * All rights reserved. 1569 * 1570 * Redistribution and use in source and binary forms, with or without modification, 1571 * are permitted provided that the following conditions are met: 1572 * 1573 * Redistributions of source code must retain the above copyright notice, this list of 1574 * conditions and the following disclaimer. 1575 * Redistributions in binary form must reproduce the above copyright notice, this list 1576 * of conditions and the following disclaimer in the documentation and/or other materials 1577 * provided with the distribution. 1578 * 1579 * Neither the name of the author nor the names of contributors may be used to endorse 1580 * or promote products derived from this software without specific prior written permission. 1581 * 1582 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 1583 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1584 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 1585 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1586 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 1587 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 1588 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1589 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 1590 * OF THE POSSIBILITY OF SUCH DAMAGE. 1591 * 1592 */ 1593;/*})'"*/;/*})'"*/ 1594(function($) { 1595 $.fn.UItoTop = function(options) { 1596 var defaults = { 1597 text: '', 1598 min: 500, 1599 scrollSpeed: 800, 1600 containerID: 'toTop', 1601 containerHoverID: 'toTopHover', 1602 easingType: 'linear', 1603 min_width: parseInt($('body').css("min-width"),10), 1604 main_width: parseInt($('body').css("min-width"),10)/2 1605 }; 1606 1607 var settings = $.extend(defaults, options); 1608 var containerIDhash = '#' + settings.containerID; 1609 var containerHoverIDHash = '#' + settings.containerHoverID; 1610 1611 $('body').append('<a href="#" id="' + settings.containerID + '">' + settings.text + '</a>'); 1612 1613 var button_width = parseInt($(containerIDhash).css("width")) + 90 1614 var button_width_1 = parseInt($(containerIDhash).css("width")) + 20 1615 var max_width = defaults.min_width + button_width; 1616 var margin_right_1 = -(defaults.main_width + button_width_1) 1617 var margin_right_2 = -(defaults.main_width - 20) 1618 1619 function top() { 1620 if(($(window).width() <= max_width) && ($(window).width() >= defaults.min_width)) { 1621 $(containerIDhash).stop().animate({marginRight: margin_right_2, right: '50%'}); 1622 } else { 1623 if($(window).width() <= defaults.min_width) { 1624 $(containerIDhash).stop().css({marginRight: 0, right: 10}) 1625 } else { 1626 $(containerIDhash).stop().animate({marginRight: margin_right_1, right: '50%'}) 1627 } 1628 } 1629 } 1630 top() 1631 $(containerIDhash).hide().click(function() { 1632 $('html, body').stop().animate({scrollTop: 0}, settings.scrollSpeed, settings.easingType); 1633 $('#' + settings.containerHoverID, this).stop().animate({'opacity': 0}, settings.inDelay, settings.easingType); 1634 return false; 1635 }) 1636 1637 .prepend('<span id="' + settings.containerHoverID + '"></span>') 1638 .hover(function() { 1639 $(containerHoverIDHash, this).stop().animate({ 1640 'opacity': 1 1641 }, 600, 'linear'); 1642 }, function() { 1643 $(containerHoverIDHash, this).stop().animate({ 1644 'opacity': 0 1645 }, 700, 'linear'); 1646 }); 1647 1648 $(window).scroll(function() { 1649 var sd = $(window).scrollTop(); 1650 if(typeof document.body.style.maxHeight === "undefined") { 1651 $(containerIDhash).css({ 1652 'position': 'absolute', 1653 'top': $(window).scrollTop() + $(window).height() - 50 1654 }); 1655 } 1656 if (sd > settings.min) { 1657 $(containerIDhash).stop(true, true).fadeIn(600); 1658 } else { 1659 $(containerIDhash).fadeOut(800); 1660 } 1661 }); 1662 $(window).resize(function() { 1663 top() 1664 }) 1665}; 1666})(jQuery); 1667;/*})'"*/;/*})'"*/ 1668/*! 1669 * jQuery Cookie Plugin v1.4.1 1670 * https://github.com/carhartl/jquery-cookie 1671 * 1672 * Copyright 2013 Klaus Hartl 1673 * Released under the MIT license 1674 */ 1675(function (factory) { 1676 if (typeof define === 'function' && define.amd) { 1677 // AMD 1678 define(['jquery'], factory); 1679 } else if (typeof exports === 'object') { 1680 // CommonJS 1681 factory(require('jquery')); 1682 } else { 1683 // Browser globals 1684 factory(jQuery); 1685 } 1686}(function ($) { 1687 1688 var pluses = /\+/g; 1689 1690 function encode(s) { 1691 return config.raw ? s : encodeURIComponent(s); 1692 } 1693 1694 function decode(s) { 1695 return config.raw ? s : decodeURIComponent(s); 1696 } 1697 1698 function stringifyCookieValue(value) { 1699 return encode(config.json ? JSON.stringify(value) : String(value)); 1700 } 1701 1702 function parseCookieValue(s) { 1703 if (s.indexOf('"') === 0) { 1704 // This is a quoted cookie as according to RFC2068, unescape... 1705 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 1706 } 1707 1708 try { 1709 // Replace server-side written pluses with spaces. 1710 // If we can't decode the cookie, ignore it, it's unusable. 1711 // If we can't parse the cookie, ignore it, it's unusable. 1712 s = decodeURIComponent(s.replace(pluses, ' ')); 1713 return config.json ? JSON.parse(s) : s; 1714 } catch(e) {} 1715 } 1716 1717 function read(s, converter) { 1718 var value = config.raw ? s : parseCookieValue(s); 1719 return $.isFunction(converter) ? converter(value) : value; 1720 } 1721 1722 var config = $.cookie = function (key, value, options) { 1723 1724 // Write 1725 1726 if (value !== undefined && !$.isFunction(value)) { 1727 options = $.extend({}, config.defaults, options); 1728 1729 if (typeof options.expires === 'number') { 1730 var days = options.expires, t = options.expires = new Date(); 1731 t.setTime(+t + days * 864e+5); 1732 } 1733 1734 return (document.cookie = [ 1735 encode(key), '=', stringifyCookieValue(value), 1736 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 1737 options.path ? '; path=' + options.path : '', 1738 options.domain ? '; domain=' + options.domain : '', 1739 options.secure ? '; secure' : '' 1740 ].join('')); 1741 } 1742 1743 // Read 1744 1745 var result = key ? undefined : {}; 1746 1747 // To prevent the for loop in the first place assign an empty array 1748 // in case there are no cookies at all. Also prevents odd result when 1749 // calling $.cookie(). 1750 var cookies = document.cookie ? document.cookie.split('; ') : []; 1751 1752 for (var i = 0, l = cookies.length; i < l; i++) { 1753 var parts = cookies[i].split('='); 1754 var name = decode(parts.shift()); 1755 var cookie = parts.join('='); 1756 1757 if (key && key === name) { 1758 // If second argument (value) is a function it's a converter... 1759 result = read(cookie, value); 1760 break; 1761 } 1762 1763 // Prevent storing a cookie that we couldn't decode. 1764 if (!key && (cookie = read(cookie)) !== undefined) { 1765 result[name] = cookie; 1766 } 1767 } 1768 1769 return result; 1770 }; 1771 1772 config.defaults = {}; 1773 1774 $.removeCookie = function (key, options) { 1775 if ($.cookie(key) === undefined) { 1776 return false;
1777 } 1778 1779 // Must not alter options, thus extending a fresh object... 1780 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 1781 return !$.cookie(key); 1782 }; 1783 1784})); 1785;/*})'"*/;/*})'"*/ 1786(function($){ 1787 $.fn.tmStickUp = function(options){ 1788 1789 var getOptions = { 1790 correctionSelector: $('.correctionSelector') 1791 } 1792 $.extend(getOptions, options); 1793 1794 var 1795 _this = $(this), 1796 _window = $(window), 1797 _document = $(document), 1798 thisOffsetTop = 0, 1799 thisOuterHeight = 0, 1800 thisMarginTop = 0, 1801 thisPaddingTop = 0, 1802 documentScroll = 0, 1803 pseudoBlock, 1804 lastScrollValue = 0, 1805 scrollDir = '', 1806 tmpScrolled; 1807 1808 init(); 1809 function init(){ 1810 thisOffsetTop = parseInt(_this.offset().top); 1811 thisMarginTop = parseInt(_this.css("margin-top")); 1812 thisOuterHeight = parseInt(_this.outerHeight(true)); 1813 1814 $('<div class="pseudoStickyBlock"></div>').insertAfter(_this); 1815 pseudoBlock = $('.pseudoStickyBlock'); 1816 pseudoBlock.css({"position": "relative", "display": "block"}); 1817 addEventsFunction(); 1818 }//end init 1819 1820 function addEventsFunction(){ 1821 _document.on('scroll', function() { 1822 tmpScrolled = $(this).scrollTop(); 1823 if (tmpScrolled > lastScrollValue) { 1824 scrollDir = 'down'; 1825 } else { 1826 scrollDir = 'up'; 1827 } 1828 lastScrollValue = tmpScrolled; 1829 1830 correctionValue = getOptions.correctionSelector.outerHeight(true); 1831 documentScroll = parseInt(_window.scrollTop()); 1832 1833 if (thisOffsetTop - correctionValue < documentScroll) { 1834 _this.addClass('isStuck'); 1835 _this.css({position: "fixed", top: correctionValue}); 1836 pseudoBlock.css({"height": thisOuterHeight}); 1837 } else { 1838 _this.removeClass('isStuck'); 1839 _this.css({position: "relative", top: 0}); 1840 pseudoBlock.css({"height": 0}); 1841 } 1842 }).trigger('scroll'); 1843 } 1844 }//end tmStickUp function 1845})(jQuery) 1846;/*})'"*/;/*})'"*/ 1847/** 1848 * tFormer.js - empower your forms 1849 * http://tjrus.com/tFormer 1850 * (c) 2013 Vasiliy Zubach (aka TjRus) - http://tjrus.com/ 1851 * tFormer may be freely distributed under the MIT license. 1852 */ 1853 1854(function ( window, document, undefined ){ 1855 1856 // button types 1857 var BUTTON_TYPES = ['button', 'submit']; 1858 // all field types that can be empowered with tFormer 1859 var FIELD_TYPES = ['text', 'password', 'select-one', 'checkbox', 'textarea', 'range', 'number', 'email', 'hidden', 'file', 'date', 'datetime-local', 'search', 'tel', 'time', 'url', 'month', 'week']; 1860 // fields that has only 'change' event 1861 var HAS_CHANGE_EVENT = ['checkbox', 'select-one', 'select', 'file']; 1862 // fields that has also 'change' event 1863 var CHANGE_ALSO = ['number', 'date', 'datetime-local', 'time', 'month', 'week', 'range']; 1864 1865 // tFormer options 1866 var TF_OPTIONS = ['timeout', 'requestTimeout', 'errorClass', 'disabledClass', 'processingClass', 'validateEvent', 'submitButtonControl', 'submitButton', 'submit', 'before', 'onerror', 'onvalid', 'eventBefore', 'eventError', 'eventValid']; 1867 var FIELD_OPTIONS = ['timeout', 'requestTimeout', 'request', 'validClass', 'errorClass', 'disabledClass', 'processingClass', 'rules', 'validateEvent', 'before', 'onerror', 'onvalid', 'own', 'eventBefore', 'eventError', 'eventValid']; 1868 var BUTTON_OPTIONS = ['disabledClass', 'processingClass']; 1869 1870 1871 var EMPOWERED = 'empowered'; 1872 1873 var defaults = { 1874 errorClass: 'error', 1875 processingClass: 'processing', 1876 disabledClass: 'disabled', 1877 validClass: 'valid', 1878 1879 eventBefore: 'tFormer:before', 1880 eventError: 'tFormer:error', 1881 eventValid: 'tFormer:valid', 1882 1883 timeout: 0, 1884 requestTimeout: 2000, 1885 1886 validateEvent: 'input keyup', 1887 1888 fields: {}, 1889 buttons: {}, 1890 1891 submitButtonControl: true, 1892 submitButton: null 1893 }; 1894 1895 /** 1896 * Main tFormer constructor 1897 * @param form_el - our form that should be empowered 1898 * @param options - tFormer options 1899 * @returns {tFormer} 1900 */ 1901 var tFormer = function ( form_el, options ){ 1902 if ( !(this instanceof tFormer) ) { 1903 return new tFormer( form_el, options ); 1904 } 1905 1906 var self = this; 1907 // our main form DOM element 1908 self.form = (function ( form_el ){ 1909 form_el = typeof(form_el) === 'string' ? document.forms[form_el] : form_el; 1910 return __isForm( form_el ) ? form_el : null; 1911 })( form_el ); 1912 1913 var my_form = self.form; 1914 if ( self.form === null ) { 1915 return null; 1916 } 1917 1918 if ( !__getAttr( my_form, EMPOWERED ) ) { 1919 __setAttr( my_form, EMPOWERED, 1 ); 1920 __setAttr( my_form, 'novalidate', 'novalidate' ); 1921 } else { 1922 var cached = (function (){ 1923 for ( var i = 0, c_l = self.cache.length; i < c_l; i++ ) { 1924 if ( self.cache[i].form == my_form ) { 1925 return self.cache[i]; 1926 } 1927 } 1928 return null; 1929 })(); 1930 if ( cached ) { 1931 var initialized = cached.inited; 1932 cached.set( options ); 1933 return cached; 1934 } 1935 } 1936 self.config = (self.config || __clone( defaults )); 1937 self.set( options ); 1938 1939 self.init(); 1940 self.cache.push( self ); 1941 return self; 1942 }; 1943 var tf_proto = tFormer.prototype; 1944 tf_proto.cache = []; 1945 1946 1947 tf_proto.init = function (){ 1948 var self = this; 1949 if ( self.inited ) { 1950 return self; 1951 } 1952 1953 self.fields = {}; 1954 self.buttons = {}; 1955 1956 self.inited = true; 1957 1958 self.locked = 0; 1959 self.holded = 0; 1960 self.invalid = 0; 1961 self.valid = true; 1962 1963 self.fields = {}; 1964 self.buttons = {}; 1965 1966 // XHR stuff 1967 self.xhr = {}; 1968 self.xhrTimeout = {}; 1969 1970 var sb = self.get( 'submitButton' ); 1971 if ( sb ) { 1972 self.buttons['submit'] = new tButton( self, sb ); 1973 } 1974 1975 for ( var i = 0, f_l = self.form.length; i < f_l; i++ ) { 1976 var el = self.form[i], 1977 type = el.type, 1978 name = type !== 'button' ? __getAttr( el, 'name' ) : __data( el, 'check' ); 1979 1980 if ( __inArray( FIELD_TYPES, type ) !== -1 && name ) { 1981 self.fields[name] = new tField( self, el ); 1982 } 1983 1984 if ( __inArray( BUTTON_TYPES, type ) !== -1 ) { 1985 name = (type == 'submit') ? type : name;
1986 if ( name && !(name == 'submit' && self.button[name]) ) { 1987 self.buttons[name] = new tButton( self, el ); 1988 } 1989 } 1990 } 1991 1992 self.form.onsubmit = (function ( self ){ 1993 return function ( event ){ 1994 event = event || window.event; 1995 1996 var sb = self.button( 'submit' ), 1997 sb_control = self.get( 'submitButtonControl' ), 1998 s_func = typeof self.get( 'submit' ) == 'function', 1999 processing = sb.get( 'processingClass' ), 2000 prevent = self.valid && s_func; 2001 2002 // disable double submit 2003 if ( (processing && sb.hasClass( processing )) || self.locked ) { 2004 __prevent( event ); 2005 return false; 2006 } 2007 2008 if ( prevent ) { 2009 __prevent( event ); 2010 } 2011 if ( self.valid ) { 2012 if ( sb_control ) { 2013 sb.processing( true ); 2014 } 2015 if ( s_func ) { 2016 self.execute( self.form, 'submit', [event, self] ); 2017 } 2018 } 2019 if ( prevent ) { 2020 return false; 2021 } 2022 2023 try { 2024 if ( !self.valid && !self.validate( { no_timeout: true } ) ) { 2025 __prevent( event ); 2026 sb.processing( false ); 2027 return false; 2028 } 2029 2030 if ( s_func ) { 2031 __prevent( event ); 2032 self.execute( self.form, 'submit', [event, self] ); 2033 return false; 2034 } 2035 self.form.submit(); 2036 return true; 2037 2038 } catch ( e ) { 2039 } 2040 }; 2041 })( self ); 2042 2043 2044 self.validate( { 2045 highlight : false, 2046 fire_event: false, 2047 2048 silence: true 2049 } ); 2050 return self.submitControl(); 2051 }; 2052 2053 2054 tf_proto.destroy = function (){ 2055 var self = this; 2056 for ( var name in self.fields ) { 2057 self.fields[name].destroy(); 2058 } 2059 for ( var name in this.buttons ) { 2060 self.buttons[name].destroy(); 2061 } 2062 self.inited = false; 2063 return self; 2064 }; 2065 2066 // function for dropping options 2067 tf_proto.drop = function (){ 2068 var self = this, 2069 fields = self.fields, 2070 buttons = self.buttons; 2071 self.destroy(); 2072 self.set( __clone( defaults ) ); 2073 for ( var name in fields ) { 2074 fields[name].drop(); 2075 } 2076 for ( var name in buttons ) { 2077 buttons[name].drop(); 2078 } 2079 self.locked = 0; 2080 return self.init(); 2081 }; 2082 2083 tf_proto.validate = function ( options ){ 2084 var self = this, 2085 fields = self.fields, 2086 errors = 0; 2087 2088 for ( var key in fields ) { 2089 errors += (fields[key].validate( options || {} )) ? 0 : 1; 2090 } 2091 self.invalid = errors; 2092 self.valid = errors === 0; 2093 return errors === 0; 2094 }; 2095 2096 2097 tf_proto.toObject = function (){ 2098 var self = this, 2099 fields = self.form, 2100 obj = {}; 2101 2102 for ( var i = 0, f_l = fields.length; i < f_l; i++ ) { 2103 var el = fields[i], 2104 name = __getAttr( el, 'name' ); 2105 if ( el.type == 'checkbox' ) { 2106 obj[name] = el.checked; 2107 } else if ( el.type == 'radio' ) { 2108 if ( !obj[name] ) { 2109 obj[name] = ''; 2110 } 2111 if ( el.checked ) { 2112 obj[name] = el.value; 2113 } 2114 } else if (el.type !== 'submit' && el.type !== 'button'){ 2115 obj[name] = el.value; 2116 } 2117 } 2118 return obj; 2119 }; 2120 2121 tf_proto.get = function ( option ){ 2122 return this.config[option]; 2123 }; 2124 2125 tf_proto.set = function ( options ){ 2126 var self = this, 2127 is_inited = self.inited; 2128 if ( is_inited ) { 2129 self.destroy(); 2130 } 2131 self.config = __extend( self.config, options ); 2132 if ( is_inited ) { 2133 self.init(); 2134 } 2135 return self; 2136 }; 2137 2138 /** 2139 * Get field object to work with 2140 * @param {string} name - field name 2141 * @returns {*} - field Object 2142 */ 2143 tf_proto.field = function ( name ){ 2144 return this.fields[name]; 2145 }; 2146 2147 /** 2148 * Get button object to work with 2149 * @param {string} name - button name 2150 * @returns {*} - button Object 2151 */ 2152 tf_proto.button = function ( name ){ 2153 return this.buttons[name]; 2154 }; 2155 2156 /** 2157 * Rewrite default form submit function with current one 2158 * (default HTML form submit function will be prevented) 2159 * @param {function} func - function that should be executed on form submit 2160 * @returns {*} 2161 */ 2162 tf_proto.submit = function ( func ){ 2163 var self = this; 2164 if ( !self.config ) { 2165 return self; 2166 } 2167 if ( typeof func == 'function' ) { 2168 self.config.submit = func; 2169 } 2170 return self; 2171 }; 2172 2173 /** 2174 * Form Submit button control function 2175 * (enabling/disabling while validating) 2176 * @param {!boolean} valid - is current form valid or not? 2177 * @returns {*} 2178 */ 2179 tf_proto.submitControl = function ( valid ){ 2180 var self = this, 2181 sb = self.button( 'submit' ), 2182 sb_control = self.get( 'submitButtonControl' ); 2183 2184 self.valid = (self.invalid === 0 && self.holded === 0 && self.locked === 0); 2185 valid = (valid === false || valid === true) ? valid : self.valid; 2186 2187 if ( sb && sb_control ) { 2188 sb[(valid) ? 'enable' : 'disable'](); 2189 } 2190 return self; 2191 }; 2192 /** 2193 * Submit button disable 2194 * @returns {*} 2195 */ 2196 tf_proto.submitDisable = function (){ 2197 return this.submitControl( false ); 2198 }; 2199 /** 2200 * Submit button enable 2201 * @returns {*} 2202 */ 2203 tf_proto.submitEnable = function (){ 2204 return this.submitControl( true ); 2205 }; 2206 2207 /** 2208 * Submit button processing control 2209 * @returns {*} 2210 */ 2211 tf_proto.processing = function ( action ){ 2212 var self = this, 2213 sb = self.button( 'submit' ); 2214 if ( sb ) { 2215 sb.processing( action ); 2216 } 2217 return self; 2218 }; 2219 2220 /** 2221 * Lock form 2222 * @returns {*} 2223 */ 2224 tf_proto.lock = function ( num ){ 2225 var self = this; 2226 self.locked += num || 1; 2227 return self.submitControl( false ); 2228 }; 2229 2230 /** 2231 * Unlock form 2232 * @returns {*} 2233 */ 2234 tf_proto.unlock = function ( num ){ 2235 var self = this; 2236 self.locked -= num || 1; 2237 return self.submitControl(); 2238 }; 2239 2240 /** 2241 * Execute function 2242 * @param context 2243 * @param func 2244 * @param params 2245 * @returns {*} 2246 */ 2247 tf_proto.execute = function ( context, func, params ){ 2248 var self = this; 2249 if ( typeof func == 'string' ) { 2250 func = self.get( func ); 2251 } 2252 if ( typeof func == 'function' ) { 2253 return func.apply( context, (params || []) ); 2254 } 2255 return null; 2256 }; 2257 2258 window.tFormer = tFormer; 2259 2260 2261 /** 2262 * Form element constructor 2263 * @returns {*} 2264 * @constructor 2265 */ 2266 var Element = function (){ 2267 }; 2268 var El_p = Element.prototype; 2269 El_p.destroy = function (){ 2270 var self = this, 2271 el = this.el, 2272 events = self.events; 2273 2274 for ( var i = 0, e_l = events.length; i < e_l; i++ ) { 2275 self.off( events[0][0], events[0][1] ); 2276 } 2277 2278 self.removeClass( self.get( 'errorClass' ) ); 2279 self.removeClass( self.get( 'desabledClass' ) ); 2280 self.removeClass( self.get( 'processignClass' ) ); 2281 2282 __data( el, 'holded', null ); 2283 __data( el, 'error', null ); 2284 // remove hold attributes 2285 2286 if ( self.timer ) { 2287 clearTimeout( self.timer ); 2288 } 2289 if ( self.xhr ) { 2290 self.xhr.abort(); 2291 } 2292 if ( self.xhrTimeout ) { 2293 clearTimeout( self.xhrTimeout ); 2294 } 2295 2296 if ( !self.valid ) {
2297 self.parent.invalid = self.parent.invalid !== 0 ? self.parent.invalid - 1 : 0; 2298 } 2299 2300 self.parent.submitControl(); 2301 2302 self.inited = false; 2303 return self; 2304 }; 2305 2306 El_p.drop = function (){ 2307 return this.set( __clone( defaults ) ); 2308 }; 2309 2310 El_p.set = function ( options ){ 2311 var self = this, 2312 name = __getAttr( self.el, 'name' ), 2313 _set = function ( key, value ){ 2314 self.config[key] = value; 2315 if ( !self.parent.config.fields[name] ) { 2316 self.parent.config.fields[name] = __clone( defaults ); 2317 } 2318 self.parent.config.fields[name][key] = value; 2319 }, 2320 is_inited = self.inited; 2321 2322 if ( is_inited ) { 2323 self.destroy(); 2324 } 2325 for ( var key in options ) { 2326 if ( ~__inArray( FIELD_OPTIONS, key ) ) { 2327 _set( key, options[key] ); 2328 } 2329 } 2330 if ( is_inited ) { 2331 self.init(); 2332 } 2333 return self; 2334 }; 2335 2336 El_p.get = function ( option ){ 2337 return this.config[option]; 2338 }; 2339 2340 /** 2341 * subscribe this.el to some event 2342 * @param {string} evnt - event name 2343 * @param {function} func - function that should be executed on event 2344 * @param {object} el - element to attach event 2345 * @returns {*} 2346 */ 2347 El_p.on = function ( evnt, func, el ){ 2348 var self = this, 2349 el = el || self.el, 2350 events = evnt.split( ' ' ); 2351 2352 for ( var i = 0, e_l = events.length; i < e_l; i++ ) { 2353 if ( el.addEventListener ) { // W3C DOM 2354 el.addEventListener( events[i], func, false ); 2355 } else if ( el.attachEvent ) { // IE DOM 2356 el.attachEvent( "on" + events[i], func ); 2357 } else { // No much to do 2358 el[events[i]] = func; 2359 } 2360 self.events.push( [events[i], func] ); 2361 } 2362 return self; 2363 }; 2364 2365 /** 2366 * unsubscribe this.el (Button || Field) from some event 2367 * @param {string} evnt - event name 2368 * @param {function} func - function that should be executed on event 2369 * @returns {*} 2370 */ 2371 El_p.off = function ( evnt, func ){ 2372 var self = this, 2373 el = self.el, 2374 events = self.events; 2375 2376 evnt = evnt.split( ' ' ); 2377 if ( !func ) { 2378 for ( var i = 0, e_l = events.length; i < e_l; i++ ) { 2379 if ( __inArray( evnt, events[i][0] ) !== -1 ) { 2380 events.splice( i, 1 ); 2381 } 2382 } 2383 return self; 2384 } 2385 2386 if ( el.removeEventListener ) { // W3C DOM 2387 el.removeEventListener( evnt, func, false ); 2388 } else if ( el.detachEvent ) { // IE DOM 2389 el.detachEvent( "on" + evnt, func ); 2390 } else { // No much to do 2391 el[evnt] = null; 2392 } 2393 2394 for ( var i = 0, e_l = events.length; i < e_l; i++ ) { 2395 if ( __inArray( evnt, events[i][0] ) !== -1 && events[i][1] == func ) { 2396 events.splice( i, 1 ); 2397 return self; 2398 } 2399 } 2400 return self; 2401 }; 2402 2403 /** 2404 * fire some event for this.field 2405 * @param {string} evnt - event name 2406 * @returns {*} 2407 */ 2408 El_p.trigger = function ( evnt ){ 2409 var self = this, 2410 el = self.el, 2411 evt; 2412 2413 if ( self.silence ) { 2414 return; 2415 } 2416 2417 try {// every browser except IE8 and below works here 2418 evt = document.createEvent( "HTMLEvents" ); 2419 evt.initEvent( evnt, true, true ); 2420 return !el.dispatchEvent( evt ); 2421 } catch ( err ) { 2422 try { 2423 return el.fireEvent( 'on' + evnt ); 2424 } catch ( error ) { 2425 } 2426 } 2427 return self; 2428 }; 2429 2430 2431 El_p.addClass = function ( new_class ){ 2432 var self = this, 2433 el = self.el, 2434 class_names = el.className.split( ' ' ) || []; 2435 2436 if ( __inArray( class_names, new_class ) === -1 ) { 2437 class_names.push( new_class ); 2438 class_names = __clear( class_names ); 2439 el.className = (class_names.length > 0) ? class_names.join( ' ' ) : ''; 2440 } 2441 return self; 2442 }; 2443 2444 El_p.removeClass = function ( old_class ){ 2445 var self = this, 2446 el = self.el; 2447 2448 if ( self.hasClass( old_class ) ) { 2449 var re = new RegExp( '(\\s|^)' + old_class + '(\\s|$)' ); 2450 el.className = el.className.replace( re, ' ' ); 2451 } 2452 return self; 2453 } 2454 2455 El_p.hasClass = function ( name ){ 2456 return !!((~(' ' + this.el.className + ' ').indexOf( ' ' + name + ' ' ))); 2457 }; 2458 2459 El_p.data = function ( attr, value ){ 2460 var self = this, 2461 el = self.el, 2462 result = __data( el, attr, value ); 2463 2464 if ( value === undefined ) { 2465 return result; 2466 } 2467 return self; 2468 }; 2469 2470 El_p.attr = function ( attr, value ){ 2471 var self = this, 2472 el = self.el; 2473 switch ( value ) { 2474 case null: 2475 __delAttr( el, attr ); 2476 break; 2477 case undefined: 2478 return __getAttr( el, attr ); 2479 break; 2480 default: 2481 __setAttr( el, attr, value ); 2482 break; 2483 } 2484 }; 2485 2486 El_p.processing = function ( action ){ 2487 var self = this, 2488 processingClass = self.get( 'processingClass' ), 2489 is_processing = self.hasClass( processingClass ); 2490 2491 if ( action === false || (action === null && is_processing) ) { 2492 self.removeClass( processingClass ); 2493 } else if ( action === true || (action === null && is_processing) ) { 2494 self.addClass( processingClass ); 2495 } 2496 return this; 2497 }; 2498 2499 2500 /** extent subclass with superclass prototype */ 2501 var __extend_proto = function ( Child, Parent ){ 2502 var F = function (){ 2503 } 2504 F.prototype = Parent.prototype 2505 Child.prototype = new F() 2506 Child.prototype.constructor = Child 2507 Child.superclass = Parent.prototype 2508 }; 2509 2510 2511 var tField = function ( parent, el ){ 2512 var self = this, 2513 type = el.type, 2514 name, rules, 2515 attr_required, attr_min, attr_max, 2516 rules2add = [], 2517 config; 2518 2519 self.parent = parent; 2520 self.el = el; 2521 self.config = {}; 2522 2523 self.events = []; 2524 name = self.attr( 'name' ); 2525 attr_required = self.attr( 'required' ) !== null; 2526 attr_min = self.attr( 'min' ); 2527 attr_max = self.attr( 'max' ); 2528 2529 config = parent.config.fields ? parent.config.fields[name] : {}; 2530 if ( typeof config == 'string' ) { 2531 config = { 2532 rules: config 2533 }; 2534 } 2535 self.set( __extend( __clone( parent.config ), __clone( config ) ) ); 2536 self.config.rules = self.config.rules || self.data( 'rules' ); 2537 2538 if ( attr_required ) { 2539 rules2add.push( '*' ); 2540 } 2541 2542 if ( type == 'email' ) { 2543 rules2add.push( '@' ); 2544 } 2545 2546 if ( type == 'url' ) { 2547 rules2add.push( 'url' ); 2548 } 2549 2550 if ( type == 'number' ) { 2551 rules2add.push( 'num' ) 2552 2553 if ( attr_min !== null ) { 2554 rules2add.push( '>' + attr_min ); 2555 } 2556 if ( attr_max !== null ) { 2557 rules2add.push( '<' + attr_max ); 2558 } 2559 } 2560 2561 2562 if ( rules2add.length > 0 ) { 2563 self.config.rules = _v_( '' ).rules( self.config.rules || self.data( 'rules' ) ).addRule( rules2add.join( ' ' ) ).rule; 2564 } 2565 2566 self.value = el.value; 2567 2568 // validate after init 2569 self.validationStart = 'v_start'; 2570 self.validationSuccess = 'v_success'; 2571 self.validationError = 'v_error'; 2572 2573 self.highlight = true; 2574 self.fire_event = true; 2575 self.silence = false;
2576 2577 return self.init(); 2578 }; 2579 __extend_proto( tField, Element ); 2580 var tField_p = tField.prototype; 2581 2582 tField_p.init = function (){ 2583 var self = this, 2584 field = self.el, 2585 value = field.value, 2586 type = self.attr( 'type' ), 2587 is_checkbox = type == 'checkbox'; 2588 2589 if ( self.inited ) { 2590 return self; 2591 } 2592 2593 self.events = []; 2594 2595 self.valid = true; 2596 self.holded = false; 2597 2598 self.value = value; 2599 2600 // adding validate event to the field; 2601 var validate_event = self.get( 'validateEvent' ); 2602 2603 if ( ~__inArray( CHANGE_ALSO, type ) && validate_event.indexOf( 'change' ) === -1 ) { 2604 validate_event = validate_event.split( ' ' ); 2605 validate_event.push( 'change' ); 2606 validate_event = validate_event.join( ' ' ); 2607 } 2608 if ( ~__inArray( HAS_CHANGE_EVENT, type ) ) { 2609 validate_event = 'change'; 2610 } 2611 2612 self.set( { 2613 validateEvent: validate_event 2614 } ); 2615 2616 self.on( validate_event, function (){ 2617 if ( !self.get( 'rules' ) ) { 2618 return; 2619 } 2620 if ( self.value != self.el.value || is_checkbox ) { 2621 self.value = self.el.value; 2622 2623 // clear field before validation 2624 self.removeClass( self.get( 'errorClass' ) ); 2625 self.removeClass( self.get( 'processingClass' ) ); 2626 2627 // disable submit button before validation 2628 self.parent.invalid += (self.valid) ? 1 : 0; 2629 self.valid = false; 2630 self.removeClass( self.get( 'errorClass' ) ); 2631 self.parent.submitControl(); 2632 2633 var timeout = self.get( 'timeout' ); 2634 if ( self.get( 'timeout' ) > 0 ) { 2635 if ( self.timer ) { 2636 clearTimeout( self.timer ); 2637 } 2638 self.timer = setTimeout( function (){ 2639 self.validate(); 2640 }, timeout ); 2641 } else { 2642 self.validate(); 2643 } 2644 } 2645 } ); 2646 2647 2648 if ( self.hasRules( '=#' ) ) { 2649 var self_v_ = _v_().rules( self.config.rules ), 2650 depended_id = self_v_.parsedRules['=#'], 2651 el = document.getElementById( depended_id ); 2652 2653 if ( el ) { 2654 self.on( 'input keyup', function ( e ){ 2655 self.validate( { 2656 highlight: !!self.value 2657 } ); 2658 }, el ) 2659 } 2660 } 2661 2662 // blur validation without timeout 2663 if ( !~validate_event.indexOf( 'blur' ) && validate_event !== 'change' ) { 2664 self.on( 'blur', function (){ 2665 if ( !self.get( 'rules' ) ) { 2666 return; 2667 } 2668 if ( self.timer ) { 2669 clearTimeout( self.timer ); 2670 } 2671 if ( !(self.valid && self.hasRules( 'request' ) ) ) { 2672 self.validate( { 2673 no_timeout: true 2674 } ); 2675 } 2676 } ); 2677 } 2678 2679 self.validate( { silence: true } ); 2680 2681 self.inited = true; 2682 return self; 2683 }; 2684 tField_p.setRules = function ( rules, options ){ 2685 var self = this; 2686 self.set( { 2687 rules: rules 2688 }, options ); 2689 self.validate( options ); 2690 return self; 2691 }; 2692 2693 tField_p.hasRules = function ( rules ){ 2694 return _v_().rules( this.get( 'rules' ) ).hasRule( rules ); 2695 }; 2696 2697 tField_p.addRules = function ( rules, options ){ 2698 var self = this; 2699 return self.setRules( _v_().rules( self.get( 'rules' ) ).addRule( rules ).rule, options ); 2700 }; 2701 2702 tField_p.delRule = function ( rules, options ){ 2703 var self = this; 2704 return self.setRules( _v_().rules( self.get( 'rules' ) ).delRule( rules ).rule, options ); 2705 }; 2706 2707 /** 2708 * Highlight field with errorClass 2709 * @param valid 2710 * @returns {*} 2711 */ 2712 tField_p.error = function ( valid ){ 2713 var self = this; 2714 self.valid = (!valid) ? true : false; 2715 2716 if ( !self.highlight && !self.valid ) { 2717 return this; 2718 } 2719 2720 var field = self.el, 2721 errorClass = self.get( 'errorClass' ); 2722 2723 if ( self.valid ) { 2724 self.removeClass( errorClass ); 2725 self.data( 'error', null ); 2726 } else { 2727 self.addClass( errorClass ); 2728 self.data( 'error', '1' ); 2729 } 2730 return self; 2731 }; 2732 2733 /** 2734 * Hold field for a while 2735 * @param {!boolean} hold 2736 * @returns {*} 2737 */ 2738 tField_p.hold = function ( hold ){ 2739 var self = this, 2740 is_holded = self.data( 'holded' ); 2741 2742 if ( hold === undefined ) { 2743 self.holded = !self.holded; 2744 } else { 2745 self.holded = (hold === true) ? true : false 2746 } 2747 self.data( 'holded', (self.holded ? 1 : null) ); 2748 if ( !is_holded && self.holded === true ) { 2749 self.parent.holded++; 2750 } else if ( is_holded && self.holded === false ) { 2751 self.parent.holded--; 2752 } 2753 self.parent.submitControl(); 2754 return self; 2755 }; 2756 2757 /** 2758 * Here is the main field validation process 2759 * @param {object} options 2760 * @returns {boolean} 2761 */ 2762 tField_p.validate = function ( options ){ 2763 var self = this, 2764 field = self.el, 2765 type = self.attr( 'type' ), 2766 result = true, 2767 own = self.get( 'own' ), 2768 request = self.get( 'request' ), 2769 rules = self.get( 'rules' ), 2770 _v_check = _v_( self.el.value || '' ).rules( rules ), 2771 is_checkbox = type == 'checkbox', 2772 is_required = _v_check.hasRule( '*' ); 2773 2774 if ( !rules ) { 2775 return result; 2776 } 2777 2778 options = options || {}; 2779 self.silence = (options.silence === true) ? true : false;
2780 2781 self.highlight = (options.highlight === false || options.silence === true) ? false : true; 2782 self.fire_event = (options.fire_event === false || options.silence === true) ? false : true; 2783 2784 if ( !self.silence ) { 2785 self.execute( 'before' ); 2786 self.trigger( self.get( 'eventBefore' ) ); 2787 self.trigger( self.validationStart ); 2788 } 2789 2790 if ( typeof own == 'function' ) { 2791 result = own.call( self.el ); 2792 } else { 2793 if ( is_checkbox ) { 2794 var is_checked = field.checked; 2795 if ( !is_checked && is_required ) { 2796 result = false; 2797 } 2798 } else { 2799 // check request validation 2800 if ( is_required || self.el.value.length > 0 ) { 2801 result = _v_check.validate(); 2802 } 2803 2804 if ( request && result ) { 2805 self.requestValidate( options ); 2806 self.highlight = true; 2807 return null; 2808 } 2809 } 2810 } 2811 2812 if ( result ) { 2813 self.__validationSuccess(); 2814 } else { 2815 self.__validationError(); 2816 } 2817 2818 self.highlight = true; 2819 self.fire_event = true; 2820 self.silence = false; 2821 return result; 2822 }; 2823 2824 tField_p.__validationStart = function (){ 2825 2826 }; 2827 2828 tField_p.__validationError = function (){ 2829 var self = this; 2830 self.trigger( self.get( 'eventError' ) ); 2831 self.parent.invalid += (self.valid) ? 1 : 0; 2832 self.parent.submitControl(); 2833 self.error( true ); 2834 self.execute( 'onerror' ); 2835 }; 2836 tField_p.__validationSuccess = function (){ 2837 var self = this; 2838 self.trigger( self.get( 'eventValid' ) ); 2839 self.parent.invalid -= (!self.valid) ? 1 : 0; 2840 self.parent.submitControl(); 2841 self.error( false ); 2842 self.execute( 'onvalid' ); 2843 }; 2844 2845 2846 tField_p.requestValidate = function ( options ){ 2847 2848 var self = this, 2849 name = self.attr( 'name' ), 2850 value = self.el.value, 2851 request = self.get( 'request' ), 2852 check_btn = self.parent.button( __getAttr( self.el, 'name' ) ), 2853 method = request.method.toLowerCase() == 'post' ? 'POST' : 'GET', 2854 data = request.data || {}, 2855 success = request.success, 2856 url = (function (){ 2857 var url = request.url || window.location.href; 2858 if ( method == 'GET' ) { 2859 url += (~url.indexOf( '?' )) ? '&' : '?'; 2860 url += name + '=' + value; 2861 } else { 2862 data[name] = value; 2863 } 2864 return url; 2865 })(), 2866 2867 timeout = options.no_timeout ? 0 : (request.timeout || 0), 2868 2869 readyStateChange = function (){ 2870 var xhr = self.xhr; 2871 2872 if ( xhr.readyState == 1 ) { 2873 self.execute( request.start, [xhr] ); 2874 } 2875 2876 if ( xhr.readyState == 4 ) { 2877 // TODO: handle other errors (maybe with switch); 2878 if ( xhr.status == 200 ) { 2879 var result = (self.execute( request.end, [xhr.response] ) === true) ? true : false; 2880 self['__validation' + (result ? 'Success' : 'Error')](); 2881 } 2882 } 2883 if ( xhr.readyState == 4 || xhr.readystate == 0 ) { 2884 self.processing( false ).hold( false ); 2885 if ( check_btn ) { 2886 check_btn.processing( false ); 2887 } 2888 } 2889 }, 2890 2891 makeRequest = function (){ 2892 self.processing( true ).hold( true ); 2893 if ( check_btn ) { 2894 check_btn.processing( true ); 2895 } 2896 var xhr = HTTP.newRequest(); 2897 self.xhr = xhr; 2898 xhr.onreadystatechange = readyStateChange; 2899 xhr.open( method, url, true ); 2900 xhr.setRequestHeader( "Accept-Language", "en" ); 2901 if ( method == 'POST' ) { 2902 xhr.setRequestHeader( "Content-type", "application/x-www-form-urlencoded; charset=UTF-8" ); 2903 xhr.send( __serialize( data ) ); 2904 } else { 2905 xhr.send( null ); 2906 } 2907 }; 2908 2909 if ( self.xhr && (self.xhr.readyState !== 0 || self.xhr.readyState !== 4) ) { 2910 self.xhr.abort(); 2911 self.processing( false ).hold( false ); 2912 if ( check_btn ) { 2913 check_btn.processing( false ); 2914 } 2915 } 2916 2917 if ( self.xhrTimeout ) { 2918 clearTimeout( self.xhrTimeout ); 2919 } 2920 self.hold( false ); 2921 2922 if ( timeout > 0 && options.no_timeout !== true ) { 2923 self.xhrTimeout = setTimeout( function (){ 2924 makeRequest(); 2925 }, timeout ); 2926 } else { 2927 makeRequest(); 2928 } 2929 }; 2930 2931 tField_p.execute = function ( func, params ){ 2932 var self = this; 2933 if ( self.silence ) { 2934 return; 2935 } 2936 2937 if ( typeof func == 'string' ) { 2938 func = self.get( func ); 2939 } 2940 return self.parent.execute( self.el, func, params ); 2941 }; 2942 2943 2944 /* 2945 * Test tButton created by Element constructor 2946 */ 2947 var tButton = function ( parent, el ){ 2948 var self = this, 2949 type = self.attr( 'type' ), 2950 name; 2951 2952 self.parent = parent; 2953 self.el = el; 2954 self.config = {}; 2955 2956 self.events = []; 2957 2958 name = type === 'submit' ? type : self.data( 'check' ); 2959 self.name = name; 2960 self.set( __extend( __clone( parent.config ), __clone( (parent.config.buttons ? parent.config.buttons[name] : {}) ) ) ); 2961 2962 return self.init(); 2963 }; 2964 __extend_proto( tButton, Element ); 2965 var tButton_p = tButton.prototype; 2966 2967 tButton_p.init = function (){ 2968 var self = this, 2969 el = self.el, 2970 parent = self.parent; 2971 2972 if ( self.inited ) { 2973 self.destroy(); 2974 } 2975 if ( el.type == 'submit' || el == parent.get( 'submitButton' ) ) { 2976 self.on( 'click', function ( e ){ 2977 __prevent( e ); 2978 parent.form.onsubmit( e ); 2979 return false;
2980 } ); 2981 } else { 2982 self.on( 'click', function (){ 2983 var field = parent.field( self.data( 'check' ) ); 2984 if ( field ) { 2985 field.validate( {no_timeout: true} ); 2986 } 2987 } ); 2988 } 2989 this.inited = true; 2990 return this; 2991 }; 2992 2993 tButton_p.disable = function (){ 2994 var self = this; 2995 self.addClass( self.get( 'disabledClass' ) ); 2996 return self; 2997 }; 2998 2999 tButton_p.enable = function (){ 3000 var self = this; 3001 self.removeClass( self.get( 'disabledClass' ) ); 3002 return self; 3003 }; 3004 3005 3006 /* 3007 * Helpers 3008 * ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- 3009 */ 3010 /** 3011 * Object extend 3012 * @param object 3013 * @param new_obj 3014 * @returns {object} 3015 */ 3016 var __extend = function ( object, new_obj ){ 3017 for ( var key in new_obj ) { 3018 if ( new_obj.hasOwnProperty( key ) ) { 3019 object[key] = new_obj[key]; 3020 } 3021 } 3022 return object; 3023 }; 3024 3025 /** 3026 * Method for preventing default events 3027 * @param e 3028 * @private 3029 */ 3030 var __prevent = function ( e ){ 3031 if ( e.preventDefault ) { 3032 e.preventDefault(); 3033 } else { 3034 event.returnValue = false; 3035 } 3036 }; 3037 3038 /** 3039 * Object clone 3040 * @returns {*|array|string} 3041 */ 3042 var __clone = function ( obj ){ 3043 return __isArray( obj ) ? obj.slice() : __extend( {}, obj ); 3044 }; 3045 3046 3047 /** 3048 * is array function 3049 * @returns {boolean} 3050 */ 3051 var __isObject = function ( obj ){ 3052 return toString.call( obj ) == '[object Object]'; 3053 }; 3054 3055 3056 var __isForm = function ( obj ){ 3057 return obj && obj.nodeName === 'FORM'; 3058 }; 3059 3060 /** 3061 * is array function 3062 * @returns {boolean} 3063 */ 3064 var __isArray = function ( obj ){ 3065 return Object.prototype.toString.call( obj ) == '[object Array]'; 3066 }; 3067 3068 3069 /** 3070 * detects is defined array has some value 3071 * @param array 3072 * @param value 3073 * @returns {number} 3074 * @private 3075 */ 3076 var __inArray = function ( array, value ){ 3077 var index = -1, 3078 length = array ? array.length : 0; 3079 while ( ++index < length ) { 3080 if ( array[index] === value ) { 3081 return index; 3082 } 3083 } 3084 return -1; 3085 }; 3086 3087 var __clear = function ( arr ){ 3088 if ( __isArray( arr ) ) { 3089 var new_arr = []; 3090 for ( var i = 0, a_l = arr.length; i < a_l; i++ ) { 3091 if ( arr[i] !== '' ) { 3092 new_arr.push( arr[i] ); 3093 } 3094 } 3095 return new_arr; 3096 } 3097 }; 3098 3099 3100 /** 3101 * Work with data-attributes 3102 * 3103 * @param {object} element - element 3104 * @param {string} attr - data-attribute 3105 * @param {!string|number} value - new attribute value. [null - delete attr, undefined - return attr value, defined - set new value] 3106 * @returns {*} 3107 */ 3108 var __data = function ( element, attr, value ){ 3109 switch ( value ) { 3110 case null: 3111 __delAttr( element, 'data-' + attr ); 3112 break; 3113 case undefined: 3114 return __getAttr( element, 'data-' + attr ); 3115 break; 3116 default: 3117 __setAttr( element, 'data-' + attr, value ); 3118 break; 3119 } 3120 }; 3121 3122 var __getAttr = function ( el, attr ){ 3123 if ( !el ) { 3124 return null; 3125 } 3126 return el.getAttribute( attr ); 3127 }; 3128 var __setAttr = function ( el, attr, value ){ 3129 if ( !el ) { 3130 return null; 3131 } 3132 el.setAttribute( attr, value ); 3133 }; 3134 var __delAttr = function ( el, attr ){ 3135 if ( !el ) { 3136 return null; 3137 } 3138 el.removeAttribute( attr ); 3139 }; 3140 3141 3142 // AJAX Request functionality 3143 var HTTP = {}; 3144 HTTP._factories = [ 3145 function (){ 3146 return new XMLHttpRequest(); 3147 }, 3148 function (){ 3149 return new ActiveXObject( "Msxml2.XMLHTTP" ); 3150 }, 3151 function (){ 3152 return new ActiveXObject( "Microsoft.XMLHTTP" ); 3153 } 3154 ]; 3155 HTTP._factory = null; 3156 HTTP.newRequest = function (){ 3157 if ( HTTP._factory !== null ) { 3158 return HTTP._factory(); 3159 } 3160 for ( var i = 0; i < HTTP._factories.length; i++ ) { 3161 try { 3162 var factory = HTTP._factories[i]; 3163 var request = factory(); 3164 if ( request !== null ) { 3165 HTTP._factory = factory; 3166 return request; 3167 } 3168 } catch ( e ) { 3169 continue; 3170 } 3171 } 3172 HTTP._factory = function (){ 3173 throw new Error( 'Object XMLHttpRequest not supported' ); 3174 }; 3175 HTTP._factory(); 3176 }; 3177 3178 3179 /** 3180 * Serrialize data for request 3181 * @param {object} data - object to serialize 3182 * @returns {string} 3183 */ 3184 var __serialize = function ( data ){ 3185 var pairs = []; 3186 var regexp = /%20/g; 3187 for ( var name in data ) { 3188 var pair = encodeURIComponent( name ).replace( regexp, '+' ) + '='; 3189 pair += encodeURIComponent( data[name].toString() ).replace( regexp, '+' ); 3190 pairs.push( pair ); 3191 } 3192 return pairs.join( '&' ); 3193 }; 3194 3195})( window, document ); 3196/** 3197 * _v_.js - validator 3198 * http://github.com/TjRus/_v_.js 3199 * (c) 2013 Vasiliy Zubach (aka TjRus) - http://tjrus.com/ 3200 * _v_ may be freely distributed under the MIT license. 3201 */ 3202"use strict"; 3203 3204(function ( window, document, undefined ){ 3205 3206 /** 3207 * Validator constructor 3208 * 3209 * @constructor 3210 * @param {!string} value 3211 * @returns {*} 3212 * @private 3213 */ 3214 var _v_ = function ( value ){ 3215 if ( !(this instanceof _v_) ) { 3216 return new _v_( value ); 3217 } 3218 this.value = value || ''; 3219 this.separator = ' '; 3220 this.rule = ''; 3221 3222 this.parsedRules = []; 3223 3224 return this; 3225 }; 3226 var _v_proto = _v_.prototype; 3227 3228 /** 3229 * sets rules separator 3230 * @param separator 3231 * @returns {*} 3232 */ 3233 _v_proto.separate = function ( separator ){ 3234 this.separator = separator; 3235 this.rules( this.rule ); // pars rules again 3236 return this; 3237 }; 3238 3239 /** 3240 * set rules to validator 3241 * @param rules 3242 * @returns {*} 3243 */ 3244 _v_proto.rules = function ( rules ){ 3245 this.rule = rules || ''; 3246 this.parseRules(); 3247 return this; 3248 }; 3249 3250 /** 3251 * add rules to existed rules str 3252 * @param rule 3253 * @returns {*} 3254 */ 3255 _v_proto.addRule = function ( rule ){ 3256 var parsed = this.parsedRules; 3257 var rule_v_ = _v_().rules( rule ).parsedRules; 3258 3259 for ( var key in rule_v_ ) { 3260 var rule = rule_v_[key]; 3261 if ( !rule ) { 3262 parsed[key] = rule; 3263 continue; 3264 } 3265 // has params and is in defined rules 3266 if ( rule && parsed.hasOwnProperty( key ) ) { 3267 // params is array 3268 parsed[key] = __toArray( parsed[key] ); 3269 rule = __toArray( rule ); 3270 for ( var i = 0, r_v_l = rule.length; i < r_v_l; i++ ) { 3271 if ( __inArray( parsed[key], rule[i] ) !== -1 ) { 3272 continue; 3273 } 3274 parsed[key].push( rule[i] ); 3275 } 3276 } else { 3277 parsed[key] = rule; 3278 } 3279 } 3280 3281 this.rule = __rulesStr( this.parsedRules, this.separator ); 3282 return this; 3283 }; 3284 3285 /** 3286 * Delete rule from validator rules 3287 * @param rule 3288 * @returns {*} 3289 */ 3290 _v_proto.delRule = function ( rule ){ 3291 var parsed = this.parsedRules; 3292 var rule_v_ = _v_().rules( rule ).parsedRules; 3293 for ( var key in rule_v_ ) { 3294 var rules = rule_v_[key]; 3295 if (!parsed.hasOwnProperty(key)) { 3296 continue; 3297 } 3298 if ( rules === undefined) { 3299 delete parsed[key]; 3300 continue; 3301 } 3302 3303 parsed[key] = __toArray( parsed[key] ); 3304 rules = __toArray( rules ); 3305 for ( var i = 0, r_l = rules.length; i < r_l; i++ ) { 3306 var index = __inArray( parsed[key], rules[i] ); 3307 if ( ~index ) { 3308 parsed[key].splice( index, 1 ); 3309 } 3310 } 3311 if ( parsed[key].length === 0 ) { 3312 delete parsed[key]; 3313 } else if ( parsed[key].length === 1 ) { 3314 parsed[key] = parsed[key][0]; 3315 } 3316 } 3317 this.rule = __rulesStr( this.parsedRules, this.separator ); 3318 return this; 3319 }; 3320 3321 /** 3322 * check has validator such rule or not 3323 * @param rules 3324 * @returns {boolean} 3325 */ 3326 _v_proto.hasRule = function ( rules ){ 3327 var rule_v_ = _v_().rules( rules ).parsedRules; 3328 var parsed = this.parsedRules; 3329 for ( var key in rule_v_ ) { 3330 var rule = rule_v_[key]; 3331 if ( !rule ) { 3332 if ( !parsed.hasOwnProperty( key ) ) { 3333 return false;
3334 } else { 3335 continue; 3336 } 3337 } 3338 parsed[key] = __toArray( parsed[key] ); 3339 rule = __toArray( rule ); 3340 for ( var i = 0, r_l = rule.length; i < r_l; i++ ) { 3341 if ( __inArray( parsed[key], rule[i] ) === -1 ) { 3342 return false; 3343 } 3344 } 3345 } 3346 return true; 3347 }; 3348 3349 3350 /** 3351 * parse validator rules and return object with rule keys and their values 3352 * @returns {{}} 3353 */ 3354 _v_proto.parseRules = function (){ 3355 var rules = this.rule.split( this.separator ); 3356 var parsed = {}; 3357 var keys = this.keys; 3358 3359 for ( var i = 0, rules_length = rules.length; i < rules_length; i++ ) { 3360 var option = rules[i], func, rule, params = undefined; 3361 if ( keys[ option ] ) { 3362 func = keys[ option ]; 3363 rule = option; 3364 } else { 3365 var keys_order = this.keys_order; 3366 for ( var j = 0, koLength = keys_order.length; j < koLength; j++ ) { 3367 var key = keys_order[j]; 3368 if ( option.indexOf( key ) === 0 ) { 3369 rule = key; 3370 params = option.replace( key, '' ); 3371 var paramArray = (/^\[(.+)\]$/).exec( params ); 3372 if ( paramArray ) params = paramArray[1].split( ',' ); // TODO: params separator 3373 func = this.keys[rule]; 3374 break; 3375 } 3376 } 3377 } 3378 if ( func ) { 3379 parsed[rule] = params; 3380 } 3381 } 3382 this.parsedRules = parsed; 3383 this.rule = __rulesStr( parsed, this.separator ); 3384 return parsed; 3385 }; 3386 3387 /** 3388 * main validate function. 3389 * @param rules 3390 * @returns {boolean} 3391 */ 3392 _v_proto.validate = function ( rules ){ 3393 if ( rules ) { 3394 this.rules( rules ); 3395 } 3396 var parsed = this.parsedRules; 3397 for ( var rule in parsed ) { 3398 try { 3399 if ( !this.keys[rule].call( this, parsed[rule] ) ) { 3400 return false; 3401 } 3402 } catch (e) { 3403 return false; 3404 } 3405 } 3406 return true; 3407 }; 3408 3409 3410 /** 3411 * method for extending _v_ with new rules and validate functions 3412 * @param rule 3413 * @param func 3414 */ 3415 _v_proto.extend = function ( rule, func ){ 3416 _v_proto.keys[rule] = func 3417 _v_proto.keys_order.push( rule ); 3418 3419 _v_proto.keys_order = this.keys_order.sort( function ( a, b ){ 3420 return b.length - a.length; 3421 } ); 3422 return this; 3423 }; 3424 3425 _v_proto.keys = {}; // object with rules 3426 _v_proto.keys_order = []; // array with ordered rules 3427 3428 window._v_ = _v_; 3429 3430 3431 /** 3432 * Rules extends 3433 * ---------- ---------- ---------- ---------- ---------- 3434 */ 3435 var rules = { 3436 3437 // required 3438 '*' : function (){ 3439 return this.value.length !== 0; 3440 }, 3441 3442 // alpha 3443 'a' : function (){ 3444 return (/^[a-z]+$/i).test( this.value ); 3445 }, 3446 3447 // alpha numeric 3448 'a1' : function (){ 3449 return (/^[a-z0-9]+$/i).test( this.value ); 3450 }, 3451 3452 // alpha dash 3453 'a_' : function (){ 3454 return (/^[a-z_-]+$/i).test( this.value ); 3455 }, 3456 3457 // alpha numeric dash 3458 'a1_' : function (){ 3459 return (/^[a-z0-9_-]+$/i).test( this.value ); 3460 }, 3461 3462 // email 3463 '@' : function (){ 3464 var mail_regexp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; 3465 return mail_regexp.test( this.value ); 3466 }, 3467 3468 // emails 3469 '@s' : function (){ 3470 var emails = this.value.split( ',' ); 3471 for ( var i = 0; i < emails.length; i++ ) { 3472 if ( !_v_( emails[i] ).validate( '@' ) ) { 3473 return false; 3474 } 3475 } 3476 return true; 3477 }, 3478 3479 // ip address 3480 'ip' : function (){ 3481 return (/^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i).test( this.value ); 3482 }, 3483 3484 // base65 string 3485 'b64' : function (){ 3486 return (/^(?:[A-Za-z0-9+\/]{4}
3486)*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})$/).test( this.value ); 3487 }, 3488 3489 // URL 3490 'url' : function (){ 3491 return (/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i).test( this.value ); 3492 }, 3493 3494 // integer 3495 'int' : function (){ 3496 return (/^\-?[0-9]+$/).test( this.value ); 3497 }, 3498 3499 // Numeric 3500 'num' : function (){ 3501 return (/^[0-9]+$/).test( this.value ); 3502 }, 3503 3504 // Decimal 3505 'dec' : function (){ 3506 return (/^\-?[0-9]*\.?[0-9]+$/).test( this.value ); 3507 }, 3508 3509 // Natural 3510 'nat' : function (){ 3511 return (/^[0-9]+$/i).test( this.value ); 3512 }, 3513 3514 // length equals to 3515 'l=' : function ( length ){ 3516 if ( typeof(length) == 'number' || typeof(length) == 'string' ) { 3517 return this.value.length == length; 3518 } else { 3519 for ( var key in length ) { 3520 if ( this.value.length == length[key] ) return true; 3521 } 3522 } 3523 return false; 3524 }, 3525 3526 // length more than 3527 'l>' : function ( length ){ 3528 return this.value.length > length; 3529 }, 3530 3531 // length more or equals to 3532 'l>=' : function ( length ){ 3533 return this.value.length >= length; 3534 }, 3535 3536 // length less than 3537 'l<' : function ( length ){ 3538 return this.value.length < length; 3539 }, 3540 3541 // length less or equals to 3542 'l<=' : function ( length ){ 3543 return this.value.length <= length; 3544 }, 3545 3546 // length is in range 3547 'lr=' : function ( range ){ 3548 return (this.value.length >= range[0] && this.value.length <= range[1]); 3549 }, 3550 3551 // is greater than 3552 '>' : function ( value ){ 3553 var test = this.value; 3554 return (_v_( test ).validate( 'dec' ) && parseFloat( test ) > parseFloat( value )); 3555 }, 3556 3557 // is greater or equals to 3558 '>=' : function ( value ){ 3559 var test = this.value; 3560 return (_v_( test ).validate( 'dec' ) && parseFloat( test ) >= parseFloat( value )); 3561 }, 3562 3563 // is less than 3564 '<' : function ( value ){ 3565 var test = this.value; 3566 return (_v_( test ).validate( 'dec' ) && parseFloat( test ) < parseFloat( value )); 3567 }, 3568 3569 // is less or equals to 3570 '<=' : function ( value ){ 3571 var test = this.value; 3572 return (_v_( test ).validate( 'dec' ) && parseFloat( test ) <= parseFloat( value )); 3573 }, 3574 3575 // is in range 3576 'r=' : function ( value ){ 3577 var test = this.value; 3578 return (_v_( test ).validate( 'dec' ) && parseFloat( test ) >= parseFloat( value[0] ) && parseFloat( test ) <= parseFloat( value[1] )); 3579 }, 3580 3581 // regular expression validation 3582 'reg=': function ( regExpression ){ 3583 var reg = new RegExp( regExpression, 'i' ); 3584 return reg.test( this.value ); 3585 }, 3586 3587 // matches to 3588 '=' : function ( value ){ 3589 var test = this.value; 3590 if ( typeof value == 'string' || typeof value == 'number' ) { 3591 return test == value; 3592 } else { 3593 for ( var i = 0, valueLength = value.length; i < valueLength; i++ ) { 3594 if ( value[i].indexOf( '#' ) === 0 ) { 3595 var el = __getElById( value[i].replace( '#', '' ) ); 3596 if ( !el ) { 3597 return false; 3598 } 3599 if ( test == el.value ) return true; 3600 } else { 3601 if ( test == value[i] ) return true; 3602 } 3603 } 3604 } 3605 return false;
3606 }, 3607 3608 // matches to id 3609 '=#' : function ( value ){ 3610 var test = this.value; 3611 if ( typeof value == 'string' || typeof value == 'number' ) { 3612 value = value.split( ' ' ); 3613 var el = __getElById( value ); 3614 if ( !el ) { 3615 return false; 3616 } 3617 return test == el.value; 3618 } else { 3619 for ( var i = 0; i < value.length; i++ ) { 3620 var el = __getElById( value[i] ); 3621 if ( el && test == el.value ) { 3622 return true; 3623 } 3624 } 3625 } 3626 return false; 3627 }, 3628 3629 // not matches to 3630 '!=' : function ( value ){ 3631 value = (__isArray( value )) ? '[' + value.join( ',' ) + ']' : value; // TODO: value separator 3632 return !(_v_( this.value ).validate( '=' + value )); 3633 }, 3634 3635 // not contain 3636 '!' : function ( value ){ 3637 if ( typeof value == 'string' || typeof value == 'number' ) { 3638 return (this.value).toString().indexOf( value.toString() ) === -1; 3639 } else { 3640 for ( var key in value ) { 3641 if ( ~(this.value).toString().indexOf( value[key].toString() ) ) { 3642 return false; 3643 } 3644 } 3645 } 3646 return true; 3647 }, 3648 3649 // credit card (all cards type) 3650 'c' : function ( value ){ 3651 return (/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/).test( this.value ); 3652 }, 3653 3654 // visa card 3655 'cv' : function ( value ){ 3656 return (/^4[0-9]{12}(?:[0-9]{3})?$/).test( this.value ); 3657 }, 3658 3659 // master card 3660 'cm' : function ( value ){ 3661 return (/^5[1-5][0-9]{14}$/).test( this.value ); 3662 }, 3663 3664 // american express card 3665 'ca' : function ( value ){ 3666 return (/^3[47][0-9]{13}$/).test( this.value ); 3667 }, 3668 3669 // discover card 3670 'cd' : function ( value ){ 3671 return (/^6(?:011|5[0-9]{2})[0-9]{12}$/).test( this.value ); 3672 }, 3673 3674 // date format validation 3675 'D=' : function ( format ){ 3676 return !!(__toDate( this.value, format )); 3677 } 3678 }; 3679 3680 // add extends 3681 for ( var key in rules ) { 3682 _v_().extend( key, rules[key] ); 3683 } 3684 3685 3686 /** 3687 * Helpers 3688 * ---------- ---------- ---------- ---------- ---------- 3689 */ 3690 3691 // Date functions 3692 var __dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; 3693 var __shortDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; 3694 var __dayChars = ['S', 'M', 'T', 'W', 'T', 'F', 'S']; 3695 3696 // Full, short and single character names for the months. Override these to provide multi-language support. 3697 var __monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; 3698 var __shortMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; 3699 var __monthChars = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']; 3700 3701 var __daysInMonth = function ( month, year ){ 3702 // If February, check for leap year 3703 if ( (month == 1) && (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) ) { 3704 return 29; 3705 } 3706 else { 3707 var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 3708 return days[month]; 3709 } 3710 }; 3711 3712 /** 3713 * Attempts to convert a string into a date based on a given format. Fields will 3714 * match either the long or short form, except in the case of the year, where the 3715 * string must match either a 2-digit or 4-digit format. Ranges are checked. Day 3716 * names are expected if they are included in the format string, but are otherwise 3717 * ignored. Use ^ to force the use of a literal character. In other words, to 3718 * have the character Y appear instead of the actual year, use ^Y. 3719 * 3720 * Field | Full Form | Short Form 3721 * -------------+---------------------+------------------- 3722 * Year | Y (4 digits) | y (2 digits) 3723 * Month | M (1 or 2 digits) | m (1 or 2 digits) 3724 * Month Name | N (full name) | n (abbr) 3725 * Day of Month | D (1 or 2 digits) | d (1 or 2 digits) 3726 * Day Name | W (full name) | w (abbr) 3727 * Hour (1-12) | H (1 or 2 digits) | h (1 or 2 digits) 3728 * Hour (0-23) | R (1 or 2 digits) | r (1 or 2 digits) 3729 * Minute | I (1 or 2 digits) | i (1 or 2 digits) 3730 * Second | S (1 or 2 digits) | s (1 or 2 digits) 3731 * AM/PM | A (upper case) | a (lower case) 3732 * 3733 * @param {Date} date Date that we should transform. 3734 * @param {string} format The basic format of the string. 3735 * @return {Date} The string as a date object. 3736 */ 3737 var __toDate = function ( date, format ){ 3738 // Default values set to midnight Jan 1 of the current year. 3739 var year = new Date().getFullYear(),
3740 month = 0, 3741 day = 1, 3742 hours = 0, 3743 minutes = 0, 3744 seconds = 0; 3745 3746 // Positions of each date element within the source string. Use to know 3747 // which backreference to check after a successful match. 3748 var yearPos = -1, 3749 monthPos = -1, 3750 dayPos = -1, 3751 hoursPos = -1, 3752 minutesPos = -1, 3753 secondsPos = -1, 3754 amPmPos = -1; 3755 3756 var monthStyle = 'm', // How we interpret the month, digits (M/m) or names (N/n) 3757 hoursStyle = 'h'; // How we interpret the hours, 12-hour (h) or 24-hour (r) 3758 3759 var position = 1, // Position of the current date element (year, month, day, etc.) in the source string 3760 pattern = ''; // Date pattern to be matched. 3761 3762 // Remove extraneous whitespace from source string and format string. 3763 var str = date.replace( /\s+/g, ' ' ); 3764 format = format.replace( /\s+/g, ' ' ); 3765 3766 // Loop throught the format string, and build the regex pattern 3767 // for extracting the date elements. 3768 for ( var i = 0, len = format.length; i < len; i++ ) { 3769 var c = format.charAt( i ); 3770 switch ( c ) { 3771 case 'Y' : 3772 pattern += '(\\d{4})'; 3773 yearPos = position++; 3774 break; 3775 case 'y' : 3776 pattern += '(\\d{2})'; 3777 yearPos = position++; 3778 break; 3779 case 'M' : 3780 case 'm' : 3781 pattern += '(\\d{1,2})'; 3782 monthPos = position++; 3783 monthStyle = 'm'; 3784 break; 3785 case 'N' : 3786 pattern += '(' + __monthNames.join( '|' ) + ')'; 3787 monthPos = position++; 3788 monthStyle = 'N'; 3789 break; 3790 case 'n' : 3791 pattern += '(' + __shortMonthNames.join( '|' ) + ')'; 3792 monthPos = position++; 3793 monthStyle = 'n'; 3794 break; 3795 case 'D' : 3796 case 'd' : 3797 pattern += '(\\d{1,2})'; 3798 dayPos = position++; 3799 break; 3800 case 'W' : // We'll match W, but won't do anything with it. 3801 pattern += '(' + __dayNames.join( '|' ) + ')'; 3802 position++; 3803 break; 3804 case 'w' : // We'll match w, but won't do anything with it. 3805 pattern += '(' + __shortDayNames.join( '|' ) + ')'; 3806 position++; 3807 break; 3808 case 'H' : 3809 case 'h' : 3810 pattern += '(\\d{1,2})'; 3811 hoursPos = position++; 3812 hoursStyle = 'h'; 3813 break; 3814 case 'R' : 3815 case 'r' : 3816 pattern += '(\\d{1,2})'; 3817 hoursPos = position++; 3818 hoursStyle = 'r'; 3819 break; 3820 case 'I' : 3821 case 'i' : 3822 pattern += '(\\d{1,2})'; 3823 minutesPos = position++; 3824 break; 3825 case 'S' : 3826 case 's' : 3827 pattern += '(\\d{1,2})'; 3828 secondsPos = position++; 3829 break; 3830 case 'A' : 3831 case 'a' : 3832 pattern += '(AM|am|PM|pm)'; 3833 amPmPos = position++; 3834 break; 3835 default : 3836 pattern += (c == '^' ? format.charAt( ++i ) : c); 3837 } 3838 } 3839 3840 // Pull out the date elements from the input string 3841 var matches = str.match( new RegExp( pattern ) ); 3842 if ( !matches ) { 3843 return null; 3844 } 3845 3846 // Now we have to interpret each of those parts... 3847 3848 if ( yearPos > -1 ) { 3849 year = parseInt( matches[yearPos], 10 ); 3850 year = (year < 50 ? year + 2000 : (year < 100 ? year + 1900 : year)); 3851 } 3852 3853 if ( monthPos > -1 ) { 3854 switch ( monthStyle ) { 3855 case 'm':
3856 month = parseInt( matches[monthPos], 10 ) - 1; // JavaScript months are zero based, user input generally is not. 3857 if ( month > 11 ) 3858 return null; 3859 break; 3860 case 'N': 3861 month = parseInt( __monthNumbers[matches[monthPos]], 10 ); 3862 if ( isNaN( month ) ) 3863 return null; 3864 break; 3865 case 'n': 3866 month = parseInt( __shortMonthNumbers[matches[monthPos]], 10 ); 3867 if ( isNaN( month ) ) 3868 return null; 3869 break; 3870 } 3871 } 3872 3873 if ( dayPos > -1 ) { 3874 day = parseInt( matches[dayPos], 10 ); 3875 if ( (day < 1) || (day > __daysInMonth( month, year )) ) 3876 return null; 3877 } 3878 3879 if ( hoursPos > -1 ) { 3880 hours = parseInt( matches[hoursPos], 10 ); 3881 if ( hoursStyle == 'h' && (hours === 0 || hours > 12) ) 3882 return null; 3883 else if ( hours > 23 ) 3884 return null; 3885 } 3886 3887 if ( minutesPos > -1 ) { 3888 minutes = parseInt( matches[minutesPos], 10 ); 3889 if ( minutes > 59 ) 3890 return null; 3891 } 3892 3893 if ( secondsPos > -1 ) { 3894 seconds = parseInt( matches[secondsPos], 10 ); 3895 if ( seconds > 59 ) 3896 return null; 3897 } 3898 3899 // Convert 12-hour time, if used, to 24-hour time. 3900 if ( amPmPos > -1 ) { 3901 var amPm = matches[amPmPos]; 3902 if ( (amPm == 'pm' || amPm == 'PM') && (hours < 12) ) 3903 hours += 12; 3904 } 3905 3906 return new Date( year, month, day, hours, minutes, seconds ); 3907 }; 3908 3909 3910 /** 3911 * Simple getElementByID function 3912 * @param {string} id - id of HTML element 3913 * @returns {HTMLElement} 3914 * @private 3915 */ 3916 var __getElById = function ( id ){ 3917 return document.getElementById( id ); 3918 } 3919 3920 /** 3921 * Check is obj is array or not 3922 * @param obj - element we should check 3923 * @returns {boolean} 3924 * @private 3925 */ 3926 var __isArray = function ( obj ){ 3927 return Object.prototype.toString.call( obj ) == '[object Array]'; 3928 }; 3929 3930 /** 3931 * detects is defined array has some value 3932 * @param array 3933 * @param value 3934 * @returns {number} 3935 * @private 3936 */ 3937 var __inArray = function ( array, value ){ 3938 var index = -1, 3939 length = array ? array.length : 0; 3940 while ( ++index < length ) { 3941 if ( array[index] === value ) { 3942 return index; 3943 } 3944 } 3945 return -1; 3946 }; 3947 window.__inArray = __inArray; 3948 3949 3950 /** 3951 * convert item to Array. 3952 * @param el 3953 * @returns {Array} 3954 * @private 3955 */ 3956 var __toArray = function ( el ){ 3957 return (!__isArray( el )) ? [el] : el; 3958 } 3959 3960 /** 3961 * convert rules object to string 3962 * @param obj 3963 * @param separator 3964 * @returns {string} 3965 * @private 3966 */ 3967 var __rulesStr = function ( obj, separator ){ 3968 separator = separator || ' '; 3969 var str = separator; 3970 for ( var key in obj ) { 3971 var rules = obj[key]; 3972 if ( __isArray( rules )){ 3973 rules = __clearArray(rules); 3974 } 3975 if ( !rules ) { 3976 str += key + separator; 3977 } else if ( __isArray( rules ) ) { 3978 str += key + '[' + rules.join( ',' ) + ']' + separator; // TODO: rule values separator 3979 } else { 3980 str += key + rules + separator; 3981 } 3982 } 3983 str = str.substr( separator.length, str.length - separator.length * 2 ); 3984 return str; 3985 }; 3986 3987 var __clearArray = function(arr){ 3988 var new_arr = []; 3989 for (var i = 0, a_l = arr.length; i < a_l; i++) { 3990 if (arr[i]) { 3991 new_arr.push(arr[i]); 3992 } 3993 } 3994 return (new_arr && new_arr.length > 1) ? new_arr : new_arr[0]; 3995 } 3996 3997})( window, document ); 3998;/*})'"*/;/*})'"*/ 3999/*! device.js 0.1.61 */ 4000(function(){var a,b,c,d,e,f,g,h,i,j;a=window.device,window.device={},c=window.document.documentElement,j=window.navigator.userAgent.toLowerCase(),device.ios=function(){return device.iphone()||device.ipod()||device.ipad()},device.iphone=function(){return d("iphone")},device.ipod=function(){return d("ipod")},device.ipad=function(){return d("ipad")},device.android=function(){return d("android")},device.androidPhone=function(){return device.android()&&d("mobile")},device.androidTablet=function(){return device.android()&&!d("mobile")},device.blackberry=function(){return d("blackberry")||d("bb10")||d("rim")},device.blackberryPhone=function(){return device.blackberry()&&!d("tablet")},device.blackberryTablet=function(){return device.blackberry()&&d("tablet")},device.windows=function(){return d("windows")},device.windowsPhone=function(){return device.windows()&&d("phone")},device.windowsTablet=function(){return device.windows()&&d("touch")&&!device.windowsPhone()},device.fxos=function(){return(d("(mobile;")||d("(tablet;"))&&d("; rv:")},device.fxosPhone=function(){return device.fxos()&&d("mobile")},device.fxosTablet=function(){return device.fxos()&&d("tablet")},device.meego=function(){return d("meego")},device.cordova=function(){return window.cordova&&"file:"===location.protocol},device.nodeWebkit=function(){return"object"==typeof window.process}
4000,device.mobile=function(){return device.androidPhone()||device.iphone()||device.ipod()||device.windowsPhone()||device.blackberryPhone()||device.fxosPhone()||device.meego()},device.tablet=function(){return device.ipad()||device.androidTablet()||device.blackberryTablet()||device.windowsTablet()||device.fxosTablet()},device.desktop=function(){return!device.tablet()&&!device.mobile()},device.portrait=function(){return window.innerHeight/window.innerWidth>1},device.landscape=function(){return window.innerHeight/window.innerWidth<1},device.noConflict=function(){return window.device=a,this},d=function(a){return-1!==j.indexOf(a)},f=function(a){var b;return b=new RegExp(a,"i"),c.className.match(b)},b=function(a){return f(a)?void 0:c.className+=" "+a},h=function(a){return f(a)?c.className=c.className.replace(a,""):void 0},device.ios()?device.ipad()?b("ios ipad tablet"):device.iphone()?b("ios iphone mobile"):device.ipod()&&b("ios ipod mobile"):b(device.android()?device.androidTablet()?"android tablet":"android mobile":device.blackberry()?device.blackberryTablet()?"blackberry tablet":"blackberry mobile":device.windows()?device.windowsTablet()?"windows tablet":device.windowsPhone()?"windows mobile":"desktop":device.fxos()?device.fxosTablet()?"fxos tablet":"fxos mobile":device.meego()?"meego mobile":device.nodeWebkit()?"node-webkit":"desktop"),device.cordova()&&b("cordova"),e=function(){return device.landscape()?(h("portrait"),b("landscape")):(h("landscape"),b("portrait"))},i="onorientationchange"in window,g=i?"orientationchange":"resize",window.addEventListener?window.addEventListener(g,e,!1):window.attachEvent?window.attachEvent(g,e):window[g]=e,e()}).call(this); 4001;/*})'"*/;/*})'"*/ 4002/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 4003 * Licensed under the MIT License (LICENSE.txt). 4004 * 4005 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 4006 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 4007 * Thanks to: Seamus Leahy for adding deltaX and deltaY 4008 * 4009 * Version: 3.0.6 4010 * 4011 * Requires: 1.2.2+ 4012 */ 4013(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery) 4014;/*})'"*/;/*})'"*/ 4015/* jquery.simplr.smoothscroll version 1.0 copyright (c) 2012 https://github.com/simov/simplr-smoothscroll licensed under MIT */ 4016;(function(e){"use strict";e.srSmoothscroll=function(t){var platform = window.navigator.platform; if ((platform === 'MacIntel' || platform === 'MacPPC')){return false}; var n=e.extend({step:170,speed:1000,ease:"swing"},t||{});var r=e(window),i=e(document),s=0,o=n.step,u=n.speed,a=r.height(),f=navigator.userAgent.indexOf("AppleWebKit")!==-1?e("body"):e("html"),l=false;e("body").mousewheel(function(e,t){l=true;if(t<0)s=s+a>=i.height()?s:s+=o;else s=s<=0?0:s-=o;f.stop().animate({scrollTop:s},u,n.ease,function(){l=false});return false});r.on("resize",function(e){a=r.height()}).on("scroll",function(e){if(!l)s=r.scrollTop()})}})(jQuery); 4017;/*})'"*/;/*})'"*/ 4018var warnedAbout = {}; 4019 4020// List of warnings already given; public read only 4021jQuery.migrateWarnings = []; 4022 4023// Set to true to prevent console output; migrateWarnings still maintained 4024// jQuery.migrateMute = false;
4025 4026// Show a message on the console so devs know we're active 4027if (!jQuery.migrateMute && window.console && window.console.log) { 4028 window.console.log("JQMIGRATE: Logging is active"); 4029} 4030 4031// Set to false to disable traces that appear with warnings 4032if (jQuery.migrateTrace === undefined) { 4033 jQuery.migrateTrace = true; 4034} 4035 4036// Forget any warnings we've already given; public 4037jQuery.migrateReset = function() { 4038 warnedAbout = {}; 4039 jQuery.migrateWarnings.length = 0; 4040}; 4041 4042function migrateWarn(msg) { 4043 var console = window.console; 4044 if (!warnedAbout[msg]) { 4045 warnedAbout[msg] = true; 4046 jQuery.migrateWarnings.push(msg); 4047 if (console && console.warn && !jQuery.migrateMute) { 4048 console.warn("JQMIGRATE: " + msg); 4049 if (jQuery.migrateTrace && console.trace) { 4050 console.trace(); 4051 } 4052 } 4053 } 4054} 4055 4056function migrateWarnProp(obj, prop, value, msg) { 4057 if (Object.defineProperty) { 4058 // On ES5 browsers (non-oldIE), warn if the code tries to get prop; 4059 // allow property to be overwritten in case some other plugin wants it 4060 try { 4061 Object.defineProperty(obj, prop, { 4062 configurable: true, 4063 enumerable: true, 4064 get: function() { 4065 migrateWarn(msg); 4066 return value; 4067 }, 4068 set: function(newValue) { 4069 migrateWarn(msg); 4070 value = newValue; 4071 } 4072 }); 4073 return; 4074 } catch(err) { 4075 // IE8 is a dope about Object.defineProperty, can't warn there 4076 } 4077 } 4078 4079 // Non-ES5 (or broken) browser; just set the property 4080 jQuery._definePropertyBroken = true; 4081 obj[ prop ] = value; 4082} 4083 4084if (document.compatMode === "BackCompat") { 4085 // jQuery has never supported or tested Quirks Mode 4086 migrateWarn("jQuery is not compatible with Quirks Mode"); 4087} 4088;/*})'"*/;/*})'"*/ 4089jQuery(document).ready(function($) { 4090 parallax_box = $('.parallax-box'); 4091 4092 if (parallax_box.length > 0) { 4093 ParallaxBox(); 4094 } 4095 4096 function ParallaxBox() { 4097 var windowSelector = $(window), 4098 documentSelector = $(document), 4099 documentWidth = documentSelector.width(), 4100 windowHeight = windowSelector.height(), 4101 liteMode = false, 4102 ieVersion = getInternetExplorerVersion(), 4103 ds = document.documentElement; 4104 4105 if (!device.mobile() && !device.tablet()) { 4106 liteMode = false; 4107 4108 if (ieVersion !=-1 && ieVersion < 9) { 4109 liteMode = true; 4110 } 4111 } else { 4112 liteMode = true; 4113 } 4114 4115 parallax_box.each(function() { 4116 parallaxBox($(this)); 4117 }); 4118 4119 function parallaxBox(obj) { 4120 var obj_bg = obj.find('.parallax-bg'), 4121 type = obj_bg.data('parallax-type'), 4122 obj_bg_inner, 4123 img, 4124 originalWidth = 0, 4125 originalHeight = 0, 4126 img_url = obj_bg.data('img-url'), 4127 bufferRatio = obj_bg.data('speed'), 4128 parallaxInvert = obj_bg.data('invert'), 4129 parallaxType = 'parallax_normal', 4130 objHeight = obj.height(), 4131 objOffsetTop = obj.offset().top, 4132 baseHeight = 0, 4133 parallax = true; 4134 4135 switch (type) { 4136 case 'image': 4137 loadImg(); 4138 break 4139 case 'video': 4140 obj_bg_inner = $('.parallax_media', obj_bg); 4141 4142 if (liteMode) { 4143 obj_bg_inner.remove(); 4144 loadImg(); 4145 } else { 4146 loadVideo(); 4147 } 4148 break 4149 } 4150 4151 function loadImg() { 4152 if (img_url) { 4153 img = new Image(); 4154 img.src = img_url; 4155 4156 img.onload = function () { 4157 originalWidth = img.width; 4158 originalHeight = img.height; 4159 4160 imgBlocksStructure = !liteMode ? "<div class='parallax-img parallax-bg-inner'></div>" : "<img class='parallax-img parallax-bg-inner' src='' alt=''/>"; 4161 obj_bg.append(imgBlocksStructure); 4162 obj_bg_inner = $('.parallax-img', obj_bg); 4163 4164 if (!liteMode) { 4165 obj_bg_inner.css('background-image', 'url(' + (img_url) + ')'); 4166 } else { 4167 obj_bg_inner.attr('src', img_url); 4168 bufferRatio = 'none'; 4169 } 4170 4171 initParallax(); 4172 } 4173 } 4174 } 4175 4176 function loadVideo() { 4177 var videoElement = obj_bg_inner.get(0); 4178 4179 videoElement.load(); 4180 videoElement.play(); 4181 4182 originalWidth = videoElement.videoWidth; 4183 originalHeight = videoElement.videoHeight; 4184 4185 if (img_url) { 4186 img = new Image(); 4187 img.src = img_url; 4188 4189 img.onload = function () { 4190 originalWidth = originalWidth == 0 ? img.width : originalWidth; 4191 originalHeight = originalHeight == 0 ? img.height : originalHeight; 4192 objectResize(obj_bg_inner, documentWidth, baseHeight, originalWidth, originalHeight); 4193 } 4194 } 4195 4196 videoElement.onloadeddata = function() { 4197 originalWidth = videoElement.videoWidth; 4198 originalHeight = videoElement.videoHeight; 4199 objectResize(obj_bg_inner, documentWidth, baseHeight, originalWidth, originalHeight); 4200 } 4201 4202 initParallax(); 4203 } 4204 4205 function initParallax() { 4206 if (!parallaxInvert) { 4207 parallaxType = 'parallax_normal'; 4208 } else { 4209 parallaxType = 'parallax_invert'; 4210 } 4211 4212 switch (bufferRatio) { 4213 case 'low': 4214 bufferRatio = 3; 4215 break 4216 case 'normal': 4217 bufferRatio = 2.25; 4218 break 4219 case 'hight': 4220 bufferRatio = 1.5; 4221 break 4222 case 'fixed': 4223 if (ieVersion != -1) { 4224 if (type != 'video') { 4225 parallax = false;
4226 obj_bg_inner.css({backgroundAttachment:'fixed'}); 4227 } else { 4228 console.log('ie'); 4229 parallaxType = 'parallax_normal'; 4230 bufferRatio = 2.25; 4231 } 4232 } else { 4233 parallaxType = 'parallax_fixes'; 4234 bufferRatio = 1; 4235 } 4236 break 4237 case 'none': 4238 parallax = false; 4239 parallaxType = 'parallax_none'; 4240 break 4241 default: 4242 bufferRatio = 2.25; 4243 4244 if (bufferRatio > 5) { 4245 bufferRatio = 5; 4246 } 4247 if (bufferRatio <= 1) { 4248 if ($.browser.msie) { 4249 parallax = false; 4250 obj_bg_inner.css({backgroundAttachment:'fixed'}); 4251 } else { 4252 parallaxType = 'parallax_fixes'; 4253 bufferRatio = 1; 4254 } 4255 } 4256 break 4257 } 4258 4259 windowSelector.resize(parallaxObjResize); 4260 parallaxObjResize(); 4261 4262 if (!liteMode) { 4263 windowSelector.scroll(parallaxMove); 4264 } 4265 } 4266 4267 function parallaxObjResize() { 4268 documentWidth = documentSelector.width(); 4269 windowHeight = windowSelector.height(); 4270 4271 objHeight = obj.height(); 4272 4273 obj_bg.width(documentWidth); 4274 obj_bg.css({'width' : documentWidth, 'margin-left' : Math.floor(documentWidth*-0.5), 'left' : '50%'}); 4275 4276 baseHeight = getBaseHeight(parallaxType, objHeight, bufferRatio); 4277 objectResize(obj_bg_inner, documentWidth, baseHeight, originalWidth, originalHeight); 4278 4279 if (!liteMode) { 4280 parallaxMove(); 4281 } 4282 } 4283 4284 function parallaxMove() { 4285 if (parallax && !liteMode) { 4286 var documentScrollTop, 4287 startScrollTop, 4288 endScrollTop; 4289 4290 objOffsetTop = obj.offset().top; 4291 documentScrollTop = documentSelector.scrollTop(); 4292 4293 startScrollTop = documentScrollTop + windowHeight; 4294 endScrollTop = documentScrollTop - objHeight; 4295 4296 if ((startScrollTop > objOffsetTop) && (endScrollTop < objOffsetTop)) { 4297 y = documentScrollTop - objOffsetTop; 4298 4299 if (!parallaxInvert) { 4300 newPositionTop = parseInt(y / bufferRatio); 4301 } else { 4302 newPositionTop = -parseInt(y / bufferRatio) - parseInt(windowHeight / bufferRatio) 4303 } 4304 4305 obj_bg_inner.css({top: newPositionTop + 'px'}); 4306 } 4307 } 4308 } 4309 } 4310 4311 function objectResize(obj, baseWidth, baseHeight, originalWidth, originalHeight ) { 4312 var imageRatio, 4313 originalWidth, 4314 originalHeight, 4315 newImgWidth, 4316 newImgHeight, 4317 newImgTop, 4318 newImgLeft; 4319 4320 imageRatio = originalHeight/originalWidth; 4321 containerRatio = baseHeight/baseWidth; 4322 4323 if (containerRatio > imageRatio) { 4324 newImgHeight = baseHeight; 4325 newImgWidth = Math.round((newImgHeight*originalWidth) / originalHeight); 4326 } else { 4327 newImgWidth = baseWidth; 4328 newImgHeight = Math.round((newImgWidth*originalHeight) / originalWidth); 4329 } 4330 4331 newImgLeft =- (newImgWidth-baseWidth) * .5; 4332 newImgTop =- (newImgHeight-baseHeight) * .5; 4333 4334 obj.css({width: newImgWidth, height: newImgHeight, marginTop: newImgTop, marginLeft: newImgLeft}); 4335 } 4336 4337 function getBaseHeight(parallaxType, objHeight, bufferRatio) { 4338 var newBaseHeight = 0; 4339 4340 switch (parallaxType) { 4341 case 'parallax_normal': 4342 newBaseHeight = objHeight + parseInt((windowHeight - objHeight)/bufferRatio); 4343 break 4344 case 'parallax_invert': 4345 newBaseHeight = objHeight + parseInt((windowHeight + objHeight)/bufferRatio); 4346 break 4347 case 'parallax_fixes': 4348 newBaseHeight = windowHeight; 4349 break 4350 case 'parallax_none': 4351 newBaseHeight = objHeight; 4352 break 4353 } 4354 4355 return newBaseHeight; 4356 } 4357 4358 function getInternetExplorerVersion() { 4359 var rv = -1; 4360 if (navigator.appName == 'Microsoft Internet Explorer') { 4361 var ua = navigator.userAgent, 4362 re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 4363 4364 if (re.exec(ua) != null) { 4365 rv = parseFloat(RegExp.$1); 4366 } 4367 } else if (navigator.appName == 'Netscape') { 4368 var ua = navigator.userAgent, 4369 re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})"); 4370 4371 if (re.exec(ua) != null) { 4372 rv = parseFloat(RegExp.$1); 4373 } 4374 } 4375 4376 return rv; 4377 } 4378 } 4379}); 4380;/*})'"*/;/*})'"*/ 4381jQuery(document).ready(function(){ 4382 jQuery('#fform .rightfsection input[type=text]').focus(function(){ 4383 var parent = jQuery(this).closest('.fsection'); 4384 //alert(parent.attr('class')); 4385 jQuery('#fform .leftfsection input').removeAttr('checked'); 4386 jQuery('.leftfsection input', parent).attr('checked', 'checked'); 4387 }) 4388 4389 jQuery('#fform .rightfsection select').focus(function(){ 4390 var parent = jQuery(this).closest('.fsection'); 4391 //alert(parent.attr('class')); 4392 jQuery('#fform .leftfsection input').removeAttr('checked'); 4393 jQuery('.leftfsection input', parent).attr('checked', 'checked'); 4394 }) 4395}) 4396 4397function subjectChanged() 4398{ 4399 jQuery.ajax({ 4400 url: "/subjectchanged", 4401 type: "GET", 4402 data: jQuery('#fform').serialize(), 4403 success: function(data){ 4404 jQuery('#fform #regionId').html(data); 4405 } 4406 }); 4407} 4408 4409function regionChanged() 4410{ 4411 jQuery.ajax({ 4412 url: "/regionchanged", 4413 type: "GET", 4414 data: jQuery('#fform').serialize(), 4415 success: function(data){ 4416 jQuery('#fform #settlementTypeId').removeAttr('disabled'); 4417 jQuery('#fform #settlementId').removeAttr('disabled'); 4418 4419 jQuery('#fform #settlementTypeId').html(data); 4420 } 4421 }); 4422} 4423 4424function cityChanged() 4425{ 4426 jQuery.ajax({ 4427 url: "/citychanged", 4428 type: "GET", 4429 data: jQuery('#fform').serialize(), 4430 success: function(data){ 4431 jQuery('#fform #settlementId').html(data); 4432 } 4433 }); 4434} 4435;/*})'"*/;/*})'"*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.