PageSourceSearch

https://www.dedoshop.com/media/js/29f90d2fa277358ccd285441b6ef99f4.js

js dedoshop.com collected 2026-10-10 02:21:22 UTC 714,801 bytes, 11,351 lines download raw bytes

1var Prototype={Version:"1.7.3",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div"),b=document.createElement("form"),a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script\\s*>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class=(function(){var d=(function(){for(var e in {toString:1}){if(e==="toString"){return false}}return true})();function a(){}function b(){var h=null,g=$A(arguments);if(Object.isFunction(g[0])){h=g.shift()}function e(){this.initialize.apply(this,arguments)}Object.extend(e,Class.Methods);e.superclass=h;e.subclasses=[];if(h){a.prototype=h.prototype;e.prototype=new a;h.subclasses.push(e)}for(var f=0,j=g.length;f<j;f++){e.addMethods(g[f])}if(!e.prototype.initialize){e.prototype.initialize=Prototype.emptyFunction}e.prototype.constructor=e;return e}function c(l){var g=this.superclass&&this.superclass.prototype,f=Object.keys(l);if(d){if(l.toString!=Object.prototype.toString){f.push("toString")}if(l.valueOf!=Object.prototype.valueOf){f.push("valueOf")}}for(var e=0,h=f.length;e<h;e++){var k=f[e],j=l[k];if(g&&Object.isFunction(j)&&j.argumentNames()[0]=="$super"){var m=j;j=(function(i){return function(){return g[i].apply(this,arguments)}})(k).wrap(m);j.valueOf=(function(i){return function(){return i.valueOf.call(i)}})(m);j.toString=(function(i){return function(){return i.toString.call(i)}})(m)}this.prototype[k]=j}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var y=Object.prototype.toString,k=Object.prototype.hasOwnProperty,z="Null",B="Undefined",K="Boolean",w="Number",v="String",I="Object",i="[object Function]",d="[object Boolean]",j="[object Number]",f="[object String]",b="[object Array]",H="[object Date]",e=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";var q=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var a=(function(){for(var L in {toString:1}){if(L==="toString"){return false}}return true})();function D(M){switch(M){case null:return z;case (void 0):return B}var L=typeof M;switch(L){case"boolean":return K;case"number":return w;case"string":return v}return I}function h(L,N){for(var M in N){L[M]=N[M]}return L}function l(L){try{if(o(L)){return"undefined"}if(L===null){return"null"}return L.inspect?L.inspect():String(L)}
1catch(M){if(M instanceof RangeError){return"..."}throw M}}function A(L){return m("",{"":L},[])}function m(U,R,S){var T=R[U];if(D(T)===I&&typeof T.toJSON==="function"){T=T.toJSON(U)}var N=y.call(T);switch(N){case j:case d:case f:T=T.valueOf()}switch(T){case null:return"null";case true:return"true";case false:return"false"}var Q=typeof T;switch(Q){case"string":return T.inspect(true);case"number":return isFinite(T)?String(T):"null";case"object":for(var M=0,L=S.length;M<L;M++){if(S[M]===T){throw new TypeError("Cyclic reference to '"+T+"' in object")}}S.push(T);var P=[];if(N===b){for(var M=0,L=T.length;M<L;M++){var O=m(M,T,S);P.push(typeof O==="undefined"?"null":O)}P="["+P.join(",")+"]"}else{var V=Object.keys(T);for(var M=0,L=V.length;M<L;M++){var U=V[M],O=m(U,T,S);if(typeof O!=="undefined"){P.push(U.inspect(true)+":"+O)}}P="{"+P.join(",")+"}"}S.pop();return P}}function J(L){return JSON.stringify(L)}function C(L){return $H(L).toQueryString()}function p(L){return L&&L.toHTML?L.toHTML():String.interpret(L)}function x(L){if(D(L)!==I){throw new TypeError()}var N=[];for(var O in L){if(k.call(L,O)){N.push(O)}}if(a){for(var M=0;O=q[M];M++){if(k.call(L,O)){N.push(O)}}}return N}function G(L){var M=[];for(var N in L){M.push(L[N])}return M}function s(L){return h({},L)}function E(L){return !!(L&&L.nodeType==1)}function u(L){return y.call(L)===b}var c=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(c){u=Array.isArray}function r(L){return L instanceof Hash}function n(L){return y.call(L)===i}function g(L){return y.call(L)===f}function F(L){return y.call(L)===j}function t(L){return y.call(L)===H}function o(L){return typeof L==="undefined"}h(Object,{extend:h,inspect:l,toJSON:e?J:A,toQueryString:C,toHTML:p,keys:Object.keys||x,values:G,clone:s,isElement:E,isArray:u,isHash:r,isFunction:n,isString:g,isNumber:F,isDate:t,isUndefined:o})})();Object.extend(Function.prototype,(function(){var l=Array.prototype.slice;function d(p,m){var o=p.length,n=m.length;while(n--){p[o+n]=m[n]}return p}function j(n,m){n=l.call(n,0);return d(n,m)}function g(){var m=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return m.length==1&&!m[0]?[]:m}function h(o){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}if(!Object.isFunction(this)){throw new TypeError("The object is not callable.")}var q=function(){};var m=this,n=l.call(arguments,1);var p=function(){var r=j(n,arguments);var s=this instanceof p?this:o;return m.apply(s,r)};q.prototype=this.prototype;p.prototype=new q();return p}function f(o){var m=this,n=l.call(arguments,1);return function(q){var p=d([q||window.event],n);return m.apply(o,p)}}function k(){if(!arguments.length){return this}var m=this,n=l.call(arguments,0);return function(){var o=j(n,arguments);return m.apply(this,o)}}function e(o){var m=this,n=l.call(arguments,1);o=o*1000;return window.setTimeout(function(){return m.apply(m,n)},o)}function a(){var m=d([0.01],arguments);return this.delay.apply(this,m)}function c(n){var m=this;return function(){var o=d([m.bind(this)],arguments);return n.apply(this,o)}}function b(){if(this._methodized){return this._methodized}var m=this;return this._methodized=function(){var n=d([this],arguments);return m.apply(null,n)}}var i={argumentNames:g,bindAsEventListener:f,curry:k,delay:e,defer:a,wrap:c,methodize:b};if(!Function.prototype.bind){i.bind=h}return i})());(function(c){function b(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function a(){return this.toISOString()}if(!c.toISOString){c.toISOString=b}if(!c.toJSON){c.toJSON=a}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function isNonEmptyRegExp(regexp){return regexp.source&&regexp.source!=="(?:)"}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||isNonEmptyRegExp(pattern))){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){match=source.match(pattern);if(match&&match[0].length>0){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;
1return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=value.gsub("+"," ");value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff\u0000]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCo
1deAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern,position){position=Object.isNumber(position)?position:0;return this.lastIndexOf(pattern,position)===position}function endsWith(pattern,position){pattern=String(pattern);position=Object.isNumber(position)?position:this.length;if(position<0){position=0}if(position>this.length){position=this.length}var d=position-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:String.prototype.startsWith||startsWith,endsWith:String.prototype.endsWith||endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(d){if(a==null){return(d[1]+"")}var f=d[1]||"";if(f=="\\"){return d[2]}var b=a,g=d[3],e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;d=e.exec(g);if(d==null){return f}while(d!=null){var c=d[1].startsWith("[")?d[2].replace(/\\\\]/g,"]"):d[1];b=b[c];if(null==b||""==d[3]){break}g=g.substring("["==d[3]?d[1].length:d[0].length);d=e.exec(g)}return f+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(x,w){try{this._each(x,w)}catch(y){if(y!=$break){throw y}}return this}function r(z,y,x){var w=-z,A=[],B=this.toArray();if(z<1){return B}while((w+=z)<B.length){A.push(B.slice(w,w+z))}return A.collect(y,x)}function b(y,x){y=y||Prototype.K;var w=true;this.each(function(A,z){w=w&&!!y.call(x,A,z,this);if(!w){throw $break}},this);return w}function i(y,x){y=y||Prototype.K;var w=false;this.each(function(A,z){if(w=!!y.call(x,A,z,this)){throw $break}},this);return w}function j(y,x){y=y||Prototype.K;var w=[];this.each(function(A,z){w.push(y.call(x,A,z,this))},this);return w}function t(y,x){var w;this.each(function(A,z){if(y.call(x,A,z,this)){w=A;throw $break}},this);return w}function h(y,x){var w=[];this.each(function(A,z){if(y.call(x,A,z,this)){w.push(A)}},this);return w}function g(z,y,x){y=y||Prototype.K;var w=[];if(Object.isString(z)){z=new RegExp(RegExp.escape(z))}this.each(function(B,A){if(z.match(B)){w.push(y.call(x,B,A,this))}},this);return w}function a(w){if(Object.isFunction(this.indexOf)&&this.indexOf(w)!=-1){return true}var x=false;this.each(function(y){if(y==w){x=true;throw $break}});return x}function q(x,w){w=Object.isUndefined(w)?null:w;return this.eachSlice(x,function(y){while(y.length<x){y.push(w)}return y})}function l(w,y,x){this.each(function(A,z){w=y.call(x,w,A,z,this)},this);return w}function v(x){var w=$A(arguments).slice(1);return this.map(function(y){return y[x].apply(y,w)})}function p(y,x){y=y||Prototype.K;var w;this.each(function(A,z){A=y.call(x,A,z,this);if(w==null||A>=w){w=A}},this);return w}function n(y,x){y=y||Prototype.K;var w;this.each(function(A,z){A=y.call(x,A,z,this);if(w==null||A<w){w=A}},this);return w}function e(z,x){z=z||Prototype.K;var y=[],w=[];this.each(function(B,A){(z.call(x,B,A,this)?y:w).push(B)},this);return[y,w]}function f(x){var w=[];this.each(function(y){w.push(y[x])});return w}function d(y,x){var w=[];this.each(function(A,z){if(!y.call(x,A,z,this)){w.push(A)}},this);return w}function m(x,w){return this.map(function(z,y){return{value:z,criteria:x.call(w,z,y,this)}},this).sort(function(B,A){var z=B.criteria,y=A.criteria;return z<y?-1:z>y?1:0}).pluck("value")}function o(){return this.map()}function s(){var x=Prototype.K,w=$A(arguments);if(Object.isFunction(w.last())){x=w.pop()}var y=[this].concat(w).map($A);return this.map(function(A,z){return x(y.pluck(z))})}function k(){return this.toArray().length}function u(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:r,all:b,every:b,any:i,some:i,collect:j,map:j,detect:t,findAll:h,select:h,filter:h,grep:g,include:a,member:a,inGroupsOf:q,inject:l,invoke:v,max:p,min:n,partition:e,pluck:f,reject:d,sortBy:m,toArray:o,entries:o,zip:s,size:k,inspect:u,find:t}})();function $A(c){if(!c){return[]}if("toArray" in Object(c)){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var v=Array.prototype,o=v.slice,q=v.forEach;function b(B,A){for(var z=0,C=this.length>>>0;z<C;z++){if(z in this){B.call(A,this[z],z,this)}}}if(!q){q=b}function n(){this.length=0;return this}function d(){return this[0]}function g(){return this[this.length-1]}function k(){return this.select(function(z){return z!=null})}function y(){return this.inject([],function(A,z){if(Object.isArray(z)){return A.concat(z.flatten())}A.push(z);return A})}function j(){var z=o.call(arguments,0);return this.select(function(A){return !z.include(A)})}function f(z){return(z===false?this.toArray():this)._reverse()}function m(z){return this.inject([],function(C,B,A){if(0==A||(z?C.last()!=B:!C.include(B))){C.push(B)}return C})}function r(z){return this.uniq().findAll(function(A){return z.indexOf(A)!==-1})}function t(){return o.call(this,0)}function l(){return this.length}function w(){return"["+this.map(Object.inspect).join(", ")+"]"}function a(C,A){if(this==null){throw new TypeError()}var D=Object(this),B=D.length>>>0;if(B===0){return -1}A=Number(A);
1if(isNaN(A)){A=0}else{if(A!==0&&isFinite(A)){A=(A>0?1:-1)*Math.floor(Math.abs(A))}}if(A>B){return -1}var z=A>=0?A:Math.max(B-Math.abs(A),0);for(;z<B;z++){if(z in D&&D[z]===C){return z}}return -1}function p(C,A){if(this==null){throw new TypeError()}var D=Object(this),B=D.length>>>0;if(B===0){return -1}if(!Object.isUndefined(A)){A=Number(A);if(isNaN(A)){A=0}else{if(A!==0&&isFinite(A)){A=(A>0?1:-1)*Math.floor(Math.abs(A))}}}else{A=B}var z=A>=0?Math.min(A,B-1):B-Math.abs(A);for(;z>=0;z--){if(z in D&&D[z]===C){return z}}return -1}function c(G){var E=[],F=o.call(arguments,0),H,A=0;F.unshift(this);for(var D=0,z=F.length;D<z;D++){H=F[D];if(Object.isArray(H)&&!("callee" in H)){for(var C=0,B=H.length;C<B;C++){if(C in H){E[A]=H[C]}A++}}else{E[A++]=H}}E.length=A;return E}function s(z){return function(){if(arguments.length===0){return z.call(this,Prototype.K)}else{if(arguments[0]===undefined){var A=o.call(arguments,1);A.unshift(Prototype.K);return z.apply(this,A)}else{return z.apply(this,arguments)}}}}function u(D){if(this==null){throw new TypeError()}D=D||Prototype.K;var z=Object(this);var C=[],B=arguments[1],F=0;for(var A=0,E=z.length>>>0;A<E;A++){if(A in z){C[F]=D.call(B,z[A],A,z)}F++}C.length=F;return C}if(v.map){u=s(Array.prototype.map)}function h(D){if(this==null||!Object.isFunction(D)){throw new TypeError()}var z=Object(this);var C=[],B=arguments[1],F;for(var A=0,E=z.length>>>0;A<E;A++){if(A in z){F=z[A];if(D.call(B,F,A,z)){C.push(F)}}}return C}if(v.filter){h=Array.prototype.filter}function i(C){if(this==null){throw new TypeError()}C=C||Prototype.K;var B=arguments[1];var z=Object(this);for(var A=0,D=z.length>>>0;A<D;A++){if(A in z&&C.call(B,z[A],A,z)){return true}}return false}if(v.some){i=s(Array.prototype.some)}function x(C){if(this==null){throw new TypeError()}C=C||Prototype.K;var B=arguments[1];var z=Object(this);for(var A=0,D=z.length>>>0;A<D;A++){if(A in z&&!C.call(B,z[A],A,z)){return false}}return true}if(v.every){x=s(Array.prototype.every)}Object.extend(v,Enumerable);if(v.entries===Enumerable.entries){delete v.entries}if(!v._reverse){v._reverse=v.reverse}Object.extend(v,{_each:q,map:u,collect:u,select:h,filter:h,findAll:h,some:i,any:i,every:x,all:x,clear:n,first:d,last:g,compact:k,flatten:y,without:j,reverse:f,uniq:m,intersect:r,clone:t,toArray:t,size:l,inspect:w});var e=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(e){v.concat=c}if(!v.indexOf){v.indexOf=a}if(!v.lastIndexOf){v.lastIndexOf=p}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function e(p){this._object=Object.isHash(p)?p.toObject():Object.clone(p)}function f(s,r){var q=0;for(var p in this._object){var t=this._object[p],u=[p,t];u.key=p;u.value=t;s.call(r,u,q);q++}}function j(p,q){return this._object[p]=q}function c(p){if(this._object[p]!==Object.prototype[p]){return this._object[p]}}function m(p){var q=this._object[p];delete this._object[p];return q}function o(){return Object.clone(this._object)}function n(){return this.pluck("key")}function l(){return this.pluck("value")}function g(q){var p=this.detect(function(r){return r.value===q});return p&&p.key}function i(p){return this.clone().update(p)}function d(p){return new Hash(p).inject(this,function(q,r){q.set(r.key,r.value);return q})}function b(p,q){if(Object.isUndefined(q)){return p}q=String.interpret(q);q=q.gsub(/(\r)?\n/,"\r\n");q=encodeURIComponent(q);q=q.gsub(/%20/,"+");return p+"="+q}function a(){return this.inject([],function(t,w){var s=encodeURIComponent(w.key),q=w.value;if(q&&typeof q=="object"){if(Object.isArray(q)){var v=[];for(var r=0,p=q.length,u;r<p;r++){u=q[r];v.push(b(s,u))}return t.concat(v)}}else{t.push(b(s,q))}return t}).join("&")}function k(){return"#<Hash:{"+this.map(function(p){return p.map(Object.inspect).join(": ")}).join(", ")+"}>"}function h(){return new Hash(this)}return{initialize:e,_each:f,set:j,get:c,unset:m,toObject:o,toTemplateReplacements:o,keys:n,values:l,index:g,merge:i,update:d,toQueryString:a,inspect:k,toJSON:o,clone:h}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function d(){return this.toPaddedString(2,16)}function b(){return this+1}function h(j,i){$R(0,this,true).each(j,i);return this}function g(k,j){var i=this.toString(j||10);return"0".times(k-i.length)+i}function a(){return Math.abs(this)}function c(){return Math.round(this)}function e(){return Math.ceil(this)}function f(){return Math.floor(this)}return{toColorPart:d,succ:b,times:h,toPaddedString:g,abs:a,round:c,ceil:e,floor:f}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(f,d,e){this.start=f;this.end=d;this.exclusive=e}function c(f,e){var g=this.start,d;for(d=0;this.include(g);d++){f.call(e,g,d);g=g.succ()}}
1function a(d){if(d<this.start){return false}if(this.exclusive){return d<this.end}return d<=this.end}return{initialize:b,_each:c,include:a}})());var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(b,a){this.responders._each(b,a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(d,b,c,a){this.each(function(f){if(Object.isFunction(f[d])){try{f[d].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var d=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){d+=(d?"&":"")+"_method="+this.method;this.method="post"}if(d&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+d}this.parameters=d.toQueryParams();try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){e.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,d=c.length;b<d;b+=2){e[c[b]]=c[b+1]}}else{$H(c).each(function(f){e[f.key]=f.value})}}for(var a in e){if(e[a]!=null){this.transport.setRequestHeader(a,e[a])}}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)||a==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(d){this.dispatchException(d)}var f=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&f&&f.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});
1Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var d=this.transport=c.transport,a=this.readyState=d.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(d.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=d.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}try{a=decodeURIComponent(escape(a))}catch(b){}try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var d=b.onComplete;b.onComplete=(function(e,f){this.updateContent(e.responseText);if(Object.isFunction(d)){d(e,f)}}).bind(this);$super(c,b)},updateContent:function(d){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){d=d.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=d;c.insert(b)}else{a.insertion(c,d)}}else{c.update(d)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});(function(a8){var aE;var a1=Array.prototype.slice;var av=document.createElement("div");function aZ(bp){if(arguments.length>1){for(var F=0,br=[],bq=arguments.length;F<bq;F++){br.push(aZ(arguments[F]))}return br}if(Object.isString(bp)){bp=document.getElementById(bp)}return aF.extend(bp)}a8.$=aZ;if(!a8.Node){a8.Node={}}if(!a8.Node.ELEMENT_NODE){Object.extend(a8.Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}var r={};function aQ(F,i){if(F==="select"){return false}if("type" in i){return false}return true}var d=(function(){try{var i=document.createElement('<input name="x">');return i.tagName.toLowerCase()==="input"&&i.name==="x"}catch(F){return false}})();var aI=a8.Element;function aF(F,i){i=i||{};F=F.toLowerCase();if(d&&i.name){F="<"+F+' name="'+i.name+'">';delete i.name;return aF.writeAttribute(document.createElement(F),i)}if(!r[F]){r[F]=aF.extend(document.createElement(F))}var bp=aQ(F,i)?r[F].cloneNode(false):document.createElement(F);return aF.writeAttribute(bp,i)}a8.Element=aF;Object.extend(a8.Element,aI||{});if(aI){a8.Element.prototype=aI.prototype}aF.Methods={ByTag:{},Simulated:{}};var a3={};var H={id:"id",className:"class"};function ba(F){F=aZ(F);var i="<"+F.tagName.toLowerCase();var bp,br;for(var bq in H){bp=H[bq];br=(F[bq]||"").toString();if(br){i+=" "+bp+"="+br.inspect(true)}}return i+">"}a3.inspect=ba;function v(i){return aZ(i).getStyle("display")!=="none"}function ax(F,i){F=aZ(F);if(typeof i!=="boolean"){i=!aF.visible(F)}aF[i?"show":"hide"](F);return F}function aH(i){i=aZ(i);i.style.display="none";return i}function j(i){i=aZ(i);i.style.display="";return i}Object.extend(a3,{visible:v,toggle:ax,hide:aH,show:j});
1function ad(i){i=aZ(i);i.parentNode.removeChild(i);return i}var aT=(function(){var i=document.createElement("select"),F=true;i.innerHTML='<option value="test">test</option>';if(i.options&&i.options[0]){F=i.options[0].nodeName.toUpperCase()!=="OPTION"}i=null;return F})();var I=(function(){try{var i=document.createElement("table");if(i&&i.tBodies){i.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var bp=typeof i.tBodies[0]=="undefined";i=null;return bp}}catch(F){return true}})();var a2=(function(){try{var i=document.createElement("div");i.innerHTML="<link />";var bp=(i.childNodes.length===0);i=null;return bp}catch(F){return true}})();var x=aT||I||a2;var aq=(function(){var i=document.createElement("script"),bp=false;try{i.appendChild(document.createTextNode(""));bp=!i.firstChild||i.firstChild&&i.firstChild.nodeType!==3}catch(F){bp=true}i=null;return bp})();function O(br,bt){br=aZ(br);var bu=br.getElementsByTagName("*"),bq=bu.length;while(bq--){Z(bu[bq])}if(bt&&bt.toElement){bt=bt.toElement()}if(Object.isElement(bt)){return br.update().insert(bt)}bt=Object.toHTML(bt);var bp=br.tagName.toUpperCase();if(bp==="SCRIPT"&&aq){br.text=bt;return br}if(x){if(bp in L.tags){while(br.firstChild){br.removeChild(br.firstChild)}var F=t(bp,bt.stripScripts());for(var bq=0,bs;bs=F[bq];bq++){br.appendChild(bs)}}else{if(a2&&Object.isString(bt)&&bt.indexOf("<link")>-1){while(br.firstChild){br.removeChild(br.firstChild)}var F=t(bp,bt.stripScripts(),true);for(var bq=0,bs;bs=F[bq];bq++){br.appendChild(bs)}}else{br.innerHTML=bt.stripScripts()}}}else{br.innerHTML=bt.stripScripts()}bt.evalScripts.bind(bt).defer();return br}function ah(F,bp){F=aZ(F);if(bp&&bp.toElement){bp=bp.toElement()}else{if(!Object.isElement(bp)){bp=Object.toHTML(bp);var i=F.ownerDocument.createRange();i.selectNode(F);bp.evalScripts.bind(bp).defer();bp=i.createContextualFragment(bp.stripScripts())}}F.parentNode.replaceChild(bp,F);return F}var L={before:function(i,F){i.parentNode.insertBefore(F,i)},top:function(i,F){i.insertBefore(F,i.firstChild)},bottom:function(i,F){i.appendChild(F)},after:function(i,F){i.parentNode.insertBefore(F,i.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};var aJ=L.tags;Object.extend(aJ,{THEAD:aJ.TBODY,TFOOT:aJ.TBODY,TH:aJ.TD});function ao(bp,bs){bp=aZ(bp);if(bs&&bs.toElement){bs=bs.toElement()}if(Object.isElement(bs)){bp.parentNode.replaceChild(bs,bp);return bp}bs=Object.toHTML(bs);var br=bp.parentNode,F=br.tagName.toUpperCase();if(F in L.tags){var bt=aF.next(bp);var i=t(F,bs.stripScripts());br.removeChild(bp);var bq;if(bt){bq=function(bu){br.insertBefore(bu,bt)}}else{bq=function(bu){br.appendChild(bu)}}i.each(bq)}else{bp.outerHTML=bs.stripScripts()}bs.evalScripts.bind(bs).defer();return bp}if("outerHTML" in document.documentElement){ah=ao}function a7(i){if(Object.isUndefined(i)||i===null){return false}if(Object.isString(i)||Object.isNumber(i)){return true}if(Object.isElement(i)){return true}if(i.toElement||i.toHTML){return true}return false}function bn(br,bt,F){F=F.toLowerCase();var bv=L[F];if(bt&&bt.toElement){bt=bt.toElement()}if(Object.isElement(bt)){bv(br,bt);return br}bt=Object.toHTML(bt);var bq=((F==="before"||F==="after")?br.parentNode:br).tagName.toUpperCase();var bu=t(bq,bt.stripScripts());if(F==="top"||F==="after"){bu.reverse()}for(var bp=0,bs;bs=bu[bp];bp++){bv(br,bs)}bt.evalScripts.bind(bt).defer()}function Q(F,bp){F=aZ(F);if(a7(bp)){bp={bottom:bp}}for(var i in bp){bn(F,bp[i],i)}return F}function u(F,bp,i){F=aZ(F);if(Object.isElement(bp)){aZ(bp).writeAttribute(i||{})}else{if(Object.isString(bp)){bp=new aF(bp,i)}else{bp=new aF("div",bp)}}if(F.parentNode){F.parentNode.replaceChild(bp,F)}bp.appendChild(F);return bp}function w(F){F=aZ(F);var bp=F.firstChild;while(bp){var i=bp.nextSibling;if(bp.nodeType===Node.TEXT_NODE&&!/\S/.test(bp.nodeValue)){F.removeChild(bp)}bp=i}return F}function a4(i){return aZ(i).innerHTML.blank()}function t(bs,br,bt){var bq=L.tags[bs],bu=av;var F=!!bq;if(!F&&bt){F=true;bq=["","",0]}if(F){bu.innerHTML="&#160;"+bq[0]+br+bq[1];bu.removeChild(bu.firstChild);for(var bp=bq[2];bp--;){bu=bu.firstChild}}else{bu.innerHTML=br}return $A(bu.childNodes)}function E(bq,F){if(!(bq=aZ(bq))){return}var bs=bq.cloneNode(F);if(!aY){bs._prototypeUID=aE;if(F){var br=aF.select(bs,"*"),bp=br.length;while(bp--){br[bp]._prototypeUID=aE}}}return aF.extend(bs)}function Z(F){var i=M(F);if(i){aF.stopObserving(F);if(!aY){F._prototypeUID=aE}delete aF.Storage[i]}}function bl(bp){var F=bp.length;while(F--){Z(bp[F])}}function at(br){var bq=br.length,bp,F;while(bq--){bp=br[bq];F=M(bp);delete aF.Storage[F];delete Event.cache[F]}}
1if(aY){bl=at}function m(bp){if(!(bp=aZ(bp))){return}Z(bp);var bq=bp.getElementsByTagName("*"),F=bq.length;while(F--){Z(bq[F])}return null}Object.extend(a3,{remove:ad,update:O,replace:ah,insert:Q,wrap:u,cleanWhitespace:w,empty:a4,clone:E,purge:m});function am(i,bp,bq){i=aZ(i);bq=bq||-1;var F=[];while(i=i[bp]){if(i.nodeType===Node.ELEMENT_NODE){F.push(aF.extend(i))}if(F.length===bq){break}}return F}function aL(i){return am(i,"parentNode")}function bm(i){return aF.select(i,"*")}function X(i){i=aZ(i).firstChild;while(i&&i.nodeType!==Node.ELEMENT_NODE){i=i.nextSibling}return aZ(i)}function bi(F){var i=[],bp=aZ(F).firstChild;while(bp){if(bp.nodeType===Node.ELEMENT_NODE){i.push(aF.extend(bp))}bp=bp.nextSibling}return i}function p(i){return am(i,"previousSibling")}function bh(i){return am(i,"nextSibling")}function aV(i){i=aZ(i);var bp=p(i),F=bh(i);return bp.reverse().concat(F)}function aR(F,i){F=aZ(F);if(Object.isString(i)){return Prototype.Selector.match(F,i)}return i.match(F)}function aW(F,bp,bq,i){F=aZ(F),bq=bq||0,i=i||0;if(Object.isNumber(bq)){i=bq,bq=null}while(F=F[bp]){if(F.nodeType!==1){continue}if(bq&&!Prototype.Selector.match(F,bq)){continue}if(--i>=0){continue}return aF.extend(F)}}function aa(F,bp,i){F=aZ(F);if(arguments.length===1){return aZ(F.parentNode)}return aW(F,"parentNode",bp,i)}function y(F,bq,i){if(arguments.length===1){return X(F)}F=aZ(F),bq=bq||0,i=i||0;if(Object.isNumber(bq)){i=bq,bq="*"}var bp=Prototype.Selector.select(bq,F)[i];return aF.extend(bp)}function h(F,bp,i){return aW(F,"previousSibling",bp,i)}function aB(F,bp,i){return aW(F,"nextSibling",bp,i)}function bb(i){i=aZ(i);var F=a1.call(arguments,1).join(", ");return Prototype.Selector.select(F,i)}function aD(bq){bq=aZ(bq);var bs=a1.call(arguments,1).join(", ");var bt=aF.siblings(bq),bp=[];for(var F=0,br;br=bt[F];F++){if(Prototype.Selector.match(br,bs)){bp.push(br)}}return bp}function D(F,i){F=aZ(F),i=aZ(i);if(!F||!i){return false}while(F=F.parentNode){if(F===i){return true}}return false}function B(F,i){F=aZ(F),i=aZ(i);if(!F||!i){return false}if(!i.contains){return D(F,i)}return i.contains(F)&&i!==F}function J(F,i){F=aZ(F),i=aZ(i);if(!F||!i){return false}return(F.compareDocumentPosition(i)&8)===8}var aM;if(av.compareDocumentPosition){aM=J}else{if(av.contains){aM=B}else{aM=D}}Object.extend(a3,{recursivelyCollect:am,ancestors:aL,descendants:bm,firstDescendant:X,immediateDescendants:bi,previousSiblings:p,nextSiblings:bh,siblings:aV,match:aR,up:aa,down:y,previous:h,next:aB,select:bb,adjacent:aD,descendantOf:aM,getElementsBySelector:bb,childElements:bi});var T=1;function aU(i){i=aZ(i);var F=aF.readAttribute(i,"id");if(F){return F}do{F="anonymous_element_"+T++}while(aZ(F));aF.writeAttribute(i,"id",F);return F}function a9(F,i){return aZ(F).getAttribute(i)}function K(F,i){F=aZ(F);var bp=aG.read;if(bp.values[i]){return bp.values[i](F,i)}if(bp.names[i]){i=bp.names[i]}if(i.include(":")){if(!F.attributes||!F.attributes[i]){return null}return F.attributes[i].value}return F.getAttribute(i)}function e(F,i){if(i==="title"){return F.title}return F.getAttribute(i)}var U=(function(){av.setAttribute("onclick",[]);var i=av.getAttribute("onclick");var F=Object.isArray(i);av.removeAttribute("onclick");return F})();if(U){a9=K}else{if(Prototype.Browser.Opera){a9=e}}function a0(bq,bp,bs){bq=aZ(bq);var F={},br=aG.write;if(typeof bp==="object"){F=bp}else{F[bp]=Object.isUndefined(bs)?true:bs}for(var i in F){bp=br.names[i]||i;bs=F[i];if(br.values[i]){bs=br.values[i](bq,bs);if(Object.isUndefined(bs)){continue}}if(bs===false||bs===null){bq.removeAttribute(bp)}else{if(bs===true){bq.setAttribute(bp,bp)}else{bq.setAttribute(bp,bs)}}}return bq}var a=(function(){if(!d){return false}var F=document.createElement('<input type="checkbox">');F.checked=true;var i=F.getAttributeNode("checked");return !i||!i.specified})();function Y(i,bp){bp=aG.has[bp]||bp;var F=aZ(i).getAttributeNode(bp);return !!(F&&F.specified)}function bg(i,F){if(F==="checked"){return i.checked}return Y(i,F)}a8.Element.Methods.Simulated.hasAttribute=a?bg:Y;function k(i){return new aF.ClassNames(i)}var V={};function f(F){if(V[F]){return V[F]}var i=new RegExp("(^|\\s+)"+F+"(\\s+|$)");V[F]=i;return i}function al(i,F){if(!(i=aZ(i))){return}var bp=i.className;if(bp.length===0){return false}if(bp===F){return true}return f(F).test(bp)}function o(i,F){if(!(i=aZ(i))){return}if(!al(i,F)){i.className+=(i.className?" ":"")+F}return i}function au(i,F){if(!(i=aZ(i))){return}i.className=i.className.replace(f(F)," ").strip();return i}function ae(F,bp,i){if(!(F=aZ(F))){return}if(Object.isUndefined(i)){i=!al(F,bp)}var bq=aF[i?"addClassName":"removeClassName"];return bq(F,bp)}var aG={};var aP="className",ar="for";av.setAttribute(aP,"x");
1if(av.className!=="x"){av.setAttribute("class","x");if(av.className==="x"){aP="class"}}var aK=document.createElement("label");aK.setAttribute(ar,"x");if(aK.htmlFor!=="x"){aK.setAttribute("htmlFor","x");if(aK.htmlFor==="x"){ar="htmlFor"}}aK=null;function ac(i,F){return i.getAttribute(F)}function g(i,F){return i.getAttribute(F,2)}function A(i,bp){var F=i.getAttributeNode(bp);return F?F.value:""}function bj(i,F){return aZ(i).hasAttribute(F)?F:null}av.onclick=Prototype.emptyFunction;var P=av.getAttribute("onclick");var aw;if(String(P).indexOf("{")>-1){aw=function(i,F){var bp=i.getAttribute(F);if(!bp){return null}bp=bp.toString();bp=bp.split("{")[1];bp=bp.split("}")[0];return bp.strip()}}else{if(P===""){aw=function(i,F){var bp=i.getAttribute(F);if(!bp){return null}return bp.strip()}}}aG.read={names:{"class":aP,className:aP,"for":ar,htmlFor:ar},values:{style:function(i){return i.style.cssText.toLowerCase()},title:function(i){return i.title}}};aG.write={names:{className:"class",htmlFor:"for",cellpadding:"cellPadding",cellspacing:"cellSpacing"},values:{checked:function(i,F){F=!!F;i.checked=F;return F?"checked":null},style:function(i,F){i.style.cssText=F?F:""}}};aG.has={names:{}};Object.extend(aG.write.names,aG.read.names);var a6=$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder");for(var af=0,ag;ag=a6[af];af++){aG.write.names[ag.toLowerCase()]=ag;aG.has.names[ag.toLowerCase()]=ag}Object.extend(aG.read.values,{href:g,src:g,type:ac,action:A,disabled:bj,checked:bj,readonly:bj,multiple:bj,onload:aw,onunload:aw,onclick:aw,ondblclick:aw,onmousedown:aw,onmouseup:aw,onmouseover:aw,onmousemove:aw,onmouseout:aw,onfocus:aw,onblur:aw,onkeypress:aw,onkeydown:aw,onkeyup:aw,onsubmit:aw,onreset:aw,onselect:aw,onchange:aw});Object.extend(a3,{identify:aU,readAttribute:a9,writeAttribute:a0,classNames:k,hasClassName:al,addClassName:o,removeClassName:au,toggleClassName:ae});function W(i){if(i==="float"||i==="styleFloat"){return"cssFloat"}return i.camelize()}function bo(i){if(i==="float"||i==="cssFloat"){return"styleFloat"}return i.camelize()}function C(bp,bq){bp=aZ(bp);var bt=bp.style,F;if(Object.isString(bq)){bt.cssText+=";"+bq;if(bq.include("opacity")){var i=bq.match(/opacity:\s*(\d?\.?\d*)/)[1];aF.setOpacity(bp,i)}return bp}for(var bs in bq){if(bs==="opacity"){aF.setOpacity(bp,bq[bs])}else{var br=bq[bs];if(bs==="float"||bs==="cssFloat"){bs=Object.isUndefined(bt.styleFloat)?"cssFloat":"styleFloat"}bt[bs]=br}}return bp}function aO(F,bp){F=aZ(F);bp=W(bp);var bq=F.style[bp];if(!bq||bq==="auto"){var i=document.defaultView.getComputedStyle(F,null);bq=i?i[bp]:null}if(bp==="opacity"){return bq?parseFloat(bq):1}return bq==="auto"?null:bq}function s(i,F){switch(F){case"height":case"width":if(!aF.visible(i)){return null}var bp=parseInt(aO(i,F),10);if(bp!==i["offset"+F.capitalize()]){return bp+"px"}return aF.measure(i,F);default:return aO(i,F)}}function aj(i,F){i=aZ(i);F=bo(F);var bp=i.style[F];if(!bp&&i.currentStyle){bp=i.currentStyle[F]}if(F==="opacity"){if(!N){return be(i)}else{return bp?parseFloat(bp):1}}if(bp==="auto"){if((F==="width"||F==="height")&&aF.visible(i)){return aF.measure(i,F)+"px"}return null}return bp}function aA(i){return(i||"").replace(/alpha\([^\)]*\)/gi,"")}function ab(i){if(!i.currentStyle||!i.currentStyle.hasLayout){i.style.zoom=1}return i}var N=(function(){av.style.cssText="opacity:.55";return/^0.55/.test(av.style.opacity)})();function z(i,F){i=aZ(i);if(F==1||F===""){F=""}else{if(F<0.00001){F=0}}i.style.opacity=F;return i}function bf(i,bq){if(N){return z(i,bq)}i=ab(aZ(i));var bp=aF.getStyle(i,"filter"),F=i.style;if(bq==1||bq===""){bp=aA(bp);if(bp){F.filter=bp}else{F.removeAttribute("filter")}return i}if(bq<0.00001){bq=0}F.filter=aA(bp)+" alpha(opacity="+(bq*100)+")";return i}function bd(i){return aF.getStyle(i,"opacity")}function be(F){if(N){return bd(F)}var bp=aF.getStyle(F,"filter");if(bp.length===0){return 1}var i=(bp||"").match(/alpha\(opacity=(.*)\)/i);if(i&&i[1]){return parseFloat(i[1])/100}return 1}Object.extend(a3,{setStyle:C,getStyle:aO,setOpacity:z,getOpacity:bd});if("styleFloat" in av.style){a3.getStyle=aj;a3.setOpacity=bf;a3.getOpacity=be}var l=0;a8.Element.Storage={UID:1};function M(i){if(i===window){return 0}if(typeof i._prototypeUID==="undefined"){i._prototypeUID=aF.Storage.UID++}return i._prototypeUID}
1function c(i){if(i===window){return 0}if(i==document){return 1}return i.uniqueID}var aY=("uniqueID" in av);if(aY){M=c}function b(F){if(!(F=aZ(F))){return}var i=M(F);if(!aF.Storage[i]){aF.Storage[i]=$H()}return aF.Storage[i]}function a5(F,i,bp){if(!(F=aZ(F))){return}var bq=b(F);if(arguments.length===2){bq.update(i)}else{bq.set(i,bp)}return F}function aN(bp,F,i){if(!(bp=aZ(bp))){return}var br=b(bp),bq=br.get(F);if(Object.isUndefined(bq)){br.set(F,i);bq=i}return bq}Object.extend(a3,{getStorage:b,store:a5,retrieve:aN});var an={},aX=aF.Methods.ByTag,aC=Prototype.BrowserFeatures;if(!aC.ElementExtensions&&("__proto__" in av)){a8.HTMLElement={};a8.HTMLElement.prototype=av.__proto__;aC.ElementExtensions=true}function bc(i){if(typeof window.Element==="undefined"){return false}if(!d){return false}var bp=window.Element.prototype;if(bp){var br="_"+(Math.random()+"").slice(2),F=document.createElement(i);bp[br]="x";var bq=(F[br]!=="x");delete bp[br];F=null;return bq}return false}var ap=bc("object");function ak(F,i){for(var bq in i){var bp=i[bq];if(Object.isFunction(bp)&&!(bq in F)){F[bq]=bp.methodize()}}}var bk={};function ay(F){var i=M(F);return(i in bk)}function az(bp){if(!bp||ay(bp)){return bp}if(bp.nodeType!==Node.ELEMENT_NODE||bp==window){return bp}var i=Object.clone(an),F=bp.tagName.toUpperCase();if(aX[F]){Object.extend(i,aX[F])}ak(bp,i);bk[M(bp)]=true;return bp}function aS(F){if(!F||ay(F)){return F}var i=F.tagName;if(i&&(/^(?:object|applet|embed)$/i.test(i))){ak(F,aF.Methods);ak(F,aF.Methods.Simulated);ak(F,aF.Methods.ByTag[i.toUpperCase()])}return F}if(aC.SpecificElementExtensions){az=ap?aS:Prototype.K}function S(F,i){F=F.toUpperCase();if(!aX[F]){aX[F]={}}Object.extend(aX[F],i)}function q(F,bp,i){if(Object.isUndefined(i)){i=false}for(var br in bp){var bq=bp[br];if(!Object.isFunction(bq)){continue}if(!i||!(br in F)){F[br]=bq.methodize()}}}function ai(bq){var i;var bp={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(bp[bq]){i="HTML"+bp[bq]+"Element"}if(window[i]){return window[i]}i="HTML"+bq+"Element";if(window[i]){return window[i]}i="HTML"+bq.capitalize()+"Element";if(window[i]){return window[i]}var F=document.createElement(bq),br=F.__proto__||F.constructor.prototype;F=null;return br}function R(br){if(arguments.length===0){G()}if(arguments.length===2){var bt=br;br=arguments[1]}if(!bt){Object.extend(aF.Methods,br||{})}else{if(Object.isArray(bt)){for(var bs=0,bq;bq=bt[bs];bs++){S(bq,br)}}else{S(bt,br)}}var bp=window.HTMLElement?HTMLElement.prototype:aF.prototype;if(aC.ElementExtensions){q(bp,aF.Methods);q(bp,aF.Methods.Simulated,true)}if(aC.SpecificElementExtensions){for(var bq in aF.Methods.ByTag){var F=ai(bq);if(Object.isUndefined(F)){continue}q(F.prototype,aX[bq])}}Object.extend(aF,aF.Methods);Object.extend(aF,aF.Methods.Simulated);delete aF.ByTag;delete aF.Simulated;aF.extend.refresh();r={}}Object.extend(a8.Element,{extend:az,addMethods:R});if(az===Prototype.K){a8.Element.extend.refresh=Prototype.emptyFunction}else{a8.Element.extend.refresh=function(){if(Prototype.BrowserFeatures.ElementExtensions){return}Object.extend(an,aF.Methods);Object.extend(an,aF.Methods.Simulated);bk={}}}function G(){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(aF.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods),BUTTON:Object.clone(Form.Element.Methods)})}aF.addMethods(a3);function n(){av=null;r=null}if(window.attachEvent){window.attachEvent("onunload",n)}})(this);(function(){function k(G){var F=G.match(/^(\d+)%?$/i);if(!F){return null}return(Number(F[1])/100)}function y(G,H){G=$(G);var I=G.style[H];if(!I||I==="auto"){var F=document.defaultView.getComputedStyle(G,null);I=F?F[H]:null}if(H==="opacity"){return I?parseFloat(I):1}return I==="auto"?null:I}function B(F,G){var H=F.style[G];if(!H&&F.currentStyle){H=F.currentStyle[G]}return H}function r(H,G){var J=H.offsetWidth;
1var L=u(H,"borderLeftWidth",G)||0;var F=u(H,"borderRightWidth",G)||0;var I=u(H,"paddingLeft",G)||0;var K=u(H,"paddingRight",G)||0;return J-L-F-I-K}if(!Object.isUndefined(document.documentElement.currentStyle)&&!Prototype.Browser.Opera){y=B}function u(P,Q,G){var J=null;if(Object.isElement(P)){J=P;P=y(J,Q)}if(P===null||Object.isUndefined(P)){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(P)){return window.parseFloat(P)}var K=P.include("%"),H=(G===document.viewport);if(/\d/.test(P)&&J&&J.runtimeStyle&&!(K&&H)){var F=J.style.left,O=J.runtimeStyle.left;J.runtimeStyle.left=J.currentStyle.left;J.style.left=P||0;P=J.style.pixelLeft;J.style.left=F;J.runtimeStyle.left=O;return P}if(J&&K){G=G||J.parentNode;var I=k(P),L=null;var N=Q.include("left")||Q.include("right")||Q.include("width");var M=Q.include("top")||Q.include("bottom")||Q.include("height");if(G===document.viewport){if(N){L=document.viewport.getWidth()}else{if(M){L=document.viewport.getHeight()}}}else{if(N){L=$(G).measure("width")}else{if(M){L=$(G).measure("height")}}}return(L===null)?0:L*I}return 0}function j(F){if(Object.isString(F)&&F.endsWith("px")){return F}return F+"px"}function m(F){while(F&&F.parentNode){var G=F.getStyle("display");if(G==="none"){return false}F=$(F.parentNode)}return true}var g=Prototype.K;if("currentStyle" in document.documentElement){g=function(F){if(!F.currentStyle.hasLayout){F.style.zoom=1}return F}}function i(F){if(F.include("border")){F=F+"-width"}return F.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,G,F){$super();this.element=$(G);Element.Layout.PROPERTIES.each(function(H){this._set(H,null)},this);if(F){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(G,F){return Hash.prototype.set.call(this,G,F)},set:function(G,F){throw"Properties of Element.Layout are read-only."},get:function($super,G){var F=$super(G);return F===null?this._compute(G):F},_begin:function(){if(this._isPrepared()){return}var J=this.element;if(m(J)){this._setPrepared(true);return}var L={position:J.style.position||"",width:J.style.width||"",visibility:J.style.visibility||"",dis
1play:J.style.display||""};J.store("prototype_original_styles",L);var M=y(J,"position"),F=J.offsetWidth;if(F===0||F===null){J.style.display="block";F=J.offsetWidth}var G=(M==="fixed")?document.viewport:J.parentNode;var N={visibility:"hidden",display:"block"};if(M!=="fixed"){N.position="absolute"}J.setStyle(N);var H=J.offsetWidth,I;if(F&&(H===F)){I=r(J,G)}else{if(M==="absolute"||M==="fixed"){I=r(J,G)}else{var O=J.parentNode,K=$(O).getLayout();I=K.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}J.setStyle({width:I+"px"});this._setPrepared(true)},_end:function(){var G=this.element;var F=G.retrieve("prototype_original_styles");G.store("prototype_original_styles",null);G.setStyle(F);this._setPrepared(false)},_compute:function(G){var F=Element.Layout.COMPUTATIONS;if(!(G in F)){throw"Property not found."}return this._set(G,F[G].call(this,this.element))},_isPrepared:function(){return this.element.retrieve("prototype_element_layout_prepared",false)},_setPrepared:function(F){return this.element.store("prototype_element_layout_prepared",F)},toObject:function(){var F=$A(arguments);var G=(F.length===0)?Element.Layout.PROPERTIES:F.join(" ").split(" ");var H={};G.each(function(I){if(!Element.Layout.PROPERTIES.include(I)){return}var J=this.get(I);if(J!=null){H[I]=J}},this);return H},toHash:function(){var F=this.toObject.apply(this,arguments);return new Hash(F)},toCSS:function(){var F=$A(arguments);var H=(F.length===0)?Element.Layout.PROPERTIES:F.join(" ").split(" ");var G={};H.each(function(I){if(!Element.Layout.PROPERTIES.include(I)){return}if(Element.Layout.COMPOSITE_PROPERTIES.include(I)){return}var J=this.get(I);if(J!=null){G[i(I)]=J+"px"}},this);return G},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(H){if(!this._preComputing){this._begin()}var F=this.get("border-box-height");if(F<=0){if(!this._preComputing){this._end()}return 0}var I=this.get("border-top"),G=this.get("border-bottom");var K=this.get("padding-top"),J=this.get("padding-bottom");if(!this._preComputing){this._end()}return F-I-G-K-J},width:function(H){if(!this._preComputing){this._begin()}var G=this.get("border-box-width");if(G<=0){if(!this._preComputing){this._end()}return 0}var K=this.get("border-left"),F=this.get("border-right");var I=this.get("padding-left"),J=this.get("padding-right");if(!this._preComputing){this._end()}return G-K-F-I-J},"padding-box-height":function(G){var F=this.get("height"),I=this.get("padding-top"),H=this.get("padding-bottom");return F+I+H},"padding-box-width":function(F){var G=this.get("width"),H=this.get("padding-left"),I=this.get("padding-right");return G+H+I},"border-box-height":function(G){if(!this._preComputing){this._begin()}var F=G.offsetHeight;if(!this._preComputing){this._end()}return F},"border-box-width":function(F){if(!this._preComputing){this._begin()}var G=F.offsetWidth;if(!this._preComputing){this._end()}return G},"margin-box-height":function(G){var F=this.get("border-box-height"),H=this.get("margin-top"),I=this.get("margin-bottom");if(F<=0){return 0}return F+H+I},"margin-box-width":function(H){var G=this.get("border-box-width"),I=this.get("margin-left"),F=this.get("margin-right");if(G<=0){return 0}return G+I+F},top:function(F){var G=F.positionedOffset();return G.top},bottom:function(F){var I=F.positionedOffset(),G=F.getOffsetParent(),H=G.measure("height");var J=this.get("border-box-height");return H-J-I.top},left:function(F){var G=F.positionedOffset();return G.left},right:function(H){var J=H.positionedOffset(),I=H.getOffsetParent(),F=I.measure("width");var G=this.get("border-box-width");return F-G-J.left},"padding-top":function(F){return u(F,"paddingTop")},"padding-bottom":function(F){return u(F,"paddingBottom")},"padding-left":function(F){return u(F,"paddingLeft")},"padding-right":function(F){return u(F,"paddingRight")},"border-top":function(F){return u(F,"borderTopWidth")},"border-bottom":function(F){return u(F,"borderBottomWidth")},"border-left":function(F){return u(F,"borderLeftWidth")},"border-right":function(F){return u(F,"borderRightWidth")},"margin-top":function(F){return u(F,"marginTop")},"margin-bottom":function(F){return u(F,"marginBottom")},"margin-left":function(F){return u(F,"marginLeft")},"margin-right":function(F){return u(F,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(G){var H=g(G.getOffsetParent());var I=G.getBoundingClientRect(),F=H.getBoundingClientRect();return(F.right-I.right).round()},bottom:function(G){var H=g(G.getOffsetParent());var I=G.getBoundingClientRect(),F=H.getBoundingClientRect();return(F.bottom-I.bottom).round()}})}Element.Offset=Class.create({initialize:function(G,F){this.left=G.round();this.top=F.round();this[0]=this.left;this[1]=this.top},relativeTo:function(F){return new Element.Offset(this.left-F.left,this.top-F.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function z(G,F){return new Element.Layout(G,F)}function d(F,G){return $(F).getLayout().get(G)}function q(F){return Element.getDimensions(F).height}function c(F){return Element.getDimensions(F).width}function s(G){G=$(G);var K=Element.getStyle(G,"display");if(K&&K!=="none"){return{width:G.offsetWidth,height:G.offsetHeight}}var H=G.style;var F={visibility:H.visibility,position:H.position,display:H.display};var J={visibility:"hidden",display:"block"};if(F.position!=="fixed"){J.position="absolute"}Element.setStyle(G,J);var I={width:G.offsetWidth,height:G.offsetHeight};Element.setStyle(G,F);return I}
1function p(F){F=$(F);function H(I){return n(I)?$(document.body):$(I)}if(h(F)||f(F)||o(F)||n(F)){return $(document.body)}var G=(Element.getStyle(F,"display")==="inline");if(!G&&F.offsetParent){return H(F.offsetParent)}while((F=F.parentNode)&&F!==document.body){if(Element.getStyle(F,"position")!=="static"){return H(F)}}return $(document.body)}function C(G){G=$(G);var F=0,H=0;if(G.parentNode){do{F+=G.offsetTop||0;H+=G.offsetLeft||0;G=G.offsetParent}while(G)}return new Element.Offset(H,F)}function w(G){G=$(G);var H=G.getLayout();var F=0,J=0;do{F+=G.offsetTop||0;J+=G.offsetLeft||0;G=G.offsetParent;if(G){if(o(G)){break}var I=Element.getStyle(G,"position");if(I!=="static"){break}}}while(G);J-=H.get("margin-left");F-=H.get("margin-top");return new Element.Offset(J,F)}function b(G){var F=0,H=0;do{if(G===document.body){var I=document.documentElement||document.body.parentNode||document.body;F+=!Object.isUndefined(window.pageYOffset)?window.pageYOffset:I.scrollTop||0;H+=!Object.isUndefined(window.pageXOffset)?window.pageXOffset:I.scrollLeft||0;break}else{F+=G.scrollTop||0;H+=G.scrollLeft||0;G=G.parentNode}}while(G);return new Element.Offset(H,F)}function A(J){var F=0,I=0,H=document.body;J=$(J);var G=J;do{F+=G.offsetTop||0;I+=G.offsetLeft||0;if(G.offsetParent==H&&Element.getStyle(G,"position")=="absolute"){break}}while(G=G.offsetParent);G=J;do{if(G!=H){F-=G.scrollTop||0;I-=G.scrollLeft||0}}while(G=G.parentNode);return new Element.Offset(I,F)}function x(F){F=$(F);if(Element.getStyle(F,"position")==="absolute"){return F}var J=p(F);var I=F.viewportOffset(),G=J.viewportOffset();var K=I.relativeTo(G);var H=F.getLayout();F.store("prototype_absolutize_original_styles",{position:F.getStyle("position"),left:F.getStyle("left"),top:F.getStyle("top"),width:F.getStyle("width"),height:F.getStyle("height")});F.setStyle({position:"absolute",top:K.top+"px",left:K.left+"px",width:H.get("width")+"px",height:H.get("height")+"px"});return F}function l(G){G=$(G);if(Element.getStyle(G,"position")==="relative"){return G}var F=G.retrieve("prototype_absolutize_original_styles");if(F){G.setStyle(F)}return G}function a(F){F=$(F);var G=Element.cumulativeOffset(F);window.scrollTo(G.left,G.top);return F}function v(G){G=$(G);var F=Element.getStyle(G,"position"),H={};if(F==="static"||!F){H.position="relative";if(Prototype.Browser.Opera){H.top=0;H.left=0}Element.setStyle(G,H);Element.store(G,"prototype_made_positioned",true)}return G}function t(F){F=$(F);var H=Element.getStorage(F),G=H.get("prototype_made_positioned");if(G){H.unset("prototype_made_positioned");Element.setStyle(F,{position:"",top:"",bottom:"",left:"",right:""})}return F}function e(G){G=$(G);var I=Element.getStorage(G),F=I.get("prototype_made_clipping");if(Object.isUndefined(F)){var H=Element.getStyle(G,"overflow");I.set("prototype_made_clipping",H);if(H!=="hidden"){G.style.overflow="hidden"}}return G}function D(F){F=$(F);var H=Element.getStorage(F),G=H.get("prototype_made_clipping");if(!Object.isUndefined(G)){H.unset("prototype_made_clipping");F.style.overflow=G||""}return F}function E(I,F,Q){Q=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},Q||{});var H=document.documentElement;F=$(F);I=$(I);var G,O,K,P={};if(Q.setLeft||Q.setTop){G=Element.viewportOffset(F);O=[0,0];if(Element.getStyle(I,"position")==="absolute"){var N=Element.getOffsetParent(I);if(N!==document.body){O=Element.viewportOffset(N)}}}function L(){var R=0,S=0;if(Object.isNumber(window.pageXOffset)){R=window.pageXOffset;S=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){R=document.body.scrollLeft;S=document.body.scrollTop}else{if(H&&(H.scrollLeft||H.scrollTop)){R=H.scrollLeft;S=H.scrollTop}}}return{x:R,y:S}}var J=L();if(Q.setWidth||Q.setHeight){K=Element.getLayout(F)}if(Q.setLeft){P.left=(G[0]+J.x-O[0]+Q.offsetLeft)+"px"}if(Q.setTop){P.top=(G[1]+J.y-O[1]+Q.offsetTop)+"px"}var M=I.getLayout();if(Q.setWidth){P.width=K.get("width")+"px"}if(Q.setHeight){P.height=K.get("height")+"px"}return Element.setStyle(I,P)}if(Prototype.Browser.IE){p=p.wrap(function(H,G){G=$(G);if(h(G)||f(G)||o(G)||n(G)){return $(document.body)}var F=G.getStyle("position");if(F!=="static"){return H(G)}G.setStyle({position:"relative"});var I=H(G);G.setStyle({position:F});return I});w=w.wrap(function(I,G){G=$(G);if(!G.parentNode){return new Element.Offset(0,0)}var F=G.getStyle("position");if(F!=="static"){return I(G)}var H=G.getOffsetParent();if(H&&H.getStyle("position")==="fixed"){g(H)}G.setStyle({position:"relative"});var J=I(G);G.setStyle({position:F});return J})}else{if(Prototype.Browser.Webkit){C=function(G){G=$(G);var F=0,H=0;do{F+=G.offsetTop||0;H+=G.offsetLeft||0;if(G.offsetParent==document.body){if(Element.getStyle(G,"position")=="absolute"){break}}G=G.offsetParent}while(G);return new Element.Offset(H,F)}}}Element.addMethods({getLayout:z,measure:d,getWidth:c,getHeight:q,getDimensions:s,getOffsetParent:p,cumulativeOffset:C,positionedOffset:w,cumulativeScrollOffset:b,viewportOffset:A,absolutize:x,relativize:l,scrollTo:a,makePositioned:v,undoPositioned:t,makeClipping:e,undoClipping:D,clonePosition:E});function o(F){return F.nodeName.toUpperCase()==="BODY"}function n(F){return F.nodeName.toUpperCase()==="HTML"}function h(F){return F.nodeType===Node.DOCUMENT_NODE}function f(F){return F!==document.body&&!Element.descendantOf(F,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(F){F=$(F);if(f(F)){return new Element.Offset(0,0)}var G=F.getBoundingClientRect(),H=document.documentElement;return new Element.Offset(G.left-H.clientLeft,G.top-H.clientTop)}})}})();(function(){var c=Prototype.Browser.Opera&&(window.parseFloat(window.opera.version())<9.5);var f=null;function b(){if(f){return f}f=c?document.body:document.documentElement;return f}function d(){return{width:this.getWidth(),height:this.getHeight()}}function a(){return b().clientWidth}function g(){return b().clientHeight}function e(){var h=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft;var i=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;return new Element.Offset(h,i)}document.viewport={getDimensions:d,getWidth:a,getHeight:g,getScrollOffsets:e}})();window.$$=function(){var a=$A(arguments).join(", ");return Prototype.Selector.select(a,document)};Prototype.Selector=(function(){function a(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function c(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function d(l,m,h){h=h||0;var g=Prototype.Selector.match,k=l.length,f=0,j;for(j=0;j<k;j++){if(g(l[j],m)&&h==f++){return Element.extend(l[j])}}}function e(h){for(var f=0,g=h.length;f<g;f++){Element.extend(h[f])}return h}var b=Prototype.K;return{select:a,match:c,find:d,extendElements:(Element.extend===b)?b:e,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;(function(){function a(b){Prototype._actual_sizzle=b()}a.amd=true;if(typeof define!=="undefined"&&define.amd){Prototype._original_define=define;Prototype._actual_sizzle=null;window.define=a}})();
2/*!
3 * Sizzle CSS Selector Engine v1.10.18
4 * http://sizzlejs.com/
5 *
6 * Copyright 2013 jQuery Foundation, Inc. and other contributors
7 * Released under the MIT license
8 * http://jquery.org/license
9 *
10 * Date: 2014-02-05
11 */
12(function(av){var D,ay,t,M,P,ab,ax,aC,N,ac,ae,H,u,an,ai,aw,k,K,ap="sizzle"+-(new Date()),O=av.document,az=0,aj=0,d=F(),ao=F(),L=F(),J=function(i,e){if(i===e){ac=true}return 0},au=typeof undefined,V=1<<31,T=({}).hasOwnProperty,ar=[],at=ar.pop,R=ar.push,b=ar.push,s=ar.slice,j=ar.indexOf||function(aE){var aD=0,e=this.length;for(;aD<e;aD++){if(this[aD]===aE){return aD}}return -1},c="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",v="[\\x20\\t\\r\\n\\f]",a="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",Q=a.replace("w","w#"),al="\\["+v+"*("+a+")"+v+"*(?:([*^$|!~]?=)"+v+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+Q+")|)|)"+v+"*\\]",q=":("+a+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+al.replace(3,8)+")*)|.*)\\)|)",x=new RegExp("^"+v+"+|((?:^|[^\\\\])(?:\\\\.)*)"+v+"+$","g"),A=new RegExp("^"+v+"*,"+v+"*"),G=new RegExp("^"+v+"*([>+~]|"+v+")"+v+"*"),z=new RegExp("="+v+"*([^\\]'\"]*?)"+v+"*\\]","g"),X=new RegExp(q),Z=new RegExp("^"+Q+"$"),ah={ID:new RegExp("^#("+a+")"),CLASS:new RegExp("^\\.("+a+")"),TAG:new RegExp("^("+a.replace("w","w*")+")"),ATTR:new RegExp("^"+al),PSEUDO:new RegExp("^"+q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+v+"*(even|odd|(([+-]|)(\\d*)n|)"+v+"*(?:([+-]|)"+v+"*(\\d+)|))"+v+"*\\)|)","i"),bool:new RegExp("^(?:"+c+")$","i"),needsContext:new RegExp("^"+v+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+v+"*((?:-\\d)?\\d*)"+v+"*\\)|)(?=[^-]|$)","i")},h=/^(?:input|select|textarea|button)$/i,r=/^h\d$/i,U=/^[^{]+\{\s*\[native \w/,W=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ag=/[+~]/,S=/'|\\/g,y=new RegExp("\\\\([\\da-f]{1,6}
12"+v+"?|("+v+")|.)","ig"),ak=function(e,aE,i){var aD="0x"+aE-65536;return aD!==aD||i?aE:aD<0?String.fromCharCode(aD+65536):String.fromCharCode(aD>>10|55296,aD&1023|56320)};try{b.apply((ar=s.call(O.childNodes)),O.childNodes);ar[O.childNodes.length].nodeType}catch(I){b={apply:ar.length?function(i,e){R.apply(i,s.call(e))}:function(aF,aE){var e=aF.length,aD=0;while((aF[e++]=aE[aD++])){}aF.length=e-1}}}function B(aK,aD,aO,aQ){var aP,aH,aI,aM,aN,aG,aF,e,aE,aL;if((aD?aD.ownerDocument||aD:O)!==H){ae(aD)}aD=aD||H;aO=aO||[];if(!aK||typeof aK!=="string"){return aO}if((aM=aD.nodeType)!==1&&aM!==9){return[]}if(an&&!aQ){if((aP=W.exec(aK))){if((aI=aP[1])){if(aM===9){aH=aD.getElementById(aI);if(aH&&aH.parentNode){if(aH.id===aI){aO.push(aH);return aO}}else{return aO}}else{if(aD.ownerDocument&&(aH=aD.ownerDocument.getElementById(aI))&&K(aD,aH)&&aH.id===aI){aO.push(aH);return aO}}}else{if(aP[2]){b.apply(aO,aD.getElementsByTagName(aK));return aO}else{if((aI=aP[3])&&ay.getElementsByClassName&&aD.getElementsByClassName){b.apply(aO,aD.getElementsByClassName(aI));return aO}}}}if(ay.qsa&&(!ai||!ai.test(aK))){e=aF=ap;aE=aD;aL=aM===9&&aK;if(aM===1&&aD.nodeName.toLowerCase()!=="object"){aG=n(aK);if((aF=aD.getAttribute("id"))){e=aF.replace(S,"\\$&")}else{aD.setAttribute("id",e)}e="[id='"+e+"'] ";aN=aG.length;while(aN--){aG[aN]=e+o(aG[aN])}aE=ag.test(aK)&&Y(aD.parentNode)||aD;aL=aG.join(",")}if(aL){try{b.apply(aO,aE.querySelectorAll(aL));return aO}catch(aJ){}finally{if(!aF){aD.removeAttribute("id")}}}}}return ax(aK.replace(x,"$1"),aD,aO,aQ)}function F(){var i=[];function e(aD,aE){if(i.push(aD+" ")>t.cacheLength){delete e[i.shift()]}return(e[aD+" "]=aE)}return e}function p(e){e[ap]=true;return e}function l(i){var aE=H.createElement("div");try{return !!i(aE)}catch(aD){return false}finally{if(aE.parentNode){aE.parentNode.removeChild(aE)}aE=null}}function aA(aD,aF){var e=aD.split("|"),aE=aD.length;while(aE--){t.attrHandle[e[aE]]=aF}}function f(i,e){var aE=e&&i,aD=aE&&i.nodeType===1&&e.nodeType===1&&(~e.sourceIndex||V)-(~i.sourceIndex||V);if(aD){return aD}if(aE){while((aE=aE.nextSibling)){if(aE===e){return -1}}}return i?1:-1}function C(e){return function(aD){var i=aD.nodeName.toLowerCase();return i==="input"&&aD.type===e}}function g(e){return function(aD){var i=aD.nodeName.toLowerCase();return(i==="input"||i==="button")&&aD.type===e}}function am(e){return p(function(i){i=+i;return p(function(aD,aH){var aF,aE=e([],aD.length,i),aG=aE.length;while(aG--){if(aD[(aF=aE[aG])]){aD[aF]=!(aH[aF]=aD[aF])}}})})}function Y(e){return e&&typeof e.getElementsByTagName!==au&&e}ay=B.support={};P=B.isXML=function(e){var i=e&&(e.ownerDocument||e).documentElement;return i?i.nodeName!=="HTML":false};ae=B.setDocument=function(aD){var e,aE=aD?aD.ownerDocument||aD:O,i=aE.defaultView;if(aE===H||aE.nodeType!==9||!aE.documentElement){return H}H=aE;u=aE.documentElement;an=!P(aE);if(i&&i!==i.top){if(i.addEventListener){i.addEventListener("unload",function(){ae()},false)}else{if(i.attachEvent){i.attachEvent("onunload",function(){ae()})}}}ay.attributes=l(function(aF){aF.className="i";return !aF.getAttribute("className")});ay.getElementsByTagName=l(function(aF){aF.appendChild(aE.createComment(""));return !aF.getElementsByTagName("*").length});ay.getElementsByClassName=U.test(aE.getElementsByClassName)&&l(function(aF){aF.innerHTML="<div class='a'></div><div class='a i'></div>";aF.firstChild.className="i";return aF.getElementsByClassName("i").length===2});ay.getById=l(function(aF){u.appendChild(aF).id=ap;return !aE.getElementsByName||!aE.getElementsByName(ap).length});if(ay.getById){t.find.ID=function(aH,aG){if(typeof aG.getElementById!==au&&an){var aF=aG.getElementById(aH);return aF&&aF.parentNode?[aF]:[]}};t.filter.ID=function(aG){var aF=aG.replace(y,ak);return function(aH){return aH.getAttribute("id")===aF}}}else{delete t.find.ID;t.filter.ID=function(aG){var aF=aG.replace(y,ak);return function(aI){var aH=typeof aI.getAttributeNode!==au&&aI.getAttributeNode("id");return aH&&aH.value===aF}}}t.find.TAG=ay.getElementsByTagName?function(aF,aG){if(typeof aG.getElementsByTagName!==au){return aG.getElementsByTagName(aF)}}:function(aF,aJ){var aK,aI=[],aH=0,aG=aJ.getElementsByTagName(aF);if(aF==="*"){while((aK=aG[aH++])){if(aK.nodeType===1){aI.push(aK)}}return aI}return aG};t.find.CLASS=ay.getElementsByClassName&&function(aG,aF){if(typeof aF.getElementsByClassName!==au&&an){return aF.getElementsByClassName(aG)}};aw=[];ai=[];if((ay.qsa=U.test(aE.querySelectorAll))){l(function(aF){aF.innerHTML="<select t=''><option selected=''></option></select>";if(aF.querySelectorAll("[t^='']").length){ai.push("[*^$]="+v+"*(?:''|\"\")")}if(!aF.querySelectorAll("[selected]").length){ai.push("\\["+v+"*(?:value|"+c+")")}if(!aF.querySelectorAll(":checked").length){ai.push(":checked")}});l(function(aG){var aF=aE.createElement("input");aF.setAttribute("type","hidden");aG.appendChild(aF).setAttribute("name","D");if(aG.querySelectorAll("[name=d]").length){ai.push("name"+v+"*[*^$|!~]?=")}if(!aG.querySelectorAll(":enabled").length){ai.push(":enabled",":disabled")}aG.querySelectorAll("*,:x");ai.push(",.*:")})}if((ay.matchesSelector=U.test((k=u.webkitMatchesSelector||u.mozMatchesSelector||u.oMatchesSelector||u.msMatchesSelector)))){l(function(aF){ay.disconnectedMatch=k.call(aF,"div");k.call(aF,"[s!='']:x");aw.push("!=",q)})}ai=ai.length&&new RegExp(ai.join("|"));aw=aw.length&&new RegExp(aw.join("|"));e=U.test(u.compareDocumentPosition);K=e||U.test(u.contains)?function(aG,aF){var aI=aG.nodeType===9?aG.documentElement:aG,aH=aF&&aF.parentNode;return aG===aH||!!(aH&&aH.nodeType===1&&(aI.contains?aI.contains(aH):aG.compareDocumentPosition&&aG.compareDocumentPosition(aH)&16))}:function(aG,aF){if(aF){while((aF=aF.parentNode)){if(aF===aG){return true}}}return false};J=e?function(aG,aF){if(aG===aF){ac=true;return 0}var aH=!aG.compareDocumentPosition-!aF.compareDocumentPosition;if(aH){return aH}aH=(aG.ownerDocument||aG)===(aF.ownerDocument||aF)?aG.compareDocumentPosition(aF):1;if(aH&1||(!ay.sortDetached&&aF.compareDocumentPosition(aG)===aH)){if(aG===aE||aG.ownerDocument===O&&K(O,aG)){return -1}if(aF===aE||aF.ownerDocument===O&&K(O,aF)){return 1}return N?(j.call(N,aG)-j.call(N,aF)):0}return aH&4?-1:1}:function(aG,aF){if(aG===aF){ac=true;return 0}var aM,aJ=0,aL=aG.parentNode,aI=aF.parentNode,aH=[aG],aK=[aF];if(!aL||!aI){return aG===aE?-1:aF===aE?1:aL?-1:aI?1:N?(j.call(N,aG)-j.call(N,aF)):0}else{if(aL===aI){return f(aG,aF)}}aM=aG;while((aM=aM.parentNode)){aH.unshift(aM)}aM=aF;while((aM=aM.parentNode)){aK.unshift(aM)}while(aH[aJ]===aK[aJ]){aJ++}return aJ?f(aH[aJ],aK[aJ]):aH[aJ]===O?-1:aK[aJ]===O?1:0};return aE};B.matches=function(i,e){return B(i,null,null,e)};B.matchesSelector=function(aD,aF){if((aD.ownerDocument||aD)!==H){ae(aD)}aF=aF.replace(z,"='$1']");if(ay.matchesSelector&&an&&(!aw||!aw.test(aF))&&(!ai||!ai.test(aF))){try{var i=k.call(aD,aF);if(i||ay.disconnectedMatch||aD.document&&aD.document.nodeType!==11){return i}}catch(aE){}}return B(aF,H,null,[aD]).length>0};B.contains=function(e,i){if((e.ownerDocument||e)!==H){ae(e)}return K(e,i)};B.attr=function(aD,e){if((aD.ownerDocument||aD)!==H){ae(aD)}var i=t.attrHandle[e.toLowerCase()],aE=i&&T.call(t.attrHandle,e.toLowerCase())?i(aD,e,!an):undefined;return aE!==undefined?aE:ay.attributes||!an?aD.getAttribute(e):(aE=aD.getAttributeNode(e))&&aE.specified?aE.value:null};B.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};B.uniqueSort=function(aE){var aF,aG=[],e=0,aD=0;ac=!ay.detectDuplicates;N=!ay.sortStable&&aE.slice(0);aE.sort(J);
12if(ac){while((aF=aE[aD++])){if(aF===aE[aD]){e=aG.push(aD)}}while(e--){aE.splice(aG[e],1)}}N=null;return aE};M=B.getText=function(aG){var aF,aD="",aE=0,e=aG.nodeType;if(!e){while((aF=aG[aE++])){aD+=M(aF)}}else{if(e===1||e===9||e===11){if(typeof aG.textContent==="string"){return aG.textContent}else{for(aG=aG.firstChild;aG;aG=aG.nextSibling){aD+=M(aG)}}}else{if(e===3||e===4){return aG.nodeValue}}}return aD};t=B.selectors={cacheLength:50,createPseudo:p,match:ah,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){e[1]=e[1].replace(y,ak);e[3]=(e[4]||e[5]||"").replace(y,ak);if(e[2]==="~="){e[3]=" "+e[3]+" "}return e.slice(0,4)},CHILD:function(e){e[1]=e[1].toLowerCase();if(e[1].slice(0,3)==="nth"){if(!e[3]){B.error(e[0])}e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd"));e[5]=+((e[7]+e[8])||e[3]==="odd")}else{if(e[3]){B.error(e[0])}}return e},PSEUDO:function(i){var e,aD=!i[5]&&i[2];if(ah.CHILD.test(i[0])){return null}if(i[3]&&i[4]!==undefined){i[2]=i[4]}else{if(aD&&X.test(aD)&&(e=n(aD,true))&&(e=aD.indexOf(")",aD.length-e)-aD.length)){i[0]=i[0].slice(0,e);i[2]=aD.slice(0,e)}}return i.slice(0,3)}},filter:{TAG:function(i){var e=i.replace(y,ak).toLowerCase();return i==="*"?function(){return true}:function(aD){return aD.nodeName&&aD.nodeName.toLowerCase()===e}},CLASS:function(e){var i=d[e+" "];return i||(i=new RegExp("(^|"+v+")"+e+"("+v+"|$)"))&&d(e,function(aD){return i.test(typeof aD.className==="string"&&aD.className||typeof aD.getAttribute!==au&&aD.getAttribute("class")||"")})},ATTR:function(aD,i,e){return function(aF){var aE=B.attr(aF,aD);if(aE==null){return i==="!="}if(!i){return true}aE+="";return i==="="?aE===e:i==="!="?aE!==e:i==="^="?e&&aE.indexOf(e)===0:i==="*="?e&&aE.indexOf(e)>-1:i==="$="?e&&aE.slice(-e.length)===e:i==="~="?(" "+aE+" ").indexOf(e)>-1:i==="|="?aE===e||aE.slice(0,e.length+1)===e+"-":false}},CHILD:function(i,aF,aE,aG,aD){var aI=i.slice(0,3)!=="nth",e=i.slice(-4)!=="last",aH=aF==="of-type";return aG===1&&aD===0?function(aJ){return !!aJ.parentNode}:function(aP,aN,aS){var aJ,aV,aQ,aU,aR,aM,aO=aI!==e?"nextSibling":"previousSibling",aT=aP.parentNode,aL=aH&&aP.nodeName.toLowerCase(),aK=!aS&&!aH;if(aT){if(aI){while(aO){aQ=aP;while((aQ=aQ[aO])){if(aH?aQ.nodeName.toLowerCase()===aL:aQ.nodeType===1){return false}}aM=aO=i==="only"&&!aM&&"nextSibling"}return true}aM=[e?aT.firstChild:aT.lastChild];if(e&&aK){aV=aT[ap]||(aT[ap]={});aJ=aV[i]||[];aR=aJ[0]===az&&aJ[1];aU=aJ[0]===az&&aJ[2];aQ=aR&&aT.childNodes[aR];while((aQ=++aR&&aQ&&aQ[aO]||(aU=aR=0)||aM.pop())){if(aQ.nodeType===1&&++aU&&aQ===aP){aV[i]=[az,aR,aU];break}}}else{if(aK&&(aJ=(aP[ap]||(aP[ap]={}))[i])&&aJ[0]===az){aU=aJ[1]}else{while((aQ=++aR&&aQ&&aQ[aO]||(aU=aR=0)||aM.pop())){if((aH?aQ.nodeName.toLowerCase()===aL:aQ.nodeType===1)&&++aU){if(aK){(aQ[ap]||(aQ[ap]={}))[i]=[az,aU]}if(aQ===aP){break}}}}}aU-=aD;return aU===aG||(aU%aG===0&&aU/aG>=0)}}},PSEUDO:function(aE,aD){var e,i=t.pseudos[aE]||t.setFilters[aE.toLowerCase()]||B.error("unsupported pseudo: "+aE);if(i[ap]){return i(aD)}if(i.length>1){e=[aE,aE,"",aD];return t.setFilters.hasOwnProperty(aE.toLowerCase())?p(function(aH,aJ){var aG,aF=i(aH,aD),aI=aF.length;while(aI--){aG=j.call(aH,aF[aI]);aH[aG]=!(aJ[aG]=aF[aI])}}):function(aF){return i(aF,0,e)}}return i}},pseudos:{not:p(function(e){var i=[],aD=[],aE=ab(e.replace(x,"$1"));return aE[ap]?p(function(aG,aL,aJ,aH){var aK,aF=aE(aG,null,aH,[]),aI=aG.length;while(aI--){if((aK=aF[aI])){aG[aI]=!(aL[aI]=aK)}}}):function(aH,aG,aF){i[0]=aH;aE(i,null,aF,aD);return !aD.pop()}}),has:p(function(e){return function(i){return B(e,i).length>0}}),contains:p(function(e){return function(i){return(i.textContent||i.innerText||M(i)).indexOf(e)>-1}}),lang:p(function(e){if(!Z.test(e||"")){B.error("unsupported lang: "+e)}e=e.replace(y,ak).toLowerCase();return function(aD){var i;do{if((i=an?aD.lang:aD.getAttribute("xml:lang")||aD.getAttribute("lang"))){i=i.toLowerCase();return i===e||i.indexOf(e+"-")===0}}while((aD=aD.parentNode)&&aD.nodeType===1);return false}}),target:function(e){var i=av.location&&av.location.hash;return i&&i.slice(1)===e.id},root:function(e){return e===u},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===false},disabled:function(e){return e.disabled===true},checked:function(e){var i=e.nodeName.toLowerCase();return(i==="input"&&!!e.checked)||(i==="option"&&!!e.selected)},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeType<6){return false}}return true},parent:function(e){return !t.pseudos.empty(e)},header:function(e){return r.test(e.nodeName)}
12,input:function(e){return h.test(e.nodeName)},button:function(i){var e=i.nodeName.toLowerCase();return e==="input"&&i.type==="button"||e==="button"},text:function(i){var e;return i.nodeName.toLowerCase()==="input"&&i.type==="text"&&((e=i.getAttribute("type"))==null||e.toLowerCase()==="text")},first:am(function(){return[0]}),last:am(function(e,i){return[i-1]}),eq:am(function(e,aD,i){return[i<0?i+aD:i]}),even:am(function(e,aE){var aD=0;for(;aD<aE;aD+=2){e.push(aD)}return e}),odd:am(function(e,aE){var aD=1;for(;aD<aE;aD+=2){e.push(aD)}return e}),lt:am(function(e,aF,aE){var aD=aE<0?aE+aF:aE;for(;--aD>=0;){e.push(aD)}return e}),gt:am(function(e,aF,aE){var aD=aE<0?aE+aF:aE;for(;++aD<aF;){e.push(aD)}return e})}};t.pseudos.nth=t.pseudos.eq;for(D in {radio:true,checkbox:true,file:true,password:true,image:true}){t.pseudos[D]=C(D)}for(D in {submit:true,reset:true}){t.pseudos[D]=g(D)}function aa(){}aa.prototype=t.filters=t.pseudos;t.setFilters=new aa();function n(aF,aK){var i,aG,aI,aJ,aH,aD,e,aE=ao[aF+" "];if(aE){return aK?0:aE.slice(0)}aH=aF;aD=[];e=t.preFilter;while(aH){if(!i||(aG=A.exec(aH))){if(aG){aH=aH.slice(aG[0].length)||aH}aD.push((aI=[]))}i=false;if((aG=G.exec(aH))){i=aG.shift();aI.push({value:i,type:aG[0].replace(x," ")});aH=aH.slice(i.length)}for(aJ in t.filter){if((aG=ah[aJ].exec(aH))&&(!e[aJ]||(aG=e[aJ](aG)))){i=aG.shift();aI.push({value:i,type:aJ,matches:aG});aH=aH.slice(i.length)}}if(!i){break}}return aK?aH.length:aH?B.error(aF):ao(aF,aD).slice(0)}function o(aF){var aE=0,aD=aF.length,e="";for(;aE<aD;aE++){e+=aF[aE].value}return e}function w(aF,aD,aE){var e=aD.dir,aG=aE&&e==="parentNode",i=aj++;return aD.first?function(aJ,aI,aH){while((aJ=aJ[e])){if(aJ.nodeType===1||aG){return aF(aJ,aI,aH)}}}:function(aL,aJ,aI){var aM,aK,aH=[az,i];if(aI){while((aL=aL[e])){if(aL.nodeType===1||aG){if(aF(aL,aJ,aI)){return true}}}}else{while((aL=aL[e])){if(aL.nodeType===1||aG){aK=aL[ap]||(aL[ap]={});if((aM=aK[e])&&aM[0]===az&&aM[1]===i){return(aH[2]=aM[2])}else{aK[e]=aH;if((aH[2]=aF(aL,aJ,aI))){return true}}}}}}}function aB(e){return e.length>1?function(aG,aF,aD){var aE=e.length;while(aE--){if(!e[aE](aG,aF,aD)){return false}}return true}:e[0]}function E(aD,aG,aF){var aE=0,e=aG.length;for(;aE<e;aE++){B(aD,aG[aE],aF)}return aF}function af(e,aD,aE,aF,aI){var aG,aL=[],aH=0,aJ=e.length,aK=aD!=null;for(;aH<aJ;aH++){if((aG=e[aH])){if(!aE||aE(aG,aF,aI)){aL.push(aG);if(aK){aD.push(aH)}}}}return aL}function m(aD,i,aF,aE,aG,e){if(aE&&!aE[ap]){aE=m(aE)}if(aG&&!aG[ap]){aG=m(aG,e)}return p(function(aR,aO,aJ,aQ){var aT,aP,aL,aK=[],aS=[],aI=aO.length,aH=aR||E(i||"*",aJ.nodeType?[aJ]:aJ,[]),aM=aD&&(aR||!i)?af(aH,aK,aD,aJ,aQ):aH,aN=aF?aG||(aR?aD:aI||aE)?[]:aO:aM;if(aF){aF(aM,aN,aJ,aQ)}if(aE){aT=af(aN,aS);aE(aT,[],aJ,aQ);aP=aT.length;while(aP--){if((aL=aT[aP])){aN[aS[aP]]=!(aM[aS[aP]]=aL)}}}if(aR){if(aG||aD){if(aG){aT=[];aP=aN.length;while(aP--){if((aL=aN[aP])){aT.push((aM[aP]=aL))}}aG(null,(aN=[]),aT,aQ)}aP=aN.length;while(aP--){if((aL=aN[aP])&&(aT=aG?j.call(aR,aL):aK[aP])>-1){aR[aT]=!(aO[aT]=aL)}}}}else{aN=af(aN===aO?aN.splice(aI,aN.length):aN);if(aG){aG(null,aO,aN,aQ)}else{b.apply(aO,aN)}}})}function aq(aI){var aD,aG,aE,aH=aI.length,aL=t.relative[aI[0].type],aM=aL||t.relative[" "],aF=aL?1:0,aJ=w(function(i){return i===aD},aM,true),aK=w(function(i){return j.call(aD,i)>-1},aM,true),e=[function(aO,aN,i){return(!aL&&(i||aN!==aC))||((aD=aN).nodeType?aJ(aO,aN,i):aK(aO,aN,i))}];for(;aF<aH;aF++){if((aG=t.relative[aI[aF].type])){e=[w(aB(e),aG)]}else{aG=t.filter[aI[aF].type].apply(null,aI[aF].matches);if(aG[ap]){aE=++aF;for(;aE<aH;aE++){if(t.relative[aI[aE].type]){break}}return m(aF>1&&aB(e),aF>1&&o(aI.slice(0,aF-1).concat({value:aI[aF-2].type===" "?"*":""})).replace(x,"$1"),aG,aF<aE&&aq(aI.slice(aF,aE)),aE<aH&&aq((aI=aI.slice(aE))),aE<aH&&o(aI))}e.push(aG)}}return aB(e)}function ad(aE,aD){var e=aD.length>0,aF=aE.length>0,i=function(aP,aJ,aO,aN,aS){var aK,aL,aQ,aU=0,aM="0",aG=aP&&[],aV=[],aT=aC,aI=aP||aF&&t.find.TAG("*",aS),aH=(az+=aT==null?1:Math.random()||0.1),aR=aI.length;if(aS){aC=aJ!==H&&aJ}for(;aM!==aR&&(aK=aI[aM])!=null;aM++){if(aF&&aK){aL=0;while((aQ=aE[aL++])){if(aQ(aK,aJ,aO)){aN.push(aK);break}}if(aS){az=aH}}if(e){if((aK=!aQ&&aK)){aU--}if(aP){aG.push(aK)}}}aU+=aM;if(e&&aM!==aU){aL=0;while((aQ=aD[aL++])){aQ(aG,aV,aJ,aO)}if(aP){if(aU>0){while(aM--){if(!(aG[aM]||aV[aM])){aV[aM]=at.call(aN)}}}aV=af(aV)}b.apply(aN,aV);if(aS&&!aP&&aV.length>0&&(aU+aD.length)>1){B.uniqueSort(aN)}}if(aS){az=aH;aC=aT}return aG};return e?p(i):i}ab=B.compile=function(e,aE){var aF,aD=[],aH=[],aG=L[e+" "];if(!aG){if(!aE){aE=n(e)}aF=aE.length;while(aF--){aG=aq(aE[aF]);if(aG[ap]){aD.push(aG)}else{aH.push(aG)}}aG=L(e,ad(aH,aD));aG.selector=e}return aG};ax=B.select=function(aE,e,aF,aI){var aG,aL,aD,aM,aJ,aK=typeof aE==="function"&&aE,aH=!aI&&n((aE=aK.selector||aE));aF=aF||[];
12if(aH.length===1){aL=aH[0]=aH[0].slice(0);if(aL.length>2&&(aD=aL[0]).type==="ID"&&ay.getById&&e.nodeType===9&&an&&t.relative[aL[1].type]){e=(t.find.ID(aD.matches[0].replace(y,ak),e)||[])[0];if(!e){return aF}else{if(aK){e=e.parentNode}}aE=aE.slice(aL.shift().value.length)}aG=ah.needsContext.test(aE)?0:aL.length;while(aG--){aD=aL[aG];if(t.relative[(aM=aD.type)]){break}if((aJ=t.find[aM])){if((aI=aJ(aD.matches[0].replace(y,ak),ag.test(aL[0].type)&&Y(e.parentNode)||e))){aL.splice(aG,1);aE=aI.length&&o(aL);if(!aE){b.apply(aF,aI);return aF}break}}}}(aK||ab(aE,aH))(aI,e,!an,aF,ag.test(aE)&&Y(e.parentNode)||e);return aF};ay.sortStable=ap.split("").sort(J).join("")===ap;ay.detectDuplicates=!!ac;ae();ay.sortDetached=l(function(e){return e.compareDocumentPosition(H.createElement("div"))&1});if(!l(function(e){e.innerHTML="<a href='#'></a>";return e.firstChild.getAttribute("href")==="#"})){aA("type|href|height|width",function(i,e,aD){if(!aD){return i.getAttribute(e,e.toLowerCase()==="type"?1:2)}})}if(!ay.attributes||!l(function(e){e.innerHTML="<input/>";e.firstChild.setAttribute("value","");return e.firstChild.getAttribute("value")===""})){aA("value",function(i,e,aD){if(!aD&&i.nodeName.toLowerCase()==="input"){return i.defaultValue}})}if(!l(function(e){return e.getAttribute("disabled")==null})){aA(c,function(i,e,aE){var aD;if(!aE){return i[e]===true?e.toLowerCase():(aD=i.getAttributeNode(e))&&aD.specified?aD.value:null}})}if(typeof define==="function"&&define.amd){define(function(){return B})}else{if(typeof module!=="undefined"&&module.exports){module.exports=B}else{av.Sizzle=B}}})(window);(function(){if(typeof Sizzle!=="undefined"){return}if(typeof define!=="undefined"&&define.amd){window.Sizzle=Prototype._actual_sizzle;window.define=Prototype._original_define;delete Prototype._actual_sizzle;delete Prototype._original_define}else{if(typeof module!=="undefined"&&module.exports){window.Sizzle=module.exports;module.exports={}}}})();(function(c){var d=Prototype.Selector.extendElements;function a(e,f){return d(c(e,f||document))}function b(f,e){return c.matches(e,[f]).length==1}Prototype.Selector.engine=c;Prototype.Selector.select=a;Prototype.Selector.match=b})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(h,d){if(typeof d!="object"){d={hash:!!d}}else{if(Object.isUndefined(d.hash)){d.hash=true}}var e,g,a=false,f=d.submit,b,c;if(d.hash){c={};b=function(i,j,k){if(j in i){if(!Object.isArray(i[j])){i[j]=[i[j]]}i[j]=i[j].concat(k)}else{i[j]=k}return i}}else{c="";b=function(i,k,j){if(!Object.isArray(j)){j=[j]}if(!j.length){return i}var l=encodeURIComponent(k).gsub(/%20/,"+");return i+(i?"&":"")+j.map(function(m){m=m.gsub(/(\r)?\n/,"\r\n");m=encodeURIComponent(m);m=m.gsub(/%20/,"+");return l+"="+m}).join("&")}}return h.inject(c,function(i,j){if(!j.disabled&&j.name){e=j.name;g=$(j).getValue();if(g!=null&&j.type!="file"&&(j.type!="submit"||(!a&&f!==false&&(!f||e==f)&&(a=true)))){i=b(i,e,g)}}return i})}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(e){var f=$(e).getElementsByTagName("*");var d,c=[],b=Form.Element.Serializers;for(var a=0;d=f[a];a++){if(b[d.tagName.toLowerCase()]){c.push(Element.extend(d))}}return c},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var e=0,h=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue}h.push(Element.extend(b))}return h},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var c=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var a=c.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return a?a:c.find(function(d){return/^(?:input|select|textarea)$/i.test(d.tagName)})},focusFirstElement:function(b){b=$(b);var a=b.findFirstElement();if(a){a.activate()}return b},request:function(b,a){b=$(b),a=Object.clone(a||{});var d=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(a.parameters,d)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function b(h,i){switch(h.type.toLowerCase()){case"checkbox":case"radio":return f(h,i);default:return e(h,i)}}function f(h,i){if(Object.isUndefined(i)){return h.checked?h.value:null}else{h.checked=!!i}}function e(h,i){if(Object.isUndefined(i)){return h.value}else{h.value=i}}
12function a(k,n){if(Object.isUndefined(n)){return(k.type==="select-one"?c:d)(k)}var j,l,o=!Object.isArray(n);for(var h=0,m=k.length;h<m;h++){j=k.options[h];l=this.optionValue(j);if(o){if(l==n){j.selected=true;return}}else{j.selected=n.include(l)}}}function c(i){var h=i.selectedIndex;return h>=0?g(i.options[h]):null}function d(l){var h,m=l.length;if(!m){return null}for(var k=0,h=[];k<m;k++){var j=l.options[k];if(j.selected){h.push(g(j))}}return h}function g(h){return Element.hasAttribute(h,"value")?h.value:h.text}return{input:b,inputSelector:f,textarea:e,select:a,selectOne:c,selectMany:d,optionValue:g,button:e}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(D){var u=document.createElement("div");var d=document.documentElement;var k="onmouseenter" in d&&"onmouseleave" in d;var L={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45};var A=function(X){return false};if(window.attachEvent){if(window.addEventListener){A=function(X){return !(X instanceof window.Event)}}else{A=function(X){return true}}}var O;function M(Y,X){return Y.which?(Y.which===X+1):(Y.button===X)}var W={0:1,1:4,2:2};function S(Y,X){return Y.button===W[X]}function P(Y,X){switch(X){case 0:return Y.which==1&&!Y.metaKey;case 1:return Y.which==2||(Y.which==1&&Y.metaKey);case 2:return Y.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){O=S}else{O=function(Y,X){return A(Y)?S(Y,X):M(Y,X)}}}else{if(Prototype.Browser.WebKit){O=P}else{O=M}}function B(X){return O(X,0)}function i(X){return O(X,1)}function e(X){return O(X,2)}function o(X){return Element.extend(K(X))}function K(Z){Z=L.extend(Z);var Y=Z.target,X=Z.type,aa=Z.currentTarget;if(aa&&aa.tagName){if(X==="load"||X==="error"||(X==="click"&&aa.tagName.toLowerCase()==="input"&&aa.type==="radio")){Y=aa}}return Y.nodeType==Node.TEXT_NODE?Y.parentNode:Y}function j(Z,aa){var Y=K(Z),X=Prototype.Selector;if(!aa){return Element.extend(Y)}while(Y){if(Object.isElement(Y)&&X.match(Y,aa)){return Element.extend(Y)}Y=Y.parentNode}}function t(X){return{x:U(X),y:T(X)}}function U(Z){var Y=document.documentElement,X=document.body||{scrollLeft:0};return Z.pageX||(Z.clientX+(Y.scrollLeft||X.scrollLeft)-(Y.clientLeft||0))}function T(Z){var Y=document.documentElement,X=document.body||{scrollTop:0};return Z.pageY||(Z.clientY+(Y.scrollTop||X.scrollTop)-(Y.clientTop||0))}function r(X){L.extend(X);X.preventDefault();X.stopPropagation();X.stopped=true}L.Methods={isLeftClick:B,isMiddleClick:i,isRightClick:e,element:o,findElement:j,pointer:t,pointerX:U,pointerY:T,stop:r};var H=Object.keys(L.Methods).inject({},function(X,Y){X[Y]=L.Methods[Y].methodize();return X});if(window.attachEvent){function V(Y){var X;switch(Y.type){case"mouseover":case"mouseenter":X=Y.fromElement;break;case"mouseout":case"mouseleave":X=Y.toElement;break;default:return null}return Element.extend(X)}var Q={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};L.extend=function(Y,X){if(!Y){return false}if(!A(Y)){return Y}if(Y._extendedByPrototype){return Y}Y._extendedByPrototype=Prototype.emptyFunction;var Z=L.pointer(Y);Object.extend(Y,{target:Y.srcElement||X,relatedTarget:V(Y),pageX:Z.x,pageY:Z.y});Object.extend(Y,H);Object.extend(Y,Q);return Y}}else{L.extend=Prototype.K}if(window.addEventListener){L.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(L.prototype,H)}
12var v={mouseenter:"mouseover",mouseleave:"mouseout"};function f(X){return v[X]||X}if(k){f=Prototype.K}function R(X){if(X===window){return 0}if(typeof X._prototypeUID==="undefined"){X._prototypeUID=Element.Storage.UID++}return X._prototypeUID}function I(X){if(X===window){return 0}if(X==document){return 1}return X.uniqueID}if("uniqueID" in u){R=I}function x(X){return X.include(":")}L._isCustomEvent=x;function z(Z,Y){var X=D.Event.cache;if(Object.isUndefined(Y)){Y=R(Z)}if(!X[Y]){X[Y]={element:Z}}return X[Y]}function E(Y,X){if(Object.isUndefined(X)){X=R(Y)}delete D.Event.cache[X]}function h(Z,ac,af){var X=z(Z);if(!X[ac]){X[ac]=[]}var ab=X[ac];var aa=ab.length;while(aa--){if(ab[aa].handler===af){return null}}var ad=R(Z);var Y=D.Event._createResponder(ad,ac,af);var ae={responder:Y,handler:af};ab.push(ae);return ae}function s(ac,Z,ad){var Y=z(ac);var X=Y[Z]||[];var ab=X.length,ae;while(ab--){if(X[ab].handler===ad){ae=X[ab];break}}if(ae){var aa=X.indexOf(ae);X.splice(aa,1)}if(X.length===0){delete Y[Z];if(Object.keys(Y).length===1&&("element" in Y)){E(ac)}}return ae}function c(Z,Y,aa){Z=$(Z);var ab=h(Z,Y,aa);if(ab===null){return Z}var X=ab.responder;if(x(Y)){p(Z,Y,X)}else{m(Z,Y,X)}return Z}function m(aa,Z,Y){var X=f(Z);if(aa.addEventListener){aa.addEventListener(X,Y,false)}else{aa.attachEvent("on"+X,Y)}}function p(Z,Y,X){if(Z.addEventListener){Z.addEventListener("dataavailable",X,false)}else{Z.attachEvent("ondataavailable",X);Z.attachEvent("onlosecapture",X)}}function J(Y,X,Z){Y=$(Y);var ab=!Object.isUndefined(Z),ac=!Object.isUndefined(X);if(!ac&&!ab){y(Y);return Y}if(!ab){G(Y,X);return Y}var aa=s(Y,X,Z);if(!aa){return Y}a(Y,X,aa.responder);return Y}function C(aa,Z,Y){var X=f(Z);if(aa.removeEventListener){aa.removeEventListener(X,Y,false)}else{aa.detachEvent("on"+X,Y)}}function b(Z,Y,X){if(Z.removeEventListener){Z.removeEventListener("dataavailable",X,false)}else{Z.detachEvent("ondataavailable",X);Z.detachEvent("onlosecapture",X)}}function y(ac){var ab=R(ac),Z=D.Event.cache[ab];if(!Z){return}E(ac,ab);var X,aa;for(var Y in Z){if(Y==="element"){continue}X=Z[Y];aa=X.length;while(aa--){a(ac,Y,X[aa].responder)}}}function G(ac,Z){var Y=z(ac);var X=Y[Z];if(X){delete Y[Z]}X=X||[];var ab=X.length;while(ab--){a(ac,Z,X[ab].responder)}for(var aa in Y){if(aa==="element"){continue}return}E(ac)}function a(Y,X,Z){if(x(X)){b(Y,X,Z)}else{C(Y,X,Z)}}function g(X){if(X!==document){return X}if(document.createEvent&&!X.dispatchEvent){return document.documentElement}return X}function w(aa,Z,Y,X){aa=g($(aa));if(Object.isUndefined(X)){X=true}Y=Y||{};var ab=N(aa,Z,Y,X);return L.extend(ab)}function l(aa,Z,Y,X){var ab=document.createEvent("HTMLEvents");ab.initEvent("dataavailable",X,true);ab.eventName=Z;ab.memo=Y;aa.dispatchEvent(ab);return ab}function n(aa,Z,Y,X){var ab=document.createEventObject();ab.eventType=X?"ondataavailable":"onlosecapture";ab.eventName=Z;ab.memo=Y;aa.fireEvent(ab.eventType,ab);return ab}var N=document.createEvent?l:n;L.Handler=Class.create({initialize:function(Z,Y,X,aa){this.element=$(Z);this.eventName=Y;this.selector=X;this.callback=aa;this.handler=this.handleEvent.bind(this)},start:function(){L.observe(this.element,this.eventName,this.handler);return this},stop:function(){L.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(Y){var X=L.findElement(Y,this.selector);if(X){this.callback.call(this.element,Y,X)}}});function F(Z,Y,X,aa){Z=$(Z);if(Object.isFunction(X)&&Object.isUndefined(aa)){aa=X,X=null}return new L.Handler(Z,Y,X,aa).start()}Object.extend(L,L.Methods);Object.extend(L,{fire:w,observe:c,stopObserving:J,on:F});Element.addMethods({fire:w,observe:c,stopObserving:J,on:F});Object.extend(document,{fire:w.methodize(),observe:c.methodize(),stopObserving:J.methodize(),on:F.methodize(),loaded:false});if(D.Event){Object.extend(window.Event,L)}else{D.Event=L}D.Event.cache={};function q(){D.Event.cache=null}if(window.attachEvent){window.attachEvent("onunload",q)}u=null;d=null})(this);(function(c){var g=document.documentElement;var b="onmouseenter" in g&&"onmouseleave" in g;function f(h){return !b&&(h==="mouseenter"||h==="mouseleave")}function d(i,h,j){if(Event._isCustomEvent(h)){return e(i,h,j)}if(f(h)){return a(i,h,j)}return function(l){if(!Event.cache){return}var k=Event.cache[i].element;Event.extend(l,k);j.call(k,l)}}function e(i,h,j){return function(m){var k=Event.cache[i];var l=k&&k.element;if(Object.isUndefined(m.eventName)){return false}if(m.eventName!==h){return false}Event.extend(m,l);
12j.call(l,m)}}function a(i,h,j){return function(m){var k=Event.cache[i].element;Event.extend(m,k);var l=m.relatedTarget;while(l&&l!==k){try{l=l.parentNode}catch(n){l=k}}if(l===k){return}j.call(k,m)}}c.Event._createResponder=d;g=null})(this);(function(a){var e;function b(){if(document.loaded){return}if(e){window.clearTimeout(e)}document.loaded=true;document.fire("dom:loaded")}function d(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",d);b()}}function c(){try{document.documentElement.doScroll("left")}catch(f){e=c.defer();return}b()}if(document.readyState==="complete"){b();return}if(document.addEventListener){document.addEventListener("DOMContentLoaded",b,false)}else{document.attachEvent("onreadystatechange",d);if(window==top){e=c.defer()}}Event.observe(window,"load",b)})(this);Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.addMethods({childOf:Element.Methods.descendantOf});var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,e){e=e.toString().strip();var d=/\s/.test(e)?$w(e).map(a).join(""):a(e);return d?document._getElementsByXPath(".//*"+d,c):[]}:function(e,f){f=f.toString().strip();var g=[],h=(/\s/.test(f)?$w(f):null);if(!h&&!f){return g}var c=$(e).getElementsByTagName("*");f=" "+f+" ";for(var d=0,k,j;k=c[d];d++){if(k.className&&(j=" "+k.className+" ")&&(j.include(f)||(h&&h.all(function(i){return !i.toString().blank()&&j.include(" "+i+" ")})))){g.push(Element.extend(k))}}return g};return function(d,c){return $(c||document.body).getElementsByClassName(d)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(b,a){this.element.className.split(/\s+/).select(function(c){return c.length>0})._each(b,a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(a){this.expression=a.strip()},findElements:function(a){return Prototype.Selector.select(this.expression,a)},match:function(a){return Prototype.Selector.match(a,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(f,g){var a=Prototype.Selector.match,d=[];for(var c=0,e=f.length;c<e;c++){var b=f[c];if(a(b,g)){d.push(Element.extend(b))}}return d},findElement:function(f,g,b){b=b||0;var a=0,d;for(var c=0,e=f.length;c<e;c++){d=f[c];if(Prototype.Selector.match(d,g)&&b===a++){return Element.extend(d)}}},findChildElements:function(b,c){var a=c.toArray().join(", ");return Prototype.Selector.select(a,b||document)}})})();
13/*
14* Really easy field validation with Prototype
15* http://tetlaw.id.au/view/javascript/really-easy-field-validation
16* Andrew Tetlaw
17* Version 1.5.4.1 (2007-01-05)
18*
19* Copyright (c) 2007 Andrew Tetlaw
20* Permission is hereby granted, free of charge, to any person
21* obtaining a copy of this software and associated documentation
22* files (the "Software"), to deal in the Software without
23* restriction, including without limitation the rights to use, copy,
24* modify, merge, publish, distribute, sublicense, and/or sell copies
25* of the Software, and to permit persons to whom the Software is
26* furnished to do so, subject to the following conditions:
27*
28* The above copyright notice and this permission notice shall be
29* included in all copies or substantial portions of the Software.
30*
31* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
35* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
36* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
37* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38* SOFTWARE.
39*
40*/
41var Validator = Class.create();
42
43Validator.prototype = {
44    initialize : function(className, error, test, options) {
45        if(typeof test == 'function'){
46            this.options = $H(options);
47            this._test = test;
48        } else {
49            this.options = $H(test);
50            this._test = function(){return true};
51        }
52        this.error = error || 'Validation failed.';
53        this.className = className;
54    },
55    test : function(v, elm) {
56        return (this._test(v,elm) && this.options.all(function(p){
57            return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true;
58        }));
59    }
60}
61Validator.methods = {
62    pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)},
63    minLength : function(v,elm,opt) {return v.length >= opt},
64    maxLength : function(v,elm,opt) {return v.length <= opt},
65    min : function(v,elm,opt) {return v >= parseFloat(opt)},
66    max : function(v,elm,opt) {return v <= parseFloat(opt)},
67    notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) {
68        return v != value;
69    })},
70    oneOf : function(v,elm,opt) {return $A(opt).any(function(value) {
71        return v == value;
72    })},
73    is : function(v,elm,opt) {return v == opt},
74    isNot : function(v,elm,opt) {return v != opt},
75    equalToField : function(v,elm,opt) {return v == $F(opt)},
76    notEqualToField : function(v,elm,opt) {return v != $F(opt)},
77    include : function(v,elm,opt) {return $A(opt).all(function(value) {
78        return Validation.get(value).test(v,elm);
79    })}
80}
81
82var Validation = Class.create();
83Validation.defaultOptions = {
84    onSubmit : true,
85    stopOnFirst : false,
86    immediate : false,
87    focusOnError : true,
88    useTitles : false,
89    addClassNameToContainer: false,
90    containerClassName: '.input-box',
91    onFormValidate : function(result, form) {},
92    onElementValidate : function(result, elm) {}
93};
94
95Validation.prototype = {
96    initialize : function(form, options){
97        this.form = $(form);
98        if (!this.form) {
99            return;
100        }
101        this.options = Object.extend({
102            onSubmit : Validation.defaultOptions.onSubmit,
103            stopOnFirst : Validation.defaultOptions.stopOnFirst,
104            immediate : Validation.defaultOptions.immediate,
105            focusOnError : Validation.defaultOptions.focusOnError,
106            useTitles : Validation.defaultOptions.useTitles,
107            onFormValidate : Validation.defaultOptions.onFormValidate,
108            onElementValidate : Validation.defaultOptions.onElementValidate
109        }, options || {});
110        if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false);
111        if(this.options.immediate) {
112            Form.getElements(this.form).each(function(input) { // Thanks Mike!
113                if (input.tagName.toLowerCase() == 'select') {
114                    Event.observe(input, 'blur', this.onChange.bindAsEventListener(this));
115                }
116                if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox') {
117                    Event.observe(input, 'click', this.onChange.bindAsEventListener(this));
118                } else {
119                    Event.observe(input, 'change', this.onChange.bindAsEventListener(this));
120                }
121            }, this);
122        }
123    },
124    onChange : function (ev) {
125        Validation.isOnChange = true;
126        Validation.validate(Event.element(ev),{
127                useTitle : this.options.useTitles,
128                onElementValidate : this.options.onElementValidate
129        });
130        Validation.isOnChange = false;
131    },
132    onSubmit :  function(ev){
133        if(!this.validate()) Event.stop(ev);
134    },
135    validate : function() {
136        var result = false;
137        var useTitles = this.options.useTitles;
138        var callback = this.options.onElementValidate;
139        try {
140            if(this.options.stopOnFirst) {
141                result = Form.getElements(this.form).all(function(elm) {
142                    if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
143                        return true;
144                    }
145                    return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
146                }, this);
147            } else {
148                result = Form.getElements(this.form).collect(function(elm) {
149                    if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
150                        return true;
151                    }
152                    return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
153                }, this).all();
154            }
155        } catch (e) {
156        }
157        if(!result && this.options.focusOnError) {
158            try{
159                Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()
160            }
161            catch(e){
162            }
163        }
164        this.options.onFormValidate(result, this.form);
165        return result;
166    },
167    reset : function() {
168        Form.getElements(this.form).each(Validation.reset);
169    },
170    isElementInForm : function(elm, form) {
171        var domForm = elm.up('form');
172        if (domForm == form) {
173            return true;
174        }
175        return false;
176    }
177}
178
179Object.extend(Validation, {
180    validate : function(elm, options){
181        options = Object.extend({
182            useTitle : false,
183            onElementValidate : function(result, elm) {}
184        }, options || {});
185        elm = $(elm);
186
187        var cn = $w(elm.className);
188        return result = cn.all(function(value) {
189            var test = Validation.test(value,elm,options.useTitle);
190            options.onElementValidate(test, elm);
191            return test;
192        });
193    },
194    insertAdvice : function(elm, advice){
195        var container = $(elm).up('.field-row');
196        if(container){
197            Element.insert(container, {after: advice});
198        } else if (elm.up('td.value')) {
199            elm.up('td.value').insert({bottom: advice});
200        } else if (elm.advaiceContainer && $(elm.advaiceContainer)) {
201            $(elm.advaiceContainer).update(advice);
202        }
203        else {
204            switch (elm.type.toLowerCase()) {
205                case 'checkbox':
206                case 'radio':
207                    var p = elm.parentNode;
208                    if(p) {
209                        Element.insert(p, {'bottom': advice});
210                    } else {
211                        Element.insert(elm, {'after': advice});
212                    }
213                    break;
214                default:
215                    Element.insert(elm, {'after': advice});
216            }
217        }
218    },
219    showAdvice : function(elm, advice, adviceName){
220        if(!elm.advices){
221            elm.advices = new Hash();
222        }
223        else{
224            elm.advices.each(function(pair){
225                if (!advice || pair.value.id != advice.id) {
226                    // hide non-current advice after delay
227                    this.hideAdvice(elm, pair.value);
228                }
229            }.bind(this));
230        }
231        elm.advices.set(adviceName, advice);
232        if(typeof Effect == 'undefined') {
233            advice.style.display = 'block';
234        } else {
235            if(!advice._adviceAbsolutize) {
236                new Effect.Appear(advice, {duration : 1 });
237            } else {
238                Position.absolutize(advice);
239                advice.show();
240                advice.setStyle({
241                    'top':advice._adviceTop,
242                    'left': advice._adviceLeft,
243                    'width': advice._adviceWidth,
244                    'z-index': 1000
245                });
246                advice.addClassName('advice-absolute');
247            }
248        }
249    },
250    hideAdvice : function(elm, advice){
251        if (advice != null) {
252            new Effect.Fade(advice, {duration : 1, afterFinishInternal : function() {advice.hide();}});
253        }
254    },
255    updateCallback : function(elm, status) {
256        if (typeof elm.callbackFunction != 'undefined') {
257            eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')');
258        }
259    },
260    ajaxError : function(elm, errorMsg) {
261        var name = 'validate-ajax';
262        var advice = Validation.getAdvice(name, elm);
263        if (advice == null) {
264            advice = this.createAdvice(name, elm, false, errorMsg);
265        }
266        this.showAdvice(elm, advice, 'validate-ajax');
267        this.updateCallback(elm, 'failed');
268
269        elm.addClassName('validation-failed');
270        elm.addClassName('validate-ajax');
271        if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
272            var container = elm.up(Validation.defaultOptions.containerClassName);
273            if (container && this.allowContainerClassName(elm)) {
274                container.removeClassName('validation-passed');
275                container.addClassName('validation-error');
276            }
277        }
278    },
279    allowContainerClassName: function (elm) {
280        if (elm.type == 'radio' || elm.type == 'checkbox') {
281            return elm.hasClassName('change-container-classname');
282        }
283
284        return true;
285    },
286    test : function(name, elm, useTitle) {
287        var v = Validation.get(name);
288        var prop = '__advice'+name.camelize();
289        try {
290        if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
291            //if(!elm[prop]) {
292                var advice = Validation.getAdvice(name, elm);
293                if (advice == null) {
294                    advice = this.createAdvice(name, elm, useTitle);
295                }
296                this.showAdvice(elm, advice, name);
297                this.updateCallback(elm, 'failed');
298            //}
299            elm[prop] = 1;
300            if (!elm.advaiceContainer) {
301                elm.removeClassName('validation-passed');
302                elm.addClassName('validation-failed');
303            }
304
305           if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
306                var container = elm.up(Validation.defaultOptions.containerClassName);
307                if (container && this.allowContainerClassName(elm)) {
308                    container.removeClassName('validation-passed');
309                    container.addClassName('validation-error');
310                }
311            }
312            return false;
313        } else {
314            var advice = Validation.getAdvice(name, elm);
315            this.hideAdvice(elm, advice);
316            this.updateCallback(elm, 'passed');
317            elm[prop] = '';
318            elm.removeClassName('validation-failed');
319            elm.addClassName('validation-passed');
320            if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
321                var container = elm.up(Validation.defaultOptions.containerClassName);
322                if (container && !container.down('.validation-failed') && this.allowContainerClassName(elm)) {
323                    if (!Validation.get('IsEmpty').test(elm.value) || !this.isVisible(elm)) {
324                        container.addClassName('validation-passed');
325                    } else {
326                        container.removeClassName('validation-passed');
327                    }
328                    container.removeClassName('validation-error');
329                }
330            }
331            return true;
332        }
333        } catch(e) {
334            throw(e)
335        }
336    },
337    isVisible : function(elm) {
338        while(elm.tagName != 'BODY') {
339            if(!$(elm).visible()) return false;
340            elm = elm.parentNode;
341        }
342        return true;
343    },
344    getAdvice : function(name, elm) {
345        return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm));
346    },
347    createAdvice : function(name, elm, useTitle, customError) {
348        var v = Validation.get(name);
349        var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
350        if (customError) {
351            errorMsg = customError;
352        }
353        try {
354            if (Translator){
355                errorMsg = Translator.translate(errorMsg);
356            }
357        }
358        catch(e){}
359
360        advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>'
361
362
363        Validation.insertAdvice(elm, advice);
364        advice = Validation.getAdvice(name, elm);
365        if($(elm).hasClassName('absolute-advice')) {
366            var dimensions = $(elm).getDimensions();
367            var originalPosition = Position.cumulativeOffset(elm);
368
369            advice._adviceTop = (originalPosition[1] + dimensions.height) + 'px';
370            advice._adviceLeft = (originalPosition[0])  + 'px';
371            advice._adviceWidth = (dimensions.width)  + 'px';
372            advice._adviceAbsolutize = true;
373        }
374        return advice;
375    },
376    getElmID : function(elm) {
377        return elm.id ? elm.id : elm.name;
378    },
379    reset : function(elm) {
380        elm = $(elm);
381        var cn = $w(elm.className);
382        cn.each(function(value) {
383            var prop = '__advice'+value.camelize();
384            if(elm[prop]) {
385                var advice = Validation.getAdvice(value, elm);
386                if (advice) {
387                    advice.hide();
388                }
389                elm[prop] = '';
390            }
391            elm.removeClassName('validation-failed');
392            elm.removeClassName('validation-passed');
393            if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
394                var container = elm.up(Validation.defaultOptions.containerClassName);
395                if (container) {
396                    container.removeClassName('validation-passed');
397                    container.removeClassName('validation-error');
398                }
399            }
400        });
401    },
402    add : function(className, error, test, options) {
403        var nv = {};
404        nv[className] = new Validator(className, error, test, options);
405        Object.extend(Validation.methods, nv);
406    },
407    addAllThese : function(validators) {
408        var nv = {};
409        $A(validators).each(function(value) {
410                nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {}));
411            });
412        Object.extend(Validation.methods, nv);
413    },
414    get : function(name) {
415        return  Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_'];
416    },
417    methods : {
418        '_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{})
419    }
420});
421
422Validation.add('IsEmpty', '', function(v) {
423    return  (v == '' || (v == null) || (v.length == 0) || /^\s+$/.test(v));
424});
425
426Validation.addAllThese([
427    ['validate-no-html-tags', 'HTML tags are not allowed', function(v) {
428				return !/<(\/)?\w+/.test(v);
429			}],
430	['validate-select', 'Please select an option.', function(v) {
431                return ((v != "none") && (v != null) && (v.length != 0));
432            }],
433    ['required-entry', 'This is a required field.', function(v) {
434                return !Validation.get('IsEmpty').test(v);
435            }],
436    ['validate-number', 'Please enter a valid number in this field.', function(v) {
437                return Validation.get('IsEmpty').test(v)
438                    || (!isNaN(parseNumber(v)) && /^\s*-?\d*(\.\d*)?\s*$/.test(v));
439            }],
440    ['validate-number-range', 'The value is not within the specified range.', function(v, elm) {
441                if (Validation.get('IsEmpty').test(v)) {
442                    return true;
443                }
444
445                var numValue = parseNumber(v);
446                if (isNaN(numValue)) {
447                    return false;
448                }
449
450                var reRange = /^number-range-(-?[\d.,]+)?-(-?[\d.,]+)?$/,
451                    result = true;
452
453                $w(elm.className).each(function(name) {
454                    var m = reRange.exec(name);
455                    if (m) {
456                        result = result
457                            && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1]))
458                            && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2]));
459                    }
460                });
461
462                return result;
463            }],
464    ['validate-digits', 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.', function(v) {
465                return Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
466            }],
467    ['validate-digits-range', 'The value is not within the specified range.', function(v, elm) {
468                if (Validation.get('IsEmpty').test(v)) {
469                    return true;
470                }
471
472                var numValue = parseNumber(v);
473                if (isNaN(numValue)) {
474                    return false;
475                }
476
477                var reRange = /^digits-range-(-?\d+)?-(-?\d+)?$/,
478                    result = true;
479
480                $w(elm.className).each(function(name) {
481                    var m = reRange.exec(name);
482                    if (m) {
483                        result = result
484                            && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1]))
485                            && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2]));
486                    }
487                });
488
489                return result;
490            }],
491    ['validate-alpha', 'Please use letters only (a-z or A-Z) in this field.', function (v) {
492                return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z]+$/.test(v)
493            }],
494    ['validate-code', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
495                return Validation.get('IsEmpty').test(v) ||  /^[a-z]+[a-z0-9_]+$/.test(v)
496            }],
497    ['validate-alphanum', 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) {
498                return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9]+$/.test(v)
499            }],
500    ['validate-alphanum-with-spaces', 'Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.', function(v) {
501                    return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9 ]+$/.test(v)
502            }],
503    ['validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.', function(v) {
504                return Validation.get('IsEmpty').test(v) ||  /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v)
505            }],
506    ['validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
507                return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
508            }],
509    ['validate-phoneLax', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
510                return Validation.get('IsEmpty').test(v) || /^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v);
511            }],
512    ['validate-fax', 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.', function(v) {
513                return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
514            }],
515    ['validate-date', 'Please enter a valid date.', function(v) {
516                var test = new Date(v);
517                return Validation.get('IsEmpty').test(v) || !isNaN(test);
518            }],
519    ['validate-date-range', 'The From Date value should be less than or equal to the To Date value.', function(v, elm) {
520            var m = /\bdate-range-(\w+)-(\w+)\b/.exec(elm.className);
521            if (!m || m[2] == 'to' || Validation.get('IsEmpty').test(v)) {
522                return true;
523            }
524
525            var currentYear = new Date().getFullYear() + '';
526            var normalizedTime = function(v) {
527                v = v.split(/[.\/]/);
528                if (v[2] && v[2].length < 4) {
529                    v[2] = currentYear.substr(0, v[2].length) + v[2];
530                }
531                return new Date(v.join('/')).getTime();
532            };
533
534            var dependentElements = Element.select(elm.form, '.validate-date-range.date-range-' + m[1] + '-to');
535            return !dependentElements.length || Validation.get('IsEmpty').test(dependentElements[0].value)
536                || normalizedTime(v) <= normalizedTime(dependentElements[0].value);
537        }],
538    ['validate-email', 'Please enter a valid email address. For example [email protected].', function (v) {
539                //return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
540                //return Validation.get('IsEmpty').test(v) || /^[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9][\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9\.]{1,30}[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9]@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i.test(v)
541                return Validation.get('IsEmpty').test(v) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v)
542            }],
543    ['validate-emailSender', 'Please use only visible characters and spaces.', function (v) {
544                return Validation.get('IsEmpty').test(v) ||  /^[\S ]+$/.test(v)
545                    }],
546    ['validate-password', 'Please enter 6 or more characters. Leading or trailing space
546s will be ignored.', function(v) {
547                var pass=v.strip(); /*strip leading and trailing spaces*/
548                return !(pass.length>0 && pass.length < 6);
549            }],
550    ['validate-admin-password', 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.', function(v) {
551                var pass=v.strip();
552                if (0 == pass.length) {
553                    return true;
554                }
555                if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v))) {
556                    return false;
557                }
558                return !(pass.length < 7);
559            }],
560    ['validate-cpassword', 'Please make sure your passwords match.', function(v) {
561                var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];
562                var pass = false;
563                if ($('password')) {
564                    pass = $('password');
565                }
566                var passwordElements = $$('.validate-password');
567                for (var i = 0; i < passwordElements.size(); i++) {
568                    var passwordElement = passwordElements[i];
569                    if (passwordElement.up('form').id == conf.up('form').id) {
570                        pass = passwordElement;
571                    }
572                }
573                if ($$('.validate-admin-password').size()) {
574                    pass = $$('.validate-admin-password')[0];
575                }
576                return (pass.value == conf.value);
577            }],
578    ['validate-both-passwords', 'Please make sure your passwords match.', function(v, input) {
579                var dependentInput = $(input.form[input.name == 'password' ? 'confirmation' : 'password']),
580                    isEqualValues  = input.value == dependentInput.value;
581
582                if (isEqualValues && dependentInput.hasClassName('validation-failed')) {
583                    Validation.test(this.className, dependentInput);
584                }
585
586                return dependentInput.value == '' || isEqualValues;
587            }],
588    ['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) {
589                v = (v || '').replace(/^\s+/, '').replace(/\s+$/, '');
590                return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(v)
591            }],
592    ['validate-clean-url', 'Please enter a valid URL. For example http://www.example.com or www.example.com', function (v) {
593                return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v) || /^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)
594            }],
595    ['validate-identifier', 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".', function (v) {
596                return Validation.get('IsEmpty').test(v) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(v)
597            }],
598    ['validate-xml-identifier', 'Please enter a valid XML-identifier. For example something_1, block5, id-4.', function (v) {
599                return Validation.get('IsEmpty').test(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v)
600            }],
601    ['validate-ssn', 'Please enter a valid social security number. For example 123-45-6789.', function(v) {
602            return Validation.get('IsEmpty').test(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v);
603            }],
604    ['validate-zip', 'Please enter a valid zip code. For example 90602 or 90602-1234.', function(v) {
605            return Validation.get('IsEmpty').test(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v);
606            }],
607    ['validate-zip-international', 'Please enter a valid zip code.', function(v) {
608            //return Validation.get('IsEmpty').test(v) || /(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(v);
609            return true;
610            }],
611    ['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
612                if(Validation.get('IsEmpty').test(v)) return true;
613                var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
614                if(!regex.test(v)) return false;
615                var d = new Date(v.replace(regex, '$2/$1/$3'));
616                return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) &&
617                            (parseInt(RegExp.$1, 10) == d.getDate()) &&
618                            (parseInt(RegExp.$3, 10) == d.getFullYear() );
619            }],
620    ['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00.', function(v) {
621                // [$]1[##][,###]+[.##]
622                // [$]1###+[.##]
623                // [$]0.##
624                // [$].##
625                return Validation.get('IsEmpty').test(v) ||  /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
626            }],
627    ['validate-one-required', 'Please select one of the above options.', function (v,elm) {
628                var p = elm.parentNode;
629                var options = p.getElementsByTagName('INPUT');
630                return $A(options).any(function(elm) {
631                    return $F(elm);
632                });
633            }],
634    ['validate-one-required-by-name', 'Please select one of the options.', function (v,elm) {
635                var inputs = $$('input[name="' + elm.name.replace(/([\\"])/g, '\\$1') + '"]');
636
637                var error = 1;
638                for(var i=0;i<inputs.length;i++) {
639                    if((inputs[i].type == 'checkbox' || inputs[i].type == 'radio') && inputs[i].checked == true) {
640                        error = 0;
641                    }
642
643                    if(Validation.isOnChange && (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')) {
644                        Validation.reset(inputs[i]);
645                    }
646                }
647
648                if( error == 0 ) {
649                    return true;
650                } else {
651                    return false;
652                }
653            }],
654    ['validate-not-negative-number', 'Please enter a number 0 or greater in this field.', function(v) {
655                if (Validation.get('IsEmpty').test(v)) {
656                    return true;
657                }
658                v = parseNumber(v);
659                return !isNaN(v) && v >= 0;
660            }],
661    ['validate-zero-or-greater', 'Please enter a number 0 or greater in this field.', function(v) {
662            return Validation.get('validate-not-negative-number').test(v);
663        }],
664    ['validate-greater-than-zero', 'Please enter a number greater than 0 in this field.', function(v) {
665            if (Validation.get('IsEmpty').test(v)) {
666                return true;
667            }
668            v = parseNumber(v);
669            return !isNaN(v) && v > 0;
670        }],
671    ['validate-state', 'Please select State/Province.', function(v) {
672                return (v!=0 || v == '');
673            }],
674    ['validate-new-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) {
675                if (!Validation.get('validate-password').test(v)) return false;
676                if (Validation.get('IsEmpty').test(v) && v != '') return false;
677                return true;
678            }],
679    ['validate-cc-number', 'Please enter a valid credit card number.', function(v, elm) {
680                // remove non-numerics
681                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
682                if (ccTypeContainer && typeof Validation.creditCartTypes.get(ccTypeContainer.value) != 'undefined'
683                        && Validation.creditCartTypes.get(ccTypeContainer.value)[2] == false) {
684                    if (!Validation.get('IsEmpty').test(v) && Validation.get('validate-digits').test(v)) {
685                        return true;
686                    } else {
687                        return false;
688                    }
689                }
690                return validateCreditCard(v);
691            }],
692    ['validate-cc-type', 'Credit card number does not match credit card type.', function(v, elm) {
693                // remove credit card number delimiters such as "-" and space
694                elm.value = removeDelimiters(elm.value);
695                v         = removeDelimiters(v);
696
697                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
698                if (!ccTypeContainer) {
699                    return true;
700                }
701                var ccType = ccTypeContainer.value;
702
703                if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
704                    return false;
705                }
706
707                // Other card type or switch or solo card
708                if (Validation.creditCartTypes.get(ccType)[0]==false) {
709                    return true;
710                }
711
712                var validationFailure = false;
713                Validation.creditCartTypes.each(function (pair) {
714                    if (pair.key == ccType) {
715                        if (pair.value[0] && !v.match(pair.value[0])) {
716                            validationFailure = true;
717                        }
718                        throw $break;
719                    }
720                });
721
722                if (validationFailure) {
723                    return false;
724                }
725
726                if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) {
727                    Validation.validate(ccTypeContainer);
728                }
729
730                return true;
731            }],
732     ['validate-cc-type-select', 'Card type does not match credit card number.', function(v, elm) {
733                var ccNumberContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_type')) + '_cc_number');
734                if (Validation.isOnChange && Validation.get('IsEmpty').test(ccNumberContainer.value)) {
735                    return true;
736                }
737                if (Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer)) {
738                    Validation.validate(ccNumberContainer);
739                }
740                return Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer);
741            }],
742     ['validate-cc-exp', 'Incorrect credit card expiration date.', function(v, elm) {
743                var ccExpMonth   = v;
744                var ccExpYear    = $(elm.id.substr(0,elm.id.indexOf('_expiration')) + '_expiration_yr').value;
745                var currentTime  = new Date();
746                var currentMonth = currentTime.getMonth() + 1;
747                var currentYear  = currentTime.getFullYear();
748                if (ccExpMonth < currentMonth && ccExpYear == currentYear) {
749                    return false;
750                }
751                return true;
752            }],
753     ['validate-cc-cvn', 'Please enter a valid credit card verification number.', function(v, elm) {
754                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_cid')) + '_cc_type');
755                if (!ccTypeContainer) {
756                    return true;
757                }
758                var ccType = ccTypeContainer.value;
759
760                if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
761                    return false;
762                }
763
764                var re = Validation.creditCartTypes.get(ccType)[1];
765
766                if (v.match(re)) {
767                    return true;
768                }
769
770                return false;
771            }],
772     ['validate-ajax', '', function(v, elm) { return true; }],
773     ['validate-data', 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
774                if(v != '' && v) {
775                    return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v);
776                }
777                return true;
778            }],
779     ['validate-css-length', 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.', function (v) {
780                if (v != '' && v) {
781                    return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v) && (!(/\..*\./.test(v))) && !(/\.$/.test(v));
782                }
783                return true;
784            }],
785     ['validate-length', 'Text length does not satisfy specified text range.', function (v, elm) {
786                var reMax = new RegExp(/^maximum-length-[0-9]+$/);
787                var reMin = new RegExp(/^minimum-length-[0-9]+$/);
788                var result = true;
789                $w(elm.className).each(function(name, index) {
790                    if (name.match(reMax) && result) {
791                       var length = name.split('-')[2];
792                       result = (v.length <= length);
793                    }
794                    if (name.match(reMin) && result && !Validation.get('IsEmpty').test(v)) {
795                        var length = name.split('-')[2];
796                        result = (v.length >= length);
797                    }
798                });
799                return result;
800            }],
801     ['validate-percents', 'Please enter a number lower than 100.', {max:100}],
802     ['required-file', 'Please select a file', function(v, elm) {
803         var result = !Validation.get('IsEmpty').test(v);
804         if (result === false) {
805             ovId = elm.id + '_value';
806             if ($(ovId)) {
807                 result = !Validation.get('IsEmpty').test($(ovId).value);
808             }
809         }
810         return result;
811     }],
812     ['validate-cc-ukss', 'Please enter issue number or start date for switch/solo card type.', function(v,elm) {
813         var endposition;
814
815         if (elm.id.match(/(.)+_cc_issue$/)) {
816             endposition = elm.id.indexOf('_cc_issue');
817         } else if (elm.id.match(/(.)+_start_month$/)) {
818             endposition = elm.id.indexOf('_start_month');
819         } else {
820             endposition = elm.id.indexOf('_start_year');
821         }
822
823         var prefix = elm.id.substr(0,endposition);
824
825         var ccTypeContainer = $(prefix + '_cc_type');
826
827         if (!ccTypeContainer) {
828               return true;
829         }
830         var ccType = ccTypeContainer.value;
831
832         if(['SS','SM','SO'].indexOf(ccType) == -1){
833             return true;
834         }
835
836         $(prefix + '_cc_issue').advaiceContainer
837           = $(prefix + '_start_month').advaiceContainer
838           = $(prefix + '_start_year').advaiceContainer
839           = $(prefix + '_cc_type_ss_div').down('ul li.adv-container');
840
841         var ccIssue   =  $(prefix + '_cc_issue').value;
842         var ccSMonth  =  $(prefix + '_start_month').value;
843         var ccSYear   =  $(prefix + '_start_year').value;
844
845         var ccStartDatePresent = (ccSMonth && ccSYear) ? true : false;
846
847         if (!ccStartDatePresent && !ccIssue){
848             return false;
849         }
850         return true;
851     }]
852]);
853
854function removeDelimiters (v) {
855    v = v.replace(/\s/g, '');
856    v = v.replace(/\-/g, '');
857    return v;
858}
859
860function parseNumber(v)
861{
862    if (typeof v != 'string') {
863        return parseFloat(v);
864    }
865
866    var isDot  = v.indexOf('.');
867    var isComa = v.indexOf(',');
868
869    if (isDot != -1 && isComa != -1) {
870        if (isComa > isDot) {
871            v = v.replace('.', '').replace(',', '.');
872        }
873        else {
874            v = v.replace(',', '');
875        }
876    }
877    else if (isComa != -1) {
878        v = v.replace(',', '.');
879    }
880
881    return parseFloat(v);
882}
883
884/**
885 * Hash with credit card types which can be simply extended in payment modules
886 * 0 - regexp for card number
887 * 1 - regexp for cvn
888 * 2 - check or not credit card number trough Luhn algorithm by
889 *     function validateCreditCard which you can find above in this file
890 */
891Validation.creditCartTypes = $H({
892//    'SS': [new RegExp('^((6759[0-9]{12})|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})|(6333[0-9]{12})|(6334[0-4]\d{11})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
893    'SO': [new RegExp('^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
894    'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true],
895    'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true],
896    'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true],
897    'DI': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true],
898    'JCB': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3,4}$'), true],
899    'DICL': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true],
900    'SM': [new RegExp('(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true],
901    'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]
902});
903
904String.prototype.parseColor=function(){var e="#";if("rgb("==this.slice(0,4)){var t=this.slice(4,this.length-1).split(","),i=0;do e+=parseInt(t[i]).toColorPart();while(3>++i)}else if("#"==this.slice(0,1)){if(4==this.length)for(var i=1;4>i;i++)e+=(this.charAt(i)+this.charAt(i)).toLowerCase();7==this.length&&(e=this.toLowerCase())}return 7==e.length?e:arguments[0]||this},Element.collectTextNodes=function(e){return $A($(e).childNodes).collect(function(e){return 3==e.nodeType?e.nodeValue:e.hasChildNodes()?Element.collectTextNodes(e):""}).flatten().join("")},Element.collectTextNodesIgnoreClass=function(e,t){return $A($(e).childNodes).collect(function(e){return 3==e.nodeType?e.nodeValue:e.hasChildNodes()&&!Element.hasClassName(e,t)?Element.collectTextNodesIgnoreClass(e,t):""}).flatten().join("")},Element.setContentZoom=function(e,t){return e=$(e),e.setStyle({fontSize:t/100+"em"}),Prototype.Browser.WebKit&&window.scrollBy(0,0),e},Element.getInlineOpacity=function(e){return $(e).style.opacity||""},Element.forceRerendering=function(e){try{e=$(e);var t=document.createTextNode(" ");e.appendChild(t),e.removeChild(t)}catch(i){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(e){return-Math.cos(e*Math.PI)/2+.5},reverse:function(e){return 1-e},flicker:function(e){var e=-Math.cos(e*Math.PI)/4+.75+Math.random()/4;return e>1?1:e},wobble:function(e){return-Math.cos(e*Math.PI*9*e)/2+.5},pulse:function(e,t){return-Math.cos(2*e*((t||5)-.5)*Math.PI)/2+.5},spring:function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)},none:function(){return 0},full:function(){return 1}},DefaultOptions:{duration:1,fps:100,sync:!1,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(e){var t="position:relative";Prototype.Browser.IE&&(t+=";
904zoom:1"),e=$(e),$A(e.childNodes).each(function(i){3==i.nodeType&&(i.nodeValue.toArray().each(function(n){e.insertBefore(new Element("span",{style:t}).update(" "==n?String.fromCharCode(160):n),i)}),Element.remove(i))})},multiple:function(e,t){var i;i=("object"==typeof e||Object.isFunction(e))&&e.length?e:$(e).childNodes;var n=Object.extend({speed:.1,delay:0},arguments[2]||{}),r=n.delay;$A(i).each(function(e,i){new t(e,Object.extend(n,{delay:i*n.speed+r}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(e,t,i){return e=$(e),t=(t||"appear").toLowerCase(),Effect[Effect.PAIRS[t][e.visible()?1:0]](e,Object.extend({queue:{position:"end",scope:e.id||"global",limit:1}},i||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal,Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[],this.interval=null},_each:function(e){this.effects._each(e)},add:function(e){var t=(new Date).getTime(),i=Object.isString(e.options.queue)?e.options.queue:e.options.queue.position;switch(i){case"front":this.effects.findAll(function(e){return"idle"==e.state}).each(function(t){t.startOn+=e.finishOn,t.finishOn+=e.finishOn});break;case"with-last":t=this.effects.pluck("startOn").max()||t;break;case"end":t=this.effects.pluck("finishOn").max()||t}e.startOn+=t,e.finishOn+=t,(!e.options.queue.limit||this.effects.length<e.options.queue.limit)&&this.effects.push(e),this.interval||(this.interval=setInterval(this.loop.bind(this),15))},remove:function(e){this.effects=this.effects.reject(function(t){return t==e}),0==this.effects.length&&(clearInterval(this.interval),this.interval=null)},loop:function(){for(var e=(new Date).getTime(),t=0,i=this.effects.length;i>t;t++)this.effects[t]&&this.effects[t].loop(e)}}),Effect.Queues={instances:$H(),get:function(e){return Object.isString(e)?this.instances.get(e)||this.instances.set(e,new Effect.ScopedQueue):e}},Effect.Queue=Effect.Queues.get("global"),Effect.Base=Class.create({position:null,start:function(e){e&&e.transition===!1&&(e.transition=Effect.Transitions.linear),this.options=Object.extend(Object.extend({},Effect.DefaultOptions),e||{}),this.currentFrame=0,this.state="idle",this.startOn=1e3*this.options.delay,this.finishOn=this.startOn+1e3*this.options.duration,this.fromToDelta=this.options.to-this.options.from,this.totalTime=this.finishOn-this.startOn,this.totalFrames=this.options.fps*this.options.duration,this.render=function(){function e(e,t){e.options[t+"Internal"]&&e.options[t+"Internal"](e),e.options[t]&&e.options[t](e)}return function(t){"idle"===this.state&&(this.state="running",e(this,"beforeSetup"),this.setup&&this.setup(),e(this,"afterSetup")),"running"===this.state&&(t=this.options.transition(t)*this.fromToDelta+this.options.from,this.position=t,e(this,"beforeUpdate"),this.update&&this.update(t),e(this,"afterUpdate"))}}(),this.event("beforeStart"),this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)},loop:function(e){if(e>=this.startOn){if(e>=this.finishOn)return this.render(1),this.cancel(),this.event("beforeFinish"),this.finish&&this.finish(),this.event("afterFinish"),void 0;var t=(e-this.startOn)/this.totalTime,i=(t*this.totalFrames).round();i>this.currentFrame&&(this.render(t),this.currentFrame=i)}},cancel:function(){this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this),this.state="finished"},event:function(e){this.options[e+"Internal"]&&this.options[e+"Internal"](this),this.options[e]&&this.options[e](this)},inspect:function(){var e=$H();for(property in this)Object.isFunction(this[property])||e.set(property,this[property]);return"#<Effect:"+e.inspect()+",options:"+$H(this.options).inspect()+">"}}),Effect.Parallel=Class.create(Effect.Base,{initialize:function(e){this.effects=e||[],this.start(arguments[1])},update:function(e){this.effects.invoke("render",e)},finish:function(e){this.effects.each(function(t){t.render(1),t.cancel(),t.event("beforeFinish"),t.finish&&t.finish(e),t.event("afterFinish")})}}),Effect.Tween=Class.create(Effect.Base,{initialize:function(e,t,i){e=Object.isString(e)?$(e):e;var n=$A(arguments),r=n.last(),s=5==n.length?n[3]:null;this.method=Object.isFunction(r)?r.bind(e):Object.isFunction(e[r])?e[r].bind(e):function(t){e[r]=t},this.start(Object.extend({from:t,to:i},s||{}))},update:function(e){this.method(e)}}),Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction}),Effect.Opacity=Class.create(Effect.Base,{initialize:function(e){if(this.element=$(e),!this.element)throw Effect._elementDoesNotExistError;Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});var t=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(t)},update:function(e){this.element.setOpacity(e)}}),Effect.Move=Class.create(Effect.Base,{initialize:function(e){if(this.element=$(e),!this.element)throw Effect._elementDoesNotExistError;var t=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(t)},setup:function(){this.element.makePositioned(),this.originalLeft=parseFloat(this.element.getStyle("left")||"0"),this.originalTop=parseFloat(this.element.getStyle("top")||"0"),"absolute"==this.options.mode&&(this.options.x=this.options.x-this.originalLeft,this.options.y=this.options.y-this.originalTop)},update:function(e){this.element.setStyle({left:(this.options.x*e+this.originalLeft).round()+"px",top:(this.options.y*e+this.originalTop).round()+"px"})}}),Effect.MoveBy=function(e,t,i){return new Effect.Move(e,Object.extend({x:i,y:t},arguments[3]||{}))},Effect.Scale=Class.create(Effect.Base,{initialize:function(e,t){if(this.element=$(e),!this.element)throw Effect._elementDoesNotExistError;var i=Object.extend({scaleX:!0,scaleY:!0,scaleContent:!0,scaleFromCenter:!1,scaleMode:"box",scaleFrom:100,scaleTo:t},arguments[2]||{});this.start(i)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||!1,this.elementPositioning=this.element.getStyle("position"),this.originalStyle={},["top","left","width","height","fontSize"].each(function(e){this.originalStyle[e]=this.element.style[e]}.bind(this)),this.originalTop=this.element.offsetTop,this.originalLeft=this.element.offsetLeft;var e=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(t){e.indexOf(t)>0&&(this.fontSize=parseFloat(e),this.fontSizeType=t)}.bind(this)),this.factor=(this.options.scaleTo-this.options.scaleFrom)/100,this.dims=null,"box"==this.options.scaleMode&&(this.dims=[this.element.offsetHeight,this.element.offsetWidth]),/^content/.test(this.options.scaleMode)&&(this.dims=[this.element.scrollHeight,this.element.scrollWidth]),this.dims||(this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth])},update:function(e){var t=this.options.scaleFrom/100+this.factor*e;this.options.scaleContent&&this.fontSize&&this.element.setStyle({fontSize:this.fontSize*t+this.fontSizeType}),this.setDimensions(this.dims[0]*t,this.dims[1]*t)},finish:function(){this.restoreAfterFinish&&this.element.setStyle(this.originalStyle)},setDimensions:function(e,t){var i={};if(this.options.scaleX&&(i.width=t.round()+"px"),this.options.scaleY&&(i.height=e.round()+"px"),this.options.scaleFromCenter){var n=(e-this.dims[0])/2,r=(t-this.dims[1])/2;"absolute"==this.elementPositioning?(this.options.scaleY&&(i.top=this.originalTop-n+"px"),this.options.scaleX&&(i.left
904=this.originalLeft-r+"px")):(this.options.scaleY&&(i.top=-n+"px"),this.options.scaleX&&(i.left=-r+"px"))}this.element.setStyle(i)}}),Effect.Highlight=Class.create(Effect.Base,{initialize:function(e){if(this.element=$(e),!this.element)throw Effect._elementDoesNotExistError;var t=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(t)},setup:function(){return"none"==this.element.getStyle("display")?(this.cancel(),void 0):(this.oldStyle={},this.options.keepBackgroundImage||(this.oldStyle.backgroundImage=this.element.getStyle("background-image"),this.element.setStyle({backgroundImage:"none"})),this.options.endcolor||(this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")),this.options.restorecolor||(this.options.restorecolor=this.element.getStyle("background-color")),this._base=$R(0,2).map(function(e){return parseInt(this.options.startcolor.slice(2*e+1,2*e+3),16)}.bind(this)),this._delta=$R(0,2).map(function(e){return parseInt(this.options.endcolor.slice(2*e+1,2*e+3),16)-this._base[e]}.bind(this)),void 0)},update:function(e){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(t,i,n){return t+(this._base[n]+this._delta[n]*e).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}}),Effect.ScrollTo=function(e){var t=arguments[1]||{},i=document.viewport.getScrollOffsets(),n=$(e).cumulativeOffset();return t.offset&&(n[1]+=t.offset),new Effect.Tween(null,i.top,n[1],t,function(e){scrollTo(i.left,e.round())})},Effect.Fade=function(e){e=$(e);var t=e.getInlineOpacity(),i=Object.extend({from:e.getOpacity()||1,to:0,afterFinishInternal:function(e){0==e.options.to&&e.element.hide().setStyle({opacity:t})}},arguments[1]||{});return new Effect.Opacity(e,i)},Effect.Appear=function(e){e=$(e);var t=Object.extend({from:"none"==e.getStyle("display")?0:e.getOpacity()||0,to:1,afterFinishInternal:function(e){e.element.forceRerendering()},beforeSetup:function(e){e.element.setOpacity(e.options.from).show()}},arguments[1]||{});return new Effect.Opacity(e,t)},Effect.Puff=function(e){e=$(e);var t={opacity:e.getInlineOpacity(),position:e.getStyle("position"),top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height};return new Effect.Parallel([new Effect.Scale(e,200,{sync:!0,scaleFromCenter:!0,scaleContent:!0,restoreAfterFinish:!0}),new Effect.Opacity(e,{sync:!0,to:0})],Object.extend({duration:1,beforeSetupInternal:function(e){Position.absolutize(e.effects[0].element)},afterFinishInternal:function(e){e.effects[0].element.hide().setStyle(t)}},arguments[1]||{}))},Effect.BlindUp=function(e){return e=$(e),e.makeClipping(),new Effect.Scale(e,0,Object.extend({scaleContent:!1,scaleX:!1,restoreAfterFinish:!0,afterFinishInternal:function(e){e.element.hide().undoClipping()}},arguments[1]||{}))},Effect.BlindDown=function(e){e=$(e);var t=e.getDimensions();return new Effect.Scale(e,100,Object.extend({scaleContent:!1,scaleX:!1,scaleFrom:0,scaleMode:{originalHeight:t.height,originalWidth:t.width},restoreAfterFinish:!0,afterSetup:function(e){e.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.element.undoClipping()}},arguments[1]||{}))},Effect.SwitchOff=function(e){e=$(e);var t=e.getInlineOpacity();return new Effect.Appear(e,Object.extend({duration:.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(e){new Effect.Scale(e.element,1,{duration:.3,scaleFromCenter:!0,scaleX:!1,scaleContent:!1,restoreAfterFinish:!0,beforeSetup:function(e){e.element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned().setStyle({opacity:t})}})}},arguments[1]||{}))},Effect.DropOut=function(e){e=$(e);var t={top:e.getStyle("top"),left:e.getStyle("left"),opacity:e.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(e,{x:0,y:100,sync:!0}),new Effect.Opacity(e,{sync:!0,to:0})],Object.extend({duration:.5,beforeSetup:function(e){e.effects[0].element.makePositioned()},afterFinishInternal:function(e){e.effects[0].element.hide().undoPositioned().setStyle(t)}},arguments[1]||{}))},Effect.Shake=function(e){e=$(e);var t=Object.extend({distance:20,duration:.5},arguments[1]||{}),i=parseFloat(t.distance),n=parseFloat(t.duration)/10,r={top:e.getStyle("top"),left:e.getStyle("left")};return new Effect.Move(e,{x:i,y:0,duration:n,afterFinishInternal:function(e){new Effect.Move(e.element,{x:2*-i,y:0,duration:2*n,afterFinishInternal:function(e){new Effect.Move(e.element,{x:2*i,y:0,duration:2*n,afterFinishInternal:function(e){new Effect.Move(e.element,{x:2*-i,y:0,duration:2*n,afterFinishInternal:function(e){new Effect.Move(e.element,{x:2*i,y:0,duration:2*n,afterFinishInternal:function(e){new Effect.Move(e.element,{x:-i,y:0,duration:n,afterFinishInternal:function(e){e.element.undoPositioned().setStyle(r)}})}})}})}})}})}})},Effect.SlideDown=function(e){e=$(e).cleanWhitespace();var t=e.down().getStyle("bottom"),i=e.getDimensions();return new Effect.Scale(e,100,Object.extend({scaleContent:!1,scaleX:!1,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:i.height,originalWidth:i.width},restoreAfterFinish:!0,afterSetup:function(e){e.element.makePositioned(),e.element.down().makePositioned(),window.opera&&e.element.setStyle({top:""}),e.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:e.dims[0]-e.element.clientHeight+"px"})},afterFinishInternal:function(e){e.element.undoClipping().undoPositioned(),e.element.down().undoPositioned().setStyle({bottom:t})}},arguments[1]||{}))},Effect.SlideUp=function(e){e=$(e).cleanWhitespace();var t=e.down().getStyle("bottom"),i=e.getDimensions();return new Effect.Scale(e,window.opera?0:1,Object.extend({scaleContent:!1,scaleX:!1,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:i.height,originalWidth:i.width},restoreAfterFinish:!0,afterSetup:function(e){e.element.makePositioned(),e.element.down().makePositioned(),window.opera&&e.element.setStyle({top:""}),e.element.makeClipping().show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:e.dims[0]-e.element.clientHeight+"px"})},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned(),e.element.down().undoPositioned().setStyle({bottom:t})}},arguments[1]||{}))},Effect.Squish=function(e){return new Effect.Scale(e,window.opera?1:0,{restoreAfterFinish:!0,beforeSetup:function(e){e.element.makeClipping()},afterFinishInternal:function(e){e.element.hide().undoClipping()}})},Effect.Grow=function(e){e=$(e);var t,i,n,r,s=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{}
904),o={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()},a=e.getDimensions();switch(s.direction){case"top-left":t=i=n=r=0;break;case"top-right":t=a.width,i=r=0,n=-a.width;break;case"bottom-left":t=n=0,i=a.height,r=-a.height;break;case"bottom-right":t=a.width,i=a.height,n=-a.width,r=-a.height;break;case"center":t=a.width/2,i=a.height/2,n=-a.width/2,r=-a.height/2}return new Effect.Move(e,{x:t,y:i,duration:.01,beforeSetup:function(e){e.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(e){new Effect.Parallel([new Effect.Opacity(e.element,{sync:!0,to:1,from:0,transition:s.opacityTransition}),new Effect.Move(e.element,{x:n,y:r,sync:!0,transition:s.moveTransition}),new Effect.Scale(e.element,100,{scaleMode:{originalHeight:a.height,originalWidth:a.width},sync:!0,scaleFrom:window.opera?1:0,transition:s.scaleTransition,restoreAfterFinish:!0})],Object.extend({beforeSetup:function(e){e.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.effects[0].element.undoClipping().undoPositioned().setStyle(o)}},s))}})},Effect.Shrink=function(e){e=$(e);var t,i,n=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{}),r={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()},s=e.getDimensions();switch(n.direction){case"top-left":t=i=0;break;case"top-right":t=s.width,i=0;break;case"bottom-left":t=0,i=s.height;break;case"bottom-right":t=s.width,i=s.height;break;case"center":t=s.width/2,i=s.height/2}return new Effect.Parallel([new Effect.Opacity(e,{sync:!0,to:0,from:1,transition:n.opacityTransition}),new Effect.Scale(e,window.opera?1:0,{sync:!0,transition:n.scaleTransition,restoreAfterFinish:!0}),new Effect.Move(e,{x:t,y:i,sync:!0,transition:n.moveTransition})],Object.extend({beforeStartInternal:function(e){e.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.effects[0].element.hide().undoClipping().undoPositioned().setStyle(r)}},n))},Effect.Pulsate=function(e){e=$(e);var t=arguments[1]||{},i=e.getInlineOpacity(),n=t.transition||Effect.Transitions.linear,r=function(e){return 1-n(-Math.cos(2*e*(t.pulses||5)*Math.PI)/2+.5)};return new Effect.Opacity(e,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(e){e.element.setStyle({opacity:i})}},t),{transition:r}))},Effect.Fold=function(e){e=$(e);var t={top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height};return e.makeClipping(),new Effect.Scale(e,5,Object.extend({scaleContent:!1,scaleX:!1,afterFinishInternal:function(){new Effect.Scale(e,1,{scaleContent:!1,scaleY:!1,afterFinishInternal:function(e){e.element.hide().undoClipping().setStyle(t)}})}},arguments[1]||{}))},Effect.Morph=Class.create(Effect.Base,{initialize:function(e){if(this.element=$(e),!this.element)throw Effect._elementDoesNotExistError;var t=Object.extend({style:{}},arguments[1]||{});if(Object.isString(t.style))if(t.style.include(":"))this.style=t.style.parseStyle();else{this.element.addClassName(t.style),this.style=$H(this.element.getStyles()),this.element.removeClassName(t.style);var i=this.element.getStyles();this.style=this.style.reject(function(e){return e.value==i[e.key]}),t.afterFinishInternal=function(e){e.element.addClassName(e.options.style),e.transforms.each(function(t){e.element.style[t.style]=""})}}else this.style=$H(t.style);this.start(t)},setup:function(){function e(e){return(!e||["rgba(0, 0, 0, 0)","transparent"].include(e))&&(e="#ffffff"),e=e.parseColor(),$R(0,2).map(function(t){return parseInt(e.slice(2*t+1,2*t+3),16)})}this.transforms=this.style.map(function(t){var i=t[0],n=t[1],r=null;if("#zzzzzz"!=n.parseColor("#zzzzzz"))n=n.parseColor(),r="color";else if("opacity"==i)n=parseFloat(n),Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});else if(Element.CSS_LENGTH.test(n)){var s=n.match(/^([\+\-]?[0-9\.]+)(.*)$/);n=parseFloat(s[1]),r=3==s.length?s[2]:null}var o=this.element.getStyle(i);return{style:i.camelize(),originalValue:"color"==r?e(o):parseFloat(o||0),targetValue:"color"==r?e(n):n,unit:r}}.bind(this)).reject(function(e){return e.originalValue==e.targetValue||"color"!=e.unit&&(isNaN(e.originalValue)||isNaN(e.targetValue))})},update:function(e){for(var t,i={},n=this.transforms.length;n--;)i[(t=this.transforms[n]).style]="color"==t.unit?"#"+Math.round(t.originalValue[0]+(t.targetValue[0]-t.originalValue[0])*e).toColorPart()+Math.round(t.originalValue[1]+(t.targetValue[1]-t.originalValue[1])*e).toColorPart()+Math.round(t.originalValue[2]+(t.targetValue[2]-t.originalValue[2])*e).toColorPart():(t.originalValue+(t.targetValue-t.originalValue)*e).toFixed(3)+(null===t.unit?"":t.unit);this.element.setStyle(i,!0)}}),Effect.Transform=Class.create({initialize:function(e){this.tracks=[],this.options=arguments[1]||{},this.addTracks(e)},addTracks:function(e){return e.each(function(e){e=$H(e);var t=e.values().first();this.tracks.push($H({ids:e.keys().first(),effect:Effect.Morph,options:{style:t}}))}.bind(this)),this},play:function(){return new Effect.Parallel(this.tracks.map(function(e){var t=e.get("ids"),i=e.get("effect"),n=e.get("options"),r=[$(t)||$$(t)].flatten();return r.map(function(e){return new i(e,Object.extend({sync:!0},n))})}).flatten(),this.options)}}),Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex"),Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/,Str
904ing.__parseStyleElement=document.createElement("div"),String.prototype.parseStyle=function(){var e,t=$H();return Prototype.Browser.WebKit?e=new Element("div",{style:this}).style:(String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>',e=String.__parseStyleElement.childNodes[0].style),Element.CSS_PROPERTIES.each(function(i){e[i]&&t.set(i,e[i])}),Prototype.Browser.IE&&this.include("opacity")&&t.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]),t},Element.getStyles=document.defaultView&&document.defaultView.getComputedStyle?function(e){var t=document.defaultView.getComputedStyle($(e),null);return Element.CSS_PROPERTIES.inject({},function(e,i){return e[i]=t[i],e})}:function(e){e=$(e);var t,i=e.currentStyle;return t=Element.CSS_PROPERTIES.inject({},function(e,t){return e[t]=i[t],e}),t.opacity||(t.opacity=e.getOpacity()),t},Effect.Methods={morph:function(e,t){return e=$(e),new Effect.Morph(e,Object.extend({style:t},arguments[2]||{})),e},visualEffect:function(e,t,i){e=$(e);var n=t.dasherize().camelize(),r=n.charAt(0).toUpperCase()+n.substring(1);return new Effect[r](e,i),e},highlight:function(e,t){return e=$(e),new Effect.Highlight(e,t),e}},$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(e){Effect.Methods[e]=function(t,i){return t=$(t),Effect[e.charAt(0).toUpperCase()+e.substring(1)](t,i),t}}),$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(e){Effect.Methods[e]=Element[e]}),Element.addMethods(Effect.Methods);
905
906// script.aculo.us controls.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
907
908// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
909//           (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
910//           (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
911// Contributors:
912//  Richard Livsey
913//  Rahul Bhargava
914//  Rob Wills
915//
916// script.aculo.us is freely distributable under the terms of an MIT-style license.
917// For details, see the script.aculo.us web site: http://script.aculo.us/
918
919// Autocompleter.Base handles all the autocompletion functionality
920// that's independent of the data source for autocompletion. This
921// includes drawing the autocompletion menu, observing keyboard
922// and mouse events, and similar.
923//
924// Specific autocompleters need to provide, at the very least,
925// a getUpdatedChoices function that will be invoked every time
926// the text inside the monitored textbox changes. This method
927// should get the text for which to provide autocompletion by
928// invoking this.getToken(), NOT by directly accessing
929// this.element.value. This is to allow incremental tokenized
930// autocompletion. Specific auto-completion logic (AJAX, etc)
931// belongs in getUpdatedChoices.
932//
933// Tokenized incremental autocompletion is enabled automatically
934// when an autocompleter is instantiated with the 'tokens' option
935// in the options parameter, e.g.:
936// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
937// will incrementally autocomplete with a comma as the token.
938// Additionally, ',' in the above example can be replaced with
939// a token array, e.g. { tokens: [',', '\n'] } which
940// enables autocompletion on multiple tokens. This is most
941// useful when one of the tokens is \n (a newline), as it
942// allows smart autocompletion after linebreaks.
943
944if(typeof Effect == 'undefined')
945  throw("controls.js requires including script.aculo.us' effects.js library");
946
947var Autocompleter = { };
948Autocompleter.Base = Class.create({
949  baseInitialize: function(element, update, options) {
950    element          = $(element);
951    this.element     = element;
952    this.update      = $(update);
953    this.hasFocus    = false;
954    this.changed     = false;
955    this.active      = false;
956    this.index       = 0;
957    this.entryCount  = 0;
958    this.oldElementValue = this.element.value;
959
960    if(this.setOptions)
961      this.setOptions(options);
962    else
963      this.options = options || { };
964
965    this.options.paramName    = this.options.paramName || this.element.name;
966    this.options.tokens       = this.options.tokens || [];
967    this.options.frequency    = this.options.frequency || 0.4;
968    this.options.minChars     = this.options.minChars || 1;
969    this.options.onShow       = this.options.onShow ||
970      function(element, update){
971        if(!update.style.position || update.style.position=='absolute') {
972          update.style.position = 'absolute';
973          Position.clone(element, update, {
974            setHeight: false,
975            offsetTop: element.offsetHeight
976          });
977        }
978        Effect.Appear(update,{duration:0.15});
979      };
980    this.options.onHide = this.options.onHide ||
981      function(element, update){ new Effect.Fade(update,{duration:0.15}) };
982
983    if(typeof(this.options.tokens) == 'string')
984      this.options.tokens = new Array(this.options.tokens);
985    // Force carriage returns as token delimiters anyway
986    if (!this.options.tokens.include('\n'))
987      this.options.tokens.push('\n');
988
989    this.observer = null;
990
991    this.element.setAttribute('autocomplete','off');
992
993    Element.hide(this.update);
994
995    Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
996    Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
997  },
998
999  show: function() {
1000    if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
1001    if(!this.iefix &&
1002      (Prototype.Browser.IE) &&
1003      (Element.getStyle(this.update, 'position')=='absolute')) {
1004      new Insertion.After(this.update,
1005       '<iframe id="' + this.update.id + '_iefix" '+
1006       'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
1007       'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
1008      this.iefix = $(this.update.id+'_iefix');
1009    }
1010    if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
1011  },
1012
1013  fixIEOverlapping: function() {
1014    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
1015    this.iefix.style.zIndex = 1;
1016    this.update.style.zIndex = 2;
1017    Element.show(this.iefix);
1018  },
1019
1020  hide: function() {
1021    this.stopIndicator();
1022    if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
1023    if(this.iefix) Element.hide(this.iefix);
1024  },
1025
1026  startIndicator: function() {
1027    if(this.options.indicator) Element.show(this.options.indicator);
1028  },
1029
1030  stopIndicator: function() {
1031    if(this.options.indicator) Element.hide(this.options.indicator);
1032  },
1033
1034  onKeyPress: function(event) {
1035    if(this.active)
1036      switch(event.keyCode) {
1037       case Event.KEY_TAB:
1038       case Event.KEY_RETURN:
1039         this.selectEntry();
1040         Event.stop(event);
1041       case Event.KEY_ESC:
1042         this.hide();
1043         this.active = false;
1044         Event.stop(event);
1045         return;
1046       case Event.KEY_LEFT:
1047       case Event.KEY_RIGHT:
1048         return;
1049       case Event.KEY_UP:
1050         this.markPrevious();
1051         this.render();
1052         Event.stop(event);
1053         return;
1054       case Event.KEY_DOWN:
1055         this.markNext();
1056         this.render();
1057         Event.stop(event);
1058         return;
1059      }
1060     else
1061       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
1062         (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
1063
1064    this.changed = true;
1065    this.hasFocus = true;
1066
1067    if(this.observer) clearTimeout(this.observer);
1068      this.observer =
1069        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
1070  },
1071
1072  activate: function() {
1073    this.changed = false;
1074    this.hasFocus = true;
1075    this.getUpdatedChoices();
1076  },
1077
1078  onHover: function(event) {
1079    var element = Event.findElement(event, 'LI');
1080    if(this.index != element.autocompleteIndex)
1081    {
1082        this.index = element.autocompleteIndex;
1083        this.render();
1084    }
1085    Event.stop(event);
1086  },
1087
1088  onClick: function(event) {
1089    var element = Event.findElement(event, 'LI');
1090    this.index = element.autocompleteIndex;
1091    this.selectEntry();
1092    this.hide();
1093  },
1094
1095  onBlur: function(event) {
1096    // needed to make click events working
1097    setTimeout(this.hide.bind(this), 250);
1098    this.hasFocus = false;
1099    this.active = false;
1100  },
1101
1102  render: function() {
1103    if(this.entryCount > 0) {
1104      for (var i = 0; i < this.entryCount; i++)
1105        this.index==i ?
1106          Element.addClassName(this.getEntry(i),"selected") :
1107          Element.removeClassName(this.getEntry(i),"selected");
1108      if(this.hasFocus) {
1109        this.show();
1110        this.active = true;
1111      }
1112    } else {
1113      this.active = false;
1114      this.hide();
1115    }
1116  },
1117
1118  markPrevious: function() {
1119    if(this.index > 0) this.index--;
1120      else this.index = this.entryCount-1;
1121    //this.getEntry(this.index).scrollIntoView(true); useless
1122  },
1123
1124  markNext: function() {
1125    if(this.index < this.entryCount-1) this.index++;
1126      else this.index = 0;
1127    this.getEntry(this.index).scrollIntoView(false);
1128  },
1129
1130  getEntry: function(index) {
1131    return this.update.firstChild.childNodes[index];
1132  },
1133
1134  getCurrentEntry: function() {
1135    return this.getEntry(this.index);
1136  },
1137
1138  selectEntry: function() {
1139    this.active = false;
1140    this.updateElement(this.getCurrentEntry());
1141  },
1142
1143  updateElement: function(selectedElement) {
1144    if (this.options.updateElement) {
1145      this.options.updateElement(selectedElement);
1146      return;
1147    }
1148    var value = '';
1149    if (this.options.select) {
1150      var nodes = $(selectedElement).select('.' + this.options.select) || [];
1151      if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
1152    } else
1153      value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
1154
1155    var bounds = this.getTokenBounds();
1156    if (bounds[0] != -1) {
1157      var newValue = this.element.value.substr(0, bounds[0]);
1158      var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
1159      if (whitespace)
1160        newValue += whitespace[0];
1161      this.element.value = newValue + value + this.element.value.substr(bounds[1]);
1162    } else {
1163      this.element.value = value;
1164    }
1165    this.oldElementValue = this.element.value;
1166    this.element.focus();
1167
1168    if (this.options.afterUpdateElement)
1169      this.options.afterUpdateElement(this.element, selectedElement);
1170  },
1171
1172  updateChoices: function(choices) {
1173    if(!this.changed && this.hasFocus) {
1174      this.update.innerHTML = choices;
1175      Element.cleanWhitespace(this.update);
1176      Element.cleanWhitespace(this.update.down());
1177
1178      if(this.update.firstChild && this.update.down().childNodes) {
1179        this.entryCount =
1180          this.update.down().childNodes.length;
1181        for (var i = 0; i < this.entryCount; i++) {
1182          var entry = this.getEntry(i);
1183          entry.autocompleteIndex = i;
1184          this.addObservers(entry);
1185        }
1186      } else {
1187        this.entryCount = 0;
1188      }
1189
1190      this.stopIndicator();
1191      this.index = 0;
1192
1193      if(this.entryCount==1 && this.options.autoSelect) {
1194        this.selectEntry();
1195        this.hide();
1196      } else {
1197        this.render();
1198      }
1199    }
1200  },
1201
1202  addObservers: function(element) {
1203    Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
1204    Event.observe(element, "click", this.onClick.bindAsEventListener(this));
1205  },
1206
1207  onObserverEvent: function() {
1208    this.changed = false;
1209    this.tokenBounds = null;
1210    if(this.getToken().length>=this.options.minChars) {
1211      this.getUpdatedChoices();
1212    } else {
1213      this.active = false;
1214      this.hide();
1215    }
1216    this.oldElementValue = this.element.value;
1217  },
1218
1219  getToken: function() {
1220    var bounds = this.getTokenBounds();
1221    return this.element.value.substring(bounds[0], bounds[1]).strip();
1222  },
1223
1224  getTokenBounds: function() {
1225    if (null != this.tokenBounds) return this.tokenBounds;
1226    var value = this.element.value;
1227    if (value.strip().empty()) return [-1, 0];
1228    var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
1229    var offset = (diff == this.oldElementValue.length ? 1 : 0);
1230    var prevTokenPos = -1, nextTokenPos = value.length;
1231    var tp;
1232    for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
1233      tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
1234      if (tp > prevTokenPos) prevTokenPos = tp;
1235      tp = value.indexOf(this.options.tokens[index], diff + offset);
1236      if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
1237    }
1238    return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
1239  }
1240});
1241
1242Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
1243  var boundary = Math.min(newS.length, oldS.length);
1244  for (var index = 0; index < boundary; ++index)
1245    if (newS[index] != oldS[index])
1246      return index;
1247  return boundary;
1248};
1249
1250Ajax.Autocompleter = Class.create(Autocompleter.Base, {
1251  initialize: function(element, update, url, options) {
1252    this.baseInitialize(element, update, options);
1253    this.options.asynchronous  = true;
1254    this.options.onComplete    = this.onComplete.bind(this);
1255    this.options.defaultParams = this.options.parameters || null;
1256    this.url                   = url;
1257  },
1258
1259  getUpdatedChoices: function() {
1260    this.startIndicator();
1261
1262    var entry = encodeURIComponent(this.options.paramName) + '=' +
1263      encodeURIComponent(this.getToken());
1264
1265    this.options.parameters = this.options.callback ?
1266      this.options.callback(this.element, entry) : entry;
1267
1268    if(this.options.defaultParams)
1269      this.options.parameters += '&' + this.options.defaultParams;
1270
1271    new Ajax.Request(this.url, this.options);
1272  },
1273
1274  onComplete: function(request) {
1275    this.updateChoices(request.responseText);
1276  }
1277});
1278
1279// The local array autocompleter. Used when you'd prefer to
1280// inject an array of autocompletion options into the page, rather
1281// than sending out Ajax queries, which can be quite slow sometimes.
1282//
1283// The constructor takes four parameters. The first two are, as usual,
1284// the id of the monitored textbox, and id of the autocompletion menu.
1285// The third is the array you want to autocomplete from, and the fourth
1286// is the options block.
1287//
1288// Extra local autocompletion options:
1289// - choices - How many autocompletion choices to offer
1290//
1291// - partialSearch - If false, the autocompleter will match entered
1292//                    text only at the beginning of strings in the
1293//                    autocomplete array. Defaults to true, which will
1294//                    match text at the beginning of any *word* in the
1295//                    strings in the autocomplete array. If you want to
1296//                    search anywhere in the string, additionally set
1297//                    the option fullSearch to true (default: off).
1298//
1299// - fullSsearch - Search anywhere in autocomplete array strings.
1300//
1301// - partialChars - How many characters to enter before triggering
1302//                   a partial match (unlike minChars, which defines
1303//                   how many characters are required to do any match
1304//                   at all). Defaults to 2.
1305//
1306// - ignoreCase - Whether to ignore case when autocompleting.
1307//                 Defaults to true.
1308//
1309// It's possible to pass in a custom function as the 'selector'
1310// option, if you prefer to write your own autocompletion logic.
1311// In that case, the other options above will not apply unless
1312// you support them.
1313
1314Autocompleter.Local = Class.create(Autocompleter.Base, {
1315  initialize: function(element, update, array, options) {
1316    this.baseInitialize(element, update, options);
1317    this.options.array = array;
1318  },
1319
1320  getUpdatedChoices: function() {
1321    this.updateChoices(this.options.selector(this));
1322  },
1323
1324  setOptions: function(options) {
1325    this.options = Object.extend({
1326      choices: 10,
1327      partialSearch: true,
1328      partialChars: 2,
1329      ignoreCase: true,
1330      fullSearch: false,
1331      selector: function(instance) {
1332        var ret       = []; // Beginning matches
1333        var partial   = []; // Inside matches
1334        var entry     = instance.getToken();
1335        var count     = 0;
1336
1337        for (var i = 0; i < instance.options.array.length &&
1338          ret.length < instance.options.choices ; i++) {
1339
1340          var elem = instance.options.array[i];
1341          var foundPos = instance.options.ignoreCase ?
1342            elem.toLowerCase().indexOf(entry.toLowerCase()) :
1343            elem.indexOf(entry);
1344
1345          while (foundPos != -1) {
1346            if (foundPos == 0 && elem.length != entry.length) {
1347              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
1348                elem.substr(entry.length) + "</li>");
1349              break;
1350            } else if (entry.length >= instance.options.partialChars &&
1351              instance.options.partialSearch && foundPos != -1) {
1352              if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
1353                partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
1354                  elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
1355                  foundPos + entry.length) + "</li>");
1356                break;
1357              }
1358            }
1359
1360            foundPos = instance.options.ignoreCase ?
1361              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
1362              elem.indexOf(entry, foundPos + 1);
1363
1364          }
1365        }
1366        if (partial.length)
1367          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
1368        return "<ul>" + ret.join('') + "</ul>";
1369      }
1370    }, options || { });
1371  }
1372});
1373
1374// AJAX in-place editor and collection editor
1375// Full rewrite by Christophe Porteneuve <[email protected]> (April 2007).
1376
1377// Use this if you notice weird scrolling problems on some browsers,
1378// the DOM might be a bit confused when this gets called so do this
1379// waits 1 ms (with setTimeout) until it does the activation
1380Field.scrollFreeActivate = function(field) {
1381  setTimeout(function() {
1382    Field.activate(field);
1383  }, 1);
1384};
1385
1386Ajax.InPlaceEditor = Class.create({
1387  initialize: function(element, url, options) {
1388    this.url = url;
1389    this.element = element = $(element);
1390    this.prepareOptions();
1391    this._controls = { };
1392    arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
1393    Object.extend(this.options, options || { });
1394    if (!this.options.formId && this.element.id) {
1395      this.options.formId = this.element.id + '-inplaceeditor';
1396      if ($(this.options.formId))
1397        this.options.formId = '';
1398    }
1399    if (this.options.externalControl)
1400      this.options.externalControl = $(this.options.externalControl);
1401    if (!this.options.externalControl)
1402      this.options.externalControlOnly = false;
1403    this._originalBackground = this.element.getStyle('background-color') || 'transparent';
1404    this.element.title = this.options.clickToEditText;
1405    this._boundCancelHandler = this.handleFormCancellation.bind(this);
1406    this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
1407    this._boundFailureHandler = this.handleAJAXFailure.bind(this);
1408    this._boundSubmitHandler = this.handleFormSubmission.bind(this);
1409    this._boundWrapperHandler = this.wrapUp.bind(this);
1410    this.registerListeners();
1411  },
1412  checkForEscapeOrReturn: function(e) {
1413    if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
1414    if (Event.KEY_ESC == e.keyCode)
1415      this.handleFormCancellation(e);
1416    else if (Event.KEY_RETURN == e.keyCode)
1417      this.handleFormSubmission(e);
1418  },
1419  createControl: function(mode, handler, extraClasses) {
1420    var control = this.options[mode + 'Control'];
1421    var text = this.options[mode + 'Text'];
1422    if ('button' == control) {
1423      var btn = document.createElement('input');
1424      btn.type = 'submit';
1425      btn.value = text;
1426      btn.className = 'editor_' + mode + '_button';
1427      if ('cancel' == mode)
1428        btn.onclick = this._boundCancelHandler;
1429      this._form.appendChild(btn);
1430      this._controls[mode] = btn;
1431    } else if ('link' == control) {
1432      var link = document.createElement('a');
1433      link.href = '#';
1434      link.appendChild(document.createTextNode(text));
1435      link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
1436      link.className = 'editor_' + mode + '_link';
1437      if (extraClasses)
1438        link.className += ' ' + extraClasses;
1439      this._form.appendChild(link);
1440      this._controls[mode] = link;
1441    }
1442  },
1443  createEditField: function() {
1444    var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
1445    var fld;
1446    if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
1447      fld = document.createElement('input');
1448      fld.type = 'text';
1449      var size = this.options.size || this.options.cols || 0;
1450      if (0 < size) fld.size = size;
1451    } else {
1452      fld = document.createElement('textarea');
1453      fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
1454      fld.cols = this.options.cols || 40;
1455    }
1456    fld.name = this.options.paramName;
1457    fld.value = text; // No HTML breaks conversion anymore
1458    fld.className = 'editor_field';
1459    if (this.options.submitOnBlur)
1460      fld.onblur = this._boundSubmitHandler;
1461    this._controls.editor = fld;
1462    if (this.options.loadTextURL)
1463      this.loadExternalText();
1464    this._form.appendChild(this._controls.editor);
1465  },
1466  createForm: function() {
1467    var ipe = this;
1468    function addText(mode, condition) {
1469      var text = ipe.options['text' + mode + 'Controls'];
1470      if (!text || condition === false) return;
1471      ipe._form.appendChild(document.createTextNode(text));
1472    };
1473    this._form = $(document.createElement('form'));
1474    this._form.id = this.options.formId;
1475    this._form.addClassName(this.options.formClassName);
1476    this._form.onsubmit = this._boundSubmitHandler;
1477    this.createEditField();
1478    if ('textarea' == this._controls.editor.tagName.toLowerCase())
1479      this._form.appendChild(document.createElement('br'));
1480    if (this.options.onFormCustomization)
1481      this.options.onFormCustomization(this, this._form);
1482    addText('Before', this.options.okControl || this.options.cancelControl);
1483    this.createControl('ok', this._boundSubmitHandler);
1484    addText('Between', this.options.okControl && this.options.cancelControl);
1485    this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
1486    addText('After', this.options.okControl || this.options.cancelControl);
1487  },
1488  destroy: function() {
1489    if (this._oldInnerHTML)
1490      this.element.innerHTML = this._oldInnerHTML;
1491    this.leaveEditMode();
1492    this.unregisterListeners();
1493  },
1494  enterEditMode: function(e) {
1495    if (this._saving || this._editing) return;
1496    this._editing = true;
1497    this.triggerCallback('onEnterEditMode');
1498    if (this.options.externalControl)
1499      this.options.externalControl.hide();
1500    this.element.hide();
1501    this.createForm();
1502    this.element.parentNode.insertBefore(this._form, this.element);
1503    if (!this.options.loadTextURL)
1504      this.postProcessEditField();
1505    if (e) Event.stop(e);
1506  },
1507  enterHover: function(e) {
1508    if (this.options.hoverClassName)
1509      this.element.addClassName(this.options.hoverClassName);
1510    if (this._saving) return;
1511    this.triggerCallback('onEnterHover');
1512  },
1513  getText: function() {
1514    return this.element.innerHTML.unescapeHTML();
1515  },
1516  handleAJAXFailure: function(transport) {
1517    this.triggerCallback('onFailure', transport);
1518    if (this._oldInnerHTML) {
1519      this.element.innerHTML = this._oldInnerHTML;
1520      this._oldInnerHTML = null;
1521    }
1522  },
1523  handleFormCancellation: function(e) {
1524    this.wrapUp();
1525    if (e) Event.stop(e);
1526  },
1527  handleFormSubmission: function(e) {
1528    var form = this._form;
1529    var value = $F(this._controls.editor);
1530    this.prepareSubmission();
1531    var params = this.options.callback(form, value) || '';
1532    if (Object.isString(params))
1533      params = params.toQueryParams();
1534    params.editorId = this.element.id;
1535    if (this.options.htmlResponse) {
1536      var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
1537      Object.extend(options, {
1538        parameters: params,
1539        onComplete: this._boundWrapperHandler,
1540        onFailure: this._boundFailureHandler
1541      });
1542      new Ajax.Updater({ success: this.element }, this.url, options);
1543    } else {
1544      var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1545      Object.extend(options, {
1546        parameters: params,
1547        onComplete: this._boundWrapperHandler,
1548        onFailure: this._boundFailureHandler
1549      });
1550      new Ajax.Request(this.url, options);
1551    }
1552    if (e) Event.stop(e);
1553  },
1554  leaveEditMode: function() {
1555    this.element.removeClassName(this.options.savingClassName);
1556    this.removeForm();
1557    this.leaveHover();
1558    this.element.style.backgroundColor = this._originalBackground;
1559    this.element.show();
1560    if (this.options.externalControl)
1561      this.options.externalControl.show();
1562    this._saving = false;
1563    this._editing = false;
1564    this._oldInnerHTML = null;
1565    this.triggerCallback('onLeaveEditMode');
1566  },
1567  leaveHover: function(e) {
1568    if (this.options.hoverClassName)
1569      this.element.removeClassName(this.options.hoverClassName);
1570    if (this._saving) return;
1571    this.triggerCallback('onLeaveHover');
1572  },
1573  loadExternalText: function() {
1574    this._form.addClassName(this.options.loadingClassName);
1575    this._controls.editor.disabled = true;
1576    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1577    Object.extend(options, {
1578      parameters: 'editorId=' + encodeURIComponent(this.element.id),
1579      onComplete: Prototype.emptyFunction,
1580      onSuccess: function(transport) {
1581        this._form.removeClassName(this.options.loadingClassName);
1582        var text = transport.responseText;
1583        if (this.options.stripLoadedTextTags)
1584          text = text.stripTags();
1585        this._controls.editor.value = text;
1586        this._controls.editor.disabled = false;
1587        this.postProcessEditField();
1588      }.bind(this),
1589      onFailure: this._boundFailureHandler
1590    });
1591    new Ajax.Request(this.options.loadTextURL, options);
1592  },
1593  postProcessEditField: function() {
1594    var fpc = this.options.fieldPostCreation;
1595    if (fpc)
1596      $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
1597  },
1598  prepareOptions: function() {
1599    this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
1600    Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
1601    [this._extraDefaultOptions].flatten().compact().each(function(defs) {
1602      Object.extend(this.options, defs);
1603    }.bind(this));
1604  },
1605  prepareSubmission: function() {
1606    this._saving = true;
1607    this.removeForm();
1608    this.leaveHover();
1609    this.showSaving();
1610  },
1611  registerListeners: function() {
1612    this._listeners = { };
1613    var listener;
1614    $H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
1615      listener = this[pair.value].bind(this);
1616      this._listeners[pair.key] = listener;
1617      if (!this.options.externalControlOnly)
1618        this.element.observe(pair.key, listener);
1619      if (this.options.externalControl)
1620        this.options.externalControl.observe(pair.key, listener);
1621    }.bind(this));
1622  },
1623  removeForm: function() {
1624    if (!this._form) return;
1625    this._form.remove();
1626    this._form = null;
1627    this._controls = { };
1628  },
1629  showSaving: function() {
1630    this._oldInnerHTML = this.element.innerHTML;
1631    this.element.innerHTML = this.options.savingText;
1632    this.element.addClassName(this.options.savingClassName);
1633    this.element.style.backgroundColor = this._originalBackgroun
1633d;
1634    this.element.show();
1635  },
1636  triggerCallback: function(cbName, arg) {
1637    if ('function' == typeof this.options[cbName]) {
1638      this.options[cbName](this, arg);
1639    }
1640  },
1641  unregisterListeners: function() {
1642    $H(this._listeners).each(function(pair) {
1643      if (!this.options.externalControlOnly)
1644        this.element.stopObserving(pair.key, pair.value);
1645      if (this.options.externalControl)
1646        this.options.externalControl.stopObserving(pair.key, pair.value);
1647    }.bind(this));
1648  },
1649  wrapUp: function(transport) {
1650    this.leaveEditMode();
1651    // Can't use triggerCallback due to backward compatibility: requires
1652    // binding + direct element
1653    this._boundComplete(transport, this.element);
1654  }
1655});
1656
1657Object.extend(Ajax.InPlaceEditor.prototype, {
1658  dispose: Ajax.InPlaceEditor.prototype.destroy
1659});
1660
1661Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
1662  initialize: function($super, element, url, options) {
1663    this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
1664    $super(element, url, options);
1665  },
1666
1667  createEditField: function() {
1668    var list = document.createElement('select');
1669    list.name = this.options.paramName;
1670    list.size = 1;
1671    this._controls.editor = list;
1672    this._collection = this.options.collection || [];
1673    if (this.options.loadCollectionURL)
1674      this.loadCollection();
1675    else
1676      this.checkForExternalText();
1677    this._form.appendChild(this._controls.editor);
1678  },
1679
1680  loadCollection: function() {
1681    this._form.addClassName(this.options.loadingClassName);
1682    this.showLoadingText(this.options.loadingCollectionText);
1683    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1684    Object.extend(options, {
1685      parameters: 'editorId=' + encodeURIComponent(this.element.id),
1686      onComplete: Prototype.emptyFunction,
1687      onSuccess: function(transport) {
1688        var js = transport.responseText.strip();
1689        if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
1690          throw('Server returned an invalid collection representation.');
1691        this._collection = eval(js);
1692        this.checkForExternalText();
1693      }.bind(this),
1694      onFailure: this.onFailure
1695    });
1696    new Ajax.Request(this.options.loadCollectionURL, options);
1697  },
1698
1699  showLoadingText: function(text) {
1700    this._controls.editor.disabled = true;
1701    var tempOption = this._controls.editor.firstChild;
1702    if (!tempOption) {
1703      tempOption = document.createElement('option');
1704      tempOption.value = '';
1705      this._controls.editor.appendChild(tempOption);
1706      tempOption.selected = true;
1707    }
1708    tempOption.update((text || '').stripScripts().stripTags());
1709  },
1710
1711  checkForExternalText: function() {
1712    this._text = this.getText();
1713    if (this.options.loadTextURL)
1714      this.loadExternalText();
1715    else
1716      this.buildOptionList();
1717  },
1718
1719  loadExternalText: function() {
1720    this.showLoadingText(this.options.loadingText);
1721    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1722    Object.extend(options, {
1723      parameters: 'editorId=' + encodeURIComponent(this.element.id),
1724      onComplete: Prototype.emptyFunction,
1725      onSuccess: function(transport) {
1726        this._text = transport.responseText.strip();
1727        this.buildOptionList();
1728      }.bind(this),
1729      onFailure: this.onFailure
1730    });
1731    new Ajax.Request(this.options.loadTextURL, options);
1732  },
1733
1734  buildOptionList: function() {
1735    this._form.removeClassName(this.options.loadingClassName);
1736    this._collection = this._collection.map(function(entry) {
1737      return 2 === entry.length ? entry : [entry, entry].flatten();
1738    });
1739    var marker = ('value' in this.options) ? this.options.value : this._text;
1740    var textFound = this._collection.any(function(entry) {
1741      return entry[0] == marker;
1742    }.bind(this));
1743    this._controls.editor.update('');
1744    var option;
1745    this._collection.each(function(entry, index) {
1746      option = document.createElement('option');
1747      option.value = entry[0];
1748      option.selected = textFound ? entry[0] == marker : 0 == index;
1749      option.appendChild(document.createTextNode(entry[1]));
1750      this._controls.editor.appendChild(option);
1751    }.bind(this));
1752    this._controls.editor.disabled = false;
1753    Field.scrollFreeActivate(this._controls.editor);
1754  }
1755});
1756
1757//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
1758//**** This only  exists for a while,  in order to  let ****
1759//**** users adapt to  the new API.  Read up on the new ****
1760//**** API and convert your code to it ASAP!            ****
1761
1762Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
1763  if (!options) return;
1764  function fallback(name, expr) {
1765    if (name in options || expr === undefined) return;
1766    options[name] = expr;
1767  };
1768  fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
1769    options.cancelLink == options.cancelButton == false ? false : undefined)));
1770  fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
1771    options.okLink == options.okButton == false ? false : undefined)));
1772  fallback('highlightColor', options.highlightcolor);
1773  fallback('highlightEndColor', options.highlightendcolor);
1774};
1775
1776Object.extend(Ajax.InPlaceEditor, {
1777  DefaultOptions: {
1778    ajaxOptions: { },
1779    autoRows: 3,                                // Use when multi-line w/ rows == 1
1780    cancelControl: 'link',                      // 'link'|'button'|false
1781    cancelText: 'cancel',
1782    clickToEditText: 'Click to edit',
1783    externalControl: null,                      // id|elt
1784    externalControlOnly: false,
1785    fieldPostCreation: 'activate',              // 'activate'|'focus'|false
1786    formClassName: 'inplaceeditor-form',
1787    formId: null,                               // id|elt
1788    highlightColor: '#ffff99',
1789    highlightEndColor: '#ffffff',
1790    hoverClassName: '',
1791    htmlResponse: true,
1792    loadingClassName: 'inplaceeditor-loading',
1793    loadingText: 'Loading...',
1794    okControl: 'button',                        // 'link'|'button'|false
1795    okText: 'ok',
1796    paramName: 'value',
1797    rows: 1,                                    // If 1 and multi-line, uses autoRows
1798    savingClassName: 'inplaceeditor-saving',
1799    savingText: 'Saving...',
1800    size: 0,
1801    stripLoadedTextTags: false,
1802    submitOnBlur: false,
1803    textAfterControls: '',
1804    textBeforeControls: '',
1805    textBetweenControls: ''
1806  },
1807  DefaultCallbacks: {
1808    callback: function(form) {
1809      return Form.serialize(form);
1810    },
1811    onComplete: function(transport, element) {
1812      // For backward compatibility, this one is bound to the IPE, and passes
1813      // the element directly.  It was too often customized, so we don't break it.
1814      new Effect.Highlight(element, {
1815        startcolor: this.options.highlightColor, keepBackgroundImage: true });
1816    },
1817    onEnterEditMode: null,
1818    onEnterHover: function(ipe) {
1819      ipe.element.style.backgroundColor = ipe.options.highlightColor;
1820      if (ipe._effect)
1821        ipe._effect.cancel();
1822    },
1823    onFailure: function(transport, ipe) {
1824      alert('Error communication with the server: ' + transport.responseText.stripTags());
1825    },
1826    onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
1827    onLeaveEditMode: null,
1828    onLeaveHover: function(ipe) {
1829      ipe._effect = new Effect.Highlight(ipe.element, {
1830        startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
1831        restorecolor: ipe._originalBackground, keepBackgroundImage: true
1832      });
1833    }
1834  },
1835  Listeners: {
1836    click: 'enterEditMode',
1837    keydown: 'checkForEscapeOrReturn',
1838    mouseover: 'enterHover',
1839    mouseout: 'leaveHover'
1840  }
1841});
1842
1843Ajax.InPlaceCollectionEditor.DefaultOptions = {
1844  loadingCollectionText: 'Loading options...'
1845};
1846
1847// Delayed observer, like Form.Element.Observer,
1848// but waits for delay after last key input
1849// Ideal for live-search fields
1850
1851Form.Element.DelayedObserver = Class.create({
1852  initialize: function(element, delay, callback) {
1853    this.delay     = delay || 0.5;
1854    this.element   = $(element);
1855    this.callback  = callback;
1856    this.timer     = null;
1857    this.lastValue = $F(this.element);
1858    Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
1859  },
1860  delayedListener: function(event) {
1861    if(this.lastValue == $F(this.element)) return;
1862    if(this.timer) clearTimeout(this.timer);
1863    this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
1864    this.lastValue = $F(this.element);
1865  },
1866  onTimerEvent: function() {
1867    this.timer = null;
1868    this.callback(this.element, $F(this.element));
1869  }
1870});
1871// script.aculo.us slider.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
1872
1873// Copyright (c) 2005-2010 Marty Haught, Thomas Fuchs
1874//
1875// script.aculo.us is freely distributable under the terms of an MIT-style license.
1876// For details, see the script.aculo.us web site: http://script.aculo.us/
1877
1878if (!Control) var Control = { };
1879
1880// options:
1881//  axis: 'vertical', or 'horizontal' (default)
1882//
1883// callbacks:
1884//  onChange(value)
1885//  onSlide(value)
1886Control.Slider = Class.create({
1887  initialize: function(handle, track, options) {
1888    var slider = this;
1889
1890    if (Object.isArray(handle)) {
1891      this.handles = handle.collect( function(e) { return $(e) });
1892    } else {
1893      this.handles = [$(handle)];
1894    }
1895
1896    this.track   = $(track);
1897    this.options = options || { };
1898
1899    this.axis      = this.options.axis || 'horizontal';
1900    this.increment = this.options.increment || 1;
1901    this.step      = parseInt(this.options.step || '1');
1902    this.range     = this.options.range || $R(0,1);
1903
1904    this.value     = 0; // assure backwards compat
1905    this.values    = this.handles.map( function() { return 0 });
1906    this.spans     = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
1907    this.options.startSpan = $(this.options.startSpan || null);
1908    this.options.endSpan   = $(this.options.endSpan || null);
1909
1910    this.restricted = this.options.restricted || false;
1911
1912    this.maximum   = this.options.maximum || this.range.end;
1913    this.minimum   = this.options.minimum || this.range.start;
1914
1915    // Will be used to align the handle onto the track, if necessary
1916    this.alignX = parseInt(this.options.alignX || '0');
1917    this.alignY = parseInt(this.options.alignY || '0');
1918
1919    this.trackLength = this.maximumOffset() - this.minimumOffset();
1920
1921    this.handleLength = this.isVertical() ?
1922      (this.handles[0].offsetHeight != 0 ?
1923        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
1924      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
1925        this.handles[0].style.width.replace(/px$/,""));
1926
1927    this.active   = false;
1928    this.dragging = false;
1929    this.disabled = false;
1930
1931    if (this.options.disabled) this.setDisabled();
1932
1933    // Allowed values array
1934    this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
1935    if (this.allowedValues) {
1936      this.minimum = this.allowedValues.min();
1937      this.maximum = this.allowedValues.max();
1938    }
1939
1940    this.eventMouseDown = this.startDrag.bindAsEventListener(this);
1941    this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
1942    this.eventMouseMove = this.update.bindAsEventListener(this);
1943
1944    // Initialize handles in reverse (make sure first handle is active)
1945    this.handles.each( function(h,i) {
1946      i = slider.handles.length-1-i;
1947      slider.setValue(parseFloat(
1948        (Object.isArray(slider.options.sliderValue) ?
1949          slider.options.sliderValue[i] : slider.options.sliderValue) ||
1950         slider.range.start), i);
1951      h.makePositioned().observe("mousedown", slider.eventMouseDown);
1952    });
1953
1954    this.track.observe("mousedown", this.eventMouseDown);
1955    document.observe("mouseup", this.eventMouseUp);
1956    document.observe("mousemove", this.eventMouseMove);
1957
1958    this.initialized = true;
1959  },
1960  dispose: function() {
1961    var slider = this;
1962    Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
1963    Event.stopObserving(document, "mouseup", this.eventMouseUp);
1964    Event.stopObserving(document, "mousemove", this.eventMouseMove);
1965    this.handles.each( function(h) {
1966      Event.stopObserving(h, "mousedown", slider.eventMouseDown);
1967    });
1968  },
1969  setDisabled: function(){
1970    this.disabled = true;
1971  },
1972  setEnabled: function(){
1973    this.disabled = false;
1974  },
1975  getNearestValue: function(value){
1976    if (this.allowedValues){
1977      if (value >= this.allowedValues.max()) return(this.allowedValues.max());
1978      if (value <= this.allowedValues.min()) return(this.allowedValues.min());
1979
1980      var offset = Math.abs(this.allowedValues[0] - value);
1981      var newValue = this.allowedValues[0];
1982      this.allowedValues.each( function(v) {
1983        var currentOffset = Math.abs(v - value);
1984        if (currentOffset <= offset){
1985          newValue = v;
1986          offset = currentOffset;
1987        }
1988      });
1989      return newValue;
1990    }
1991    if (value > this.range.end) return this.range.end;
1992    if (value < this.range.start) return this.range.start;
1993    return value;
1994  },
1995  setValue: function(sliderValue, handleIdx){
1996    if (!this.active) {
1997      this.activeHandleIdx = handleIdx || 0;
1998      this.activeHandle    = this.handles[this.activeHandleIdx];
1999      this.updateStyles();
2000    }
2001    handleIdx = handleIdx || this.activeHandleIdx || 0;
2002    if (this.initialized && this.restricted) {
2003      if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
2004        sliderValue = this.values[handleIdx-1];
2005      if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
2006        sliderValue = this.values[handleIdx+1];
2007    }
2008    sliderValue = this.getNearestValue(sliderValue);
2009    this.values[handleIdx] = sliderValue;
2010    this.value = this.values[0]; // assure backwards compat
2011
2012    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
2013      this.translateToPx(sliderValue);
2014
2015    this.drawSpans();
2016    if (!this.dragging || !this.event) this.updateFinished();
2017  },
2018  setValueBy: function(delta, handleIdx) {
2019    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
2020      handleIdx || this.activeHandleIdx || 0);
2021  },
2022  translateToPx: function(value) {
2023    return Math.round(
2024      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
2025      (value - this.range.start)) + "px";
2026  },
2027  translateToValue: function(offset) {
2028    return ((offset/(this.trackLength-this.handleLength) *
2029      (this.range.end-this.range.start)) + this.range.start);
2030  },
2031  getRange: function(range) {
2032    var v = this.values.sortBy(Prototype.K);
2033    range = range || 0;
2034    return $R(v[range],v[range+1]);
2035  },
2036  minimumOffset: function(){
2037    return(this.isVertical() ? this.alignY : this.alignX);
2038  },
2039  maximumOffset: function(){
2040    return(this.isVertical() ?
2041      (this.track.offsetHeight != 0 ? this.track.offsetHeight :
2042        this.track.style.height.replace(/px$/,"")) - this.alignY :
2043      (this.track.offsetWidth != 0 ? this.track.offsetWidth :
2044        this.track.style.width.replace(/px$/,"")) - this.alignX);
2045  },
2046  isVertical:  function(){
2047    return (this.axis == 'vertical');
2048  },
2049  drawSpans: function() {
2050    var slider = this;
2051    if (this.spans)
2052      $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
2053    if (this.options.startSpan)
2054      this.setSpan(this.options.startSpan,
2055        $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
2056    if (this.options.endSpan)
2057      this.setSpan(this.options.endSpan,
2058        $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
2059  },
2060  setSpan: function(span, range) {
2061    if (this.isVertical()) {
2062      span.style.top = this.translateToPx(range.start);
2063      span.style.height = this.translateToPx(range.end - range.start + this.range.start);
2064    } else {
2065      span.style.left = this.translateToPx(range.start);
2066      span.style.width = this.translateToPx(range.end - range.start + this.range.start);
2067    }
2068  },
2069  updateStyles: function() {
2070    this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
2071    Element.addClassName(this.activeHandle, 'selected');
2072  },
2073  startDrag: function(event) {
2074    if (Event.isLeftClick(event)) {
2075      if (!this.disabled){
2076        this.active = true;
2077
2078        var handle = Event.element(event);
2079        var pointer  = [Event.pointerX(event), Event.pointerY(event)];
2080        var track = handle;
2081        if (track==this.track) {
2082          var offsets  = this.track.cumulativeOffset();
2083          this.event = event;
2084          this.setValue(this.translateToValue(
2085           (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
2086          ));
2087          var offsets  = this.activeHandle.cumulativeOffset();
2088          this.offsetX = (pointer[0] - offsets[0]);
2089          this.offsetY = (pointer[1] - offsets[1]);
2090        } else {
2091          // find the handle (prevents issues with Safari)
2092          while((this.handles.indexOf(handle) == -1) && handle.parentNode)
2093            handle = handle.parentNode;
2094
2095          if (this.handles.indexOf(handle)!=-1) {
2096            this.activeHandle    = handle;
2097            this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
2098            this.updateStyles();
2099
2100            var offsets  = this.activeHandle.cumulativeOffset();
2101            this.offsetX = (pointer[0] - offsets[0]);
2102            this.offsetY = (pointer[1] - offsets[1]);
2103          }
2104        }
2105      }
2106      Event.stop(event);
2107    }
2108  },
2109  update: function(event) {
2110   if (this.active) {
2111      if (!this.dragging) this.dragging = true;
2112      this.draw(event);
2113      if (Prototype.Browser.WebKit) window.scrollBy(0,0);
2114      Event.stop(event);
2115   }
2116  },
2117  draw: function(event) {
2118    var pointer = [Event.pointerX(event), Event.pointerY(event)];
2119    var offsets = this.track.cumulativeOffset();
2120    pointer[0] -= this.offsetX + offsets[0];
2121    pointer[1] -= this.offsetY + offsets[1];
2122    this.event = event;
2123    this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
2124    if (this.initialized && this.options.onSlide)
2125      this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
2126  },
2127  endDrag: function(event) {
2128    if (this.active && this.dragging) {
2129      this.finishDrag(event, true);
2130      Event.stop(event);
2131    }
2132    this.active = false;
2133    this.dragging = false;
2134  },
2135  finishDrag: function(event, success) {
2136    this.active = false;
2137    this.dragging = false;
2138    this.updateFinished();
2139  },
2140  updateFinished: function() {
2141    if (this.initialized && this.options.onChange)
2142      this.options.onChange(this.values.length>1 ? this.values : this.value, this);
2143    this.event = null;
2144  }
2145});
2146/**
2147 * Magento
2148 *
2149 * NOTICE OF LICENSE
2150 *
2151 * This source file is subject to the Academic Free License (AFL 3.0)
2152 * that is bundled with this package in the file LICENSE_AFL.txt.
2153 * It is also available through the world-wide-web at this URL:
2154 * http://opensource.org/licenses/afl-3.0.php
2155 * If you did not receive a copy of the license and are unable to
2156 * obtain it through the world-wide-web, please send an email
2157 * to [email protected] so we can send you a copy immediately.
2158 *
2159 * DISCLAIMER
2160 *
2161 * Do not edit or add to this file if you wish to upgrade Magento to newer
2162 * versions in the future. If you wish to customize Magento for your
2163 * needs please refer to http://www.magentocommerce.com for more information.
2164 *
2165 * @category    Varien
2166 * @package     js
2167 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
2168 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
2169 */
2170function popWin(url,win,para) {
2171    var win = window.open(url,win,para);
2172    win.focus();
2173}
2174
2175function setLocation(url){
2176    window.location.href = url;
2177}
2178
2179function setPLocation(url, setFocus){
2180    if( setFocus ) {
2181        window.opener.focus();
2182    }
2183    window.opener.location.href = url;
2184}
2185
2186function setLanguageCode(code, fromCode){
2187    //TODO: javascript cookies have different domain and path than php cookies
2188    var href = window.location.href;
2189    var after = '', dash;
2190    if (dash = href.match(/\#(.*)$/)) {
2191        href = href.replace(/\#(.*)$/, '');
2192        after = dash[0];
2193    }
2194
2195    if (href.match(/[?]/)) {
2196        var re = /([?&]store=)[a-z0-9_]*/;
2197        if (href.match(re)) {
2198            href = href.replace(re, '$1'+code);
2199        } else {
2200            href += '&store='+code;
2201        }
2202
2203        var re = /([?&]from_store=)[a-z0-9_]*/;
2204        if (href.match(re)) {
2205            href = href.replace(re, '');
2206        }
2207    } else {
2208        href += '?store='+code;
2209    }
2210    if (typeof(fromCode) != 'undefined') {
2211        href += '&from_store='+fromCode;
2212    }
2213    href += after;
2214
2215    setLocation(href);
2216}
2217
2218/**
2219 * Add classes to specified elements.
2220 * Supported classes are: 'odd', 'even', 'first', 'last'
2221 *
2222 * @param elements - array of elements to be decorated
2223 * [@param decorateParams] - array of classes to be set. If omitted, all available will be used
2224 */
2225function decorateGeneric(elements, decorateParams)
2226{
2227    var allSupportedParams = ['odd', 'even', 'first', 'last'];
2228    var _decorateParams = {};
2229    var total = elements.length;
2230
2231    if (total) {
2232        // determine params called
2233        if (typeof(decorateParams) == 'undefined') {
2234            decorateParams = allSupportedParams;
2235        }
2236        if (!decorateParams.length) {
2237            return;
2238        }
2239        for (var k in allSupportedParams) {
2240            _decorateParams[allSupportedParams[k]] = false;
2241        }
2242        for (var k in decorateParams) {
2243            _decorateParams[decorateParams[k]] = true;
2244        }
2245
2246        // decorate elements
2247        // elements[0].addClassName('first'); // will cause bug in IE (#5587)
2248        if (_decorateParams.first) {
2249            Element.addClassName(elements[0], 'first');
2250        }
2251        if (_decorateParams.last) {
2252            Element.addClassName(elements[total-1], 'last');
2253        }
2254        for (var i = 0; i < total; i++) {
2255            if ((i + 1) % 2 == 0) {
2256                if (_decorateParams.even) {
2257                    Element.addClassName(elements[i], 'even');
2258                }
2259            }
2260            else {
2261                if (_decorateParams.odd) {
2262                    Element.addClassName(elements[i], 'odd');
2263                }
2264            }
2265        }
2266    }
2267}
2268
2269/**
2270 * Decorate table rows and cells, tbody etc
2271 * @see decorateGeneric()
2272 */
2273function decorateTable(table, options) {
2274    var table = $(table);
2275    if (table) {
2276        // set default options
2277        var _options = {
2278            'tbody'    : false,
2279            'tbody tr' : ['odd', 'even', 'first', 'last'],
2280            'thead tr' : ['first', 'last'],
2281            'tfoot tr' : ['first', 'last'],
2282            'tr td'    : ['last']
2283        };
2284        // overload options
2285        if (typeof(options) != 'undefined') {
2286            for (var k in options) {
2287                _options[k] = options[k];
2288            }
2289        }
2290        // decorate
2291        if (_options['tbody']) {
2292            decorateGeneric(table.select('tbody'), _options['tbody']);
2293        }
2294        if (_options['tbody tr']) {
2295            decorateGeneric(table.select('tbody tr'), _options['tbody tr']);
2296        }
2297        if (_options['thead tr']) {
2298            decorateGeneric(table.select('thead tr'), _options['thead tr']);
2299        }
2300        if (_options['tfoot tr']) {
2301            decorateGeneric(table.select('tfoot tr'), _options['tfoot tr']);
2302        }
2303        if (_options['tr td']) {
2304            var allRows = table.select('tr');
2305            if (allRows.length) {
2306                for (var i = 0; i < allRows.length; i++) {
2307                    decorateGeneric(allRows[i].getElementsByTagName('TD'), _options['tr td']);
2308                }
2309            }
2310        }
2311    }
2312}
2313
2314/**
2315 * Set "odd", "even" and "last" CSS classes for list items
2316 * @see decorateGeneric()
2317 */
2318function decorateList(list, nonRecursive) {
2319    if ($(list)) {
2320        if (typeof(nonRecursive) == 'undefined') {
2321            var items = $(list).select('li')
2322        }
2323        else {
2324            var items = $(list).childElements();
2325        }
2326        decorateGeneric(items, ['odd', 'even', 'last']);
2327    }
2328}
2329
2330/**
2331 * Set "odd", "even" and "last" CSS classes for list items
2332 * @see decorateGeneric()
2333 */
2334function decorateDataList(list) {
2335    list = $(list);
2336    if (list) {
2337        decorateGeneric(list.select('dt'), ['odd', 'even', 'last']);
2338        decorateGeneric(list.select('dd'), ['odd', 'even', 'last']);
2339    }
2340}
2341
2342/**
2343 * Parse SID and produces the correct URL
2344 */
2345function parseSidUrl(baseUrl, urlExt) {
2346    var sidPos = baseUrl.indexOf('/?SID=');
2347    var sid = '';
2348    urlExt = (urlExt != undefined) ? urlExt : '';
2349
2350    if(sidPos > -1) {
2351        sid = '?' + baseUrl.substring(sidPos + 2);
2352        baseUrl = baseUrl.substring(0, sidPos + 1);
2353    }
2354
2355    return baseUrl+urlExt+sid;
2356}
2357
2358/**
2359 * Formats currency using patern
2360 * format - JSON (pattern, decimal, decimalsDelimeter, groupsDelimeter)
2361 * showPlus - true (always show '+'or '-'),
2362 *      false (never show '-' even if number is negative)
2363 *      null (show '-' if number is negative)
2364 */
2365
2366function formatCurrency(price, format, showPlus){
2367    var precision = isNaN(format.precision = Math.abs(format.precision)) ? 2 : format.precision;
2368    var requiredPrecision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;
2369
2370    //precision = (precision > requiredPrecision) ? precision : requiredPrecision;
2371    //for now we don't need this difference so precision is requiredPrecision
2372    precision = requiredPrecision;
2373
2374    var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired;
2375
2376    var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol;
2377    var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol;
2378    var groupLength = format.groupLength == undefined ? 3 : format.groupLength;
2379
2380    var s = '';
2381
2382    if (showPlus == undefined || showPlus == true) {
2383        s = price < 0 ? "-" : ( showPlus ? "+" : "");
2384    } else if (showPlus == false) {
2385        s = '';
2386    }
2387
2388    var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + "";
2389    var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0;
2390    while (pad) { i = '0' + i; pad--; }
2391    j = (j = i.length) > groupLength ? j % groupLength : 0;
2392    re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g");
2393
2394    /**
2395     * replace(/-/, 0) is only for fixing Safari bug which appears
2396     * when Math.abs(0).toFixed() executed on "0" number.
2397     * Result is "0.-0" :(
2398     */
2399    var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : "")
2400    var pattern = '';
2401    if (format.pattern.indexOf('{sign}') == -1) {
2402        pattern = s + format.pattern;
2403    } else {
2404        pattern = format.pattern.replace('{sign}', s);
2405    }
2406
2407    return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
2408};
2409
2410function expandDetails(el, childClass) {
2411    if (Element.hasClassName(el,'show-details')) {
2412        $$(childClass).each(function(item){item.hide()});
2413        Element.removeClassName(el,'show-details');
2414    }
2415    else {
2416        $$(childClass).each(function(item){item.show()});
2417        Element.addClassName(el,'show-details');
2418    }
2419}
2420
2421// Version 1.0
2422var isIE = navigator.appVersion.match(/MSIE/) == "MSIE";
2423
2424if (!window.Varien)
2425    var Varien = new Object();
2426
2427Varien.showLoading = function(){
2428    var loader = $('loading-process');
2429    loader && loader.show();
2430}
2431Varien.hideLoading = function(){
2432    var loader = $('loading-process');
2433    loader && loader.hide();
2434}
2435Varien.GlobalHandlers = {
2436    onCreate: function() {
2437        Varien.showLoading();
2438    },
2439
2440    onComplete: function() {
2441        if(Ajax.activeRequestCount == 0) {
2442            Varien.hideLoading();
2443        }
2444    }
2445};
2446
2447Ajax.Responders.register(Varien.GlobalHandlers);
2448
2449/**
2450 * Quick Search form client model
2451 */
2452Varien.searchForm = Class.create();
2453Varien.searchForm.prototype = {
2454    initialize : function(form, field, emptyText){
2455        this.form   = $(form);
2456        this.field  = $(field);
2457        this.emptyText = emptyText;
2458
2459        Event.observe(this.form,  'submit', this.submit.bind(this));
2460        Event.observe(this.field, 'focus', this.focus.bind(this));
2461        Event.observe(this.field, 'blur', this.blur.bind(this));
2462        this.blur();
2463    },
2464
2465    submit : function(event){
2466        if (this.field.value == this.emptyText || this.field.value == ''){
2467            Event.stop(event);
2468            return false;
2469        }
2470        return true;
2471    },
2472
2473    focus : function(event){
2474        if(this.field.value==this.emptyText){
2475            this.field.value='';
2476        }
2477
2478    },
2479
2480    blur : function(event){
2481        if(this.field.value==''){
2482            this.field.value=this.emptyText;
2483        }
2484    },
2485
2486    initAutocomplete : function(url, destinationElement){
2487        new Ajax.Autocompleter(
2488            this.field,
2489            destinationElement,
2490            url,
2491            {
2492                paramName: this.field.name,
2493                method: 'get',
2494                minChars: 2,
2495                updateElement: this._selectAutocompleteItem.bind(this),
2496                onShow : function(element, update) {
2497                    if(!update.style.position || update.style.position=='absolute') {
2498                        update.style.position = 'absolute';
2499                        Position.clone(element, update, {
2500                            setHeight: false,
2501                            offsetTop: element.offsetHeight
2502                        });
2503                    }
2504                    Effect.Appear(update,{duration:0});
2505                }
2506
2507            }
2508        );
2509    },
2510
2511    _selectAutocompleteItem : function(element){
2512        if(element.title){
2513            this.field.value = element.title;
2514        }
2515        this.form.submit();
2516    }
2517}
2518
2519Varien.Tabs = Class.create();
2520Varien.Tabs.prototype = {
2521  initialize: function(selector) {
2522    var self=this;
2523    $$(selector+' a').each(this.initTab.bind(this));
2524  },
2525
2526  initTab: function(el) {
2527      el.href = 'javascript:void(0)';
2528      if ($(el.parentNode).hasClassName('active')) {
2529        this.showContent(el);
2530      }
2531      el.observe('click', this.showContent.bind(this, el));
2532  },
2533
2534  showContent: function(a) {
2535    var li = $(a.parentNode), ul = $(li.parentNode);
2536    ul.getElementsBySelector('li', 'ol').each(function(el){
2537      var contents = $(el.id+'_contents');
2538      if (el==li) {
2539        el.addClassName('active');
2540        contents.show();
2541      } else {
2542        el.removeClassName('active');
2543        contents.hide();
2544      }
2545    });
2546  }
2547}
2548
2549Varien.DateElement = Class.create();
2550Varien.DateElement.prototype = {
2551    initialize: function(type, content, required, format) {
2552        if (type == 'id') {
2553            // id prefix
2554            this.day    = $(content + 'day');
2555            this.month  = $(content + 'month');
2556            this.year   = $(content + 'year');
2557            this.full   = $(content + 'full');
2558            this.advice = $(content + 'date-advice');
2559        } else if (type == 'container') {
2560            // content must be container with data
2561            this.day    = content.day;
2562            this.month  = content.month;
2563            this.year   = content.year;
2564            this.full   = content.full;
2565            this.advice = content.advice;
2566        } else {
2567            return;
2568        }
2569
2570        this.required = required;
2571        this.format   = format;
2572
2573        this.day.addClassName('validate-custom');
2574        this.day.validate = this.validate.bind(this);
2575        this.month.addClassName('validate-custom');
2576        this.month.validate = this.validate.bind(this);
2577        this.year.addClassName('validate-custom');
2578        this.year.validate = this.validate.bind(this);
2579
2580        this.setDateRange(false, false);
2581        this.year.setAttribute('autocomplete','off');
2582
2583        this.advice.hide();
2584    },
2585    validate: function() {
2586        var error = false,
2587            day   = parseInt(this.day.value, 10)   || 0,
2588            month = parseInt(this.month.value, 10) || 0,
2589            year  = parseInt(this.year.value, 10)  || 0;
2590        if (this.day.value.strip().empty()
2591            && this.month.value.strip().empty()
2592            && this.year.value.strip().empty()
2593        ) {
2594            if (this.required) {
2595                error = 'This date is a required value.';
2596            } else {
2597                this.full.value = '';
2598            }
2599        } else if (!day || !month || !year) {
2600            error = 'Please enter a valid full date.';
2601        } else {
2602            var date = new Date, countDaysInMonth = 0, errorType = null;
2603            date.setYear(year);date.setMonth(month-1);date.setDate(32);
2604            countDaysInMonth = 32 - date.getDate();
2605            if(!countDaysInMonth || countDaysInMonth>31) countDaysInMonth = 31;
2606
2607            if (day<1 || day>countDaysInMonth) {
2608                errorType = 'day';
2609                error = 'Please enter a valid day (1-%d).';
2610            } else if (month<1 || month>12) {
2611                errorType = 'month';
2612                error = 'Please enter a valid month (1-12).';
2613            } else {
2614                if(day % 10 == day) this.day.value = '0'+day;
2615                if(month % 10 == month) this.month.value = '0'+month;
2616                this.full.value = this.format.replace(/%[mb]/i, this.month.value).replace(/%[de]/i, this.day.value).replace(/%y/i, this.year.value);
2617                var testFull = this.month.value + '/' + this.day.value + '/'+ this.year.value;
2618                var test = new Date(testFull);
2619                if (isNaN(test)) {
2620                    error = 'Please enter a valid date.';
2621                } else {
2622                    this.setFullDate(test);
2623                }
2624            }
2625            var valueError = false;
2626            if (!error && !this.validateData()){//(year<1900 || year>curyear) {
2627                errorType = this.validateDataErrorType;//'year';
2628                valueError = this.validateDataErrorText;//'Please enter a valid year (1900-%d).';
2629                error = valueError;
2630            }
2631        }
2632
2633        if (error !== false) {
2634            try {
2635                error = Translator.translate(error);
2636            }
2637            catch (e) {}
2638            if (!valueError) {
2639                this.advice.innerHTML = error.replace('%d', countDaysInMonth);
2640            } else {
2641                this.advice.innerHTML = this.errorTextModifier(error);
2642            }
2643            this.advice.show();
2644            return false;
2645        }
2646
2647        // fixing elements class
2648        this.day.removeClassName('validation-failed');
2649        this.month.removeClassName('validation-failed');
2650        this.year.removeClassName('validation-failed');
2651
2652        this.advice.hide();
2653        return true;
2654    },
2655    validateData: function() {
2656        var year = this.fullDate.getFullYear();
2657        var date = new Date;
2658        this.curyear = date.getFullYear();
2659        return (year>=1900 && year<=this.curyear);
2660    },
2661    validateDataErrorType: 'year',
2662    validateDataErrorText: 'Please enter a valid year (1900-%d).',
2663    errorTextModifier: function(text) {
2664        return text.replace('%d', this.curyear);
2665    },
2666    setDateRange: function(minDate, maxDate) {
2667        this.minDate = minDate;
2668        this.maxDate = maxDate;
2669    },
2670    setFullDate: function(date) {
2671        this.fullDate = date;
2672    }
2673};
2674
2675Varien.DOB = Class.create();
2676Varien.DOB.prototype = {
2677    initialize: function(selector, required, format) {
2678        var el = $$(selector)[0];
2679        var container       = {};
2680        container.day       = Element.select(el, '.dob-day input')[0];
2681        container.month     = Element.select(el, '.dob-month input')[0];
2682        container.year      = Element.select(el, '.dob-year input')[0];
2683        container.full      = Element.select(el, '.dob-full input')[0];
2684        container.advice    = Element.select(el, '.validation-advice')[0];
2685
2686        new Varien.DateElement('container', container, required, format);
2687    }
2688};
2689
2690Varien.dateRangeDate = Class.create();
2691Varien.dateRangeDate.prototype = Object.extend(new Varien.DateElement(), {
2692    validateData: function() {
2693        var validate = true;
2694        if (this.minDate || this.maxValue) {
2695            if (this.minDate) {
2696                this.minDate = new Date(this.minDate);
2697                this.minDate.setHours(0);
2698                if (isNaN(this.minDate)) {
2699                    this.minDate = new Date('1/1/1900');
2700                }
2701                validate = validate && (this.fullDate >= this.minDate)
2702            }
2703            if (this.maxDate) {
2704                this.maxDate = new Date(this.maxDate)
2705                this.minDate.setHours(0);
2706                if (isNaN(this.maxDate)) {
2707                    this.maxDate = new Date();
2708                }
2709                validate = validate && (this.fullDate <= this.maxDate)
2710            }
2711            if (this.maxDate && this.minDate) {
2712                this.validateDataErrorText = 'Please enter a valid date between %s and %s';
2713            } else if (this.maxDate) {
2714                this.validateDataErrorText = 'Please enter a valid date less than or equal to %s';
2715            } else if (this.minDate) {
2716                this.validateDataErrorText = 'Please enter a valid date equal to or greater than %s';
2717            } else {
2718                this.validateDataErrorText = '';
2719            }
2720        }
2721        return validate;
2722    },
2723    validateDataErrorText: 'Date should be between %s and %s',
2724    errorTextModifier: function(text) {
2725        if (this.minDate) {
2726            text = text.sub('%s', this.dateFormat(this.minDate));
2727        }
2728        if (this.maxDate) {
2729            text = text.sub('%s', this.dateFormat(this.maxDate));
2730        }
2731        return text;
2732    },
2733    dateFormat: function(date) {
2734        return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
2735    }
2736});
2737
2738Varien.FileElement = Class.create();
2739Varien.FileElement.prototype = {
2740    initialize: function (id) {
2741        this.fileElement = $(id);
2742        this.hiddenElement = $(id + '_value');
2743
2744        this.fileElement.observe('change', this.selectFile.bind(this));
2745    },
2746    selectFile: function(event) {
2747        this.hiddenElement.value = this.fileElement.getValue();
2748    }
2749};
2750
2751Validation.addAllThese([
2752    ['validate-custom', ' ', function(v,elm) {
2753        return elm.validate();
2754    }]
2755]);
2756
2757function truncateOptions() {
2758    $$('.truncated').each(function(element){
2759        Event.observe(element, 'mouseover', function(){
2760            if (element.down('div.truncated_full_value')) {
2761                element.down('div.truncated_full_value').addClassName('show')
2762            }
2763        });
2764        Event.observe(element, 'mouseout', function(){
2765            if (element.down('div.truncated_full_value')) {
2766                element.down('div.truncated_full_value').removeClassName('show')
2767            }
2768        });
2769
2770    });
2771}
2772Event.observe(window, 'load', function(){
2773   truncateOptions();
2774});
2775
2776Element.addMethods({
2777    getInnerText: function(element)
2778    {
2779        element = $(element);
2780        if(element.innerText && !Prototype.Browser.Opera) {
2781            return element.innerText
2782        }
2783        return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ').strip();
2784    }
2785});
2786
2787/*
2788if (!("console" in window) || !("firebug" in console))
2789{
2790    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
2791    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
2792
2793    window.console = {};
2794    for (var i = 0; i < names.length; ++i)
2795        window.console[names[i]] = function() {}
2796}
2797*/
2798
2799/**
2800 * Executes event handler on the element. Works with event handlers attached by Prototype,
2801 * in a browser-agnostic fashion.
2802 * @param element The element object
2803 * @param event Event name, like 'change'
2804 *
2805 * @example fireEvent($('my-input', 'click'));
2806 */
2807function fireEvent(element, event) {
2808    if (document.createEvent) {
2809        // dispatch for all browsers except IE before version 9
2810        var evt = document.createEvent("HTMLEvents");
2811        evt.initEvent(event, true, true ); // event type, bubbling, cancelable
2812        return element.dispatchEvent(evt);
2813    } else {
2814        // dispatch for IE before version 9
2815        var evt = document.createEventObject();
2816        return element.fireEvent('on' + event, evt)
2817    }
2818}
2819
2820/**
2821 * Returns more accurate results of floating-point modulo division
2822 * E.g.:
2823 * 0.6 % 0.2 = 0.19999999999999996
2824 * modulo(0.6, 0.2) = 0
2825 *
2826 * @param dividend
2827 * @param divisor
2828 */
2829function modulo(dividend, divisor)
2830{
2831    var epsilon = divisor / 10000;
2832    var remainder = dividend % divisor;
2833
2834    if (Math.abs(remainder - divisor) < epsilon || Math.abs(remainder) < epsilon) {
2835        remainder = 0;
2836    }
2837
2838    return remainder;
2839}
2840
2841/**
2842 * createContextualFragment is not supported in IE9. Adding its support.
2843 */
2844if ((typeof Range != "undefined") && !Range.prototype.createContextualFragment)
2845{
2846    Range.prototype.createContextualFragment = function(html)
2847    {
2848        var frag = document.createDocumentFragment(),
2849        div = document.createElement("div");
2850        frag.appendChild(div);
2851        div.outerHTML = html;
2852        return frag;
2853    };
2854}
2855
2856/**
2857 * Magento
2858 *
2859 * NOTICE OF LICENSE
2860 *
2861 * This source file is subject to the Academic Free License (AFL 3.0)
2862 * that is bundled with this package in the file LICENSE_AFL.txt.
2863 * It is also available through the world-wide-web at this URL:
2864 * http://opensource.org/licenses/afl-3.0.php
2865 * If you did not receive a copy of the license and are unable to
2866 * obtain it through the world-wide-web, please send an email
2867 * to [email protected] so we can send you a copy immediately.
2868 *
2869 * DISCLAIMER
2870 *
2871 * Do not edit or add to this file if you wish to upgrade Magento to newer
2872 * versions in the future. If you wish to customize Magento for your
2873 * needs please refer to http://www.magentocommerce.com for more information.
2874 *
2875 * @category    Varien
2876 * @package     js
2877 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
2878 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
2879 */ (VarienForm=Class.create()).prototype={initialize:function(e,i){if(this.form=$(e),this.form&&(this.cache=$A(),this.currLoader=!1,this.currDataIndex=!1,this.validator=new Validation(this.form),this.elementFocus=this.elementOnFocus.bindAsEventListener(this),this.elementBlur=this.elementOnBlur.bindAsEventListener(this),this.childLoader=this.onChangeChildLoad.bindAsEventListener(this),this.highlightClass="highlight",this.extraChildParams="",this.firstFieldFocus=i||!1,this.bindElements(),this.firstFieldFocus))try{Form.Element.focus(Form.findFirstElement(this.form))}catch(t){}},submit:function(e){return this.validator&&this.validator.validate()&&this.form.submit(),!1},bindElements:function(){var e=Form.getElements(this.form);for(var i in e)e[i].id&&(Event.observe(e[i],"focus",this.elementFocus),Event.observe(e[i],"blur",this.elementBlur))},elementOnFocus:function(e){var i=Event.findElement(e,"fieldset");i&&Element.addClassName(i,this.highlightClass)},elementOnBlur:function(e){var i=Event.findElement(e,"fieldset");i&&Element.removeClassName(i,this.highlightClass)},setElementsRelation:function(e,i,t,s){(e=$(e))&&(this.cache[e.id]||(this.cache[e.id]=$A(),this.cache[e.id].child=i,this.cache[e.id].dataUrl=t,this.cache[e.id].data=$A(),this.cache[e.id].first=s||!1),Event.observe(e,"change",this.childLoader))},onChangeChildLoad:function(e){element=Event.element(e),this.elementChildLoad(element)},elementChildLoad:function(e,i){this.callback=i||!1,e.value&&(this.currLoader=e.id,this.currDataIndex=e.value,this.cache[e.id].data[e.value]?this.setDataToChild(this.cache[e.id].data[e.value]):new Ajax.Request(this.cache[this.currLoader].dataUrl,{method:"post",parameters:{parent:e.value},onComplete:this.reloadChildren.bind(this)}))},reloadChildren:function(transport){var data=eval("("+transport.responseText+")");this.cache[this.currLoader].data[this.currDataIndex]=data,this.setDataToChild(data)},setDataToChild:function(e){if(e.length){var i=$(this.cache[this.currLoader].child);if(i){var t='<select name="'+i.name+'" id="'+i.id+'" class="'+i.className+'" title="'+i.title+'" '+this.extraChildParams+">";for(var s in this.cache[this.currLoader].first&&(t+='<option value="">'+this.cache[this.currLoader].first+"</option>"),e)e[s].value&&(t+='<option value="'+e[s].value+'"',i.value&&(i.value==e[s].value||i.value==e[s].label)&&(t+=" selected"),t+=">"+e[s].label+"</option>");t+="</select>",Element.insert(i,{before:t}),Element.remove(i)}}else{var i=$(this.cache[this.currLoader].child);if(i){var t='<input type="text" name="'+i.name+'" id="'+i.id+'" class="'+i.className+'" title="'+i.title+'" '+this.extraChildParams+">";Element.insert(i,{before:t}),Element.remove(i)}}this.bindElements(),this.callback&&this.callback()}},(RegionUpdater=Class.create()).prototype={initialize:function(e,i,t,s,a,l){this.countryEl=$(e),this.regionTextEl=$(i),this.regionSelectEl=$(t),this.zipEl=$(l),this.config=s.config,delete s.config,this.regions=s,this.disableAction=void 0===a?"hide":a,this.zipOptions="undefined"!=typeof zipOptions&&zipOptions,this.regionSelectEl.options.length<=1&&this.update(),Event.observe(this.countryEl,"change",this.update.bind(this))}
2879,_checkRegionRequired:function(){var e,i,t=[this.regionTextEl,this.regionSelectEl],s=this;if(void 0!==this.config){var a=this.config.regions_required.indexOf(this.countryEl.value)>=0;t.each(function(t){Validation.reset(t),(e=$$('label[for="'+t.id+'"]')[0])&&(i=e.down("em")||e.down("span.required"),s.config.show_all_regions||(a?e.up().show():e.up().hide())),e&&i&&(a?a&&(i.show(),e.hasClassName("required")||e.addClassName("required")):(i.hide(),e.hasClassName("required")&&e.removeClassName("required"))),a?(t.hasClassName("required-entry")||t.addClassName("required-entry"),"select"!=t.tagName.toLowerCase()||t.hasClassName("validate-select")||t.addClassName("validate-select")):(t.hasClassName("required-entry")&&t.removeClassName("required-entry"),"select"==t.tagName.toLowerCase()&&t.hasClassName("validate-select")&&t.removeClassName("validate-select"))})}},update:function(){var e,i,t;if(this.regions[this.countryEl.value]){for(regionId in t=this.regionSelectEl.getAttribute("defaultValue"),this.regionTextEl&&(t||(t=this.regionTextEl.value.toLowerCase()),this.regionTextEl.value=""),this.regionSelectEl.options.length=1,this.regions[this.countryEl.value])i=this.regions[this.countryEl.value][regionId],(e=document.createElement("OPTION")).value=regionId,e.text=i.name.stripTags(),e.title=i.name,this.regionSelectEl.options.add?this.regionSelectEl.options.add(e):this.regionSelectEl.appendChild(e),(regionId==t||i.name&&i.name.toLowerCase()==t||i.name&&i.code.toLowerCase()==t)&&(this.regionSelectEl.value=regionId);"hide"==this.disableAction?(this.regionTextEl&&(this.regionTextEl.style.display="none"),this.regionSelectEl.style.display=""):"disable"==this.disableAction&&(this.regionTextEl&&(this.regionTextEl.disabled=!0),this.regionSelectEl.disabled=!1),this.setMarkDisplay(this.regionSelectEl,!0)}else this.regionSelectEl.options.length=1,"hide"==this.disableAction?(this.regionTextEl&&(this.regionTextEl.style.display=""),this.regionSelectEl.style.display="none",Validation.reset(this.regionSelectEl)):"disable"==this.disableAction?(this.regionTextEl&&(this.regionTextEl.disabled=!1),this.regionSelectEl.disabled=!0):"nullify"==this.disableAction&&(this.regionSelectEl.options.length=1,this.regionSelectEl.value="",this.regionSelectEl.selectedIndex=0,this.lastCountryId=""),this.setMarkDisplay(this.regionSelectEl,!1);this._checkRegionRequired(),new ZipUpdater(this.countryEl.value,this.zipEl).update()},setMarkDisplay:function(e,i){var t=(e=$(e)).up(0).down("label > span.required")||e.up(1).down("label > span.required")||e.up(0).down("label.required > em")||e.up(1).down("label.required > em");t&&(inputElement=t.up().next("input"),i?(t.show(),inputElement&&inputElement.addClassName("required-entry")):(t.hide(),inputElement&&inputElement.removeClassName("required-entry")))}},(ZipUpdater=Class.create()).prototype={initialize:function(e,i){this.country=e,this.zipElement=$(i)},update:function(){if("undefined"==typeof optionalZipCountries)return!1;void 0!=this.zipElement?(Validation.reset(this.zipElement),this._setPostcodeOptional()):Event.observe(window,"load",this._setPostcodeOptional.bind(this))},_setPostcodeOptional:function(){if(this.zipElement=$(this.zipElement),void 0==this.zipElement)return!1;var e=$$('label[for="'+this.zipElement.id+'"]')[0];if(void 0!=e)var i=e.down("em")||e.down("span.required");if(-1!=optionalZipCountries.indexOf(this.country)){for(;this.zipElement.hasClassName("required-entry");)this.zipElement.removeClassName("required-entry");void 0!=i&&i.hide()}else this.zipElement.addClassName("required-entry"),void 0!=i&&i.show()}};
2880/**
2881 * Magento
2882 *
2883 * NOTICE OF LICENSE
2884 *
2885 * This source file is subject to the Academic Free License (AFL 3.0)
2886 * that is bundled with this package in the file LICENSE_AFL.txt.
2887 * It is also available through the world-wide-web at this URL:
2888 * http://opensource.org/licenses/afl-3.0.php
2889 * If you did not receive a copy of the license and are unable to
2890 * obtain it through the world-wide-web, please send an email
2891 * to [email protected] so we can send you a copy immediately.
2892 *
2893 * DISCLAIMER
2894 *
2895 * Do not edit or add to this file if you wish to upgrade Magento to newer
2896 * versions in the future. If you wish to customize Magento for your
2897 * needs please refer to http://www.magentocommerce.com for more information.
2898 *
2899 * @category    Varien
2900 * @package     js
2901 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
2902 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
2903 */
2904
2905/**
2906 * @classDescription simple Navigation with replacing old handlers
2907 * @param {String} id id of ul element with navigation lists
2908 * @param {Object} settings object with settings
2909 */
2910var mainNav = function() {
2911
2912    var main = {
2913        obj_nav :   $(arguments[0]) || $("nav"),
2914
2915        settings :  {
2916            show_delay      :   0,
2917            hide_delay      :   0,
2918            _ie6            :   /MSIE 6.+Win/.test(navigator.userAgent),
2919            _ie7            :   /MSIE 7.+Win/.test(navigator.userAgent)
2920        },
2921
2922        init :  function(obj, level) {
2923            obj.lists = obj.childElements();
2924            obj.lists.each(function(el,ind){
2925                main.handlNavElement(el);
2926                if((main.settings._ie6 || main.settings._ie7) && level){
2927                    main.ieFixZIndex(el, ind, obj.lists.size());
2928                }
2929            });
2930            if(main.settings._ie6 && !level){
2931                document.execCommand("BackgroundImageCache", false, true);
2932            }
2933        },
2934
2935        handlNavElement :   function(list) {
2936            if(list !== undefined){
2937                list.onmouseover = function(){
2938                    main.fireNavEvent(this,true);
2939                };
2940                list.onmouseout = function(){
2941                    main.fireNavEvent(this,false);
2942                };
2943                if(list.down("ul")){
2944                    main.init(list.down("ul"), true);
2945                }
2946            }
2947        },
2948
2949        ieFixZIndex : function(el, i, l) {
2950            if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){
2951                el.style.zIndex = l - i;
2952            } else {
2953                el.onmouseover = "null";
2954                el.onmouseout = "null";
2955            }
2956        },
2957
2958        fireNavEvent :  function(elm,ev) {
2959            if(ev){
2960                elm.addClassName("over");
2961                elm.down("a").addClassName("over");
2962                if (elm.childElements()[1]) {
2963                    main.show(elm.childElements()[1]);
2964                }
2965            } else {
2966                elm.removeClassName("over");
2967                elm.down("a").removeClassName("over");
2968                if (elm.childElements()[1]) {
2969                    main.hide(elm.childElements()[1]);
2970                }
2971            }
2972        },
2973
2974        show : function (sub_elm) {
2975            if (sub_elm.hide_time_id) {
2976                clearTimeout(sub_elm.hide_time_id);
2977            }
2978            sub_elm.show_time_id = setTimeout(function() {
2979                if (!sub_elm.hasClassName("shown-sub")) {
2980                    sub_elm.addClassName("shown-sub");
2981                }
2982            }, main.settings.show_delay);
2983        },
2984
2985        hide : function (sub_elm) {
2986            if (sub_elm.show_time_id) {
2987                clearTimeout(sub_elm.show_time_id);
2988            }
2989            sub_elm.hide_time_id = setTimeout(function(){
2990                if (sub_elm.hasClassName("shown-sub")) {
2991                    sub_elm.removeClassName("shown-sub");
2992                }
2993            }, main.settings.hide_delay);
2994        }
2995
2996    };
2997    if (arguments[1]) {
2998        main.settings = Object.extend(main.settings, arguments[1]);
2999    }
3000    if (main.obj_nav) {
3001        main.init(main.obj_nav, false);
3002    }
3003};
3004
3005document.observe("dom:loaded", function() {
3006    //run navigation without delays and with default id="#nav"
3007    //mainNav();
3008
3009    //run navigation with delays
3010    mainNav("nav", {"show_delay":"100","hide_delay":"100"});
3011});
3012
3013/**
3014 * Magento
3015 *
3016 * NOTICE OF LICENSE
3017 *
3018 * This source file is subject to the Academic Free License (AFL 3.0)
3019 * that is bundled with this package in the file LICENSE_AFL.txt.
3020 * It is also available through the world-wide-web at this URL:
3021 * http://opensource.org/licenses/afl-3.0.php
3022 * If you did not receive a copy of the license and are unable to
3023 * obtain it through the world-wide-web, please send an email
3024 * to [email protected] so we can send you a copy immediately.
3025 *
3026 * DISCLAIMER
3027 *
3028 * Do not edit or add to this file if you wish to upgrade Magento to newer
3029 * versions in the future. If you wish to customize Magento for your
3030 * needs please refer to http://www.magentocommerce.com for more information.
3031 *
3032 * @category    Mage
3033 * @package     js
3034 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
3035 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
3036 */
3037
3038var Translate = Class.create();
3039Translate.prototype = {
3040    initialize: function(data){
3041        this.data = $H(data);
3042    },
3043
3044    translate : function(){
3045        var args = arguments;
3046        var text = arguments[0];
3047
3048        if(this.data.get(text)){
3049            return this.data.get(text);
3050        }
3051        return text;
3052    },
3053    add : function() {
3054        if (arguments.length > 1) {
3055            this.data.set(arguments[0], arguments[1]);
3056        } else if (typeof arguments[0] =='object') {
3057            $H(arguments[0]).each(function (pair){
3058                this.data.set(pair.key, pair.value);
3059            }.bind(this));
3060        }
3061    }
3062}
3063
3064/**
3065 * Magento
3066 *
3067 * NOTICE OF LICENSE
3068 *
3069 * This source file is subject to the Academic Free License (AFL 3.0)
3070 * that is bundled with this package in the file LICENSE_AFL.txt.
3071 * It is also available through the world-wide-web at this URL:
3072 * http://opensource.org/licenses/afl-3.0.php
3073 * If you did not receive a copy of the license and are unable to
3074 * obtain it through the world-wide-web, please send an email
3075 * to [email protected] so we can send you a copy immediately.
3076 *
3077 * DISCLAIMER
3078 *
3079 * Do not edit or add to this file if you wish to upgrade Magento to newer
3080 * versions in the future. If you wish to customize Magento for your
3081 * needs please refer to http://www.magentocommerce.com for more information.
3082 *
3083 * @category    Mage
3084 * @package     js
3085 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
3086 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
3087 */
3088// old school cookie functions grabbed off the web
3089
3090if (!window.Mage) var Mage = {};
3091
3092Mage.Cookies = {};
3093Mage.Cookies.expires  = null;
3094Mage.Cookies.path     = '/';
3095Mage.Cookies.domain   = null;
3096Mage.Cookies.secure   = false;
3097Mage.Cookies.set = function(name, value){
3098     var argv = arguments;
3099     var argc = arguments.length;
3100     var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires;
3101     var path = (argc > 3) ? argv[3] : Mage.Cookies.path;
3102     var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain;
3103     var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure;
3104     document.cookie = name + "=" + escape (value) +
3105       ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
3106       ((path == null) ? "" : ("; path=" + path)) +
3107       ((domain == null) ? "" : ("; domain=" + domain)) +
3108       ((secure == true) ? "; secure" : "");
3109};
3110
3111Mage.Cookies.get = function(name){
3112    var arg = name + "=";
3113    var alen = arg.length;
3114    var clen = document.cookie.length;
3115    var i = 0;
3116    var j = 0;
3117    while(i < clen){
3118        j = i + alen;
3119        if (document.cookie.substring(i, j) == arg)
3120            return Mage.Cookies.getCookieVal(j);
3121        i = document.cookie.indexOf(" ", i) + 1;
3122        if(i == 0)
3123            break;
3124    }
3125    return null;
3126};
3127
3128Mage.Cookies.clear = function(name) {
3129  if(Mage.Cookies.get(name)){
3130    document.cookie = name + "=" +
3131    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
3132  }
3133};
3134
3135Mage.Cookies.getCookieVal = function(offset){
3136   var endstr = document.cookie.indexOf(";", offset);
3137   if(endstr == -1){
3138       endstr = document.cookie.length;
3139   }
3140   return unescape(document.cookie.substring(offset, endstr));
3141};
3142
3143/*! jQuery v1.8.3 jquery.com | jquery.org/license */�
vendor: 93,525 bytes, lines 3143-3144
3143
3144(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.
3144jQuery&&define("jquery",[],function(){return v})})(window);
3145jQuery.noConflict();
3146jQuery.noConflict();
3147/*!
3148 * jQuery resize event - v1.1 - 3/14/2010
3149 * http://benalman.com/projects/jquery-resize-plugin/
3150 * 
3151 * Copyright (c) 2010 "Cowboy" Ben Alman
3152 * Dual licensed under the MIT and GPL licenses.
3153 * http://benalman.com/about/license/
3154 */
3155
3156// Script: jQuery resize event
3157//
3158// *Version: 1.1, Last updated: 3/14/2010*
3159// 
3160// Project Home - http://benalman.com/projects/jquery-resize-plugin/
3161// GitHub       - http://github.com/cowboy/jquery-resize/
3162// Source       - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.js
3163// (Minified)   - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.min.js (1.0kb)
3164// 
3165// About: License
3166// 
3167// Copyright (c) 2010 "Cowboy" Ben Alman,
3168// Dual licensed under the MIT and GPL licenses.
3169// http://benalman.com/about/license/
3170// 
3171// About: Examples
3172// 
3173// This working example, complete with fully commented code, illustrates a few
3174// ways in which this plugin can be used.
3175// 
3176// resize event - http://benalman.com/code/projects/jquery-resize/examples/resize/
3177// 
3178// About: Support and Testing
3179// 
3180// Information about what version or versions of jQuery this plugin has been
3181// tested with, what browsers it has been tested in, and where the unit tests
3182// reside (so you can test it yourself).
3183// 
3184// jQuery Versions - 1.3.2, 1.4.1, 1.4.2
3185// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome, Opera 9.6-10.1.
3186// Unit Tests      - http://benalman.com/code/projects/jquery-resize/unit/
3187// 
3188// About: Release History
3189// 
3190// 1.1 - (3/14/2010) Fixed a minor bug that was causing the event to trigger
3191//       immediately after bind in some circumstances. Also changed $.fn.data
3192//       to $.data to improve performance.
3193// 1.0 - (2/10/2010) Initial release
3194
3195(function($,window,undefined){
3196  '$:nomunge'; // Used by YUI compressor.
3197  
3198  // A jQuery object containing all non-window elements to which the resize
3199  // event is bound.
3200  var elems = $([]),
3201    
3202    // Extend $.resize if it already exists, otherwise create it.
3203    jq_resize = $.resize = $.extend( $.resize, {} ),
3204    
3205    timeout_id,
3206    
3207    // Reused strings.
3208    str_setTimeout = 'setTimeout',
3209    str_resize = 'resize',
3210    str_data = str_resize + '-special-event',
3211    str_delay = 'delay',
3212    str_throttle = 'throttleWindow';
3213  
3214  // Property: jQuery.resize.delay
3215  // 
3216  // The numeric interval (in milliseconds) at which the resize event polling
3217  // loop executes. Defaults to 250.
3218  
3219  jq_resize[ str_delay ] = 250;
3220  
3221  // Property: jQuery.resize.throttleWindow
3222  // 
3223  // Throttle the native window object resize event to fire no more than once
3224  // every <jQuery.resize.delay> milliseconds. Defaults to true.
3225  // 
3226  // Because the window object has its own resize event, it doesn't need to be
3227  // provided by this plugin, and its execution can be left entirely up to the
3228  // browser. However, since certain browsers fire the resize event continuously
3229  // while others do not, enabling this will throttle the window resize event,
3230  // making event behavior consistent across all elements in all browsers.
3231  // 
3232  // While setting this property to false will disable window object resize
3233  // event throttling, please note that this property must be changed before any
3234  // window object resize event callbacks are bound.
3235  
3236  jq_resize[ str_throttle ] = true;
3237  
3238  // Event: resize event
3239  // 
3240  // Fired when an element's width or height changes. Because browsers only
3241  // provide this event for the window element, for other elements a polling
3242  // loop is initialized, running every <jQuery.resize.delay> milliseconds
3243  // to see if elements' dimensions have changed. You may bind with either
3244  // .resize( fn ) or .bind( "resize", fn ), and unbind with .unbind( "resize" ).
3245  // 
3246  // Usage:
3247  // 
3248  // > jQuery('selector').bind( 'resize', function(e) {
3249  // >   // element's width or height has changed!
3250  // >   ...
3251  // > });
3252  // 
3253  // Additional Notes:
3254  // 
3255  // * The polling loop is not created until at least one callback is actually
3256  //   bound to the 'resize' event, and this single polling loop is shared
3257  //   across all elements.
3258  // 
3259  // Double firing issue in jQuery 1.3.2:
3260  // 
3261  // While this plugin works in jQuery 1.3.2, if an element's event callbacks
3262  // are manually triggered via .trigger( 'resize' ) or .resize() those
3263  // callbacks may double-fire, due to limitations in the jQuery 1.3.2 special
3264  // events system. This is not an issue when using jQuery 1.4+.
3265  // 
3266  // > // While this works in jQuery 1.4+
3267  // > $(elem).css({ width: new_w, height: new_h }).resize();
3268  // > 
3269  // > // In jQuery 1.3.2, you need to do this:
3270  // > var elem = $(elem);
3271  // > elem.css({ width: new_w, height: new_h });
3272  // > elem.data( 'resize-special-event', { width: elem.width(), height: elem.height() } );
3273  // > elem.resize();
3274      
3275  $.event.special[ str_resize ] = {
3276    
3277    // Called only when the first 'resize' event callback is bound per element.
3278    setup: function() {
3279      // Since window has its own native 'resize' event, return false so that
3280      // jQuery will bind the event using DOM methods. Since only 'window'
3281      // objects have a .setTimeout method, this should be a sufficient test.
3282      // Unless, of course, we're throttling the 'resize' event for window.
3283      if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
3284      
3285      var elem = $(this);
3286      
3287      // Add this element to the list of internal elements to monitor.
3288      elems = elems.add( elem );
3289      
3290      // Initialize data store on the element.
3291      $.data( this, str_data, { w: elem.width(), h: elem.height() } );
3292      
3293      // If this is the first element added, start the polling loop.
3294      if ( elems.length === 1 ) {
3295        loopy();
3296      }
3297    },
3298    
3299    // Called only when the last 'resize' event callback is unbound per element.
3300    teardown: function() {
3301      // Since window has its own native 'resize' event, return false so that
3302      // jQuery will unbind the event using DOM methods. Since only 'window'
3303      // objects have a .setTimeout method, this should be a sufficient test.
3304      // Unless, of course, we're throttling the 'resize' event for window.
3305      if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
3306      
3307      var elem = $(this);
3308      
3309      // Remove this element from the list of internal elements to monitor.
3310      elems = elems.not( elem );
3311      
3312      // Remove any data stored on the element.
3313      elem.removeData( str_data );
3314      
3315      // If this is the last element removed, stop the polling loop.
3316      if ( !elems.length ) {
3317        clearTimeout( timeout_id );
3318      }
3319    },
3320    
3321    // Called every time a 'resize' event callback is bound per element (new in
3322    // jQuery 1.4).
3323    add: function( handleObj ) {
3324      // Since window has its own native 'resize' event, return false so that
3325      // jQuery doesn't modify the event object. Unless, of course, we're
3326      // throttling the 'resize' event for window.
3327      if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
3328      
3329      var old_handler;
3330      
3331      // The new_handler function is executed every time the event is triggered.
3332      // This is used to update the internal element data store with the width
3333      // and height when the event is triggered manually, to avoid double-firing
3334      // of the event callback. See the "Double firing issue in jQuery 1.3.2"
3335      // comments above for more information.
3336      
3337      function new_handler( e, w, h ) {
3338        var elem = $(this),
3339          data = $.data( this, str_data );
3340        
3341        // If called from the polling loop, w and h will be passed in as
3342        // arguments. If called manually, via .trigger( 'resize' ) or .resize(),
3343        // those values will need to be computed.
3344        data.w = w !== undefined ? w : elem.width();
3345        data.h = h !== undefined ? h : elem.height();
3346        
3347        old_handler.apply( this, arguments );
3348      };
3349      
3350      // This may seem a little complicated, but it normalizes the special event
3351      // .add method between jQuery 1.4/1.4.1 and 1.4.2+
3352      if ( $.isFunction( handleObj ) ) {
3353        // 1.4, 1.4.1
3354        old_handler = handleObj;
3355        return new_handler;
3356      } else {
3357        // 1.4.2+
3358        old_handler = handleObj.handler;
3359        handleObj.handler = new_handler;
3360      }
3361    }
3362    
3363  };
3364  
3365  function loopy() {
3366    
3367    // Start the polling loop, asynchronously.
3368    timeout_id = window[ str_setTimeout ](function(){
3369      
3370      // Iterate over all elements to which the 'resize' event is bound.
3371      elems.each(function(){
3372        var elem = $(this),
3373          width = elem.width(),
3374          height = elem.height(),
3375          data = $.data( this, str_data );
3376        
3377        // If element size has changed since the last time, update the element
3378        // data store and trigger the 'resize' event.
3379        if ( width !== data.w || height !== data.h ) {
3380          elem.trigger( str_resize, [ data.w = width, data.h = height ] );
3381        }
3382        
3383      });
3384      
3385      // Loop.
3386      loopy();
3387      
3388    }, jq_resize[ str_delay ] );
3389    
3390  };
3391  
3392})(jQuery,this);
3393
3394/**
3395* hoverIntent is similar to jQuery's built-in "hover" function except that
3396* instead of firing the onMouseOver event immediately, hoverIntent checks
3397* to see if the user's mouse has slowed down (beneath the sensitivity
3398* threshold) before firing the onMouseOver event.
3399* 
3400* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
3401* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
3402* 
3403* hoverIntent is currently available for use in all personal or commercial 
3404* projects under both MIT and GPL licenses. This means that you can choose 
3405* the license that best suits your project, and use it accordingly.
3406* 
3407* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
3408* $("ul li").hoverIntent( showNav , hideNav );
3409* 
3410* // advanced usage receives configuration object only
3411* $("ul li").hoverIntent({
3412*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
3413*	interval: 100,   // number = milliseconds of polling interval
3414*	over: showNav,  // function = onMouseOver callback (required)
3415*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
3416*	out: hideNav    // function = onMouseOut callback (required)
3417* });
3418* 
3419* @param  f  onMouseOver function || An object with configuration options
3420* @param  g  onMouseOut function  || Nothing (use configuration options object)
3421* @author    Brian Cherne brian(at)cherne(dot)net
3422*/
3423(function($) {
3424	$.fn.hoverIntent = function(f,g) {
3425		// default configuration options
3426		var cfg = {
3427			sensitivity: 7,
3428			interval: 100,
3429			timeout: 0
3430		};
3431		// override configuration options with user supplied object
3432		cfg = $.extend(cfg, g ? { over: f, out: g } : f );
3433
3434		// instantiate variables
3435		// cX, cY = current X and Y position of mouse, updated by mousemove event
3436		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
3437		var cX, cY, pX, pY;
3438
3439		// A private function for getting mouse position
3440		var track = function(ev) {
3441			cX = ev.pageX;
3442			cY = ev.pageY;
3443		};
3444
3445		// A private function for comparing current and previous mouse position
3446		var compare = function(ev,ob) {
3447			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
3448			// compare mouse positions to see if they've crossed the threshold
3449			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
3450				$(ob).unbind("mousemove",track);
3451				// set hoverIntent state to true (so mouseOut can be called)
3452				ob.hoverIntent_s = 1;
3453				return cfg.over.apply(ob,[ev]);
3454			} else {
3455				// set previous coordinates for next time
3456				pX = cX; pY = cY;
3457				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
3458				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
3459			}
3460		};
3461
3462		// A private function for delaying the mouseOut function
3463		var delay = function(ev,ob) {
3464			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
3465			ob.hoverIntent_s = 0;
3466			return cfg.out.apply(ob,[ev]);
3467		};
3468
3469		// A private function for handling mouse 'hovering'
3470		var handleHover = function(e) {
3471			// copy objects to be passed into t (required for event object to be passed in IE)
3472			var ev = jQuery.extend({},e);
3473			var ob = this;
3474
3475			// cancel hoverIntent timer if it exists
3476			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
3477
3478			// if e.type == "mouseenter"
3479			if (e.type == "mouseenter") {
3480				// set "previous" X and Y position based on initial entry point
3481				pX = ev.pageX; pY = ev.pageY;
3482				// update "current" X and Y position based on mousemove
3483				$(ob).bind("mousemove",track);
3484				// start polling interval (self-calling timeout) to compare mouse coordinates over time
3485				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
3486
3487			// else e.type == "mouseleave"
3488			} else {
3489				// unbind expensive mousemove event
3490				$(ob).unbind("mousemove",track);
3491				// if hoverIntent state is true, then call the mouseOut function after the specified delay
3492				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
3493			}
3494		};
3495
3496		// bind the function to the two event listeners
3497		return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover);
3498	};
3499})(jQuery);
3500/*
3501 * jQuery hashchange event - v1.3 - 7/21/2010
3502 * http://benalman.com/projects/jquery-hashchange-plugin/
3503 * 
3504 * Copyright (c) 2010 "Cowboy" Ben Alman
3505 * Dual licensed under the MIT and GPL licenses.
3506 * http://benalman.com/about/license/
3507 */
3508(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();
3508t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
3509/**
3510 * Copyright (C) 2010-2011 Graham Breach
3511 *
3512 * This program is free software: you can redistribute it and/or modify
3513 * it under the terms of the GNU Lesser General Public License as published by
3514 * the Free Software Foundation, either version 3 of the License, or
3515 * (at your option) any later version.
3516 *
3517 * This program is distributed in the hope that it will be useful,
3518 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3519 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3520 * GNU Lesser General Public License for more details.
3521 * 
3522 * You should have received a copy of the GNU Lesser General Public License
3523 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
3524 */
3525/**
3526 * TagCanvas 1.10
3527 * For more information, please contact <[email protected]>
3528 */
3529(function(){
3530var i, j, abs = Math.abs, sin = Math.sin, cos = Math.cos, hexlookup3 = {}, hexlookup2 = {}, hexlookup1 = {
3531	0:"0,",   1:"17,",  2:"34,",  3:"51,",  4:"68,",  5:"85,",
3532	6:"102,", 7:"119,", 8:"136,", 9:"153,", a:"170,", A:"170,",
3533	b:"187,", B:"187,", c:"204,", C:"204,", d:"221,", D:"221,",
3534	e:"238,", E:"238,", f:"255,", F:"255,"	
3535}, Oproto, Tproto, TCproto, doc = document;
3536for(i = 0; i < 256; ++i) {
3537	j = i.toString(16);
3538	if(i < 16)
3539		j = '0' + j;
3540	hexlookup2[j] = hexlookup2[j.toUpperCase()] = i.toString() + ',';
3541}
3542function Defined(d) {
3543	return typeof(d) != 'undefined';
3544}
3545function PointsOnSphere(n) {
3546	var i, y, r, phi, pts = [], inc = Math.PI * (3-Math.sqrt(5)), off = 2/n;
3547	for(i = 0; i < n; ++i) {
3548		y = i * off - 1 + (off / 2);
3549		r = Math.sqrt(1 - y*y);
3550		phi = i * inc;
3551		pts.push([cos(phi)*r, y, sin(phi)*r]);
3552	}
3553	return pts;
3554}
3555function SetAlpha(c,a) {
3556	var d = c, p1, p2, ae = (a*1).toPrecision(3) + ')';
3557	if(c[0] === '#') {
3558		if(!hexlookup3[c])
3559			if(c.length === 4)
3560				hexlookup3[c] = 'rgba(' + hexlookup1[c[1]] + hexlookup1[c[2]] + hexlookup1[c[3]];
3561			else
3562				hexlookup3[c] = 'rgba(' + hexlookup2[c.substr(1,2)] + hexlookup2[c.substr(3,2)] + hexlookup2[c.substr(5,2)];
3563		d = hexlookup3[c] + ae;
3564	} else if(c.substr(0,4) === 'rgb(' || c.substr(0,4) === 'hsl(') {
3565		d = (c.replace('(','a(').replace(')', ',' + ae));
3566	} else if(c.substr(0,5) === 'rgba(' || c.substr(0,5) === 'hsla(') {
3567		p1 = c.lastIndexOf(',') + 1, p2 = c.indexOf(')');
3568		a *= parseFloat(c.substring(p1,p2));
3569		d = c.substr(0,p1) + a.toPrecision(3) + ')';
3570	}
3571	return d;
3572}
3573function NewCanvas(w,h) {
3574	// if using excanvas, give up now
3575	if(window.G_vmlCanvasManager)
3576		return null;
3577	var c = doc.createElement('canvas');
3578	c.width = w;
3579	c.height = h;
3580	return c;
3581}
3582// I think all browsers pass this test now...
3583function ShadowAlphaBroken() {
3584	var cv = NewCanvas(3,3), c, i;
3585	if(!cv)
3586		return false;
3587	c = cv.getContext('2d');
3588	c.strokeStyle = '#000';
3589	c.shadowColor = '#fff';
3590	c.shadowBlur = 3;
3591	c.globalAlpha = 0;
3592	c.strokeRect(2,2,2,2);
3593	c.globalAlpha = 1;
3594	i = c.getImageData(2,2,1,1);
3595	cv = null;
3596	return (i.data[0] > 0);
3597}
3598function FindGradientColour(t,p) {
3599	var l = 1024, g = t.weightGradient, cv, c, i, gd, d;
3600	if(t.gCanvas) {
3601		c = t.gCanvas.getContext('2d');
3602	} else {
3603		t.gCanvas = cv = NewCanvas(l,1);
3604		if(!cv)
3605			return null;
3606		c = cv.getContext('2d');
3607		gd = c.createLinearGradient(0,0,l,0);
3608		for(i in g)
3609			gd.addColorStop(1-i, g[i]);
3610		c.fillStyle = gd;
3611		c.fillRect(0,0,l,1);
3612	}
3613	d = c.getImageData(~~((l-1)*p),0,1,1).data;
3614	return 'rgba(' + d[0] + ',' + d[1] + ',' + d[2] + ',' + (d[3]/255) + ')';
3615}
3616function TextSet(c,f,l,s,sc,sb,so) {
3617	var xo = (sb || 0) + (so && so[0] < 0 ? abs(so[0]) : 0),
3618		yo = (sb || 0) + (so && so[1] < 0 ? abs(so[1]) : 0);
3619	c.font = f;
3620	c.textBaseline = 'top';
3621	c.fillStyle = l;
3622	sc && (c.shadowColor = sc);
3623	sb && (c.shadowBlur = sb);
3624	so && (c.shadowOffsetX = so[0], c.shadowOffsetY = so[1]);
3625	c.fillText(s, xo, yo);
3626}
3627function TextToCanvas(s,f,ht,w,h,l,sc,sb,so) {
3628	var cw = w + abs(so[0]) + sb + sb, ch = h + abs(so[1]) + sb + sb, cv, c;
3629	cv = NewCanvas(cw,ch);
3630	if(!cv)
3631		return null;
3632	c = cv.getContext('2d');
3633	TextSet(c,f,l,s,sc,sb,so);
3634	return cv;
3635}
3636function AddShadowToImage(i,sc,sb,so) {
3637	var cw = i.width + abs(so[0]) + sb + sb, ch = i.height + abs(so[1]) + sb + sb, cv, c,
3638		xo = (sb || 0) + (so && so[0] < 0 ? abs(so[0]) : 0),
3639		yo = (sb || 0) + (so && so[1] < 0 ? abs(so[1]) : 0);
3640	cv = NewCanvas(cw,ch);
3641	if(!cv)
3642		return null;
3643	c = cv.getContext('2d');
3644	sc && (c.shadowColor = sc);
3645	sb && (c.shadowBlur = sb);
3646	so && (c.shadowOffsetX = so[0], c.shadowOffsetY = so[1]);
3647	c.drawImage(i, xo, yo);
3648	return cv;
3649}
3650function FindTextBoundingBox(s,f,ht) {
3651	var w = parseInt(s.length * ht), h = parseInt(ht * 2), cv = NewCanvas(w,h), c, idata, w1, h1, x, y, i, ex;
3652	if(!cv)
3653		return null;
3654	c = cv.getContext('2d');
3655	c.fillStyle = '#000';
3656	c.fillRect(0,0,w,h);
3657	TextSet(c,ht + 'px ' + f,'#fff',s)
3658
3659	idata = c.getImageData(0,0,w,h);
3660	w1 = idata.width; h1 = idata.height;
3661	ex = {
3662		min: { x: w1, y: h1 },
3663		max: { x: -1, y: -1 }
3664	};
3665	for(y = 0; y < h1; ++y) {
3666		for(x = 0; x < w1; ++x) {
3667			i = (y * w1 + x) * 4;
3668			if(idata.data[i+1] > 0) {
3669				if(x < ex.min.x) ex.min.x = x;
3670				if(x > ex.max.x) ex.max.x = x;
3671				if(y < ex.min.y) ex.min.y = y;
3672				if(y > ex.max.y) ex.max.y = y;
3673			}
3674		}
3675	}
3676	// device pixels might not be css pixels
3677	if(w1 != w) {
3678		ex.min.x *= (w / w1);
3679		ex.max.x *= (w / w1);
3680	}
3681	if(h1 != h) {
3682		ex.min.y *= (w / h1);
3683		ex.max.y *= (w / h1);
3684	}
3685
3686	cv = null;
3687	return ex;
3688}
3689function FixFont(f) {
3690	return "'" + f.replace(/(\'|\")/g,'').replace(/\s*,\s*/g, "', '") + "'";
3691}
3692function AddHandler(h,f,e) {
3693	e = e || doc;
3694	if(e.addEventListener)
3695		e.addEventListener(h,f,false);
3696	else
3697		e.attachEvent('on' + h, f);
3698}
3699function AddImage(i,t,tl) {
3700	if(i.complete) {
3701		t.w = i.width;
3702		t.h = i.height;
3703		tl.push(t);
3704	} else {
3705		AddHandler('load',function() {
3706			t.w = this.width;
3707			t.h = this.height;
3708			tl.push(t);
3709		},i);
3710	}
3711}
3712function FindWeight(t,a) {
3713	var w = 1, p;
3714	if(t.weightFrom) {
3715		w = 1 * (a.getAttribute(t.weightFrom) || t.textHeight);
3716	} else if(doc.defaultView && doc.defaultView.getComputedStyle) {
3717		p = doc.defaultView.getComputedStyle(a,null).getPropertyValue('font-size');
3718		w = p.replace('px','') * 1;
3719	} else {
3720		t.weight = false;
3721	}
3722	return w;
3723}
3724function MouseMove(e) {
3725	var i, tc, dd = doc.documentElement, p;
3726	for(i in TagCanvas.tc) {
3727		tc = TagCanvas.tc[i];
3728		p = AbsPos(i);
3729		if(e.pageX) {
3730			tc.mx = e.pageX - p.x;
3731			tc.my = e.pageY - p.y;
3732		} else {
3733			tc.mx = e.clientX + (dd.scrollLeft || doc.body.scrollLeft) - p.x;
3734			tc.my = e.clientY + (dd.scrollTop || doc.body.scrollTop) - p.y;
3735		}
3736	}
3737}
3738function MouseClick(e) {
3739	var t = TagCanvas, cb = doc.addEventListener ? 0 : 1,
3740		tg = e.target && Defined(e.target.id) ? e.target.id : e.srcElement.parentNode.id;
3741	if(tg && e.button == cb && t.tc[tg]) {
3742		MouseMove(e);
3743		t.tc[tg].Clicked(e);
3744	}
3745}
3746function DrawCanvas() {
3747	var t = TagCanvas.tc, i;
3748	for(i in t)
3749		t[i].Draw();
3750}
3751function AbsPos(id) {
3752	var e, p, pn;
3753	e = doc.getElementById(id);
3754	p = {x:e.offsetLeft,y:e.offsetTop};
3755	while(e.offsetParent) {
3756		pn = e.offsetParent;
3757		p.x += pn.offsetLeft;
3758		p.y += pn.offsetTop;
3759		e = pn;
3760	}
3761	return p;
3762}
3763function RotX(p1,t) {
3764	var s = sin(t), c = cos(t); 
3765	return {x:p1.x, y:(p1.y * c) + (p1.z * s), z:(p1.y * -s) + (p1.z * c)};
3766}
3767function RotY(p1,t) {
3768	var s = sin(t), c = cos(t); 
3769	return {x:(p1.x * c) + (p1.z * -s), y:p1.y, z:(p1.x * s) + (p1.z * c)};
3770}
3771function Project(tc,p1,w,h,fov,asp) {
3772	var yn, xn, zn, m = tc.z1 / (tc.z1 + tc.z2 + p1.z);
3773	yn = p1.y * m;
3774	xn = p1.x * m;
3775	zn = tc.z2 + p1.z;
3776	return {x:xn, y:yn, z:zn};
3777}
3778/**
3779 * @constructor
3780 */
3781function Outline(tc) {
3782	this.ts = new Date().valueOf();
3783	this.tc = tc;
3784	this.x = this.y = this.w = this.h = this.sc = 1;
3785	this.z = 0;
3786}
3787Oproto = Outline.prototype;
3788Oproto.Update = function(x,y,w,h,sc,p) {
3789	var o = this.tc.outlineOffset;
3790	this.x = sc * (x - o);
3791	this.y = sc * (y - o);
3792	this.w = sc * (w + o * 2);
3793	this.h = sc * (h + o * 2);
3794	this.sc = sc; // used to determine frontmost
3795	this.z = p.z;
3796};
3797Oproto.Draw = function(c) {
3798	var diff = new Date().valueOf() - this.ts, t = this.tc;
3799	c.setTransform(1,0,0,1,0,0);
3800	c.strokeStyle = t.outlineColour;
3801	c.lineWidth = t.outlineThickness;
3802	c.shadowBlur = c.shadowOffsetX = c.shadowOffsetY = 0;
3803	if(t.pulsateTo < 1)
3804		c.globalAlpha = t.pulsateTo + ((1 - t.pulsateTo) * 
3805			(0.5 + (cos(2 * Math.PI * diff / (1000 * t.pulsateTime)) / 2)));
3806	else
3807		c.globalAlpha = 1;
3808	c.strokeRect(this.x, this.y, this.w, this.h);
3809};
3810Oproto.Active = function(c,x,y) {
3811	return (x >= this.x && y >= this.y &&
3812		x <= this.x + this.w && y <= this.y + this.h);
3813};
3814/**
3815 * @constructor
3816 */
3817function Tag(tc,name,a,v,w,h) {
3818	var c = tc.ctxt, i;
3819	this.tc = tc;
3820	this.image = name.src ? name : null;
3821	this.name = name.src ? '' : name;
3822	this.a = a;
3823	this.p3d = { x: v[0] * tc.radius * 1.1, y: v[1] * tc.radius * 1.1, z: v[2] * tc.radius * 1.1};
3824	this.x = this.y = 0;
3825	this.w = w;
3826	this.h = h;
3827	this.colour = tc.textColour;
3828	this.weight = this.sc = this.alpha = 1;
3829	this.weighted = !tc.weight;
3830	this.outline = new Outline(tc);
3831	if(this.image) {
3832		if(tc.txtOpt && tc.shadow) {
3833			i = AddShadowToImage(this.image,tc.shadow,tc.shadowBlur,tc.shadowOffset);
3834			if(i) {
3835				this.image = i;
3836				this.w = i.width;
3837				this.h = i.height;
3838			}
3839		}
3840	} else {
3841		this.textHeight = tc.textHeight;
3842		this.extents = FindTextBoundingBox(this.name, tc.textFont, this.textHeight);
3843		this.Measure(c,tc);
3844	}
3845	this.SetShadowColour = tc.shadowAlpha ? this.SetShadowColourAlpha : this.SetShadowColourFixed;
3846	this.SetDraw(tc);
3847}
3848Tproto = Tag.prototype;
3849Tproto.SetDraw = function(t) {
3850	this.Draw = this.image ? (t.ie > 7 ? this.DrawImageIE : this.DrawImage) : this.DrawText;
3851};
3852Tproto.Measure = function(c,t) {
3853	this.h = this.extents ? this.extents.max.y + this.extents.min.y : this.textHeight;
3854	c.font = this.font = this.textHeight + 'px ' + t.textFont;
3855	this.w1 = c.measureText(this.name).width;
3856	if(t.txtOpt) {
3857		var s = t.txtScale, th = s * this.textHeight, f = th + 'px ' + t.textFont,
3858			soff = [s*t.shadowOffset[0],s*t.shadowOffset[1]], cw;
3859		c.font = f;
3860		cw = c.measureText(this.name).width;
3861		this.image = TextToCanvas(this.name, f, th, cw, s * this.h, this.colour,
3862			t.shadow, s * t.shadowBlur, soff);
3863		if(this.image) {
3864			this.w = this.image.width / s;
3865			this.h = this.image.height / s;
3866		}
3867		this.SetDraw(t);
3868		t.txtOpt = this.image;
3869	}
3870};
3871Tproto.SetWeight = function(w) {
3872	this.weight = w;
3873	this.Weight(this.tc.ctxt, this.tc);
3874	this.Measure(this.tc.ctxt, this.tc);
3875};
3876Tproto.Weight = function(c,t) {
3877	var w = this.weight, m = t.weightMode;
3878	this.weighted = true;
3879	if(m == 'colour' || m == 'both')
3880		this.colour = FindGradientColour(t, (w - t.min_weight) / (t.max_weight-t.min_weight));
3881	if(m == 'size' || m == 'both')
3882		this.textHeight = w * t.weightSize;
3883	this.extents = FindTextBoundingBox(this.name, t.textFont, this.textHeight);
3884};
3885Tproto.SetShadowColourFixed = function(c,s,a) {
3886	c.shadowColor = s;
3887};
3888Tproto.SetShadowColourAlpha = function(c,s,a) {
3889	c.shadowColor = SetAlpha(s, a);
3890};
3891Tproto.DrawText = function(c,xoff,yoff) {
3892	var t = this.tc, x = this.x, y = this.y, w, h, s = this.sc, o = this.outline;
3893
3894	c.globalAlpha = this.alpha;
3895	c.setTransform(s,0,0,s,0,0);
3896	c.fillStyle = this.colour;
3897	t.shadow && this.SetShadowColour(c,t.shadow,this.alpha);
3898	c.font = this.font;
3899	w = this.w1 * s;
3900	h = this.h * s;
3901	x += 1 + (xoff / s) - (w / 2);
3902	y += 1 + (yoff / s) - (h / 2);
3903
3904	c.fillText(this.name, x, y);
3905	o.Update(x, y, this.w1, this.h, s, this.p3d);
3906	return o.Active(c, t.mx, t.my) ? o : null;
3907};
3908Tproto.DrawImage = function(c,xoff,yoff) {
3909	var t = this.tc, x = this.x, y = this.y, s = this.sc, o = this.outline,
3910		i = this.image, w = this.w, h = this.h;
3911	c.globalAlpha = this.alpha;
3912	c.setTransform(s,0,0,s,0,0);
3913	c.fillStyle = this.colour;
3914	t.shadow && this.SetShadowColour(c,t.shadow,this.alpha);
3915	x += (xoff / s) - (w / 2);
3916	y += (yoff / s) - (h / 2);
3917
3918	c.drawImage(i, x, y, w, h);
3919	o.Update(x, y, w, h, s, this.p3d);
3920	return o.Active(c, t.mx, t.my) ? o : null;
3921};
3922Tproto.DrawImageIE = function(c,xoff,yoff) {
3923	var t = this.tc, i = this.image, s = this.sc, o = this.outline,
3924		w = i.width = this.w*s, h = i.height = this.h * s,
3925		x = (this.x*s) + xoff - (w/2), y = (this.y*s) + yoff - (h/2);
3926	c.globalAlpha = this.alpha;
3927	c.drawImage(i, x, y);
3928	o.Update(x, y, w, h, 1, this.p3d);
3929	return o.Active(c, t.mx, t.my) ? o : null;
3930};
3931Tproto.Calc = function(yaw,pitch) {
3932	var pp = RotY(this.p3d,yaw), t = this.tc, mb = t.minBrightness, r = t.radius;
3933	this.p3d = RotX(pp,pitch);
3934	pp = Project(t, this.p3d, this.w, this.h, Math.PI / 4, 20);
3935	this.x = pp.x;
3936	this.y = pp.y;
3937	this.sc = (t.z1 + t.z2 - pp.z) / t.z2;
3938	this.alpha = Math.max(mb,Math.min(1,mb + 1 - ((pp.z - t.z2 + r) / (2 * r))));
3939};
3940Tproto.Clicked = function(e) {
3941	var a = this.a, t = a.target, h = a.href, evt;
3942	if(t != '' && t != '_self') {
3943		if(self.frames[t])
3944			self.frames[t] = h;
3945		else if(top.frames[t])
3946			top.frames[t] = h;
3947		else
3948			window.open(h, t);
3949		return;
3950	}
3951	if(a.fireEvent) {
3952		if(!a.fireEvent('onclick'))
3953			return;
3954	} else {
3955		evt = doc.createEvent('MouseEvents');
3956		evt.initMouseEvent('click', 1, 1, window, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null);
3957		if(!a.dispatchEvent(evt))
3958			return;
3959	}
3960	doc.location = h;
3961};
3962/**
3963 * @constructor
3964 */
3965function TagCanvas(cid,lctr,opt) {
3966	var i, ctr, tl, vl, p, im, ii, tag, c = doc.getElementById(cid), cp = ['id','class','innerHTML'], w, weights = [];
3967
3968	if(!c) throw 0;
3969	if(Defined(window.G_vmlCanvasManager)) {
3970		c = window.G_vmlCanvasManager.initElement(c);
3971		this.ie = parseFloat(navigator.appVersion.split('MSIE')[1]);
3972	}
3973	if(c && (!c.getContext || !c.getContext('2d').fillText)) {
3974		p = doc.createElement('DIV');
3975		for(i = 0; i < cp.length; ++i)
3976			p[cp[i]] = c[cp[i]];
3977		c.parentNode.insertBefore(p,c);
3978		c.parentNode.removeChild(c);
3979		throw 0;
3980	}
3981	for(i in TagCanvas.options)
3982		this[i] = opt && Defined(opt[i]) ? opt[i] : 
3983			(Defined(TagCanvas[i]) ? TagCanvas[i] : TagCanvas.options[i]);
3984
3985	this.canvas = c;
3986	this.ctxt = c.getContext('2d');
3987	this.z1 = (19800 / (Math.exp(this.depth) * (1-1/Math.E))) +
3988		20000 - 19800 / (1-(1/Math.E));
3989	this.z2 = this.z1 * (1/this.zoom);
3990	this.radius = (c.height > c.width ? c.width : c.height)
3991				* 0.33 * (this.z2 + this.z1) / (this.z1);
3992	this.max_weight = 0;
3993	this.min_weight = 200;
3994	this.textFont = FixFont(this.textFont);
3995	this.ctxt.textBaseline = 'top';
3996	if(this.shadowBlur || this.shadowOffset[0] || this.shadowOffset[1]) {
3997		// let the browser translate "red" into "#ff0000"
3998		this.ctxt.shadowColor = this.shadow;
3999		this.shadow = this.ctxt.shadowColor;
4000		this.shadowAlpha = ShadowAlphaBroken();
4001	} else {
4002		delete this.shadow;
4003	}
4004	try {
4005		ctr = doc.getElementById(lctr || cid);
4006		tl = ctr.getElementsByTagName('a');
4007		this.taglist = [];
4008		if(tl.length) {
4009			vl = PointsOnSphere(tl.length);
4010			for(i = 0; i < tl.length; ++i) {
4011				im = tl[i].getElementsByTagName('img');
4012				if(im.length) {
4013					ii = new Image;
4014					ii.src = im[0].src;
4015					tag = new Tag(this, ii, tl[i], vl[i], 1, 1);
4016					AddImage(ii,tag,this.taglist);
4017				} else {
4018					this.taglist.push(new Tag(this, tl[i].innerText || tl[i].textContent, tl[i],
4019						vl[i], 2, this.textHeight + 2));
4020				}
4021				if(this.weight) {
4022					w = FindWeight(this,tl[i]);
4023					if(w > this.max_weight) this.max_weight = w;
4024					if(w < this.min_weight) this.min_weight = w;
4025					weights.push(w);
4026				}
4027			}
4028			if(this.weight = (this.max_weight > this.min_weight)) {
4029				for(i = 0; i < this.taglist.length; ++i) {
4030					this.taglist[i].SetWeight(weights[i]);
4031				}
4032			}
4033		}
4034		if(lctr && this.hideTags)
4035			ctr.style.display = 'none';
4036	} catch(ex) {
4037		ex;
4038	}
4039
4040	this.yaw = this.initial ? this.initial[0] * this.maxSpeed : 0;
4041	this.pitch = this.initial ? this.initial[1] * this.maxSpeed : 0;
4042	AddHandler('mousemove', MouseMove, c);
4043	AddHandler('mouseout', MouseMove, c);
4044	AddHandler('mouseup', MouseClick, c);
4045	TagCanvas.started || (TagCanvas.started = setInterval(DrawCanvas, this.interval));
4046}
4047TCproto = TagCanvas.prototype;
4048TCproto.Draw = function() {
4049	var cv = this.canvas, cw = cv.width, ch = cv.height, max_sc = 0, yaw = this.yaw, pitch = this.pitch,
4050		x1 = cw / 2, y1 = ch / 2, c = this.ctxt, active, a, i, tl = this.taglist, l = tl.length;
4051	c.setTransform(1,0,0,1,0,0);
4052	this.active = null;
4053	for(i = 0; i < l; ++i)
4054		tl[i].Calc(yaw, pitch);
4055	tl = tl.sort(function(a,b) {return a.sc-b.sc});
4056
4057	if(!this.txtOpt && this.shadow) {
4058		c.shadowBlur = this.shadowBlur;
4059		c.shadowOffsetX = this.shadowOffset[0];
4060		c.shadowOffsetY = this.shadowOffset[1];
4061	}
4062	c.clearRect(0,0,cw,ch);
4063	for(i = 0; i < l; ++i) {
4064		a = tl[i].Draw(c, x1, y1);
4065		if(a && a.sc > max_sc && (!this.frontSelect || a.z <= 0)) {
4066			active = a;
4067			active.index = i;
4068			max_sc = a.sc;
4069		}
4070	}
4071	if(this.freezeActive && active)
4072		this.yaw = this.pitch = 0;
4073	else
4074		this.Animate(cw, ch);
4075	active && (this.active = active).Draw(c);
4076};
4077TCproto.Animate = function(w,h) {
4078	var tc = this, x = tc.mx, y = tc.my, s, ay, ap, r;
4079	if(x >= 0 && y >= 0 && x < w && y < h)
4080	{
4081		s = tc.maxSpeed, r = tc.reverse ? -1 : 1;
4082		this.yaw = r * ((s * 2 * x / w) - s);
4083		this.pitch = r * -((s * 2 * y / h) - s);
4084		this.initial = null;
4085	}
4086	else if(!tc.initial)
4087	{
4088		s = tc.minSpeed, ay = abs(tc.yaw), ap = abs(tc.pitch);
4089		if(ay > s)
4090			this.yaw = ay > tc.z0 ? tc.yaw * tc.decel : 0;
4091		if(ap > s)
4092			this.pitch = ap > tc.z0 ? tc.pitch * tc.decel : 0;
4093	}
4094};
4095TCproto.Clicked = function(e) {
4096	var t = this.taglist, a = this.active;
4097	try {
4098		if(a && t[a.index]) 
4099			t[a.index].Clicked(e);
4100	} catch(ex) {
4101	}
4102};
4103TagCanvas.Start = function(id,l,o) {
4104	TagCanvas.tc[id] = new TagCanvas(id,l,o);
4105};
4106
4107TagCanvas.tc = {};
4108TagCanvas.options = {
4109z1: 20000,
4110z2: 20000,
4111z0: 0.0002,
4112freezeActive: false,
4113pulsateTo: 0.15,
4114pulsateTime: 3,
4115reverse: false,
4116depth: 0.5,
4117maxSpeed: 0.05,
4118minSpeed: 0,
4119decel: 0.95,
4120interval: 20,
4121minBrightness: 0.1,
4122outlineColour: '#ffff99',
4123outlineThickness: 2,
4124outlineOffset: 5,
4125textColour: '#ff99ff',
4126textHeight: 15,
4127textFont: 'Helvetica, Arial, sans-serif',
4128shadow: '#000',
4129shadowBlur: 0,
4130shadowOffset: [0,0],
4131initial: null,
4132hideTags: true,
4133zoom: 1,
4134weight: false,
4135weightMode: 'size',
4136weightFrom: null,
4137weightSize: 1,
4138weightGradient: {0:'#f00', 0.33:'#ff0', 0.66:'#0f0', 1:'#00f'},
4139txtOpt: true,
4140txtScale: 2,
4141frontSelect: false
4142};
4143for(i in TagCanvas.options) TagCanvas[i] = TagCanvas.options[i];
4144window.TagCanvas = TagCanvas;
4145})();
4146
vendor: 10,254 bytes, lines 4147-4398
4147/*!
4148 * jQuery throttle / debounce - v1.1 - 3/7/2010
4149 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
4150 * 
4151 * Copyright (c) 2010 "Cowboy" Ben Alman
4152 * Dual licensed under the MIT and GPL licenses.
4153 * http://benalman.com/about/license/
4154 */
4155
4156// Script: jQuery throttle / debounce: Sometimes, less is more!
4157//
4158// *Version: 1.1, Last updated: 3/7/2010*
4159// 
4160// Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
4161// GitHub       - http://github.com/cowboy/jquery-throttle-debounce/
4162// Source       - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
4163// (Minified)   - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
4164// 
4165// About: License
4166// 
4167// Copyright (c) 2010 "Cowboy" Ben Alman,
4168// Dual licensed under the MIT and GPL licenses.
4169// http://benalman.com/about/license/
4170// 
4171// About: Examples
4172// 
4173// These working examples, complete with fully commented code, illustrate a few
4174// ways in which this plugin can be used.
4175// 
4176// Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
4177// Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
4178// 
4179// About: Support and Testing
4180// 
4181// Information about what version or versions of jQuery this plugin has been
4182// tested with, what browsers it has been tested in, and where the unit tests
4183// reside (so you can test it yourself).
4184// 
4185// jQuery Versions - none, 1.3.2, 1.4.2
4186// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
4187// Unit Tests      - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
4188// 
4189// About: Release History
4190// 
4191// 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
4192//       executed later than they should. Reworked a fair amount of internal
4193//       logic as well.
4194// 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
4195//       from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
4196//       no_trailing throttle parameter and debounce functionality.
4197// 
4198// Topic: Note for non-jQuery users
4199// 
4200// jQuery isn't actually required for this plugin, because nothing internal
4201// uses any jQuery methods or properties. jQuery is just used as a namespace
4202// under which these methods can exist.
4203// 
4204// Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
4205// when this plugin is loaded, the method described below will be created in
4206// the `Cowboy` namespace. Usage will be exactly the same, but instead of
4207// $.method() or jQuery.method(), you'll need to use Cowboy.method().
4208
4209(function(window,undefined){
4210  '$:nomunge'; // Used by YUI compressor.
4211  
4212  // Since jQuery really isn't required for this plugin, use `jQuery` as the
4213  // namespace only if it already exists, otherwise use the `Cowboy` namespace,
4214  // creating it if necessary.
4215  var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
4216    
4217    // Internal method reference.
4218    jq_throttle;
4219  
4220  // Method: jQuery.throttle
4221  // 
4222  // Throttle execution of a function. Especially useful for rate limiting
4223  // execution of handlers on events like resize and scroll. If you want to
4224  // rate-limit execution of a function to a single time, see the
4225  // <jQuery.debounce> method.
4226  // 
4227  // In this visualization, | is a throttled-function call and X is the actual
4228  // callback execution:
4229  // 
4230  // > Throttled with `no_trailing` specified as false or unspecified:
4231  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4232  // > X    X    X    X    X    X        X    X    X    X    X    X
4233  // > 
4234  // > Throttled with `no_trailing` specified as true:
4235  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4236  // > X    X    X    X    X             X    X    X    X    X
4237  // 
4238  // Usage:
4239  // 
4240  // > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
4241  // > 
4242  // > jQuery('selector').bind( 'someevent', throttled );
4243  // > jQuery('selector').unbind( 'someevent', throttled );
4244  // 
4245  // This also works in jQuery 1.4+:
4246  // 
4247  // > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
4248  // > jQuery('selector').unbind( 'someevent', callback );
4249  // 
4250  // Arguments:
4251  // 
4252  //  delay - (Number) A zero-or-greater delay in milliseconds. For event
4253  //    callbacks, values around 100 or 250 (or even higher) are most useful.
4254  //  no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
4255  //    true, callback will only execute every `delay` milliseconds while the
4256  //    throttled-function is being called. If no_trailing is false or
4257  //    unspecified, callback will be executed one final time after the last
4258  //    throttled-function call. (After the throttled-function has not been
4259  //    called for `delay` milliseconds, the internal counter is reset)
4260  //  callback - (Function) A function to be executed after delay milliseconds.
4261  //    The `this` context and all arguments are passed through, as-is, to
4262  //    `callback` when the throttled-function is executed.
4263  // 
4264  // Returns:
4265  // 
4266  //  (Function) A new, throttled, function.
4267  
4268  $.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
4269    // After wrapper has stopped being called, this timeout ensures that
4270    // `callback` is executed at the proper times in `throttle` and `end`
4271    // debounce modes.
4272    var timeout_id,
4273      
4274      // Keep track of the last time `callback` was executed.
4275      last_exec = 0;
4276    
4277    // `no_trailing` defaults to falsy.
4278    if ( typeof no_trailing !== 'boolean' ) {
4279      debounce_mode = callback;
4280      callback = no_trailing;
4281      no_trailing = undefined;
4282    }
4283    
4284    // The `wrapper` function encapsulates all of the throttling / debouncing
4285    // functionality and when executed will limit the rate at which `callback`
4286    // is executed.
4287    function wrapper() {
4288      var that = this,
4289        elapsed = +new Date() - last_exec,
4290        args = arguments;
4291      
4292      // Execute `callback` and update the `last_exec` timestamp.
4293      function exec() {
4294        last_exec = +new Date();
4295        callback.apply( that, args );
4296      };
4297      
4298      // If `debounce_mode` is true (at_begin) this is used to clear the flag
4299      // to allow future `callback` executions.
4300      function clear() {
4301        timeout_id = undefined;
4302      };
4303      
4304      if ( debounce_mode && !timeout_id ) {
4305        // Since `wrapper` is being called for the first time and
4306        // `debounce_mode` is true (at_begin), execute `callback`.
4307        exec();
4308      }
4309      
4310      // Clear any existing timeout.
4311      timeout_id && clearTimeout( timeout_id );
4312      
4313      if ( debounce_mode === undefined && elapsed > delay ) {
4314        // In throttle mode, if `delay` time has been exceeded, execute
4315        // `callback`.
4316        exec();
4317        
4318      } else if ( no_trailing !== true ) {
4319        // In trailing throttle mode, since `delay` time has not been
4320        // exceeded, schedule `callback` to execute `delay` ms after most
4321        // recent execution.
4322        // 
4323        // If `debounce_mode` is true (at_begin), schedule `clear` to execute
4324        // after `delay` ms.
4325        // 
4326        // If `debounce_mode` is false (at end), schedule `callback` to
4327        // execute after `delay` ms.
4328        timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
4329      }
4330    };
4331    
4332    // Set the guid of `wrapper` function to the same of original callback, so
4333    // it can be removed in jQuery 1.4+ .unbind or .die by using the original
4334    // callback as a reference.
4335    if ( $.guid ) {
4336      wrapper.guid = callback.guid = callback.guid || $.guid++;
4337    }
4338    
4339    // Return the wrapper function.
4340    return wrapper;
4341  };
4342  
4343  // Method: jQuery.debounce
4344  // 
4345  // Debounce execution of a function. Debouncing, unlike throttling,
4346  // guarantees that a function is only executed a single time, either at the
4347  // very beginning of a series of calls, or at the very end. If you want to
4348  // simply rate-limit execution of a function, see the <jQuery.throttle>
4349  // method.
4350  // 
4351  // In this visualization, | is a debounced-function call and X is the actual
4352  // callback execution:
4353  // 
4354  // > Debounced with `at_begin` specified as false or unspecified:
4355  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4356  // >                          X                                 X
4357  // > 
4358  // > Debounced with `at_begin` specified as true:
4359  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4360  // > X                                 X
4361  // 
4362  // Usage:
4363  // 
4364  // > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
4365  // > 
4366  // > jQuery('selector').bind( 'someevent', debounced );
4367  // > jQuery('selector').unbind( 'someevent', debounced );
4368  // 
4369  // This also works in jQuery 1.4+:
4370  // 
4371  // > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
4372  // > jQuery('selector').unbind( 'someevent', callback );
4373  // 
4374  // Arguments:
4375  // 
4376  //  delay - (Number) A zero-or-greater delay in milliseconds. For event
4377  //    callbacks, values around 100 or 250 (or even higher) are most useful.
4378  //  at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
4379  //    unspecified, callback will only be executed `delay` milliseconds after
4380  //    the last debounced-function call. If at_begin is true, callback will be
4381  //    executed only at the first debounced-function call. (After the
4382  //    throttled-function has not been called for `delay` milliseconds, the
4383  //    internal counter is reset)
4384  //  callback - (Function) A function to be executed after delay milliseconds.
4385  //    The `this` context and all arguments are passed through, as-is, to
4386  //    `callback` when the debounced-function is executed.
4387  // 
4388  // Returns:
4389  // 
4390  //  (Function) A new, debounced, function.
4391  
4392  $.debounce = function( delay, at_begin, callback ) {
4393    return callback === undefined
4394      ? jq_throttle( delay, at_begin, false )
4395      : jq_throttle( delay, callback, at_begin !== false );
4396  };
4397  
4398})(this);
4399
4400/**
4401 * EM MegaMenuPro
4402 *
4403 * @license commercial software
4404 * @copyright (c) 2012 Codespot Software JSC - EMThemes.com. (http://www.emthemes.com)
4405 */
4406(function($) {
4407	function isMobileView() {
4408		return $(window).width() <= 767;
4409	};
4410	/**
4411	 * Make menu support on mobile
4412	 */
4413
4414	function mobile() {
4415		$('.em_nav').each(function(i) {
4416			var $nav = $('.hnav, .vnav', this);
4417			// prepend a.arrow into parent LI 
4418			var timeout = null;
4419			// bind event when click on a.arrow sliding to the sub menu horizontally
4420            $('a.arrow', $nav).bind(isWindowPhone ? 'mouseenter' : (isMobile ? 'click mouseenter' : 'click'), function(event) {
4421			//$('a.arrow', $nav).bind(isMobile ? 'click mouseenter' : 'click', function(event) {
4422				if (!isMobileView()) return;
4423				event.preventDefault();
4424				event.stopPropagation();
4425				var $li = $(this.parentNode);
4426				if (timeout) {
4427					clearTimeout(timeout);
4428				}
4429				if (!$li.hasClass('cur-toggle') && $('li.cur-toggle', $nav).length > 0 && !($li.parents('li.cur-toggle').length > 0)) {
4430					$('li.cur-toggle', $nav).each(function() {
4431						$(this).removeClass('cur-toggle');
4432						if ($(this).css('display') != 'none') {
4433							$(this).children('ul').slideToggle();
4434						}
4435					});
4436				}
4437				// fix bug event called twice cause menu sub menu showed even not clicked
4438				// don't know why it happens!!!
4439				$li.children('ul').slideToggle();
4440				if ($li.hasClass('cur-toggle')) $li.removeClass('cur-toggle');
4441				else if ($li.parents('li.cur-toggle').length == 0) $li.addClass('cur-toggle');
4442			});
4443		});
4444	};
4445
4446	function fixPc() {
4447		if ($(window).width() > 767) {
4448			$('.em_nav').each(function(i) {
4449				var $nav = $('.hnav, .vnav', this);
4450				//$('a.arrow', $nav).unbind(isMobile ? 'click mouseenter' : 'click');
4451				var $li = $(this.parentNode);
4452				$('li', $nav).each(function() {
4453					$(this).children('ul').css('display', '');
4454				});
4455			});
4456		}
4457	};
4458	/**
4459	 * Fix mega menu drop-down's container overflows the right edge of page.
4460	 *
4461	 * Should be called once when document ready
4462	 */
4463
4464	function fixMegaMenuOverflow() {
4465		function fix($container, $nav) {
4466			var pad = $nav.offset().left + $nav.outerWidth() - ($container.offset().left + $container.outerWidth());
4467			var pad2 = $container.offset().left + pad - $nav.offset().left;
4468			if (pad2 < 0) pad = pad - pad2;
4469			if (pad < 0) {
4470				$container.css('left', pad + 'px');
4471			}
4472		};
4473		$('.em_nav > .hnav > .menu-item-link > .menu-container').parent().hover(function() {
4474			var $container = $(this).children('.menu-container');
4475			if ($(this).hasClass('menu-item-depth-0')) $container.css('left', 0);
4476			var $nav = $(this).parents('.fix_menu').first();
4477			fix($container, $nav);
4478		}, function() {
4479			$(this).children('.menu-container').css('left', '');
4480		});
4481	};
4482
4483	function menuVertical() {
4484		if (!isPhone && $(window).width() > 767) {
4485			if ($('.vnav > .menu-item-link > .menu-container > li.fix-top').length > 0) {
4486				$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().parent().mouseover(function() {
4487					var $container = $(this).children('.menu-container,ul.level0');
4488					var $containerHeight = $container.outerHeight();
4489					var $containerTop = $container.offset().top;
4490					var $winHeight = $(window).height();
4491					var $maxHeight = $containerHeight + $containerTop;
4492					$setTop = $(this).parent().offset().top - $(this).offset().top;
4493					if (($setTop + $containerHeight) < $(this).height()) {
4494						$setTop = $(this).outerHeight() - $containerHeight;
4495					}
4496					var $grid = $(this).parents('.em_nav').first().parents().first();
4497					$container.css('top', $setTop);
4498					if ($maxHeight < $winHeight) {
4499						$('.vnav ul.level0,.vnav > .menu-item-link').children('.fix-top').parent('.menu-container').first().css('top', $setTop - 9 + 'px');
4500					}
4501				});
4502				$('.vnav ul.level0,.vnav > .menu-item-link').children('.fix-top').parent('.menu-container').parent().mouseout(function() {
4503					var $container = $(this).children('.menu-container,ul.level0');
4504					$container.removeAttr('style');
4505				});
4506			}
4507		} else {
4508			$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().parent().off('mouseover mouseon');
4509			$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().off('mouseover mouseon');
4510			$('.vnav .menu-item-link > .menu-container,.vnav ul.level0').parent().off('mouseover mouseon');
4511		}
4512	};
4513	var tm;
4514	$(document).ready(function() {
4515		$('.em_nav').each(function(i) {
4516			var $nav = $('.hnav, .vnav', this);
4517			$('.em-catalog-navigation li.parent, .menu-item-link.menu-item-parent', $nav).each(function() {
4518				$(this).prepend('<a href="javascript:void(0)" class="arrow"><span>&gt;</span></a>');
4519			});
4520		});
4521		menuVertical();
4522		clearTimeout(tm);
4523        if(disableResponsive!=1){
4524            tm = setTimeout(function() {
4525    			mobile();
4526    		}, 100);
4527        }		
4528		fixMegaMenuOverflow();
4529	});
4530    
4531	var temp;
4532	$(window).resize(function() {
4533	   if(disableResponsive!=1){
4534    		menuVertical();
4535    		clearTimeout(temp);
4536    		temp = setTimeout(function() {
4537    			fixPc();
4538    		}, 100);
4539    		fixMegaMenuOverflow();
4540        }
4541	});
4542    
4543})(jQuery);
4544(function(e){function h(){r.setAttribute("content",o);u=true}function p(){r.setAttribute("content",s);u=false}function d(t){c=t.accelerationIncludingGravity;a=Math.abs(c.x);f=Math.abs(c.y);l=Math.abs(c.z);if((!e.orientation||e.orientation===180)&&(a>7||(l>6&&f<8||l<8&&f>6)&&a>5)){if(u){p()}}else if(!u){h()}}var t=navigator.userAgent;if(!(/iPhone|iPad|iPod/.test(navigator.platform)&&/OS [1-5]_[0-9_]* like Mac OS X/i.test(t)&&t.indexOf("AppleWebKit")>-1)){return}var n=e.document;if(!n.querySelector){return}var r=n.querySelector("meta[name=viewport]"),i=r&&r.getAttribute("content"),s=i+",maximum-scale=1",o=i+",maximum-scale=10",u=true,a,f,l,c;if(!r){return}e.addEventListener("orientationchange",h,false);e.addEventListener("devicemotion",d,false)})(this);
4545(function(e){var t=function(){var t={},n,r=65,i,s='<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="btn btn-danger btn-xs colorpicker_submit" data-loading-text="Saving...">Save</div></div>',o={eventName:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},color:"ff0000",livePreview:true,flat:false},u=function(t,n){var r=q(t);e(n).data("colorpicker").fields.eq(1).val(r.r).end().eq(2).val(r.g).end().eq(3).val(r.b).end()},a=function(t,n){e(n).data("colorpicker").fields.eq(4).val(t.h).end().eq(5).val(t.s).end().eq(6).val(t.b).end()},f=function(t,n){e(n).data("colorpicker").fields.eq(0).val(U(t)).end()},l=function(t,n){e(n).data("colorpicker").selector.css("backgroundColor","#"+U({h:t.h,s:100,b:100}));e(n).data("colorpicker").selectorIndic.css({left:parseInt(150*t.s/100,10),top:parseInt(150*(100-t.b)/100,10)})},c=function(t,n){e(n).data("colorpicker").hue.css("top",parseInt(150-150*t.h/360,10))},h=function(t,n){e(n).data("colorpicker").currentColor.css("backgroundColor","#"+U(t))},p=function(t,n){e(n).data("colorpicker").newColor.css("backgroundColor","#"+U(t))},d=function(t){var n=t.charCode||t.keyCode||-1;if(n>r&&n<=90||n==32){return false}var i=e(this).parent().parent();if(i.data("colorpicker").livePreview===true){v.apply(this)}},v=function(t){var n=e(this).parent().parent(),r;if(this.parentNode.className.indexOf("_hex")>0){n.data("colorpicker").color=r=F(B(this.value))}else if(this.parentNode.className.indexOf("_hsb")>0){n.data("colorpicker").color=r=P({h:parseInt(n.data("colorpicker").fields.eq(4).val(),10),s:parseInt(n.data("colorpicker").fields.eq(5).val(),10),b:parseInt(n.data("colorpicker").fields.eq(6).val(),10)})}
4545else{n.data("colorpicker").color=r=I(H({r:parseInt(n.data("colorpicker").fields.eq(1).val(),10),g:parseInt(n.data("colorpicker").fields.eq(2).val(),10),b:parseInt(n.data("colorpicker").fields.eq(3).val(),10)}))}if(t){u(r,n.get(0));f(r,n.get(0));a(r,n.get(0))}l(r,n.get(0));c(r,n.get(0));p(r,n.get(0));n.data("colorpicker").onChange.apply(n,[r,U(r),q(r)])},m=function(t){var n=e(this).parent().parent();n.data("colorpicker").fields.parent().removeClass("colorpicker_focus")},g=function(){r=this.parentNode.className.indexOf("_hex")>0?70:65;e(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus");e(this).parent().addClass("colorpicker_focus")},y=function(t){var n=e(this).parent().find("input").focus();var r={el:e(this).parent().addClass("colorpicker_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:this.parentNode.className.indexOf("_hsb")>0?100:255,y:t.pageY,field:n,val:parseInt(n.val(),10),preview:e(this).parent().parent().data("colorpicker").livePreview};e(document).bind("mouseup",r,w);e(document).bind("mousemove",r,b)},b=function(e){e.data.field.val(Math.max(0,Math.min(e.data.max,parseInt(e.data.val+e.pageY-e.data.y,10))));if(e.data.preview){v.apply(e.data.field.get(0),[true])}return false},w=function(t){v.apply(t.data.field.get(0),[true]);t.data.el.removeClass("colorpicker_slider").find("input").focus();e(document).unbind("mouseup",w);e(document).unbind("mousemove",b);return false},E=function(t){var n={cal:e(this).parent(),y:e(this).offset().top};n.preview=n.cal.data("colorpicker").livePreview;e(document).bind("mouseup",n,x);e(document).bind("mousemove",n,S)},S=function(e){v.apply(e.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360*(150-Math.max(0,Math.min(150,e.pageY-e.data.y)))/150,10)).get(0),[e.data.preview]);return false},x=function(t){u(t.data.cal.data("colorpicker").color,t.data.cal.get(0));f(t.data.cal.data("colorpicker").color,t.data.cal.get(0));e(document).unbind("mouseup",x);e(document).unbind("mousemove",S);return false},T=function(t){var n={cal:e(this).parent(),pos:e(this).offset()};n.preview=n.cal.data("colorpicker").livePreview;e(document).bind("mouseup",n,C);e(document).bind("mousemove",n,N)},N=function(e){v.apply(e.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100*(150-Math.max(0,Math.min(150,e.pageY-e.data.pos.top)))/150,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(150,e.pageX-e.data.pos.left))/150,10)).get(0),[e.data.preview]);return false},C=function(t){u(t.data.cal.data("colorpicker").color,t.data.cal.get(0));f(t.data.cal.data("colorpicker").color,t.data.cal.get(0));e(document).unbind("mouseup",C);e(document).unbind("mousemove",N);return false},k=function(t){e(this).addClass("colorpicker_focus")},L=function(t){e(this).removeClass("colorpicker_focus")},A=function(t){var n=e(this).parent();var r=n.data("colorpicker").color;n.data("colorpicker").origColor=r;h(r,n.get(0));n.data("colorpicker").onSubmit(r,U(r),q(r),n.data("colorpicker").el)},O=function(t){var n=e("#"+e(this).data("colorpickerId"));n.data("colorpicker").onBeforeShow.apply(this,[n.get(0)]);var r=e(this).offset();var i=D();var s=r.top+this.offsetHeight;var o=r.left;if(s+176>i.t+i.h){s-=this.offsetHeight+176}if(o+356>i.l+i.w){o-=356}n.css({left:o+"px",top:s+"px"});if(n.data("colorpicker").onShow.apply(this,[n.get(0)])!=false){n.show()}e(document).bind("mousedown",{cal:n},M);return false},M=function(t){if(!_(t.data.cal.get(0),t.target,t.data.cal.get(0))){if(t.data.cal.data("colorpicker").onHide.apply(this,[t.data.cal.get(0)])!=false){t.data.cal.hide()}e(document).unbind("mousedown",M)}},_=function(e,t,n){if(e==t){return true}if(e.contains){return e.contains(t)}if(e.compareDocumentPosition){return!!(e.compareDocumentPosition(t)&16)}var r=t.parentNode;while(r&&r!=n){if(r==e)return true;r=r.parentNode}return false},D=function(){var e=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(e?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(e?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(e?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(e?document.documentElement.clientHeight:document.body.clientHeight)}},P=function(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}},H=function(e){return{r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}},B=function(e){var t=6-e.length;if(t>0){var n=[];for(var r=0;r<t;r++){n.push("0")}n.push(e);e=n.join("")}return e},j=function(e){var e=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:e>>16,g:(e&65280)>>8,b:e&255}},F=function(e){return I(j(e))},I=function(e){var t={h:0,s:0,b:0};var n=Math.min(e.r,e.g,e.b);var r=Math.max(e.r,e.g,e.b);var i=r-n;t.b=r;if(r!=0){}t.s=r!=0?255*i/r:0;if(t.s!=0){if(e.r==r){t.h=(e.g-e.b)/i}else if(e.g==r){t.h=2+(e.b-e.r)/i}else{t.h=4+(e.r-e.g)/i}}else{t.h=-1}t.h*=60;if(t.h<0){t.h+=360}t.s*=100/255;t.b*=100/255;return t},q=function(e){var t={};var n=Math.round(e.h);var r=Math.round(e.s*255/100);var i=Math.round(e.b*255/100);if(r==0){t.r=t.g=t.b=i}else{var s=i;var o=(255-r)*i/255;var u=(s-o)*(n%60)/60;if(n==360)n=0;if(n<60){t.r=s;t.b=o;t.g=o+u}else if(n<120){t.g=s;t.b=o;t.r=s-u}else if(n<180){t.g=s;t.r=o;t.b=o+u}else if(n<240){t.b=s;t.r=o;t.g=s-u}else if(n<300){t.b=s;t.g=o;t.r=o+u}else if(n<360){t.r=s;t.g=o;t.b=s-u}else{t.r=0;t.g=0;t.b=0}}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},R=function(t){var n=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];e.each(n,function(e,t){if(t.length==1){n[e]="0"+t}});return n.join("")},U=function(e){return R(q(e))},z=function(){var t=e(this).parent();var n=t.data("colorpicker").origColor;t.data("colorpicker").color=n;u(n,t.get(0));f(n,t.get(0));a(n,t.get(0));l(n,t.get(0));c(n,t.get(0));p(n,t.get(0))};return{init:function(t){t=e.extend({},o,t||{});if(typeof t.color=="string"){t.color=F(t.color)}else if(t.color.r!=undefined&&t.color.g!=undefined&&t.color.b!=undefined){t.color=I(t.color)}else if(t.color.h!=undefined&&t.color.s!=undefined&&t.color.b!=undefined){t.color=P(t.color)}else{return this}
4545return this.each(function(){if(!e(this).data("colorpickerId")){var n=e.extend({},t);n.origColor=t.color;var r="collorpicker_"+parseInt(Math.random()*1e3);e(this).data("colorpickerId",r);var i=e(s).attr("id",r);if(n.flat){i.appendTo(this).show()}else{i.appendTo(document.body)}n.fields=i.find("input").bind("keyup",d).bind("change",v).bind("blur",m).bind("focus",g);i.find("span").bind("mousedown",y).end().find(">div.colorpicker_current_color").bind("click",z);n.selector=i.find("div.colorpicker_color").bind("mousedown",T);n.selectorIndic=n.selector.find("div div");n.el=this;n.hue=i.find("div.colorpicker_hue div");i.find("div.colorpicker_hue").bind("mousedown",E);n.newColor=i.find("div.colorpicker_new_color");n.currentColor=i.find("div.colorpicker_current_color");i.data("colorpicker",n);i.find("div.colorpicker_submit").bind("mouseenter",k).bind("mouseleave",L).bind("click",A);u(n.color,i.get(0));a(n.color,i.get(0));f(n.color,i.get(0));c(n.color,i.get(0));l(n.color,i.get(0));h(n.color,i.get(0));p(n.color,i.get(0));if(n.flat){i.css({position:"relative",display:"block"})}else{e(this).bind(n.eventName,O)}}})},showPicker:function(){return this.each(function(){if(e(this).data("colorpickerId")){O.apply(this)}})},hidePicker:function(){return this.each(function(){if(e(this).data("colorpickerId")){e("#"+e(this).data("colorpickerId")).hide()}})},setColor:function(t){if(typeof t=="string"){t=F(t)}
4545else if(t.r!=undefined&&t.g!=undefined&&t.b!=undefined){t=I(t)}else if(t.h!=undefined&&t.s!=undefined&&t.b!=undefined){t=P(t)}else{return this}return this.each(function(){if(e(this).data("colorpickerId")){var n=e("#"+e(this).data("colorpickerId"));n.data("colorpicker").color=t;n.data("colorpicker").origColor=t;u(t,n.get(0));a(t,n.get(0));f(t,n.get(0));c(t,n.get(0));l(t,n.get(0));h(t,n.get(0));p(t,n.get(0))}})}}}();e.fn.extend({ColorPicker:t.init,ColorPickerHide:t.hidePicker,ColorPickerShow:t.showPicker,ColorPickerSetColor:t.setColor})})(jQuery);
4546/**
4547 * Galathemes
4548 *
4549 * @license commercial software
4550 * @copyright (c) 2014 Codespot Software JSC - Galathemes.com. (http://www.galathemes.com)
4551 */
4552jQuery(function($) {
4553	var variables = {};
4554	var panel = $('#demotool_variation').css({
4555		'left': '-100%',
4556		'position': 'absolute'
4557	});
4558	$('a.btn-toggle').click(function() {
4559		if (!panel.hasClass('show')) {
4560			$('.variation-cp').show();
4561			panel.css('top', Math.max($(document).scrollTop(), Math.min($(this).offset().top, $(document).scrollTop() + $(window).height() - panel.outerHeight())) + 'px').addClass('show').animate({
4562				'left': $(this).width() + 1 + 'px'
4563			});
4564		} else {
4565			panel.removeClass('show').animate({
4566				'left': -$(this).width() - panel.outerWidth() - 10 + 'px'
4567			}, 500, function() {
4568				$('.variation-cp').hide();
4569			});
4570		}
4571		return false;
4572	});
4573	// toogle section content-title
4574	$('#demotool_variation .content-title').click(function() {
4575		$(this).next('.wrapper-content').slideToggle('fast');
4576	}).trigger('click').first().trigger('click');
4577	// toggle box content
4578	$('#demotool_variation .box .title').click(function() {
4579		var box = $(this).parent();
4580		if (box.children('.content').is(':visible')) {
4581			box.children('.content').slideUp('fast');
4582			box.addClass('close');
4583		} else {
4584			box.children('.content').slideDown('fast');
4585			box.removeClass('close');
4586		}
4587	});
4588	// load google fonts
4589
4590    /* Box Wide Mode */
4591	$('#em_box_wide').change(function() {
4592		var mode = $('#em_box_wide').val();
4593		if (mode == 'box') {
4594			$('#emoption_wideslideshow').hide();
4595			$('#page_boxconfig').show();
4596			$('.wrapper').addClass('em-box-custom');
4597			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4598			if ($('.em_area01').parent().is("div.container")) {
4599				$(".em_area01").unwrap("<div class='container'></div>");
4600			}
4601			$('.em_area02').removeClass('em-wide-custom');
4602		} else {
4603			$('.wrapper').removeClass('em-box-custom');
4604			$('#emoption_wideslideshow').show();
4605			$('#page_boxconfig').hide();
4606			if ($('#wide_full').is(':checked')) {
4607				$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
4608				$(".em_area01").wrap("<div class='container'></div>");
4609				$('.em_area02').addClass('em-wide-custom');
4610			} else {
4611				$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4612				if ($('.em_area01').parent().is("div.container")) {
4613					$(".em_area01").unwrap("<div class='container'></div>");
4614				}
4615				$('.em_area02').removeClass('em-wide-custom');
4616			}
4617		}
4618	});
4619	$('#wide_full').change(function() {
4620		if ($('#wide_full').is(':checked')) {
4621			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
4622			$(".em_area01").wrap("<div class='container'></div>");
4623			$('.em_area02').addClass('em-wide-custom');
4624		} else {
4625			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4626			if ($('.em_area01').parent().is("div.container")) {
4627				$(".em_area01").unwrap("<div class='container'></div>");
4628			}
4629			$('.em_area02').removeClass('em-wide-custom');
4630		}
4631	});
4632	// reset
4633	$('#demotool_variation .reset-button').click(function() {
4634		$('#demotool_variation input[type=text], #demotool_variation select, #demotool_variation input[type=hidden]').val('').css('background-color', '');
4635		resetVariation();
4636		//box wide
4637		$('#em_box_wide').val(boxwide_selected);
4638		var mode = $('#em_box_wide').val();
4639		if (mode == 'box') {
4640			$('#emoption_wideslideshow').hide();
4641			$('#page_boxconfig').show();
4642			$('.wrapper').addClass('em-box-custom');
4643			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4644			if ($('.em_area01').parent().is("div.container")) {
4645				$(".em_area01").unwrap("<div class='container'></div>");
4646			}
4647			$('.em_area02').removeClass('em-wide-custom');
4648		} else {
4649			$('.wrapper').removeClass('em-box-custom');
4650			$('#emoption_wideslideshow').show();
4651			$('#page_boxconfig').hide();
4652			if ($('#wide_full').is(':checked')) {
4653				$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
4654				$(".em_area01").wrap("<div class='container'></div>");
4655				$('.em_area02').addClass('em-wide-custom');
4656			} else {
4657				$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4658				if ($('.em_area01').parent().is("div.container")) {
4659					$(".em_area01").unwrap("<div class='container'></div>");
4660				}
4661				$('.em_area02').removeClass('em-wide-custom');
4662			}
4663		}
4664		// slideshow
4665		if (fullSlideshow) {
4666			$('#wide_full').prop('checked', true); // Uncheck the checkbox
4667		} else {
4668			$('#wide_full').prop('checked', false);
4669		}
4670		if ($('#wide_full').is(':checked')) {
4671			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
4672			$('.em_area02').addClass('em-wide-custom');
4673		} else {
4674			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4675			$('.em_area02').removeClass('em-wide-custom');
4676		}
4677		return false;
4678	});
4679	// stripes pattern
4680	$('#demotool_variation a.page_bg_image').click(function() {
4681		$('#demotool_variation a.page_bg_image').removeClass('selected');
4682		$(this).addClass('selected');
4683		$('#demotool_variation input[name=page_bg_image]').val($(this).data('input-value'));
4684		changeVariation('@page_bg_image', $('#demotool_variation input[name=page_bg_image]').val());
4685		return false;
4686	});
4687	$('#demotool_variation a.header_bg_image').click(function() {
4688		$('#demotool_variation a.header_bg_image').removeClass('selected');
4689		$(this).addClass('selected');
4690		$('#demotool_variation input[name=header_bg_image]').val($(this).data('input-value'));
4691		changeVariation('@header_bg_image', $('#demotool_variation input[name=header_bg_image]').val());
4692		return false;
4693	});
4694	$('#demotool_variation a.body_bg_image').click(function() {
4695		$('#demotool_variation a.body_bg_image').removeClass('selected');
4696		$(this).addClass('selected');
4697		$('#demotool_variation input[name=body_bg_image]').val($(this).data('input-value'));
4698		changeVariation('@body_bg_image', $('#demotool_variation input[name=body_bg_image]').val());
4699		return false;
4700	});
4701	$('#demotool_variation a.footer_bg_image').click(function() {
4702		$('#demotool_variation a.footer_bg_image').removeClass('selected');
4703		$(this).addClass('selected');
4704		$('#demotool_variation input[name=footer_bg_image]').val($(this).data('input-value'));
4705		changeVariation('@footer_bg_image', $('#demotool_variation input[name=footer_bg_image]').val());
4706		return false;
4707	});
4708	changeVariation = function(key, value) {
4709		var key = key || null;
4710		var value = value || null;
4711		var temp = {};
4712		if (key) {
4713			if (String(value).indexOf(',') != -1 || String(value).indexOf('.') != -1 || String(value).indexOf('/') != -1 || String(value).indexOf(' ') != -1) variables[key] = '~"' + String(value.replace(/"/g, "'")) + '"';
4714			else
4715			variables[key] = String(value);
4716		}
4717		less.modifyVars(variables);
4718	}; /*return default value when input value is null*/
4719	returnDefault = function(key) {
4720		if (variables[key]) delete(variables[key]);
4721		less.modifyVars(variables);
4722	};
4722 /*reset Variation*/
4723	resetVariation = function() {
4724		variables = {};
4725		less.refresh();
4726	};
4727	$('.color-picker').ColorPicker({
4728		onSubmit: $.throttle(300, function(hsb, hex, rgb, el) {
4729			$(el).val('#' + hex);
4730			$(el).css('backgroundColor', '#' + hex);
4731			//$(el).ColorPickerHide();
4732		}),
4733		onChange: $.debounce(300, function(hsb, hex) {
4734			var el = this.data('colorpicker').el;
4735			$(el).val('#' + hex);
4736			$(el).css('backgroundColor', '#' + hex);
4737			changeVariation('@' + $(el).attr('name'), $(el).val());
4738		}),
4739		onBeforeShow: function() {
4740			$(this).ColorPickerSetColor(this.value);
4741		}
4742	}).bind('keyup', $.debounce(300, function() {
4743		$(this).ColorPickerSetColor(this.value);
4744		if ($(this).val() == "") {
4745			$(this).css('background-color', '');
4746			returnDefault('@' + $(this).attr('name'));
4747		}
4748	}));
4749	$('.colorpicker_submit').click(function() {
4750		var btn = $(this);
4751		var tm;
4752		clearTimeout(tm);
4753		btn.button('loading');
4754		tm = setTimeout(function() {
4755			btn.button('reset');
4756		}, 1000);
4757	});
4758	$('#demotool_variation input.input-text').blur(function(e) {
4759		if ($(this).val() != "") {
4760			changeVariation('@' + $(this).attr('name'), $(this).val());
4761		}
4762	});
4763	$('#demotool_variation input.input-text').bind('keyup', function(e, hbs, hex) {
4764		if ($(this).val() == "") {
4765			returnDefault('@' + $(this).attr('name'));
4766		} else {
4767			if (e.keyCode == 13) {
4768				changeVariation('@' + $(this).attr('name'), $(this).val());
4769			}
4770		}
4771	});
4772	//box wide
4773	var mode = $('#em_box_wide').val();
4774	if (mode == 'box') {
4775		$('#emoption_wideslideshow').hide();
4776		$('#page_boxconfig').show();
4777		$('.wrapper').addClass('em-box-custom');
4778		$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4779		if ($('.em_area01').parent().is("div.container")) {
4780			$(".em_area01").unwrap("<div class='container'></div>");
4781		}
4782		$('.em_area02').removeClass('em-wide-custom');
4783	} else {
4784		$('.wrapper').removeClass('em-box-custom');
4785		$('#emoption_wideslideshow').show();
4786		$('#page_boxconfig').hide();
4787		if ($('#wide_full').is(':checked')) {
4788			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
4789			$(".em_area01").wrap("<div class='container'></div>");
4790			$('.em_area02').addClass('em-wide-custom');
4791		} else {
4792			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
4793			if ($('.em_area01').parent().is("div.container")) {
4794				$(".em_area01").unwrap("<div class='container'></div>");
4795			}
4796			$('.em_area02').removeClass('em-wide-custom');
4797		}
4798	}
4799});
4800(function($) {
4801	$.fn.selectUl = function() {
4802		var config = {
4803			over: function() {
4804				if ($(this).parent().children().length > 1) {
4805					$(this).parent().children('.toolbar-dropdown').children('ul').addClass('over');
4806				} else {
4807					$(this).addClass('over');
4808					// $('.toolbar-dropdown', this).css({width: $(this).width()+50});
4809				}
4810				$(this).parent().children('.toolbar-dropdown').children('ul').animate({
4811					opacity: 1,
4812					height: 'toggle'
4813				}, 100);
4814				//$('.toolbar-dropdown ul', this).animate({opacity:1, height:'toggle'}, 100);
4815			},
4816			timeout: 0,
4817			// number = milliseconds delay before onMouseOut
4818			out: function() {
4819				var that = this;
4820				$(this).parent().children('.toolbar-dropdown').children('ul').animate({
4821					opacity: 0,
4822					height: 'toggle'
4823				}, 100, function() {
4824					if ($(this).parent().children().length > 1) {
4825						$(that).parent().children('.toolbar-dropdown').children('ul').removeClass('over');
4826					} else {
4827						$(that).removeClass('over');
4828					}
4829				});
4830			}
4831		};
4832		$('.toolbar-title select').css('display', 'none');
4833		$('.toolbar-switch .toolbar-dropdown .current, .toolbar-switch .toolbar-dropdown').hoverIntent(config);
4834	};
4835	$.fn.insertUl = function() {
4836		var numOptions = $(this).children().length;
4837		$('<div class="toolbar-dropdown"><span class="current"/><ul style="display:none" /></div>').insertAfter($(this).toggleClass('.toolbar-switch').parent());
4838		var divSpan = $(this).toggleClass('toolbar-switch').parent().parent().find('span');
4839		divSpan.append($(this).parent().children('select').find('option:selected').text());
4840		var divUl = $(this).toggleClass('toolbar-switch').parent().parent().find('ul');
4841		for (var i = 0; i < numOptions; i++) {
4842			var text = '<li><a href ="' + $(this).find('option').eq(i).val() + '">' + $(this).find('option').eq(i).text() + '</a></li>';
4843			//$('<li />').text(text).appendTo(divUl);
4844			divUl.append(text);
4845		}
4846	};
4847	$.fn.insertUlLanguage = function() {
4848		var numOptions = $(this).children().length;
4849		$('<div class="toolbar-dropdown"><span class="current"/><ul style="display:none" /></div>').insertAfter($(this).toggleClass('.toolbar-switch').parent());
4850		var divSpan = $(this).toggleClass('toolbar-switch').parent().parent().find('span');
4851		divSpan.append($(this).parent().children('select').find('option:selected').text());
4852		imageUrl = language + ($(this).find('option').eq(i).text()).toLowerCase() + '.png';
4853		divSpan.css('background-image', 'url(' + language + ($(this).parent().children('select').find('option:selected').text()).toLowerCase() + '.png)');
4854		divSpan.css('background-repeat', 'no-repeat');
4855		var divUl = $(this).toggleClass('toolbar-switch').parent().parent().find('ul');
4856		for (var i = 0; i < numOptions; i++) {
4857			var text = '<li><a style="background-image:url(' + language + ($(this).find('option').eq(i).text()).toLowerCase() + '.png); background-repeat: no-repeat;" href ="' + $(this).find('option').eq(i).val() + '">' + $(this).find('option').eq(i).text() + '</a></li>';
4858			divUl.append(text);
4859		}
4860	};
4861})(jQuery);
4862(function(){var e=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++){if(t in this&&this[t]===e)return t}return-1},t=[].slice;(function(e,t){if(typeof define==="function"&&define.amd){return define("waypoints",["jquery"],function(n){return t(n,e)})}else{return t(e.jQuery,e)}})(this,function(n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;i=n(r);c=e.call(r,"ontouchstart")>=0;u={horizontal:{},vertical:{}};a=1;l={};f="waypoints-context-id";d="resize.waypoints";v="scroll.waypoints";m=1;g="waypoints-waypoint-ids";y="waypoint";b="waypoints";s=function(){function e(e){var t=this;this.$element=e;this.element=e[0];this.didResize=false;this.didScroll=false;this.id="context"+a++;this.oldScroll={x:e.scrollLeft(),y:e.scrollTop()};this.waypoints={horizontal:{},vertical:{}};this.element[f]=this.id;l[this.id]=this;e.bind(v,function(){var e;if(!(t.didScroll||c)){t.didScroll=true;e=function(){t.doScroll();return t.didScroll=false};return r.setTimeout(e,n[b].settings.scrollThrottle)}});e.bind(d,function(){var e;if(!t.didResize){t.didResize=true;e=function(){n[b]("refresh");return t.didResize=false};return r.setTimeout(e,n[b].settings.resizeThrottle)}})}e.prototype.doScroll=function(){var e,t=this;e={horizontal:{newScroll:this.$element.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.$element.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};if(c&&(!e.vertical.oldScroll||!e.vertical.newScroll)){n[b]("refresh")}n.each(e,function(e,r){var i,s,o;o=[];s=r.newScroll>r.oldScroll;i=s?r.forward:r.backward;n.each(t.waypoints[e],function(e,t){var n,i;if(r.oldScroll<(n=t.offset)&&n<=r.newScroll){return o.push(t)}else if(r.newScroll<(i=t.offset)&&i<=r.oldScroll){return o.push(t)}});o.sort(function(e,t){return e.offset-t.offset});if(!s){o.reverse()}return n.each(o,function(e,t){if(t.options.continuous||e===o.length-1){return t.trigger([i])}})});return this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}};e.prototype.refresh=function(){var e,t,r,i=this;r=n.isWindow(this.element);t=this.$element.offset();this.doScroll();e={horizontal:{contextOffset:r?0:t.left,contextScroll:r?0:this.oldScroll.x,contextDimension:this.$element.width(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:r?0:t.top,contextScroll:r?0:this.oldScroll.y,contextDimension:r?n[b]("viewportHe
4862ight"):this.$element.height(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};return n.each(e,function(e,t){return n.each(i.waypoints[e],function(e,r){var i,s,o,u,a;i=r.options.offset;o=r.offset;s=n.isWindow(r.element)?0:r.$element.offset()[t.offsetProp];if(n.isFunction(i)){i=i.apply(r.element)}else if(typeof i==="string"){i=parseFloat(i);if(r.options.offset.indexOf("%")>-1){i=Math.ceil(t.contextDimension*i/100)}}r.offset=s-t.contextOffset+t.contextScroll-i;if(r.options.onlyOnScroll&&o!=null||!r.enabled){return}if(o!==null&&o<(u=t.oldScroll)&&u<=r.offset){return r.trigger([t.backward])}else if(o!==null&&o>(a=t.oldScroll)&&a>=r.offset){return r.trigger([t.forward])}else if(o===null&&t.oldScroll>=r.offset){return r.trigger([t.forward])}})})};e.prototype.checkEmpty=function(){if(n.isEmptyObject(this.waypoints.horizontal)&&n.isEmptyObject(this.waypoints.vertical)){this.$element.unbind([d,v].join(" "));return delete l[this.id]}};return e}();o=function(){function e(e,t,r){var i,s;r=n.extend({},n.fn[y].defaults,r);if(r.offset==="bottom-in-view"){r.offset=function(){var e;e=n[b]("viewportHeight");if(!n.isWindow(t.element)){e=t.$element.height()}return e-n(this).outerHeight()}}this.$element=e;this.element=e[0];this.axis=r.horizontal?"horizontal":"vertical";this.callback=r.handler;this.context=t;this.enabled=r.enabled;this.id="waypoints"+m++;this.offset=null;this.options=r;t.waypoints[this.axis][this.id]=this;u[this.axis][this.id]=this;i=(s=this.element[g])!=null?s:[];i.push(this.id);this.element[g]=i}e.prototype.trigger=function(e){if(!this.enabled){return}if(this.callback!=null){this.callback.apply(this.element,e)}if(this.options.triggerOnce){return this.destroy()}};e.prototype.disable=function(){return this.enabled=false};e.prototype.enable=function(){this.context.refresh();return this.enabled=true};e.prototype.destroy=function(){delete u[this.axis][this.id];delete this.context.waypoints[this.axis][this.id];return this.context.checkEmpty()};e.getWaypointsByElement=function(e){var t,r;r=e[g];if(!r){return[]}t=n.extend({},u.horizontal,u.vertical);return n.map(r,function(e){return t[e]})};return e}();p={init:function(e,t){var r;if(t==null){t={}}if((r=t.handler)==null){t.handler=e}this.each(function(){var e,r,i,u;e=n(this);i=(u=t.context)!=null?u:n.fn[y].defaults.context;if(!n.isWindow(i)){i=e.closest(i)}i=n(i);r=l[i[0][f]];if(!r){r=new s(i)}return new o(e,r,t)});n[b]("refresh");return this},disable:function(){return p._invoke.call(this,"disable")},enable:function(){return p._invoke.call(this,"enable")},destroy:function(){return p._invoke.call(this,"destroy")},prev:function(e,t){return p._traverse.call(this,e,t,function(e,t,n){if(t>0){return e.push(n[t-1])}})},next:function(e,t){return p._traverse.call(this,e,t,function(e,t,n){if(t<n.length-1){return e.push(n[t+1])}})},_traverse:function(e,t,i){var s,o;if(e==null){e="vertical"}if(t==null){t=r}o=h.aggregate(t);s=[];this.each(function(){var t;t=n.inArray(this,o[e]);return i(s,t,o[e])});return this.pushStack(s)},_invoke:function(e){this.each(function(){var t;t=o.getWaypointsByElement(this);return n.each(t,function(t,n){n[e]();return true})});return this}};n.fn[y]=function(){var e,r;r=arguments[0],e=2<=arguments.length?t.call(arguments,1):[];if(p[r]){return p[r].apply(this,e)}else if(n.isFunction(r)){return p.init.apply(this,arguments)}else if(n.isPlainObject(r)){return p.init.apply(this,[null,r])}else if(!r){return n.error("jQuery Waypoints needs a callback function or handler option.")}else{return n.error("The "+r+" method does not exist in jQuery Waypoints.")}};n.fn[y].defaults={context:r,continuous:true,enabled:true,horizontal:false,offset:0,triggerOnce:false};h={refresh:function(){return n.each(l,function(e,t){return t.refresh()})},viewportHeight:function(){var e;
4862return(e=r.innerHeight)!=null?e:i.height()},aggregate:function(e){var t,r,i;t=u;if(e){t=(i=l[n(e)[0][f]])!=null?i.waypoints:void 0}if(!t){return[]}r={horizontal:[],vertical:[]};n.each(r,function(e,i){n.each(t[e],function(e,t){return i.push(t)});i.sort(function(e,t){return e.offset-t.offset});r[e]=n.map(i,function(e){return e.element});return r[e]=n.unique(r[e])});return r},above:function(e){if(e==null){e=r}return h._filter(e,"vertical",function(e,t){return t.offset<=e.oldScroll.y})},below:function(e){if(e==null){e=r}return h._filter(e,"vertical",function(e,t){return t.offset>e.oldScroll.y})},left:function(e){if(e==null){e=r}return h._filter(e,"horizontal",function(e,t){return t.offset<=e.oldScroll.x})},right:function(e){if(e==null){e=r}return h._filter(e,"horizontal",function(e,t){return t.offset>e.oldScroll.x})},enable:function(){return h._invoke("enable")},disable:function(){return h._invoke("disable")},destroy:function(){return h._invoke("destroy")},extendFn:function(e,t){return p[e]=t},_invoke:function(e){var t;t=n.extend({},u.vertical,u.horizontal);return n.each(t,function(t,n){n[e]();return true})},_filter:function(e,t,r){var i,s;i=l[n(e)[0][f]];if(!i){return[]}s=[];n.each(i.waypoints[t],function(e,t){if(r(i,t)){return s.push(t)}});s.sort(function(e,t){return e.offset-t.offset});return n.map(s,function(e){return e.element})}};n[b]=function(){var e,n;n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[];if(h[n]){return h[n].apply(null,e)}else{return h.aggregate.call(null,n)}};n[b].settings={resizeThrottle:100,scrollThrottle:30};return i.load(function(){return n[b]("refresh")})})}).call(this);
4863function ssc_init(){if(!document.body)return;var e=document.body;var t=document.documentElement;var n=window.innerHeight;var r=e.scrollHeight;ssc_root=document.compatMode.indexOf("CSS")>=0?t:e;ssc_activeElement=e;ssc_initdone=true;if(top!=self){ssc_frame=true}else if(r>n&&(e.offsetHeight<=n||t.offsetHeight<=n)){ssc_root.style.height="auto";if(ssc_root.offsetHeight<=n){var i=document.createElement("div");i.style.clear="both";e.appendChild(i)}}if(!ssc_fixedback){e.style.backgroundAttachment="scroll";t.style.backgroundAttachment="scroll"}if(ssc_keyboardsupport){ssc_addEvent("keydown",ssc_keydown)}}function ssc_scrollArray(e,t,n,r){r||(r=1e3);ssc_directionCheck(t,n);ssc_que.push({x:t,y:n,lastX:t<0?.99:-.99,lastY:n<0?.99:-.99,start:+(new Date)});if(ssc_pending){return}var i=function(){var s=+(new Date);var o=0;var u=0;for(var a=0;a<ssc_que.length;a++){var f=ssc_que[a];var l=s-f.start;var c=l>=ssc_animtime;var h=c?1:l/ssc_animtime;if(ssc_pulseAlgorithm){h=ssc_pulse(h)}var p=f.x*h-f.lastX>>0;var d=f.y*h-f.lastY>>0;o+=p;u+=d;f.lastX+=p;f.lastY+=d;if(c){ssc_que.splice(a,1);a--}}if(t){var v=e.scrollLeft;e.scrollLeft+=o;if(o&&e.scrollLeft===v){t=0}}if(n){var m=e.scrollTop;e.scrollTop+=u;if(u&&e.scrollTop===m){n=0}}if(!t&&!n){ssc_que=[]}if(ssc_que.length){setTimeout(i,r/ssc_framerate+1)}else{ssc_pending=false}};setTimeout(i,0);ssc_pending=true}function ssc_wheel(e){if(!ssc_initdone){ssc_init()}var t=e.target;var n=ssc_overflowingAncestor(t);if(!n||e.defaultPrevented||ssc_isNodeName(ssc_activeElement,"embed")||ssc_isNodeName(t,"embed")&&/\.pdf/i.test(t.src)){return true}var r=e.wheelDeltaX||0;var i=e.wheelDeltaY||0;if(!r&&!i){i=e.wheelDelta||0}if(Math.abs(r)>1.2){r*=ssc_stepsize/120}if(Math.abs(i)>1.2){i*=ssc_stepsize/120}ssc_scrollArray(n,-r,-i);e.preventDefault()}function ssc_keydown(e){var t=e.target;var n=e.ctrlKey||e.altKey||e.metaKey;if(/input|textarea|embed/i.test(t.nodeName)||t.isContentEditable||e.defaultPrevented||n){return true}if(ssc_isNodeName(t,"button")&&e.keyCode===ssc_key.spacebar){return true}var r,i=0,s=0;var o=ssc_overflowingAncestor(ssc_activeElement);var u=o.clientHeight;if(o==document.body){u=window.innerHeight}switch(e.keyCode){case ssc_key.up:s=-ssc_arrowscroll;break;case ssc_key.down:s=ssc_arrowscroll;break;case ssc_key.spacebar:r=e.shiftKey?1:-1;s=-r*u*.9;break;case ssc_key.pageup:s=-u*.9;break;case ssc_key.pagedown:s=u*.9;break;case ssc_key.home:s=-o.scrollTop;break;case ssc_key.end:var a=o.scrollHeight-o.scrollTop-u;s=a>0?a+10:0;break;case ssc_key.left:i=-ssc_arrowscroll;break;case ssc_key.right:i=ssc_arrowscroll;break;default:return true}ssc_scrollArray(o,i,s);e.preventDefault()}function ssc_mousedown(e){ssc_activeElement=e.target}
4863function ssc_setCache(e,t){for(var n=e.length;n--;)ssc_cache[ssc_uniqueID(e[n])]=t;return t}function ssc_overflowingAncestor(e){var t=[];var n=ssc_root.scrollHeight;do{var r=ssc_cache[ssc_uniqueID(e)];if(r){return ssc_setCache(t,r)}t.push(e);if(n===e.scrollHeight){if(!ssc_frame||ssc_root.clientHeight+10<n){return ssc_setCache(t,document.body)}}else if(e.clientHeight+10<e.scrollHeight){overflow=getComputedStyle(e,"").getPropertyValue("overflow");if(overflow==="scroll"||overflow==="auto"){return ssc_setCache(t,e)}}}while(e=e.parentNode)}function ssc_addEvent(e,t,n){window.addEventListener(e,t,n||false)}function ssc_removeEvent(e,t,n){window.removeEventListener(e,t,n||false)}function ssc_isNodeName(e,t){return e.nodeName.toLowerCase()===t.toLowerCase()}function ssc_directionCheck(e,t){e=e>0?1:-1;t=t>0?1:-1;if(ssc_direction.x!==e||ssc_direction.y!==t){ssc_direction.x=e;ssc_direction.y=t;ssc_que=[]}}function ssc_pulse_(e){var t,n,r;e=e*ssc_pulseScale;if(e<1){t=e-(1-Math.exp(-e))}else{n=Math.exp(-1);e-=1;r=1-Math.exp(-e);t=n+r*(1-n)}return t*ssc_pulseNormalize}function ssc_pulse(e){if(e>=1)return 1;if(e<=0)return 0;if(ssc_pulseNormalize==1){ssc_pulseNormalize/=ssc_pulse_(1)}return ssc_pulse_(e)}var ssc_framerate=150;var ssc_animtime=500;var ssc_stepsize=150;var ssc_pulseAlgorithm=true;var ssc_pulseScale=6;var ssc_pulseNormalize=1;var ssc_keyboardsupport=true;var ssc_arrowscroll=50;var ssc_frame=false;var ssc_direction={x:0,y:0};var ssc_initdone=false;var ssc_fixedback=true;var ssc_root=document.documentElement;var ssc_activeElement;var ssc_key={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36};var ssc_que=[];var ssc_pending=false;var ssc_cache={};setInterval(function(){ssc_cache={}},10*1e3);var ssc_uniqueID=function(){var e=0;return function(t){return t.ssc_uniqueID||(t.ssc_uniqueID=e++)}}();var ischrome=/chrome/.test(navigator.userAgent.toLowerCase());if(false){ssc_addEvent("mousedown",ssc_mousedown);ssc_addEvent("mousewheel",ssc_wheel);ssc_addEvent("load",ssc_init)};
4864/**
4865 * Galathemes
4866 *
4867 * @license commercial software
4868 * @copyright (c) 2014 Codespot Software JSC - Galathemes.com. (http://www.galathemes.com)
4869 */
4870var timeout = null;
4871var touch = false;
4872var animate = false;
4873(function($) {
4874	if (typeof EM == 'undefined') EM = {};
4875	if (typeof EM.tools == 'undefined') EM.tools = {};
4876	var domLoaded = false;
4877	var windowLoaded = false;
4878	/**
4879	 *   Add class mobile
4880	 **/
4881
4882	function addClassMobile() {
4883		if (isMobile) {
4884			$('body').addClass('mobile-view');
4885		}
4886	};
4887	/**
4888	 * Fix iPhone/iPod auto zoom-in when text fields, select boxes are focus
4889	 */
4890
4891	function fixIPhoneAutoZoomWhenFocus() {
4892		var viewport = $('head meta[name=viewport]');
4893		if (viewport.length == 0) {
4894			$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1.0"/>');
4895			viewport = $('head meta[name=viewport]');
4896		}
4897		var old_content = viewport.attr('content');
4898
4899		function zoomDisable() {
4900			viewport.attr('content', old_content + ', user-scalable=0');
4901		}
4902
4903		function zoomEnable() {
4904			viewport.attr('content', old_content);
4905		}
4906		$("input[type=text], textarea, select").mouseover(zoomDisable).mousedown(zoomEnable);
4907	}; /* hover language currency */
4908
4909	function hoverUl() {
4910		if (!isMobile) {
4911			$('#select-language').each(function() {
4912				$(this).insertUlLanguage();
4913				$(this).selectUl();
4914			});
4915			$('.currency').each(function() {
4916				$(this).insertUl();
4917				$(this).selectUl();
4918			});
4919			$('#select-store').each(function() {
4920				$(this).insertUl();
4921				$(this).selectUl();
4922			});
4923		}
4924	}; /* Menu Left */
4925
4926	function doMenuLeft() {
4927		var wi = $(window).width();
4928		if (isHomePage == 1 || pos_menuleft == true) {
4929			$('.all_categories').attr('id', 'menuleftTextHomepage');
4930			$('#menu-default').css('display', 'block');
4931		} else {
4932			$('.all_categories').attr('id', 'menuleftText');
4933			$('#menu-default').css('display', 'none');
4934		}
4935		var container = $("#menu-default");
4936		if (disableResponsive != 1) {
4937			if ((!isPhone) && (wi > 767)) {
4938				$("#menuleftText,#menuleftTextHomepage").unbind("click");
4939				$(".menu-wrapper").unbind('hover');
4940				container.show();
4941				if (!($("body").hasClass("cms-index-index"))) {
4942					container.hide();
4943					$(".menu-wrapper").hover(
4944
4945					function() {
4946						container.fadeIn(500);
4947						$("#menuleftText").toggleClass('hidden-arrow');
4948						$("#menuleftText").attr('title', 'hide-option');
4949					}, function() {
4950						container.fadeOut(100);
4951						$("#menuleftText").removeClass('hidden-arrow');
4952						$("#menuleftText").attr('title', 'show-option');
4953					});
4954				}
4955			} else {
4956				$("#menu-default").css("display", "none");
4957				$(".menu-wrapper").unbind('hover');
4958				$("#menuleftText,#menuleftTextHomepage").unbind("click");
4959				$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
4960				$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
4961				$("#menuleftText,#menuleftTextHomepage").click(
4962
4963				function(event) {
4964					event.preventDefault();
4965					if (container.is(":visible")) {
4966						container.hide();
4967						$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
4968						$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
4969					} else {
4970						container.show();
4971						$("#menuleftText,#menuleftTextHomepage").toggleClass('hidden-arrow');
4972						$("#menuleftText,#menuleftTextHomepage").attr('title', 'hide-option');
4973					}
4974				});
4975			}
4976		} else {
4977            if(!isMobile){
4978    			$("#menuleftText,#menuleftTextHomepage").unbind("click");
4979    			$(".menu-wrapper").unbind('hover');
4980    			container.show();
4981    			if (!($("body").hasClass("cms-index-index"))) {
4982    				container.hide();
4983    				$(".menu-wrapper").hover(
4984    
4985    				function() {
4986    					container.fadeIn(500);
4987    					$("#menuleftText").toggleClass('hidden-arrow');
4988    					$("#menuleftText").attr('title', 'hide-option');
4989    				}, function() {
4990    					container.fadeOut(100);
4991    					$("#menuleftText").removeClass('hidden-arrow');
4992    					$("#menuleftText").attr('title', 'show-option');
4993    				});
4994    			}
4995            }else{
4996    			container.show();
4997    			if (!($("body").hasClass("cms-index-index"))) {
4998    				container.hide();
4999    				$("#menuleftText,#menuleftTextHomepage").click(
5000
5001    				function(event) {
5002    					event.preventDefault();
5003    					if (container.is(":visible")) {
5004    						container.hide();
5005    						$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
5006    						$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
5007    					} else {
5008    						container.show();
5009    						$("#menuleftText,#menuleftTextHomepage").toggleClass('hidden-arrow');
5010    						$("#menuleftText,#menuleftTextHomepage").attr('title', 'hide-option');
5011    					}
5012    				});
5013    			}
5014            }
5015		}
5016	};
5017
5018	function persistentMenu() {
5019		if (FREEZED_TOP_MENU != 0 && !isPhone) {
5020			var sticky_navigation = function() {
5021				var scroll_top = $(window).scrollTop();
5022				var navpos = $('#navpos').offset().top;
5023				if ($(window).width() > 767) {
5024					if (scroll_top > navpos) {
5025						$('.header-bottom-right').addClass('navbar-fixed-top');
5026					} else {
5027						$('.header-bottom-right').removeClass('navbar-fixed-top');
5028					}
5029				} else {
5030					$('.header-bottom-right').removeClass('navbar-fixed-top');
5031				}
5032			};
5033			$(window).scroll(function() {
5034				sticky_navigation();
5035			});
5036		}
5037		if ($(window).width() <= 767) {
5038			$('.header-bottom-right').removeClass('navbar-fixed-top');
5039		}
5040	};
5041    
5042    function freezedMenuNoResponsive(){
5043        if (FREEZED_TOP_MENU != 0 && !isPhone) {
5044			var sticky_navigation = function() {
5045				var scroll_top = $(window).scrollTop();
5046				var navpos = $('#navpos').offset().top;
5047				if (scroll_top > navpos) {
5048					$('.header-bottom-right').addClass('navbar-fixed-top');
5049				} else {
5050					$('.header-bottom-right').removeClass('navbar-fixed-top');
5051				}
5052			};
5053			$(window).scroll(function() {
5054				sticky_navigation();
5055			});
5056		}
5057		if (isMobile) {
5058			$('.header-bottom-right').removeClass('navbar-fixed-top');
5059		}
5060    };
5061	// Back to top
5062
5063	function backToTop() {
5064		// hide #back-top first
5065		$("#back-top").hide();
5066		// fade in #back-top
5067		if (!isMobile) {
5068			$(window).scroll(function() {
5069				if ($(this).scrollTop() > 100) {
5070					$('#back-top').fadeIn();
5071				} else {
5072					$('#back-top').fadeOut();
5073				}
5074			});
5075			// scroll body to 0px on click
5076			$('#back-top a').click(function() {
5077				$('body,html').animate({
5078					scrollTop: 0
5079				}, 800);
5080				return false;
5081			});
5082		}
5083	};
5084	
5085/**
5086	 Tab On Details Page
5087	 */
5088
5089	function decorateProductCollateralTabs() {
5090		if ($('.box-collateral').length > 1) {
5091			$('.product-collateral').each(function(i) {
5092				$(this).wrap('<div class="tabs_wrapper_detail collateral_wrapper" />');
5093				$(this).prepend('<ul class="tabs_control"></ul>');
5094				$(this).children(".product-collateral-item").addClass("ui-slider-tabs-content-container");
5095				$('.box-collateral', this).addClass('tab-item').each(function(j) {
5096					var id = 'box_collateral_' + i + '_' + j;
5097					$(this).addClass('content_' + id);
5098					$(this).attr('id', id);
5099					$('.tabs_wrapper_detail ul.tabs_control').append('<li><a href="#' + id + '">' + $('h2', this).html() + '</a></li>');
5100				});
5101				$("div.tabs_wrapper_detail .product-collateral").sliderTabs();
5102			});
5103		}
5104	};
5105
5106/**
5107 *   showReviewTab
5108	 **/
5109
5110	function showReviewList() {
5111		if (jQuery('#customer_review_list').size()) {
5112			// scroll to customer review
5113			jQuery('html, body').animate({
5114				scrollTop: jQuery('#customer_review_list').offset().top
5115			}, 500);
5116		} else {
5117			return false;
5118		}
5119		return true;
5120	};
5121
5122	function showReviewForm() {
5123		if (jQuery('#customer_review_form').size()) {
5124			// scroll to customer review
5125			jQuery('html, body').animate({
5126				scrollTop: jQuery('#customer_review_form').offset().top
5127			}, 500);
5128		} else {
5129			return false;
5130		}
5131		return true;
5132	};
5133
5134	function setupReviewLink() {
5135		jQuery('.product-view .product-essential .link_review_list').click(function(e) {
5136			if (showReviewList()) {
5137				e.preventDefault();
5138			}
5139		});
5140		jQuery('.product-view .product-essential .link_review_form').click(function(e) {
5141			if (showReviewForm()) {
5142				e.preventDefault();
5143			}
5144		});
5145	};
5146	/**
5147	 Do Slider
5148	 */
5149
5150	function doSlider($e, $move, $circular, $direction) {
5151		if ($($e + ' ul > li').size() > 1) {
5152			$($e + ' > ul').addClass('slides');
5153			$($e).csslider({
5154				move: $move,
5155				circular: $circular,
5156				direction: $direction,
5157				parentHidden: 'div.slider'
5158			});
5159		}
5160	}; /* Store Switcher */
5161
5162	function toogleStore() {
5163		if (!isMobile) {
5164			doSlider('#slider_storeview', 1, 0, 'horizontal');
5165			$('.storediv').hide();
5166			$(".btn_storeview").click(function() {
5167				store_show();
5168			});
5169			$(".btn_storeclose").click(function() {
5170				store_hide();
5171			});
5172
5173			function store_show() {
5174				var bg = $("#bg_fade_color");
5175				bg.css("opacity", 0.5);
5176				bg.css("display", "block");
5177				var top = ($(window).height() - $(".storediv").height()) / 2;
5178				var left = ($(window).width() - $(".storediv").width()) / 2;
5179				$(".storediv").show();
5180				$(".storediv").css('top', top + 'px');
5181				$(".storediv").css('left', left + 'px');
5182			};
5183
5184			function store_hide() {
5185				var bg = $("#bg_fade_color");
5186				$(".storediv").hide();
5187				bg.css("opacity", 0);
5188				bg.css("display", "none");
5189			};
5190		}
5191	};
5192
5193	function qrCode() {
5194		$('#qr_code .qr_code_name a').mouseover(function(e) {
5195			var $img = $('img', this);
5196			$img.css({
5197				'display': 'block'
5198			}).attr('src', $img.data('originalImg'));
5199			var parent = $img.offsetParent().offset();
5200			//var left = e.pageX - parent.left + 15;
5201			var top = e.pageY - parent.top + 15;
5202			if ((parent.top + top + $img.height()) > ($(document).scrollTop() + $(window).height())) top = $(document).scrollTop() + $(window).height() - $img.height() - parent.top;
5203			if ((parent.top + top) < $(document).scrollTop()) top = $(document).scrollTop() - parent.top;
5204			$img.css({
5205				'left': 48 + 'px',
5206				'position': 'absolute',
5207				'top': 0 + 'px',
5208				'width': 'auto',
5209				'height': 'auto'
5210			}).attr('src', $img.data('originalImg'));
5211		});
5212		$('#qr_code .qr_code_name a').mouseout(function(e) {
5213			var $img = $('img', this);
5214			$img.css({
5215				'display': 'none'
5216			}).attr('src', $img.data('originalImg'));
5217		});
5218	};
5219	/**
5220	 * Adjust elements to make it responsive
5221	 */
5222
5223	function responsive() {
5224		var position = $('.products-grid .item').css('position');
5225		if (position != 'absolute' && position != 'fixed' && position != 'relative') $('.products-grid .item').css('position', 'relative');
5226	};
5227	/**
5228	 *   Toogle Footer Information Mobile View
5229	 **/
5230
5231	function toogleFooter() {
5232		var wi = $(window).width();
5233		if (isPhone || (wi <= 767)) {
5234			$('.link_content > div > .content_links').css('display', 'none');
5235			$('.link_content > div > p.h5').addClass('toogle-icon');
5236			$('.link_content > div > p.h5').unbind('click');
5237			$('.link_content > div > p.h5').removeClass('active');
5238			$('.link_content > div > p.h5').on('click', function() {
5239				$(this).toggleClass("active").parent().find(".content_links").slideToggle();
5240			});
5241		} else {
5242			$('.link_content > div > p.h5').unbind('click');
5243			$('.link_content > div > p.h5').removeClass('toogle-icon');
5244			$('.link_content > div > p.h5').removeClass('active');
5245			$('.link_content > div > .content_links').css('display', 'block');
5246		}
5247	};
5248
5249	function buildBootrapJs() {
5250		$('.link_connect a.icon').tooltip();
5251		$('.reset-button').click(function() {
5252			var btn = $(this);
5253			btn.button('loading');
5254			var tm;
5255			clearTimeout(tm);
5256			tm = setTimeout(function() {
5257				btn.button('reset');
5258			}, 1000);
5259		});
5260	};
5261
5262	function dataAnimate() {
5263		if ($('[data-animate]')) {
5264			$('[data-animate]').each(function() {
5265				var $toAnimateElement = $(this);
5266				var toAnimateDelay = $(this).attr('data-delay');
5267				var toAnimateDelayTime = 0;
5268				if (toAnimateDelay) {
5269					toAnimateDelayTime = Number(toAnimateDelay);
5270				} else {
5271					toAnimateDelayTime = 200;
5272				}
5273				if (!$toAnimateElement.hasClass('animated')) { /*$toAnimateElement.addClass('not-animated');*/
5274					var elementAnimation = $toAnimateElement.attr('data-animate');
5275					setTimeout(function() {
5276						$toAnimateElement.waypoint({
5277							handler: function() {
5278								$toAnimateElement.removeClass('not-animated').addClass(elementAnimation + ' animated');
5279                                /*
5280                                $toAnimateElement.removeClass('not-animated').addClass(elementAnimation + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
5281                                    $(this).removeClass(elementAnimation + ' animated').addClass('not-animated');
5282                                });*/
5283							},
5284							offset: '100%',
5285							triggerOnce: false
5286						});
5287					}, toAnimateDelayTime);
5288				}
5289				if ($toAnimateElement.hasClass('not-animated')) animate = false;
5290			});
5291		}
5292	};
5293
5294	function ieVersion() {
5295		var rv = -1; // Return value assumes failure.
5296		if (navigator.appName == 'Microsoft Internet Explorer') {
5297			var ua = navigator.userAgent;
5298			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
5299			if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
5300		}
5301		return rv;
5302	};
5303
5304	function doAnimate() { /* DETECT PLATFORM */
5305		$.support.touch = 'ontouchend' in document;
5306		if ($.support.touch) {
5307			touch = true;
5308			$('body').addClass('touch');
5309		} else {
5310			$('body').addClass('notouch');
5311		}
5312		if (touch == false && ANIMATION_LOADING == 0) {
5313			if (ieVersion() == -1 || ieVersion() > 9) $('[data-animate]').addClass('not-animated');
5314		}
5315	};
5316
5317	function setAnimate() {
5318		$('.header-top').children('div').each(function() {
5319			$(this).children('div').each(function() {
5320				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_header);
5321			});
5322		});
5323		$('.em_col_left').children('div').each(function() {
5324			$(this).children('div').each(function() {
5325				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_left);
5326			});
5327		});
5328		$('.em_col_right').children('div').each(function() {
5329			$(this).children('div').each(function() {
5330				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_right);
5331			});
5332		});
5333		$('.em_col_main, .em_area03').children('div').each(function() {
5334			$(this).children('div').each(function() {
5335				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_main);
5336			});
5337		});
5338		$('.em_area04, .em_area05, .inner_footer, #footer-information').children('div').each(function() {
5339			$(this).children('div').each(function() {
5340				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_footer);
5341			});
5342		});
5343	};
5344
5345	function fixClickMobile() {
5346		var currentName;
5347		if (isMobile) {
5348			$('.products-grid li.item a').each(function() {
5349				$(this).bind('click', function(event) {
5350					if (currentName != this) {
5351						event.preventDefault();
5352						// next time click this element will open link
5353						currentName = this;
5354					}
5355				});
5356			});
5357		}
5358	};
5359
5360	function colorVariation() {
5361		var screen = "<div id='bg_fade_color'></div>";
5362		$(document.body).append(screen);
5363		$("#bg_fade_color").css("opacity", 0);
5364		$("#bg_fade_color").css("display", "none");
5365		$(".btn_color_variation").click(function() {
5366			var bg = $("#bg_fade_color");
5367			bg.css("opacity", 0.5);
5368			bg.css("display", "block");
5369			var left = ($(window).width() - $(".colordiv").width()) / 2;
5370			$(".colordiv").show();
5371			$(".colordiv").css('top', Math.max($(document).scrollTop(), Math.min($(this).offset().top, $(document).scrollTop() + $(window).height() - $(".colordiv").outerHeight())) + 20 + 'px');
5372			$(".colordiv").css('left', left);
5373		});
5374		$(".btn_color_close").click(function() {
5375			color_hide();
5376		});
5377
5378		function color_hide() {
5379			var bg = $("#bg_fade_color");
5380			$(".colordiv").hide();
5381			bg.css("opacity", 0);
5382			bg.css("display", "none");
5383		}
5384	};
5385	/**
5386	 Ready Function
5387	 */
5388	$(document).ready(function() {
5389		domLoaded = true;
5390		setAnimate();
5391		addClassMobile();
5392		if (disableVariation != 1) {
5393			colorVariation();
5394			qrCode();
5395			toogleStore();
5396		}
5397		// safari hack: remove bold in h5, .h5
5398		if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
5399			$('h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6').css('font-weight', 'normal');
5400		}
5401        if (disableResponsive != 1) {
5402            isMobile && fixIPhoneAutoZoomWhenFocus();
5403        }else{
5404            freezedMenuNoResponsive();
5405        }
5406		hoverUl();
5407		toolbarCategoty();
5408		backToTop();
5409		doMenuLeft();
5410		//hoverTopCart();
5411		alternativeProductImage();
5412		if (useTab) {
5413			decorateProductCollateralTabs();
5414		}
5415		setupReviewLink();
5416		doSlider('#upsell-product-table', 1, 0, 'horizontal');
5417		doSlider('#slider_crosell', 1, 0, 'horizontal');
5418		doSlider('#slider_moreview', 1, 0, 'horizontal');
5419		doSlider('#slider_related', 1, 0, 'horizontal');
5420		responsive();
5421		buildBootrapJs();
5422		doAnimate();
5423		//fixClickMobile();
5424		setupReviewLink();
5425        if (disableResponsive != 1) {
5426			toogleFooter();
5427		}
5428	});
5429	/**
5430	 Load Function
5431	 */
5432	$(window).bind('load', function() {
5433		windowLoaded = true;
5434		$.support.touch = 'ontouchend' in document;
5435		if ($.support.touch) {
5436			touch = true;
5437			$('body').addClass('touch');
5438		} else {
5439			$('body').addClass('notouch');
5440		}
5441		if (touch == false && ANIMATION_LOADING == 0) {
5442			if (ieVersion() == -1 || ieVersion() > 9) {
5443				dataAnimate();
5444			}
5445		}
5446        if (ieVersion() != -1 || ieVersion() < 9){
5447            setTimeout(function() {                
5448				if (typeof em_slider !== 'undefined') {
5449					em_slider.reinit();
5450				}
5451            },8000);
5452        }
5453        setHeightItem('.em_col_main ul.products-grid');
5454	});
5455	var tmresize;
5456	$(window).resize(function() {
5457		if (disableResponsive != 1) {
5458			clearTimeout(tmresize);
5459			tmresize = setTimeout(function() {
5460                setHeightItem('.em_col_main ul.products-grid');
5461				doMenuLeft();
5462				persistentMenu();
5463				toogleFooter();
5464				if (typeof em_slider !== 'undefined') {
5465					em_slider.reinit();
5466				}
5467			}, 300);
5468			if (touch == false && ANIMATION_LOADING == 0) {
5469				if (ieVersion() == -1 || ieVersion() > 9) dataAnimate();
5470			}
5471		}
5472	});
5473	$(window).bind('orientationchange', function() {
5474		if (disableResponsive != 1) {
5475			toogleFooter();
5476		}
5477	});
5478})(jQuery);
5479/**
5480 * Change the alternative product image when hover
5481 */
5482
5483function alternativeProductImage() {
5484	var $ = jQuery;
5485	var tm;
5486
5487	function swap() {
5488		clearTimeout(tm);
5489		tm = setTimeout(function() {
5490			el = $(this).find('img[data-alt-src]');
5491			var newImg = $(el).data('alt-src');
5492			var oldImg = $(el).attr('src');
5493			$(el).attr('src', newImg).data('alt-src', oldImg);
5494		}.bind(this), 200);
5495	}
5496	$('.item .product-image img[data-alt-src]').parents('.item').bind('mouseenter', swap).bind('mouseleave', swap);
5497};
5498
5499function toolbarCategoty() {
5500	var $ = jQuery;
5501	if (!isMobile) {
5502		$('.toolbar-show').each(function() {
5503			$(this).insertUl();
5504			$(this).selectUl();
5505		});
5506		$('.sortby').each(function() {
5507			$(this).insertUl();
5508			$(this).selectUl();
5509		});
5510	}
5511};
5512/**
5513 *   After Layer Update
5514 **/
5515window.afterLayerUpdate = function() {
5516	var $ = jQuery;
5517    setHeightItem('.em_col_main ul.products-grid');
5518	toolbarCategoty();
5519	alternativeProductImage();
5520	if ((typeof EM_QUICKSHOP_DISABLED == 'undefined' || !EM_QUICKSHOP_DISABLED) && !isMobile) {
5521		qs({
5522			itemClass: '.products-grid li.item, .products-list li.item',
5523			//selector for each items in catalog product list,use to insert quickshop image
5524			aClass: 'a.product-image',
5525			//selector for each a tag in product items,give us href for one product
5526			imgClass: '.product-image > img' //class for quickshop href
5527		});
5528	}
5529};
5530
5531function hideAgreementPopup(e) {
5532	jQuery('#checkout-agreements .agreement-content').hide();
5533};
5534
5535function showAgreementPopup(e) {
5536	jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').show().css({
5537		'left': (parseInt(document.viewport.getWidth()) - jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').width()) / 2 + 'px',
5538		'top': (parseInt(document.viewport.getHeight()) - jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').height()) / 2 + 'px'
5539	});
5540};
5541
5542function setHeightItem(e){
5543    var $=jQuery;
5544    if($(e).length){        
5545        $(e).each(function(){
5546            var maxHeight = 0;
5547            $(this).children('li.item').each(function(){
5548                $(this).removeAttr('height');
5549                if(maxHeight<$(this).outerHeight()){
5550                    maxHeight = $(this).outerHeight(); 
5551                }
5552            });
5553            $(this).children('li.item').each(function(){
5554                $(this).removeAttr('height');
5555                $(this).css('height',maxHeight+'px');
5556            });
5557        });    
5558    }
5559};
5560
5561/**
5562 * Isotope v1.5.25
5563 * An exquisite jQuery plugin for magical layouts
5564 * http://isotope.metafizzy.co
5565 *
5566 * Commercial use requires one-time license fee
5567 * http://metafizzy.co/#licenses
5568 *
5569 * Copyright 2012 David DeSandro / Metafizzy
5570 */
5571
5572/*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true */
5573/*global jQuery: false */
5574jQuery.noConflict();
5575(function( window, $, undefined ){
5576
5577  'use strict';
5578
5579  // get global vars
5580  var document = window.document;
5581  var Modernizr = window.Modernizr;
5582
5583  // helper function
5584  var capitalize = function( str ) {
5585    return str.charAt(0).toUpperCase() + str.slice(1);
5586  };
5587
5588  // ========================= getStyleProperty by kangax ===============================
5589  // http://perfectionkills.com/feature-testing-css-properties/
5590
5591  var prefixes = 'Moz Webkit O Ms'.split(' ');
5592
5593  var getStyleProperty = function( propName ) {
5594    var style = document.documentElement.style,
5595        prefixed;
5596
5597    // test standard property first
5598    if ( typeof style[propName] === 'string' ) {
5599      return propName;
5600    }
5601
5602    // capitalize
5603    propName = capitalize( propName );
5604
5605    // test vendor specific properties
5606    for ( var i=0, len = prefixes.length; i < len; i++ ) {
5607      prefixed = prefixes[i] + propName;
5608      if ( typeof style[ prefixed ] === 'string' ) {
5609        return prefixed;
5610      }
5611    }
5612  };
5613
5614  var transformProp = getStyleProperty('transform'),
5615      transitionProp = getStyleProperty('transitionProperty');
5616
5617
5618  // ========================= miniModernizr ===============================
5619  // <3<3<3 and thanks to Faruk and Paul for doing the heavy lifting
5620
5621  /*!
5622   * Modernizr v1.6ish: miniModernizr for Isotope
5623   * http://www.modernizr.com
5624   *
5625   * Developed by:
5626   * - Faruk Ates  http://farukat.es/
5627   * - Paul Irish  http://paulirish.com/
5628   *
5629   * Copyright (c) 2009-2010
5630   * Dual-licensed under the BSD or MIT licenses.
5631   * http://www.modernizr.com/license/
5632   */
5633
5634  /*
5635   * This version whittles down the script just to check support for
5636   * CSS transitions, transforms, and 3D transforms.
5637  */
5638
5639  var tests = {
5640    csstransforms: function() {
5641      return !!transformProp;
5642    },
5643
5644    csstransforms3d: function() {
5645      var test = !!getStyleProperty('perspective');
5646      // double check for Chrome's false positive
5647      if ( test ) {
5648        var vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
5649            mediaQuery = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)',
5650            $style = $('<style>' + mediaQuery + '{#modernizr{height:3px}}' + '</style>')
5651                        .appendTo('head'),
5652            $div = $('<div id="modernizr" />').appendTo('html');
5653
5654        test = $div.height() === 3;
5655
5656        $div.remove();
5657        $style.remove();
5658      }
5659      return test;
5660    },
5661
5662    csstransitions: function() {
5663      return !!transitionProp;
5664    }
5665  };
5666
5667  var testName;
5668
5669  if ( Modernizr ) {
5670    // if there's a previous Modernzir, check if there are necessary tests
5671    for ( testName in tests) {
5672      if ( !Modernizr.hasOwnProperty( testName ) ) {
5673        // if test hasn't been run, use addTest to run it
5674        Modernizr.addTest( testName, tests[ testName ] );
5675      }
5676    }
5677  } else {
5678    // or create new mini Modernizr that just has the 3 tests
5679    Modernizr = window.Modernizr = {
5680      _version : '1.6ish: miniModernizr for Isotope'
5681    };
5682
5683    var classes = ' ';
5684    var result;
5685
5686    // Run through tests
5687    for ( testName in tests) {
5688      result = tests[ testName ]();
5689      Modernizr[ testName ] = result;
5690      classes += ' ' + ( result ?  '' : 'no-' ) + testName;
5691    }
5692
5693    // Add the new classes to the <html> element.
5694    $('html').addClass( classes );
5695  }
5696
5697
5698  // ========================= isoTransform ===============================
5699
5700  /**
5701   *  provides hooks for .css({ scale: value, translate: [x, y] })
5702   *  Progressively enhanced CSS transforms
5703   *  Uses hardware accelerated 3D transforms for Safari
5704   *  or falls back to 2D transforms.
5705   */
5706
5707  if ( Modernizr.csstransforms ) {
5708
5709        // i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)'
5710    var transformFnNotations = Modernizr.csstransforms3d ?
5711      { // 3D transform functions
5712        translate : function ( position ) {
5713          return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) ';
5714        },
5715        scale : function ( scale ) {
5716          return 'scale3d(' + scale + ', ' + scale + ', 1) ';
5717        }
5718      } :
5719      { // 2D transform functions
5720        translate : function ( position ) {
5721          return 'translate(' + position[0] + 'px, ' + position[1] + 'px) ';
5722        },
5723        scale : function ( scale ) {
5724          return 'scale(' + scale + ') ';
5725        }
5726      }
5727    ;
5728
5729    var setIsoTransform = function ( elem, name, value ) {
5730          // unpack current transform data
5731      var data =  $.data( elem, 'isoTransform' ) || {},
5732          newData = {},
5733          fnName,
5734          transformObj = {},
5735          transformValue;
5736
5737      // i.e. newData.scale = 0.5
5738      newData[ name ] = value;
5739      // extend new value over current data
5740      $.extend( data, newData );
5741
5742      for ( fnName in data ) {
5743        transformValue = data[ fnName ];
5744        transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue );
5745      }
5746
5747      // get proper order
5748      // ideally, we could loop through this give an array, but since we only have
5749      // a couple transforms we're keeping track of, we'll do it like so
5750      var translateFn = transformObj.translate || '',
5751          scaleFn = transformObj.scale || '',
5752          // sorting so translate always comes first
5753          valueFns = translateFn + scaleFn;
5754
5755      // set data back in elem
5756      $.data( elem, 'isoTransform', data );
5757
5758      // set name to vendor specific property
5759      elem.style[ transformProp ] = valueFns;
5760    };
5761
5762    // ==================== scale ===================
5763
5764    $.cssNumber.scale = true;
5765
5766    $.cssHooks.scale = {
5767      set: function( elem, value ) {
5768        // uncomment this bit if you want to properly parse strings
5769        // if ( typeof value === 'string' ) {
5770        //   value = parseFloat( value );
5771        // }
5772        setIsoTransform( elem, 'scale', value );
5773      },
5774      get: function( elem, computed ) {
5775        var transform = $.data( elem, 'isoTransform' );
5776        return transform && transform.scale ? transform.scale : 1;
5777      }
5778    };
5779
5780    $.fx.step.scale = function( fx ) {
5781      $.cssHooks.scale.set( fx.elem, fx.now+fx.unit );
5782    };
5783
5784
5785    // ==================== translate ===================
5786
5787    $.cssNumber.translate = true;
5788
5789    $.cssHooks.translate = {
5790      set: function( elem, value ) {
5791
5792        // uncomment this bit if you want to properly parse strings
5793        // if ( typeof value === 'string' ) {
5794        //   value = value.split(' ');
5795        // }
5796        //
5797        // var i, val;
5798        // for ( i = 0; i < 2; i++ ) {
5799        //   val = value[i];
5800        //   if ( typeof val === 'string' ) {
5801        //     val = parseInt( val );
5802        //   }
5803        // }
5804
5805        setIsoTransform( elem, 'translate', value );
5806      },
5807
5808      get: function( elem, computed ) {
5809        var transform = $.data( elem, 'isoTransform' );
5810        return transform && transform.translate ? transform.translate : [ 0, 0 ];
5811      }
5812    };
5813
5814  }
5815
5816  // ========================= get transition-end event ===============================
5817  var transitionEndEvent, transitionDurProp;
5818
5819  if ( Modernizr.csstransitions ) {
5820    transitionEndEvent = {
5821      WebkitTransitionProperty: 'webkitTransitionEnd',  // webkit
5822      MozTransitionProperty: 'transitionend',
5823      OTransitionProperty: 'oTransitionEnd otransitionend',
5824      transitionProperty: 'transitionend'
5825    }[ transitionProp ];
5826
5827    transitionDurProp = getStyleProperty('transitionDuration');
5828  }
5829
5830  // ========================= smartresize ===============================
5831
5832  /*
5833   * smartresize: debounced resize event for jQuery
5834   *
5835   * latest version and complete README available on Github:
5836   * https://github.com/louisremi/jquery.smartresize.js
5837   *
5838   * Copyright 2011 @louis_remi
5839   * Licensed under the MIT license.
5840   */
5841
5842  var $event = $.event,
5843      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
5844      resizeTimeout;
5845
5846  $event.special.smartresize = {
5847    setup: function() {
5848      $(this).bind( "resize", $event.special.smartresize.handler );
5849    },
5850    teardown: function() {
5851      $(this).unbind( "resize", $event.special.smartresize.handler );
5852    },
5853    handler: function( event, execAsap ) {
5854      // Save the context
5855      var context = this,
5856          args = arguments;
5857
5858      // set correct event type
5859      event.type = "smartresize";
5860
5861      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
5862      resizeTimeout = setTimeout(function() {
5863        $event[ dispatchMethod ].apply( context, args );
5864      }, execAsap === "execAsap"? 0 : 100 );
5865    }
5866  };
5867
5868  $.fn.smartresize = function( fn ) {
5869    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
5870  };
5871
5872
5873
5874// ========================= Isotope ===============================
5875
5876
5877  // our "Widget" object constructor
5878  $.Isotope = function( options, element, callback ){
5879    this.element = $( element );
5880
5881    this._create( options );
5882    this._init( callback );
5883  };
5884
5885  // styles of container element we want to keep track of
5886  var isoContainerStyles = [ 'width', 'height' ];
5887
5888  var $window = $(window);
5889
5890  $.Isotope.settings = {
5891    resizable: true,
5892    layoutMode : 'masonry',
5893    containerClass : 'isotope',
5894    itemClass : 'isotope-item',
5895    hiddenClass : 'isotope-hidden',
5896    hiddenStyle: { opacity: 0, scale: 0.001 },
5897    visibleStyle: { opacity: 1, scale: 1 },
5898    containerStyle: {
5899      position: 'relative',
5900      overflow: 'hidden'
5901    },
5902    animationEngine: 'best-available',
5903    animationOptions: {
5904      queue: false,
5905      duration: 800
5906    },
5907    sortBy : 'original-order',
5908    sortAscending : true,
5909    resizesContainer : true,
5910    transformsEnabled: true,
5911    itemPositionDataEnabled: false
5912  };
5913
5914  $.Isotope.prototype = {
5915
5916    // sets up widget
5917    _create : function( options ) {
5918
5919      this.options = $.extend( {}, $.Isotope.settings, options );
5920
5921      this.styleQueue = [];
5922      this.elemCount = 0;
5923
5924      // get original styles in case we re-apply them in .destroy()
5925      var elemStyle = this.element[0].style;
5926      this.originalStyle = {};
5927      // keep track of container styles
5928      var containerStyles = isoContainerStyles.slice(0);
5929      for ( var prop in this.options.containerStyle ) {
5930        containerStyles.push( prop );
5931      }
5932      for ( var i=0, len = containerStyles.length; i < len; i++ ) {
5933        prop = containerStyles[i];
5934        this.originalStyle[ prop ] = elemStyle[ prop ] || '';
5935      }
5936      // apply container style from options
5937      this.element.css( this.options.containerStyle );
5938
5939      this._updateAnimationEngine();
5940      this._updateUsingTransforms();
5941
5942      // sorting
5943      var originalOrderSorter = {
5944        'original-order' : function( $elem, instance ) {
5945          instance.elemCount ++;
5946          return instance.elemCount;
5947        },
5948        random : function() {
5949          return Math.random();
5950        }
5951      };
5952
5953      this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter );
5954
5955      // need to get atoms
5956      this.reloadItems();
5957
5958      // get top left position of where the bricks should be
5959      this.offset = {
5960        left: parseInt( ( this.element.css('padding-left') || 0 ), 10 ),
5961        top: parseInt( ( this.element.css('padding-top') || 0 ), 10 )
5962      };
5963
5964      // add isotope class first time around
5965      var instance = this;
5966      setTimeout( function() {
5967        instance.element.addClass( instance.options.containerClass );
5968      }, 0 );
5969
5970      // bind resize method
5971      if ( this.options.resizable ) {
5972        $window.bind( 'smartresize.isotope', function() {
5973          instance.resize();
5974        });
5975      }
5976
5977      // dismiss all click events from hidden events
5978      this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){
5979        return false;
5980      });
5981
5982    },
5983
5984    _getAtoms : function( $elems ) {
5985      var selector = this.options.itemSelector,
5986          // filter & find
5987          $atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems,
5988          // base style for atoms
5989          atomStyle = { position: 'absolute' };
5990
5991      // filter out text nodes
5992      $atoms = $atoms.filter( function( i, atom ) {
5993        return atom.nodeType === 1;
5994      });
5995
5996      if ( this.usingTransforms ) {
5997        atomStyle.left = 0;
5998        atomStyle.top = 0;
5999      }
6000
6001      $atoms.css( atomStyle ).addClass( this.options.itemClass );
6002
6003      this.updateSortData( $atoms, true );
6004
6005      return $atoms;
6006    },
6007
6008    // _init fires when your instance is first created
6009    // (from the constructor above), and when you
6010    // attempt to initialize the widget again (by the bridge)
6011    // after it has already been initialized.
6012    _init : function( callback ) {
6013
6014      this.$filteredAtoms = this._filter( this.$allAtoms );
6015      this._sort();
6016      this.reLayout( callback );
6017
6018    },
6019
6020    option : function( opts ){
6021      // change options AFTER initialization:
6022      // signature: $('#foo').bar({ cool:false });
6023      if ( $.isPlainObject( opts ) ){
6024        this.options = $.extend( true, this.options, opts );
6025
6026        // trigger _updateOptionName if it exists
6027        var updateOptionFn;
6028        for ( var optionName in opts ) {
6029          updateOptionFn = '_update' + capitalize( optionName );
6030          if ( this[ updateOptionFn ] ) {
6031            this[ updateOptionFn ]();
6032          }
6033        }
6034      }
6035    },
6036
6037    // ====================== updaters ====================== //
6038    // kind of like setters
6039
6040    _updateAnimationEngine : function() {
6041      var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, '');
6042      var isUsingJQueryAnimation;
6043      // set applyStyleFnName
6044      switch ( animationEngine ) {
6045        case 'css' :
6046        case 'none' :
6047          isUsingJQueryAnimation = false;
6048          break;
6049        case 'jquery' :
6050          isUsingJQueryAnimation = true;
6051          break;
6052        default : // best available
6053          isUsingJQueryAnimation = !Modernizr.csstransitions;
6054      }
6055      this.isUsingJQueryAnimation = isUsingJQueryAnimation;
6056      this._updateUsingTransforms();
6057    },
6058
6059    _updateTransformsEnabled : function() {
6060      this._updateUsingTransforms();
6061    },
6062
6063    _updateUsingTransforms : function() {
6064      var usingTransforms = this.usingTransforms = this.options.transformsEnabled &&
6065        Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation;
6066
6067      // prevent scales when transforms are disabled
6068      if ( !usingTransforms ) {
6069        delete this.options.hiddenStyle.scale;
6070        delete this.options.visibleStyle.scale;
6071      }
6072
6073      this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs;
6074    },
6075
6076
6077    // ====================== Filtering ======================
6078
6079    _filter : function( $atoms ) {
6080      var filter = this.options.filter === '' ? '*' : this.options.filter;
6081
6082      if ( !filter ) {
6083        return $atoms;
6084      }
6085
6086      var hiddenClass    = this.options.hiddenClass,
6087          hiddenSelector = '.' + hiddenClass,
6088          $hiddenAtoms   = $atoms.filter( hiddenSelector ),
6089          $atomsToShow   = $hiddenAtoms;
6090
6091      if ( filter !== '*' ) {
6092        $atomsToShow = $hiddenAtoms.filter( filter );
6093        var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass );
6094        this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle });
6095      }
6096
6097      this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle });
6098      $atomsToShow.removeClass( hiddenClass );
6099
6100      return $atoms.filter( filter );
6101    },
6102
6103    // ====================== Sorting ======================
6104
6105    updateSortData : function( $atoms, isIncrementingElemCount ) {
6106      var instance = this,
6107          getSortData = this.options.getSortData,
6108          $this, sortData;
6109      $atoms.each(function(){
6110        $this = $(this);
6111        sortData = {};
6112        // get value for sort data based on fn( $elem ) passed in
6113        for ( var key in getSortData ) {
6114          if ( !isIncrementingElemCount && key === 'original-order' ) {
6115            // keep original order original
6116            sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ];
6117          } else {
6118            sortData[ key ] = getSortData[ key ]( $this, instance );
6119          }
6120        }
6121        // apply sort data to element
6122        $.data( this, 'isotope-sort-data', sortData );
6123      });
6124    },
6125
6126    // used on all the filtered atoms
6127    _sort : function() {
6128
6129      var sortBy = this.options.sortBy,
6130          getSorter = this._getSorter,
6131          sortDir = this.options.sortAscending ? 1 : -1,
6132          sortFn = function( alpha, beta ) {
6133            var a = getSorter( alpha, sortBy ),
6134                b = getSorter( beta, sortBy );
6135            // fall back to original order if data matches
6136            if ( a === b && sortBy !== 'original-order') {
6137              a = getSorter( alpha, 'original-order' );
6138              b = getSorter( beta, 'original-order' );
6139            }
6140            return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
6141          };
6142
6143      this.$filteredAtoms.sort( sortFn );
6144    },
6145
6146    _getSorter : function( elem, sortBy ) {
6147      return $.data( elem, 'isotope-sort-data' )[ sortBy ];
6148    },
6149
6150    // ====================== Layout Helpers ======================
6151
6152    _translate : function( x, y ) {
6153      return { translate : [ x, y ] };
6154    },
6155
6156    _positionAbs : function( x, y ) {
6157      return { left: x, top: y };
6158    },
6159
6160    _pushPosition : function( $elem, x, y ) {
6161      x = Math.round( x + this.offset.left );
6162      y = Math.round( y + this.offset.top );
6163      var position = this.getPositionStyles( x, y );
6164      this.styleQueue.push({ $el: $elem, style: position });
6165      if ( this.options.itemPositionDataEnabled ) {
6166        $elem.data('isotope-item-position', {x: x, y: y} );
6167      }
6168    },
6169
6170
6171    // ====================== General Layout ======================
6172
6173    // used on collection of atoms (should be filtered, and sorted before )
6174    // accepts atoms-to-be-laid-out to start with
6175    layout : function( $elems, callback ) {
6176
6177      var layoutMode = this.options.layoutMode;
6178
6179      // layout logic
6180      this[ '_' +  layoutMode + 'Layout' ]( $elems );
6181
6182      // set the size of the container
6183      if ( this.options.resizesContainer ) {
6184        var containerStyle = this[ '_' +  layoutMode + 'GetContainerSize' ]();
6185        this.styleQueue.push({ $el: this.element, style: containerStyle });
6186      }
6187
6188      this._processStyleQueue( $elems, callback );
6189
6190      this.isLaidOut = true;
6191    },
6192
6193    _processStyleQueue : function( $elems, callback ) {
6194      // are we animating the layout arrangement?
6195      // use plugin-ish syntax for css or animate
6196      var styleFn = !this.isLaidOut ? 'css' : (
6197            this.isUsingJQueryAnimation ? 'animate' : 'css'
6198          ),
6199          animOpts = this.options.animationOptions,
6200          onLayout = this.options.onLayout,
6201          objStyleFn, processor,
6202          triggerCallbackNow, callbackFn;
6203
6204      // default styleQueue processor, may be overwritten down below
6205      processor = function( i, obj ) {
6206        obj.$el[ styleFn ]( obj.style, animOpts );
6207      };
6208
6209      if ( this._isInserting && this.isUsingJQueryAnimation ) {
6210        // if using styleQueue to insert items
6211        processor = function( i, obj ) {
6212          // only animate if it not being inserted
6213          objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn;
6214          obj.$el[ objStyleFn ]( obj.style, animOpts );
6215        };
6216
6217      } else if ( callback || onLayout || animOpts.complete ) {
6218        // has callback
6219        var isCallbackTriggered = false,
6220            // array of possible callbacks to trigger
6221            callbacks = [ callback, onLayout, animOpts.complete ],
6222            instance = this;
6223        triggerCallbackNow = true;
6224        // trigger callback only once
6225        callbackFn = function() {
6226          if ( isCallbackTriggered ) {
6227            return;
6228          }
6229          var hollaback;
6230          for (var i=0, len = callbacks.length; i < len; i++) {
6231            hollaback = callbacks[i];
6232            if ( typeof hollaback === 'function' ) {
6233              hollaback.call( instance.element, $elems, instance );
6234            }
6235          }
6236          isCallbackTriggered = true;
6237        };
6238
6239        if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) {
6240          // add callback to animation options
6241          animOpts.complete = callbackFn;
6242          triggerCallbackNow = false;
6243
6244        } else if ( Modernizr.csstransitions ) {
6245          // detect if first item has transition
6246          var i = 0,
6247              firstItem = this.styleQueue[0],
6248              testElem = firstItem && firstItem.$el,
6249              styleObj;
6250          // get first non-empty jQ object
6251          while ( !testElem || !testElem.length ) {
6252            styleObj = this.styleQueue[ i++ ];
6253            // HACK: sometimes styleQueue[i] is undefined
6254            if ( !styleObj ) {
6255              return;
6256            }
6257            testElem = styleObj.$el;
6258          }
6259          // get transition duration of the first element in that object
6260          // yeah, this is inexact
6261          var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] );
6262          if ( duration > 0 ) {
6263            processor = function( i, obj ) {
6264              obj.$el[ styleFn ]( obj.style, animOpts )
6265                // trigger callback at transition end
6266                .one( transitionEndEvent, callbackFn );
6267            };
6268            triggerCallbackNow = false;
6269          }
6270        }
6271      }
6272
6273      // process styleQueue
6274      $.each( this.styleQueue, processor );
6275
6276      if ( triggerCallbackNow ) {
6277        callbackFn();
6278      }
6279
6280      // clear out queue for next time
6281      this.styleQueue = [];
6282    },
6283
6284
6285    resize : function() {
6286      if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) {
6287        this.reLayout();
6288      }
6289    },
6290
6291
6292    reLayout : function( callback ) {
6293
6294      this[ '_' +  this.options.layoutMode + 'Reset' ]();
6295      this.layout( this.$filteredAtoms, callback );
6296
6297    },
6298
6299    // ====================== Convenience methods ======================
6300
6301    // ====================== Adding items ======================
6302
6303    // adds a jQuery object of items to a isotope container
6304    addItems : function( $content, callback ) {
6305      var $newAtoms = this._getAtoms( $content );
6306      // add new atoms to atoms pools
6307      this.$allAtoms = this.$allAtoms.add( $newAtoms );
6308
6309      if ( callback ) {
6310        callback( $newAtoms );
6311      }
6312    },
6313
6314    // convienence method for adding elements properly to any layout
6315    // positions items, hides them, then animates them back in <--- very sezzy
6316    insert : function( $content, callback ) {
6317      // position items
6318      this.element.append( $content );
6319
6320      var instance = this;
6321      this.addItems( $content, function( $newAtoms ) {
6322        var $newFilteredAtoms = instance._filter( $newAtoms );
6323        instance._addHideAppended( $newFilteredAtoms );
6324        instance._sort();
6325        instance.reLayout();
6326        instance._revealAppended( $newFilteredAtoms, callback );
6327      });
6328
6329    },
6330
6331    // convienence method for working with Infinite Scroll
6332    appended : function( $content, callback ) {
6333      var instance = this;
6334      this.addItems( $content, function( $newAtoms ) {
6335        instance._addHideAppended( $newAtoms );
6336        instance.layout( $newAtoms );
6337        instance._revealAppended( $newAtoms, callback );
6338      });
6339    },
6340
6341    // adds new atoms, then hides them before positioning
6342    _addHideAppended : function( $newAtoms ) {
6343      this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms );
6344      $newAtoms.addClass('no-transition');
6345
6346      this._isInserting = true;
6347
6348      // apply hidden styles
6349      this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle });
6350    },
6351
6352    // sets visible style on new atoms
6353    _revealAppended : function( $newAtoms, callback ) {
6354      var instance = this;
6355      // apply visible style after a sec
6356      setTimeout( function() {
6357        // enable animation
6358        $newAtoms.removeClass('no-transition');
6359        // reveal newly inserted filtered elements
6360        instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle });
6361        instance._isInserting = false;
6362        instance._processStyleQueue( $newAtoms, callback );
6363      }, 10 );
6364    },
6365
6366    // gathers all atoms
6367    reloadItems : function() {
6368      this.$allAtoms = this._getAtoms( this.element.children() );
6369    },
6370
6371    // removes elements from Isotope widget
6372    remove: function( $content, callback ) {
6373      // remove elements immediately from Isotope instance
6374      this.$allAtoms = this.$allAtoms.not( $content );
6375      this.$filteredAtoms = this.$filteredAtoms.not( $content );
6376      // remove() as a callback, for after transition / animation
6377      var instance = this;
6378      var removeContent = function() {
6379        $content.remove();
6380        if ( callback ) {
6381          callback.call( instance.element );
6382        }
6383      };
6384
6385      if ( $content.filter( ':not(.' + this.options.hiddenClass + ')' ).length ) {
6386        // if any non-hidden content needs to be removed
6387        this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle });
6388        this._sort();
6389        this.reLayout( removeContent );
6390      } else {
6391        // remove it now
6392        removeContent();
6393      }
6394
6395    },
6396
6397    shuffle : function( callback ) {
6398      this.updateSortData( this.$allAtoms );
6399      this.options.sortBy = 'random';
6400      this._sort();
6401      this.reLayout( callback );
6402    },
6403
6404    // destroys widget, returns elements and container back (close) to original style
6405    destroy : function() {
6406
6407      var usingTransforms = this.usingTransforms;
6408      var options = this.options;
6409
6410      this.$allAtoms
6411        .removeClass( options.hiddenClass + ' ' + options.itemClass )
6412        .each(function(){
6413          var style = this.style;
6414          style.position = '';
6415          style.top = '';
6416          style.left = '';
6417          style.opacity = '';
6418          if ( usingTransforms ) {
6419            style[ transformProp ] = '';
6420          }
6421        });
6422
6423      // re-apply saved container styles
6424      var elemStyle = this.element[0].style;
6425      for ( var prop in this.originalStyle ) {
6426        elemStyle[ prop ] = this.originalStyle[ prop ];
6427      }
6428
6429      this.element
6430        .unbind('.isotope')
6431        .undelegate( '.' + options.hiddenClass, 'click' )
6432        .removeClass( options.containerClass )
6433        .removeData('isotope');
6434
6435      $window.unbind('.isotope');
6436
6437    },
6438
6439
6440    // ====================== LAYOUTS ======================
6441
6442    // calculates number of rows or columns
6443    // requires columnWidth or rowHeight to be set on namespaced object
6444    // i.e. this.masonry.columnWidth = 200
6445    _getSegments : function( isRows ) {
6446      var namespace = this.options.layoutMode,
6447          measure  = isRows ? 'rowHeight' : 'columnWidth',
6448          size     = isRows ? 'height' : 'width',
6449          segmentsName = isRows ? 'rows' : 'cols',
6450          containerSize = this.element[ size ](),
6451          segments,
6452                    // i.e. options.masonry && options.masonry.columnWidth
6453          segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] ||
6454                    // or use the size of the first item, i.e. outerWidth
6455                    this.$filteredAtoms[ 'outer' + capitalize(size) ](true) ||
6456                    // if there's no items, use size of container
6457                    containerSize;
6458
6459      segments = Math.floor( containerSize / segmentSize );
6460      segments = Math.max( segments, 1 );
6461
6462      // i.e. this.masonry.cols = ....
6463      this[ namespace ][ segmentsName ] = segments;
6464      // i.e. this.masonry.columnWidth = ...
6465      this[ namespace ][ measure ] = segmentSize;
6466
6467    },
6468
6469    _checkIfSegmentsChanged : function( isRows ) {
6470      var namespace = this.options.layoutMode,
6471          segmentsName = isRows ? 'rows' : 'cols',
6472          prevSegments = this[ namespace ][ segmentsName ];
6473      // update cols/rows
6474      this._getSegments( isRows );
6475      // return if updated cols/rows is not equal to previous
6476      return ( this[ namespace ][ segmentsName ] !== prevSegments );
6477    },
6478
6479    // ====================== Masonry ======================
6480
6481    _masonryReset : function() {
6482      // layout-specific props
6483      this.masonry = {};
6484      // FIXME shouldn't have to call this again
6485      this._getSegments();
6486      var i = this.masonry.cols;
6487      this.masonry.colYs = [];
6488      while (i--) {
6489        this.masonry.colYs.push( 0 );
6490      }
6491    },
6492
6493    _masonryLayout : function( $elems ) {
6494      var instance = this,
6495          props = instance.masonry;
6496      $elems.each(function(){
6497        var $this  = $(this),
6498            //how many columns does this brick span
6499            colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth );
6500        colSpan = Math.min( colSpan, props.cols );
6501
6502        if ( colSpan === 1 ) {
6503          // if brick spans only one column, just like singleMode
6504          instance._masonryPlaceBrick( $this, props.colYs );
6505        } else {
6506          // brick spans more than one column
6507          // how many different places could this brick fit horizontally
6508          var groupCount = props.cols + 1 - colSpan,
6509              groupY = [],
6510              groupColY,
6511              i;
6512
6513          // for each group potential horizontal position
6514          for ( i=0; i < groupCount; i++ ) {
6515            // make an array of colY values for that one group
6516            groupColY = props.colYs.slice( i, i+colSpan );
6517            // and get the max value of the array
6518            groupY[i] = Math.max.apply( Math, groupColY );
6519          }
6520
6521          instance._masonryPlaceBrick( $this, groupY );
6522        }
6523      });
6524    },
6525
6526    // worker method that places brick in the columnSet
6527    //   with the the minY
6528    _masonryPlaceBrick : function( $brick, setY ) {
6529      // get the minimum Y value from the columns
6530      var minimumY = Math.min.apply( Math, setY ),
6531          shortCol = 0;
6532
6533      // Find index of short column, the first from the left
6534      for (var i=0, len = setY.length; i < len; i++) {
6535        if ( setY[i] === minimumY ) {
6536          shortCol = i;
6537          break;
6538        }
6539      }
6540
6541      // position the brick
6542      var x = this.masonry.columnWidth * shortCol,
6543          y = minimumY;
6544      this._pushPosition( $brick, x, y );
6545
6546      // apply setHeight to necessary columns
6547      var setHeight = minimumY + $brick.outerHeight(true),
6548          setSpan = this.masonry.cols + 1 - len;
6549      for ( i=0; i < setSpan; i++ ) {
6550        this.masonry.colYs[ shortCol + i ] = setHeight;
6551      }
6552
6553    },
6554
6555    _masonryGetContainerSize : function() {
6556      var containerHeight = Math.max.apply( Math, this.masonry.colYs );
6557      return { height: containerHeight };
6558    },
6559
6560    _masonryResizeChanged : function() {
6561      return this._checkIfSegmentsChanged();
6562    },
6563
6564    // ====================== fitRows ======================
6565
6566    _fitRowsReset : function() {
6567      this.fitRows = {
6568        x : 0,
6569        y : 0,
6570        height : 0
6571      };
6572    },
6573
6574    _fitRowsLayout : function( $elems ) {
6575      var instance = this,
6576          containerWidth = this.element.width(),
6577          props = this.fitRows;
6578
6579      $elems.each( function() {
6580        var $this = $(this),
6581            atomW = $this.outerWidth(true),
6582            atomH = $this.outerHeight(true);
6583
6584        if ( props.x !== 0 && atomW + props.x > containerWidth ) {
6585          // if this element cannot fit in the current row
6586          props.x = 0;
6587          props.y = props.height;
6588        }
6589
6590        // position the atom
6591        instance._pushPosition( $this, props.x, props.y );
6592
6593        props.height = Math.max( props.y + atomH, props.height );
6594        props.x += atomW;
6595
6596      });
6597    },
6598
6599    _fitRowsGetContainerSize : function () {
6600      return { height : this.fitRows.height };
6601    },
6602
6603    _fitRowsResizeChanged : function() {
6604      return true;
6605    },
6606
6607
6608    // ====================== cellsByRow ======================
6609
6610    _cellsByRowReset : function() {
6611      this.cellsByRow = {
6612        index : 0
6613      };
6614      // get this.cellsByRow.columnWidth
6615      this._getSegments();
6616      // get this.cellsByRow.rowHeight
6617      this._getSegments(true);
6618    },
6619
6620    _cellsByRowLayout : function( $elems ) {
6621      var instance = this,
6622          props = this.cellsByRow;
6623      $elems.each( function(){
6624        var $this = $(this),
6625            col = props.index % props.cols,
6626            row = Math.floor( props.index / props.cols ),
6627            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
6628            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2 ;
6629        instance._pushPosition( $this, x, y );
6630        props.index ++;
6631      });
6632    },
6633
6634    _cellsByRowGetContainerSize : function() {
6635      return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top };
6636    },
6637
6638    _cellsByRowResizeChanged : function() {
6639      return this._checkIfSegmentsChanged();
6640    },
6641
6642
6643    // ====================== straightDown ======================
6644
6645    _straightDownReset : function() {
6646      this.straightDown = {
6647        y : 0
6648      };
6649    },
6650
6651    _straightDownLayout : function( $elems ) {
6652      var instance = this;
6653      $elems.each( function( i ){
6654        var $this = $(this);
6655        instance._pushPosition( $this, 0, instance.straightDown.y );
6656        instance.straightDown.y += $this.outerHeight(true);
6657      });
6658    },
6659
6660    _straightDownGetContainerSize : function() {
6661      return { height : this.straightDown.y };
6662    },
6663
6664    _straightDownResizeChanged : function() {
6665      return true;
6666    },
6667
6668
6669    // ====================== masonryHorizontal ======================
6670
6671    _masonryHorizontalReset : function() {
6672      // layout-specific props
6673      this.masonryHorizontal = {};
6674      // FIXME shouldn't have to call this again
6675      this._getSegments( true );
6676      var i = this.masonryHorizontal.rows;
6677      this.masonryHorizontal.rowXs = [];
6678      while (i--) {
6679        this.masonryHorizontal.rowXs.push( 0 );
6680      }
6681    },
6682
6683    _masonryHorizontalLayout : function( $elems ) {
6684      var instance = this,
6685          props = instance.masonryHorizontal;
6686      $elems.each(function(){
6687        var $this  = $(this),
6688            //how many rows does this brick span
6689            rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight );
6690        rowSpan = Math.min( rowSpan, props.rows );
6691
6692        if ( rowSpan === 1 ) {
6693          // if brick spans only one column, just like singleMode
6694          instance._masonryHorizontalPlaceBrick( $this, props.rowXs );
6695        } else {
6696          // brick spans more than one row
6697          // how many different places could this brick fit horizontally
6698          var groupCount = props.rows + 1 - rowSpan,
6699              groupX = [],
6700              groupRowX, i;
6701
6702          // for each group potential horizontal position
6703          for ( i=0; i < groupCount; i++ ) {
6704            // make an array of colY values for that one group
6705            groupRowX = props.rowXs.slice( i, i+rowSpan );
6706            // and get the max value of the array
6707            groupX[i] = Math.max.apply( Math, groupRowX );
6708          }
6709
6710          instance._masonryHorizontalPlaceBrick( $this, groupX );
6711        }
6712      });
6713    },
6714
6715    _masonryHorizontalPlaceBrick : function( $brick, setX ) {
6716      // get the minimum Y value from the columns
6717      var minimumX  = Math.min.apply( Math, setX ),
6718          smallRow  = 0;
6719      // Find index of smallest row, the first from the top
6720      for (var i=0, len = setX.length; i < len; i++) {
6721        if ( setX[i] === minimumX ) {
6722          smallRow = i;
6723          break;
6724        }
6725      }
6726
6727      // position the brick
6728      var x = minimumX,
6729          y = this.masonryHorizontal.rowHeight * smallRow;
6730      this._pushPosition( $brick, x, y );
6731
6732      // apply setHeight to necessary columns
6733      var setWidth = minimumX + $brick.outerWidth(true),
6734          setSpan = this.masonryHorizontal.rows + 1 - len;
6735      for ( i=0; i < setSpan; i++ ) {
6736        this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth;
6737      }
6738    },
6739
6740    _masonryHorizontalGetContainerSize : function() {
6741      var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs );
6742      return { width: containerWidth };
6743    },
6744
6745    _masonryHorizontalResizeChanged : function() {
6746      return this._checkIfSegmentsChanged(true);
6747    },
6748
6749
6750    // ====================== fitColumns ======================
6751
6752    _fitColumnsReset : function() {
6753      this.fitColumns = {
6754        x : 0,
6755        y : 0,
6756        width : 0
6757      };
6758    },
6759
6760    _fitColumnsLayout : function( $elems ) {
6761      var instance = this,
6762          containerHeight = this.element.height(),
6763          props = this.fitColumns;
6764      $elems.each( function() {
6765        var $this = $(this),
6766            atomW = $this.outerWidth(true),
6767            atomH = $this.outerHeight(true);
6768
6769        if ( props.y !== 0 && atomH + props.y > containerHeight ) {
6770          // if this element cannot fit in the current column
6771          props.x = props.width;
6772          props.y = 0;
6773        }
6774
6775        // position the atom
6776        instance._pushPosition( $this, props.x, props.y );
6777
6778        props.width = Math.max( props.x + atomW, props.width );
6779        props.y += atomH;
6780
6781      });
6782    },
6783
6784    _fitColumnsGetContainerSize : function () {
6785      return { width : this.fitColumns.width };
6786    },
6787
6788    _fitColumnsResizeChanged : function() {
6789      return true;
6790    },
6791
6792
6793
6794    // ====================== cellsByColumn ======================
6795
6796    _cellsByColumnReset : function() {
6797      this.cellsByColumn = {
6798        index : 0
6799      };
6800      // get this.cellsByColumn.columnWidth
6801      this._getSegments();
6802      // get this.cellsByColumn.rowHeight
6803      this._getSegments(true);
6804    },
6805
6806    _cellsByColumnLayout : function( $elems ) {
6807      var instance = this,
6808          props = this.cellsByColumn;
6809      $elems.each( function(){
6810        var $this = $(this),
6811            col = Math.floor( props.index / props.rows ),
6812            row = props.index % props.rows,
6813            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
6814            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
6815        instance._pushPosition( $this, x, y );
6816        props.index ++;
6817      });
6818    },
6819
6820    _cellsByColumnGetContainerSize : function() {
6821      return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth };
6822    },
6823
6824    _cellsByColumnResizeChanged : function() {
6825      return this._checkIfSegmentsChanged(true);
6826    },
6827
6828    // ====================== straightAcross ======================
6829
6830    _straightAcrossReset : function() {
6831      this.straightAcross = {
6832        x : 0
6833      };
6834    },
6835
6836    _straightAcrossLayout : function( $elems ) {
6837      var instance = this;
6838      $elems.each( function( i ){
6839        var $this = $(this);
6840        instance._pushPosition( $this, instance.straightAcross.x, 0 );
6841        instance.straightAcross.x += $this.outerWidth(true);
6842      });
6843    },
6844
6845    _straightAcrossGetContainerSize : function() {
6846      return { width : this.straightAcross.x };
6847    },
6848
6849    _straightAcrossResizeChanged : function() {
6850      return true;
6851    }
6852
6853  };
6854
6855
6856  // ======================= imagesLoaded Plugin ===============================
6857  /*!
6858   * jQuery imagesLoaded plugin v1.1.0
6859   * http://github.com/desandro/imagesloaded
6860   *
6861   * MIT License. by Paul Irish et al.
6862   */
6863
6864
6865  // $('#my-container').imagesLoaded(myFunction)
6866  // or
6867  // $('img').imagesLoaded(myFunction)
6868
6869  // execute a callback when all images have loaded.
6870  // needed because .load() doesn't work on cached images
6871
6872  // callback function gets image collection as argument
6873  //  `this` is the container
6874
6875  $.fn.imagesLoaded = function( callback ) {
6876    var $this = this,
6877        $images = $this.find('img').add( $this.filter('img') ),
6878        len = $images.length,
6879        blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==',
6880        loaded = [];
6881
6882    function triggerCallback() {
6883      callback.call( $this, $images );
6884    }
6885
6886    function imgLoaded( event ) {
6887      var img = event.target;
6888      if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
6889        loaded.push( img );
6890        if ( --len <= 0 ){
6891          setTimeout( triggerCallback );
6892          $images.unbind( '.imagesLoaded', imgLoaded );
6893        }
6894      }
6895    }
6896
6897    // if no images, trigger immediately
6898    if ( !len ) {
6899      triggerCallback();
6900    }
6901
6902    $images.bind( 'load.imagesLoaded error.imagesLoaded',  imgLoaded ).each( function() {
6903      // cached images don't fire load sometimes, so we reset src.
6904      var src = this.src;
6905      // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
6906      // data uri bypasses webkit log warning (thx doug jones)
6907      this.src = blank;
6908      this.src = src;
6909    });
6910
6911    return $this;
6912  };
6913
6914
6915  // helper function for logging errors
6916  // $.error breaks jQuery chaining
6917  var logError = function( message ) {
6918    if ( window.console ) {
6919      window.console.error( message );
6920    }
6921  };
6922
6923  // =======================  Plugin bridge  ===============================
6924  // leverages data method to either create or return $.Isotope constructor
6925  // A bit from jQuery UI
6926  //   https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
6927  // A bit from jcarousel
6928  //   https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarou
6928sel.js
6929
6930  $.fn.isotope = function( options, callback ) {
6931    if ( typeof options === 'string' ) {
6932      // call method
6933      var args = Array.prototype.slice.call( arguments, 1 );
6934
6935      this.each(function(){
6936        var instance = $.data( this, 'isotope' );
6937        if ( !instance ) {
6938          logError( "cannot call methods on isotope prior to initialization; " +
6939              "attempted to call method '" + options + "'" );
6940          return;
6941        }
6942        if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
6943          logError( "no such method '" + options + "' for isotope instance" );
6944          return;
6945        }
6946        // apply method
6947        instance[ options ].apply( instance, args );
6948      });
6949    } else {
6950      this.each(function() {
6951        var instance = $.data( this, 'isotope' );
6952        if ( instance ) {
6953          // apply options & init
6954          instance.option( options );
6955          instance._init( callback );
6956        } else {
6957          // initialize new instance
6958          $.data( this, 'isotope', new $.Isotope( options, this, callback ) );
6959        }
6960      });
6961    }
6962    // return jQuery object
6963    // so plugin methods do not have to
6964    return this;
6965  };
6966
6967})( window, jQuery );
6968/*jshint undef: true */
6969/*global jQuery: true */
6970
6971/*
6972   --------------------------------
6973   Infinite Scroll
6974   --------------------------------
6975   + https://github.com/paulirish/infinite-scroll
6976   + version 2.0b2.120519
6977   + Copyright 2011/12 Paul Irish & Luke Shumard
6978   + Licensed under the MIT license
6979
6980   + Documentation: http://infinite-scroll.com/
6981*/
6982
6983(function (window, $, undefined) {
6984	"use strict";
6985
6986    $.infinitescroll = function infscr(options, callback, element) {
6987        this.element = $(element);
6988
6989        // Flag the object in the event of a failed creation
6990        if (!this._create(options, callback)) {
6991            this.failed = true;
6992        }
6993    };
6994
6995    $.infinitescroll.defaults = {
6996        loading: {
6997            finished: undefined,
6998            finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
6999			img: "data:image/gif;base64,R0lGODlh3AATAPQeAPDy+MnQ6LW/4N3h8MzT6rjC4sTM5r/I5NHX7N7j8c7U6tvg8OLl8uXo9Ojr9b3G5MfP6Ovu9tPZ7PT1+vX2+tbb7vf4+8/W69jd7rC73vn5/O/x+K243ai02////wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQECgD/ACwAAAAA3AATAAAF/6AnjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEj0BAScpHLJbDqf0Kh0Sq1ar9isdioItAKGw+MAKYMFhbF63CW438f0mg1R2O8EuXj/aOPtaHx7fn96goR4hmuId4qDdX95c4+RBIGCB4yAjpmQhZN0YGYGXitdZBIVGAsLoq4BBKQDswm1CQRkcG6ytrYKubq8vbfAcMK9v7q7EMO1ycrHvsW6zcTKsczNz8HZw9vG3cjTsMIYqQkCLBwHCgsMDQ4RDAYIqfYSFxDxEfz88/X38Onr16+Bp4ADCco7eC8hQYMAEe57yNCew4IVBU7EGNDiRn8Z831cGLHhSIgdFf9chIeBg7oA7gjaWUWTVQAGE3LqBDCTlc9WOHfm7PkTqNCh54rePDqB6M+lR536hCpUqs2gVZM+xbrTqtGoWqdy1emValeXKzggYBBB5y1acFNZmEvXAoN2cGfJrTv3bl69Ffj2xZt3L1+/fw3XRVw4sGDGcR0fJhxZsF3KtBTThZxZ8mLMgC3fRatCbYMNFCzwLEqLgE4NsDWs/tvqdezZf13Hvk2A9Szdu2X3pg18N+68xXn7rh1c+PLksI/Dhe6cuO3ow3NfV92bdArTqC2Ebd3A8vjf5QWfH6Bg7Nz17c2fj69+fnq+8N2Lty+fuP78/eV2X13neIcCeBRwxorbZrA1ANoCDGrgoG8RTshahQ9iSKEEzUmYIYfNWViUhheCGJyIP5E4oom7WWjgCeBFAJNv1DVV01MAdJhhjdkplWNzO/5oXI846njjVEIqR2OS2B1pE5PVscajkxhMycqLJghQSwT40PgfAl4GqNSXYdZXJn5gSkmmmmJu1aZYb14V51do+pTOCmA40AqVCIhG5IJ9PvYnhIFOxmdqhpaI6GeHCtpooisuutmg+Eg62KOMKuqoTaXgicQWoIYq6qiklmoqFV0UoeqqrLbq6quwxirrrLTWauutJ4QAACH5BAUKABwALAcABADOAAsAAAX/IPd0D2dyRCoUp/k8gpHOKtseR9yiSmGbuBykler9XLAhkbDavXTL5k2oqFqNOxzUZPU5YYZd1XsD72rZpBjbeh52mSNnMSC8lwblKZGwi+0QfIJ8CncnCoCDgoVnBHmKfByGJimPkIwtiAeBkH6ZHJaKmCeVnKKTHIihg5KNq4uoqmEtcRUtEREMBggtEr4QDrjCuRC8h7/BwxENeicSF8DKy82pyNLMOxzWygzFmdvD2L3P0dze4+Xh1Arkyepi7dfFvvTtLQkZBC0T/FX3CRgCMOBHsJ+EHYQY7OinAGECgQsB+Lu3AOK+CewcWjwxQeJBihtNGHSoQOE+iQ3//4XkwBBhRZMcUS6YSXOAwIL8PGqEaSJCiYt9SNoCmnJPAgUVLChdaoFBURN8MAzl2PQphwQLfDFd6lTowglHve6rKpbjhK7/pG5VinZP1qkiz1rl4+tr2LRwWU64cFEihwEtZgbgR1UiHaMVvxpOSwBA37kzGz9e8G+B5MIEKLutOGEsAH2ATQwYfTmuX8aETWdGPZmiZcccNSzeTCA1Sw0bdiitC7LBWgu8jQr8HRzqgpK6gX88QbrB14z/kF+ELpwB8eVQj/JkqdylAudji/+ts3039vEEfK8Vz2dlvxZKG0CmbkKDBvllRd6fCzDvBLKBDSCeffhRJEFebFk1k/Mv9jVIoIJZSeBggwUaNeB+Qk34IE0cXlihcfRxkOAJFFhwGmKlmWDiakZhUJtnLBpnWWcnKaAZcxI0piFGGLBm1mc90kajSCveeBVWKeYEoU2wqeaQi0PetoE+rr14EpVC7oAbAUHqhYExbn2XHHsVqbcVew9tx8+XJKk5AZsqqdlddGpqAKdbAYBn1pcczmSTdWvdmZ17c1b3FZ99vnTdCRFM8OEcAhLwm1NdXnWcBBSMRWmfkWZqVlsmLIiAp/o1gGV2vpS4lalGYsUOqXrddcKCmK61aZ8SjEpUpVFVoCpTj4r661Km7kBHjrDyc1RAIQAAIfkEBQoAGwAsBwAEAM4ACwAABf/gtmUCd4goQQgFKj6PYKi0yrrbc8i4ohQt12EHcal+MNSQiCP8gigdz7iCioaCIvUmZLp8QBzW0EN2vSlCuDtFKaq4RyHzQLEKZNdiQDhRDVooCwkbfm59EAmKi4SGIm+AjIsKjhsqB4mSjT2IOIOUnICeCaB/mZKFNTSRmqVpmJqklSqskq6PfYYCDwYHDC4REQwGCBLGxxIQDsHMwhAIX8bKzcENgSLGF9PU1j3Sy9zX2NrgzQziChLk1BHWxcjf7N046tvN82715czn9Pryz6Ilc4ACj4EBOCZM8KEnAYYADBRKnACAYUMFv1wotIhCEcaJCisqwJFgAUSQGyX/kCSVUUTIdKMwJlyo0oX
6999HlhskwrTJciZHEXsgaqS4s6PJiCAr1uzYU8kBBSgnWFqpoMJMUjGtDmUwkmfVmVypakWhEKvXsS4nhLW5wNjVroJIoc05wSzTr0PtiigpYe4EC2vj4iWrFu5euWIMRBhacaVJhYQBEFjA9jHjyQ0xEABwGceGAZYjY0YBOrRLCxUp29QM+bRkx5s7ZyYgVbTqwwti2ybJ+vLtDYpycyZbYOlptxdx0kV+V7lC5iJAyyRrwYKxAdiz82ng0/jnAdMJFz0cPi104Ec1Vj9/M6F173vKL/feXv156dw11tlqeMMnv4V5Ap53GmjQQH97nFfg+IFiucfgRX5Z8KAgbUlQ4IULIlghhhdOSB6AgX0IVn8eReghen3NRIBsRgnH4l4LuEidZBjwRpt6NM5WGwoW0KSjCwX6yJSMab2GwwAPDXfaBCtWpluRTQqC5JM5oUZAjUNS+VeOLWpJEQ7VYQANW0INJSZVDFSnZphjSikfmzE5N4EEbQI1QJmnWXCmHulRp2edwDXF43txukenJwvI9xyg9Q26Z3MzGUcBYFEChZh6DVTq34AU8Iflh51Sd+CnKFYQ6mmZkhqfBKfSxZWqA9DZanWjxmhrWwi0qtCrt/43K6WqVjjpmhIqgEGvculaGKklKstAACEAACH5BAUKABwALAcABADOAAsAAAX/ICdyQmaMYyAUqPgIBiHPxNpy79kqRXH8wAPsRmDdXpAWgWdEIYm2llCHqjVHU+jjJkwqBTecwItShMXkEfNWSh8e1NGAcLgpDGlRgk7EJ/6Ae3VKfoF/fDuFhohVeDeCfXkcCQqDVQcQhn+VNDOYmpSWaoqBlUSfmowjEA+iEAEGDRGztAwGCDcXEA60tXEiCrq8vREMEBLIyRLCxMWSHMzExnbRvQ2Sy7vN0zvVtNfU2tLY3rPgLdnDvca4VQS/Cpk3ABwSLQkYAQwT/P309vcI7OvXr94jBQMJ/nskkGA/BQBRLNDncAIAiDcG6LsxAWOLiQzmeURBKWSLCQbv/1F0eDGinJUKR47YY1IEgQASKk7Yc7ACRwZm7mHweRJoz59BJUogisKCUaFMR0x4SlJBVBFTk8pZivTR0K73rN5wqlXEAq5Fy3IYgHbEzQ0nLy4QSoCjXLoom96VOJEeCosK5n4kkFfqXjl94wa+l1gvAcGICbewAOAxY8l/Ky/QhAGz4cUkGxu2HNozhwMGBnCUqUdBg9UuW9eUynqSwLHIBujePef1ZGQZXcM+OFuEBeBhi3OYgLyqcuaxbT9vLkf4SeqyWxSQpKGB2gQpm1KdWbu72rPRzR9Ne2Nu9Kzr/1Jqj0yD/fvqP4aXOt5sW/5qsXXVcv1Nsp8IBUAmgswGF3llGgeU1YVXXKTN1FlhWFXW3gIE+DVChApysACHHo7Q4A35lLichh+ROBmLKAzgYmYEYDAhCgxKGOOMn4WR4kkDaoBBOxJtdNKQxFmg5JIWIBnQc07GaORfUY4AEkdV6jHlCEISSZ5yTXpp1pbGZbkWmcuZmQCaE6iJ0FhjMaDjTMsgZaNEHFRAQVp3bqXnZED1qYcECOz5V6BhSWCoVJQIKuKQi2KFKEkEFAqoAo7uYSmO3jk61wUUMKmknJ4SGimBmAa0qVQBhAAAIfkEBQoAGwAsBwAEAM4ACwAABf/gJm5FmRlEqhJC+bywgK5pO4rHI0D3pii22+Mg6/0Ej96weCMAk7cDkXf7lZTTnrMl7eaYoy10JN0ZFdco0XAuvKI6qkgVFJXYNwjkIBcNBgR8TQoGfRsJCRuCYYQQiI+ICosiCoGOkIiKfSl8mJkHZ4U9kZMbKaI3pKGXmJKrngmug4WwkhA0lrCBWgYFCCMQFwoQDRHGxwwGCBLMzRLEx8iGzMMO0cYNeCMKzBDW19lnF9DXDIY/48Xg093f0Q3s1dcR8OLe8+Y91OTv5wrj7o7B+7VNQqABIoRVCMBggsOHE36kSoCBIcSH3EbFangxogJYFi8CkJhqQciLJEf/LDDJEeJIBT0GsOwYUYJGBS0fjpQAMidGmyVP6sx4Y6VQhzs9VUwkwqaCCh0tmKoFtSMDmBOf9phg4SrVrROuasRQAaxXpVUhdsU6IsECZlvX3kwLUWzRt0BHOLTbNlbZG3vZinArge5Dvn7wbqtQkSYAAgtKmnSsYKVKo2AfW048uaPmG386i4Q8EQMBAIAnfB7xBxBqvapJ9zX9WgRS2YMpnvYMGdPK3aMjt/3dUcNI4blpj7iwkMFWDXDvSmgAlijrt9RTR78+PS6z1uAJZIe93Q8g5zcsWCi/4Y+C8bah5zUv3vv89uft30QP23punGCx5954oBBwnwYaNCDY/wYrsYeggnM9B2Fpf8GG2CEUVWhbWAtGouEGDy7Y4IEJVrbSiXghqGKIo7z1IVcXIkKWWR361QOLWWnIhwERpLaaCCee5iMBGJQmJGyPFTnbkfHVZGRtIGrg5HALEJAZbu39BuUEUmq1JJQIPtZilY5hGeSWsSk52G9XqsmgljdIcABytq13HyIM6RcUA+r1qZ4EBF3WHWB29tBgAzRhEGhig8KmqKFv8SeCeo+mgsF7YFXa1qWSbkDpom/mqR1PmHCqJ3fwNRVXjC7S6CZhFVCQ2lWvZiirhQq42SACt25IK2hv8TprriUV1usGgeka7LFcNmCldMLi6qZMgFLgpw16Cipb7bC1knXsBiEAACH5BAUKABsALAcABADOAAsAAAX/4FZsJPkUmUGsLCEUTywXglFuSg7fW1xAvNWLF6sFFcPb42C8EZCj24EJdCp2yoegWsolS0Uu6fmamg8n8YYcLU2bXSiRaXMGvqV6/KAeJAh8VgZqCX+BexCFioWAYgqNi4qAR4ORhRuHY408jAeUhAmYYiuVlpiflqGZa5CWkzc5fKmbbhIpsAoQDRG8vQwQCBLCwxK6vb5qwhfGxxENahvCEA7NzskSy7vNzzzK09W/PNHF1NvX2dXcN8K55cfh69Luveol3vO8zwi4Yhj+AQwmCBw4IYclDAAJDlQggVOChAoLKkgFkSCAHDwWLKhIEOONARsDKryogFPIiAUb/95gJNIiw4wnI778GFPhzBKFOAq8qLJEhQpiNArjMcHCmlTCUDIouTKBhApELSxFWiGiVKY4E2CAekPgUphDu0742nRrVLJZnyrFSqKQ2ohoSYAMW6IoDpNJ4bLdILTnAj8KUF7UeENjAKuDyxIgOuGiOI0EBBMgLNew5AUrDTMGsFixwBIaNCQuAXJB57qNJ2OWm2Aj4skwCQCIyNkhhtMkdsIuodE0AN4LJDRgfLPtn5YDLdBlraAByuUbBgxQwICxMOnYpVOPej074OFdlfc0TqC62OIbcppHjV4o+LrieWhfT8JC/I/T6W8oCl29vQ0XjLdBaA3s1RcPBO7lFvpX8BVoG4O5jTXRQRDuJ6FDTzEWF1/BCZhgbyAKE9qICYLloQYOFtahVRsWYlZ4KQJHlwHS/IYaZ6sZd9tmu5HQm2xi1UaTbzxYwJk/wBF5g5EEYOBZeEfGZmNdFyFZmZIR4jikbLThlh5kUUVJGmRT7sekkziRWUIACABk3T4qCsedgO4xhgGcY7q5pHJ4klBBTQRJ0CeHcoYHHUh6wgfdn9uJdSdMiebGJ0zUPTcoS286FCkrZxnYoYYKWLkBowhQoBeaOlZAgVhLidrXqg2G
6999iqpQpZ4apwSwRtjqrB3muoF9BboaXKmshlqWqsWiGt2wphJkQbAU5hoCACH5BAUKABsALAcABADOAAsAAAX/oGFw2WZuT5oZROsSQnGaKjRvilI893MItlNOJ5v5gDcFrHhKIWcEYu/xFEqNv6B1N62aclysF7fsZYe5aOx2yL5aAUGSaT1oTYMBwQ5VGCAJgYIJCnx1gIOBhXdwiIl7d0p2iYGQUAQBjoOFSQR/lIQHnZ+Ue6OagqYzSqSJi5eTpTxGcjcSChANEbu8DBAIEsHBChe5vL13G7fFuscRDcnKuM3H0La3EA7Oz8kKEsXazr7Cw9/Gztar5uHHvte47MjktznZ2w0G1+D3BgirAqJmJMAQgMGEgwgn5Ei0gKDBhBMALGRYEOJBb5QcWlQo4cbAihZz3GgIMqFEBSM1/4ZEOWPAgpIIJXYU+PIhRG8ja1qU6VHlzZknJNQ6UanCjQkWCIGSUGEjAwVLjc44+DTqUQtPPS5gejUrTa5TJ3g9sWCr1BNUWZI161StiQUDmLYdGfesibQ3XMq1OPYthrwuA2yU2LBs2cBHIypYQPPlYAKFD5cVvNPtW8eVGbdcQADATsiNO4cFAPkvHpedPzc8kUcPgNGgZ5RNDZG05reoE9s2vSEP79MEGiQGy1qP8LA4ZcdtsJE48ONoLTBtTV0B9LsTnPceoIDBDQvS7W7vfjVY3q3eZ4A339J4eaAmKqU/sV58HvJh2RcnIBsDUw0ABqhBA5aV5V9XUFGiHfVeAiWwoFgJJrIXRH1tEMiDFV4oHoAEGlaWhgIGSGBO2nFomYY3mKjVglidaNYJGJDkWW2xxTfbjCbVaOGNqoX2GloR8ZeTaECS9pthRGJH2g0b3Agbk6hNANtteHD2GJUucfajCQBy5OOTQ25ZgUPvaVVQmbKh9510/qQpwXx3SQdfk8tZJOd5b6JJFplT3ZnmmX3qd5l1eg5q00HrtUkUn0AKaiGjClSAgKLYZcgWXwocGRcCFGCKwSB6ceqphwmYRUFYT/1WKlOdUpipmxW0mlCqHjYkAaeoZlqrqZ4qd+upQKaapn/AmgAegZ8KUtYtFAQQAgAh+QQFCgAbACwHAAQAzgALAAAF/+C2PUcmiCiZGUTrEkKBis8jQEquKwU5HyXIbEPgyX7BYa5wTNmEMwWsSXsqFbEh8DYs9mrgGjdK6GkPY5GOeU6ryz7UFopSQEzygOGhJBjoIgMDBAcBM0V/CYqLCQqFOwobiYyKjn2TlI6GKC2YjJZknouaZAcQlJUHl6eooJwKooobqoewrJSEmyKdt59NhRKFMxLEEA4RyMkMEAjDEhfGycqAG8TQx9IRDRDE3d3R2ctD1RLg0ttKEnbY5wZD3+zJ6M7X2RHi9Oby7u/r9g38UFjTh2xZJBEBMDAboogAgwkQI07IMUORwocSJwCgWDFBAIwZOaJIsOBjRogKJP8wTODw5ESVHVtm3AhzpEeQElOuNDlTZ0ycEUWKWFASqEahGwYUPbnxoAgEdlYSqDBkgoUNClAlIHbSAoOsqCRQnQHxq1axVb06FWFxLIqyaze0Tft1JVqyE+pWXMD1pF6bYl3+HTqAWNW8cRUFzmih0ZAAB2oGKukSAAGGRHWJgLiR6AylBLpuHKKUMlMCngMpDSAa9QIUggZVVvDaJobLeC3XZpvgNgCmtPcuwP3WgmXSq4do0DC6o2/guzcseECtUoO0hmcsGKDgOt7ssBd07wqesAIGZC1YIBa7PQHvb1+SFo+++HrJSQfB33xfav3i5eX3Hnb4CTJgegEq8tH/YQEOcIJzbm2G2EoYRLgBXFpVmFYDcREV4HIcnmUhiGBRouEMJGJGzHIspqgdXxK0yCKHRNXoIX4uorCdTyjkyNtdPWrA4Up82EbAbzMRxxZRR54WXVLDIRmRcag5d2R6ugl3ZXzNhTecchpMhIGVAKAYpgJjjsSklBEd99maZoo535ZvdamjBEpusJyctg3h4X8XqodBMx0tiNeg/oGJaKGABpogS40KSqiaEgBqlQWLUtqoVQnytekEjzo0hHqhRorppOZt2p923M2AAV+oBtpAnnPNoB6HaU6mAAIU+IXmi3j2mtFXuUoHKwXpzVrsjcgGOauKEjQrwq157hitGq2NoWmjh7z6Wmxb0m5w66+2VRAuXN/yFUAIACH5BAUKABsALAcABADOAAsAAAX/4CZuRiaM45MZqBgIRbs9AqTcuFLE7VHLOh7KB5ERdjJaEaU4ClO/lgKWjKKcMiJQ8KgumcieVdQMD8cbBeuAkkC6LYLhOxoQ2PF5Ys9PKPBMen17f0CCg4VSh32JV4t8jSNqEIOEgJKPlkYBlJWRInKdiJdkmQlvKAsLBxdABA4RsbIMBggtEhcQsLKxDBC2TAS6vLENdJLDxMZAubu8vjIbzcQRtMzJz79S08oQEt/guNiyy7fcvMbh4OezdAvGrakLAQwyABsELQkY9BP+//ckyPDD4J9BfAMh1GsBoImMeQUN+lMgUJ9CiRMa5msxoB9Gh/o8GmxYMZXIgxtR/yQ46S/gQAURR0pDwYDfywoyLPip5AdnCwsMFPBU4BPFhKBDi444quCmDKZOfwZ9KEGpCKgcN1jdALSpPqIYsabS+nSqvqplvYqQYAeDPgwKwjaMtiDl0oaqUAyo+3TuWwUAMPpVCfee0cEjVBGQq2ABx7oTWmQk4FglZMGN9fGVDMCuiH2AOVOu/PmyxM630gwM0CCn6q8LjVJ8GXvpa5Uwn95OTC/nNxkda1/dLSK475IjCD6dHbK1ZOa4hXP9DXs5chJ00UpVm5xo2qRpoxptwF2E4/IbJpB/SDz9+q9b1aNfQH08+p4a8uvX8B53fLP+ycAfemjsRUBgp1H20K+BghHgVgt1GXZXZpZ5lt4ECjxYR4ScUWiShEtZqBiIInRGWnERNnjiBglw+JyGnxUmGowsyiiZg189lNtPGACjV2+S9UjbU0JWF6SPvEk3QZEqsZYTk3UAaRSUnznJI5LmESCdBVSyaOWUWLK4I5gDUYVeV1T9l+FZClCAUVA09uSmRHBCKAECFEhW51ht6rnmWBXkaR+NjuHpJ40D3DmnQXt2F+ihZxlqVKOfQRACACH5BAUKABwALAcABADOAAsAAAX/ICdyUCkUo/g8mUG8MCGkKgspeC6j6XEIEBpBUeCNfECaglBcOVfJFK7YQwZHQ6JRZBUqTrSuVEuD3nI45pYjFuWKvjjSkCoRaBUMWxkwBGgJCXspQ36Bh4EEB0oKhoiBgyNLjo8Ki4QElIiWfJqHnISNEI+Ql5J9o6SgkqKkgqYihamPkW6oNBgSfiMMDQkGCBLCwxIQDhHIyQwQCGMKxsnKVyPCF9DREQ3MxMPX0cu4wt7J2uHWx9jlKd3o39MiuefYEcvNkuLt5O8c1ePI2tyELXGQwoGDAQf+iEC2xByDCRAjTlAgIUWCBRgCPJQ4AQBFXAs0coT40WLIjRxL/47AcHLkxIomRXL0CHPERZkpa4q4iVKiyp0tR/7kwHMkTUBBJR5dOCEBAVcKKtCAyOHpowXCpk7goABqBZdcvWploACpBKkpIJI1q5OD2rIWE0R1uTZu1LFwbWL9OlKuWb4c6+o9i3dEgw0RCGDUG9KlRw56gDY2qmCByZBaASi+TACA0TucAaTteCcy0ZuOK3N2vJlx58+LRQyY3Xm0ZsgjZg+oPQLi7dUcNXi0LOJw1pgNtB7XG6CBy+U75SYfPTSQAgZTNUDnQHt67wnbZyvwLgKiMN3oCZB3C76tdewpLFgIP2C88rbi4Y+QT3+8S5USMICZXWj1pkEDeUU3lOYGB3alSoEiMIjgX4WlgNF2EibIwQIXauWXSRg2SAOHIU5IIIMoZkhhWiJaiFVbKo6AQEgQXrTAazO1JhkBrBG3Y2Y6EsUhaGn95hprSN0oWpFE7rhkeaQBchGOEWnwEmc0uKWZj0LeuNV3W4Y2lZHFlQCSRjTIl8uZ+kG5HU/3sRlnTG2ytyadytnD3HrmuRcSn+0h1dycexIK1KCjYaCnjCCVqOFFJTZ5GkUUjESWaUIKU2lgCmAKKQIUjHapXRKE+t2og1VgankNYnohqKJ2CmKplso6GKz7WYCgqxeuyoF8u9IQAgA7",
7000            msg: null,
7001            msgText: "<em>Loading the next set of products...</em>",
7002            selector: null,
7003            speed: 'fast',
7004            start: undefined
7005        },
7006        state: {
7007            isDuringAjax: false,
7008            isInvalidPage: false,
7009            isDestroyed: false,
7010            isDone: false, // For when it goes all the way through the archive.
7011            isPaused: false,
7012            currPage: 1
7013        },
7014        debug: false,
7015		behavior: undefined,
7016        binder: $(window), // used to cache the selector
7017        nextSelector: "div.navigation a:first",
7018        navSelector: "div.navigation",
7019        contentSelector: null, // rename to pageFragment
7020        extraScrollPx: 150,
7021        itemSelector: "div.post",
7022        animate: false,
7023        pathParse: undefined,
7024        dataType: 'html',
7025        appendCallback: true,
7026        bufferPx: 40,
7027        errorCallback: function () { },
7028        infid: 0, //Instance ID
7029        pixelsFromNavToBottom: undefined,
7030        path: undefined, // Either parts of a URL as an array (e.g. ["/page/", "/"] or a function that takes in the page number and returns a URL
7031		prefill: false, // When the document is smaller than the window, load data until the document is larger or links are exhausted
7032        maxPage: undefined // to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)
7033	};
7034
7035    $.infinitescroll.prototype = {
7036
7037        /*	
7038            ----------------------------
7039            Private methods
7040            ----------------------------
7041            */
7042
7043        // Bind or unbind from scroll
7044        _binding: function infscr_binding(binding) {
7045
7046            var instance = this,
7047            opts = instance.options;
7048
7049            opts.v = '2.0b2.120520';
7050
7051            // if behavior is defined and this function is extended, call that instead of default
7052            if (!!opts.behavior && this['_binding_'+opts.behavior] !== undefined) {
7053                this['_binding_'+opts.behavior].call(this);
7054                return;
7055            }
7056
7057            if (binding !== 'bind' && binding !== 'unbind') {
7058                this._debug('Binding value  ' + binding + ' not valid');
7059                return false;
7060            }
7061
7062            if (binding === 'unbind') {
7063                (this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);
7064            } else {
7065                (this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function () {
7066                    instance.scroll();
7067                });
7068            }
7069
7070            this._debug('Binding', binding);
7071        },
7072
7073        // Fundamental aspects of the plugin are initialized
7074        _create: function infscr_create(options, callback) {
7075
7076            // Add custom options to defaults
7077            var opts = $.extend(true, {}, $.infinitescroll.defaults, options);
7078			this.options = opts;
7079			var $window = $(window);
7080			var instance = this;
7081
7082			// Validate selectors
7083            if (!instance._validate(options)) {
7084				return false;
7085			}
7086
7087            // Validate page fragment path
7088            var path = $(opts.nextSelector).attr('href');
7089            if (!path) {
7090                this._debug('Navigation selector not found');
7091                return false;
7092            }
7093
7094            // Set the path to be a relative URL from root.
7095            opts.path = opts.path || this._determinepath(path);
7096
7097            // contentSelector is 'page fragment' option for .load() / .ajax() calls
7098            opts.contentSelector = opts.contentSelector || this.element;
7099
7100            // loading.selector - if we want to place the load message in a specific selector, defaulted to the contentSelector
7101            opts.loading.selector = opts.loading.selector || opts.contentSelector;
7102
7103            // Define loading.msg
7104            opts.loading.msg = opts.loading.msg || $('<div id="infscr-loading"><img alt="Loading..." src="' + opts.loading.img + '" /><div>' + opts.loading.msgText + '</div></div>');
7105
7106            // Preload loading.img
7107            (new Image()).src = opts.loading.img;
7108
7109            // distance from nav links to bottom
7110            // computed as: height of the document + top offset of container - top offset of nav link
7111            if(opts.pixelsFromNavToBottom === undefined) {
7112				opts.pixelsFromNavToBottom = $(document).height() - $(opts.navSelector).offset().top;
7113			}
7114
7115			var self = this;
7116
7117            // determine loading.start actions
7118            opts.loading.start = opts.loading.start || function() {
7119                $(opts.navSelector).hide();
7120                opts.loading.msg
7121                .appendTo(opts.loading.selector.parent())
7122                .show(opts.loading.speed, $.proxy(function() {
7123					this.beginAjax(opts);
7124				}, self));
7125            };
7126
7127            // determine loading.finished actions
7128            opts.loading.finished = opts.loading.finished || function() {
7129                opts.loading.msg.fadeOut(opts.loading.speed);
7130            };
7131
7132			// callback loading
7133            opts.callback = function(instance, data, url) {
7134                if (!!opts.behavior && instance['_callback_'+opts.behavior] !== undefined) {
7135                    instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data, url);
7136                }
7137
7138                if (callback) {
7139                    callback.call($(opts.contentSelector)[0], data, opts, url);
7140                }
7141
7142				if (opts.prefill) {
7143					$window.bind("resize.infinite-scroll", instance._prefill);
7144				}
7145            };
7146
7147			if (options.debug) {
7148				// Tell IE9 to use its built-in console
7149				if (Function.prototype.bind && (typeof console === 'object' || typeof console === 'function') && typeof console.log === "object") {
7150					["log","info","warn","error","assert","dir","clear","profile","profileEnd"]
7151						.forEach(function (method) {
7152							console[method] = this.call(console[method], console);
7153						}, Function.prototype.bind);
7154				}
7155			}
7156
7157            this._setup();
7158
7159			// Setups the prefill method for use
7160			if (opts.prefill) {
7161				this._prefill();
7162			}
7163
7164            // Return true to indicate successful creation
7165            return true;
7166        },
7167
7168		_prefill: function infscr_prefill() {
7169			var instance = this;
7170			var $document = $(document);
7171			var $window = $(window);
7172
7173			function needsPrefill() {
7174				return ($document.height() <= $window.height());
7175			}
7176
7177			this._prefill = function() {
7178				if (needsPrefill()) {
7179					instance.scroll();
7180				}
7181
7182				$window.bind("resize.infinite-scroll", function() {
7183					if (needsPrefill()) {
7184						$window.unbind("resize.infinite-scroll");
7185						instance.scroll();
7186					}
7187				});
7188			};
7189
7190			// Call self after setting up the new function
7191			this._prefill();
7192		},
7193
7194        // Console log wrapper
7195        _debug: function infscr_debug() {
7196			if (true !== this.options.debug) {
7197				return;
7198			}
7199
7200			if (typeof console !== 'undefined' && typeof console.log === 'function') {
7201				// Modern browsers
7202				// Single argument, which is a string
7203				if ((Array.prototype.slice.call(arguments)).length === 1 && typeof Array.prototype.slice.call(arguments)[0] === 'string') {
7204					console.log( (Array.prototype.slice.call(arguments)).toString() );
7205				} else {
7206					console.log( Array.prototype.slice.call(arguments) );
7207				}
7208			} else if (!Function.prototype.bind && typeof console !== 'undefined' && typeof console.log === 'object') {
7209				// IE8
7210				Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
7211			}
7212        },
7213
7214        // find the number to increment in the path.
7215        _determinepath: function infscr_determinepath(path) {
7216
7217            var opts = this.options;
7218
7219            // if behavior is defined and this function is extended, call that instead of default
7220            if (!!opts.behavior && this['_determinepath_'+opts.behavior] !== undefined) {
7221                return this['_determinepath_'+opts.behavior].call(this,path);
7222            }
7223
7224            if (!!opts.pathParse) {
7225
7226                this._debug('pathParse manual');
7227                return opts.pathParse(path, this.options.state.currPage+1);
7228
7229            } else if (path.match(/^(.*?)\b2\b(.*?$)/)) {
7230                path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
7231
7232                // if there is any 2 in the url at all.    
7233            } else if (path.match(/^(.*?)2(.*?$)/)) {
7234
7235                // page= is used in django:
7236                // http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127
7237                if (path.match(/^(.*?page=)2(\/.*|$)/)) {
7238                    path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
7239                    return path;
7240                }
7241
7242                path = path.match(/^(.*?)2(.*?$)/).slice(1);
7243
7244            } else {
7245
7246                // page= is used in drupal too but second page is page=1 not page=2:
7247                // thx Jerod Fritz, vladikoff
7248                if (path.match(/^(.*?page=)1(\/.*|$)/)) {
7249                    path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
7250                    return path;
7251                } else {
7252                    this._debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');
7253                    // Get rid of isInvalidPage to allow permalink to state
7254                    opts.state.isInvalidPage = true;  //prevent it from running on this page.
7255                }
7256            }
7257            this._debug('determinePath', path);
7258            return path;
7259
7260        },
7261
7262        // Custom error
7263        _error: function infscr_error(xhr) {
7264
7265            var opts = this.options;
7266
7267            // if behavior is defined and this function is extended, call that instead of default
7268            if (!!opts.behavior && this['_error_'+opts.behavior] !== undefined) {
7269                this['_error_'+opts.behavior].call(this,xhr);
7270                return;
7271            }
7272
7273            if (xhr !== 'destroy' && xhr !== 'end') {
7274                xhr = 'unknown';
7275            }
7276
7277            this._debug('Error', xhr);
7278
7279            if (xhr === 'end') {
7280                this._showdonemsg();
7281            }
7282
7283            opts.state.isDone = true;
7284            opts.state.currPage = 1; // if you need to go back to this instance
7285            opts.state.isPaused = false;
7286            this._binding('unbind');
7287
7288        },
7289
7290        // Load Callback
7291        _loadcallback: function infscr_loadcallback(box, data, url) {
7292            var opts = this.options,
7293            callback = this.options.callback, // GLOBAL OBJECT FOR CALLBACK
7294            result = (opts.state.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
7295            frag;
7296
7297            // if behavior is defined and this function is extended, call that instead of default
7298            if (!!opts.behavior && this['_loadcallback_'+opts.behavior] !== undefined) {
7299                this['_loadcallback_'+opts.behavior].call(this,box,data);
7300                return;
7301            }
7302
7303			switch (result) {
7304				case 'done':
7305					this._showdonemsg();
7306					return false;
7307
7308				case 'no-append':
7309					if (opts.dataType === 'html') {
7310						data = '<div>' + data + '</div>';
7311						data = $(data).find(opts.itemSelector);
7312					}
7313					break;
7314
7315				case 'append':
7316					var children = box.children();
7317					// if it didn't return anything
7318					if (children.length === 0) {
7319						return this._error('end');
7320					}
7321
7322					// use a documentFragment because it works when content is going into a table or UL
7323					frag = document.createDocumentFragment();
7324					while (box[0].firstChild) {
7325						frag.appendChild(box[0].firstChild);
7326					}
7327
7328					this._debug('contentSelector', $(opts.contentSelector)[0]);
7329					$(opts.contentSelector)[0].appendChild(frag);
7330					// previously, we would pass in the new DOM element as context for the callback
7331					// however we're now using a documentfragment, which doesn't have parents or children,
7332					// so the context is the contentContainer guy, and we pass in an array
7333					// of the elements collected as the first argument.
7334
7335					data = children.get();
7336					break;
7337			}
7338
7339            // loadingEnd function
7340            opts.loading.finished.call($(opts.contentSelector)[0],opts);
7341
7342            // smooth scroll to ease in the new content
7343            if (opts.animate) {
7344                var scrollTo = $(window).scrollTop() + $('#infscr-loading').height() + opts.extraScrollPx + 'px';
7345                $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.state.isDuringAjax = false; });
7346            }
7347
7348            if (!opts.animate) {
7349				// once the call is done, we can allow it again.
7350				opts.state.isDuringAjax = false;
7351			}
7352
7353            callback(this, data, url);
7354
7355			if (opts.prefill) {
7356				this._prefill();
7357			}
7358		},
7359
7360        _nearbottom: function infscr_nearbottom() {
7361
7362            var opts = this.options,
7363            pixelsFromWindowBottomToBottom = 0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
7364
7365            // if behavior is defined and this function is extended, call that instead of default
7366            if (!!opts.behavior && this['_nearbottom_'+opts.behavior] !== undefined) {
7367                return this['_nearbottom_'+opts.behavior].call(this);
7368            }
7369
7370            this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
7371
7372            // if distance remaining in the scroll (including buffer) is less than the orignal nav to bottom....
7373            return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
7374
7375        },
7376
7377        // Pause / temporarily disable plugin from firing
7378        _pausing: function infscr_pausing(pause) {
7379
7380            var opts = this.options;
7381
7382            // if behavior is defined and this function is extended, call that instead of default
7383            if (!!opts.behavior && this['_pausing_'+opts.behavior] !== undefined) {
7384                this['_pausing_'+opts.behavior].call(this,pause);
7385                return;
7386            }
7387
7388            // If pause is not 'pause' or 'resume', toggle it's value
7389            if (pause !== 'pause' && pause !== 'resume' && pause !== null) {
7390                this._debug('Invalid argument. Toggling pause value instead');
7391            }
7392
7393            pause = (pause && (pause === 'pause' || pause === 'resume')) ? pause : 'toggle';
7394
7395            switch (pause) {
7396                case 'pause':
7397                    opts.state.isPaused = true;
7398                break;
7399
7400                case 'resume':
7401                    opts.state.isPaused = false;
7402                break;
7403
7404                case 'toggle':
7405                    opts.state.isPaused = !opts.state.isPaused;
7406                break;
7407            }
7408
7409            this._debug('Paused', opts.state.isPaused);
7410            return false;
7411
7412        },
7413
7414        // Behavior is determined
7415        // If the behavior option is undefined, it will set to default and bind to scroll
7416        _setup: function infscr_setup() {
7417
7418            var opts = this.options;
7419
7420            // if behavior is defined and this function is extended, call that instead of default
7421            if (!!opts.behavior && this['_setup_'+opts.behavior] !== undefined) {
7422                this['_setup_'+opts.behavior].call(this);
7423                return;
7424            }
7425
7426            this._binding('bind');
7427
7428            return false;
7429
7430        },
7431
7432        // Show done message
7433        _showdonemsg: function infscr_showdonemsg() {
7434
7435            var opts = this.options;
7436
7437            // if behavior is defined and this function is extended, call that instead of default
7438            if (!!opts.behavior && this['_showdonemsg_'+opts.behavior] !== undefined) {
7439                this['_showdonemsg_'+opts.behavior].call(this);
7440                return;
7441            }
7442
7443            opts.loading.msg
7444            .find('img')
7445            .hide()
7446            .parent()
7447            .find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
7448                $(this).parent().fadeOut(opts.loading.speed);
7449            });
7450
7451            // user provided callback when done    
7452            opts.errorCallback.call($(opts.contentSelector)[0],'done');
7453        },
7454
7455        // grab each selector option and see if any fail
7456        _validate: function infscr_validate(opts) {
7457            for (var key in opts) {
7458                if (key.indexOf && key.indexOf('Selector') > -1 && $(opts[key]).length === 0) {
7459                    this._debug('Your ' + key + ' found no elements.');
7460                    return false;
7461                }
7462            }
7463
7464            return true;
7465        },
7466
7467        /*	
7468            ----------------------------
7469            Public methods
7470            ----------------------------
7471            */
7472
7473        // Bind to scroll
7474        bind: function infscr_bind() {
7475            this._binding('bind');
7476        },
7477
7478        // Destroy current instance of plugin
7479        destroy: function infscr_destroy() {
7480            this.options.state.isDestroyed = true;
7481			this.options.loading.finished();
7482            return this._error('destroy');
7483        },
7484
7485        // Set pause value to false
7486        pause: function infscr_pause() {
7487            this._pausing('pause');
7488        },
7489
7490        // Set pause value to false
7491        resume: function infscr_resume() {
7492            this._pausing('resume');
7493        },
7494
7495		beginAjax: function infscr_ajax(opts) {
7496			var instance = this,
7497				path = opts.path,
7498				box, desturl, method, condition;
7499
7500			// increment the URL bit. e.g. /page/3/
7501			opts.state.currPage++;
7502
7503            // Manually control maximum page 
7504            if ( opts.maxPage != undefined && opts.state.currPage > opts.maxPage ){
7505                this.destroy();
7506                return;
7507            }
7508
7509			// if we're dealing with a table we can't use DIVs
7510			box = $(opts.contentSelector).is('table') ? $('<tbody/>') : $('<div/>');
7511
7512			desturl = (typeof path === 'function') ? path(opts.state.currPage) : path.join(opts.state.currPage);
7513			instance._debug('heading into ajax', desturl);
7514
7515			method = (opts.dataType === 'html' || opts.dataType === 'json' ) ? opts.dataType : 'html+callback';
7516			if (opts.appendCallback && opts.dataType === 'html') {
7517				method += '+callback';
7518			}
7519
7520			switch (method) {
7521				case 'html+callback':
7522					instance._debug('Using HTML via .load() method');
7523					box.load(desturl + ' ' + opts.itemSelector, undefined, function infscr_ajax_callback(responseText) {
7524						instance._loadcallback(box, responseText, desturl);
7525					});
7526
7527					break;
7528
7529				case 'html':
7530					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
7531					$.ajax({
7532						// params
7533						url: desturl,
7534						dataType: opts.dataType,
7535						complete: function infscr_ajax_callback(jqXHR, textStatus) {
7536							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
7537							if (condition) {
7538								instance._loadcallback(box, jqXHR.responseText, desturl);
7539							} else {
7540								instance._error('end');
7541							}
7542						}
7543					});
7544
7545					break;
7546				case 'json':
7547					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
7548					$.ajax({
7549						dataType: 'json',
7550						type: 'GET',
7551						url: desturl,
7552						success: function (data, textStatus, jqXHR) {
7553							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
7554							if (opts.appendCallback) {
7555								// if appendCallback is true, you must defined template in options.
7556								// note that data passed into _loadcallback is already an html (after processed in opts.template(data)).
7557								if (opts.template !== undefined) {
7558									var theData = opts.template(data);
7559									box.append(theData);
7560									if (condition) {
7561										instance._loadcallback(box, theData);
7562									} else {
7563										instance._error('end');
7564									}
7565								} else {
7566									instance._debug("template must be defined.");
7567									instance._error('end');
7568								}
7569							} else {
7570								// if appendCallback is false, we will pass in the JSON object. you should handle it yourself in your callback.
7571								if (condition) {
7572									instance._loadcallback(box, data, desturl);
7573								} else {
7574									instance._error('end');
7575								}
7576							}
7577						},
7578						error: function() {
7579							instance._debug("JSON ajax request failed.");
7580							instance._error('end');
7581						}
7582					});
7583
7584					break;
7585			}
7586		},
7587
7588        // Retrieve next set of content items
7589        retrieve: function infscr_retrieve(pageNum) {
7590			pageNum = pageNum || null;
7591
7592			var instance = this,
7593            opts = instance.options;
7594
7595            // if behavior is defined and this function is extended, call that instead of default
7596            if (!!opts.behavior && this['retrieve_'+opts.behavior] !== undefined) {
7597                this['retrieve_'+opts.behavior].call(this,pageNum);
7598                return;
7599            }
7600
7601            // for manual triggers, if destroyed, get out of here
7602            if (opts.state.isDestroyed) {
7603                this._debug('Instance is destroyed');
7604                return false;
7605            }
7606
7607            // we dont want to fire the ajax multiple times
7608            opts.state.isDuringAjax = true;
7609
7610            opts.loading.start.call($(opts.contentSelector)[0],opts);
7611        },
7612
7613        // Check to see next page is needed
7614        scroll: function infscr_scroll() {
7615
7616            var opts = this.options,
7617            state = opts.state;
7618
7619            // if behavior is defined and this function is extended, call that instead of default
7620            if (!!opts.behavior && this['scroll_'+opts.behavior] !== undefined) {
7621                this['scroll_'+opts.behavior].call(this);
7622                return;
7623            }
7624
7625            if (state.isDuringAjax || state.isInvalidPage || state.isDone || state.isDestroyed || state.isPaused) {
7626				return;
7627			}
7628
7629            if (!this._nearbottom()) {
7630				return;
7631			}
7632
7633            this.retrieve();
7634
7635        },
7636
7637        // Toggle pause value
7638        toggle: function infscr_toggle() {
7639            this._pausing();
7640        },
7641
7642        // Unbind from scroll
7643        unbind: function infscr_unbind() {
7644            this._binding('unbind');
7645        },
7646
7647        // update options
7648        update: function infscr_options(key) {
7649            if ($.isPlainObject(key)) {
7650                this.options = $.extend(true,this.options,key);
7651            }
7652        }
7653    };
7654
7655
7656    /*	
7657        ----------------------------
7658        Infinite Scroll function
7659        ----------------------------
7660
7661        Borrowed logic from the following...
7662
7663        jQuery UI
7664        - https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
7665
7666        jCarousel
7667        - https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
7668
7669        Masonry
7670        - https://github.com/desandro/masonry/blob/master/jquery.masonry.js		
7671
7672*/
7673
7674    $.fn.infinitescroll = function infscr_init(options, callback) {
7675
7676        var thisCall = typeof options;
7677
7678        switch (thisCall) {
7679
7680            // method 
7681            case 'string':
7682                var args = Array.prototype.slice.call(arguments, 1);
7683
7684				this.each(function () {
7685					var instance = $.data(this, 'infinitescroll');
7686
7687					if (!instance) {
7688						// not setup yet
7689						// return $.error('Method ' + options + ' cannot be called until Infinite Scroll is setup');
7690						return false;
7691					}
7692
7693					if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
7694						// return $.error('No such method ' + options + ' for Infinite Scroll');
7695						return false;
7696					}
7697
7698					// no errors!
7699					instance[options].apply(instance, args);
7700				});
7701
7702            break;
7703
7704            // creation 
7705            case 'object':
7706
7707                this.each(function () {
7708
7709                var instance = $.data(this, 'infinitescroll');
7710
7711                if (instance) {
7712
7713                    // update options of current instance
7714                    instance.update(options);
7715
7716                } else {
7717
7718                    // initialize new instance
7719                    instance = new $.infinitescroll(options, callback, this);
7720
7721                    // don't attach if instantiation failed
7722                    if (!instance.failed) {
7723                        $.data(this, 'infinitescroll', instance);
7724                    }
7725
7726                }
7727
7728            });
7729
7730            break;
7731
7732        }
7733
7734        return this;
7735    };
7736
7737
7738
7739    /* 
7740     * smartscroll: debounced scroll event for jQuery *
7741     * https://github.com/lukeshumard/smartscroll
7742     * Based on smartresize by @louis_remi: https://github.com/lrbabe/jquery.smartresize.js *
7743     * Copyright 2011 Louis-Remi & Luke Shumard * Licensed under the MIT license. *
7744     */
7745
7746    var event = $.event,
7747    scrollTimeout;
7748
7749    event.special.smartscroll = {
7750        setup: function () {
7751            $(this).bind("scroll", event.special.smartscroll.handler);
7752        },
7753        teardown: function () {
7754            $(this).unbind("scroll", event.special.smartscroll.handler);
7755        },
7756        handler: function (event, execAsap) {
7757            // Save the context
7758            var context = this,
7759            args = arguments;
7760
7761            // set correct event type
7762            event.type = "smartscroll";
7763
7764            if (scrollTimeout) { clearTimeout(scrollTimeout); }
7765            scrollTimeout = setTimeout(function () {
7766                $(context).trigger('smartscroll', args);
7767            }, execAsap === "execAsap" ? 0 : 100);
7768        }
7769    };
7770
7771    $.fn.smartscroll = function (fn) {
7772        return fn ? this.bind("smartscroll", fn) : this.trigger("smartscroll", ["execAsap"]);
7773    };
7774
7775
7776})(window, jQuery);
7777
7778/*
7779	--------------------------------
7780	Infinite Scroll Behavior
7781	Manual / Twitter-style
7782	--------------------------------
7783	+ https://github.com/paulirish/infinitescroll/
7784	+ version 2.0b2.110617
7785	+ Copyright 2011 Paul Irish & Luke Shumard
7786	+ Licensed under the MIT license
7787	
7788	+ Documentation: http://infinite-scroll.com/
7789	
7790*/
7791
7792(function($, undefined) {
7793	$.extend($.infinitescroll.prototype,{
7794
7795		_setup_click: function infscr_setup_click () {
7796			var opts = this.options,
7797				instance = this;
7798			// Bind nextSelector link to retrieve
7799			$(opts.nextSelector).click(function(e) {
7800				if (e.which == 1 && !e.metaKey && !e.shiftKey) {
7801					e.preventDefault();
7802					instance.retrieve();
7803				}
7804			});
7805
7806			// Define loadingStart to never hide pager
7807			instance.options.loading.start = function (opts) {
7808				opts.loading.msg
7809					.appendTo(opts.loading.selector)
7810					.show(opts.loading.speed, function () {
7811						instance.beginAjax(opts);
7812					});
7813			}
7814		},
7815		_showdonemsg_click: function infscr_showdonemsg_click () {
7816			var opts = this.options,
7817				instance = this;
7818
7819			//Do all the usual stuff
7820			opts.loading.msg
7821				.find('img')
7822				.hide()
7823				.parent()
7824				.find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
7825					$(this).parent().fadeOut('normal');
7826				});
7827
7828			//And also hide the navSelector
7829			$(opts.navSelector).fadeOut('normal');
7830
7831			// user provided callback when done
7832			opts.errorCallback.call($(opts.contentSelector)[0],'done');
7833
7834		}
7835
7836	});
7837})(jQuery);
7838
7839/*!
vendor: 5,629 bytes, lines 7840-8048
7840 * fancyBox - jQuery Plugin
7841 * version: 2.1.3 (Tue, 23 Oct 2012)
7842 * @requires jQuery v1.6 or later
7843 *
7844 * Examples at http://fancyapps.com/fancybox/
7845 * License: www.fancyapps.com/fancybox/#license
7846 *
7847 * Copyright 2012 Janis Skarnelis - [email protected]
7848 *
7849 */
7850
7851(function (window, document, $, undefined) {
7852	"use strict";
7853
7854	var W = $(window),
7855		D = $(document),
7856		F = $.fancybox = function () {
7857			F.open.apply( this, arguments );
7858		},
7859		didUpdate = null,
7860		isTouch	  = document.createTouch !== undefined,
7861
7862		isQuery	= function(obj) {
7863			return obj && obj.hasOwnProperty && obj instanceof $;
7864		},
7865		isString = function(str) {
7866			return str && $.type(str) === "string";
7867		},
7868		isPercentage = function(str) {
7869			return isString(str) && str.indexOf('%') > 0;
7870		},
7871		isScrollable = function(el) {
7872			return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
7873		},
7874		getScalar = function(orig, dim) {
7875			var value = parseInt(orig, 10) || 0;
7876
7877			if (dim && isPercentage(orig)) {
7878				value = F.getViewport()[ dim ] / 100 * value;
7879			}
7880
7881			return Math.ceil(value);
7882		},
7883		getValue = function(value, dim) {
7884			return getScalar(value, dim) + 'px';
7885		};
7886
7887	$.extend(F, {
7888		// The current version of fancyBox
7889		version: '2.1.3',
7890
7891		defaults: {
7892			padding : 15,
7893			margin  : 20,
7894
7895			width     : 800,
7896			height    : 600,
7897			minWidth  : 100,
7898			minHeight : 100,
7899			maxWidth  : 9999,
7900			maxHeight : 9999,
7901
7902			autoSize   : true,
7903			autoHeight : false,
7904			autoWidth  : false,
7905
7906			autoResize  : true,
7907			autoCenter  : !isTouch,
7908			fitToView   : true,
7909			aspectRatio : false,
7910			topRatio    : 0.5,
7911			leftRatio   : 0.5,
7912
7913			scrolling : 'auto', // 'auto', 'yes' or 'no'
7914			wrapCSS   : '',
7915
7916			arrows     : true,
7917			closeBtn   : true,
7918			closeClick : false,
7919			nextClick  : false,
7920			mouseWheel : true,
7921			autoPlay   : false,
7922			playSpeed  : 3000,
7923			preload    : 3,
7924			modal      : false,
7925			loop       : true,
7926
7927			ajax  : {
7928				dataType : 'html',
7929				headers  : { 'X-fancyBox': true }
7930			},
7931			iframe : {
7932				scrolling : 'auto',
7933				preload   : true
7934			},
7935			swf : {
7936				wmode: 'transparent',
7937				allowfullscreen   : 'true',
7938				allowscriptaccess : 'always'
7939			},
7940
7941			keys  : {
7942				next : {
7943					13 : 'left', // enter
7944					34 : 'up',   // page down
7945					39 : 'left', // right arrow
7946					40 : 'up'    // down arrow
7947				},
7948				prev : {
7949					8  : 'right',  // backspace
7950					33 : 'down',   // page up
7951					37 : 'right',  // left arrow
7952					38 : 'down'    // up arrow
7953				},
7954				close  : [27], // escape key
7955				play   : [32], // space - start/stop slideshow
7956				toggle : [70]  // letter "f" - toggle fullscreen
7957			},
7958
7959			direction : {
7960				next : 'left',
7961				prev : 'right'
7962			},
7963
7964			scrollOutside  : true,
7965
7966			// Override some properties
7967			index   : 0,
7968			type    : null,
7969			href    : null,
7970			content : null,
7971			title   : null,
7972
7973			// HTML templates
7974			tpl: {
7975				wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
7976				image    : '<img class="fancybox-image" src="{href}" alt="" />',
7977				iframe   : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + ($.browser.msie ? ' allowtransparency="true"' : '') + '></iframe>',
7978				error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
7979				closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
7980				next     : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
7981				prev     : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
7982			},
7983
7984			// Properties for each animation type
7985			// Opening fancyBox
7986			openEffect  : 'fade', // 'elastic', 'fade' or 'none'
7987			openSpeed   : 250,
7988			openEasing  : 'swing',
7989			openOpacity : true,
7990			openMethod  : 'zoomIn',
7991
7992			// Closing fancyBox
7993			closeEffect  : 'fade', // 'elastic', 'fade' or 'none'
7994			closeSpeed   : 250,
7995			closeEasing  : 'swing',
7996			closeOpacity : true,
7997			closeMethod  : 'zoomOut',
7998
7999			// Changing next gallery item
8000			nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
8001			nextSpeed  : 250,
8002			nextEasing : 'swing',
8003			nextMethod : 'changeIn',
8004
8005			// Changing previous gallery item
8006			prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
8007			prevSpeed  : 250,
8008			prevEasing : 'swing',
8009			prevMethod : 'changeOut',
8010
8011			// Enable default helpers
8012			helpers : {
8013				overlay : true,
8014				title   : true
8015			},
8016
8017			// Callbacks
8018			onCancel     : $.noop, // If canceling
8019			beforeLoad   : $.noop, // Before loading
8020			afterLoad    : $.noop, // After loading
8021			beforeShow   : $.noop, // Before changing in current item
8022			afterShow    : $.noop, // After opening
8023			beforeChange : $.noop, // Before changing gallery item
8024			beforeClose  : $.noop, // Before closing
8025			afterClose   : $.noop  // After closing
8026		},
8027
8028		//Current state
8029		group    : {}, // Selected group
8030		opts     : {}, // Group options
8031		previous : null,  // Previous element
8032		coming   : null,  // Element being loaded
8033		current  : null,  // Currently loaded element
8034		isActive : false, // Is activated
8035		isOpen   : false, // Is currently open
8036		isOpened : false, // Have been fully opened at least once
8037
8038		wrap  : null,
8039		skin  : null,
8040		outer : null,
8041		inner : null,
8042
8043		player : {
8044			timer    : null,
8045			isActive : false
8046		},
8047
8048		// Loaders
vendor: 35,360 bytes, lines 8049-9532
8049		ajaxLoad   : null,
8050		imgPreload : null,
8051
8052		// Some collections
8053		transitions : {},
8054		helpers     : {},
8055
8056		/*
8057		 *	Static methods
8058		 */
8059
8060		open: function (group, opts) {
8061			if (!group) {
8062				return;
8063			}
8064
8065			if (!$.isPlainObject(opts)) {
8066				opts = {};
8067			}
8068
8069			// Close if already active
8070			if (false === F.close(true)) {
8071				return;
8072			}
8073
8074			// Normalize group
8075			if (!$.isArray(group)) {
8076				group = isQuery(group) ? $(group).get() : [group];
8077			}
8078
8079			// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
8080			$.each(group, function(i, element) {
8081				var obj = {},
8082					href,
8083					title,
8084					content,
8085					type,
8086					rez,
8087					hrefParts,
8088					selector;
8089
8090				if ($.type(element) === "object") {
8091					// Check if is DOM element
8092					if (element.nodeType) {
8093						element = $(element);
8094					}
8095
8096					if (isQuery(element)) {
8097						obj = {
8098							href    : element.data('fancybox-href') || element.attr('href'),
8099							title   : element.data('fancybox-title') || element.attr('title'),
8100							isDom   : true,
8101							element : element
8102						};
8103
8104						if ($.metadata) {
8105							$.extend(true, obj, element.metadata());
8106						}
8107
8108					} else {
8109						obj = element;
8110					}
8111				}
8112
8113				href  = opts.href  || obj.href || (isString(element) ? element : null);
8114				title = opts.title !== undefined ? opts.title : obj.title || '';
8115
8116				content = opts.content || obj.content;
8117				type    = content ? 'html' : (opts.type  || obj.type);
8118
8119				if (!type && obj.isDom) {
8120					type = element.data('fancybox-type');
8121
8122					if (!type) {
8123						rez  = element.prop('class').match(/fancybox\.(\w+)/);
8124						type = rez ? rez[1] : null;
8125					}
8126				}
8127
8128				if (isString(href)) {
8129					// Try to guess the content type
8130					if (!type) {
8131						if (F.isImage(href)) {
8132							type = 'image';
8133
8134						} else if (F.isSWF(href)) {
8135							type = 'swf';
8136
8137						} else if (href.charAt(0) === '#') {
8138							type = 'inline';
8139
8140						} else if (isString(element)) {
8141							type    = 'html';
8142							content = element;
8143						}
8144					}
8145
8146					// Split url into two pieces with source url and content selector, e.g,
8147					// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
8148					if (type === 'ajax') {
8149						hrefParts = href.split(/\s+/, 2);
8150						href      = hrefParts.shift();
8151						selector  = hrefParts.shift();
8152					}
8153				}
8154
8155				if (!content) {
8156					if (type === 'inline') {
8157						if (href) {
8158							content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
8159
8160						} else if (obj.isDom) {
8161							content = element;
8162						}
8163
8164					} else if (type === 'html') {
8165						content = href;
8166
8167					} else if (!type && !href && obj.isDom) {
8168						type    = 'inline';
8169						content = element;
8170					}
8171				}
8172
8173				$.extend(obj, {
8174					href     : href,
8175					type     : type,
8176					content  : content,
8177					title    : title,
8178					selector : selector
8179				});
8180
8181				group[ i ] = obj;
8182			});
8183
8184			// Extend the defaults
8185			F.opts = $.extend(true, {}, F.defaults, opts);
8186
8187			// All options are merged recursive except keys
8188			if (opts.keys !== undefined) {
8189				F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
8190			}
8191
8192			F.group = group;
8193
8194			return F._start(F.opts.index);
8195		},
8196
8197		// Cancel image loading or abort ajax request
8198		cancel: function () {
8199			var coming = F.coming;
8200
8201			if (!coming || false === F.trigger('onCancel')) {
8202				return;
8203			}
8204
8205			F.hideLoading();
8206
8207			if (F.ajaxLoad) {
8208				F.ajaxLoad.abort();
8209			}
8210
8211			F.ajaxLoad = null;
8212
8213			if (F.imgPreload) {
8214				F.imgPreload.onload = F.imgPreload.onerror = null;
8215			}
8216
8217			if (coming.wrap) {
8218				coming.wrap.stop(true, true).trigger('onReset').remove();
8219			}
8220
8221			F.coming = null;
8222
8223			// If the first item has been canceled, then clear everything
8224			if (!F.current) {
8225				F._afterZoomOut( coming );
8226			}
8227		},
8228
8229		// Start closing animation if is open; remove immediately if opening/closing
8230		close: function (event) {
8231			F.cancel();
8232
8233			if (false === F.trigger('beforeClose')) {
8234				return;
8235			}
8236
8237			F.unbindEvents();
8238
8239			if (!F.isActive) {
8240				return;
8241			}
8242
8243			if (!F.isOpen || event === true) {
8244				$('.fancybox-wrap').stop(true).trigger('onReset').remove();
8245
8246				F._afterZoomOut();
8247
8248			} else {
8249				F.isOpen = F.isOpened = false;
8250				F.isClosing = true;
8251
8252				$('.fancybox-item, .fancybox-nav').remove();
8253
8254				F.wrap.stop(true, true).removeClass('fancybox-opened');
8255
8256				F.transitions[ F.current.closeMethod ]();
8257			}
8258		},
8259
8260		// Manage slideshow:
8261		//   $.fancybox.play(); - toggle slideshow
8262		//   $.fancybox.play( true ); - start
8263		//   $.fancybox.play( false ); - stop
8264		play: function ( action ) {
8265			var clear = function () {
8266					clearTimeout(F.player.timer);
8267				},
8268				set = function () {
8269					clear();
8270
8271					if (F.current && F.player.isActive) {
8272						F.player.timer = setTimeout(F.next, F.current.playSpeed);
8273					}
8274				},
8275				stop = function () {
8276					clear();
8277
8278					$('body').unbind('.player');
8279
8280					F.player.isActive = false;
8281
8282					F.trigger('onPlayEnd');
8283				},
8284				start = function () {
8285					if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
8286						F.player.isActive = true;
8287
8288						$('body').bind({
8289							'afterShow.player onUpdate.player'   : set,
8290							'onCancel.player beforeClose.player' : stop,
8291							'beforeLoad.player' : clear
8292						});
8293
8294						set();
8295
8296						F.trigger('onPlayStart');
8297					}
8298				};
8299
8300			if (action === true || (!F.player.isActive && action !== false)) {
8301				start();
8302			} else {
8303				stop();
8304			}
8305		},
8306
8307		// Navigate to next gallery item
8308		next: function ( direction ) {
8309			var current = F.current;
8310
8311			if (current) {
8312				if (!isString(direction)) {
8313					direction = current.direction.next;
8314				}
8315
8316				F.jumpto(current.index + 1, direction, 'next');
8317			}
8318		},
8319
8320		// Navigate to previous gallery item
8321		prev: function ( direction ) {
8322			var current = F.current;
8323
8324			if (current) {
8325				if (!isString(direction)) {
8326					direction = current.direction.prev;
8327				}
8328
8329				F.jumpto(current.index - 1, direction, 'prev');
8330			}
8331		},
8332
8333		// Navigate to gallery item by index
8334		jumpto: function ( index, direction, router ) {
8335			var current = F.current;
8336
8337			if (!current) {
8338				return;
8339			}
8340
8341			index = getScalar(index);
8342
8343			F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
8344			F.router    = router || 'jumpto';
8345
8346			if (current.loop) {
8347				if (index < 0) {
8348					index = current.group.length + (index % current.group.length);
8349				}
8350
8351				index = index % current.group.length;
8352			}
8353
8354			if (current.group[ index ] !== undefined) {
8355				F.cancel();
8356
8357				F._start(index);
8358			}
8359		},
8360
8361		// Center inside viewport and toggle position type to fixed or absolute if needed
8362		reposition: function (e, onlyAbsolute) {
8363			var current = F.current,
8364				wrap    = current ? current.wrap : null,
8365				pos;
8366
8367			if (wrap) {
8368				pos = F._getPosition(onlyAbsolute);
8369
8370				if (e && e.type === 'scroll') {
8371					delete pos.position;
8372
8373					wrap.stop(true, true).animate(pos, 200);
8374
8375				} else {
8376					wrap.css(pos);
8377
8378					current.pos = $.extend({}, current.dim, pos);
8379				}
8380			}
8381		},
8382
8383		update: function (e) {
8384			var type = (e && e.type),
8385				anyway = !type || type === 'orientationchange';
8386
8387			if (anyway) {
8388				clearTimeout(didUpdate);
8389
8390				didUpdate = null;
8391			}
8392
8393			if (!F.isOpen || didUpdate) {
8394				return;
8395			}
8396
8397			didUpdate = setTimeout(function() {
8398				var current = F.current;
8399
8400				if (!current || F.isClosing) {
8401					return;
8402				}
8403
8404				F.wrap.removeClass('fancybox-tmp');
8405                //alert(type === 'resize');
8406				if (anyway || type === 'load' || (current.autoResize)) {
8407					F._setDimension();
8408				}
8409
8410				if (!(type === 'scroll' && current.canShrink)) {
8411					F.reposition(e);
8412				}
8413
8414				F.trigger('onUpdate');
8415
8416				didUpdate = null;
8417
8418			}, (anyway && !isTouch ? 0 : 300));
8419		},
8420
8421		// Shrink content to fit inside viewport or restore if resized
8422		toggle: function ( action ) {
8423			if (F.isOpen) {
8424				F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
8425
8426				// Help browser to restore document dimensions
8427				if (isTouch) {
8428					F.wrap.removeAttr('style').addClass('fancybox-tmp');
8429
8430					F.trigger('onUpdate');
8431				}
8432
8433				F.update();
8434			}
8435		},
8436
8437		hideLoading: function () {
8438			D.unbind('.loading');
8439
8440			$('#fancybox-loading').remove();
8441		},
8442
8443		showLoading: function () {
8444			var el, viewport;
8445
8446			F.hideLoading();
8447
8448			el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
8449
8450			// If user will press the escape-button, the request will be canceled
8451			D.bind('keydown.loading', function(e) {
8452				if ((e.which || e.keyCode) === 27) {
8453					e.preventDefault();
8454
8455					F.cancel();
8456				}
8457			});
8458
8459			if (!F.defaults.fixed) {
8460				viewport = F.getViewport();
8461
8462				el.css({
8463					position : 'absolute',
8464					top  : (viewport.h * 0.5) + viewport.y,
8465					left : (viewport.w * 0.5) + viewport.x
8466				});
8467			}
8468		},
8469
8470		getViewport: function () {
8471			var locked = (F.current && F.current.locked) || false,
8472				rez    = {
8473					x: W.scrollLeft(),
8474					y: W.scrollTop()
8475				};
8476
8477			if (locked) {
8478				rez.w = locked[0].clientWidth;
8479				rez.h = locked[0].clientHeight;
8480
8481			} else {
8482				// See http://bugs.jquery.com/ticket/6724
8483				rez.w = isTouch && window.innerWidth  ? window.innerWidth  : W.width();
8484				rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
8485			}
8486
8487			return rez;
8488		},
8489
8490		// Unbind the keyboard / clicking actions
8491		unbindEvents: function () {
8492			if (F.wrap && isQuery(F.wrap)) {
8493				F.wrap.unbind('.fb');
8494			}
8495
8496			D.unbind('.fb');
8497			W.unbind('.fb');
8498		},
8499
8500		bindEvents: function () {
8501			var current = F.current,
8502				keys;
8503
8504			if (!current) {
8505				return;
8506			}
8507
8508			// Changing document height on iOS devices triggers a 'resize' event,
8509			// that can change document height... repeating infinitely
8510			// emtheme fix bug auot scroll in IE
8511			//W.bind('orientationchange.fb' + (isTouch || $.browser.msie ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
8512			// backup
8513			W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
8514
8515			keys = current.keys;
8516
8517			if (keys) {
8518				D.bind('keydown.fb', function (e) {
8519					var code   = e.which || e.keyCode,
8520						target = e.target || e.srcElement;
8521
8522					// Skip esc key if loading, because showLoading will cancel preloading
8523					if (code === 27 && F.coming) {
8524						return false;
8525					}
8526
8527					// Ignore key combinations and key events within form elements
8528					if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
8529						$.each(keys, function(i, val) {
8530							if (current.group.length > 1 && val[ code ] !== undefined) {
8531								F[ i ]( val[ code ] );
8532
8533								e.preventDefault();
8534								return false;
8535							}
8536
8537							if ($.inArray(code, val) > -1) {
8538								F[ i ] ();
8539
8540								e.preventDefault();
8541								return false;
8542							}
8543						});
8544					}
8545				});
8546			}
8547
8548			if ($.fn.mousewheel && current.mouseWheel) {
8549				F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
8550					var target = e.target || null,
8551						parent = $(target),
8552						canScroll = false;
8553
8554					while (parent.length) {
8555						if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
8556							break;
8557						}
8558
8559						canScroll = isScrollable( parent[0] );
8560						parent    = $(parent).parent();
8561					}
8562
8563					if (delta !== 0 && !canScroll) {
8564						if (F.group.length > 1 && !current.canShrink) {
8565							if (deltaY > 0 || deltaX > 0) {
8566								F.prev( deltaY > 0 ? 'down' : 'left' );
8567
8568							} else if (deltaY < 0 || deltaX < 0) {
8569								F.next( deltaY < 0 ? 'up' : 'right' );
8570							}
8571
8572							e.preventDefault();
8573						}
8574					}
8575				});
8576			}
8577		},
8578
8579		trigger: function (event, o) {
8580			var ret, obj = o || F.coming || F.current;
8581
8582			if (!obj) {
8583				return;
8584			}
8585
8586			if ($.isFunction( obj[event] )) {
8587				ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
8588			}
8589
8590			if (ret === false) {
8591				return false;
8592			}
8593
8594			if (obj.helpers) {
8595				$.each(obj.helpers, function (helper, opts) {
8596					if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
8597						opts = $.extend(true, {}, F.helpers[helper].defaults, opts);
8598
8599						F.helpers[helper][event](opts, obj);
8600					}
8601				});
8602			}
8603
8604			$.event.trigger(event + '.fb');
8605		},
8606
8607		isImage: function (str) {
8608			return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i);
8609		},
8610
8611		isSWF: function (str) {
8612			return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
8613		},
8614
8615		_start: function (index) {
8616			var coming = {},
8617				obj,
8618				href,
8619				type,
8620				margin,
8621				padding;
8622
8623			index = getScalar( index );
8624			obj   = F.group[ index ] || null;
8625
8626			if (!obj) {
8627				return false;
8628			}
8629
8630			coming = $.extend(true, {}, F.opts, obj);
8631
8632			// Convert margin and padding properties to array - top, right, bottom, left
8633			margin  = coming.margin;
8634			padding = coming.padding;
8635
8636			if ($.type(margin) === 'number') {
8637				coming.margin = [margin, margin, margin, margin];
8638			}
8639
8640			if ($.type(padding) === 'number') {
8641				coming.padding = [padding, padding, padding, padding];
8642			}
8643
8644			// 'modal' propery is just a shortcut
8645			if (coming.modal) {
8646				$.extend(true, coming, {
8647					closeBtn   : false,
8648					closeClick : false,
8649					nextClick  : false,
8650					arrows     : false,
8651					mouseWheel : false,
8652					keys       : null,
8653					helpers: {
8654						overlay : {
8655							closeClick : false
8656						}
8657					}
8658				});
8659			}
8660
8661			// 'autoSize' property is a shortcut, too
8662			if (coming.autoSize) {
8663				coming.autoWidth = coming.autoHeight = true;
8664			}
8665
8666			if (coming.width === 'auto') {
8667				coming.autoWidth = true;
8668			}
8669
8670			if (coming.height === 'auto') {
8671				coming.autoHeight = true;
8672			}
8673
8674			/*
8675			 * Add reference to the group, so it`s possible to access from callbacks, example:
8676			 * afterLoad : function() {
8677			 *     this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
8678			 * }
8679			 */
8680
8681			coming.group  = F.group;
8682			coming.index  = index;
8683
8684			// Give a chance for callback or helpers to update coming item (type, title, etc)
8685			F.coming = coming;
8686
8687			if (false === F.trigger('beforeLoad')) {
8688				F.coming = null;
8689
8690				return;
8691			}
8692
8693			type = coming.type;
8694			href = coming.href;
8695
8696			if (!type) {
8697				F.coming = null;
8698
8699				//If we can not determine content type then drop silently or display next/prev item if looping through gallery
8700				if (F.current && F.router && F.router !== 'jumpto') {
8701					F.current.index = index;
8702
8703					return F[ F.router ]( F.direction );
8704				}
8705
8706				return false;
8707			}
8708
8709			F.isActive = true;
8710
8711			if (type === 'image' || type === 'swf') {
8712				coming.autoHeight = coming.autoWidth = false;
8713				coming.scrolling  = 'visible';
8714			}
8715
8716			if (type === 'image') {
8717				coming.aspectRatio = true;
8718			}
8719
8720			if (type === 'iframe' && isTouch) {
8721				coming.scrolling = 'scroll';
8722			}
8723
8724			// Build the neccessary markup
8725			coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
8726
8727			$.extend(coming, {
8728				skin  : $('.fancybox-skin',  coming.wrap),
8729				outer : $('.fancybox-outer', coming.wrap),
8730				inner : $('.fancybox-inner', coming.wrap)
8731			});
8732
8733			$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
8734				coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
8735			});
8736
8737			F.trigger('onReady');
8738
8739			// Check before try to load; 'inline' and 'html' types need content, others - href
8740			if (type === 'inline' || type === 'html') {
8741				if (!coming.content || !coming.content.length) {
8742					return F._error( 'content' );
8743				}
8744
8745			} else if (!href) {
8746				return F._error( 'href' );
8747			}
8748
8749			if (type === 'image') {
8750				F._loadImage();
8751
8752			} else if (type === 'ajax') {
8753				F._loadAjax();
8754
8755			} else if (type === 'iframe') {
8756				F._loadIframe();
8757
8758			} else {
8759				F._afterLoad();
8760			}
8761		},
8762
8763		_error: function ( type ) {
8764			$.extend(F.coming, {
8765				type       : 'html',
8766				autoWidth  : true,
8767				autoHeight : true,
8768				minWidth   : 0,
8769				minHeight  : 0,
8770				scrolling  : 'no',
8771				hasError   : type,
8772				content    : F.coming.tpl.error
8773			});
8774
8775			F._afterLoad();
8776		},
8777
8778		_loadImage: function () {
8779			// Reset preload image so it is later possible to check "complete" property
8780			var img = F.imgPreload = new Image();
8781
8782			img.onload = function () {
8783				this.onload = this.onerror = null;
8784
8785				F.coming.width  = this.width;
8786				F.coming.height = this.height;
8787
8788				F._afterLoad();
8789			};
8790
8791			img.onerror = function () {
8792				this.onload = this.onerror = null;
8793
8794				F._error( 'image' );
8795			};
8796
8797			img.src = F.coming.href;
8798
8799			if (img.complete !== true) {
8800				F.showLoading();
8801			}
8802		},
8803
8804		_loadAjax: function () {
8805			var coming = F.coming;
8806
8807			F.showLoading();
8808
8809			F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
8810				url: coming.href,
8811				error: function (jqXHR, textStatus) {
8812					if (F.coming && textStatus !== 'abort') {
8813						F._error( 'ajax', jqXHR );
8814
8815					} else {
8816						F.hideLoading();
8817					}
8818				},
8819				success: function (data, textStatus) {
8820					if (textStatus === 'success') {
8821						coming.content = data;
8822
8823						F._afterLoad();
8824					}
8825				}
8826			}));
8827		},
8828
8829		_loadIframe: function() {
8830			var coming = F.coming,
8831				iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
8832					.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
8833					.attr('src', coming.href);
8834
8835			// This helps IE
8836			$(coming.wrap).bind('onReset', function () {
8837				try {
8838					$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
8839				} catch (e) {}
8840			});
8841
8842			if (coming.iframe.preload) {
8843				F.showLoading();
8844
8845				iframe.one('load', function() {
8846					$(this).data('ready', 1);
8847
8848					// iOS will lose scrolling if we resize
8849					if (!isTouch) {
8850						$(this).bind('load.fb', F.update);
8851					}
8852
8853					// Without this trick:
8854					//   - iframe won't scroll on iOS devices
8855					//   - IE7 sometimes displays empty iframe
8856					$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
8857
8858					F._afterLoad();
8859				});
8860			}
8861
8862			coming.content = iframe.appendTo( coming.inner );
8863
8864			if (!coming.iframe.preload) {
8865				F._afterLoad();
8866			}
8867		},
8868
8869		_preloadImages: function() {
8870			var group   = F.group,
8871				current = F.current,
8872				len     = group.length,
8873				cnt     = current.preload ? Math.min(current.preload, len - 1) : 0,
8874				item,
8875				i;
8876
8877			for (i = 1; i <= cnt; i += 1) {
8878				item = group[ (current.index + i ) % len ];
8879
8880				if (item.type === 'image' && item.href) {
8881					new Image().src = item.href;
8882				}
8883			}
8884		},
8885
8886		_afterLoad: function () {
8887			var coming   = F.coming,
8888				previous = F.current,
8889				placeholder = 'fancybox-placeholder',
8890				current,
8891				content,
8892				type,
8893				scrolling,
8894				href,
8895				embed;
8896
8897			F.hideLoading();
8898
8899			if (!coming || F.isActive === false) {
8900				return;
8901			}
8902
8903			if (false === F.trigger('afterLoad', coming, previous)) {
8904				coming.wrap.stop(true).trigger('onReset').remove();
8905
8906				F.coming = null;
8907
8908				return;
8909			}
8910
8911			if (previous) {
8912				F.trigger('beforeChange', previous);
8913
8914				previous.wrap.stop(true).removeClass('fancybox-opened')
8915					.find('.fancybox-item, .fancybox-nav')
8916					.remove();
8917			}
8918
8919			F.unbindEvents();
8920
8921			current   = coming;
8922			content   = coming.content;
8923			type      = coming.type;
8924			scrolling = coming.scrolling;
8925
8926			$.extend(F, {
8927				wrap  : current.wrap,
8928				skin  : current.skin,
8929				outer : current.outer,
8930				inner : current.inner,
8931				current  : current,
8932				previous : previous
8933			});
8934
8935			href = current.href;
8936
8937			switch (type) {
8938				case 'inline':
8939				case 'ajax':
8940				case 'html':
8941					if (current.selector) {
8942						content = $('<div>').html(content).find(current.selector);
8943
8944					} else if (isQuery(content)) {
8945						if (!content.data(placeholder)) {
8946							content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
8947						}
8948
8949						content = content.show().detach();
8950
8951						current.wrap.bind('onReset', function () {
8952							if ($(this).find(content).length) {
8953								content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
8954							}
8955						});
8956					}
8957				break;
8958
8959				case 'image':
8960					content = current.tpl.image.replace('{href}', href);
8961				break;
8962
8963				case 'swf':
8964					content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
8965					embed   = '';
8966
8967					$.each(current.swf, function(name, val) {
8968						content += '<param name="' + name + '" value="' + val + '"></param>';
8969						embed   += ' ' + name + '="' + val + '"';
8970					});
8971
8972					content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
8973				break;
8974			}
8975
8976			if (!(isQuery(content) && content.parent().is(current.inner))) {
8977				current.inner.append( content );
8978			}
8979
8980			// Give a chance for helpers or callbacks to update elements
8981			F.trigger('beforeShow');
8982
8983			// Set scrolling before calculating dimensions
8984			current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
8985
8986			// Set initial dimensions and start position
8987			F._setDimension();
8988
8989			F.reposition();
8990
8991			F.isOpen = false;
8992			F.coming = null;
8993
8994			F.bindEvents();
8995
8996			if (!F.isOpened) {
8997				$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
8998
8999			} else if (previous.prevMethod) {
9000				F.transitions[ previous.prevMethod ]();
9001			}
9002
9003			F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
9004
9005			F._preloadImages();
9006		},
9007
9008		_setDimension: function () {
9009			var viewport   = F.getViewport(),
9010				steps      = 0,
9011				canShrink  = false,
9012				canExpand  = false,
9013				wrap       = F.wrap,
9014				skin       = F.skin,
9015				inner      = F.inner,
9016				current    = F.current,
9017				width      = current.width,
9018				height     = current.height,
9019				minWidth   = current.minWidth,
9020				minHeight  = current.minHeight,
9021				maxWidth   = current.maxWidth,
9022				maxHeight  = current.maxHeight,
9023				scrolling  = current.scrolling,
9024				scrollOut  = current.scrollOutside ? current.scrollbarWidth : 0,
9025				margin     = current.margin,
9026				wMargin    = getScalar(margin[1] + margin[3]),
9027				hMargin    = getScalar(margin[0] + margin[2]),
9028				wPadding,
9029				hPadding,
9030				wSpace,
9031				hSpace,
9032				origWidth,
9033				origHeight,
9034				origMaxWidth,
9035				origMaxHeight,
9036				ratio,
9037				width_,
9038				height_,
9039				maxWidth_,
9040				maxHeight_,
9041				iframe,
9042				body;
9043
9044			// Reset dimensions so we could re-check actual size
9045			wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
9046
9047			wPadding = getScalar(skin.outerWidth(true)  - skin.width());
9048			hPadding = getScalar(skin.outerHeight(true) - skin.height());
9049
9050			// Any space between content and viewport (margin, padding, border, title)
9051			wSpace = wMargin + wPadding;
9052			hSpace = hMargin + hPadding;
9053
9054			origWidth  = isPercentage(width)  ? (viewport.w - wSpace) * getScalar(width)  / 100 : width;
9055			origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
9056
9057			if (current.type === 'iframe') {
9058				iframe = current.content;
9059
9060				if (current.autoHeight && iframe.data('ready') === 1) {
9061					try {
9062						if (iframe[0].contentWindow.document.location) {
9063							inner.width( origWidth ).height(9999);
9064
9065							body = iframe.contents().find('body');
9066
9067							if (scrollOut) {
9068								body.css('overflow-x', 'hidden');
9069							}
9070
9071							origHeight = body.height();
9072						}
9073
9074					} catch (e) {}
9075				}
9076
9077			} else if (current.autoWidth || current.autoHeight) {
9078				inner.addClass( 'fancybox-tmp' );
9079
9080				// Set width or height in case we need to calculate only one dimension
9081				if (!current.autoWidth) {
9082					inner.width( origWidth );
9083				}
9084
9085				if (!current.autoHeight) {
9086					inner.height( origHeight );
9087				}
9088
9089				if (current.autoWidth) {
9090					origWidth = inner.width();
9091				}
9092
9093				if (current.autoHeight) {
9094					origHeight = inner.height();
9095				}
9096
9097				inner.removeClass( 'fancybox-tmp' );
9098			}
9099
9100			width  = getScalar( origWidth );
9101			height = getScalar( origHeight );
9102
9103			ratio  = origWidth / origHeight;
9104
9105			// Calculations for the content
9106			minWidth  = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
9107			maxWidth  = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
9108
9109			minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
9110			maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
9111
9112			// These will be used to determine if wrap can fit in the viewport
9113			origMaxWidth  = maxWidth;
9114			origMaxHeight = maxHeight;
9115
9116			if (current.fitToView) {
9117				maxWidth  = Math.min(viewport.w - wSpace, maxWidth);
9118				maxHeight = Math.min(viewport.h - hSpace, maxHeight);
9119			}
9120
9121			maxWidth_  = viewport.w - wMargin;
9122			maxHeight_ = viewport.h - hMargin;
9123
9124			if (current.aspectRatio) {
9125				if (width > maxWidth) {
9126					width  = maxWidth;
9127					height = getScalar(width / ratio);
9128				}
9129
9130				if (height > maxHeight) {
9131					height = maxHeight;
9132					width  = getScalar(height * ratio);
9133				}
9134
9135				if (width < minWidth) {
9136					width  = minWidth;
9137					height = getScalar(width / ratio);
9138				}
9139
9140				if (height < minHeight) {
9141					height = minHeight;
9142					width  = getScalar(height * ratio);
9143				}
9144
9145			} else {
9146				width = Math.max(minWidth, Math.min(width, maxWidth));
9147
9148				if (current.autoHeight && current.type !== 'iframe') {
9149					inner.width( width );
9150
9151					height = inner.height();
9152				}
9153
9154				height = Math.max(minHeight, Math.min(height, maxHeight));
9155			}
9156
9157			// Try to fit inside viewport (including the title)
9158			if (current.fitToView) {
9159				inner.width( width ).height( height );
9160
9161				wrap.width( width + wPadding );
9162
9163				// Real wrap dimensions
9164				width_  = wrap.width();
9165				height_ = wrap.height();
9166
9167				if (current.aspectRatio) {
9168					while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
9169						if (steps++ > 19) {
9170							break;
9171						}
9172
9173						height = Math.max(minHeight, Math.min(maxHeight, height - 10));
9174						width  = getScalar(height * ratio);
9175
9176						if (width < minWidth) {
9177							width  = minWidth;
9178							height = getScalar(width / ratio);
9179						}
9180
9181						if (width > maxWidth) {
9182							width  = maxWidth;
9183							height = getScalar(width / ratio);
9184						}
9185
9186						inner.width( width ).height( height );
9187
9188						wrap.width( width + wPadding );
9189
9190						width_  = wrap.width();
9191						height_ = wrap.height();
9192					}
9193
9194				} else {
9195					width  = Math.max(minWidth,  Math.min(width,  width  - (width_  - maxWidth_)));
9196					height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
9197				}
9198			}
9199
9200			if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
9201				width += scrollOut;
9202			}
9203
9204			inner.width( width ).height( height );
9205
9206			wrap.width( width + wPadding );
9207
9208			width_  = wrap.width();
9209			height_ = wrap.height();
9210
9211			canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
9212			canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
9213
9214			$.extend(current, {
9215				dim : {
9216					width	: getValue( width_ ),
9217					height	: getValue( height_ )
9218				},
9219				origWidth  : origWidth,
9220				origHeight : origHeight,
9221				canShrink  : canShrink,
9222				canExpand  : canExpand,
9223				wPadding   : wPadding,
9224				hPadding   : hPadding,
9225				wrapSpace  : height_ - skin.outerHeight(true),
9226				skinSpace  : skin.height() - height
9227			});
9228
9229			if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
9230				inner.height('auto');
9231			}
9232		},
9233
9234		_getPosition: function (onlyAbsolute) {
9235			var current  = F.current,
9236				viewport = F.getViewport(),
9237				margin   = current.margin,
9238				width    = F.wrap.width()  + margin[1] + margin[3],
9239				height   = F.wrap.height() + margin[0] + margin[2],
9240				rez      = {
9241					position: 'absolute',
9242					top  : margin[0],
9243					left : margin[3]
9244				};
9245
9246			if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
9247				rez.position = 'fixed';
9248
9249			} else if (!current.locked) {
9250				rez.top  += viewport.y;
9251				rez.left += viewport.x;
9252			}
9253
9254			rez.top  = getValue(Math.max(rez.top,  rez.top  + ((viewport.h - height) * current.topRatio)));
9255			rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width)  * current.leftRatio)));
9256
9257			return rez;
9258		},
9259
9260		_afterZoomIn: function () {
9261			var current = F.current;
9262
9263			if (!current) {
9264				return;
9265			}
9266
9267			F.isOpen = F.isOpened = true;
9268
9269			F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
9270
9271			F.update();
9272
9273			// Assign a click event
9274			if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
9275				F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
9276					if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
9277						e.preventDefault();
9278
9279						F[ current.closeClick ? 'close' : 'next' ]();
9280					}
9281				});
9282			}
9283
9284			// Create a close button
9285			if (current.closeBtn) {
9286				$(current.tpl.closeBtn).appendTo(F.skin).bind( isTouch ? 'touchstart.fb' : 'click.fb', function(e) {
9287					e.preventDefault();
9288
9289					F.close();
9290				});
9291			}
9292
9293			// Create navigation arrows
9294			if (current.arrows && F.group.length > 1) {
9295				if (current.loop || current.index > 0) {
9296					$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
9297				}
9298
9299				if (current.loop || current.index < F.group.length - 1) {
9300					$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
9301				}
9302			}
9303
9304			F.trigger('afterShow');
9305
9306			// Stop the slideshow if this is the last item
9307			if (!current.loop && current.index === current.group.length - 1) {
9308				F.play( false );
9309
9310			} else if (F.opts.autoPlay && !F.player.isActive) {
9311				F.opts.autoPlay = false;
9312
9313				F.play();
9314			}
9315		},
9316
9317		_afterZoomOut: function ( obj ) {
9318			obj = obj || F.current;
9319
9320			$('.fancybox-wrap').trigger('onReset').remove();
9321
9322			$.extend(F, {
9323				group  : {},
9324				opts   : {},
9325				router : false,
9326				current   : null,
9327				isActive  : false,
9328				isOpened  : false,
9329				isOpen    : false,
9330				isClosing : false,
9331				wrap   : null,
9332				skin   : null,
9333				outer  : null,
9334				inner  : null
9335			});
9336
9337			F.trigger('afterClose', obj);
9338		}
9339	});
9340
9341	/*
9342	 *	Default transitions
9343	 */
9344
9345	F.transitions = {
9346		getOrigPosition: function () {
9347			var current  = F.current,
9348				element  = current.element,
9349				orig     = current.orig,
9350				pos      = {},
9351				width    = 50,
9352				height   = 50,
9353				hPadding = current.hPadding,
9354				wPadding = current.wPadding,
9355				viewport = F.getViewport();
9356
9357			if (!orig && current.isDom && element.is(':visible')) {
9358				orig = element.find('img:first');
9359
9360				if (!orig.length) {
9361					orig = element;
9362				}
9363			}
9364
9365			if (isQuery(orig)) {
9366				pos = orig.offset();
9367
9368				if (orig.is('img')) {
9369					width  = orig.outerWidth();
9370					height = orig.outerHeight();
9371				}
9372
9373			} else {
9374				pos.top  = viewport.y + (viewport.h - height) * current.topRatio;
9375				pos.left = viewport.x + (viewport.w - width)  * current.leftRatio;
9376			}
9377
9378			if (F.wrap.css('position') === 'fixed' || current.locked) {
9379				pos.top  -= viewport.y;
9380				pos.left -= viewport.x;
9381			}
9382
9383			pos = {
9384				top     : getValue(pos.top  - hPadding * current.topRatio),
9385				left    : getValue(pos.left - wPadding * current.leftRatio),
9386				width   : getValue(width  + wPadding),
9387				height  : getValue(height + hPadding)
9388			};
9389
9390			return pos;
9391		},
9392
9393		step: function (now, fx) {
9394			var ratio,
9395				padding,
9396				value,
9397				prop       = fx.prop,
9398				current    = F.current,
9399				wrapSpace  = current.wrapSpace,
9400				skinSpace  = current.skinSpace;
9401
9402			if (prop === 'width' || prop === 'height') {
9403				ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
9404
9405				if (F.isClosing) {
9406					ratio = 1 - ratio;
9407				}
9408
9409				padding = prop === 'width' ? current.wPadding : current.hPadding;
9410				value   = now - padding;
9411
9412				F.skin[ prop ](  getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) ) );
9413				F.inner[ prop ]( getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
9414			}
9415		},
9416
9417		zoomIn: function () {
9418			var current  = F.current,
9419				startPos = current.pos,
9420				effect   = current.openEffect,
9421				elastic  = effect === 'elastic',
9422				endPos   = $.extend({opacity : 1}, startPos);
9423
9424			// Remove "position" property that breaks older IE
9425			delete endPos.position;
9426
9427			if (elastic) {
9428				startPos = this.getOrigPosition();
9429
9430				if (current.openOpacity) {
9431					startPos.opacity = 0.1;
9432				}
9433
9434			} else if (effect === 'fade') {
9435				startPos.opacity = 0.1;
9436			}
9437
9438			F.wrap.css(startPos).animate(endPos, {
9439				duration : effect === 'none' ? 0 : current.openSpeed,
9440				easing   : current.openEasing,
9441				step     : elastic ? this.step : null,
9442				complete : F._afterZoomIn
9443			});
9444		},
9445
9446		zoomOut: function () {
9447			var current  = F.current,
9448				effect   = current.closeEffect,
9449				elastic  = effect === 'elastic',
9450				endPos   = {opacity : 0.1};
9451
9452			if (elastic) {
9453				endPos = this.getOrigPosition();
9454
9455				if (current.closeOpacity) {
9456					endPos.opacity = 0.1;
9457				}
9458			}
9459
9460			F.wrap.animate(endPos, {
9461				duration : effect === 'none' ? 0 : current.closeSpeed,
9462				easing   : current.closeEasing,
9463				step     : elastic ? this.step : null,
9464				complete : F._afterZoomOut
9465			});
9466		},
9467
9468		changeIn: function () {
9469			var current   = F.current,
9470				effect    = current.nextEffect,
9471				startPos  = current.pos,
9472				endPos    = { opacity : 1 },
9473				direction = F.direction,
9474				distance  = 200,
9475				field;
9476
9477			startPos.opacity = 0.1;
9478
9479			if (effect === 'elastic') {
9480				field = direction === 'down' || direction === 'up' ? 'top' : 'left';
9481
9482				if (direction === 'down' || direction === 'right') {
9483					startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
9484					endPos[ field ]   = '+=' + distance + 'px';
9485
9486				} else {
9487					startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
9488					endPos[ field ]   = '-=' + distance + 'px';
9489				}
9490			}
9491
9492			// Workaround for http://bugs.jquery.com/ticket/12273
9493			if (effect === 'none') {
9494				F._afterZoomIn();
9495
9496			} else {
9497				F.wrap.css(startPos).animate(endPos, {
9498					duration : current.nextSpeed,
9499					easing   : current.nextEasing,
9500					complete : function() {
9501						// This helps FireFox to properly render the box
9502						setTimeout(F._afterZoomIn, 20);
9503					}
9504				});
9505			}
9506		},
9507
9508		changeOut: function () {
9509			var previous  = F.previous,
9510				effect    = previous.prevEffect,
9511				endPos    = { opacity : 0.1 },
9512				direction = F.direction,
9513				distance  = 200;
9514
9515			if (effect === 'elastic') {
9516				endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
9517			}
9518
9519			previous.wrap.animate(endPos, {
9520				duration : effect === 'none' ? 0 : previous.prevSpeed,
9521				easing   : previous.prevEasing,
9522				complete : function () {
9523					$(this).trigger('onReset').remove();
9524				}
9525			});
9526		}
9527	};
9528
9529	/*
9530	 *	Overlay helper
9531	 */
9532
9533	F.helpers.overlay = {
9534		defaults : {
9535			closeClick : true,  // if true, fancyBox will be closed when user clicks on the overlay
9536			speedOut   : 200,   // duration of fadeOut animation
9537			showEarly  : true,  // indicates if should be opened immediately or wait until the content is ready
9538			css        : {},    // custom CSS properties
9539			locked     : !isTouch,  // if true, the content will be locked into overlay
9540			fixed      : true   // if false, the overlay CSS position property will not be set to "fixed"
9541		},
9542
9543		overlay : null,   // current handle
9544		fixed   : false,  // indicates if the overlay has position "fixed"
9545
9546		// Public methods
9547		create : function(opts) {
9548			opts = $.extend({}, this.defaults, opts);
9549
9550			if (this.overlay) {
9551				this.close();
9552			}
9553
9554			this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( 'body' );
9555			this.fixed   = false;
9556
9557			if (opts.fixed && F.defaults.fixed) {
9558				this.overlay.addClass('fancybox-overlay-fixed');
9559
9560				this.fixed = true;
9561			}
9562		},
9563
9564		open : function(opts) {
9565			var that = this;
9566
9567			opts = $.extend({}, this.defaults, opts);
9568
9569			if (this.overlay) {
9570				this.overlay.unbind('.overlay').width('auto').height('auto');
9571
9572			} else {
9573				this.create(opts);
9574			}
9575
9576			if (!this.fixed) {
9577				W.bind('resize.overlay', $.proxy( this.update, this) );
9578
9579				this.update();
9580			}
9581
9582			if (opts.closeClick) {
9583				this.overlay.bind('click.overlay', function(e) {
9584					if ($(e.target).hasClass('fancybox-overlay')) {
9585						if (F.isActive) {
9586							F.close();
9587						} else {
9588							that.close();
9589						}
9590					}
9591				});
9592			}
9593
9594			this.overlay.css( opts.css ).show();
9595		},
9596
9597		close : function() {
9598			$('.fancybox-overlay').remove();
9599
9600			W.unbind('resize.overlay');
9601
9602			this.overlay = null;
9603
9604			if (this.margin !== false) {
9605				$('body').css('margin-right', this.margin);
9606
9607				this.margin = false;
9608			}
9609
9610			if (this.el) {
9611				this.el.removeClass('fancybox-lock');
9612			}
9613		},
9614
9615		// Private, callbacks
9616
9617		update : function () {
9618			var width = '100%', offsetWidth;
9619
9620			// Reset width/height so it will not mess
9621			this.overlay.width(width).height('100%');
9622
9623			// jQuery does not return reliable result for IE
9624			if ($.browser.msie) {
9625				offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
9626
9627				if (D.width() > offsetWidth) {
9628					width = D.width();
9629				}
9630
9631			} else if (D.width() > W.width()) {
9632				width = D.width();
9633			}
9634
9635			this.overlay.width(width).height(D.height());
9636		},
9637
9638		// This is where we can manipulate DOM, because later it would cause iframes to reload
9639		onReady : function (opts, obj) {
9640			$('.fancybox-overlay').stop(true, true);
9641
9642			if (!this.overlay) {
9643				this.margin = D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false;
9644				this.el     = document.all && !document.querySelector ? $('html') : $('body');
9645
9646				this.create(opts);
9647			}
9648
9649			if (opts.locked && this.fixed) {
9650				obj.locked = this.overlay.append( obj.wrap );
9651				obj.fixed  = false;
9652			}
9653
9654			if (opts.showEarly === true) {
9655				this.beforeShow.apply(this, arguments);
9656			}
9657		},
9658
9659		beforeShow : function(opts, obj) {
9660			if (obj.locked) {
9661				this.el.addClass('fancybox-lock');
9662
9663				if (this.margin !== false) {
9664					$('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth);
9665				}
9666			}
9667
9668			this.open(opts);
9669		},
9670
9671		onUpdate : function() {
9672			if (!this.fixed) {
9673				this.update();
9674			}
9675		},
9676
9677		afterClose: function (opts) {
9678			// Remove overlay if exists and fancyBox is not opening
9679			// (e.g., it is not being open using afterClose callback)
9680			if (this.overlay && !F.isActive) {
9681				this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
9682			}
9683		}
9684	};
9685
9686	/*
9687	 *	Title helper
9688	 */
9689
9690	F.helpers.title = {
9691		defaults : {
9692			type     : 'float', // 'float', 'inside', 'outside' or 'over',
9693			position : 'bottom' // 'top' or 'bottom'
9694		},
9695
9696		beforeShow: function (opts) {
9697			var current = F.current,
9698				text    = current.title,
9699				type    = opts.type,
9700				title,
9701				target;
9702
9703			if ($.isFunction(text)) {
9704				text = text.call(current.element, current);
9705			}
9706
9707			if (!isString(text) || $.trim(text) === '') {
9708				return;
9709			}
9710
9711			title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">
9711' + text + '</div>');
9712
9713			switch (type) {
9714				case 'inside':
9715					target = F.skin;
9716				break;
9717
9718				case 'outside':
9719					target = F.wrap;
9720				break;
9721
9722				case 'over':
9723					target = F.inner;
9724				break;
9725
9726				default: // 'float'
9727					target = F.skin;
9728
9729					title.appendTo('body');
9730
9731					if ($.browser.msie) {
9732						title.width( title.width() );
9733					}
9734
9735					title.wrapInner('<span class="child"></span>');
9736
9737					//Increase bottom margin so this title will also fit into viewport
9738					F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
9739				break;
9740			}
9741
9742			title[ (opts.position === 'top' ? 'prependTo'  : 'appendTo') ](target);
9743		}
9744	};
9745
9746	// jQuery plugin initialization
9747	$.fn.fancybox = function (options) {
9748		var index,
9749			that     = $(this),
9750			selector = this.selector || '',
9751			run      = function(e) {
9752				var what = $(this).blur(), idx = index, relType, relVal;
9753
9754				if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
9755					relType = options.groupAttr || 'data-fancybox-group';
9756					relVal  = what.attr(relType);
9757
9758					if (!relVal) {
9759						relType = 'rel';
9760						relVal  = what.get(0)[ relType ];
9761					}
9762
9763					if (relVal && relVal !== '' && relVal !== 'nofollow') {
9764						what = selector.length ? $(selector) : that;
9765						what = what.filter('[' + relType + '="' + relVal + '"]');
9766						idx  = what.index(this);
9767					}
9768
9769					options.index = idx;
9770
9771					// Stop an event from bubbling if everything is fine
9772					if (F.open(what, options) !== false) {
9773						e.preventDefault();
9774					}
9775				}
9776			};
9777
9778		options = options || {};
9779		index   = options.index || 0;
9780
9781		if (!selector || options.live === false) {
9782			that.unbind('click.fb-start').bind('click.fb-start', run);
9783
9784		} else {
9785			D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
9786		}
9787
9788		this.filter('[data-fancybox-start=1]').trigger('click');
9789
9790		return this;
9791	};
9792
9793	// Tests that need a body at doc ready
9794	D.ready(function() {
9795		if ( $.scrollbarWidth === undefined ) {
9796			// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
9797			$.scrollbarWidth = function() {
9798				var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
9799					child  = parent.children(),
9800					width  = child.innerWidth() - child.height( 99 ).innerWidth();
9801
9802				parent.remove();
9803
9804				return width;
9805			};
9806		}
9807
9808		if ( $.support.fixedPosition === undefined ) {
9809			$.support.fixedPosition = (function() {
9810				var elem  = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
9811					fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
9812
9813				elem.remove();
9814
9815				return fixed;
9816			}());
9817		}
9818
9819		$.extend(F.defaults, {
9820			scrollbarWidth : $.scrollbarWidth(),
9821			fixed  : $.support.fixedPosition,
9822			parent : $('body')
9823		});
9824	});
9825
9826}(window, document, jQuery));
9827
9828/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
9829 * Licensed under the MIT License (LICENSE.txt).
9830 *
9831 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
9832 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
9833 * Thanks to: Seamus Leahy for adding deltaX and deltaY
9834 *
9835 * Version: 3.0.6
9836 * 
9837 * Requires: 1.2.2+
9838 */
9839(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=
9840d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
9841/**
9842 * EM QuickShop
9843 *
9844 * @license commercial software
9845 * @copyright (c) 2012 Codespot Software JSC - EMThemes.com. (http://www.emthemes.com)
9846 */
9847// disable QuickShop:
9848// EM_QUICKSHOP_DISABLED = true;
9849jQuery.noConflict();
9850qs = null;
9851jQuery(function($) {
9852	//get IE version
9853
9854	function ieVersion() {
9855		var rv = -1; // Return value assumes failure.
9856		if (navigator.appName == 'Microsoft Internet Explorer') {
9857			var ua = navigator.userAgent;
9858			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
9859			if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
9860		}
9861		return rv;
9862	}
9863	//read href attr in a tag
9864
9865	function readHref() {
9866		var result = arguments[0].replace(EM.QuickShop.BASE_URL, '');
9867		var patn = /catalog\/product\/view\/id\/(.*?)\//i;
9868		if (patn.test(result)) {
9869			var s = patn.exec(result);
9870			result = 'catalog/product/view/id/' + s[1];
9871		} else {
9872			result = result.replace(/\//gi, "_!_");
9873		}
9874		return result;
9875	}
9876	//string trim
9877
9878	function strTrim() {
9879		return arguments[0].replace(/^\s+|\s+$/g, "");
9880	}
9881	// quickshop init
9882	var _qsJnit = function() {
9883		var selectorObj = arguments[0];
9884		var listprod = $(selectorObj.itemClass); // selector chon tat ca cac li chua san pham tren luoi
9885		var mypath = 'quickshop/index/view/path/';
9886		var baseUrl = EM.QuickShop.BASE_URL + mypath;
9887		var _qsHref = "<a id=\"em_quickshop_handler\" href=\"#\" style=\"visibility:hidden;position:absolute;top:0;left:0\"><span>" + EM.QuickShop.QS_TEXT + "</span></a>";
9888		$(document.body).append(_qsHref);
9889		var qsHandlerImg = $('#em_quickshop_handler span');
9890		$.each(listprod, function(index, value) {
9891			if ($(value).parents(".no_quickshop").length <= 0) {
9892				var reloadurl = baseUrl;
9893				//get reload url
9894				var prodLinkTag = $(value).find(selectorObj.aClass);
9895				if (!prodLinkTag || prodLinkTag.length == 0) return;
9896				var prodHref = readHref(prodLinkTag.attr('href'));
9897				reloadurl = baseUrl + prodHref;
9898
9899				// show quickshop handle when hover product image aClass selectorObj.imgClass
9900				$(selectorObj.aClass, this).bind('mouseover', function () {
9901					var o = $(this).offset();
9902					$('#em_quickshop_handler').attr('href', reloadurl).show().css({
9903							'top': o.top+($(this).children('img').height() - qsHandlerImg.height() - 30)/2+'px',
9904							'left': o.left+($(this).children('img').width() - qsHandlerImg.width() - 40)/2+'px',
9905							'visibility': 'visible',
9906							'z-index':	999
9907					});
9908				});
9909				$(value).bind('mouseout', function() {
9910					$('#em_quickshop_handler').hide();
9911				});
9912			}
9913		});
9914		//fix bug image disapper when hover
9915		$('#em_quickshop_handler').bind('mouseover', function() {
9916			$(this).show();
9917		}).bind('click', function() {
9918			$(this).hide();
9919		});
9920		//insert quickshop popup
9921		$('#em_quickshop_handler').fancybox({
9922			'width': EM.QuickShop.QS_FRM_WIDTH,
9923			'height': EM.QuickShop.QS_FRM_HEIGHT,
9924			'autoScale': false,
9925			//			'padding': 20,
9926			//			'margin': 20,
9927			//'transitionIn'		: 'none',
9928			//'transitionOut'		: 'none',
9929			'type': 'iframe',
9930			onComplete: function() {
9931				$.fancybox.showActivity();
9932				$('#fancybox-frame').unbind('load');
9933				$('#fancybox-frame').bind('load', function() {
9934					$.fancybox.hideActivity();
9935				});
9936			}
9937		});
9938	}
9939	if ( (typeof EM_QUICKSHOP_DISABLED == 'undefined' || !EM_QUICKSHOP_DISABLED) && !isMobile ) {
9940	   _qsJnit({
9941    		itemClass: '.products-grid li.item, .products-list li.item',
9942    		//selector for each items in catalog product list,use to insert quickshop image
9943    		aClass: 'a.product-image',
9944    		//selector for each a tag in product items,give us href for one product
9945    		imgClass: '.product-image > img' //class for quickshop href
9946    	});
9947	}    
9948	qs = _qsJnit;
9949});
9950function Hammer(e,t,n){function x(e){return e.touches?e.touches.length:1}function T(e){e=e||window.event;if(!S){var t=document,n=t.body;return[{x:e.pageX||e.clientX+(t&&t.scrollLeft||n&&n.scrollLeft||0)-(t&&t.clientLeft||n&&t.clientLeft||0),y:e.pageY||e.clientY+(t&&t.scrollTop||n&&n.scrollTop||0)-(t&&t.clientTop||n&&t.clientTop||0)}]}else{var r=[],i;for(var s=0,o=e.touches.length;s<o;s++){i=e.touches[s];r.push({x:i.pageX,y:i.pageY})}return r}}function N(e,t){return Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI}function C(e,t){var n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)}function k(e,t){if(e.length==2&&t.length==2){var n=C(e[0],e[1]);var r=C(t[0],t[1]);return r/n}return 0}function L(e,t){if(e.length==2&&t.length==2){var n=N(e[1],e[0]);var r=N(t[1],t[0]);return r-n}return 0}function A(e,t){t.touches=T(t.originalEvent);t.type=e;if(j(r["on"+e])){r["on"+e].call(r,t)}}function O(e){e=e||window.event;if(e.preventDefault){e.preventDefault();e.stopPropagation()}else{e.returnValue=false;e.cancelBubble=true}}function M(){a={};l=false;f=0;s=0;o=0;c=null}function D(n){switch(n.type){case"mousedown":case"touchstart":a.start=T(n);p=(new Date).getTime();f=x(n);l=true;b=n;var r=e.getBoundingClientRect();var i=e.clientTop||document.body.clientTop||0;var d=e.clientLeft||document.body.clientLeft||0;var v=window.pageYOffset||e.scrollTop||document.body.scrollTop;var m=window.pageXOffset||e.scrollLeft||document.body.scrollLeft;g={top:r.top+v-i,left:r.left+m-d};y=true;_.hold(n);if(t.prevent_default){O(n)}break;case"mousemove":case"touchmove":if(!y){return false}w=n;a.move=T(n);if(!_.transform(n)){_.drag(n)}break;case"mouseup":case"mouseout":case"touchcancel":case"touchend":if(!y||c!="transform"&&n.touches&&n.touches.length>0){return false}y=false;E=n;_.swipe(n);if(c=="drag"){A("dragend",{originalEvent:n,direction:u,distance:s,angle:o})}else if(c=="transform"){A("transformend",{originalEvent:n,position:a.center,scale:k(a.start,a.move),rotation:L(a.start,a.move),distance:s,distanceX:_distance_x,distanceY:_distance_y})}else{_.tap(b)}h=c;A("release",{originalEvent:n,gesture:c,position:a.move||a.start});M();break}}function P(t){if(!H(e,t.relatedTarget)){D(t)}}function H(e,t){if(!t&&window.event&&window.event.toElement){t=window.event.toElement}if(e===t){return true}if(t){var n=t.parentNode;while(n!==null){if(n===e){return true}n=n.parentNode}}return false}function B(e,t){var n={};if(!t){return e}for(var r in e){if(r in t){n[r]=t[r]}else{n[r]=e[r]}}return n}function j(e){return Object.prototype.toString.call(e)=="[object Function]"}function F(e,t,n){t=t.split(" ");for(var r=0,i=t.length;r<i;r++){if(e.addEventListener){e.addEventListener(t[r],n,false)}else if(document.attachEvent){e.attachEvent("on"+t[r],n)}}}function I(e,t,n){t=t.split(" ");for(var r=0,i=t.length;r<i;r++){if(e.removeEventListener){e.removeEventListener(t[r],n,false)}else if(document.detachEvent){e.detachEvent("on"+t[r],n)}}}
9950var r=this;var i={prevent_default:false,css_hacks:true,swipe:true,swipe_time:200,swipe_min_distance:20,drag:true,drag_vertical:true,drag_horizontal:true,drag_min_distance:20,transform:true,scale_treshold:.1,rotation_treshold:15,tap:true,tap_double:true,tap_max_interval:300,tap_max_distance:10,tap_double_distance:20,hold:true,hold_timeout:500};t=B(i,t);(function(){if(!t.css_hacks){return false}var n=["webkit","moz","ms","o",""];var r={userSelect:"none",touchCallout:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"};var i="";for(var s=0;s<n.length;s++){for(var o in r){i=o;if(n[s]){i=n[s]+i.substring(0,1).toUpperCase()+i.substring(1)}e.style[i]=r[o]}}})();var s=0;var o=0;var u=0;var a={};var f=0;var l=false;var c=null;var h=null;var p=null;var d={x:0,y:0};var v=null;var m=null;var g={};var y=false;var b;var w;var E;var S="ontouchstart"in window;this.option=function(e,r){if(r!=n){t[e]=r}return t[e]};this.getDirectionFromAngle=function(e){var t={down:e>=45&&e<135,left:e>=135||e<=-135,up:e<-45&&e>-135,right:e>=-45&&e<=45};var n,r;for(r in t){if(t[r]){n=r;break}}return n};this.destroy=function(){if(S){I(e,"touchstart touchmove touchend touchcancel",D)}else{I(e,"mouseup mousedown mousemove",D);I(e,"mouseout",P)}};var _={hold:function(e){if(t.hold){c="hold";clearTimeout(m);m=setTimeout(function(){if(c=="hold"){A("hold",{originalEvent:e,position:a.start})}},t.hold_timeout)}},swipe:function(e){if(!a.move||c==="transform"){return}var n=a.move[0].x-a.start[0].x;var i=a.move[0].y-a.start[0].y;s=Math.sqrt(n*n+i*i);var f=(new Date).getTime();var l=f-p;if(t.swipe&&t.swipe_time>l&&s>t.swipe_min_distance){o=N(a.start[0],a.move[0]);u=r.getDirectionFromAngle(o);c="swipe";var h={x:a.move[0].x-g.left,y:a.move[0].y-g.top};var d={originalEvent:e,position:h,direction:u,distance:s,distanceX:n,distanceY:i,angle:o};A("swipe",d)}},drag:function(e){var n=a.move[0].x-a.start[0].x;var i=a.move[0].y-a.start[0].y;s=Math.sqrt(n*n+i*i);if(t.drag&&s>t.drag_min_distance||c=="drag"){o=N(a.start[0],a.move[0]);u=r.getDirectionFromAngle(o);var f=u=="up"||u=="down";if((f&&!t.drag_vertical||!f&&!t.drag_horizontal)&&s>t.drag_min_distance){return}c="drag";var h={x:a.move[0].x-g.left,y:a.move[0].y-g.top};var p={originalEvent:e,position:h,direction:u,distance:s,distanceX:n,distanceY:i,angle:o};if(l){A("dragstart",p);l=false}A("drag",p);O(e)}},transform:function(e){if(t.transform){if(x(e)!=2){return false}var n=L(a.start,a.move);var r=k(a.start,a.move);if(c!="drag"&&(c=="transform"||Math.abs(1-r)>t.scale_treshold||Math.abs(n)>t.rotation_treshold)){c="transform";a.center={x:(a.move[0].x+a.move[1].x)/2-g.left,y:(a.move[0].y+a.move[1].y)/2-g.top};if(l)a.startCenter=a.center;var i=a.center.x-a.startCenter.x;var o=a.center.y-a.startCenter.y;s=Math.sqrt(i*i+o*o);var u={originalEvent:e,position:a.center,scale:r,rotation:n,distance:s,distanceX:i,distanceY:o};if(l){A("transformstart",u);l=false}A("transform",u);O(e);return true}}return false},tap:function(e){var n=(new Date).getTime();var r=n-p;if(t.hold&&!(t.hold&&t.hold_timeout>r)){return}var i=function(){if(d&&t.tap_double&&h=="tap"&&p-v<t.tap_max_interval){var e=Math.abs(d[0].x-a.start[0].x);var n=Math.abs(d[0].y-a.start[0].y);return d&&a.start&&Math.max(e,n)<t.tap_double_distance}return false}();if(i){c="double_tap";v=null;A("doubletap",{originalEvent:e,position:a.start});O(e)}else{var o=a.move?Math.abs(a.move[0].x-a.start[0].x):0;var u=a.move?Math.abs(a.move[0].y-a.start[0].y):0;s=Math.max(o,u);if(s<t.tap_max_distance){c="tap";v=n;d=a.start;if(t.tap){A("tap",{originalEvent:e,position:a.start});O(e)}}}}};if(S){F(e,"touchstart touchmove touchend touchcancel",D)}else{F(e,"mouseup mousedown mousemove",D);F(e,"mouseout",P)}};
9951;(function ($) {
9952	 $.fn.inlineStyle = function (prop) {
9953        var styles = $.trim(this.attr("style")),
9954             value;
9955		 
9956		if(styles){
9957			var arr = styles.split(";"),i;
9958			for(i = 0;i < arr.length;i++){
9959				var style = arr[i].split(":");
9960				
9961				if ($.trim(style[0]) === prop) {
9962					value = style[1];           
9963				}	
9964			}
9965		}	 
9966        return value;
9967    };
9968	
9969	$.csslider = function(el,options) {
9970		var defaults = {
9971			selector : ".slides > li.item",
9972			move : 1,
9973			speed : 400,
9974			direction : 'horizontal',
9975			textClassName : '.product-name',
9976			delay : 0,
9977			widthViewport : 0,
9978			heightViewport : 0,
9979			textPrev : 'Prev',
9980			textNext : 'Next',
9981			circular : 0,
9982			parentHidden : ''
9983		}
9984		
9985		var vars = $.extend({}, defaults, options);
9986		var slider = $(el),
9987        //touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
9988        eventType = "click",
9989		vertical = vars.direction === "vertical",
9990		auto = vars.delay > 0;
9991		slider.addClass('csslider'),
9992		rtlStyle = $('div.page').first().css('direction') == 'rtl';
9993		var time = 0;
9994		slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
9995		slider.container = $(slider.containerSelector, slider);
9996		slider.slides = $(vars.selector, slider);
9997		slider.target = 0;
9998		slider.enoughtItem = true;
9999		slider.currentHideNav = 'prev';
10000		if(vertical)
10001			slider.addClass('vertical');
10002		else
10003			slider.addClass('horizontal');
10004		slider.scrolling = false;
10005		slider.reInit = false;
10006		slider.setup = function(){
10007			slider.viewport = $('<div class="viewport"></div>');
10008			slider.viewport.append(slider.container);
10009			slider.append(slider.viewport);
10010			slider.controlNav();
10011			if(vars.widthViewport > 0){
10012				slider.viewport.width(vars.widthViewport);
10013			}
10014			if(vars.heightViewport > 0){
10015				slider.viewport.height(vars.heightViewport);
10016			}
10017			slider.init(true);
10018			slider.hammer = new Hammer(slider.container[0], {"swipe_time": 200/*,"prevent_default" : true*/});
10019			slider.touchHamer();
10020		}
10021		
10022		slider.init = function (first){
10023			if(vars.parentHidden && (slider.parents(vars.parentHidden).length > 0)){
10024				slider.curDisplay = slider.parents(vars.parentHidden).css('display');
10025				if(slider.curDisplay != 'block')
10026					slider.parents(vars.parentHidden).css({visibility:'hidden',display:'block'});
10027			}
10028			//if($(vars.textClassName,slider))
10029				//$(vars.textClassName,slider).hide();
10030			if(slider.interval && auto)
10031				clearTimeout(slider.interval);
10032			// Do not reset when slider is first loaded	
10033			if(!first)	
10034				slider.reset();
10035
10036			var maxWidth = 0,maxOuterWidth = 0,maxHeight = 0,i=0,maxHeight = 0,maxOuterHeight = 0;
10037			slider.slides.each(function(index,value){
10038				// Backup css inline for width and height
10039				if($(this).inlineStyle('width') != undefined){
10040					$(this).attr('data-width',$.trim($(this).inlineStyle('width')));
10041				}
10042				
10043				if($(this).inlineStyle('height') != undefined){
10044					$(this).attr('data-height',$.trim($(this).inlineStyle('height')));
10045				}
10046				
10047				if(maxWidth < $(this).width()){
10048					maxWidth = $(this).width();
10049					maxOuterWidth = $(this).outerWidth(true);
10050					i = index;
10051				}
10052				
10053				if(maxHeight < $(this).height()){
10054					maxHeight = $(this).height();
10055					maxOuterHeight = $(this).outerHeight(true);
10056				}
10057			});
10058			
10059			if(!vertical){ // horizontal
10060				//slider.lengthPx = Math.floor(slider.viewport.width()/maxOuterWidth)*maxOuterWidth;
10061				slider.lengthPx = slider.viewport.width();
10062				//slider.lengthPx = slider.viewport.width();
10063				if(slider.lengthPx < maxOuterWidth){
10064					slider.reInit = true;
10065					slider.container.addClass('no-float');
10066					var newWidth = slider.viewport.width() - (maxOuterWidth - maxWidth);
10067					slider.lengthPx = slider.viewport.width();
10068					var ratio = (newWidth/maxWidth);
10069					var delta = maxWidth - newWidth;
10070					maxWidth = newWidth;
10071					maxOuterWidth = maxOuterWidth - delta;
10072					//maxHeight = Math.ceil(maxHeight*ratio);
10073					//slider.slides.height(maxHeight);
10074					//$('a.product-image',slider).css('float','none');
10075				}
10076				
10077				slider.initHorizontal(maxWidth,maxOuterWidth);
10078				slider.finalInit();
10079			} else { // vertical
10080				if(slider.viewport.width() < maxOuterWidth){
10081					slider.reInit = true;
10082					slider.container.addClass('no-float');
10083					var newWidth = slider.viewport.width() - (maxOuterWidth - maxWidth);
10084					var ratio = (newWidth/maxWidth);
10085					maxWidth = newWidth;
10086					//slider.slides.width(150);
10087					slider.slides.width(maxWidth);
10088					
10089					//$('a.product-image',slider).css('float','none');
10090					/*newHeight = Math.ceil(maxHeight*ratio);
10091					var delta = maxHeight - newHeight;
10092					maxOuterHeight -= delta;
10093					maxHeight = newHeight;*/
10094					
10095					setTimeout(function(){
10096						slider.initVertical(maxHeight,maxOuterHeight);
10097						slider.finalInit();
10098					},300);
10099				} else {
10100					slider.initVertical(maxHeight,maxOuterHeight);
10101					slider.finalInit();
10102				}
10103				
10104			}
10105			//if($(vars.textClassName,slider))
10106				//$(vars.textClassName,slider).show();
10107				
10108			
10109		}
10110		
10111		slider.finalInit = function(){
10112			slider.finalTarget = slider.lengthPx - slider.container.lengthPx;	
10113			//slider.deltaTotal = slider.lengthPx - Math.floor(slider.viewport.width()/maxOuterWidth)*maxOuterWidth;
10114			slider.target = 0;
10115			slider.resetScroll();
10116			slider.slide(slider.target,vars.speed);	
10117			if(vars.circular == 0 && slider.enoughtItem){
10118				slider.prev.hide();
10119				slider.next.show();
10120				slider.currentHideNav = 'prev';
10121			}
10122			/*if(auto)
10123				slider.interval = setTimeout(slider.nextSlide,vars.delay);*/
10124			if(vars.parentHidden && (slider.parents(vars.parentHidden).length > 0)){
10125				if(slider.curDisplay != 'block')
10126					slider.parents(vars.parentHidden).css({visibility:'',display:slider.curDisplay});
10127			}
10128		}
10129		
10130		slider.initHorizontal = function(maxWidth,maxOuterWidth){
10131			slider.reInit = false;
10132			slider.slides.width(maxWidth);
10133			//var first = slider.slides.first();
10134			slider.stepLength = (maxOuterWidth)*vars.move;
10135			var lengthPx = slider.slides.length*(maxOuterWidth);
10136			slider.container.width(lengthPx);
10137			slider.container.lengthPx = lengthPx;
10138			if(slider.container.lengthPx - slider.lengthPx <= maxOuterWidth - maxWidth){
10139				slider.enoughtItem = false;
10140				slider.next.hide();
10141				slider.prev.hide();
10142			} else {
10143				slider.enoughtItem = true;
10144				slider.next.show();
10145				slider.prev.show();
10146			}
10147		}
10148		
10149		slider.initVertical = function(maxHeight,maxOuterHeight){
10150			if(slider.reInit == true){
10151				maxHeight = 0;maxOuterHeight = 0;
10152				slider.slides.each(function(index,value){
10153					$(this).attr('test-height',$(this).height());
10154					if(maxHeight < $(this).height()){
10155						maxHeight = $(this).height();
10156						
10157						maxOuterHeight = $(this).outerHeight(true);
10158					}
10159				});
10160				slider.reInit = false;
10161			}
10162			//slider.lengthPx = Math.floor(slider.viewport.height()/maxOuterHeight)*maxOuterHeight;
10163			slider.lengthPx = slider.viewport.height();
10164			//slider.lengthPx = slider.viewport.height();
10165			slider.slides.height(maxHeight);
10166			//var first = slider.slides.first();
10167			slider.stepLength = (maxOuterHeight)*vars.move;
10168			var lengthPx = slider.slides.length*(maxOuterHeight);
10169			slider.container.height(lengthPx);
10170			slider.container.lengthPx = lengthPx;
10171			if(slider.container.lengthPx - slider.lengthPx <= maxOuterHeight - maxHeight){
10172				slider.enoughtItem = false;
10173				slider.next.hide();
10174				slider.prev.hide();
10175			} else {
10176				slider.enoughtItem = true;
10177				slider.next.show();
10178				slider.prev.show();
10179			}
10180		}
10181		
10182		slider.reset = function(){
10183			slider.container.css('height','');
10184			slider.slides.css('height','');
10185			slider.container.css('width','');
10186			slider.slides.css('width','');
10187			if($('a.product-image',slider).length > 0)
10188				$('a.product-image',slider).css('float','');
10189			// Restore css inline
10190			if(slider.slides.attr('data-width')){
10191				slider.slides.css('width',slider.slides.attr('data-width'));
10192			}
10193			if(slider.slides.attr('data-height')){
10194				slider.slides.css('height',slider.slides.attr('data-height'));
10195			}
10196			slider.container.removeClass('no-float');
10197		}
10198		
10199		slider.resetScroll = function(){
10200			slider.scrolling = false;
10201			if(auto)
10202				slider.interval = setTimeout(slider.nextSlide,vars.delay);
10203		}
10204		
10205		slider.touchHamer = function(){
10206			var targetVirtual,flow, time, distance;
10207			if(typeof addEventListener == 'function'){
10208				el.addEventListener("touchmove", function(ev){
10209					if(ev.touches.length == 1)
10210						ev.preventDefault();
10211				}, false);
10212			}
10213			
10214			function cancelEvent(event)
10215			{
10216				event = event || window.event;
10217				if(event.preventDefault){
10218					event.preventDefault();
10219					event.stopPropagation();
10220				}else{
10221					event.returnValue = false;
10222					event.cancelBubble = true;
10223				}
10224			}
10225			
10226			slider.hammer.ondragstart = function(ev) {
10227				if(slider.interval && auto)
10228					clearTimeout(slider.interval);
10229				if(slider.scrolling 
10230					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
10231					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))){
10232					return;
10233				}	
10234				targetVirtual = 0;
10235				flow = 0;
10236				time = Number( new Date() );
10237				distance = 0;
10238			}
10239			
10240			slider.hammer.ondrag = function(ev) {
10241				if(slider.interval && auto)
10242					clearTimeout(slider.interval);
10243				if(slider.scrolling
10244					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
10245					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))
10246					|| !slider.enoughtItem){
10247					cancelEvent(ev);	
10248					return;
10249				}
10250				if(ev.touches.length > 1 || ev.scale && ev.scale !== 1 || slider.scrolling || !slider.enoughtItem){
10251					cancelEvent(ev);
10252					return;
10253				}	
10254				distance = (vertical) ? ev.distanceY : ev.distanceX;
10255				targetVirtual = slider.target + distance;
10256				if(targetVirtual > slider.stepLength/2){// last slide right
10257					flow = 1;
10258					return;
10259				}	
10260				if(slider.container.lengthPx + targetVirtual < slider.lengthPx - (slider.stepLength/2)){//first slide left
10261					flow = -1;
10262					return;
10263				}	
10264				if(vertical)
10265					slider.container.animate({ marginTop: targetVirtual + 'px'}, 0);
10266				else
10267					slider.container.animate({ marginLeft: targetVirtual + 'px'}, 0);
10268				
10269			};
10270			
10271			slider.hammer.ondragend = function(ev) {
10272				if(slider.scrolling
10273					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
10274					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))
10275					|| !slider.enoughtItem){
10276					cancelEvent(ev);	
10277					return;
10278				}	
10279				//slider.hammer.cancelEvent(ev);	
10280				var oldTarget = slider.target;
10281				if(flow < 0){
10282					slider.target = slider.finalTarget;
10283					/*if(vars.circular == 0){
10284						slider.currentHideNav = 'next';
10285						slider.next.hide();
10286						slider.prev.show();
10287					}		*/			
10288				} else if(flow > 0){
10289					slider.target = 0;
10290					/*if(vars.circular == 0){
10291						slider.currentHideNav = 'prev';
10292						slider.next.show();
10293						slider.prev.hide();
10294					}*/
10295				} else {
10296					var remainDistance = Math.floor(Math.abs(distance)%slider.stepLength),remainStep;
10297					if(remainDistance < (slider.stepLength/2)){
10298						remainStep = (ev.direction == 'left' || ev.direction == 'up') ? remainDistance : remainDistance*(-1);
10299					} else {
10300						remainStep = (ev.direction == 'left' || ev.direction == 'up') ? (slider.stepLength-remainDistance)*(-1) : (slider.stepLength-remainDistance);
10301					}
10302					slider.target = targetVirtual + remainStep;
10303					
10304				}
10305		
10306				if(vars.circular == 0 && (oldTarget != slider.target)){
10307					if(ev.direction == 'left' || ev.direction == 'up'){ // next slide
10308						slider.checkNextSlide();
10309					} else {
10310						slider.checkPrevSlide();
10311					}
10312				}
10313		
10314				slider.slide(slider.target,vars.speed);
10315			};
10316			
10317			slider.hammer.onswipe = function(ev) {
10318				if(slider.scrolling || !slider.enoughtItem){
10319					cancelEvent(ev);	
10320					return;
10321				}	
10322				if(!vertical){
10323					if(ev.direction == 'left')
10324						slider.nextSlide();
10325					else if(ev.direction == 'right')	
10326						slider.prevSlide();
10327				} else {
10328					if(ev.direction == 'up')
10329						slider.nextSlide();
10330					else if(ev.direction == 'down')	
10331						slider.prevSlide();
10332				}
10333			}
10334			
10335		}		
10336		
10337		slider.slide = function(target, durationVal){
10338			if(slider.interval && auto)
10339				clearTimeout(slider.interval);
10340			slider.scrolling = true;
10341			var targetCss = target + 'px';
10342			if(!vertical)
10343				if(rtlStyle)
10344					slider.container.animate({ marginRight: targetCss}, durationVal, 'swing',slider.resetScroll);
10345				else	
10346					slider.container.animate({ marginLeft: targetCss}, durationVal, 'swing',slider.resetScroll);
10347			else	
10348				slider.container.animate({ marginTop: targetCss}, durationVal, 'swing',slider.resetScroll);
10349		}
10350		
10351		slider.checkNextSlide = function(){
10352			if(slider.currentHideNav != 'next' && vars.circular == 0){
10353				if(slider.currentHideNav == 'prev'){
10354					slider.prev.show();
10355					slider.currentHideNav = '';
10356				}	
10357				//if(slider.container.lengthPx + slider.target - slider.stepLength <= slider.lengthPx - slider.stepLength/2){
10358				if(slider.target <= slider.finalTarget){
10359					slider.currentHideNav = 'next';
10360					slider.next.hide();
10361				} 					
10362			}	
10363		}
10364		
10365		slider.checkPrevSlide = function(){
10366			if(slider.currentHideNav != 'prev' && vars.circular == 0){	
10367				if((slider.currentHideNav == 'next')){
10368					slider.next.show();
10369					slider.currentHideNav = '';
10370				}	
10371				if(slider.target + slider.stepLength > slider.stepLength/2){
10372					slider.currentHideNav = 'prev';
10373					slider.prev.hide();
10374				}									
10375			}
10376		}
10377		
10378		slider.nextSlide = function(){
10379			if(!slider.scrolling && slider.enoughtItem){
10380				if(slider.interval && auto)
10381					clearTimeout(slider.interval);
10382				slider.target -= slider.stepLength;
10383				if(slider.target < slider.finalTarget ){
10384					if((vars.circular > 0) && (Math.abs(slider.target-slider.finalTarget) >= slider.stepLength))
10385						slider.target = 0;
10386					else 
10387						slider.target = slider.finalTarget;
10388				}
10389				slider.slide(slider.target,vars.speed);	
10390				
10391				// Check show/hide prev/next button when circular is disabled
10392				slider.checkNextSlide();					
10393			}
10394		}
10395		
10396		slider.prevSlide = function(){
10397			if(!slider.scrolling && slider.enoughtItem){
10398				if(slider.interval && auto)
10399					clearTimeout(slider.interval);
10400				if(slider.target <= slider.finalTarget){
10401					slider.target += slider.stepLength + (Math.abs(slider.finalTarget)%slider.stepLength);
10402					if(slider.target >= 0){
10403						if((slider.target >= slider.stepLength) && (vars.circular > 0))
10404							slider.target = slider.finalTarget;
10405						else	
10406							slider.target = 0;
10407					}
10408				} else {
10409					slider.target += slider.stepLength;
10410					if(slider.target >= 0){
10411						if((slider.target >= slider.stepLength) && (vars.circular > 0))
10412							slider.target = slider.finalTarget;
10413						else	
10414							slider.target = 0;
10415					}
10416				}	
10417				slider.slide(slider.target,vars.speed);	
10418				
10419				// Check show/hide prev/next button when circular is disabled
10420				slider.checkPrevSlide();
10421			}	
10422		}
10423		
10424		slider.controlNav = function(){
10425			var navHtml =  $("<div class='controls'><a href='#' title='" + vars.textPrev + "' class='prev'>" + vars.textPrev + "</a><a title='" + vars.textNext + "' href='#' class='next'>" + vars.textNext + "</a></div>");
10426			slider.append(navHtml);
10427			slider.next = $('a.next',slider);
10428			slider.prev = $('a.prev',slider);
10429			slider.next.bind(eventType, function(event) {
10430				event.preventDefault();
10431				slider.nextSlide();
10432			});
10433			
10434			slider.prev.bind(eventType, function(event) {
10435				event.preventDefault();
10436				slider.prevSlide();
10437			});
10438		}
10439		
10440		slider.showHideNav = function(){
10441			if(slider.target < 0){
10442				slider.prev.show();
10443			} else {
10444				slider.prev.hide();
10445			}
10446		}
10447		
10448		slider.setup();
10449		$(window).resize(function() {
10450			//slider.reset();
10451			setTimeout(function(){slider.init(false);},300);
10452		});
10453	}
10454	
10455	$.fn.csslider = function(options) {
10456		return this.each(function(){
10457			new $.csslider(this,options);
10458		});
10459	}
10460})(jQuery);
10461
10462(function(e){function t(e){if(e in u.style)return e;var t=["Moz","Webkit","O","ms"],n=e.charAt(0).toUpperCase()+e.substr(1);if(e in u.style)return e;for(e=0;e<t.length;++e){var r=t[e]+n;if(r in u.style)return r}}function n(e){"string"===typeof e&&this.parse(e);return this}function r(t,n,r,i){var s=[];e.each(t,function(t){t=e.camelCase(t);t=e.transit.propertyMap[t]||e.cssProps[t]||t;t=t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()});-1===e.inArray(t,s)&&s.push(t)});e.cssEase[r]&&(r=e.cssEase[r]);var u=""+o(n)+" "+r;0<parseInt(i,10)&&(u+=" "+o(i));var a=[];e.each(s,function(e,t){a.push(t+" "+u)});return a.join(", ")}function i(t,n){n||(e.cssNumber[t]=!0);e.transit.propertyMap[t]=a.transform;e.cssHooks[t]={get:function(n){return e(n).css("transit:transform").get(t)},set:function(n,r){var i=e(n).css("transit:transform");i.setFromString(t,r);e(n).css({"transit:transform":i})}}}function s(e,t){return"string"===typeof e&&!e.match(/^[\-0-9\.]+$/)?e:""+e+t}function o(t){e.fx.speeds[t]&&(t=e.fx.speeds[t]);return s(t,"ms")}e.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:!0,useTransitionEnd:!1};var u=document.createElement("div"),a={},f=-1<navigator.userAgent.toLowerCase().indexOf("chrome");a.transition=t("transition");a.transitionDelay=t("transitionDelay");a.transform=t("transform");a.transformOrigin=t("transformOrigin");u.style[a.transform]="";u.style[a.transform]="rotateY(90deg)";a.transform3d=""!==u.style[a.transform];var l=a.transitionEnd={transition:"transitionend",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"}[a.transition]||null,c;for(c in a)a.hasOwnProperty(c)&&"undefined"===typeof e.support[c]&&(e.support[c]=a[c]);u=null;e.cssEase={_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)",easeInExpo:"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)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"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)"};e.cssHooks["transit:transform"]={get:function(t){return e(t).data("transform")||new n},set:function(t,r){var i=r;i instanceof n||(i=new n(i));t.style[a.transform]="WebkitTransform"===a.transform&&!f?i.toString(!0):i.toString();e(t).data("transform",i)}};e.cssHooks.transform={set:e.cssHooks["transit:transform"].set};"1.8">e.fn.jquery&&(e.cssHooks.transformOrigin={get:function(e){return e.style[a.transformOrigin]},set:function(e,t){e.style[a.transformOrigin]=t}},e.cssHooks.transition={get:function(e){return e.style[a.transition]},set:function(e,t){e.style[a.transition]=t}}
10462);i("scale");i("translate");i("rotate");i("rotateX");i("rotateY");i("rotate3d");i("perspective");i("skewX");i("skewY");i("x",!0);i("y",!0);n.prototype={setFromString:function(e,t){var r="string"===typeof t?t.split(","):t.constructor===Array?t:[t];r.unshift(e);n.prototype.set.apply(this,r)},set:function(e){var t=Array.prototype.slice.apply(arguments,[1]);this.setter[e]?this.setter[e].apply(this,t):this[e]=t.join(",")},get:function(e){return this.getter[e]?this.getter[e].apply(this):this[e]||0},setter:{rotate:function(e){this.rotate=s(e,"deg")},rotateX:function(e){this.rotateX=s(e,"deg")},rotateY:function(e){this.rotateY=s(e,"deg")},scale:function(e,t){void 0===t&&(t=e);this.scale=e+","+t},skewX:function(e){this.skewX=s(e,"deg")},skewY:function(e){this.skewY=s(e,"deg")},perspective:function(e){this.perspective=s(e,"px")},x:function(e){this.set("translate",e,null)},y:function(e){this.set("translate",null,e)},translate:function(e,t){void 0===this._translateX&&(this._translateX=0);void 0===this._translateY&&(this._translateY=0);null!==e&&void 0!==e&&(this._translateX=s(e,"px"));null!==t&&void 0!==t&&(this._translateY=s(t,"px"));this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var e=(this.scale||"1,1").split(",");e[0]&&(e[0]=parseFloat(e[0]));e[1]&&(e[1]=parseFloat(e[1]));return e[0]===e[1]?e[0]:e},rotate3d:function(){for(var e=(this.rotate3d||"0,0,0,0deg").split(","),t=0;3>=t;++t)e[t]&&(e[t]=parseFloat(e[t]));e[3]&&(e[3]=s(e[3],"deg"));return e}},parse:function(e){var t=this;e.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(e,n,r){t.setFromString(n,r)})},toString:function(e){var t=[],n;for(n in this)if(this.hasOwnProperty(n)&&(a.transform3d||!("rotateX"===n||"rotateY"===n||"perspective"===n||"transformOrigin"===n)))"_"!==n[0]&&(e&&"scale"===n?t.push(n+"3d("+this[n]+",1)"):e&&"translate"===n?t.push(n+"3d("+this[n]+",0)"):t.push(n+"("+this[n]+")"));return t.join(" ")}};e.fn.transition=e.fn.transit=function(t,n,i,s){var u=this,f=0,c=!0;"function"===typeof n&&(s=n,n=void 0);"function"===typeof i&&(s=i,i=void 0);"undefined"!==typeof t.easing&&(i=t.easing,delete t.easing);"undefined"!==typeof t.duration&&(n=t.duration,delete t.duration);"undefined"!==typeof t.complete&&(s=t.complete,delete t.complete);"undefined"!==typeof t.queue&&(c=t.queue,delete t.queue);"undefined"!==typeof t.delay&&(f=t.delay,delete t.delay);"undefined"===typeof n&&(n=e.fx.speeds._default);"undefined"===typeof i&&(i=e.cssEase._default);n=o(n);var h=r(t,n,i,f),v=e.transit.enabled&&a.transition?parseInt(n,10)+parseInt(f,10):0;if(0===v)return n=c,i=function(e){u.css(t);s&&s.apply(u);e&&e()},!0===n?u.queue(i):n?u.queue(n,i):i(),u;var m={};n=c;i=function(n){var r=0;"MozTransition"===a.transition&&25>r&&(r=25);window.setTimeout(function(){var r=!1,i=function(){r&&u.unbind(l,i);0<v&&u.each(function(){this.style[a.transition]=m[this]||null});"function"===typeof s&&s.apply(u);"function"===typeof n&&n()};0<v&&l&&e.transit.useTransitionEnd?(r=!0,u.bind(l,i)):window.setTimeout(i,v);u.each(function(){0<v&&(this.style[a.transition]=h);e(this).css(t)})},r)};!0===n?u.queue(i):n?u.queue(n,i):i();return this};e.transit.getTransitionValue=r})(jQuery);(function(e,t){jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,t,n,r,i){return jQuery.easing[jQuery.easing.def](e,t,n,r,i)},easeInQuad:function(e,t,n,r,i){return r*(t/=i)*t+n},easeOutQuad:function(e,t,n,r,i){return-r*(t/=i)*(t-2)+n},easeInOutQuad:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t+n;return-r/2*(--t*(t-2)-1)+n},easeInCubic:function(e,t,n,r,i){return r*(t/=i)*t*t+n},easeOutCubic:function(e,t,n,r,i){return r*((t=t/i-1)*t*t+1)+n},easeInOutCubic:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t+n;return r/2*((t-=2)*t*t+2)+n},easeInQuart:function(e,t,n,r,i){return r*(t/=i)*t*t*t+n},easeOutQuart:function(e,t,n,r,i){return-r*((t=t/i-1)*t*t*t-1)+n},easeInOutQuart:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t*t+n;return-r/2*((t-=2)*t*t*t-2)+n},easeInQuint:function(e,t,n,r,i){return r*(t/=i)*t*t*t*t+n},easeOutQuint:function(e,t,n,r,i){return r*((t=t/i-1)*t*t*t*t+1)+n},easeInOutQuint:function(e,t,n,r,i){if((t/=i/2)<1)return r/2*t*t*t*t*t+n;return r/2*((t-=2)*t*t*t*t+2)+n},easeInSine:function(e,t,n,r,i){return-r*Math.cos(t/i*(Math.PI/2))+r+n},easeOutSine:function(e,t,n,r,i){return r*Math.sin(t/i*(Math.PI/2))+n},easeInOutSine:function(e,t,n,r,i){return-r/2*(Math.cos(Math.PI*t/i)-1)+n},easeInExpo:function(e,t,n,r,i){return t==0?n:r*Math.pow(2,10*(t/i-1))+n},easeOutExpo:function(e,t,n,r,i){return t==i?n+r:r*(-Math.pow(2,-10*t/i)+1)+n},easeInOutExpo:function(e,t,n,r,i){if(t==0)return n;if(t==i)return n+r;if((t/=i/2)<1)return r/2*Math.pow(2,10*(t-1))+n;return r/2*(-Math.pow(2,-10*--t)+2)+n},easeInCirc:function(e,t,n,r,i){return-r*(Math.sqrt(1-(t/=i)*t)-1)+n},easeOutCirc:function(e,t,n,r,i){return r*Math.sqrt(1-(t=t/i-1)*t)+n},easeInOutCirc:function(e,t,n,r,i){if((t/=i/2)<1)return-r/2*(Math.sqrt(1-t*t)-1)+n;return r/2*(Math.sqrt(1-(t-=2)*t)+1)+n},easeInElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i)==1)return n+r;if(!o)o=i*.3;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);return-(u*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o))+n},easeOutElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i)==1)return n+r;if(!o)o=i*.3;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);return u*Math.pow(2,-10*t)*Math.sin((t*i-s)*2*Math.PI/o)+r+n},easeInOutElastic:function(e,t,n,r,i){var s=1.70158;var o=0;var u=r;if(t==0)return n;if((t/=i/2)==2)return n+r;if(!o)o=i*.3*1.5;if(u<Math.abs(r)){u=r;var s=o/4}else var s=o/(2*Math.PI)*Math.asin(r/u);if(t<1)return-.5*u*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o)+n;return u*Math.pow(2,-10*(t-=1))*Math.sin((t*i-s)*2*Math.PI/o)*.5+r+n}
10462,easeInBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;return r*(t/=i)*t*((s+1)*t-s)+n},easeOutBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;return r*((t=t/i-1)*t*((s+1)*t+s)+1)+n},easeInOutBack:function(e,t,n,r,i,s){if(s==undefined)s=1.70158;if((t/=i/2)<1)return r/2*t*t*(((s*=1.525)+1)*t-s)+n;return r/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+n},easeInBounce:function(e,t,n,r,i){return r-jQuery.easing.easeOutBounce(e,i-t,0,r,i)+n},easeOutBounce:function(e,t,n,r,i){if((t/=i)<1/2.75){return r*7.5625*t*t+n}else if(t<2/2.75){return r*(7.5625*(t-=1.5/2.75)*t+.75)+n}else if(t<2.5/2.75){return r*(7.5625*(t-=2.25/2.75)*t+.9375)+n}else{return r*(7.5625*(t-=2.625/2.75)*t+.984375)+n}},easeInOutBounce:function(e,t,n,r,i){if(t<i/2)return jQuery.easing.easeInBounce(e,t*2,0,r,i)*.5+n;return jQuery.easing.easeOutBounce(e,t*2-i,0,r,i)*.5+r*.5+n}});e.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage"]};e.expr[":"].uncached=function(t){var n=document.createElement("img");n.src=t.src;return e(t).is('img[src!=""]')&&!n.complete};e.fn.waitForImages=function(t,n,r){if(e.isPlainObject(arguments[0])){n=t.each;r=t.waitForAll;t=t.finished}t=t||e.noop;n=n||e.noop;r=!!r;if(!e.isFunction(t)||!e.isFunction(n)){throw new TypeError("An invalid callback was supplied.")}return this.each(function(){var i=e(this),s=[];if(r){var o=e.waitForImages.hasImageProperties||[],u=/url\((['"]?)(.*?)\1\)/g;i.find("*").each(function(){var t=e(this);if(t.is("img:uncached")){s.push({src:t.attr("src"),element:t[0]})}e.each(o,function(e,n){var r=t.css(n);if(!r){return true}var i;while(i=u.exec(r)){s.push({src:i[2],element:t[0]})}})})}else{i.find("img:uncached").each(function(){s.push({src:this.src,element:this})})}var f=s.length,l=0;if(f==0){t.call(i[0])}e.each(s,function(r,s){var o=new Image;e(o).bind("load error",function(e){l++;n.call(s.element,l,f,e.type=="load");if(l==f){t.call(i[0]);return false}});o.src=s.src})})};e.fn.swipe=function(t){if(!this)return false;var n={fingers:1,threshold:75,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,click:null,triggerOnTouchEnd:true,allowPageScroll:"auto"};var r="left";var i="right";var s="up";var o="down";var u="none";var f="horizontal";var l="vertical";var c="auto";var h="start";var p="move";var d="end";var v="cancel";var m="ontouchstart"in window,g=m?"touchstart":"mousedown",y=m?"touchmove":"mousemove",b=m?"touchend":"mouseup",w="touchcancel";var E="start";if(t.allowPageScroll==undefined&&(t.swipe!=undefined||t.swipeStatus!=undefined))t.allowPageScroll=u;if(t)e.extend(n,t);return this.each(function(){function t(){var e=S();if(e<=45&&e>=0)return r;else if(e<=360&&e>=315)return r;else if(e>=135&&e<=225)return i;else if(e>45&&e<135)return o;else return s}function S(){var e=H.x-B.x;var t=B.y-H.y;var n=Math.atan2(t,e);var r=Math.round(n*180/Math.PI);if(r<0)r=360-Math.abs(r);return r}function x(){return Math.round(Math.sqrt(Math.pow(B.x-H.x,2)+Math.pow(B.y-H.y,2)))}function T(e,t){if(n.allowPageScroll==u){e.preventDefault()}else{var a=n.allowPageScroll==c;switch(t){case r:if(n.swipeLeft&&a||!a&&n.allowPageScroll!=f)e.preventDefault();break;case i:if(n.swipeRight&&a||!a&&n.allowPageScroll!=f)e.preventDefault();break;case s:if(n.swipeUp&&a||!a&&n.allowPageScroll!=l)e.preventDefault();break;case o:if(n.swipeDown&&a||!a&&n.allowPageScroll!=l)e.preventDefault();break}}}function N(e,t){if(n.swipeStatus)n.swipeStatus.call(_,e,t,direction||null,distance||0);if(t==v){if(n.click&&(P==1||!m)&&(isNaN(distance)||distance==0))n.click.call(_,e,e.target)}if(t==d){if(n.swipe){n.swipe.call(_,e,direction,distance)}switch(direction){case r:if(n.swipeLeft)n.swipeLeft.call(_,e,direction,distance);break;case i:if(n.swipeRight)n.swipeRight.call(_,e,direction,distance);break;case s:if(n.swipeUp)n.swipeUp.call(_,e,direction,distance);break;case o:if(n.swipeDown)n.swipeDown.call(_,e,direction,distance);break}}}function C(e){P=0;H.x=0;H.y=0;B.x=0;B.y=0;F.x=0;F.y=0}function L(e){e.preventDefault();distance=x();direction=t();if(n.triggerOnTouchEnd){E=d;if((P==n.fingers||!m)&&B.x!=0){if(distance>=n.threshold){N(e,E);C(e)}else{E=v;N(e,E);C(e)}}else{E=v;N(e,E);C(e)}}else if(E==p){E=v;N(e,E);C(e)}M.removeEventListener(y,A,false);M.removeEventListener(b,L,false)}function A(e){if(E==d||E==v)return;var r=m?e.touches[0]:e;B.x=r.pageX;B.y=r.pageY;direction=t();if(m){P=e.touches.length}E=p;T(e,direction);if(P==n.fingers||!m){distance=x();if(n.swipeStatus)N(e,E,direction,distance);if(!n.triggerOnTouchEnd){if(distance>=n.threshold){E=d;N(e,E);C(e)}}}else{E=v;N(e,E);C(e)}}function O(e){var t=m?e.touches[0]:e;E=h;if(m){P=e.touches.length}distance=0;direction=null;if(P==n.fingers||!m){H.x=B.x=t.pageX;H.y=B.y=t.pageY;if(n.swipeStatus)N(e,E)}else{C(e)}M.addEventListener(y,A,false);M.addEventListener(b,L,false)}var M=this;var _=e(this);var D=null;var P=0;var H={x:0,y:0};var B={x:0,y:0};var F={x:0,y:0};try{this.addEventListener(g,O,false);this.addEventListener(w,C)}catch(I){}})}})(jQuery)
10463function revslider_showDoubleJqueryError(sliderID){var errorMessage="Revolution Slider Error: You have some jquery.js library include that c
10463omes after the revolution files js include.";errorMessage+="<br> This includes make eliminates the revolution slider libraries, and make it not work.";errorMessage+="<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Slider Settings -> Troubleshooting set option:  <strong><b>Put JS Includes To Body</b></strong> option to true.";errorMessage+="<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it.";errorMessage="<span style='font-size:16px;color:#BC0C06;'>"+errorMessage+"</span>"
10464jQuery(sliderID).show().html(errorMessage);}
10465/**************************************************************************
10466 * jquery.themepunch.revolution.js - jQuery Plugin for kenburn Slider
10467 * @version: 2.3.9 (03.04.2013)
10468 * @requires jQuery v1.7 or later (tested on 1.9)
10469 * @author ThemePunch
10470**************************************************************************/
10471
10472(function(e,t){function n(e){var t=[],n;var r=window.location.href.slice(window.location.href.indexOf(e)+1).split("_");for(var i=0;i<r.length;i++){r[i]=r[i].replace("%3D","=");n=r[i].split("=");t.push(n[0]);t[n[0]]=n[1]}return t}function r(t,n){t.find(".defaultimg").each(function(r){d(e(this),n);n.height=Math.round(n.startheight*(n.width/n.startwidth));t.height(n.height);d(e(this),n);try{t.parent().find(".tp-bannershadow").css({width:n.width})}catch(s){}var o=t.find(">ul >li:eq("+n.act+") .slotholder");var u=t.find(">ul >li:eq("+n.next+") .slotholder");b(t,n);u.find(".defaultimg").css({opacity:0});o.find(".defaultimg").css({opacity:1});w(t,n);var a=t.find(">ul >li:eq("+n.next+")");t.find(".tp-caption").each(function(){e(this).stop(true,true)});L(a,n);i(n,t)})}function i(e,t){e.cd=0;if(e.videoplaying!=true){var n=t.find(".tp-bannertimer");if(n.length>0){n.stop();n.css({width:"0%"});n.animate({width:"100%"},{duration:e.delay-100,queue:false,easing:"linear"})}clearTimeout(e.thumbtimer);e.thumbtimer=setTimeout(function(){u(t);p(t,e)},200)}}function s(e,t){e.cd=0;E(t,e);var n=t.find(".tp-bannertimer");if(n.length>0){n.stop();n.css({width:"0%"});n.animate({width:"100%"},{duration:e.delay-100,queue:false,easing:"linear"})}}function o(n,r){var i=n.parent();if(r.navigationType=="thumb"||r.navsecond=="both"){i.append('<div class="tp-bullets tp-thumbs '+r.navigationStyle+'"><div class="tp-mask"><div class="tp-thumbcontainer"></div></div></div>')}var o=i.find(".tp-bullets.tp-thumbs .tp-mask .tp-thumbcontainer");var f=o.parent();f.width(r.thumbWidth*r.thumbAmount);f.height(r.thumbHeight);f.parent().width(r.thumbWidth*r.thumbAmount);f.parent().height(r.thumbHeight);n.find(">ul:first >li").each(function(e){var r=n.find(">ul:first >li:eq("+e+")");if(r.data("thumb")!=t)var i=r.data("thumb");else var i=r.find("img:first").attr("src");o.append('<div class="bullet thumb"><img src="'+i+'"></div>');var s=o.find(".bullet:first")});var l=100;o.find(".bullet").each(function(t){var i=e(this);if(t==r.slideamount-1)i.addClass("last");if(t==0)i.addClass("first");i.width(r.thumbWidth);i.height(r.thumbHeight);if(l>i.outerWidth(true))l=i.outerWidth(true);i.click(function(){if(r.transition==0&&i.index()!=r.act){r.next=i.index();s(r,n)}})});var c=l*n.find(">ul:first >li").length;var h=o.parent().width();r.thumbWidth=l;if(h<c){e(document).mousemove(function(t){e("body").data("mousex",t.pageX)});o.parent().mouseenter(function(){var t=e(this);t.addClass("over");var r=t.offset();var i=e("body").data("mousex")-r.left;var s=t.width();var o=t.find(".bullet:first").outerWidth(true);var u=o*n.find(">ul:first >li").length;var f=u-s+15;var l=f/s;i=i-30;var c=0-i*l;if(c>0)c=0;if(c<0-u+s)c=0-u+s;a(t,c,200)});o.parent().mousemove(function(){var t=e(this);var r=t.offset();var i=e("body").data("mousex")-r.left;var s=t.width();var o=t.find(".bullet:first").outerWidth(true);var u=o*n.find(">ul:first >li").length;var f=u-s+15;var l=f/s;i=i-30;var c=0-i*l;if(c>0)c=0;if(c<0-u+s)c=0-u+s;a(t,c,0)});o.parent().mouseleave(function(){var t=e(this);t.removeClass("over");u(n)})}}function u(e){var t=e.parent().find(".tp-bullets.tp-thumbs .tp-mask .tp-thumbcontainer");var n=t.parent();var r=n.offset();var i=n.find(".bullet:first").outerWidth(true);var s=n.find(".bullet.selected").index()*i;var o=n.width();var i=n.find(".bullet:first").outerWidth(true);var u=i*e.find(">ul:first >li").length;var f=u-o;var l=f/o;var c=0-s;if(c>0)c=0;if(c<0-u+o)c=0-u+o;if(!n.hasClass("over")){a(n,c,200)}}function a(e,t,n){e.stop();e.find(".tp-thumbcontainer").animate({left:t+"px"},{duration:n,queue:false})}function f(t,n){if(n.navigationType=="bullet"||n.navigationType=="both"){t.parent().append('<div class="tp-bullets simplebullets '+n.navigationStyle+'"></div>')}var r=t.parent().find(".tp-bullets");t.find(">ul:first >li").each(function(e){var n=t.find(">ul:first >li:eq("+e+") img:first").attr("src");r.append('<div class="bullet"></div>');var i=r.find(".bullet:first")});r.find(".bullet").each(function(r){var i=e(this);if(r==n.slideamount-1)i.addClass("last");if(r==0)i.addClass("first");i.click(function(){var e=false;if(n.navigationArrows=="withbullet"||n.navigationArrows=="nexttobullets"){if(i.index()-1==n.act)e=true}else{if(i.index()==n.act)e=true}if(n.transition==0&&!e){if(n.navigationArrows=="withbullet"||n.navigationArrows=="nexttobullets"){n.next=i.index()-1}else{n.next=i.index()}s(n,t)}})});r.append('<div class="tpclear"></div>');p(t,n)}function l(e,n){var r=e.find(".tp-bullets");var i="";var o=n.navigationStyle;if(n.navigationArrows=="none")i="visibility:none";n.soloArrowStyle="default";if(n.navigationArrows!="none"&&n.navigationArrows!="nexttobullets")o=n.soloArrowStyle;e.parent().append('<div style="'+i+'" class="tp-leftarrow tparrows '+o+'"></div>');e.parent().append('<div style="'+i+'" class="tp-rightarrow tparrows '+o+'"></div>');e.parent().find(".tp-rightarrow").click(function(){if(n.transition==0){if(e.data("showus")!=t&&e.data("showus")!=-1)n.next=e.data("showus")-1;else n.next=n.next+1;e.data("showus",-1);if(n.next>=n.slideamount)n.next=0;if(n.next<0)n.next=0;if(n.act!=n.next)s(n,e)}});e.parent().find(".tp-leftarrow").click(function(){if(n.transition==0){n.next=n.next-1;n.leftarrowpressed=1;if(n.next<0)n.next=n.slideamount-1;s(n,e)}});p(e,n)}function c(e,t){if(t.touchenabled=="on")e.swipe({data:e,swipeRight:function(){if(t.transition==0){t.next=t.next-1;t.leftarrowpressed=1;if(t.next<0)t.next=t.slideamount-1;s(t,e)}},swipeLeft:function(){if(t.transition==0){t.next=t.next+1;if(t.next==t.slideamount)t.next=0;s(t,e)}},allowPageScroll:"auto"})}function h(e,t){var n=e.parent().find(".tp-bullets");var r=e.parent().find(".tparrows");if(n==null){e.append('<div class=".tp-bullets"></div>');var n=e.parent().find(".tp-bullets")}if(r==null){e.append('<div class=".tparrows"></div>');var r=e.parent().find(".tparrows")}e.data("hidethumbs",t.hideThumbs);n.addClass("hidebullets");r.addClass("hidearrows");n.hover(function(){n.addClass("hovered");clearTimeout(e.data("hidethumbs"));n.removeClass("hidebullets");r.removeClass("hidearrows")},function(){n.removeClass("hovered");if(!e.hasClass("hovered")&&!n.hasClass("hovered"))e.data("hidethumbs",setTimeout(function(){n.addClass("hidebullets");r.addClass("hidearrows")},t.hideThumbs))});r.hover(function(){n.addClass("hovered");clearTimeout(e.data("hidethumbs"));n.removeClass("hidebullets");r.removeClass("hidearrows")},function(){n.removeClass("hovered")});e.on("mouseenter",function(){e.addClass("hovered");clearTimeout(e.data("hidethumbs"));n.removeClass("hidebullets");r.removeClass("hidearrows")});e.on("mouseleave",function(){e.removeClass("hovered");if(!e.hasClass("hovered")&&!n.hasClass("hovered"))e.data("hidethumbs",setTimeout(function(){n.addClass("hidebullets");r.addClass("hidearrows")},t.hideThumbs))})}function p(e,t){var n=e.parent();var r=n.find(".tp-bullets");var i=n.find(".tp-leftarrow");var s=n.find(".tp-rightarrow");if(t.navigationType=="thumb"&&t.navigationArrows=="nexttobullets")t.navigationArrows="solo";if(t.navigationArrows=="nexttobullets"){i.prependTo(r).css({"float":"left"});s.insertBefore(r.find(".tpclear")).css({"float":"left"})}if(t.navigationArrows!="none"&&t.navigationArrows!="nexttobullets"){i.css({position:"absolute"});s.css({position:"absolute"});if(t.soloArrowLeftValign=="center")i.css({top:"50%",marginTop:t.soloArrowLeftVOffset-Math.round(i.innerHeight()/2)+"px"});if(t.soloArrowLeftValign=="bottom")i.css({bottom:0+t.soloArrowLeftVOffset+"px"});if(t.soloArrowLeftValign=="top")i.css({top:0+t.soloArrowLeftVOffset+"px"});if(t.soloArrowLeftHalign=="center")i.css({left:"50%",marginLeft:t.soloArrowLeftHOffset-Math.round(i.innerWidth()/2)+"px"});if(t.soloArrowLeftHalign=="left")i.css({left:0+t.soloArrowLeftHOffset+"px"});if(t.soloArrowLeftHalign=="right")i.css({right:0+t.soloArrowLeftHOffset+"px"});if(t.soloArrowRightValign=="center")s.css({top:"50%",marginTop:t.soloArrowRightVOffset-Math.round(s.innerHeight()/2)+"px"});if(t.soloArrowRightValign=="bottom")s.css({bottom:0+t.soloArrowRightVOffset+"px"});if(t.soloArrowRightValign=="top")s.css({top:0+t.soloArrowRightVOffset+"px"});if(t.soloArrowRightHalign=="center")s.css({left:"50%",marginLeft:t.soloArrowRightHOffset-Math.round(s.innerWidth()/2)+"px"});if(t.soloArrowRightHalign=="left")s.css({left:0+t.soloArrowRightHOffset+"px"});if(t.soloArrowRightHalign=="right")s.css({right:0+t.soloArrowRightHOffset+"px"});
10472if(i.position()!=null)i.css({top:Math.round(parseInt(i.position().top,0))+"px"});if(s.position()!=null)s.css({top:Math.round(parseInt(s.position().top,0))+"px"})}if(t.navigationArrows=="none"){i.css({visibility:"hidden"});s.css({visibility:"hidden"})}if(t.navigationVAlign=="center")r.css({top:"50%",marginTop:t.navigationVOffset-Math.round(r.innerHeight()/2)+"px"});if(t.navigationVAlign=="bottom")r.css({bottom:0+t.navigationVOffset+"px"});if(t.navigationVAlign=="top")r.css({top:0+t.navigationVOffset+"px"});if(t.navigationHAlign=="center")r.css({left:"50%",marginLeft:t.navigationHOffset-Math.round(r.innerWidth()/2)+"px"});if(t.navigationHAlign=="left")r.css({left:0+t.navigationHOffset+"px"});if(t.navigationHAlign=="right")r.css({right:0+t.navigationHOffset+"px"})}function d(e,n){n.width=parseInt(n.container.width(),0);n.height=parseInt(n.container.height(),0);n.bw=n.width/n.startwidth;n.bh=n.height/n.startheight;if(n.bh>1){n.bw=1;n.bh=1}if(e.data("orgw")!=t){e.width(e.data("orgw"));e.height(e.data("orgh"))}var r=n.width/e.width();var i=n.height/e.height();n.fw=r;n.fh=i;if(e.data("orgw")==t){e.data("orgw",e.width());e.data("orgh",e.height())}if(n.fullWidth=="on"){var s=n.container.parent().width();var o=n.container.parent().height();var u=o/e.data("orgh");var a=s/e.data("orgw");e.width(e.width()*u);e.height(o);if(e.width()<s){e.width(s+50);var a=e.width()/e.data("orgw");e.height(e.data("orgh")*a)}if(e.width()>s){e.data("fxof",s/2-e.width()/2);e.css({position:"absolute",left:e.data("fxof")+"px"})}if(e.height()<=o){e.data("fyof",0);e.data("fxof",s/2-e.width()/2);e.css({position:"absolute",top:e.data("fyof")+"px",left:e.data("fxof")+"px"})}if(e.height()>o&&e.data("fullwidthcentering")=="on"){e.data("fyof",o/2-e.height()/2);e.data("fxof",s/2-e.width()/2);e.css({position:"absolute",top:e.data("fyof")+"px",left:e.data("fxof")+"px"})}}else{e.width(n.width);e.height(e.height()*r);if(e.height()<n.height&&e.height()!=0&&e.height()!=null){e.height(n.height);e.width(e.data("orgw")*i)}}e.data("neww",e.width());e.data("newh",e.height());if(n.fullWidth=="on"){n.slotw=Math.ceil(e.width()/n.slots)}else{n.slotw=Math.ceil(n.width/n.slots)}n.sloth=Math.ceil(n.height/n.slots)}function v(n,r){n.find(".tp-caption").each(function(){e(this).addClass(e(this).data("transition"));e(this).addClass("start")});n.find(">ul:first >li").each(function(n){var r=e(this);if(r.data("link")!=t){var i=r.data("link");var s="_self";var o=2;if(r.data("slideindex")=="back")o=0;var u=r.data("linktoslide");if(r.data("target")!=t)s=r.data("target");if(i=="slide"){r.append('<div class="tp-caption sft slidelink" style="z-index:'+o+';" data-x="0" data-y="0" data-linktoslide="'+u+'" data-start="0"><a><div></div></a></div>')}else{u="no";r.append('<div class="tp-caption sft slidelink" style="z-index:'+o+';" data-x="0" data-y="0" data-linktoslide="'+u+'" data-start="0"><a target="'+s+'" href="'+i+'"><div></div></a></div>')}}});n.find(">ul:first >li >img").each(function(t){var n=e(this);n.addClass("defaultimg");d(n,r);d(n,r);n.wrap('<div class="slotholder"></div>');n.css({opacity:0});n.data("li-id",t)})}function m(e,n,r){var i=e;var s=i.find("img");d(s,n);var o=s.attr("src");var u=s.css("background-color");var a=s.data("neww");var f=s.data("newh");var l=s.data("fxof");if(l==t)l=0;var c=s.data("fyof");if(s.data("fullwidthcentering")!="on"||c==t)c=0;var h=0;if(!r)var h=0-n.slotw;for(var p=0;p<n.slots;p++)i.append('<div class="slot" style="position:absolute;top:'+(0+c)+"px;left:"+(l+p*n.slotw)+"px;overflow:hidden;width:"+n.slotw+"px;height:"+f+'px"><div class="slotslide" style="position:absolute;top:0px;left:'+h+"px;width:"+n.slotw+"px;height:"+f+'px;overflow:hidden;"><img style="background-color:'+u+";position:absolute;top:0px;left:"+(0-p*n.slotw)+"px;width:"+a+"px;height:"+f+'px" src="'+o+'"></div></div>')}function g(e,n,r){var i=e;var s=i.find("img");d(s,n);var o=s.attr("src");var u=s.css("background-color");var a=s.data("neww");var f=s.data("newh");var l=s.data("fxof");if(l==t)l=0;var c=s.data("fyof");if(s.data("fullwidthcentering")!="on"||c==t)c=0;var h=0;if(!r)var h=0-n.sloth;for(var p=0;p<n.slots+2;p++)i.append('<div class="slot" style="position:absolute;'+"top:"+(c+p*n.sloth)+"px;"+"left:"+l+"px;"+"overflow:hidden;"+"width:"+a+"px;"+"height:"+n.sloth+'px"'+'><div class="slotslide" style="position:absolute;'+"top:"+h+"px;"+"left:0px;width:"+a+"px;"+"height:"+n.sloth+"px;"+'overflow:hidden;"><img style="position:absolute;'+"background-color:"+u+";"+"top:"+(0-p*n.sloth)+"px;"+"left:0px;width:"+a+"px;"+"height:"+f+'px" src="'+o+'"></div></div>')}function y(e,n,r){var i=e;var s=i.find("img");d(s,n);var o=s.attr("src");var u=s.css("background-color");var a=s.data("neww");var f=s.data("newh");var l=s.data("fxof");if(l==t)l=0;var c=s.data("fyof");
10472if(s.data("fullwidthcentering")!="on"||c==t)c=0;var h=0;var p=0;if(n.sloth>n.slotw)p=n.sloth;else p=n.slotw;if(!r){var h=0-p}n.slotw=p;n.sloth=p;var v=0;var m=0;for(var g=0;g<n.slots;g++){m=0;for(var y=0;y<n.slots;y++){i.append('<div class="slot" '+'style="position:absolute;'+"top:"+(c+m)+"px;"+"left:"+(l+v)+"px;"+"width:"+p+"px;"+"height:"+p+"px;"+'overflow:hidden;">'+'<div class="slotslide" data-x="'+v+'" data-y="'+m+'" '+'style="position:absolute;'+"top:"+0+"px;"+"left:"+0+"px;"+"width:"+p+"px;"+"height:"+p+"px;"+'overflow:hidden;">'+'<img style="position:absolute;'+"top:"+(0-m)+"px;"+"left:"+(0-v)+"px;"+"width:"+a+"px;"+"height:"+f+"px"+"background-color:"+u+';"'+'src="'+o+'"></div></div>');m=m+p}v=v+p}}function b(n,r,i){if(i==t)i==80;setTimeout(function(){n.find(".slotholder .slot").each(function(){clearTimeout(e(this).data("tout"));e(this).remove()});r.transition=0},i)}function w(e,t){var n=e.find(">li:eq("+t.act+")");var r=e.find(">li:eq("+t.next+")");var i=r.find(".tp-caption");if(i.find("iframe")==0){if(i.hasClass("hcenter"))i.css({height:t.height+"px",top:"0px",left:t.width/2-i.outerWidth()/2+"px"});else if(i.hasClass("vcenter"))i.css({width:t.width+"px",left:"0px",top:t.height/2-i.outerHeight()/2+"px"})}}function E(n,r){n.trigger("revolution.slide.onbeforeswap");r.transition=1;r.videoplaying=false;try{var i=n.find(">ul:first-child >li:eq("+r.act+")")}catch(s){var i=n.find(">ul:first-child >li:eq(1)")}r.lastslide=r.act;var o=n.find(">ul:first-child >li:eq("+r.next+")");var a=i.find(".slotholder");var f=o.find(".slotholder");i.css({visibility:"visible"});o.css({visibility:"visible"});if(r.ie){if(o.data("transition")=="boxfade")o.data("transition","boxslide");if(o.data("transition")=="slotfade-vertical")o.data("transition","slotzoom-vertical");if(o.data("transition")=="slotfade-horizontal")o.data("transition","slotzoom-horizontal")}if(o.data("delay")!=t){r.cd=0;r.delay=o.data("delay")}else{r.delay=r.origcd}i.css({left:"0px",top:"0px"});o.css({left:"0px",top:"0px"});if(o.data("differentissplayed")=="prepared"){o.data("differentissplayed","done");o.data("transition",o.data("savedtransition"));o.data("slotamount",o.data("savedslotamount"));o.data("masterspeed",o.data("savedmasterspeed"))}if(o.data("fstransition")!=t&&o.data("differentissplayed")!="done"){o.data("savedtransition",o.data("transition"));o.data("savedslotamount",o.data("slotamount"));o.data("savedmasterspeed",o.data("masterspeed"));o.data("transition",o.data("fstransition"));o.data("slotamount",o.data("fsslotamount"));o.data("masterspeed",o.data("fsmasterspeed"));o.data("differentissplayed","prepared")}var l=0;if(o.data("transition")=="boxslide")l=0;else if(o.data("transition")=="boxfade")l=1;else if(o.data("transition")=="slotslide-horizontal")l=2;else if(o.data("transition")=="slotslide-vertical")l=3;else if(o.data("transition")=="curtain-1")l=4;else if(o.data("transition")=="curtain-2")l=5;else if(o.data("transition")=="curtain-3")l=6;else if(o.data("transition")=="slotzoom-horizontal")l=7;else if(o.data("transition")=="slotzoom-vertical")l=8;else if(o.data("transition")=="slotfade-horizontal")l=9;else if(o.data("transition")=="slotfade-vertical")l=10;else if(o.data("transition")=="fade")l=11;else if(o.data("transition")=="slideleft")l=12;else if(o.data("transition")=="slideup")l=13;else if(o.data("transition")=="slidedown")l=14;else if(o.data("transition")=="slideright")l=15;else if(o.data("transition")=="papercut")l=16;else if(o.data("transition")=="3dcurtain-horizontal")l=17;else if(o.data("transition")=="3dcurtain-vertical")l=18;else if(o.data("transition")=="cubic"||o.data("transition")=="cube")l=19;else if(o.data("transition")=="flyin")l=20;else if(o.data("transition")=="turnoff")l=21;else{l=Math.round(Math.random()*21);o.data("slotamount",Math.round(Math.random()*12+4))}if(o.data("transition")=="random-static"){l=Math.round(Math.random()*16);if(l>15)l=15;if(l<0)l=0}if(o.data("transition")=="random-premium"){l=Math.round(Math.random()*6+16);if(l>21)l=21;if(l<16)l=16}var c=-1;if(r.leftarrowpressed==1||r.act>r.next)c=1;if(o.data("transition")=="slidehorizontal"){l=12;if(r.leftarrowpressed==1)l=15}if(o.data("transition")=="slidevertical"){l=13;if(r.leftarrowpressed==1)l=14}r.leftarrowpressed=0;if(l>21)l=21;if(l<0)l=0;if((r.ie||r.ie9)&&l>18){l=Math.round(Math.random()*16);o.data("slotamount",Math.round(Math.random()*12+4))}if(r.ie&&(l==17||l==16||l==2||l==3||l==9||l==10))l=Math.round(Math.random()*3+12);if(r.ie9&&l==3)l=4;var h=300;if(o.data("masterspeed")!=t&&o.data("masterspeed")>99&&o.data("masterspeed")<4001)h=o.data("masterspeed");n.parent().find(".bullet").each(function(){var t=e(this);t.removeClass("selected");if(r.navigationArrows=="withbullet"||r.navigationArrows=="nexttobullets"){if(t.index()-1==r.next)t.addClass("selected")}else{if(t.index()==r.next)t.addClass("selected")}});n.find(">li").each(function(){var t=e(this);
10472if(t.index!=r.act&&t.index!=r.next)t.css({"z-index":16})});i.css({"z-index":18});o.css({"z-index":20});o.css({opacity:0});A(i,r);L(o,r);if(o.data("slotamount")==t||o.data("slotamount")<1){r.slots=Math.round(Math.random()*12+4);if(o.data("transition")=="boxslide")r.slots=Math.round(Math.random()*6+3)}else{r.slots=o.data("slotamount")}if(o.data("rotate")==t)r.rotate=0;else if(o.data("rotate")==999)r.rotate=Math.round(Math.random()*360);else r.rotate=o.data("rotate");if(!e.support.transition||r.ie||r.ie9)r.rotate=0;if(r.firststart==1){i.css({opacity:0});r.firststart=0}if(l==0){h=h+100;if(r.slots>10)r.slots=10;o.css({opacity:1});y(a,r,true);y(f,r,false);f.find(".defaultimg").css({opacity:0});f.find(".slotslide").each(function(t){var s=e(this);if(r.ie9)s.transition({top:0-r.sloth,left:0-r.slotw},0);else s.transition({top:0-r.sloth,left:0-r.slotw,rotate:r.rotate},0);setTimeout(function(){s.transition({top:0,left:0,scale:1,rotate:0},h*1.5,function(){if(t==r.slots*r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})},t*15)})}if(l==1){if(r.slots>5)r.slots=5;o.css({opacity:1});y(f,r,false);f.find(".defaultimg").css({opacity:0});f.find(".slotslide").each(function(t){var s=e(this);s.css({opacity:0});s.find("img").css({opacity:0});if(r.ie9)s.find("img").transition({top:Math.random()*r.slotw-r.slotw+"px",left:Math.random()*r.slotw-r.slotw+"px"},0);else s.find("img").transition({top:Math.random()*r.slotw-r.slotw+"px",left:Math.random()*r.slotw-r.slotw+"px",rotate:r.rotate},0);var l=Math.random()*1e3+(h+200);if(t==r.slots*r.slots-1)l=1500;s.find("img").transition({opacity:1,top:0-s.data("y")+"px",left:0-s.data("x")+"px",rotate:0},l);s.transition({opacity:1},l,function(){if(t==r.slots*r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})})}if(l==2){h=h+200;o.css({opacity:1});m(a,r,true);m(f,r,false);f.find(".defaultimg").css({opacity:0});a.find(".slotslide").each(function(){var t=e(this);t.transit({left:r.slotw+"px",rotate:0-r.rotate},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)})});f.find(".slotslide").each(function(){var t=e(this);if(r.ie9)t.transit({left:0-r.slotw+"px"},0);else t.transit({left:0-r.slotw+"px",rotate:r.rotate},0);t.transit({left:"0px",rotate:0},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});if(r.ie)a.find(".defaultimg").css({opacity:1});r.act=r.next;u(n)})})}if(l==3){h=h+200;o.css({opacity:1});g(a,r,true);g(f,r,false);f.find(".defaultimg").css({opacity:0});a.find(".slotslide").each(function(){var t=e(this);t.transit({top:r.sloth+"px",rotate:r.rotate},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)})});f.find(".slotslide").each(function(){var t=e(this);if(r.ie9)t.transit({top:0-r.sloth+"px"},0);else t.transit({top:0-r.sloth+"px",rotate:r.rotate},0);t.transit({top:"0px",rotate:0},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)})})}if(l==4){o.css({opacity:1});m(a,r,true);m(f,r,true);f.find(".defaultimg").css({opacity:0});a.find(".defaultimg").css({opacity:0});a.find(".slotslide").each(function(t){var n=e(this);n.transit({top:0+r.height+"px",opacity:1,rotate:r.rotate},h+t*(70-r.slots))});f.find(".slotslide").each(function(t){var s=e(this);if(r.ie9)s.transition({top:0-r.height+"px",opacity:0},0);else s.transition({top:0-r.height+"px",opacity:0,rotate:r.rotate},0);s.transition({top:"0px",opacity:1,rotate:0},h+t*(70-r.slots),function(){if(t==r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})})}if(l==5){o.css({opacity:1});m(a,r,true);m(f,r,true);f.find(".defaultimg").css({opacity:0});a.find(".defaultimg").css({opacity:0});a.find(".slotslide").each(function(t){var n=e(this);n.transition({top:0+r.height+"px",opacity:1,rotate:r.rotate},h+(r.slots-t)*(70-r.slots))});f.find(".slotslide").each(function(t){var s=e(this);if(r.ie9)s.transition({top:0-r.height+"px",opacity:0}
10472,0);else s.transition({top:0-r.height+"px",opacity:0,rotate:r.rotate},0);s.transition({top:"0px",opacity:1,rotate:0},h+(r.slots-t)*(70-r.slots),function(){if(t==0){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})})}if(l==6){o.css({opacity:1});if(r.slots<2)r.slots=2;m(a,r,true);m(f,r,true);f.find(".defaultimg").css({opacity:0});a.find(".defaultimg").css({opacity:0});a.find(".slotslide").each(function(t){var n=e(this);if(t<r.slots/2)var i=(t+2)*60;else var i=(2+r.slots-t)*60;n.transition({top:0+r.height+"px",opacity:1},h+i)});f.find(".slotslide").each(function(t){var s=e(this);if(r.ie9)s.transition({top:0-r.height+"px",opacity:0},0);else s.transition({top:0-r.height+"px",opacity:0,rotate:r.rotate},0);if(t<r.slots/2)var l=(t+2)*60;else var l=(2+r.slots-t)*60;s.transition({top:"0px",opacity:1,rotate:0},h+l,function(){if(t==Math.round(r.slots/2)){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})})}if(l==7){h=h*3;o.css({opacity:1});m(a,r,true);m(f,r,true);f.find(".defaultimg").css({opacity:0});a.find(".slotslide").each(function(){var t=e(this).find("img");t.transition({left:0-r.slotw/2+"px",top:0-r.height/2+"px",width:r.slotw*2+"px",height:r.height*2+"px",opacity:0,rotate:r.rotate},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)})});/						/;f.find(".slotslide").each(function(t){var s=e(this).find("img");if(r.ie9)s.transition({left:0+"px",top:0+"px",opacity:0},0);else s.transition({left:0+"px",top:0+"px",opacity:0,rotate:r.rotate},0);s.transition({left:0-t*r.slotw+"px",top:0+"px",width:f.find(".defaultimg").data("neww")+"px",height:f.find(".defaultimg").data("newh")+"px",opacity:1,rotate:0},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)})})}if(l==8){h=h*3;o.css({opacity:1});g(a,r,true);g(f,r,true);f.find(".defaultimg").css({opacity:0});a.find(".slotslide").each(function(){var t=e(this).find("img");t.transition({left:0-r.width/2+"px",top:0-r.sloth/2+"px",width:r.width*2+"px",height:r.sloth*2+"px",opacity:0,rotate:r.rotate},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)})});f.find(".slotslide").each(function(t){var s=e(this).find("img");if(r.ie9)s.transition({left:0+"px",top:0+"px",opacity:0},0);else s.transition({left:0+"px",top:0+"px",opacity:0,rotate:r.rotate},0);s.transition({left:0+"px",top:0-t*r.sloth+"px",width:f.find(".defaultimg").data("neww")+"px",height:f.find(".defaultimg").data("newh")+"px",opacity:1,rotate:0},h,function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)})})}if(l==9){o.css({opacity:1});r.slots=r.width/20;m(f,r,true);f.find(".defaultimg").css({opacity:0});var p=0;f.find(".slotslide").each(function(t){var n=e(this);p++;n.transition({opacity:0,x:0,y:0},0);n.data("tout",setTimeout(function(){n.transition({x:0,y:0,opacity:1},h)},t*4))});setTimeout(function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});if(r.ie)a.find(".defaultimg").css({opacity:1});r.act=r.next;u(n)},h+p*4)}if(l==10){o.css({opacity:1});r.slots=r.height/20;g(f,r,true);f.find(".defaultimg").css({opacity:0});var p=0;f.find(".slotslide").each(function(t){var n=e(this);p++;n.transition({opacity:0,x:0,y:0},0);n.data("tout",setTimeout(function(){n.transition({x:0,y:0,opacity:1},h)},t*4))});setTimeout(function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});if(r.ie)a.find(".defaultimg").css({opacity:1});r.act=r.next;u(n)},h+p*4)}if(l==11){o.css({opacity:1});r.slots=1;m(f,r,true);f.find(".defaultimg").css({opacity:0,position:"relative"});var p=0;f.find(".slotslide").each(function(t){var n=e(this);p++;if(r.ie9||r.ie){if(r.ie)o.css({opacity:"0"});n.css({opacity:0}
10472)}else n.transition({opacity:0,rotate:r.rotate},0);setTimeout(function(){if(r.ie9||r.ie){if(r.ie)o.animate({opacity:1},{duration:h});else n.transition({opacity:1},h)}else{n.transition({opacity:1,rotate:0},h)}},10)});setTimeout(function(){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});if(r.ie)a.find(".defaultimg").css({opacity:1});r.act=r.next;u(n)},h+15)}if(l==12||l==13||l==14||l==15){h=h*3;o.css({opacity:1});r.slots=1;m(f,r,true);m(a,r,true);a.find(".defaultimg").css({opacity:0});f.find(".defaultimg").css({opacity:0});var d=r.width;var v=r.height;if(r.fullWidth=="on"){d=r.container.parent().width();v=r.container.parent().height()}var w=f.find(".slotslide");if(l==12)if(r.ie9){w.transition({left:d+"px"},0)}else{w.transition({left:d+"px",rotate:r.rotate},0)}else if(l==15)if(r.ie9)w.transition({left:0-r.width+"px"},0);else w.transition({left:0-r.width+"px",rotate:r.rotate},0);else if(l==13)if(r.ie9)w.transition({top:v+"px"},0);else w.transition({top:v+"px",rotate:r.rotate},0);else if(l==14)if(r.ie9)w.transition({top:0-r.height+"px"},0);else w.transition({top:0-r.height+"px",rotate:r.rotate},0);w.transition({left:"0px",top:"0px",opacity:1,rotate:0},h,function(){b(n,r,0);if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});f.find(".defaultimg").css({opacity:1});r.act=r.next;u(n)});var E=a.find(".slotslide");if(l==12)E.transition({left:0-d+"px",opacity:1,rotate:0},h);else if(l==15)E.transition({left:d+"px",opacity:1,rotate:0},h);else if(l==13)E.transition({top:0-v+"px",opacity:1,rotate:0},h);else if(l==14)E.transition({top:v+"px",opacity:1,rotate:0},h)}if(l==16){i.css({position:"absolute","z-index":20});o.css({position:"absolute","z-index":15});i.wrapInner('<div class="tp-half-one"></div>');i.find(".tp-half-one").clone(true).appendTo(i).addClass("tp-half-two");i.find(".tp-half-two").removeClass("tp-half-one");i.find(".tp-half-two").wrapInner('<div class="tp-offset"></div>');var S=i.find(".defaultimg");if(S.length>0&&S.data("fullwidthcentering")=="on"){var x=S.height()/2;var T=S.position().top}else{var x=r.height/2;var T=0}i.find(".tp-half-one").css({width:r.width+"px",height:T+x+"px",overflow:"hidden",position:"absolute",top:"0px",left:"0px"});i.find(".tp-half-two").css({width:r.width+"px",height:T+x+"px",overflow:"hidden",position:"absolute",top:T+x+"px",left:"0px"});i.find(".tp-half-two .tp-offset").css({position:"absolute",top:0-x-T+"px",left:"0px"});if(!e.support.transition){i.find(".tp-half-one").animate({opacity:0,top:0-r.height/2+"px"},{duration:500,queue:false});i.find(".tp-half-two").animate({opacity:0,top:r.height+"px"},{duration:500,queue:false})}else{var N=Math.round(Math.random()*40-20);var C=Math.round(Math.random()*40-20);var k=Math.random()*1+1;var O=Math.random()*1+1;i.find(".tp-half-one").transition({opacity:1,scale:k,rotate:N,y:0-r.height/1.4+"px"},800,"in");i.find(".tp-half-two").transition({opacity:1,scale:O,rotate:C,y:0+r.height/1.4+"px"},800,"in");if(i.html()!=null)o.transition({scale:.8,x:r.width*.1,y:r.height*.1,rotate:N},0).transition({rotate:0,scale:1,x:0,y:0},600,"snap")}f.find(".defaultimg").css({opacity:1});setTimeout(function(){i.css({position:"absolute","z-index":18});o.css({position:"absolute","z-index":20});f.find(".defaultimg").css({opacity:1});a.find(".defaultimg").css({opacity:0});if(i.find(".tp-half-one").length>0){i.find(".tp-half-one >img, .tp-half-one >div").unwrap()}i.find(".tp-half-two").remove();r.transition=0;r.act=r.next},800);o.css({opacity:1})}if(l==17){h=h+100;if(r.slots>10)r.slots=10;o.css({opacity:1});g(a,r,true);g(f,r,false);f.find(".defaultimg").css({opacity:0});f.find(".slotslide").each(function(t){var s=e(this);s.transition({opacity:0,rotateY:350,rotateX:40,perspective:"1400px"},0);setTimeout(function(){s.transition({opacity:1,top:0,left:0,scale:1,perspective:"150px",rotate:0,rotateY:0,rotateX:0},h*2,function(){if(t==r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})},t*100)})}if(l==18){h=h+100;if(r.slots>10)r.slots=10;o.css({opacity:1});m(a,r,true);m(f,r,false);f.find(".defaultimg").css({opacity:0}
10472);f.find(".slotslide").each(function(t){var s=e(this);s.transition({rotateX:10,rotateY:310,perspective:"1400px",rotate:0,opacity:0},0);setTimeout(function(){s.transition({top:0,left:0,scale:1,perspective:"150px",rotate:0,rotateY:0,rotateX:0,opacity:1},h*2,function(){if(t==r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})},t*100)})}if(l==19){h=h+100;if(r.slots>10)r.slots=10;o.css({opacity:1});m(a,r,true);m(f,r,false);f.find(".defaultimg").css({opacity:0});var M=o.css("z-index");var _=i.css("z-index");f.find(".slotslide").each(function(t){var s=e(this);s.parent().css({overflow:"visible"});s.css({background:"#333"});if(c==1)s.transition({opacity:0,left:0,top:r.height/2,rotate3d:"1, 0, 0, -90deg "},0);else s.transition({opacity:0,left:0,top:0-r.height/2,rotate3d:"1, 0, 0, 90deg "},0);setTimeout(function(){s.transition({opacity:1,top:0,perspective:r.height*2,rotate3d:" 1, 0, 0, 0deg "},h*2,function(){if(t==r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})},t*150)});a.find(".slotslide").each(function(t){var n=e(this);n.parent().css({overflow:"visible"});n.css({background:"#333"});n.transition({top:0,rotate3d:"1, 0, 0, 0deg"},0);a.find(".defaultimg").css({opacity:0});setTimeout(function(){if(c==1)n.transition({opacity:.6,left:0,perspective:r.height*2,top:0-r.height/2,rotate3d:"1, 0, 0, 90deg"},h*2,function(){});else n.transition({opacity:.6,left:0,perspective:r.height*2,top:0+r.height/2,rotate3d:"1, 0, 0, -90deg"},h*2,function(){})},t*150)})}if(l==20){h=h+100;if(r.slots>10)r.slots=10;o.css({opacity:1});g(a,r,true);g(f,r,false);f.find(".defaultimg").css({opacity:0});f.find(".slotslide").each(function(t){var s=e(this);s.parent().css({overflow:"visible"});if(c==1)s.transition({scale:.8,top:0,left:0-r.width,rotate3d:"2, 5, 0, 110deg"},0);else s.transition({scale:.8,top:0,left:0+r.width,rotate3d:"2, 5, 0, -110deg"},0);setTimeout(function(){s.transition({scale:.8,left:0,perspective:r.width,rotate3d:"1, 5, 0, 0deg"},h*2,"ease").transition({scale:1},200,"out",function(){if(t==r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})},t*100)});a.find(".slotslide").each(function(t){var n=e(this);n.transition({scale:.5,left:0,rotate3d:"1, 5, 0, 5deg"},300,"in-out");a.find(".defaultimg").css({opacity:0});setTimeout(function(){if(c==1)n.transition({top:0,left:r.width/2,perspective:r.width,rotate3d:"0, -3, 0, 70deg",opacity:0},h*2,"out",function(){});else n.transition({top:0,left:0-r.width/2,perspective:r.width,rotate3d:"0, -3, 0, -70deg",opacity:0},h*2,"out",function(){})},t*100)})}if(l==21){h=h+100;if(r.slots>10)r.slots=10;o.css({opacity:1});g(a,r,true);g(f,r,false);f.find(".defaultimg").css({opacity:0});f.find(".slotslide").each(function(t){var s=e(this);if(c==1)s.transition({top:0,left:0-r.width,rotate3d:"0, 1, 0, 90deg"},0);else s.transition({top:0,left:0+r.width,rotate3d:"0, 1, 0, -90deg"},0);setTimeout(function(){s.transition({left:0,perspective:r.width*2,rotate3d:"0, 0, 0, 0deg"},h*2,function(){if(t==r.slots-1){b(n,r);f.find(".defaultimg").css({opacity:1});if(o.index()!=i.index())a.find(".defaultimg").css({opacity:0});r.act=r.next;u(n)}})},t*100)});a.find(".slotslide").each(function(t){var n=e(this);n.transition({left:0,rotate3d:"0, 0, 0, 0deg"},0);a.find(".defaultimg").css({opacity:0});setTimeout(function(){if(c==1)n.transition({top:0,left:r.width/2,perspective:r.width,rotate3d:"0, 1, 0, -90deg"},h*1.5,function(){});else n.transition({top:0,left:0-r.width/2,perspective:r.width,rotate3d:"0, 1, 0, +90deg"},h*1.5,function(){})},t*100)})}var D={};D.slideIndex=r.next+1;n.trigger("revolution.slide.onchange",D);setTimeout(function(){n.trigger("revolution.slide.onafterswap")},h);n.trigger("revolution.slide.onvideostop")}function S(){}function x(t){if(t.data==YT.PlayerState.PLAYING){var n=e("body").find(".tp-bannertimer");var r=n.data("opt");n.stop();r.videoplaying=true;r.videostartednow=1}else{var n=e("body").find(".tp-bannertimer");var r=n.data("opt");if(r.conthover==0)n.animate({width:"100%"},{duration:r.delay-r.cd-100,queue:false,easing:"linear"});r.videoplaying=false;r.videostoppednow=1}}function T(e){e.target.playVideo()}function N(e,t,n){if(e.addEventListener){e.addEventListener(t,n,false)}else{e.attachEvent(t,n,false)}}function C(t){var n=$f(t);n.addEvent("ready",function(t){n.addEvent("play",function(t){var n=e("body").find(".tp-bannertimer");var r=n.data("opt");n.stop();r.videoplaying=true});n.addEvent("finish",function(t){var n=e("body").find(".tp-bannertimer");var r=n.data("opt");if(r.conthover==0)n.animate({width:"100%"},{duration:r.delay-r.cd-100,queue:false,easing:"linear"});r.videoplaying=false;r.videostartednow=1});n.addEvent("pause",function(t){var n=e("body").find(".tp-bannertimer");var r=n.data("opt");if(r.conthover==0)n.animate({width:"100%"},{duration:r.delay-r.cd-100,queue:false,easing:"linear"});r.videoplaying=false;r.videostoppednow=1})})}function k(t){var n=$f(t);n.addEvent("ready",function(e){n.api("play")});n.addEvent("play",function(t){var n=e("body").find(".tp-bannertimer");var r=n.data("opt");n.stop();r.videoplaying=true});n.addEvent("finish",function(t){var n=e("body").find(".tp-bannertimer");var r=n.data("opt");if(r.conthover==0)n.animate({width:"100%"},{duration:r.delay-r.cd-100,queue:false,easing:"linear"});r.videoplaying=false;r.videostartednow=1});n.addEvent("pause",function(t){var n=e("body").find(".tp-bannertimer");var r=n.data("opt");if(r.conthover==0)n.animate({width:"100%"},{duration:r.delay-r.cd-100,queue:false,easing:"linear"});r.videoplaying=false;r.videostoppednow=1})}function L(n,r,i){var s=0;n.find(".tp-caption").each(function(i){s=r.width/2-r.startwidth/2;if(r.bh>1){r.bw=1;r.bh=1}if(r.bw>1){r.bw=1;r.bh=1}var o=r.bw;var u=r.bh;var a=n.find(".tp-caption:eq("+i+")");var f=0;if(r.width<r.hideCaptionAtLimit&&a.data("captionhidden")=="on"){a.addClass("tp-hidden-caption");f=1}else{if(r.width<r.hideAllCaptionAtLilmit){a.addClass("tp-hidden-caption");f=1}else{a.removeClass("tp-hidden-caption")}}a.stop(true,true);if(f==0){if(a.data("linktoslide")!=t){a.css({cursor:"pointer"});if(a.data("linktoslide")!="no"){a.click(function(){var t=e(this);var n=t.data("linktoslide");if(n!="next"&&n!="prev"){r.container.data("showus",n);r.container.parent().find(".tp-rightarrow").click()}else if(n=="next")r.container.parent().find(".tp-rightarrow").click();else if(n=="prev")r.container.parent().find(".tp-leftarrow").click()})}}
10472if(a.hasClass("coloredbg"))s=0;if(s<0)s=0;var l=0;clearTimeout(a.data("timer"));clearTimeout(a.data("timer-end"));var c="iframe"+Math.round(Math.random()*1e3+1);if(a.find("iframe").length>0){a.find("iframe").each(function(){var n=e(this);if(n.attr("src").toLowerCase().indexOf("youtube")>=0){if(!n.hasClass("HasListener")){try{n.attr("id",c);var r;if(a.data("autoplay")==true)r=new YT.Player(c,{events:{onStateChange:x,onReady:T}});else r=new YT.Player(c,{events:{onStateChange:x}});n.addClass("HasListener");a.data("player",r)}catch(i){}}else{if(a.data("autoplay")==true){var r=a.data("player");r.playVideo()}}}else{if(n.attr("src").toLowerCase().indexOf("vimeo")>=0){if(!n.hasClass("HasListener")){n.addClass("HasListener");n.attr("id",c);var s=n.attr("src");var o={},u=s,f=/([^&=]+)=([^&]*)/g,l;while(l=f.exec(u)){o[decodeURIComponent(l[1])]=decodeURIComponent(l[2])}if(o["player_id"]!=t){s=s.replace(o["player_id"],c)}else{s=s+"&player_id="+c}try{s=s.replace("api=0","api=1")}catch(i){}s=s+"&api=1";n.attr("src",s);var r=a.find("iframe")[0];if(a.data("autoplay")==true)$f(r).addEvent("ready",k);else $f(r).addEvent("ready",C)}else{if(a.data("autoplay")==true){var n=a.find("iframe");var h=n.attr("id");var p=$f(h);p.api("pause")}}}}})}if(a.hasClass("randomrotate")&&(r.ie||r.ie9))a.removeClass("randomrotate").addClass("sfb");a.removeClass("noFilterClass");var h=0;var p=0;if(a.find("img").length>0){var d=a.find("img");if(d.data("ww")==t)d.data("ww",d.width());if(d.data("hh")==t)d.data("hh",d.height());var v=d.data("ww");var m=d.data("hh");d.width(v*r.bw);d.height(m*r.bh);h=d.width();p=d.height()}else{if(a.find("iframe").length>0){var d=a.find("iframe");if(a.data("ww")==t){a.data("ww",d.width())}if(a.data("hh")==t)a.data("hh",d.height());var v=a.data("ww");var m=a.data("hh");var g=a;if(g.data("fsize")==t)g.data("fsize",parseInt(g.css("font-size"),0)||0);if(g.data("pt")==t)g.data("pt",parseInt(g.css("paddingTop"),0)||0);if(g.data("pb")==t)g.data("pb",parseInt(g.css("paddingBottom"),0)||0);if(g.data("pl")==t)g.data("pl",parseInt(g.css("paddingLeft"),0)||0);if(g.data("pr")==t)g.data("pr",parseInt(g.css("paddingRight"),0)||0);if(g.data("mt")==t)g.data("mt",parseInt(g.css("marginTop"),0)||0);if(g.data("mb")==t)g.data("mb",parseInt(g.css("marginBottom"),0)||0);if(g.data("ml")==t)g.data("ml",parseInt(g.css("marginLeft"),0)||0);if(g.data("mr")==t)g.data("mr",parseInt(g.css("marginRight"),0)||0);if(g.data("bt")==t)g.data("bt",parseInt(g.css("borderTop"),0)||0);if(g.data("bb")==t)g.data("bb",parseInt(g.css("borderBottom"),0)||0);if(g.data("bl")==t)g.data("bl",parseInt(g.css("borderLeft"),0)||0);if(g.data("br")==t)g.data("br",parseInt(g.css("borderRight"),0)||0);if(g.data("lh")==t)g.data("lh",parseInt(g.css("lineHeight"),0)||0);var y=r.width;var b=r.height;if(y>r.startwidth)y=r.startwidth;if(b>r.startheight)b=r.startheight;if(!a.hasClass("fullscreenvideo"))a.css({"font-size":g.data("fsize")*r.bw+"px","padding-top":g.data("pt")*r.bh+"px","padding-bottom":g.data("pb")*r.bh+"px","padding-left":g.data("pl")*r.bw+"px","padding-right":g.data("pr")*r.bw+"px","margin-top":g.data("mt")*r.bh+"px","margin-bottom":g.data("mb")*r.bh+"px","margin-left":g.data("ml")*r.bw+"px","margin-right":g.data("mr")*r.bw+"px","border-top":g.data("bt")*r.bh+"px","border-bottom":g.data("bb")*r.bh+"px","border-left":g.data("bl")*r.bw+"px","border-right":g.data("br")*r.bw+"px","line-height":g.data("lh")*r.bh+"px",height:m*r.bh+"px","white-space":"nowrap"});else a.css({width:r.startwidth*r.bw,height:r.startheight*r.bh});d.width(v*r.bw);d.height(m*r.bh);h=d.width();p=d.height()}else{var g=a;if(g.data("fsize")==t)g.data("fsize",parseInt(g.css("font-size"),0)||0);if(g.data("pt")==t)g.data("pt",parseInt(g.css("paddingTop"),0)||0);if(g.data("pb")==t)g.data("pb",parseInt(g.css("paddingBottom"),0)||0);if(g.data("pl")==t)g.data("pl",parseInt(g.css("paddingLeft"),0)||0);if(g.data("pr")==t)g.data("pr",parseInt(g.css("paddingRight"),0)||0);if(g.data("mt")==t)g.data("mt",parseInt(g.css("marginTop"),0)||0);if(g.data("mb")==t)g.data("mb",parseInt(g.css("marginBottom"),0)||0);if(g.data("ml")==t)g.data("ml",parseInt(g.css("marginLeft"),0)||0);if(g.data("mr")==t)g.data("mr",parseInt(g.css("marginRight"),0)||0);if(g.data("bt")==t)g.data("bt",parseInt(g.css("borderTop"),0)||0);if(g.data("bb")==t)g.data("bb",parseInt(g.css("borderBottom"),0)||0);if(g.data("bl")==t)g.data("bl",parseInt(g.css("borderLeft"),0)||0);if(g.data("br")==t)g.data("br",parseInt(g.css("borderRight"),0)||0);if(g.data("lh")==t)g.data("lh",parseInt(g.css("lineHeight"),0)||0);a.css({"font-size":g.data("fsize")*r.bw+"px","padding-top":g.data("pt")*r.bh+"px","padding-bottom":g.data("pb")*r.bh+"px","padding-left":g.data("pl")*r.bw+"px","padding-right":g.data("pr")*r.bw+"px","margin-top":g.data("mt")*r.bh+"px","margin-bottom":g.data("mb")*r.bh+"px","margin-left":g.data("ml")*r.bw+"px","margin-right":g.data("mr")*r.bw+"px","border-top":g.data("bt")*r.bh+"px","border-bottom":g.data("bb")*r.bh+"px","border-left":g.data("bl")*r.bw+"px","border-right":g.data("br")*r.bw+"px","line-height":g.data("lh")*r.bh+"px","white-space":"nowrap"});p=a.outerHeight(true);h=a.outerWidth(true)}}if(a.data("x")=="center"||a.data("xcenter")=="center"){a.data("xcenter","center");a.data("x",(r.width/2-a.outerWidth(true)/2)/o-s)}if(a.data("y")=="center"||a.data("ycenter")=="center"){a.data("ycenter","center");a.data("y",(r.height/2-a.outerHeight(true)/2)/r.bh)}if(a.hasClass("fade")){a.css({opacity:0,left:o*a.data("x")+s+"px",top:r.bh*a.data("y")+"px"})}
10472if(a.hasClass("randomrotate")){a.css({left:o*a.data("x")+s+"px",top:u*a.data("y")+l+"px"});var w=Math.random()*2+1;var E=Math.round(Math.random()*200-100);var S=Math.round(Math.random()*200-100);var N=Math.round(Math.random()*200-100);a.data("repx",S);a.data("repy",N);a.data("repo",a.css("opacity"));a.data("rotate",E);a.data("scale",w);a.transition({opacity:0,scale:w,rotate:E,x:S,y:N,duration:"0ms"})}else{if(r.ie||r.ie9){}else{if(a.find("iframe").length==0)a.transition({scale:1,rotate:0})}}if(a.hasClass("lfr")){a.css({opacity:1,left:15+r.width+"px",top:r.bh*a.data("y")+"px"})}if(a.hasClass("lfl")){a.css({opacity:1,left:-15-h+"px",top:r.bh*a.data("y")+"px"})}if(a.hasClass("sfl")){a.css({opacity:0,left:o*a.data("x")-50+s+"px",top:r.bh*a.data("y")+"px"})}if(a.hasClass("sfr")){a.css({opacity:0,left:o*a.data("x")+50+s+"px",top:r.bh*a.data("y")+"px"})}if(a.hasClass("lft")){a.css({opacity:1,left:o*a.data("x")+s+"px",top:-25-p+"px"})}if(a.hasClass("lfb")){a.css({opacity:1,left:o*a.data("x")+s+"px",top:25+r.height+"px"})}if(a.hasClass("sft")){a.css({opacity:0,left:o*a.data("x")+s+"px",top:r.bh*a.data("y")-50+"px"})}if(a.hasClass("sfb")){a.css({opacity:0,left:o*a.data("x")+s+"px",top:r.bh*a.data("y")+50+"px"})}a.data("timer",setTimeout(function(){a.css({visibility:"visible"});if(a.hasClass("fade")){a.data("repo",a.css("opacity"));a.animate({opacity:1},{duration:a.data("speed"),complete:function(){if(r.ie)e(this).addClass("noFilterClass")}})}if(a.hasClass("randomrotate")){a.transition({opacity:1,scale:1,left:o*a.data("x")+s+"px",top:u*a.data("y")+l+"px",rotate:0,x:0,y:0,duration:a.data("speed")});if(r.ie)a.addClass("noFilterClass")}if(a.hasClass("lfr")||a.hasClass("lfl")||a.hasClass("sfr")||a.hasClass("sfl")||a.hasClass("lft")||a.hasClass("lfb")||a.hasClass("sft")||a.hasClass("sfb")){var n=a.data("easing");if(n==t)n="linear";a.data("repx",a.position().left);a.data("repy",a.position().top);a.data("repo",a.css("opacity"));a.animate({opacity:1,left:o*a.data("x")+s+"px",top:r.bh*a.data("y")+"px"},{duration:a.data("speed"),easing:n,complete:function(){if(r.ie)e(this).addClass("noFilterClass")}})}},a.data("start")));if(a.data("end")!=t)a.data("timer-end",setTimeout(function(){if((r.ie||r.ie9)&&(a.hasClass("randomrotate")||a.hasClass("randomrotateout"))){a.removeClass("randomrotate").removeClass("randomrotateout").addClass("fadeout")}O(a,r)},a.data("end")))}});var o=jQuery("body").find("#"+r.container.attr("id")).find(".tp-bannertimer");o.data("opt",r)}function A(e,t){e.find(".tp-caption").each(function(n){var r=e.find(".tp-caption:eq("+n+")");r.stop(true,true);clearTimeout(r.data("timer"));clearTimeout(r.data("timer-end"));var i=r.data("easing");i="easeInOutSine";var s=r.data("repx");var o=r.data("repy");var u=r.data("repo");var a=r.data("rotate");var f=r.data("scale");if(r.find("iframe").length>0){try{var l=r.find("iframe");var c=l.attr("id");var h=$f(c);h.api("pause")}catch(p){}try{var d=r.data("player");d.stopVideo()}catch(p){}}try{O(r,t)}catch(p){}})}function O(n,r){if(n.hasClass("randomrotate")&&(r.ie||r.ie9))n.removeClass("randomrotate").addClass("sfb");if(n.hasClass("randomrotateout")&&(r.ie||r.ie9))n.removeClass("randomrotateout").addClass("stb");var i=n.data("endspeed");if(i==t)i=n.data("speed");var s=n.data("repx");var o=n.data("repy");var u=n.data("repo");if(r.ie){n.css({opacity:"inherit",filter:"inherit"})}if(n.hasClass("ltr")||n.hasClass("ltl")||n.hasClass("str")||n.hasClass("stl")||n.hasClass("ltt")||n.hasClass("ltb")||n.hasClass("stt")||n.hasClass("stb")){s=n.position().left;o=n.position().top;if(n.hasClass("ltr"))s=r.width+60;else if(n.hasClass("ltl"))s=0-n.width()-60;else if(n.hasClass("ltt"))o=0-n.height()-60;else if(n.hasClass("ltb"))o=r.height+60;else if(n.hasClass("str")){s=s+50;u=0}else if(n.hasClass("stl")){s=s-50;u=0}else if(n.hasClass("stt")){o=o-50;u=0}else if(n.hasClass("stb")){o=o+50;u=0}var a=n.data("endeasing");if(a==t)a="linear";n.animate({opacity:u,left:s+"px",top:o+"px"},{duration:n.data("endspeed"),easing:a,complete:function(){e(this).css({visibility:"hidden"})}});if(r.ie)n.removeClass("noFilterClass")}else if(n.hasClass("randomrotateout")){n.transition({opacity:0,scale:Math.random()*2+.3,left:Math.random()*r.width+"px",top:Math.random()*r.height+"px",rotate:Math.random()*40,duration:i,complete:function(){e(this).css({visibility:"hidden"})}});if(r.ie)n.removeClass("noFilterClass")}else if(n.hasClass("fadeout")){if(r.ie)n.removeClass("noFilterClass");n.animate({opacity:0}
10472,{duration:200,complete:function(){e(this).css({visibility:"hidden"})}})}else if(n.hasClass("lfr")||n.hasClass("lfl")||n.hasClass("sfr")||n.hasClass("sfl")||n.hasClass("lft")||n.hasClass("lfb")||n.hasClass("sft")||n.hasClass("sfb")){if(n.hasClass("lfr"))s=r.width+60;else if(n.hasClass("lfl"))s=0-n.width()-60;else if(n.hasClass("lft"))o=0-n.height()-60;else if(n.hasClass("lfb"))o=r.height+60;var a=n.data("endeasing");if(a==t)a="linear";n.animate({opacity:u,left:s+"px",top:o+"px"},{duration:n.data("endspeed"),easing:a,complete:function(){e(this).css({visibility:"hidden"})}});if(r.ie)n.removeClass("noFilterClass")}else if(n.hasClass("fade")){n.animate({opacity:0},{duration:i,complete:function(){e(this).css({visibility:"hidden"})}});if(r.ie)n.removeClass("noFilterClass")}else if(n.hasClass("randomrotate")){n.transition({opacity:0,scale:Math.random()*2+.3,left:Math.random()*r.width+"px",top:Math.random()*r.height+"px",rotate:Math.random()*40,duration:i});if(r.ie)n.removeClass("noFilterClass")}}function M(t,n){t.children().each(function(){try{e(this).die("click")}catch(t){}try{e(this).die("mouseenter")}catch(t){}try{e(this).die("mouseleave")}catch(t){}try{e(this).unbind("hover")}catch(t){}});try{$container.die("click","mouseenter","mouseleave")}catch(r){}clearInterval(n.cdint);t=null}function _(n,r){r.cd=0;r.loop=0;if(r.stopAfterLoops!=t&&r.stopAfterLoops>-1)r.looptogo=r.stopAfterLoops;else r.looptogo=9999999;if(r.stopAtSlide!=t&&r.stopAtSlide>-1)r.lastslidetoshow=r.stopAtSlide;else r.lastslidetoshow=999;r.stopLoop="off";if(r.looptogo==0)r.stopLoop="on";if(r.slideamount>1&&!(r.stopAfterLoops==0&&r.stopAtSlide==1)){var i=n.find(".tp-bannertimer");if(i.length>0){i.css({width:"0%"});i.animate({width:"100%"},{duration:r.delay-100,queue:false,easing:"linear"})}i.data("opt",r);r.cdint=setInterval(function(){if(e("body").find(n).length==0)M(n,r);if(n.data("conthover-changed")==1){r.conthover=n.data("conthover");n.data("conthover-changed",0)}if(r.conthover!=1&&r.videoplaying!=true&&r.width>r.hideSliderAtLimit)r.cd=r.cd+100;if(r.fullWidth!="on")if(r.width>r.hideSliderAtLimit)n.parent().removeClass("tp-hide-revslider");else n.parent().addClass("tp-hide-revslider");if(r.videostartednow==1){n.trigger("revolution.slide.onvideoplay");r.videostartednow=0}if(r.videostoppednow==1){n.trigger("revolution.slide.onvideostop");r.videostoppednow=0}if(r.cd>=r.delay){r.cd=0;r.act=r.next;r.next=r.next+1;if(r.next>n.find(">ul >li").length-1){r.next=0;r.looptogo=r.looptogo-1;if(r.looptogo<=0){r.stopLoop="on"}}if(r.stopLoop=="on"&&r.next==r.lastslidetoshow-1){clearInterval(r.cdint);n.find(".tp-bannertimer").css({visibility:"hidden"});n.trigger("revolution.slide.onstop")}E(n,r);if(i.length>0){i.css({width:"0%"});i.animate({width:"100%"},{duration:r.delay-100,queue:false,easing:"linear"})}}},100);n.hover(function(){if(r.onHoverStop=="on"){r.conthover=1;i.stop();n.trigger("revolution.slide.onpause")}},function(){if(n.data("conthover")!=1){n.trigger("revolution.slide.onresume");r.conthover=0;if(r.onHoverStop=="on"&&r.videoplaying!=true){i.animate({width:"100%"},{duration:r.delay-r.cd-100,queue:false,easing:"linear"})}}})}}e.fn.extend({revolution:function(i){e.fn.revolution.defaults={delay:9e3,startheight:500,startwidth:960,hideThumbs:200,thumbWidth:100,thumbHe
10472ight:50,thumbAmount:5,navigationType:"bullet",navigationArrows:"withbullet",navigationStyle:"round",navigationHAlign:"center",navigationVAlign:"bottom",navigationHOffset:0,navigationVOffset:20,soloArrowLeftHalign:"left",soloArrowLeftValign:"center",soloArrowLeftHOffset:20,soloArrowLeftVOffset:0,soloArrowRightHalign:"right",soloArrowRightValign:"center",soloArrowRightHOffset:20,soloArrowRightVOffset:0,touchenabled:"on",onHoverStop:"on",stopAtSlide:-1,stopAfterLoops:-1,hideCaptionAtLimit:0,hideAllCaptionAtLilmit:0,hideSliderAtLimit:0,shadow:1,fullWidth:"off"};i=e.extend({},e.fn.revolution.defaults,i);return this.each(function(){var s=i;var u=e(this);if(!u.hasClass("revslider-initialised")){u.addClass("revslider-initialised");s.firefox13=false;s.ie=!e.support.opacity;s.ie9=document.documentMode==9;var a=e.fn.jquery.split("."),p=parseFloat(a[0]),d=parseFloat(a[1]),m=parseFloat(a[2]||"0");if(p==1&&d<7){u.html('<div style="text-align:center; padding:40px 0px; font-size:20px; color:#992222;"> The Current Version of jQuery:'+a+" <br>Please update your jQuery Version to min. 1.7 in Case you wish to use the Revolution Slider Plugin</div>")}if(!e.support.transition)e.fn.transition=e.fn.animate;e.cssEase["bounce"]="cubic-bezier(0,1,0.5,1.3)";u.find(".caption").each(function(){e(this).addClass("tp-caption")});u.find(".tp-caption iframe").each(function(){try{if(e(this).attr("src").indexOf("you")>0){var t=document.createElement("script");t.src="http://www.youtube.com/player_api";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)}}catch(r){}});u.find(".tp-caption iframe").each(function(){try{if(e(this).attr("src").indexOf("vim")>0){var t=document.createElement("script");t.src="http://a.vimeocdn.com/js/froogaloop2.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)}}catch(r){}});if(s.shuffle=="on"){for(var g=0;g<u.find(">ul:first-child >li").length;g++){var y=Math.round(Math.random()*u.find(">ul:first-child >li").length);u.find(">ul:first-child >li:eq("+y+")").prependTo(u.find(">ul:first-child"))}}s.slots=4;s.act=-1;s.next=0;if(s.startWithSlide!=t)s.next=s.startWithSlide;var b=n("#")[0];if(b.length<9){if(b.split("slide").length>1){var w=parseInt(b.split("slide")[1],0);if(w<1)w=1;if(w>u.find(">ul:first >li").length)w=u.find(">ul:first >li").length;s.next=w-1}}s.origcd=s.delay;s.firststart=1;if(s.navigationHOffset==t)s.navOffsetHorizontal=0;if(s.navigationVOffset==t)s.navOffsetVertical=0;u.append('<div class="tp-loader"></div>');if(u.find(".tp-bannertimer").length==0)u.append('<div class="tp-bannertimer" style="visibility:hidden"></div>');var S=u.find(".tp-bannertimer");if(S.length>0){S.css({width:"0%"})}u.addClass("tp-simpleresponsive");s.container=u;s.slideamount=u.find(">ul:first >li").length;if(u.height()==0)u.height(s.startheight);if(s.startwidth==t||s.startwidth==0)s.startwidth=u.width();if(s.startheight==t||s.startheight==0)s.startheight=u.height();s.width=u.width();s.height=u.height();s.bw=s.startwidth/u.width();s.bh=s.startheight/u.height();if(s.width!=s.startwidth){s.height=Math.round(s.startheight*(s.width/s.startwidth));u.height(s.height)}if(s.shadow!=0){u.parent().append('<div class="tp-bannershadow tp-shadow'+s.shadow+'"></div>');u.parent().find(".tp-bannershadow").css({width:s.width})}u.find("ul").css({display:"none"});u.waitForImages(function(){u.find("ul").css({display:"block"});v(u,s);if(s.slideamount>1)f(u,s);if(s.slideamount>1)o(u,s);if(s.slideamount>1)l(u,s);e("#unvisible_button").click(function(){s.navigationArrows=e(".selectnavarrows").val();s.navigationType=e(".selectnavtype").val();s.navigationStyle=e(".selectnavstyle").val();s.soloArrowStyle="default";e(".tp-bullets").remove();e(".tparrows").remove();if(s.slideamount>1)f(u,s);if(s.slideamount>1)o(u,s);if(s.slideamount>1)l(u,s)});c(u,s);if(s.hideThumbs>0)h(u,s);u.waitForImages(function(){u.find(".tp-loader").fadeOut(600);setTimeout(function(){E(u,s);if(s.slideamount>1)_(u,s);u.trigger("revolution.slide.onloaded")},600)})});e(window).resize(function(){if(e("body").find(u)!=0)if(u.outerWidth(true)!=s.width){r(u,s)}})}})},revpause:function(t){return this.each(function(){var t=e(this);t.data("conthover",1);t.data("conthover-changed",1);t.trigger("revolution.slide.onpause");var n=t.parent().find(".tp-bannertimer");n.stop()})},revresume:function(t){return this.each(function(){var t=e(this);t.data("conthover",0);t.data("conthover-changed",1);t.trigger("revolution.slide.onresume");var n=t.parent().find(".tp-bannertimer");var r=n.data("opt");n.animate({width:"100%"},{duration:r.delay-r.cd-100,queue:false,easing:"linear"})})},revnext:function(t){return this.each(function(){var t=e(this);t.parent().find(".tp-rightarrow").click()})},revprev:function(t){return this.each(function(){var t=e(this);t.parent().find(".tp-leftarrow").click()})},revmaxslide:function(t){return e(this).find(">ul:first-child >li").length},revcurrentslide:function(t){var n=e(this);var r=n.parent().find(".tp-bannertimer");var i=r.data("opt");return i.act},revlastslide:function(t){var n=e(this);var r=n.parent().find(".tp-bannertimer");var i=r.data("opt");return i.lastslide},revshowslide:function(t){return this.each(function(){var n=e(this);n.data("showus",t);n.parent().find(".tp-rightarrow").click()})}})})(jQuery)
10473/*
10474 * jQuery SliderTabs v1.1
10475 * http://lopatin.github.com/sliderTabs
10476 *
10477 * Copyright 2012, Alex Lopatin
10478 * Free to use under the MIT license.
10479 * http://www.opensource.org/licenses/mit-license.php
10480 *
10481 */
10482
10483jQuery.noConflict();
10484 (function( $ ){
10485	/*
10486	 * The sliderTabs tabs class
10487	 */
10488	$.sliderTabs = function(container, options){
10489		var plugin = this;
10490
10491		var defaults = {
10492			autoplay: false,
10493			tabArrowWidth: 35,
10494			classes: {
10495				leftTabArrow: '',
10496				panel: '',
10497				panelActive: '',
10498				panelsContainer: '',
10499				rightTabArrow: '',
10500				tab: '',
10501				tabActive: '',	
10502				tabsList: ''
10503			},
10504			defaultTab: 1,
10505			height: null,
10506			indicators: false,
10507			mousewheel: false,
10508			position: "top",
10509			panelArrows: false,
10510			panelArrowsShowOnHover: false,
10511			tabs: true,
10512			tabHeight: 46,
10513			tabArrows: true,
10514			tabSlideLength: 100,
10515			tabSlideSpeed: 200,
10516			transition: 'slide',
10517			transitionEasing: 'easeOutCubic',
10518			transitionSpeed: 500,
10519			width: null
10520		};
10521
10522		// jQuery objects of important elements
10523		var $container = $(container),
10524			$indicators,
10525			$tabsList,
10526			$contentDivs,
10527			$tabsListContainer,
10528			$tabsListWrapper,
10529			$contentDivsContainer,
10530			$leftTabArrow,
10531			$rightTabArrow,
10532			$leftPanelArrow,
10533			$rightPanelArrow;
10534
10535		// Locks to stop out of sync behavior
10536		var selectLock = false,
10537			heightLock = true;
10538		
10539		var settings, minMargin;
10540
10541		// Index of currently selected tab
10542		plugin.selectedTab = defaults.defaultTab;
10543		plugin.lock = false;
10544		plugin.init = function(){
10545			settings = plugin.settings = $.extend({}, defaults, options);
10546			$container.addClass('ui-slider-tabs');
10547
10548			/* 
10549			 * Rebuild structure of container
10550			 */
10551			$contentDivs = $container.children("div").addClass('ui-slider-tab-content');//.remove();
10552			
10553			// Tabs
10554			$tabsList = $container.children("ul").addClass('ui-slider-tabs-list').remove();
10555			$tabsList.children("li").remove().appendTo($tabsList);
10556			plugin.count = $tabsList.children('li').length;
10557			$tabsListWrapper = $("<div class='ui-slider-tabs-list-wrapper'>");
10558			$tabsListContainer = $("<div class='ui-slider-tabs-list-container'>").append($tabsList).appendTo($tabsListWrapper);
10559			$tabsListContainer.find('li').css('height', settings.tabHeight+2);
10560			$tabsListContainer.find('li a').css('height', settings.tabHeight+2);
10561			
10562			// Tab arrows
10563			$leftTabArrow = $("<a href='#' class='ui-slider-left-arrow'><div></div></a>").css({
10564				'width': settings.tabArrowWidth,
10565				'height': settings.tabHeight+2
10566			}).appendTo($tabsListContainer).click(function(e){
10567				plugin.slideTabs('right', settings.tabSlideLength);
10568				return false;
10569			});
10570			$rightTabArrow = $("<a href='#' class='ui-slider-right-arrow'><div></div></a>").css({
10571				'width': settings.tabArrowWidth,
10572				'height': settings.tabHeight+2
10573			}).appendTo($tabsListContainer).click(function(e){
10574				plugin.slideTabs('left', settings.tabSlideLength);
10575				return false;
10576			});
10577
10578			// Content container
10579			$contentDivsContainer = $("<div class='ui-slider-tabs-content-container'>").append($contentDivs);
10580
10581			// Position the tabs on top or bottom
10582			if(settings.position == 'bottom')
10583				$container.append($contentDivsContainer).append($tabsListWrapper.addClass('bottom'));
10584			else
10585				$container.append($tabsListWrapper).append($contentDivsContainer);
10586			
10587
10588			if(settings.width)
10589				$container.width(parseInt(settings.width));
10590			if(settings.height)
10591				$contentDivsContainer.height(parseInt(settings.height)- settings.tabHeight);
10592
10593			// Create and show indicators
10594			if(settings.indicators)
10595				plugin.showIndicators();
10596			resizePanels();
10597
10598			// Select default tab
10599			plugin.selectTab(settings.defaultTab);
10600			plugin.slideTabs('left', 0);
10601
10602			reorderPanels();
10603
10604			
10605
10606			// When tab is clicked
10607			$container.delegate('.ui-slider-tabs-list li a', 'click', function(){
10608				if(!$(this).parent().hasClass('selected') && !selectLock){
10609					plugin.selectTab($(this).parent());
10610				}
10611				return false;
10612			});
10613
10614			// When indicator is clicked
10615			if($indicators)
10616				$indicators.delegate('.ui-slider-tabs-indicator', 'click', function(){
10617					if(!$(this).hasClass('selected') && !selectLock)
10618						plugin.selectTab($(this).index()+1);
10619				});
10620
10621			// Set classes
10622			$.each(settings.classes, function(i, c){
10623				switch(i){
10624					case 'leftTabArrow': 
10625						$leftTabArrow.addClass(c);
10626						break;
10627					case 'rightTabArrow':
10628						$rightTabArrow.addClass(c);
10629						break;
10630					case 'panel':
10631						$contentDivs.addClass(c);
10632						break;
10633					case 'panelsContainer':
10634						$contentDivsContainer.addClass(c);
10635						break;
10636					case 'tab':
10637						$tabsList.find('li').addClass(c);
10638						break;
10639					case 'tabsList':
10640						$tabsList.addClass(c);
10641						break;
10642					default:
10643						break;
10644				}
10645			});
10646
10647			// Panel arrows
10648			// Creates them if they don't exist
10649			if(settings.panelArrows)
10650				positionPanelArrows();
10651
10652			if(settings.panelArrowsShowOnHover){
10653				if($leftPanelArrow)
10654					$leftPanelArrow.addClass('showOnHover');
10655				if($rightPanelArrow)
10656					$rightPanelArrow.addClass('showOnHover');
10657			}
10658
10659			$contentDivsContainer.resize(positionPanelArrows);
10660
10661			// Make responsive to changes in dimensions
10662			$tabsListWrapper.resize(function(){
10663				resizeTabsList();
10664				resizePanels();
10665				setTimeout(function(){
10666					plugin.reCalContent(plugin.selectedTab);
10667				},500);
10668				
10669				/*if(!plugin.lock){
10670					if(plugin.selectedTab == 1)
10671						plugin.selectTab1(2);
10672					else
10673						plugin.selectTab(1);
10674				}*/
10675			});
10676			
10677			// Resize content container height if inner panels change
10678			//setInterval(function(){
10679				var $panel = $contentDivsContainer.children('.selected');
10680				//console.log(heightLock);
10681				if($panel.outerHeight() > $contentDivsContainer.outerHeight() && heightLock)
10682					resizeContentContainer($panel);
10683			//}, 100);
10684
10685			resizeTabsList();
10686
10687			// Hide tabs wrapper if option if false
10688			if(!settings.tabs)
10689				$tabsListWrapper.hide();
10690
10691			// Auto play
10692			if(settings.autoplay)
10693				setInterval(plugin.next, settings.autoplay);
10694
10695			// Panel arrows
10696
10697			// Mousehweel
10698			if(settings.mousewheel){
10699				$container.bind('mousewheel', function(event, delta, deltaX, deltaY) {
10700					if(delta > 0)
10701						plugin.next();
10702					else if(delta < 0)
10703						plugin.prev();
10704					return false;
10705				});
10706			}
10707		}
10708
10709		/*
10710		 * Public methods
10711		 */
10712
10713		// Select tab
10714		// param: tab is a tab index (1 ... n) or jQuery object of tab li element
10715		plugin.selectTab = function(tab){
10716			heightLock = false;
10717
10718			// Find $targetPanel, the panel to show
10719			var $clicked = (typeof tab === 'number') ? $tabsList.children("li:nth-child("+tab+")") : tab;
10720			var targetId = ($clicked.find('a').attr('href')).substr(1);
10721			var $targetPanel = $contentDivsContainer.children("#"+targetId);
10722
10723			// Update selected tab
10724			plugin.selectedTab = (typeof tab === 'number') ? tab : tab.index()+1;
10725
10726			// Resize the main contant container to the size of $targetPanel
10727			resizeContentContainer($targetPanel);
10728
10729			// Lock selections until transitions finished
10730			selectLock = true;
10731
10732			// Direction to slide panel on hide
10733			var direction = ($tabsList.find('.selected').index() < $clicked.index()) ? 'left' : 'right';
10734			// Update selected classes
10735			$clicked.siblings().removeClass('selected');
10736			if(settings.classes.tabActive != '') $clicked.siblings().removeClass(settings.classes.tabActive);
10737			$clicked.addClass('selected').addClass(settings.classes.tabActive);
10738			
10739			// Hide and show appropriate panels
10740			hidePanel($contentDivsContainer.children(".ui-slider-tab-content:visible"), direction);
10741			showPanel($targetPanel);
10742
10743			// Slide tabs so that they fit in $tabsListContainer
10744			fitTabInContainer($clicked);
10745
10746			// Select the proper indicator
10747			selectIndicator();
10748		};
10749		
10750		plugin.reCalContent = function(tab){
10751			heightLock = false;
10752
10753			// Find $targetPanel, the panel to show
10754			var $clicked = (typeof tab === 'number') ? $tabsList.children("li:nth-child("+tab+")") : tab;			
10755			var targetId = ($clicked.find('a').attr('href')).substr(1);
10756			var $targetPanel = $contentDivsContainer.children("#"+targetId);
10757
10758			// Update selected tab
10759			resizeContentContainer($targetPanel);
10760			showPanel($targetPanel);
10761		};
10762
10763		// Select the next (right) panel
10764		plugin.next = function(){
10765			if(!selectLock){
10766				if(plugin.count === plugin.selectedTab)
10767					plugin.selectTab(1);
10768				else plugin.selectTab(plugin.selectedTab+1);
10769			}	
10770		};
10771
10772		// Select the previous panel
10773		plugin.prev = function(){
10774			if(!selectLock){
10775				if(plugin.selectedTab === 1)
10776					plugin.selectTab(plugin.count);
10777				else plugin.selectTab(plugin.selectedTab-1);
10778			}
10779		};
10780
10781		// Slide tabs left/right within $tabsListContainer
10782		plugin.slideTabs = function(direction, length){
10783			var margin = parseInt($tabsList.css('margin-left'));
10784			var newMargin = margin;
10785
10786			// Reset 'edge' classes on tab arrows
10787			$leftTabArrow.removeClass('edge');
10788			$rightTabArrow.removeClass('edge');
10789
10790			// Calculate delta to slide by
10791			if(direction=='right') newMargin += length;
10792			else if(direction=='left') newMargin -= length;
10793			if(newMargin >= 0) {
10794				newMargin = 0;
10795				$leftTabArrow.addClass('edge');
10796			}
10797			else if(newMargin <= minMargin){
10798				newMargin = minMargin;
10799				$rightTabArrow.addClass('edge');
10800			}
10801
10802			// Animate
10803			$tabsList.animate({'margin-left': newMargin}, settings.tabSlideSpeed);
10804		};
10805
10806		// Show panel indicators
10807		// Create indicators if they don't exist yet
10808		plugin.showIndicators = function(){
10809			if(!$indicators){
10810				$indicators = $("<div class='ui-slider-tabs-indicator-container'>");
10811				for(var i = 0; i < $contentDivs.length; i++){
10812					$indicators.append("<div class='ui-slider-tabs-indicator'></div>");
10813				}
10814				$contentDivsContainer.append($indicators);
10815			}
10816			else
10817				$indicators.show();
10818		};
10819
10820		// Hide panel indicators
10821		plugin.hideIndicators = function(){
10822			if($indicators)
10823				$indicators.hide();
10824		};
10825
10826		plugin.showTabArrows = function(){
10827			if(!settings.tabArrows)
10828				return;
10829			$leftTabArrow.show();
10830			$rightTabArrow.show();
10831			$tabsListContainer.css('margin', '0 ' + settings.tabArrowWidth + 'px');
10832			$tabsListContainer.removeClass("wrapper_no_tabs_slider");
10833			$tabsList.removeClass("ul_no_tabs_slider");
10834		};
10835		// Hide arrows that slide tabs left and right
10836		plugin.hideTabArrows = function() {
10837			$leftTabArrow.hide();
10838			$rightTabArrow.hide();
10839			$tabsListContainer.css('margin', '0');
10840			$tabsListContainer.addClass("wrapper_no_tabs_slider");
10841			$tabsList.addClass("ul_no_tabs_slider");
10842		};
10843
10844		// Show panel arrows
10845		plugin.showPanelArrows = function(){
10846			if($leftPanelArrow) $leftPanelArrow.show();
10847			if($rightPanelArrow) $rightPanelArrow.show();
10848		};
10849
10850		// Hide panel arrows
10851		plugin.hidePanelArrows = function(){
10852			if($leftPanelArrow) $leftPanelArrow.hide();
10853			if($rightPanelArrow) $rightPanelArrow.hide();
10854		};
10855
10856		/*
10857		 * Private methods
10858		 */
10859
10860		// Add the selected class to the plugin.selectedTab tab. Remove from all others.
10861		var selectIndicator = function(){
10862			if(settings.indicators && $indicators){
10863				var $indicator = $indicators.children("div:nth-child("+plugin.selectedTab+")");
10864				$indicator.siblings().removeClass('selected');
10865				$indicator.addClass('selected');
10866			}	
10867		};
10868
10869		// 	Slide tabs inside of $tabsListContainer so that the selected one fits inside
10870		var fitTabInContainer = function(tab){
10871			var tabOffset = tab.offset(),
10872				containerOffset = $tabsListContainer.offset(),
10873				leftOffset = tabOffset.left - containerOffset.left,
10874				rightOffset = (containerOffset.left + $tabsListContainer.outerWidth()) - (tabOffset.left + tab.outerWidth() );
10875			
10876			if(leftOffset < 0)
10877				plugin.slideTabs('right', -leftOffset);
10878			else if(rightOffset < 0)
10879				plugin.slideTabs('left', -rightOffset);
10880		};
10881
10882		// Reposition content panels so that they are ready to be transitioned in and out.
10883		// This depends on whether the transition is set to slide or fade
10884		var reorderPanels = function(){
10885			// Position content divs
10886			if(settings.transition == 'slide')
10887				// Move panels left/right basedon their index relative to the selected panel
10888				$tabsList.children('li').each(function(index, el){
10889					var selectedIndex = $tabsList.children('.selected').index(),
10890						thisIndex = $(el).index();
10891					var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1));
10892					if(selectedIndex < thisIndex)
10893						panel.css({left: $contentDivsContainer.width()+'px'});
10894					else if(selectedIndex > thisIndex)
10895						panel.css({left: '-'+$contentDivsContainer.width()+'px'});
10896					else
10897						panel.addClass(settings.classes.panelActive);
10898				});
10899			
10900			if(settings.transition == 'fade')
10901				// Set opacity to correct value for non selected panels.
10902				$tabsList.children('li').each(function(index, el){
10903					var selectedIndex = $tabsList.children('.selected').index(),
10904						thisIndex = $(el).index();
10905					var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1));
10906					if(selectedIndex != thisIndex)
10907						panel.css({opacity: 0});
10908					else
10909						panel.addClass(settings.classes.panelActive);
10910				});
10911		};
10912		
10913		// Object determining css properties to be animated to based on various actions, transitions, and directions
10914		var panelAnimationCSS = function(width){
10915			return {
10916					hide: {
10917						slideleft: {
10918							left: '-'+width+'px'
10919						},
10920						slideright: {
10921							left: width+'px'
10922						},
10923						fade: {
10924							opacity: 0
10925						}
10926					},
10927					show: {
10928						slide: {
10929							left: 0
10930						},
10931						fade: {
10932							opacity: 1
10933						}
10934					}
10935				}
10936		};
10937		
10938		// Transition out the passed in panel.
10939		// param: 	panel is the jQuery object of the panel to be hidden
10940		//			direction is either 'left' or 'right' for sliding transitions
10941		var hidePanel = function(panel, direction){
10942			// Calculate correct key in panelAnimationCSS
10943			if(settings.transition == 'slide')
10944				var trans = 'slide'+direction;
10945			else var trans = settings.transition;
10946
10947			// Animate the panel out
10948			panel.animate(panelAnimationCSS($contentDivsContainer.width())['hide'][trans], settings.transitionSpeed, settings.transitionEasing, function(){
10949				panel.hide();
10950				panel.removeClass('selected');
10951				//if(settings.classes.panelActive != '') panel.removeClass(settings.classes.panelActive);
10952				selectLock = false;
10953				reorderPanels();
10954			});
10955		};
10956
10957		// Transition in the parameter panel
10958		// param: 	panel is the jQuery object of the panel to be shown
10959		var showPanel = function(panel){
10960			// Show first
10961			panel.show();
10962			panel.addClass(settings.classes.panelActive).addClass('selected');
10963
10964			// Then animate css properties
10965			panel.animate(panelAnimationCSS($contentDivsContainer.width())['show'][settings.transition], settings.transitionSpeed, settings.transitionEasing, function(){
10966				selectLock = false;
10967				heightLock = true;
10968				reorderPanels();
10969			});
10970		};
10971
10972		// Animate the height of the content container to height target
10973		// params:  target (int) is the new height
10974		var resizeContentContainer = function(target){
10975			//console.log(target);
10976			//resizePanels();
10977			if(!settings.height)
10978				$contentDivsContainer.animate({
10979					height: actualHeight(target)
10980				}, 200);
10981		};
10982
10983		// Position the panel arrows
10984		var positionPanelArrows = function(){
10985			if(settings.panelArrows){
10986				// Initialize them if you need to
10987				if(!$leftPanelArrow && !$rightPanelArrow){
10988					$leftPanelArrow = $("<div class='ui-slider-tabs-leftPanelArrow'>").click(function(){
10989						plugin.prev();
10990					});
10991					$rightPanelArrow = $("<div class='ui-slider-tabs-rightPanelArrow'>").click(function(){
10992						plugin.next();
10993					});
10994
10995					$leftPanelArrow.appendTo($contentDivsContainer);
10996					$rightPanelArrow.appendTo($contentDivsContainer);
10997				}
10998
10999				// Set correct CSS 'top' attribute of each panel arrow
11000				$rightPanelArrow.css({
11001					"top": $contentDivsContainer.height()/2 - $rightPanelArrow.outerHeight()/2
11002				});
11003				$leftPanelArrow.css({
11004					"top": $contentDivsContainer.height()/2 - $leftPanelArrow.outerHeight()/2
11005				});
11006			}
11007		};
11008
11009		// Change the width of $tabsList to the sum of the outer widths of all tabs
11010		var resizeTabsList = function(){
11011			// Calculate total width
11012			var width = 0;
11013			$tabsList.children().each(function(index, element){				
11014				width += $(element).outerWidth(true);
11015			});
11016			// Set new width of $tabsList
11017			// Hack by emthemes
11018			if($.browser.msie && $.browser.version == 8){
11019				width = width-16;
11020				$tabsList.width(width + 16);
11021				if($tabsListContainer.width() < width && settings.tabArrows){
11022					plugin.showTabArrows();
11023					minMargin = $tabsListContainer.width() - width;
11024				}
11025				else plugin.hideTabArrows();
11026			}else{
11027				width = width + 10;
11028				$tabsList.width(width);
11029				if($tabsListContainer.width() < width && settings.tabArrows){
11030					plugin.showTabArrows();
11031					minMargin = $tabsListContainer.width() - width;
11032				}
11033				else plugin.hideTabArrows();
11034			}
11035			
11036			// Original version :$tabsList.width(width);
11037
11038			// Update minMargin. Hide tab arrows if no overflow
11039			//console.log(width);
11040			
11041
11042			$tabsList.animate({'margin-left': 0});
11043		}
11044
11045		// Resize indiviual panels to the width of the new container
11046		var resizePanels = function(){
11047			$contentDivs.width($contentDivsContainer.width() - ($contentDivs.outerWidth() - $contentDivs.width()));
11048		};
11049
11050		// Get height of a hidden element
11051		var actualHeight = function(element){
11052
11053			var prevCSS = {
11054				'display': element.css('display'),
11055				'left': element.css('left'),
11056				'position': element.css('position')
11057			};
11058			element.css({
11059				'display': 'normal',
11060				'left': -5000,
11061				'position': 'absolute'
11062			});
11063			var height = element.outerHeight();
11064			element.css(prevCSS);
11065
11066			return height;
11067		};
11068		
11069
11070		// Initialize the plugin
11071		plugin.init();
11072	};
11073
11074	/*
11075	 * Handle input. Call public functions and initializers
11076	 */
11077	$.fn.sliderTabs = function( data ) {
11078		return this.each(function(){
11079			var _this = $(this),
11080				plugin = _this.data('sliderTabs');
11081
11082			// Method calling logic
11083		    if (!plugin) {
11084		    	// If no plugin, initialize it
11085				plugin = new $.sliderTabs(this, data);
11086				_this.data('sliderTabs', plugin);
11087				return plugin;
11088			}
11089			if (plugin.methods[data]){
11090				// If plugin exists, call a public method
11091				return plugin.methods[ data ].apply( this, Array.prototype.slice.call( arguments, 1 ));
11092			}
11093		});
11094  	};
11095})( jQuery );
11096
11097
11098
11099
11100
11101/*
11102 * Additional easing functions
11103 * Taken from jQuery UI source code
11104 * 
11105 * https://github.com/jquery/jquery-ui
11106 */
11107
11108jQuery.extend($.easing,
11109{
11110    def: 'easeOutQuad',
11111    swing: function (x, t, b, c, d) {
11112        //alert($.easing.default);
11113        return $.easing[$.easing.def](x, t, b, c, d);
11114    },
11115    easeInQuad: function (x, t, b, c, d) {
11116        return c*(t/=d)*t + b;
11117    },
11118    easeOutQuad: function (x, t, b, c, d) {
11119        return -c *(t/=d)*(t-2) + b;
11120    },
11121    easeInOutQuad: function (x, t, b, c, d) {
11122        if ((t/=d/2) < 1) return c/2*t*t + b;
11123        return -c/2 * ((--t)*(t-2) - 1) + b;
11124    },
11125    easeInCubic: function (x, t, b, c, d) {
11126        return c*(t/=d)*t*t + b;
11127    },
11128    easeOutCubic: function (x, t, b, c, d) {
11129        return c*((t=t/d-1)*t*t + 1) + b;
11130    },
11131    easeInOutCubic: function (x, t, b, c, d) {
11132        if ((t/=d/2) < 1) return c/2*t*t*t + b;
11133        return c/2*((t-=2)*t*t + 2) + b;
11134    },
11135    easeInQuart: function (x, t, b, c, d) {
11136        return c*(t/=d)*t*t*t + b;
11137    },
11138    easeOutQuart: function (x, t, b, c, d) {
11139        return -c * ((t=t/d-1)*t*t*t - 1) + b;
11140    },
11141    easeInOutQuart: function (x, t, b, c, d) {
11142        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
11143        return -c/2 * ((t-=2)*t*t*t - 2) + b;
11144    },
11145    easeInQuint: function (x, t, b, c, d) {
11146        return c*(t/=d)*t*t*t*t + b;
11147    },
11148    easeOutQuint: function (x, t, b, c, d) {
11149        return c*((t=t/d-1)*t*t*t*t + 1) + b;
11150    },
11151    easeInOutQuint: function (x, t, b, c, d) {
11152        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
11153        return c/2*((t-=2)*t*t*t*t + 2) + b;
11154    },
11155    easeInSine: function (x, t, b, c, d) {
11156        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
11157    },
11158    easeOutSine: function (x, t, b, c, d) {
11159        return c * Math.sin(t/d * (Math.PI/2)) + b;
11160    },
11161    easeInOutSine: function (x, t, b, c, d) {
11162        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
11163    },
11164    easeInExpo: function (x, t, b, c, d) {
11165        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
11166    },
11167    easeOutExpo: function (x, t, b, c, d) {
11168        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
11169    },
11170    easeInOutExpo: function (x, t, b, c, d) {
11171        if (t==0) return b;
11172        if (t==d) return b+c;
11173        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
11174        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
11175    },
11176    easeInCirc: function (x, t, b, c, d) {
11177        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
11178    },
11179    easeOutCirc: function (x, t, b, c, d) {
11180        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
11181    },
11182    easeInOutCirc: function (x, t, b, c, d) {
11183        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
11184        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
11185    },
11186    easeInElastic: function (x, t, b, c, d) {
11187        var s=1.70158;var p=0;var a=c;
11188        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
11189        if (a < Math.abs(c)) { a=c; var s=p/4; }
11190        else var s = p/(2*Math.PI) * Math.asin (c/a);
11191        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
11192    },
11193    easeOutElastic: function (x, t, b, c, d) {
11194        var s=1.70158;var p=0;var a=c;
11195        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
11196        if (a < Math.abs(c)) { a=c; var s=p/4; }
11197        else var s = p/(2*Math.PI) * Math.asin (c/a);
11198        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
11199    },
11200    easeInOutElastic: function (x, t, b, c, d) {
11201        var s=1.70158;var p=0;var a=c;
11202        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
11203        if (a < Math.abs(c)) { a=c; var s=p/4; }
11204        else var s = p/(2*Math.PI) * Math.asin (c/a);
11205        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
11206        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
11207    },
11208    easeInBack: function (x, t, b, c, d, s) {
11209        if (s == undefined) s = 1.70158;
11210        return c*(t/=d)*t*((s+1)*t - s) + b;
11211    },
11212    easeOutBack: function (x, t, b, c, d, s) {
11213        if (s == undefined) s = 1.70158;
11214        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
11215    },
11216    easeInOutBack: function (x, t, b, c, d, s) {
11217        if (s == undefined) s = 1.70158;
11218        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
11219        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
11220    },
11221    easeInBounce: function (x, t, b, c, d) {
11222        return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
11223    },
11224    easeOutBounce: function (x, t, b, c, d) {
11225        if ((t/=d) < (1/2.75)) {
11226            return c*(7.5625*t*t) + b;
11227        } else if (t < (2/2.75)) {
11228            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
11229        } else if (t < (2.5/2.75)) {
11230            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
11231        } else {
11232            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
11233        }
11234    },
11235    easeInOutBounce: function (x, t, b, c, d) {
11236        if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
11237        return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
11238    }
11239});
11240
11241
11242
11243
11244
11245/*
11246 * The following is the jQuery Mousewheel plugin. Full credit goes to 
11247 * Brandon Aaron. (https://github.com/brandonaaron/jquery-mousewheel)
11248 * /
11249
11250
11251/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
11252 * Licensed under the MIT License (LICENSE.txt).
11253 *
11254 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
11255 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
11256 * Thanks to: Seamus Leahy for adding deltaX and deltaY
11257 *
11258 * Version: 3.0.6
11259 * 
11260 * Requires: 1.2.2+
11261 */
11262
11263(function($) {
11264
11265var types = ['DOMMouseScroll', 'mousewheel'];
11266
11267if ($.event.fixHooks) {
11268    for ( var i=types.length; i; ) {
11269        $.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
11270    }
11271}
11272
11273$.event.special.mousewheel = {
11274    setup: function() {
11275        if ( this.addEventListener ) {
11276            for ( var i=types.length; i; ) {
11277                this.addEventListener( types[--i], handler, false );
11278            }
11279        } else {
11280            this.onmousewheel = handler;
11281        }
11282    },
11283    
11284    teardown: function() {
11285        if ( this.removeEventListener ) {
11286            for ( var i=types.length; i; ) {
11287                this.removeEventListener( types[--i], handler, false );
11288            }
11289        } else {
11290            this.onmousewheel = null;
11291        }
11292    }
11293};
11294
11295$.fn.extend({
11296    mousewheel: function(fn) {
11297        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
11298    },
11299    
11300    unmousewheel: function(fn) {
11301        return this.unbind("mousewheel", fn);
11302    }
11303});
11304
11305
11306function handler(event) {
11307    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
11308    event = $.event.fix(orgEvent);
11309    event.type = "mousewheel";
11310    
11311    // Old school scrollwheel delta
11312    if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
11313    if ( orgEvent.detail     ) { delta = -orgEvent.detail/3; }
11314    
11315    // New school multidimensional scroll (touchpads) deltas
11316    deltaY = delta;
11317    
11318    // Gecko
11319    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
11320        deltaY = 0;
11321        deltaX = -1*delta;
11322    }
11323    
11324    // Webkit
11325    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
11326    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
11327    
11328    // Add event and delta to the front of the arguments
11329    args.unshift(event, delta, deltaX, deltaY);
11330    
11331    return ($.event.dispatch || $.event.handle).apply(this, args);
11332}
11333
11334})(jQuery);
11335
11336
11337
11338/*
11339 * The following is the jQuery Resize plugin. Full credit goes to 
11340 * "Cowboy" Ben Alman. (https://github.com/cowboy/jquery-resize)
11341 * /
11342
11343/*
11344 * jQuery resize event - v1.1 - 3/14/2010
11345 * http://benalman.com/projects/jquery-resize-plugin/
11346 * 
11347 * Copyright (c) 2010 "Cowboy" Ben Alman
11348 * Dual licensed under the MIT and GPL licenses.
11349 * http://benalman.com/about/license/
11350 */
11351(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}
11351var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);

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.