PageSourceSearch

https://www.dedoshop.com/media/js/0eb8dca1510d9e957cad9adc7f6f18bb.js

js dedoshop.com collected 2026-10-10 02:21:31 UTC 775,646 bytes, 12,415 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// Credit Card Validation Javascript
14// copyright 12th May 2003, by Stephen Chapman, Felgall Pty Ltd
15
16// You have permission to copy and use this javascript provided that
17// the content of the script is not changed in any way.
18
19function validateCreditCard(s) {
20    // remove non-numerics
21    var v = "0123456789";
22    var w = "";
23    for (i=0; i < s.length; i++) {
24        x = s.charAt(i);
25        if (v.indexOf(x,0) != -1)
26        w += x;
27    }
28    // validate number
29    j = w.length / 2;
30    k = Math.floor(j);
31    m = Math.ceil(j) - k;
32    c = 0;
33    for (i=0; i<k; i++) {
34        a = w.charAt(i*2+m) * 2;
35        c += a > 9 ? Math.floor(a/10 + a%10) : a;
36    }
37    for (i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1;
38    return (c%10 == 0);
39}
40
41
42/*
43* Really easy field validation with Prototype
44* http://tetlaw.id.au/view/javascript/really-easy-field-validation
45* Andrew Tetlaw
46* Version 1.5.4.1 (2007-01-05)
47*
48* Copyright (c) 2007 Andrew Tetlaw
49* Permission is hereby granted, free of charge, to any person
50* obtaining a copy of this software and associated documentation
51* files (the "Software"), to deal in the Software without
52* restriction, including without limitation the rights to use, copy,
53* modify, merge, publish, distribute, sublicense, and/or sell copies
54* of the Software, and to permit persons to whom the Software is
55* furnished to do so, subject to the following conditions:
56*
57* The above copyright notice and this permission notice shall be
58* included in all copies or substantial portions of the Software.
59*
60* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
61* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
62* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
63* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
64* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
65* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
66* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
67* SOFTWARE.
68*
69*/
70var Validator = Class.create();
71
72Validator.prototype = {
73    initialize : function(className, error, test, options) {
74        if(typeof test == 'function'){
75            this.options = $H(options);
76            this._test = test;
77        } else {
78            this.options = $H(test);
79            this._test = function(){return true};
80        }
81        this.error = error || 'Validation failed.';
82        this.className = className;
83    },
84    test : function(v, elm) {
85        return (this._test(v,elm) && this.options.all(function(p){
86            return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true;
87        }));
88    }
89}
90Validator.methods = {
91    pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)},
92    minLength : function(v,elm,opt) {return v.length >= opt},
93    maxLength : function(v,elm,opt) {return v.length <= opt},
94    min : function(v,elm,opt) {return v >= parseFloat(opt)},
95    max : function(v,elm,opt) {return v <= parseFloat(opt)},
96    notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) {
97        return v != value;
98    })},
99    oneOf : function(v,elm,opt) {return $A(opt).any(function(value) {
100        return v == value;
101    })},
102    is : function(v,elm,opt) {return v == opt},
103    isNot : function(v,elm,opt) {return v != opt},
104    equalToField : function(v,elm,opt) {return v == $F(opt)},
105    notEqualToField : function(v,elm,opt) {return v != $F(opt)},
106    include : function(v,elm,opt) {return $A(opt).all(function(value) {
107        return Validation.get(value).test(v,elm);
108    })}
109}
110
111var Validation = Class.create();
112Validation.defaultOptions = {
113    onSubmit : true,
114    stopOnFirst : false,
115    immediate : false,
116    focusOnError : true,
117    useTitles : false,
118    addClassNameToContainer: false,
119    containerClassName: '.input-box',
120    onFormValidate : function(result, form) {},
121    onElementValidate : function(result, elm) {}
122};
123
124Validation.prototype = {
125    initialize : function(form, options){
126        this.form = $(form);
127        if (!this.form) {
128            return;
129        }
130        this.options = Object.extend({
131            onSubmit : Validation.defaultOptions.onSubmit,
132            stopOnFirst : Validation.defaultOptions.stopOnFirst,
133            immediate : Validation.defaultOptions.immediate,
134            focusOnError : Validation.defaultOptions.focusOnError,
135            useTitles : Validation.defaultOptions.useTitles,
136            onFormValidate : Validation.defaultOptions.onFormValidate,
137            onElementValidate : Validation.defaultOptions.onElementValidate
138        }, options || {});
139        if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false);
140        if(this.options.immediate) {
141            Form.getElements(this.form).each(function(input) { // Thanks Mike!
142                if (input.tagName.toLowerCase() == 'select') {
143                    Event.observe(input, 'blur', this.onChange.bindAsEventListener(this));
144                }
145                if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox') {
146                    Event.observe(input, 'click', this.onChange.bindAsEventListener(this));
147                } else {
148                    Event.observe(input, 'change', this.onChange.bindAsEventListener(this));
149                }
150            }, this);
151        }
152    },
153    onChange : function (ev) {
154        Validation.isOnChange = true;
155        Validation.validate(Event.element(ev),{
156                useTitle : this.options.useTitles,
157                onElementValidate : this.options.onElementValidate
158        });
159        Validation.isOnChange = false;
160    },
161    onSubmit :  function(ev){
162        if(!this.validate()) Event.stop(ev);
163    },
164    validate : function() {
165        var result = false;
166        var useTitles = this.options.useTitles;
167        var callback = this.options.onElementValidate;
168        try {
169            if(this.options.stopOnFirst) {
170                result = Form.getElements(this.form).all(function(elm) {
171                    if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
172                        return true;
173                    }
174                    return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
175                }, this);
176            } else {
177                result = Form.getElements(this.form).collect(function(elm) {
178                    if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) {
179                        return true;
180                    }
181                    return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
182                }, this).all();
183            }
184        } catch (e) {
185        }
186        if(!result && this.options.focusOnError) {
187            try{
188                Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()
189            }
190            catch(e){
191            }
192        }
193        this.options.onFormValidate(result, this.form);
194        return result;
195    },
196    reset : function() {
197        Form.getElements(this.form).each(Validation.reset);
198    },
199    isElementInForm : function(elm, form) {
200        var domForm = elm.up('form');
201        if (domForm == form) {
202            return true;
203        }
204        return false;
205    }
206}
207
208Object.extend(Validation, {
209    validate : function(elm, options){
210        options = Object.extend({
211            useTitle : false,
212            onElementValidate : function(result, elm) {}
213        }, options || {});
214        elm = $(elm);
215
216        var cn = $w(elm.className);
217        return result = cn.all(function(value) {
218            var test = Validation.test(value,elm,options.useTitle);
219            options.onElementValidate(test, elm);
220            return test;
221        });
222    },
223    insertAdvice : function(elm, advice){
224        var container = $(elm).up('.field-row');
225        if(container){
226            Element.insert(container, {after: advice});
227        } else if (elm.up('td.value')) {
228            elm.up('td.value').insert({bottom: advice});
229        } else if (elm.advaiceContainer && $(elm.advaiceContainer)) {
230            $(elm.advaiceContainer).update(advice);
231        }
232        else {
233            switch (elm.type.toLowerCase()) {
234                case 'checkbox':
235                case 'radio':
236                    var p = elm.parentNode;
237                    if(p) {
238                        Element.insert(p, {'bottom': advice});
239                    } else {
240                        Element.insert(elm, {'after': advice});
241                    }
242                    break;
243                default:
244                    Element.insert(elm, {'after': advice});
245            }
246        }
247    },
248    showAdvice : function(elm, advice, adviceName){
249        if(!elm.advices){
250            elm.advices = new Hash();
251        }
252        else{
253            elm.advices.each(function(pair){
254                if (!advice || pair.value.id != advice.id) {
255                    // hide non-current advice after delay
256                    this.hideAdvice(elm, pair.value);
257                }
258            }.bind(this));
259        }
260        elm.advices.set(adviceName, advice);
261        if(typeof Effect == 'undefined') {
262            advice.style.display = 'block';
263        } else {
264            if(!advice._adviceAbsolutize) {
265                new Effect.Appear(advice, {duration : 1 });
266            } else {
267                Position.absolutize(advice);
268                advice.show();
269                advice.setStyle({
270                    'top':advice._adviceTop,
271                    'left': advice._adviceLeft,
272                    'width': advice._adviceWidth,
273                    'z-index': 1000
274                });
275                advice.addClassName('advice-absolute');
276            }
277        }
278    },
279    hideAdvice : function(elm, advice){
280        if (advice != null) {
281            new Effect.Fade(advice, {duration : 1, afterFinishInternal : function() {advice.hide();}});
282        }
283    },
284    updateCallback : function(elm, status) {
285        if (typeof elm.callbackFunction != 'undefined') {
286            eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')');
287        }
288    },
289    ajaxError : function(elm, errorMsg) {
290        var name = 'validate-ajax';
291        var advice = Validation.getAdvice(name, elm);
292        if (advice == null) {
293            advice = this.createAdvice(name, elm, false, errorMsg);
294        }
295        this.showAdvice(elm, advice, 'validate-ajax');
296        this.updateCallback(elm, 'failed');
297
298        elm.addClassName('validation-failed');
299        elm.addClassName('validate-ajax');
300        if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
301            var container = elm.up(Validation.defaultOptions.containerClassName);
302            if (container && this.allowContainerClassName(elm)) {
303                container.removeClassName('validation-passed');
304                container.addClassName('validation-error');
305            }
306        }
307    },
308    allowContainerClassName: function (elm) {
309        if (elm.type == 'radio' || elm.type == 'checkbox') {
310            return elm.hasClassName('change-container-classname');
311        }
312
313        return true;
314    },
315    test : function(name, elm, useTitle) {
316        var v = Validation.get(name);
317        var prop = '__advice'+name.camelize();
318        try {
319        if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
320            //if(!elm[prop]) {
321                var advice = Validation.getAdvice(name, elm);
322                if (advice == null) {
323                    advice = this.createAdvice(name, elm, useTitle);
324                }
325                this.showAdvice(elm, advice, name);
326                this.updateCallback(elm, 'failed');
327            //}
328            elm[prop] = 1;
329            if (!elm.advaiceContainer) {
330                elm.removeClassName('validation-passed');
331                elm.addClassName('validation-failed');
332            }
333
334           if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
335                var container = elm.up(Validation.defaultOptions.containerClassName);
336                if (container && this.allowContainerClassName(elm)) {
337                    container.removeClassName('validation-passed');
338                    container.addClassName('validation-error');
339                }
340            }
341            return false;
342        } else {
343            var advice = Validation.getAdvice(name, elm);
344            this.hideAdvice(elm, advice);
345            this.updateCallback(elm, 'passed');
346            elm[prop] = '';
347            elm.removeClassName('validation-failed');
348            elm.addClassName('validation-passed');
349            if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
350                var container = elm.up(Validation.defaultOptions.containerClassName);
351                if (container && !container.down('.validation-failed') && this.allowContainerClassName(elm)) {
352                    if (!Validation.get('IsEmpty').test(elm.value) || !this.isVisible(elm)) {
353                        container.addClassName('validation-passed');
354                    } else {
355                        container.removeClassName('validation-passed');
356                    }
357                    container.removeClassName('validation-error');
358                }
359            }
360            return true;
361        }
362        } catch(e) {
363            throw(e)
364        }
365    },
366    isVisible : function(elm) {
367        while(elm.tagName != 'BODY') {
368            if(!$(elm).visible()) return false;
369            elm = elm.parentNode;
370        }
371        return true;
372    },
373    getAdvice : function(name, elm) {
374        return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm));
375    },
376    createAdvice : function(name, elm, useTitle, customError) {
377        var v = Validation.get(name);
378        var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
379        if (customError) {
380            errorMsg = customError;
381        }
382        try {
383            if (Translator){
384                errorMsg = Translator.translate(errorMsg);
385            }
386        }
387        catch(e){}
388
389        advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>'
390
391
392        Validation.insertAdvice(elm, advice);
393        advice = Validation.getAdvice(name, elm);
394        if($(elm).hasClassName('absolute-advice')) {
395            var dimensions = $(elm).getDimensions();
396            var originalPosition = Position.cumulativeOffset(elm);
397
398            advice._adviceTop = (originalPosition[1] + dimensions.height) + 'px';
399            advice._adviceLeft = (originalPosition[0])  + 'px';
400            advice._adviceWidth = (dimensions.width)  + 'px';
401            advice._adviceAbsolutize = true;
402        }
403        return advice;
404    },
405    getElmID : function(elm) {
406        return elm.id ? elm.id : elm.name;
407    },
408    reset : function(elm) {
409        elm = $(elm);
410        var cn = $w(elm.className);
411        cn.each(function(value) {
412            var prop = '__advice'+value.camelize();
413            if(elm[prop]) {
414                var advice = Validation.getAdvice(value, elm);
415                if (advice) {
416                    advice.hide();
417                }
418                elm[prop] = '';
419            }
420            elm.removeClassName('validation-failed');
421            elm.removeClassName('validation-passed');
422            if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') {
423                var container = elm.up(Validation.defaultOptions.containerClassName);
424                if (container) {
425                    container.removeClassName('validation-passed');
426                    container.removeClassName('validation-error');
427                }
428            }
429        });
430    },
431    add : function(className, error, test, options) {
432        var nv = {};
433        nv[className] = new Validator(className, error, test, options);
434        Object.extend(Validation.methods, nv);
435    },
436    addAllThese : function(validators) {
437        var nv = {};
438        $A(validators).each(function(value) {
439                nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {}));
440            });
441        Object.extend(Validation.methods, nv);
442    },
443    get : function(name) {
444        return  Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_'];
445    },
446    methods : {
447        '_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{})
448    }
449});
450
451Validation.add('IsEmpty', '', function(v) {
452    return  (v == '' || (v == null) || (v.length == 0) || /^\s+$/.test(v));
453});
454
455Validation.addAllThese([
456    ['validate-no-html-tags', 'HTML tags are not allowed', function(v) {
457				return !/<(\/)?\w+/.test(v);
458			}],
459	['validate-select', 'Please select an option.', function(v) {
460                return ((v != "none") && (v != null) && (v.length != 0));
461            }],
462    ['required-entry', 'This is a required field.', function(v) {
463                return !Validation.get('IsEmpty').test(v);
464            }],
465    ['validate-number', 'Please enter a valid number in this field.', function(v) {
466                return Validation.get('IsEmpty').test(v)
467                    || (!isNaN(parseNumber(v)) && /^\s*-?\d*(\.\d*)?\s*$/.test(v));
468            }],
469    ['validate-number-range', 'The value is not within the specified range.', function(v, elm) {
470                if (Validation.get('IsEmpty').test(v)) {
471                    return true;
472                }
473
474                var numValue = parseNumber(v);
475                if (isNaN(numValue)) {
476                    return false;
477                }
478
479                var reRange = /^number-range-(-?[\d.,]+)?-(-?[\d.,]+)?$/,
480                    result = true;
481
482                $w(elm.className).each(function(name) {
483                    var m = reRange.exec(name);
484                    if (m) {
485                        result = result
486                            && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1]))
487                            && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2]));
488                    }
489                });
490
491                return result;
492            }],
493    ['validate-digits', 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.', function(v) {
494                return Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
495            }],
496    ['validate-digits-range', 'The value is not within the specified range.', function(v, elm) {
497                if (Validation.get('IsEmpty').test(v)) {
498                    return true;
499                }
500
501                var numValue = parseNumber(v);
502                if (isNaN(numValue)) {
503                    return false;
504                }
505
506                var reRange = /^digits-range-(-?\d+)?-(-?\d+)?$/,
507                    result = true;
508
509                $w(elm.className).each(function(name) {
510                    var m = reRange.exec(name);
511                    if (m) {
512                        result = result
513                            && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1]))
514                            && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2]));
515                    }
516                });
517
518                return result;
519            }],
520    ['validate-alpha', 'Please use letters only (a-z or A-Z) in this field.', function (v) {
521                return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z]+$/.test(v)
522            }],
523    ['validate-code', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
524                return Validation.get('IsEmpty').test(v) ||  /^[a-z]+[a-z0-9_]+$/.test(v)
525            }],
526    ['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) {
527                return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9]+$/.test(v)
528            }],
529    ['validate-alphanum-with-spaces', 'Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.', function(v) {
530                    return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9 ]+$/.test(v)
531            }],
532    ['validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.', function(v) {
533                return Validation.get('IsEmpty').test(v) ||  /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v)
534            }],
535    ['validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
536                return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
537            }],
538    ['validate-phoneLax', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
539                return Validation.get('IsEmpty').test(v) || /^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v);
540            }],
541    ['validate-fax', 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.', function(v) {
542                return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
543            }],
544    ['validate-date', 'Please enter a valid date.', function(v) {
545                var test = new Date(v);
546                return Validation.get('IsEmpty').test(v) || !isNaN(test);
547            }],
548    ['validate-date-range', 'The From Date value should be less than or equal to the To Date value.', function(v, elm) {
549            var m = /\bdate-range-(\w+)-(\w+)\b/.exec(elm.className);
550            if (!m || m[2] == 'to' || Validation.get('IsEmpty').test(v)) {
551                return true;
552            }
553
554            var currentYear = new Date().getFullYear() + '';
555            var normalizedTime = function(v) {
556                v = v.split(/[.\/]/);
557                if (v[2] && v[2].length < 4) {
558                    v[2] = currentYear.substr(0, v[2].length) + v[2];
559                }
560                return new Date(v.join('/')).getTime();
561            };
562
563            var dependentElements = Element.select(elm.form, '.validate-date-range.date-range-' + m[1] + '-to');
564            return !dependentElements.length || Validation.get('IsEmpty').test(dependentElements[0].value)
565                || normalizedTime(v) <= normalizedTime(dependentElements[0].value);
566        }],
567    ['validate-email', 'Please enter a valid email address. For example [email protected].', function (v) {
568                //return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
569                //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)
570                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)
571            }],
572    ['validate-emailSender', 'Please use only visible characters and spaces.', function (v) {
573                return Validation.get('IsEmpty').test(v) ||  /^[\S ]+$/.test(v)
574                    }],
575    ['validate-password', 'Please enter 6 or more characters. Leading or trailing space
575s will be ignored.', function(v) {
576                var pass=v.strip(); /*strip leading and trailing spaces*/
577                return !(pass.length>0 && pass.length < 6);
578            }],
579    ['validate-admin-password', 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.', function(v) {
580                var pass=v.strip();
581                if (0 == pass.length) {
582                    return true;
583                }
584                if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v))) {
585                    return false;
586                }
587                return !(pass.length < 7);
588            }],
589    ['validate-cpassword', 'Please make sure your passwords match.', function(v) {
590                var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];
591                var pass = false;
592                if ($('password')) {
593                    pass = $('password');
594                }
595                var passwordElements = $$('.validate-password');
596                for (var i = 0; i < passwordElements.size(); i++) {
597                    var passwordElement = passwordElements[i];
598                    if (passwordElement.up('form').id == conf.up('form').id) {
599                        pass = passwordElement;
600                    }
601                }
602                if ($$('.validate-admin-password').size()) {
603                    pass = $$('.validate-admin-password')[0];
604                }
605                return (pass.value == conf.value);
606            }],
607    ['validate-both-passwords', 'Please make sure your passwords match.', function(v, input) {
608                var dependentInput = $(input.form[input.name == 'password' ? 'confirmation' : 'password']),
609                    isEqualValues  = input.value == dependentInput.value;
610
611                if (isEqualValues && dependentInput.hasClassName('validation-failed')) {
612                    Validation.test(this.className, dependentInput);
613                }
614
615                return dependentInput.value == '' || isEqualValues;
616            }],
617    ['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) {
618                v = (v || '').replace(/^\s+/, '').replace(/\s+$/, '');
619                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)
620            }],
621    ['validate-clean-url', 'Please enter a valid URL. For example http://www.example.com or www.example.com', function (v) {
622                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)
623            }],
624    ['validate-identifier', 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".', function (v) {
625                return Validation.get('IsEmpty').test(v) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(v)
626            }],
627    ['validate-xml-identifier', 'Please enter a valid XML-identifier. For example something_1, block5, id-4.', function (v) {
628                return Validation.get('IsEmpty').test(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v)
629            }],
630    ['validate-ssn', 'Please enter a valid social security number. For example 123-45-6789.', function(v) {
631            return Validation.get('IsEmpty').test(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v);
632            }],
633    ['validate-zip', 'Please enter a valid zip code. For example 90602 or 90602-1234.', function(v) {
634            return Validation.get('IsEmpty').test(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v);
635            }],
636    ['validate-zip-international', 'Please enter a valid zip code.', function(v) {
637            //return Validation.get('IsEmpty').test(v) || /(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(v);
638            return true;
639            }],
640    ['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
641                if(Validation.get('IsEmpty').test(v)) return true;
642                var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
643                if(!regex.test(v)) return false;
644                var d = new Date(v.replace(regex, '$2/$1/$3'));
645                return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) &&
646                            (parseInt(RegExp.$1, 10) == d.getDate()) &&
647                            (parseInt(RegExp.$3, 10) == d.getFullYear() );
648            }],
649    ['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00.', function(v) {
650                // [$]1[##][,###]+[.##]
651                // [$]1###+[.##]
652                // [$]0.##
653                // [$].##
654                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)
655            }],
656    ['validate-one-required', 'Please select one of the above options.', function (v,elm) {
657                var p = elm.parentNode;
658                var options = p.getElementsByTagName('INPUT');
659                return $A(options).any(function(elm) {
660                    return $F(elm);
661                });
662            }],
663    ['validate-one-required-by-name', 'Please select one of the options.', function (v,elm) {
664                var inputs = $$('input[name="' + elm.name.replace(/([\\"])/g, '\\$1') + '"]');
665
666                var error = 1;
667                for(var i=0;i<inputs.length;i++) {
668                    if((inputs[i].type == 'checkbox' || inputs[i].type == 'radio') && inputs[i].checked == true) {
669                        error = 0;
670                    }
671
672                    if(Validation.isOnChange && (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')) {
673                        Validation.reset(inputs[i]);
674                    }
675                }
676
677                if( error == 0 ) {
678                    return true;
679                } else {
680                    return false;
681                }
682            }],
683    ['validate-not-negative-number', 'Please enter a number 0 or greater in this field.', function(v) {
684                if (Validation.get('IsEmpty').test(v)) {
685                    return true;
686                }
687                v = parseNumber(v);
688                return !isNaN(v) && v >= 0;
689            }],
690    ['validate-zero-or-greater', 'Please enter a number 0 or greater in this field.', function(v) {
691            return Validation.get('validate-not-negative-number').test(v);
692        }],
693    ['validate-greater-than-zero', 'Please enter a number greater than 0 in this field.', function(v) {
694            if (Validation.get('IsEmpty').test(v)) {
695                return true;
696            }
697            v = parseNumber(v);
698            return !isNaN(v) && v > 0;
699        }],
700    ['validate-state', 'Please select State/Province.', function(v) {
701                return (v!=0 || v == '');
702            }],
703    ['validate-new-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) {
704                if (!Validation.get('validate-password').test(v)) return false;
705                if (Validation.get('IsEmpty').test(v) && v != '') return false;
706                return true;
707            }],
708    ['validate-cc-number', 'Please enter a valid credit card number.', function(v, elm) {
709                // remove non-numerics
710                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
711                if (ccTypeContainer && typeof Validation.creditCartTypes.get(ccTypeContainer.value) != 'undefined'
712                        && Validation.creditCartTypes.get(ccTypeContainer.value)[2] == false) {
713                    if (!Validation.get('IsEmpty').test(v) && Validation.get('validate-digits').test(v)) {
714                        return true;
715                    } else {
716                        return false;
717                    }
718                }
719                return validateCreditCard(v);
720            }],
721    ['validate-cc-type', 'Credit card number does not match credit card type.', function(v, elm) {
722                // remove credit card number delimiters such as "-" and space
723                elm.value = removeDelimiters(elm.value);
724                v         = removeDelimiters(v);
725
726                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
727                if (!ccTypeContainer) {
728                    return true;
729                }
730                var ccType = ccTypeContainer.value;
731
732                if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
733                    return false;
734                }
735
736                // Other card type or switch or solo card
737                if (Validation.creditCartTypes.get(ccType)[0]==false) {
738                    return true;
739                }
740
741                var validationFailure = false;
742                Validation.creditCartTypes.each(function (pair) {
743                    if (pair.key == ccType) {
744                        if (pair.value[0] && !v.match(pair.value[0])) {
745                            validationFailure = true;
746                        }
747                        throw $break;
748                    }
749                });
750
751                if (validationFailure) {
752                    return false;
753                }
754
755                if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) {
756                    Validation.validate(ccTypeContainer);
757                }
758
759                return true;
760            }],
761     ['validate-cc-type-select', 'Card type does not match credit card number.', function(v, elm) {
762                var ccNumberContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_type')) + '_cc_number');
763                if (Validation.isOnChange && Validation.get('IsEmpty').test(ccNumberContainer.value)) {
764                    return true;
765                }
766                if (Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer)) {
767                    Validation.validate(ccNumberContainer);
768                }
769                return Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer);
770            }],
771     ['validate-cc-exp', 'Incorrect credit card expiration date.', function(v, elm) {
772                var ccExpMonth   = v;
773                var ccExpYear    = $(elm.id.substr(0,elm.id.indexOf('_expiration')) + '_expiration_yr').value;
774                var currentTime  = new Date();
775                var currentMonth = currentTime.getMonth() + 1;
776                var currentYear  = currentTime.getFullYear();
777                if (ccExpMonth < currentMonth && ccExpYear == currentYear) {
778                    return false;
779                }
780                return true;
781            }],
782     ['validate-cc-cvn', 'Please enter a valid credit card verification number.', function(v, elm) {
783                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_cid')) + '_cc_type');
784                if (!ccTypeContainer) {
785                    return true;
786                }
787                var ccType = ccTypeContainer.value;
788
789                if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
790                    return false;
791                }
792
793                var re = Validation.creditCartTypes.get(ccType)[1];
794
795                if (v.match(re)) {
796                    return true;
797                }
798
799                return false;
800            }],
801     ['validate-ajax', '', function(v, elm) { return true; }],
802     ['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) {
803                if(v != '' && v) {
804                    return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v);
805                }
806                return true;
807            }],
808     ['validate-css-length', 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.', function (v) {
809                if (v != '' && v) {
810                    return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v) && (!(/\..*\./.test(v))) && !(/\.$/.test(v));
811                }
812                return true;
813            }],
814     ['validate-length', 'Text length does not satisfy specified text range.', function (v, elm) {
815                var reMax = new RegExp(/^maximum-length-[0-9]+$/);
816                var reMin = new RegExp(/^minimum-length-[0-9]+$/);
817                var result = true;
818                $w(elm.className).each(function(name, index) {
819                    if (name.match(reMax) && result) {
820                       var length = name.split('-')[2];
821                       result = (v.length <= length);
822                    }
823                    if (name.match(reMin) && result && !Validation.get('IsEmpty').test(v)) {
824                        var length = name.split('-')[2];
825                        result = (v.length >= length);
826                    }
827                });
828                return result;
829            }],
830     ['validate-percents', 'Please enter a number lower than 100.', {max:100}],
831     ['required-file', 'Please select a file', function(v, elm) {
832         var result = !Validation.get('IsEmpty').test(v);
833         if (result === false) {
834             ovId = elm.id + '_value';
835             if ($(ovId)) {
836                 result = !Validation.get('IsEmpty').test($(ovId).value);
837             }
838         }
839         return result;
840     }],
841     ['validate-cc-ukss', 'Please enter issue number or start date for switch/solo card type.', function(v,elm) {
842         var endposition;
843
844         if (elm.id.match(/(.)+_cc_issue$/)) {
845             endposition = elm.id.indexOf('_cc_issue');
846         } else if (elm.id.match(/(.)+_start_month$/)) {
847             endposition = elm.id.indexOf('_start_month');
848         } else {
849             endposition = elm.id.indexOf('_start_year');
850         }
851
852         var prefix = elm.id.substr(0,endposition);
853
854         var ccTypeContainer = $(prefix + '_cc_type');
855
856         if (!ccTypeContainer) {
857               return true;
858         }
859         var ccType = ccTypeContainer.value;
860
861         if(['SS','SM','SO'].indexOf(ccType) == -1){
862             return true;
863         }
864
865         $(prefix + '_cc_issue').advaiceContainer
866           = $(prefix + '_start_month').advaiceContainer
867           = $(prefix + '_start_year').advaiceContainer
868           = $(prefix + '_cc_type_ss_div').down('ul li.adv-container');
869
870         var ccIssue   =  $(prefix + '_cc_issue').value;
871         var ccSMonth  =  $(prefix + '_start_month').value;
872         var ccSYear   =  $(prefix + '_start_year').value;
873
874         var ccStartDatePresent = (ccSMonth && ccSYear) ? true : false;
875
876         if (!ccStartDatePresent && !ccIssue){
877             return false;
878         }
879         return true;
880     }]
881]);
882
883function removeDelimiters (v) {
884    v = v.replace(/\s/g, '');
885    v = v.replace(/\-/g, '');
886    return v;
887}
888
889function parseNumber(v)
890{
891    if (typeof v != 'string') {
892        return parseFloat(v);
893    }
894
895    var isDot  = v.indexOf('.');
896    var isComa = v.indexOf(',');
897
898    if (isDot != -1 && isComa != -1) {
899        if (isComa > isDot) {
900            v = v.replace('.', '').replace(',', '.');
901        }
902        else {
903            v = v.replace(',', '');
904        }
905    }
906    else if (isComa != -1) {
907        v = v.replace(',', '.');
908    }
909
910    return parseFloat(v);
911}
912
913/**
914 * Hash with credit card types which can be simply extended in payment modules
915 * 0 - regexp for card number
916 * 1 - regexp for cvn
917 * 2 - check or not credit card number trough Luhn algorithm by
918 *     function validateCreditCard which you can find above in this file
919 */
920Validation.creditCartTypes = $H({
921//    '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],
922    '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],
923    'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true],
924    'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true],
925    'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true],
926    '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],
927    '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],
928    '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],
929    '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],
930    'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false]
931});
932
933var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(e){e=e.toUpperCase();var t=this.NODEMAP[e]||"div",i=document.createElement(t);try{i.innerHTML="<"+e+"></"+e+">"}catch(n){}var r=i.firstChild||null;if(r&&r.tagName.toUpperCase()!=e&&(r=r.getElementsByTagName(e)[0]),r||(r=document.createElement(e)),r){if(arguments[1])if(this._isStringOrNumber(arguments[1])||arguments[1]instanceof Array||arguments[1].tagName)this._children(r,arguments[1]);else{var s=this._attributes(arguments[1]);if(s.length){try{i.innerHTML="<"+e+" "+s+"></"+e+">"}catch(n){}if(r=i.firstChild||null,!r){r=document.createElement(e);
933for(attr in arguments[1])r["class"==attr?"className":attr]=arguments[1][attr]}r.tagName.toUpperCase()!=e&&(r=i.getElementsByTagName(e)[0])}}return arguments[2]&&this._children(r,arguments[2]),$(r)}},_text:function(e){return document.createTextNode(e)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(e){var t=[];for(attribute in e)t.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+(""+e[attribute]).escapeHTML().gsub(/"/,"&quot;")+'"');return t.join(" ")},_children:function(e,t){return t.tagName?(e.appendChild(t),void 0):("object"==typeof t?t.flatten().each(function(t){"object"==typeof t?e.appendChild(t):Builder._isStringOrNumber(t)&&e.appendChild(Builder._text(t))}):Builder._isStringOrNumber(t)&&e.appendChild(Builder._text(t)),void 0)},_isStringOrNumber:function(e){return"string"==typeof e||"number"==typeof e},build:function(e){var t=this.node("div");return $(t).update(e.strip()),t.down()},dump:function(e){"object"!=typeof e&&"function"!=typeof e&&(e=window);var t="A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR".split(/\s+/);t.each(function(t){e[t]=function(){return Builder.node.apply(Builder,[t].concat($A(arguments)))}})}};
934
935String.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+=";zoom: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;
935case"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
935=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]||{}
935),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
935ing.__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);
936
937if(Object.isUndefined(Effect))throw"dragdrop.js requires including script.aculo.us' effects.js library";var Droppables={drops:[],remove:function(e){this.drops=this.drops.reject(function(t){return t.element==$(e)})},add:function(e){e=$(e);var t=Object.extend({greedy:!0,hoverclass:null,tree:!1},arguments[1]||{});if(t.containment){t._containers=[];var i=t.containment;Object.isArray(i)?i.each(function(e){t._containers.push($(e))}):t._containers.push($(i))}t.accept&&(t.accept=[t.accept].flatten()),Element.makePositioned(e),t.element=e,this.drops.push(t)},findDeepestChild:function(e){for(deepest=e[0],i=1;e.length>i;++i)Element.isParent(e[i].element,deepest.element)&&(deepest=e[i]);return deepest},isContained:function(e,t){var i;return i=t.tree?e.treeNode:e.parentNode,t._containers.detect(function(e){return i==e})},isAffected:function(e,t,i){return i.element!=t&&(!i._containers||this.isContained(t,i))&&(!i.accept||Element.classNames(t).detect(function(e){return i.accept.include(e)}))&&Position.within(i.element,e[0],e[1])},deactivate:function(e){e.hoverclass&&Element.removeClassName(e.element,e.hoverclass),this.last_active=null},activate:function(e){e.hoverclass&&Element.addClassName(e.element,e.hoverclass),this.last_active=e},show:function(e,t){if(this.drops.length){var i,n=[];this.drops.each(function(i){Droppables.isAffected(e,t,i)&&n.push(i)}),n.length>0&&(i=Droppables.findDeepestChild(n)),this.last_active&&this.last_active!=i&&this.deactivate(this.last_active),i&&(Position.within(i.element,e[0],e[1]),i.onHover&&i.onHover(t,i.element,Position.overlap(i.overlap,i.element)),i!=this.last_active&&Droppables.activate(i))}},fire:function(e,t){return this.last_active?(Position.prepare(),this.isAffected([Event.pointerX(e),Event.pointerY(e)],t,this.last_active)&&this.last_active.onDrop?(this.last_active.onDrop(t,this.last_active.element,e),!0):void 0):void 0},reset:function(){this.last_active&&this.deactivate(this.last_active)}},Draggables={drags:[],observers:[],register:function(e){0==this.drags.length&&(this.eventMouseUp=this.endDrag.bindAsEventListener(this),this.eventMouseMove=this.updateDrag.bindAsEventListener(this),this.eventKeypress=this.keyPress.bindAsEventListener(this),Event.observe(document,"mouseup",this.eventMouseUp),Event.observe(document,"mousemove",this.eventMouseMove),Event.observe(document,"keypress",this.eventKeypress)),this.drags.push(e)},unregister:function(e){this.drags=this.drags.reject(function(t){return t==e}),0==this.drags.length&&(Event.stopObserving(document,"mouseup",this.eventMouseUp),Event.stopObserving(document,"mousemove",this.eventMouseMove),Event.stopObserving(document,"keypress",this.eventKeypress))},activate:function(e){e.options.delay?this._timeout=setTimeout(function(){Draggables._timeout=null,window.focus(),Draggables.activeDraggable=e}.bind(this),e.options.delay):(window.focus(),this.activeDraggable=e)},deactivate:function(){this.activeDraggable=null},updateDrag:function(e){if(this.activeDraggable){var t=[Event.pointerX(e),Event.pointerY(e)];this._lastPointer&&this._lastPointer.inspect()==t.inspect()||(this._lastPointer=t,this.activeDraggable.updateDrag(e,t))}},endDrag:function(e){this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this.activeDraggable&&(this._lastPointer=null,this.activeDraggable.endDrag(e),this.activeDraggable=null)},keyPress:function(e){this.activeDraggable&&this.activeDraggable.keyPress(e)},addObserver:function(e){this.observers.push(e),this._cacheObserverCallbacks()},removeObserver:function(e){this.observers=this.observers.reject(function(t){return t.element==e}),this._cacheObserverCallbacks()},notify:function(e,t,i){this[e+"Count"]>0&&this.observers.each(function(n){n[e]&&n[e](e,t,i)}),t.options[e]&&t.options[e](t,i)},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(e){Draggables[e+"Count"]=Draggables.observers.select(function(t){return t[e]}).length})}},Draggable=Class.create({initialize:function(e){var t={handle:!1,reverteffect:function(e,t,i){var n=.02*Math.sqrt(Math.abs(2^t)+Math.abs(2^i));new Effect.Move(e,{x:-i,y:-t,duration:n,queue:{scope:"_draggable",position:"end"}})}
937,endeffect:function(e){var t=Object.isNumber(e._opacity)?e._opacity:1;new Effect.Opacity(e,{duration:.2,from:.7,to:t,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[e]=!1}})},zindex:1e3,revert:!1,quiet:!1,scroll:!1,scrollSensitivity:20,scrollSpeed:15,snap:!1,delay:0};(!arguments[1]||Object.isUndefined(arguments[1].endeffect))&&Object.extend(t,{starteffect:function(e){e._opacity=Element.getOpacity(e),Draggable._dragging[e]=!0,new Effect.Opacity(e,{duration:.2,from:e._opacity,to:.7})}});var i=Object.extend(t,arguments[1]||{});this.element=$(e),i.handle&&Object.isString(i.handle)&&(this.handle=this.element.down("."+i.handle,0)),this.handle||(this.handle=$(i.handle)),this.handle||(this.handle=this.element),!i.scroll||i.scroll.scrollTo||i.scroll.outerHTML||(i.scroll=$(i.scroll),this._isScrollChild=Element.childOf(this.element,i.scroll)),Element.makePositioned(this.element),this.options=i,this.dragging=!1,this.eventMouseDown=this.initDrag.bindAsEventListener(this),Event.observe(this.handle,"mousedown",this.eventMouseDown),Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown),Draggables.unregister(this)},currentDelta:function(){return[parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")]},initDrag:function(e){if((Object.isUndefined(Draggable._dragging[this.element])||!Draggable._dragging[this.element])&&Event.isLeftClick(e)){var t=Event.element(e);if((tag_name=t.tagName.toUpperCase())&&("INPUT"==tag_name||"SELECT"==tag_name||"OPTION"==tag_name||"BUTTON"==tag_name||"TEXTAREA"==tag_name))return;var i=[Event.pointerX(e),Event.pointerY(e)],n=this.element.cumulativeOffset();this.offset=[0,1].map(function(e){return i[e]-n[e]}),Draggables.activate(this),Event.stop(e)}},startDrag:function(e){if(this.dragging=!0,this.delta||(this.delta=this.currentDelta()),this.options.zindex&&(this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0),this.element.style.zIndex=this.options.zindex),this.options.ghosting&&(this._clone=this.element.cloneNode(!0),this._originallyAbsolute="absolute"==this.element.getStyle("position"),this._originallyAbsolute||Position.absolutize(this.element),this.element.parentNode.insertBefore(this._clone,this.element)),this.options.scroll)if(this.options.scroll==window){var t=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=t.left,this.originalScrollTop=t.top}else this.originalScrollLeft=this.options.scroll.scrollLeft,this.originalScrollTop=this.options.scroll.scrollTop;Draggables.notify("onStart",this,e),this.options.starteffect&&this.options.starteffect(this.element)},updateDrag:function(event,pointer){if(this.dragging||this.startDrag(event),this.options.quiet||(Position.prepare(),Droppables.show(pointer,this.element)),Draggables.notify("onDrag",this,event),this.draw(pointer),this.options.change&&this.options.change(this),this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window)with(this._getWindowScroll(this.options.scroll))p=[left,top,left+width,top+height];else p=Position.page(this.options.scroll).toArray(),p[0]+=this.options.scroll.scrollLeft+Position.deltaX,p[1]+=this.options.scroll.scrollTop+Position.deltaY,p.push(p[0]+this.options.scroll.offsetWidth),p.push(p[1]+this.options.scroll.offsetHeight);var speed=[0,0];pointer[0]<p[0]+this.options.scrollSensitivity&&(speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)),pointer[1]<p[1]+this.options.scrollSensitivity&&(speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)),pointer[0]>p[2]-this.options.scrollSensitivity&&(speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)),pointer[1]>p[3]-this.options.scrollSensitivity&&(speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)),this.startScrolling(speed)}Prototype.Browser.WebKit&&window.scrollBy(0,0),Event.stop(event)},finishDrag:function(e,t){if(this.dragging=!1,this.options.quiet){Position.prepare();var i=[Event.pointerX(e),Event.pointerY(e)];Droppables.show(i,this.element)}this.options.ghosting&&(this._originallyAbsolute||Position.relativize(this.element),delete this._originallyAbsolute,Element.remove(this._clone),this._clone=null);var n=!1;t&&(n=Droppables.fire(e,this.element),n||(n=!1)),n&&this.options.onDropped&&this.options.onDropped(this.element),Draggables.notify("onEnd",this,e);var r=this.options.revert;r&&Object.isFunction(r)&&(r=r(this.element));var s=this.currentDelta();r&&this.options.reverteffect?(0==n||"failure"!=r)&&this.options.reverteffect(this.element,s[1]-this.delta[1],s[0]-this.delta[0]):this.delta=s,this.options.zindex&&(this.element.style.zIndex=this.originalZ),this.options.endeffect&&this.options.endeffect(this.element),Draggables.deactivate(this),Droppables.reset()},keyPress:function(e){e.keyCode==Event.KEY_ESC&&(this.finishDrag(e,!1),Event.stop(e))},endDrag:function(e){this.dragging&&(this.stopScrolling(),this.finishDrag(e,!0),Event.stop(e))},draw:function(e){var t=this.element.cumulativeOffset();if(this.options.ghosting){var i=Position.realOffset(this.element);t[0]+=i[0]-Position.deltaX,t[1]+=i[1]-Position.deltaY}var n=this.currentDelta();t[0]-=n[0],t[1]-=n[1],this.options.scroll&&this.options.scroll!=window&&this._isScrollChild&&(t[0]-=this.options.scroll.
937scrollLeft-this.originalScrollLeft,t[1]-=this.options.scroll.scrollTop-this.originalScrollTop);var r=[0,1].map(function(i){return e[i]-t[i]-this.offset[i]}.bind(this));this.options.snap&&(r=Object.isFunction(this.options.snap)?this.options.snap(r[0],r[1],this):Object.isArray(this.options.snap)?r.map(function(e,t){return(e/this.options.snap[t]).round()*this.options.snap[t]}.bind(this)):r.map(function(e){return(e/this.options.snap).round()*this.options.snap}.bind(this)));var s=this.element.style;this.options.constraint&&"horizontal"!=this.options.constraint||(s.left=r[0]+"px"),this.options.constraint&&"vertical"!=this.options.constraint||(s.top=r[1]+"px"),"hidden"==s.visibility&&(s.visibility="")},stopScrolling:function(){this.scrollInterval&&(clearInterval(this.scrollInterval),this.scrollInterval=null,Draggables._lastScrollPointer=null)},startScrolling:function(e){(e[0]||e[1])&&(this.scrollSpeed=[e[0]*this.options.scrollSpeed,e[1]*this.options.scrollSpeed],this.lastScrolled=new Date,this.scrollInterval=setInterval(this.scroll.bind(this),10))},scroll:function(){var current=new Date,delta=current-this.lastScrolled;if(this.lastScrolled=current,this.options.scroll==window){with(this._getWindowScroll(this.options.scroll))if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1e3;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}else this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1e3,this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1e3;Position.prepare(),Droppables.show(Draggables._lastPointer,this.element),Draggables.notify("onDrag",this),this._isScrollChild&&(Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer),Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1e3,Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1e3,0>Draggables._lastScrollPointer[0]&&(Draggables._lastScrollPointer[0]=0),0>Draggables._lastScrollPointer[1]&&(Draggables._lastScrollPointer[1]=0),this.draw(Draggables._lastScrollPointer)),this.options.change&&this.options.change(this)},_getWindowScroll:function(w){var T,L,W,H;with(w.document)w.document.documentElement&&documentElement.scrollTop?(T=documentElement.scrollTop,L=documentElement.scrollLeft):w.document.body&&(T=body.scrollTop,L=body.scrollLeft),w.innerWidth?(W=w.innerWidth,H=w.innerHeight):w.document.documentElement&&documentElement.clientWidth?(W=documentElement.clientWidth,H=documentElement.clientHeight):(W=body.offsetWidth,H=body.offsetHeight);return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(e,t){this.element=$(e),this.observer=t,this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark(),this.lastValue!=Sortable.serialize(this.element)&&this.observer(this.element)}}),Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(e){for(;"BODY"!=e.tagName.toUpperCase();){if(e.id&&Sortable.sortables[e.id])return e;e=e.parentNode}},options:function(e){return(e=Sortable._findRootElement($(e)))?Sortable.sortables[e.id]:void 0},destroy:function(e){e=$(e);var t=Sortable.sortables[e.id];t&&(Draggables.removeObserver(t.element),t.droppables.each(function(e){Droppables.remove(e)}),t.draggables.invoke("destroy"),delete Sortable.sortables[t.element.id])},create:function(e){e=$(e);var t=Object.extend({element:e,tag:"li",dropOnEmpty:!1,tree:!1,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:e,handle:!1,only:!1,delay:0,hoverclass:null,ghosting:!1,quiet:!1,scroll:!1,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:!1,handles:!1,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(e);var i={revert:!0,quiet:t.quiet,scroll:t.scroll,scrollSpeed:t.scrollSpeed,scrollSensitivity:t.scrollSensitivity,delay:t.delay,ghosting:t.ghosting,constraint:t.constraint,handle:t.handle};t.starteffect&&(i.starteffect=t.starteffect),t.reverteffect?i.reverteffect=t.reverteffect:t.ghosting&&(i.reverteffect=function(e){e.style.top=0,e.style.left=0}),t.endeffect&&(i.endeffect=t.endeffect),t.zindex&&(i.zindex=t.zindex);var n={overlap:t.overlap,containment:t.containment,tree:t.tree,hoverclass:t.hoverclass,onHover:Sortable.onHover},r={onHover:Sortable.onEmptyHover,overlap:t.overlap,containment:t.containment,hoverclass:t.hoverclass};Element.cleanWhitespace(e),t.draggables=[],t.droppables=[],(t.dropOnEmpty||t.tree)&&(Droppables.add(e,r),t.droppables.push(e)),(t.elements||this.findElements(e,t)||[]).each(function(r,s){var o=t.handles?$(t.handles[s]):t.handle?$(r).select("."+t.handle)[0]:r;t.draggables.push(new Draggable(r,Object.extend(i,{handle:o}))),Droppables.add(r,n),t.tree&&(r.treeNode=e),t.droppables.push(r)}),t.tree&&(Sortable.findTreeElements(e,t)||[]).each(function(i){Droppables.add(i,r),i.treeNode=e,t.droppables.push(i)}),this.sortables[e.identify()]=t,Draggables.addObserver(new SortableObserver(e,t.onUpdate))},findElements:function(e,t){return Element.findChildren(e,t.only,t.tree?!0:!1,t.tag)},findTreeElements:function(e,t){return Element.findChildren(e,t.only,t.tree?!0:!1,t.treeTag)},onHover:function(e,t,i){if(!(Element.isParent(t,e)||i>.33&&.66>
937i&&Sortable.options(t).tree))if(i>.5){if(Sortable.mark(t,"before"),t.previousSibling!=e){var n=e.parentNode;e.style.visibility="hidden",t.parentNode.insertBefore(e,t),t.parentNode!=n&&Sortable.options(n).onChange(e),Sortable.options(t.parentNode).onChange(e)}}else{Sortable.mark(t,"after");var r=t.nextSibling||null;if(r!=e){var n=e.parentNode;e.style.visibility="hidden",t.parentNode.insertBefore(e,r),t.parentNode!=n&&Sortable.options(n).onChange(e),Sortable.options(t.parentNode).onChange(e)}}},onEmptyHover:function(e,t,i){var n=e.parentNode,r=Sortable.options(t);if(!Element.isParent(t,e)){var s,o=Sortable.findElements(t,{tag:r.tag,only:r.only}),a=null;if(o){var l=Element.offsetSize(t,r.overlap)*(1-i);for(s=0;o.length>s;s+=1){if(!(l-Element.offsetSize(o[s],r.overlap)>=0)){if(l-Element.offsetSize(o[s],r.overlap)/2>=0){a=o.length>s+1?o[s+1]:null;break}a=o[s];break}l-=Element.offsetSize(o[s],r.overlap)}}t.insertBefore(e,a),Sortable.options(n).onChange(e),r.onChange(e)}},unmark:function(){Sortable._marker&&Sortable._marker.hide()},mark:function(e,t){var i=Sortable.options(e.parentNode);if(!i||i.ghosting){Sortable._marker||(Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"}),document.getElementsByTagName("body").item(0).appendChild(Sortable._marker));var n=e.cumulativeOffset();Sortable._marker.setStyle({left:n[0]+"px",top:n[1]+"px"}),"after"==t&&("horizontal"==i.overlap?Sortable._marker.setStyle({left:n[0]+e.clientWidth+"px"}):Sortable._marker.setStyle({top:n[1]+e.clientHeight+"px"})),Sortable._marker.show()}},_tree:function(e,t,i){for(var n=Sortable.findElements(e,t)||[],r=0;n.length>r;++r){var s=n[r].id.match(t.format);if(s){var o={id:encodeURIComponent(s?s[1]:null),element:e,parent:i,children:[],position:i.children.length,container:$(n[r]).down(t.treeTag)};o.container&&this._tree(o.container,t,o),i.children.push(o)}}return i},tree:function(e){e=$(e);var t=this.options(e),i=Object.extend({tag:t.tag,treeTag:t.treeTag,only:t.only,name:e.id,format:t.format},arguments[1]||{}),n={id:null,parent:null,children:[],container:e,position:0};return Sortable._tree(e,i,n)},_constructIndex:function(e){var t="";do e.id&&(t="["+e.position+"]"+t);while(null!=(e=e.parent));return t},sequence:function(e){e=$(e);var t=Object.extend(this.options(e),arguments[1]||{});return $(this.findElements(e,t)||[]).map(function(e){return e.id.match(t.format)?e.id.match(t.format)[1]:""})},setSequence:function(e,t){e=$(e);var i=Object.extend(this.options(e),arguments[2]||{}),n={};this.findElements(e,i).each(function(e){e.id.match(i.format)&&(n[e.id.match(i.format)[1]]=[e,e.parentNode]),e.parentNode.removeChild(e)}),t.each(function(e){var t=n[e];t&&(t[1].appendChild(t[0]),delete n[e])})},serialize:function(e){e=$(e);var t=Object.extend(Sortable.options(e),arguments[1]||{}),i=encodeURIComponent(arguments[1]&&arguments[1].name?arguments[1].name:e.id);return t.tree?Sortable.tree(e,arguments[1]).children.map(function(e){return[i+Sortable._constructIndex(e)+"[id]="+encodeURIComponent(e.id)].concat(e.children.map(arguments.callee))}).flatten().join("&"):Sortable.sequence(e,arguments[1]).map(function(e){return i+"[]="+encodeURIComponent(e)}).join("&")}};Element.isParent=function(e,t){return e.parentNode&&e!=t?e.parentNode==t?!0:Element.isParent(e.parentNode,t):!1},Element.findChildren=function(e,t,i,n){if(!e.hasChildNodes())return null;n=n.toUpperCase(),t&&(t=[t].flatten());var r=[];return $A(e.childNodes).each(function(e){if(!e.tagName||e.tagName.toUpperCase()!=n||t&&!Element.classNames(e).detect(function(e){return t.include(e)})||r.push(e),i){var s=Element.findChildren(e,t,i,n);s&&r.push(s)}}),r.length>0?r.flatten():[]},Element.offsetSize=function(e,t){return e["offset"+("vertical"==t||"height"==t?"Height":"Width")]};
938
939// script.aculo.us controls.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
940
941// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
942//           (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
943//           (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
944// Contributors:
945//  Richard Livsey
946//  Rahul Bhargava
947//  Rob Wills
948//
949// script.aculo.us is freely distributable under the terms of an MIT
949-style license.
950// For details, see the script.aculo.us web site: http://script.aculo.us/
951
952// Autocompleter.Base handles all the autocompletion functionality
953// that's independent of the data source for autocompletion. This
954// includes drawing the autocompletion menu, observing keyboard
955// and mouse events, and similar.
956//
957// Specific autocompleters need to provide, at the very least,
958// a getUpdatedChoices function that will be invoked every time
959// the text inside the monitored textbox changes. This method
960// should get the text for which to provide autocompletion by
961// invoking this.getToken(), NOT by directly accessing
962// this.element.value. This is to allow incremental tokenized
963// autocompletion. Specific auto-completion logic (AJAX, etc)
964// belongs in getUpdatedChoices.
965//
966// Tokenized incremental autocompletion is enabled automatically
967// when an autocompleter is instantiated with the 'tokens' option
968// in the options parameter, e.g.:
969// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
970// will incrementally autocomplete with a comma as the token.
971// Additionally, ',' in the above example can be replaced with
972// a token array, e.g. { tokens: [',', '\n'] } which
973// enables autocompletion on multiple tokens. This is most
974// useful when one of the tokens is \n (a newline), as it
975// allows smart autocompletion after linebreaks.
976
977if(typeof Effect == 'undefined')
978  throw("controls.js requires including script.aculo.us' effects.js library");
979
980var Autocompleter = { };
981Autocompleter.Base = Class.create({
982  baseInitialize: function(element, update, options) {
983    element          = $(element);
984    this.element     = element;
985    this.update      = $(update);
986    this.hasFocus    = false;
987    this.changed     = false;
988    this.active      = false;
989    this.index       = 0;
990    this.entryCount  = 0;
991    this.oldElementValue = this.element.value;
992
993    if(this.setOptions)
994      this.setOptions(options);
995    else
996      this.options = options || { };
997
998    this.options.paramName    = this.options.paramName || this.element.name;
999    this.options.tokens       = this.options.tokens || [];
1000    this.options.frequency    = this.options.frequency || 0.4;
1001    this.options.minChars     = this.options.minChars || 1;
1002    this.options.onShow       = this.options.onShow ||
1003      function(element, update){
1004        if(!update.style.position || update.style.position=='absolute') {
1005          update.style.position = 'absolute';
1006          Position.clone(element, update, {
1007            setHeight: false,
1008            offsetTop: element.offsetHeight
1009          });
1010        }
1011        Effect.Appear(update,{duration:0.15});
1012      };
1013    this.options.onHide = this.options.onHide ||
1014      function(element, update){ new Effect.Fade(update,{duration:0.15}) };
1015
1016    if(typeof(this.options.tokens) == 'string')
1017      this.options.tokens = new Array(this.options.tokens);
1018    // Force carriage returns as token delimiters anyway
1019    if (!this.options.tokens.include('\n'))
1020      this.options.tokens.push('\n');
1021
1022    this.observer = null;
1023
1024    this.element.setAttribute('autocomplete','off');
1025
1026    Element.hide(this.update);
1027
1028    Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
1029    Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
1030  },
1031
1032  show: function() {
1033    if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
1034    if(!this.iefix &&
1035      (Prototype.Browser.IE) &&
1036      (Element.getStyle(this.update, 'position')=='absolute')) {
1037      new Insertion.After(this.update,
1038       '<iframe id="' + this.update.id + '_iefix" '+
1039       'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
1040       'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
1041      this.iefix = $(this.update.id+'_iefix');
1042    }
1043    if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
1044  },
1045
1046  fixIEOverlapping: function() {
1047    Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
1048    this.iefix.style.zIndex = 1;
1049    this.update.style.zIndex = 2;
1050    Element.show(this.iefix);
1051  },
1052
1053  hide: function() {
1054    this.stopIndicator();
1055    if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
1056    if(this.iefix) Element.hide(this.iefix);
1057  },
1058
1059  startIndicator: function() {
1060    if(this.options.indicator) Element.show(this.options.indicator);
1061  },
1062
1063  stopIndicator: function() {
1064    if(this.options.indicator) Element.hide(this.options.indicator);
1065  },
1066
1067  onKeyPress: function(event) {
1068    if(this.active)
1069      switch(event.keyCode) {
1070       case Event.KEY_TAB:
1071       case Event.KEY_RETURN:
1072         this.selectEntry();
1073         Event.stop(event);
1074       case Event.KEY_ESC:
1075         this.hide();
1076         this.active = false;
1077         Event.stop(event);
1078         return;
1079       case Event.KEY_LEFT:
1080       case Event.KEY_RIGHT:
1081         return;
1082       case Event.KEY_UP:
1083         this.markPrevious();
1084         this.render();
1085         Event.stop(event);
1086         return;
1087       case Event.KEY_DOWN:
1088         this.markNext();
1089         this.render();
1090         Event.stop(event);
1091         return;
1092      }
1093     else
1094       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
1095         (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
1096
1097    this.changed = true;
1098    this.hasFocus = true;
1099
1100    if(this.observer) clearTimeout(this.observer);
1101      this.observer =
1102        setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
1103  },
1104
1105  activate: function() {
1106    this.changed = false;
1107    this.hasFocus = true;
1108    this.getUpdatedChoices();
1109  },
1110
1111  onHover: function(event) {
1112    var element = Event.findElement(event, 'LI');
1113    if(this.index != element.autocompleteIndex)
1114    {
1115        this.index = element.autocompleteIndex;
1116        this.render();
1117    }
1118    Event.stop(event);
1119  },
1120
1121  onClick: function(event) {
1122    var element = Event.findElement(event, 'LI');
1123    this.index = element.autocompleteIndex;
1124    this.selectEntry();
1125    this.hide();
1126  },
1127
1128  onBlur: function(event) {
1129    // needed to make click events working
1130    setTimeout(this.hide.bind(this), 250);
1131    this.hasFocus = false;
1132    this.active = false;
1133  },
1134
1135  render: function() {
1136    if(this.entryCount > 0) {
1137      for (var i = 0; i < this.entryCount; i++)
1138        this.index==i ?
1139          Element.addClassName(this.getEntry(i),"selected") :
1140          Element.removeClassName(this.getEntry(i),"selected");
1141      if(this.hasFocus) {
1142        this.show();
1143        this.active = true;
1144      }
1145    } else {
1146      this.active = false;
1147      this.hide();
1148    }
1149  },
1150
1151  markPrevious: function() {
1152    if(this.index > 0) this.index--;
1153      else this.index = this.entryCount-1;
1154    //this.getEntry(this.index).scrollIntoView(true); useless
1155  },
1156
1157  markNext: function() {
1158    if(this.index < this.entryCount-1) this.index++;
1159      else this.index = 0;
1160    this.getEntry(this.index).scrollIntoView(false);
1161  },
1162
1163  getEntry: function(index) {
1164    return this.update.firstChild.childNodes[index];
1165  },
1166
1167  getCurrentEntry: function() {
1168    return this.getEntry(this.index);
1169  },
1170
1171  selectEntry: function() {
1172    this.active = false;
1173    this.updateElement(this.getCurrentEntry());
1174  },
1175
1176  updateElement: function(selectedElement) {
1177    if (this.options.updateElement) {
1178      this.options.updateElement(selectedElement);
1179      return;
1180    }
1181    var value = '';
1182    if (this.options.select) {
1183      var nodes = $(selectedElement).select('.' + this.options.select) || [];
1184      if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
1185    } else
1186      value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
1187
1188    var bounds = this.getTokenBounds();
1189    if (bounds[0] != -1) {
1190      var newValue = this.element.value.substr(0, bounds[0]);
1191      var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
1192      if (whitespace)
1193        newValue += whitespace[0];
1194      this.element.value = newValue + value + this.element.value.substr(bounds[1]);
1195    } else {
1196      this.element.value = value;
1197    }
1198    this.oldElementValue = this.element.value;
1199    this.element.focus();
1200
1201    if (this.options.afterUpdateElement)
1202      this.options.afterUpdateElement(this.element, selectedElement);
1203  },
1204
1205  updateChoices: function(choices) {
1206    if(!this.changed && this.hasFocus) {
1207      this.update.innerHTML = choices;
1208      Element.cleanWhitespace(this.update);
1209      Element.cleanWhitespace(this.update.down());
1210
1211      if(this.update.firstChild && this.update.down().childNodes) {
1212        this.entryCount =
1213          this.update.down().childNodes.length;
1214        for (var i = 0; i < this.entryCount; i++) {
1215          var entry = this.getEntry(i);
1216          entry.autocompleteIndex = i;
1217          this.addObservers(entry);
1218        }
1219      } else {
1220        this.entryCount = 0;
1221      }
1222
1223      this.stopIndicator();
1224      this.index = 0;
1225
1226      if(this.entryCount==1 && this.options.autoSelect) {
1227        this.selectEntry();
1228        this.hide();
1229      } else {
1230        this.render();
1231      }
1232    }
1233  },
1234
1235  addObservers: function(element) {
1236    Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
1237    Event.observe(element, "click", this.onClick.bindAsEventListener(this));
1238  },
1239
1240  onObserverEvent: function() {
1241    this.changed = false;
1242    this.tokenBounds = null;
1243    if(this.getToken().length>=this.options.minChars) {
1244      this.getUpdatedChoices();
1245    } else {
1246      this.active = false;
1247      this.hide();
1248    }
1249    this.oldElementValue = this.element.value;
1250  },
1251
1252  getToken: function() {
1253    var bounds = this.getTokenBounds();
1254    return this.element.value.substring(bounds[0], bounds[1]).strip();
1255  },
1256
1257  getTokenBounds: function() {
1258    if (null != this.tokenBounds) return this.tokenBounds;
1259    var value = this.element.value;
1260    if (value.strip().empty()) return [-1, 0];
1261    var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
1262    var offset = (diff == this.oldElementValue.length ? 1 : 0);
1263    var prevTokenPos = -1, nextTokenPos = value.length;
1264    var tp;
1265    for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
1266      tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
1267      if (tp > prevTokenPos) prevTokenPos = tp;
1268      tp = value.indexOf(this.options.tokens[index], diff + offset);
1269      if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
1270    }
1271    return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
1272  }
1273});
1274
1275Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
1276  var boundary = Math.min(newS.length, oldS.length);
1277  for (var index = 0; index < boundary; ++index)
1278    if (newS[index] != oldS[index])
1279      return index;
1280  return boundary;
1281};
1282
1283Ajax.Autocompleter = Class.create(Autocompleter.Base, {
1284  initialize: function(element, update, url, options) {
1285    this.baseInitialize(element, update, options);
1286    this.options.asynchronous  = true;
1287    this.options.onComplete    = this.onComplete.bind(this);
1288    this.options.defaultParams = this.options.parameters || null;
1289    this.url                   = url;
1290  },
1291
1292  getUpdatedChoices: function() {
1293    this.startIndicator();
1294
1295    var entry = encodeURIComponent(this.options.paramName) + '=' +
1296      encodeURIComponent(this.getToken());
1297
1298    this.options.parameters = this.options.callback ?
1299      this.options.callback(this.element, entry) : entry;
1300
1301    if(this.options.defaultParams)
1302      this.options.parameters += '&' + this.options.defaultParams;
1303
1304    new Ajax.Request(this.url, this.options);
1305  },
1306
1307  onComplete: function(request) {
1308    this.updateChoices(request.responseText);
1309  }
1310});
1311
1312// The local array autocompleter. Used when you'd prefer to
1313// inject an array of autocompletion options into the page, rather
1314// than sending out Ajax queries, which can be quite slow sometimes.
1315//
1316// The constructor takes four parameters. The first two are, as usual,
1317// the id of the monitored textbox, and id of the autocompletion menu.
1318// The third is the array you want to autocomplete from, and the fourth
1319// is the options block.
1320//
1321// Extra local autocompletion options:
1322// - choices - How many autocompletion choices to offer
1323//
1324// - partialSearch - If false, the autocompleter will match entered
1325//                    text only at the beginning of strings in the
1326//                    autocomplete array. Defaults to true, which will
1327//                    match text at the beginning of any *word* in the
1328//                    strings in the autocomplete array. If you want to
1329//                    search anywhere in the string, additionally set
1330//                    the option fullSearch to true (default: off).
1331//
1332// - fullSsearch - Search anywhere in autocomplete array strings.
1333//
1334// - partialChars - How many characters to enter before triggering
1335//                   a partial match (unlike minChars, which defines
1336//                   how many characters are required to do any match
1337//                   at all). Defaults to 2.
1338//
1339// - ignoreCase - Whether to ignore case when autocompleting.
1340//                 Defaults to true.
1341//
1342// It's possible to pass in a custom function as the 'selector'
1343// option, if you prefer to write your own autocompletion logic.
1344// In that case, the other options above will not apply unless
1345// you support them.
1346
1347Autocompleter.Local = Class.create(Autocompleter.Base, {
1348  initialize: function(element, update, array, options) {
1349    this.baseInitialize(element, update, options);
1350    this.options.array = array;
1351  },
1352
1353  getUpdatedChoices: function() {
1354    this.updateChoices(this.options.selector(this));
1355  },
1356
1357  setOptions: function(options) {
1358    this.options = Object.extend({
1359      choices: 10,
1360      partialSearch: true,
1361      partialChars: 2,
1362      ignoreCase: true,
1363      fullSearch: false,
1364      selector: function(instance) {
1365        var ret       = []; // Beginning matches
1366        var partial   = []; // Inside matches
1367        var entry     = instance.getToken();
1368        var count     = 0;
1369
1370        for (var i = 0; i < instance.options.array.length &&
1371          ret.length < instance.options.choices ; i++) {
1372
1373          var elem = instance.options.array[i];
1374          var foundPos = instance.options.ignoreCase ?
1375            elem.toLowerCase().indexOf(entry.toLowerCase()) :
1376            elem.indexOf(entry);
1377
1378          while (foundPos != -1) {
1379            if (foundPos == 0 && elem.length != entry.length) {
1380              ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
1381                elem.substr(entry.length) + "</li>");
1382              break;
1383            } else if (entry.length >= instance.options.partialChars &&
1384              instance.options.partialSearch && foundPos != -1) {
1385              if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
1386                partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
1387                  elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
1388                  foundPos + entry.length) + "</li>");
1389                break;
1390              }
1391            }
1392
1393            foundPos = instance.options.ignoreCase ?
1394              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
1395              elem.indexOf(entry, foundPos + 1);
1396
1397          }
1398        }
1399        if (partial.length)
1400          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
1401        return "<ul>" + ret.join('') + "</ul>";
1402      }
1403    }, options || { });
1404  }
1405});
1406
1407// AJAX in-place editor and collection editor
1408// Full rewrite by Christophe Porteneuve <[email protected]> (April 2007).
1409
1410// Use this if you notice weird scrolling problems on some browsers,
1411// the DOM might be a bit confused when this gets called so do this
1412// waits 1 ms (with setTimeout) until it does the activation
1413Field.scrollFreeActivate = function(field) {
1414  setTimeout(function() {
1415    Field.activate(field);
1416  }, 1);
1417};
1418
1419Ajax.InPlaceEditor = Class.create({
1420  initialize: function(element, url, options) {
1421    this.url = url;
1422    this.element = element = $(element);
1423    this.prepareOptions();
1424    this._controls = { };
1425    arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
1426    Object.extend(this.options, options || { });
1427    if (!this.options.formId && this.element.id) {
1428      this.options.formId = this.element.id + '-inplaceeditor';
1429      if ($(this.options.formId))
1430        this.options.formId = '';
1431    }
1432    if (this.options.externalControl)
1433      this.options.externalControl = $(this.options.externalControl);
1434    if (!this.options.externalControl)
1435      this.options.externalControlOnly = false;
1436    this._originalBackground = this.element.getStyle('background-color') || 'transparent';
1437    this.element.title = this.options.clickToEditText;
1438    this._boundCancelHandler = this.handleFormCancellation.bind(this);
1439    this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
1440    this._boundFailureHandler = this.handleAJAXFailure.bind(this);
1441    this._boundSubmitHandler = this.handleFormSubmission.bind(this);
1442    this._boundWrapperHandler = this.wrapUp.bind(this);
1443    this.registerListeners();
1444  },
1445  checkForEscapeOrReturn: function(e) {
1446    if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
1447    if (Event.KEY_ESC == e.keyCode)
1448      this.handleFormCancellation(e);
1449    else if (Event.KEY_RETURN == e.keyCode)
1450      this.handleFormSubmission(e);
1451  },
1452  createControl: function(mode, handler, extraClasses) {
1453    var control = this.options[mode + 'Control'];
1454    var text = this.options[mode + 'Text'];
1455    if ('button' == control) {
1456      var btn = document.createElement('input');
1457      btn.type = 'submit';
1458      btn.value = text;
1459      btn.className = 'editor_' + mode + '_button';
1460      if ('cancel' == mode)
1461        btn.onclick = this._boundCancelHandler;
1462      this._form.appendChild(btn);
1463      this._controls[mode] = btn;
1464    } else if ('link' == control) {
1465      var link = document.createElement('a');
1466      link.href = '#';
1467      link.appendChild(document.createTextNode(text));
1468      link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
1469      link.className = 'editor_' + mode + '_link';
1470      if (extraClasses)
1471        link.className += ' ' + extraClasses;
1472      this._form.appendChild(link);
1473      this._controls[mode] = link;
1474    }
1475  },
1476  createEditField: function() {
1477    var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
1478    var fld;
1479    if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
1480      fld = document.createElement('input');
1481      fld.type = 'text';
1482      var size = this.options.size || this.options.cols || 0;
1483      if (0 < size) fld.size = size;
1484    } else {
1485      fld = document.createElement('textarea');
1486      fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
1487      fld.cols = this.options.cols || 40;
1488    }
1489    fld.name = this.options.paramName;
1490    fld.value = text; // No HTML breaks conversion anymore
1491    fld.className = 'editor_field';
1492    if (this.options.submitOnBlur)
1493      fld.onblur = this._boundSubmitHandler;
1494    this._controls.editor = fld;
1495    if (this.options.loadTextURL)
1496      this.loadExternalText();
1497    this._form.appendChild(this._controls.editor);
1498  },
1499  createForm: function() {
1500    var ipe = this;
1501    function addText(mode, condition) {
1502      var text = ipe.options['text' + mode + 'Controls'];
1503      if (!text || condition === false) return;
1504      ipe._form.appendChild(document.createTextNode(text));
1505    };
1506    this._form = $(document.createElement('form'));
1507    this._form.id = this.options.formId;
1508    this._form.addClassName(this.options.formClassName);
1509    this._form.onsubmit = this._boundSubmitHandler;
1510    this.createEditField();
1511    if ('textarea' == this._controls.editor.tagName.toLowerCase())
1512      this._form.appendChild(document.createElement('br'));
1513    if (this.options.onFormCustomization)
1514      this.options.onFormCustomization(this, this._form);
1515    addText('Before', this.options.okControl || this.options.cancelControl);
1516    this.createControl('ok', this._boundSubmitHandler);
1517    addText('Between', this.options.okControl && this.options.cancelControl);
1518    this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
1519    addText('After', this.options.okControl || this.options.cancelControl);
1520  },
1521  destroy: function() {
1522    if (this._oldInnerHTML)
1523      this.element.innerHTML = this._oldInnerHTML;
1524    this.leaveEditMode();
1525    this.unregisterListeners();
1526  },
1527  enterEditMode: function(e) {
1528    if (this._saving || this._editing) return;
1529    this._editing = true;
1530    this.triggerCallback('onEnterEditMode');
1531    if (this.options.externalControl)
1532      this.options.externalControl.hide();
1533    this.element.hide();
1534    this.createForm();
1535    this.element.parentNode.insertBefore(this._form, this.element);
1536    if (!this.options.loadTextURL)
1537      this.postProcessEditField();
1538    if (e) Event.stop(e);
1539  },
1540  enterHover: function(e) {
1541    if (this.options.hoverClassName)
1542      this.element.addClassName(this.options.hoverClassName);
1543    if (this._saving) return;
1544    this.triggerCallback('onEnterHover');
1545  },
1546  getText: function() {
1547    return this.element.innerHTML.unescapeHTML();
1548  },
1549  handleAJAXFailure: function(transport) {
1550    this.triggerCallback('onFailure', transport);
1551    if (this._oldInnerHTML) {
1552      this.element.innerHTML = this._oldInnerHTML;
1553      this._oldInnerHTML = null;
1554    }
1555  },
1556  handleFormCancellation: function(e) {
1557    this.wrapUp();
1558    if (e) Event.stop(e);
1559  },
1560  handleFormSubmission: function(e) {
1561    var form = this._form;
1562    var value = $F(this._controls.editor);
1563    this.prepareSubmission();
1564    var params = this.options.callback(form, value) || '';
1565    if (Object.isString(params))
1566      params = params.toQueryParams();
1567    params.editorId = this.element.id;
1568    if (this.options.htmlResponse) {
1569      var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
1570      Object.extend(options, {
1571        parameters: params,
1572        onComplete: this._boundWrapperHandler,
1573        onFailure: this._boundFailureHandler
1574      });
1575      new Ajax.Updater({ success: this.element }, this.url, options);
1576    } else {
1577      var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1578      Object.extend(options, {
1579        parameters: params,
1580        onComplete: this._boundWrapperHandler,
1581        onFailure: this._boundFailureHandler
1582      });
1583      new Ajax.Request(this.url, options);
1584    }
1585    if (e) Event.stop(e);
1586  },
1587  leaveEditMode: function() {
1588    this.element.removeClassName(this.options.savingClassName);
1589    this.removeForm();
1590    this.leaveHover();
1591    this.element.style.backgroundColor = this._originalBackground;
1592    this.element.show();
1593    if (this.options.externalControl)
1594      this.options.externalControl.show();
1595    this._saving = false;
1596    this._editing = false;
1597    this._oldInnerHTML = null;
1598    this.triggerCallback('onLeaveEditMode');
1599  },
1600  leaveHover: function(e) {
1601    if (this.options.hoverClassName)
1602      this.element.removeClassName(this.options.hoverClassName);
1603    if (this._saving) return;
1604    this.triggerCallback('onLeaveHover');
1605  },
1606  loadExternalText: function() {
1607    this._form.addClassName(this.options.loadingClassName);
1608    this._controls.editor.disabled = true;
1609    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1610    Object.extend(options, {
1611      parameters: 'editorId=' + encodeURIComponent(this.element.id),
1612      onComplete: Prototype.emptyFunction,
1613      onSuccess: function(transport) {
1614        this._form.removeClassName(this.options.loadingClassName);
1615        var text = transport.responseText;
1616        if (this.options.stripLoadedTextTags)
1617          text = text.stripTags();
1618        this._controls.editor.value = text;
1619        this._controls.editor.disabled = false;
1620        this.postProcessEditField();
1621      }.bind(this),
1622      onFailure: this._boundFailureHandler
1623    });
1624    new Ajax.Request(this.options.loadTextURL, options);
1625  },
1626  postProcessEditField: function() {
1627    var fpc = this.options.fieldPostCreation;
1628    if (fpc)
1629      $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
1630  },
1631  prepareOptions: function() {
1632    this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
1633    Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
1634    [this._extraDefaultOptions].flatten().compact().each(function(defs) {
1635      Object.extend(this.options, defs);
1636    }.bind(this));
1637  },
1638  prepareSubmission: function() {
1639    this._saving = true;
1640    this.removeForm();
1641    this.leaveHover();
1642    this.showSaving();
1643  },
1644  registerListeners: function() {
1645    this._listeners = { };
1646    var listener;
1647    $H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
1648      listener = this[pair.value].bind(this);
1649      this._listeners[pair.key] = listener;
1650      if (!this.options.externalControlOnly)
1651        this.element.observe(pair.key, listener);
1652      if (this.options.externalControl)
1653        this.options.externalControl.observe(pair.key, listener);
1654    }.bind(this));
1655  },
1656  removeForm: function() {
1657    if (!this._form) return;
1658    this._form.remove();
1659    this._form = null;
1660    this._controls = { };
1661  },
1662  showSaving: function() {
1663    this._oldInnerHTML = this.element.innerHTML;
1664    this.element.innerHTML = this.options.savingText;
1665    this.element.addClassName(this.options.savingClassName);
1666    this.element.style.backgroundColor = this._originalBackgroun
1666d;
1667    this.element.show();
1668  },
1669  triggerCallback: function(cbName, arg) {
1670    if ('function' == typeof this.options[cbName]) {
1671      this.options[cbName](this, arg);
1672    }
1673  },
1674  unregisterListeners: function() {
1675    $H(this._listeners).each(function(pair) {
1676      if (!this.options.externalControlOnly)
1677        this.element.stopObserving(pair.key, pair.value);
1678      if (this.options.externalControl)
1679        this.options.externalControl.stopObserving(pair.key, pair.value);
1680    }.bind(this));
1681  },
1682  wrapUp: function(transport) {
1683    this.leaveEditMode();
1684    // Can't use triggerCallback due to backward compatibility: requires
1685    // binding + direct element
1686    this._boundComplete(transport, this.element);
1687  }
1688});
1689
1690Object.extend(Ajax.InPlaceEditor.prototype, {
1691  dispose: Ajax.InPlaceEditor.prototype.destroy
1692});
1693
1694Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
1695  initialize: function($super, element, url, options) {
1696    this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
1697    $super(element, url, options);
1698  },
1699
1700  createEditField: function() {
1701    var list = document.createElement('select');
1702    list.name = this.options.paramName;
1703    list.size = 1;
1704    this._controls.editor = list;
1705    this._collection = this.options.collection || [];
1706    if (this.options.loadCollectionURL)
1707      this.loadCollection();
1708    else
1709      this.checkForExternalText();
1710    this._form.appendChild(this._controls.editor);
1711  },
1712
1713  loadCollection: function() {
1714    this._form.addClassName(this.options.loadingClassName);
1715    this.showLoadingText(this.options.loadingCollectionText);
1716    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1717    Object.extend(options, {
1718      parameters: 'editorId=' + encodeURIComponent(this.element.id),
1719      onComplete: Prototype.emptyFunction,
1720      onSuccess: function(transport) {
1721        var js = transport.responseText.strip();
1722        if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
1723          throw('Server returned an invalid collection representation.');
1724        this._collection = eval(js);
1725        this.checkForExternalText();
1726      }.bind(this),
1727      onFailure: this.onFailure
1728    });
1729    new Ajax.Request(this.options.loadCollectionURL, options);
1730  },
1731
1732  showLoadingText: function(text) {
1733    this._controls.editor.disabled = true;
1734    var tempOption = this._controls.editor.firstChild;
1735    if (!tempOption) {
1736      tempOption = document.createElement('option');
1737      tempOption.value = '';
1738      this._controls.editor.appendChild(tempOption);
1739      tempOption.selected = true;
1740    }
1741    tempOption.update((text || '').stripScripts().stripTags());
1742  },
1743
1744  checkForExternalText: function() {
1745    this._text = this.getText();
1746    if (this.options.loadTextURL)
1747      this.loadExternalText();
1748    else
1749      this.buildOptionList();
1750  },
1751
1752  loadExternalText: function() {
1753    this.showLoadingText(this.options.loadingText);
1754    var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
1755    Object.extend(options, {
1756      parameters: 'editorId=' + encodeURIComponent(this.element.id),
1757      onComplete: Prototype.emptyFunction,
1758      onSuccess: function(transport) {
1759        this._text = transport.responseText.strip();
1760        this.buildOptionList();
1761      }.bind(this),
1762      onFailure: this.onFailure
1763    });
1764    new Ajax.Request(this.options.loadTextURL, options);
1765  },
1766
1767  buildOptionList: function() {
1768    this._form.removeClassName(this.options.loadingClassName);
1769    this._collection = this._collection.map(function(entry) {
1770      return 2 === entry.length ? entry : [entry, entry].flatten();
1771    });
1772    var marker = ('value' in this.options) ? this.options.value : this._text;
1773    var textFound = this._collection.any(function(entry) {
1774      return entry[0] == marker;
1775    }.bind(this));
1776    this._controls.editor.update('');
1777    var option;
1778    this._collection.each(function(entry, index) {
1779      option = document.createElement('option');
1780      option.value = entry[0];
1781      option.selected = textFound ? entry[0] == marker : 0 == index;
1782      option.appendChild(document.createTextNode(entry[1]));
1783      this._controls.editor.appendChild(option);
1784    }.bind(this));
1785    this._controls.editor.disabled = false;
1786    Field.scrollFreeActivate(this._controls.editor);
1787  }
1788});
1789
1790//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
1791//**** This only  exists for a while,  in order to  let ****
1792//**** users adapt to  the new API.  Read up on the new ****
1793//**** API and convert your code to it ASAP!            ****
1794
1795Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
1796  if (!options) return;
1797  function fallback(name, expr) {
1798    if (name in options || expr === undefined) return;
1799    options[name] = expr;
1800  };
1801  fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
1802    options.cancelLink == options.cancelButton == false ? false : undefined)));
1803  fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
1804    options.okLink == options.okButton == false ? false : undefined)));
1805  fallback('highlightColor', options.highlightcolor);
1806  fallback('highlightEndColor', options.highlightendcolor);
1807};
1808
1809Object.extend(Ajax.InPlaceEditor, {
1810  DefaultOptions: {
1811    ajaxOptions: { },
1812    autoRows: 3,                                // Use when multi-line w/ rows == 1
1813    cancelControl: 'link',                      // 'link'|'button'|false
1814    cancelText: 'cancel',
1815    clickToEditText: 'Click to edit',
1816    externalControl: null,                      // id|elt
1817    externalControlOnly: false,
1818    fieldPostCreation: 'activate',              // 'activate'|'focus'|false
1819    formClassName: 'inplaceeditor-form',
1820    formId: null,                               // id|elt
1821    highlightColor: '#ffff99',
1822    highlightEndColor: '#ffffff',
1823    hoverClassName: '',
1824    htmlResponse: true,
1825    loadingClassName: 'inplaceeditor-loading',
1826    loadingText: 'Loading...',
1827    okControl: 'button',                        // 'link'|'button'|false
1828    okText: 'ok',
1829    paramName: 'value',
1830    rows: 1,                                    // If 1 and multi-line, uses autoRows
1831    savingClassName: 'inplaceeditor-saving',
1832    savingText: 'Saving...',
1833    size: 0,
1834    stripLoadedTextTags: false,
1835    submitOnBlur: false,
1836    textAfterControls: '',
1837    textBeforeControls: '',
1838    textBetweenControls: ''
1839  },
1840  DefaultCallbacks: {
1841    callback: function(form) {
1842      return Form.serialize(form);
1843    },
1844    onComplete: function(transport, element) {
1845      // For backward compatibility, this one is bound to the IPE, and passes
1846      // the element directly.  It was too often customized, so we don't break it.
1847      new Effect.Highlight(element, {
1848        startcolor: this.options.highlightColor, keepBackgroundImage: true });
1849    },
1850    onEnterEditMode: null,
1851    onEnterHover: function(ipe) {
1852      ipe.element.style.backgroundColor = ipe.options.highlightColor;
1853      if (ipe._effect)
1854        ipe._effect.cancel();
1855    },
1856    onFailure: function(transport, ipe) {
1857      alert('Error communication with the server: ' + transport.responseText.stripTags());
1858    },
1859    onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
1860    onLeaveEditMode: null,
1861    onLeaveHover: function(ipe) {
1862      ipe._effect = new Effect.Highlight(ipe.element, {
1863        startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
1864        restorecolor: ipe._originalBackground, keepBackgroundImage: true
1865      });
1866    }
1867  },
1868  Listeners: {
1869    click: 'enterEditMode',
1870    keydown: 'checkForEscapeOrReturn',
1871    mouseover: 'enterHover',
1872    mouseout: 'leaveHover'
1873  }
1874});
1875
1876Ajax.InPlaceCollectionEditor.DefaultOptions = {
1877  loadingCollectionText: 'Loading options...'
1878};
1879
1880// Delayed observer, like Form.Element.Observer,
1881// but waits for delay after last key input
1882// Ideal for live-search fields
1883
1884Form.Element.DelayedObserver = Class.create({
1885  initialize: function(element, delay, callback) {
1886    this.delay     = delay || 0.5;
1887    this.element   = $(element);
1888    this.callback  = callback;
1889    this.timer     = null;
1890    this.lastValue = $F(this.element);
1891    Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
1892  },
1893  delayedListener: function(event) {
1894    if(this.lastValue == $F(this.element)) return;
1895    if(this.timer) clearTimeout(this.timer);
1896    this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
1897    this.lastValue = $F(this.element);
1898  },
1899  onTimerEvent: function() {
1900    this.timer = null;
1901    this.callback(this.element, $F(this.element));
1902  }
1903});
1904// script.aculo.us slider.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
1905
1906// Copyright (c) 2005-2010 Marty Haught, Thomas Fuchs
1907//
1908// script.aculo.us is freely distributable under the terms of an MIT-style license.
1909// For details, see the script.aculo.us web site: http://script.aculo.us/
1910
1911if (!Control) var Control = { };
1912
1913// options:
1914//  axis: 'vertical', or 'horizontal' (default)
1915//
1916// callbacks:
1917//  onChange(value)
1918//  onSlide(value)
1919Control.Slider = Class.create({
1920  initialize: function(handle, track, options) {
1921    var slider = this;
1922
1923    if (Object.isArray(handle)) {
1924      this.handles = handle.collect( function(e) { return $(e) });
1925    } else {
1926      this.handles = [$(handle)];
1927    }
1928
1929    this.track   = $(track);
1930    this.options = options || { };
1931
1932    this.axis      = this.options.axis || 'horizontal';
1933    this.increment = this.options.increment || 1;
1934    this.step      = parseInt(this.options.step || '1');
1935    this.range     = this.options.range || $R(0,1);
1936
1937    this.value     = 0; // assure backwards compat
1938    this.values    = this.handles.map( function() { return 0 });
1939    this.spans     = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
1940    this.options.startSpan = $(this.options.startSpan || null);
1941    this.options.endSpan   = $(this.options.endSpan || null);
1942
1943    this.restricted = this.options.restricted || false;
1944
1945    this.maximum   = this.options.maximum || this.range.end;
1946    this.minimum   = this.options.minimum || this.range.start;
1947
1948    // Will be used to align the handle onto the track, if necessary
1949    this.alignX = parseInt(this.options.alignX || '0');
1950    this.alignY = parseInt(this.options.alignY || '0');
1951
1952    this.trackLength = this.maximumOffset() - this.minimumOffset();
1953
1954    this.handleLength = this.isVertical() ?
1955      (this.handles[0].offsetHeight != 0 ?
1956        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
1957      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
1958        this.handles[0].style.width.replace(/px$/,""));
1959
1960    this.active   = false;
1961    this.dragging = false;
1962    this.disabled = false;
1963
1964    if (this.options.disabled) this.setDisabled();
1965
1966    // Allowed values array
1967    this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
1968    if (this.allowedValues) {
1969      this.minimum = this.allowedValues.min();
1970      this.maximum = this.allowedValues.max();
1971    }
1972
1973    this.eventMouseDown = this.startDrag.bindAsEventListener(this);
1974    this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
1975    this.eventMouseMove = this.update.bindAsEventListener(this);
1976
1977    // Initialize handles in reverse (make sure first handle is active)
1978    this.handles.each( function(h,i) {
1979      i = slider.handles.length-1-i;
1980      slider.setValue(parseFloat(
1981        (Object.isArray(slider.options.sliderValue) ?
1982          slider.options.sliderValue[i] : slider.options.sliderValue) ||
1983         slider.range.start), i);
1984      h.makePositioned().observe("mousedown", slider.eventMouseDown);
1985    });
1986
1987    this.track.observe("mousedown", this.eventMouseDown);
1988    document.observe("mouseup", this.eventMouseUp);
1989    document.observe("mousemove", this.eventMouseMove);
1990
1991    this.initialized = true;
1992  },
1993  dispose: function() {
1994    var slider = this;
1995    Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
1996    Event.stopObserving(document, "mouseup", this.eventMouseUp);
1997    Event.stopObserving(document, "mousemove", this.eventMouseMove);
1998    this.handles.each( function(h) {
1999      Event.stopObserving(h, "mousedown", slider.eventMouseDown);
2000    });
2001  },
2002  setDisabled: function(){
2003    this.disabled = true;
2004  },
2005  setEnabled: function(){
2006    this.disabled = false;
2007  },
2008  getNearestValue: function(value){
2009    if (this.allowedValues){
2010      if (value >= this.allowedValues.max()) return(this.allowedValues.max());
2011      if (value <= this.allowedValues.min()) return(this.allowedValues.min());
2012
2013      var offset = Math.abs(this.allowedValues[0] - value);
2014      var newValue = this.allowedValues[0];
2015      this.allowedValues.each( function(v) {
2016        var currentOffset = Math.abs(v - value);
2017        if (currentOffset <= offset){
2018          newValue = v;
2019          offset = currentOffset;
2020        }
2021      });
2022      return newValue;
2023    }
2024    if (value > this.range.end) return this.range.end;
2025    if (value < this.range.start) return this.range.start;
2026    return value;
2027  },
2028  setValue: function(sliderValue, handleIdx){
2029    if (!this.active) {
2030      this.activeHandleIdx = handleIdx || 0;
2031      this.activeHandle    = this.handles[this.activeHandleIdx];
2032      this.updateStyles();
2033    }
2034    handleIdx = handleIdx || this.activeHandleIdx || 0;
2035    if (this.initialized && this.restricted) {
2036      if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
2037        sliderValue = this.values[handleIdx-1];
2038      if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
2039        sliderValue = this.values[handleIdx+1];
2040    }
2041    sliderValue = this.getNearestValue(sliderValue);
2042    this.values[handleIdx] = sliderValue;
2043    this.value = this.values[0]; // assure backwards compat
2044
2045    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
2046      this.translateToPx(sliderValue);
2047
2048    this.drawSpans();
2049    if (!this.dragging || !this.event) this.updateFinished();
2050  },
2051  setValueBy: function(delta, handleIdx) {
2052    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
2053      handleIdx || this.activeHandleIdx || 0);
2054  },
2055  translateToPx: function(value) {
2056    return Math.round(
2057      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
2058      (value - this.range.start)) + "px";
2059  },
2060  translateToValue: function(offset) {
2061    return ((offset/(this.trackLength-this.handleLength) *
2062      (this.range.end-this.range.start)) + this.range.start);
2063  },
2064  getRange: function(range) {
2065    var v = this.values.sortBy(Prototype.K);
2066    range = range || 0;
2067    return $R(v[range],v[range+1]);
2068  },
2069  minimumOffset: function(){
2070    return(this.isVertical() ? this.alignY : this.alignX);
2071  },
2072  maximumOffset: function(){
2073    return(this.isVertical() ?
2074      (this.track.offsetHeight != 0 ? this.track.offsetHeight :
2075        this.track.style.height.replace(/px$/,"")) - this.alignY :
2076      (this.track.offsetWidth != 0 ? this.track.offsetWidth :
2077        this.track.style.width.replace(/px$/,"")) - this.alignX);
2078  },
2079  isVertical:  function(){
2080    return (this.axis == 'vertical');
2081  },
2082  drawSpans: function() {
2083    var slider = this;
2084    if (this.spans)
2085      $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
2086    if (this.options.startSpan)
2087      this.setSpan(this.options.startSpan,
2088        $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
2089    if (this.options.endSpan)
2090      this.setSpan(this.options.endSpan,
2091        $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
2092  },
2093  setSpan: function(span, range) {
2094    if (this.isVertical()) {
2095      span.style.top = this.translateToPx(range.start);
2096      span.style.height = this.translateToPx(range.end - range.start + this.range.start);
2097    } else {
2098      span.style.left = this.translateToPx(range.start);
2099      span.style.width = this.translateToPx(range.end - range.start + this.range.start);
2100    }
2101  },
2102  updateStyles: function() {
2103    this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
2104    Element.addClassName(this.activeHandle, 'selected');
2105  },
2106  startDrag: function(event) {
2107    if (Event.isLeftClick(event)) {
2108      if (!this.disabled){
2109        this.active = true;
2110
2111        var handle = Event.element(event);
2112        var pointer  = [Event.pointerX(event), Event.pointerY(event)];
2113        var track = handle;
2114        if (track==this.track) {
2115          var offsets  = this.track.cumulativeOffset();
2116          this.event = event;
2117          this.setValue(this.translateToValue(
2118           (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
2119          ));
2120          var offsets  = this.activeHandle.cumulativeOffset();
2121          this.offsetX = (pointer[0] - offsets[0]);
2122          this.offsetY = (pointer[1] - offsets[1]);
2123        } else {
2124          // find the handle (prevents issues with Safari)
2125          while((this.handles.indexOf(handle) == -1) && handle.parentNode)
2126            handle = handle.parentNode;
2127
2128          if (this.handles.indexOf(handle)!=-1) {
2129            this.activeHandle    = handle;
2130            this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
2131            this.updateStyles();
2132
2133            var offsets  = this.activeHandle.cumulativeOffset();
2134            this.offsetX = (pointer[0] - offsets[0]);
2135            this.offsetY = (pointer[1] - offsets[1]);
2136          }
2137        }
2138      }
2139      Event.stop(event);
2140    }
2141  },
2142  update: function(event) {
2143   if (this.active) {
2144      if (!this.dragging) this.dragging = true;
2145      this.draw(event);
2146      if (Prototype.Browser.WebKit) window.scrollBy(0,0);
2147      Event.stop(event);
2148   }
2149  },
2150  draw: function(event) {
2151    var pointer = [Event.pointerX(event), Event.pointerY(event)];
2152    var offsets = this.track.cumulativeOffset();
2153    pointer[0] -= this.offsetX + offsets[0];
2154    pointer[1] -= this.offsetY + offsets[1];
2155    this.event = event;
2156    this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
2157    if (this.initialized && this.options.onSlide)
2158      this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
2159  },
2160  endDrag: function(event) {
2161    if (this.active && this.dragging) {
2162      this.finishDrag(event, true);
2163      Event.stop(event);
2164    }
2165    this.active = false;
2166    this.dragging = false;
2167  },
2168  finishDrag: function(event, success) {
2169    this.active = false;
2170    this.dragging = false;
2171    this.updateFinished();
2172  },
2173  updateFinished: function() {
2174    if (this.initialized && this.options.onChange)
2175      this.options.onChange(this.values.length>1 ? this.values : this.value, this);
2176    this.event = null;
2177  }
2178});
2179/**
2180 * Magento
2181 *
2182 * NOTICE OF LICENSE
2183 *
2184 * This source file is subject to the Academic Free License (AFL 3.0)
2185 * that is bundled with this package in the file LICENSE_AFL.txt.
2186 * It is also available through the world-wide-web at this URL:
2187 * http://opensource.org/licenses/afl-3.0.php
2188 * If you did not receive a copy of the license and are unable to
2189 * obtain it through the world-wide-web, please send an email
2190 * to [email protected] so we can send you a copy immediately.
2191 *
2192 * DISCLAIMER
2193 *
2194 * Do not edit or add to this file if you wish to upgrade Magento to newer
2195 * versions in the future. If you wish to customize Magento for your
2196 * needs please refer to http://www.magentocommerce.com for more information.
2197 *
2198 * @category    Varien
2199 * @package     js
2200 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
2201 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
2202 */
2203function popWin(url,win,para) {
2204    var win = window.open(url,win,para);
2205    win.focus();
2206}
2207
2208function setLocation(url){
2209    window.location.href = url;
2210}
2211
2212function setPLocation(url, setFocus){
2213    if( setFocus ) {
2214        window.opener.focus();
2215    }
2216    window.opener.location.href = url;
2217}
2218
2219function setLanguageCode(code, fromCode){
2220    //TODO: javascript cookies have different domain and path than php cookies
2221    var href = window.location.href;
2222    var after = '', dash;
2223    if (dash = href.match(/\#(.*)$/)) {
2224        href = href.replace(/\#(.*)$/, '');
2225        after = dash[0];
2226    }
2227
2228    if (href.match(/[?]/)) {
2229        var re = /([?&]store=)[a-z0-9_]*/;
2230        if (href.match(re)) {
2231            href = href.replace(re, '$1'+code);
2232        } else {
2233            href += '&store='+code;
2234        }
2235
2236        var re = /([?&]from_store=)[a-z0-9_]*/;
2237        if (href.match(re)) {
2238            href = href.replace(re, '');
2239        }
2240    } else {
2241        href += '?store='+code;
2242    }
2243    if (typeof(fromCode) != 'undefined') {
2244        href += '&from_store='+fromCode;
2245    }
2246    href += after;
2247
2248    setLocation(href);
2249}
2250
2251/**
2252 * Add classes to specified elements.
2253 * Supported classes are: 'odd', 'even', 'first', 'last'
2254 *
2255 * @param elements - array of elements to be decorated
2256 * [@param decorateParams] - array of classes to be set. If omitted, all available will be used
2257 */
2258function decorateGeneric(elements, decorateParams)
2259{
2260    var allSupportedParams = ['odd', 'even', 'first', 'last'];
2261    var _decorateParams = {};
2262    var total = elements.length;
2263
2264    if (total) {
2265        // determine params called
2266        if (typeof(decorateParams) == 'undefined') {
2267            decorateParams = allSupportedParams;
2268        }
2269        if (!decorateParams.length) {
2270            return;
2271        }
2272        for (var k in allSupportedParams) {
2273            _decorateParams[allSupportedParams[k]] = false;
2274        }
2275        for (var k in decorateParams) {
2276            _decorateParams[decorateParams[k]] = true;
2277        }
2278
2279        // decorate elements
2280        // elements[0].addClassName('first'); // will cause bug in IE (#5587)
2281        if (_decorateParams.first) {
2282            Element.addClassName(elements[0], 'first');
2283        }
2284        if (_decorateParams.last) {
2285            Element.addClassName(elements[total-1], 'last');
2286        }
2287        for (var i = 0; i < total; i++) {
2288            if ((i + 1) % 2 == 0) {
2289                if (_decorateParams.even) {
2290                    Element.addClassName(elements[i], 'even');
2291                }
2292            }
2293            else {
2294                if (_decorateParams.odd) {
2295                    Element.addClassName(elements[i], 'odd');
2296                }
2297            }
2298        }
2299    }
2300}
2301
2302/**
2303 * Decorate table rows and cells, tbody etc
2304 * @see decorateGeneric()
2305 */
2306function decorateTable(table, options) {
2307    var table = $(table);
2308    if (table) {
2309        // set default options
2310        var _options = {
2311            'tbody'    : false,
2312            'tbody tr' : ['odd', 'even', 'first', 'last'],
2313            'thead tr' : ['first', 'last'],
2314            'tfoot tr' : ['first', 'last'],
2315            'tr td'    : ['last']
2316        };
2317        // overload options
2318        if (typeof(options) != 'undefined') {
2319            for (var k in options) {
2320                _options[k] = options[k];
2321            }
2322        }
2323        // decorate
2324        if (_options['tbody']) {
2325            decorateGeneric(table.select('tbody'), _options['tbody']);
2326        }
2327        if (_options['tbody tr']) {
2328            decorateGeneric(table.select('tbody tr'), _options['tbody tr']);
2329        }
2330        if (_options['thead tr']) {
2331            decorateGeneric(table.select('thead tr'), _options['thead tr']);
2332        }
2333        if (_options['tfoot tr']) {
2334            decorateGeneric(table.select('tfoot tr'), _options['tfoot tr']);
2335        }
2336        if (_options['tr td']) {
2337            var allRows = table.select('tr');
2338            if (allRows.length) {
2339                for (var i = 0; i < allRows.length; i++) {
2340                    decorateGeneric(allRows[i].getElementsByTagName('TD'), _options['tr td']);
2341                }
2342            }
2343        }
2344    }
2345}
2346
2347/**
2348 * Set "odd", "even" and "last" CSS classes for list items
2349 * @see decorateGeneric()
2350 */
2351function decorateList(list, nonRecursive) {
2352    if ($(list)) {
2353        if (typeof(nonRecursive) == 'undefined') {
2354            var items = $(list).select('li')
2355        }
2356        else {
2357            var items = $(list).childElements();
2358        }
2359        decorateGeneric(items, ['odd', 'even', 'last']);
2360    }
2361}
2362
2363/**
2364 * Set "odd", "even" and "last" CSS classes for list items
2365 * @see decorateGeneric()
2366 */
2367function decorateDataList(list) {
2368    list = $(list);
2369    if (list) {
2370        decorateGeneric(list.select('dt'), ['odd', 'even', 'last']);
2371        decorateGeneric(list.select('dd'), ['odd', 'even', 'last']);
2372    }
2373}
2374
2375/**
2376 * Parse SID and produces the correct URL
2377 */
2378function parseSidUrl(baseUrl, urlExt) {
2379    var sidPos = baseUrl.indexOf('/?SID=');
2380    var sid = '';
2381    urlExt = (urlExt != undefined) ? urlExt : '';
2382
2383    if(sidPos > -1) {
2384        sid = '?' + baseUrl.substring(sidPos + 2);
2385        baseUrl = baseUrl.substring(0, sidPos + 1);
2386    }
2387
2388    return baseUrl+urlExt+sid;
2389}
2390
2391/**
2392 * Formats currency using patern
2393 * format - JSON (pattern, decimal, decimalsDelimeter, groupsDelimeter)
2394 * showPlus - true (always show '+'or '-'),
2395 *      false (never show '-' even if number is negative)
2396 *      null (show '-' if number is negative)
2397 */
2398
2399function formatCurrency(price, format, showPlus){
2400    var precision = isNaN(format.precision = Math.abs(format.precision)) ? 2 : format.precision;
2401    var requiredPrecision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;
2402
2403    //precision = (precision > requiredPrecision) ? precision : requiredPrecision;
2404    //for now we don't need this difference so precision is requiredPrecision
2405    precision = requiredPrecision;
2406
2407    var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired;
2408
2409    var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol;
2410    var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol;
2411    var groupLength = format.groupLength == undefined ? 3 : format.groupLength;
2412
2413    var s = '';
2414
2415    if (showPlus == undefined || showPlus == true) {
2416        s = price < 0 ? "-" : ( showPlus ? "+" : "");
2417    } else if (showPlus == false) {
2418        s = '';
2419    }
2420
2421    var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + "";
2422    var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0;
2423    while (pad) { i = '0' + i; pad--; }
2424    j = (j = i.length) > groupLength ? j % groupLength : 0;
2425    re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g");
2426
2427    /**
2428     * replace(/-/, 0) is only for fixing Safari bug which appears
2429     * when Math.abs(0).toFixed() executed on "0" number.
2430     * Result is "0.-0" :(
2431     */
2432    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) : "")
2433    var pattern = '';
2434    if (format.pattern.indexOf('{sign}') == -1) {
2435        pattern = s + format.pattern;
2436    } else {
2437        pattern = format.pattern.replace('{sign}', s);
2438    }
2439
2440    return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
2441};
2442
2443function expandDetails(el, childClass) {
2444    if (Element.hasClassName(el,'show-details')) {
2445        $$(childClass).each(function(item){item.hide()});
2446        Element.removeClassName(el,'show-details');
2447    }
2448    else {
2449        $$(childClass).each(function(item){item.show()});
2450        Element.addClassName(el,'show-details');
2451    }
2452}
2453
2454// Version 1.0
2455var isIE = navigator.appVersion.match(/MSIE/) == "MSIE";
2456
2457if (!window.Varien)
2458    var Varien = new Object();
2459
2460Varien.showLoading = function(){
2461    var loader = $('loading-process');
2462    loader && loader.show();
2463}
2464Varien.hideLoading = function(){
2465    var loader = $('loading-process');
2466    loader && loader.hide();
2467}
2468Varien.GlobalHandlers = {
2469    onCreate: function() {
2470        Varien.showLoading();
2471    },
2472
2473    onComplete: function() {
2474        if(Ajax.activeRequestCount == 0) {
2475            Varien.hideLoading();
2476        }
2477    }
2478};
2479
2480Ajax.Responders.register(Varien.GlobalHandlers);
2481
2482/**
2483 * Quick Search form client model
2484 */
2485Varien.searchForm = Class.create();
2486Varien.searchForm.prototype = {
2487    initialize : function(form, field, emptyText){
2488        this.form   = $(form);
2489        this.field  = $(field);
2490        this.emptyText = emptyText;
2491
2492        Event.observe(this.form,  'submit', this.submit.bind(this));
2493        Event.observe(this.field, 'focus', this.focus.bind(this));
2494        Event.observe(this.field, 'blur', this.blur.bind(this));
2495        this.blur();
2496    },
2497
2498    submit : function(event){
2499        if (this.field.value == this.emptyText || this.field.value == ''){
2500            Event.stop(event);
2501            return false;
2502        }
2503        return true;
2504    },
2505
2506    focus : function(event){
2507        if(this.field.value==this.emptyText){
2508            this.field.value='';
2509        }
2510
2511    },
2512
2513    blur : function(event){
2514        if(this.field.value==''){
2515            this.field.value=this.emptyText;
2516        }
2517    },
2518
2519    initAutocomplete : function(url, destinationElement){
2520        new Ajax.Autocompleter(
2521            this.field,
2522            destinationElement,
2523            url,
2524            {
2525                paramName: this.field.name,
2526                method: 'get',
2527                minChars: 2,
2528                updateElement: this._selectAutocompleteItem.bind(this),
2529                onShow : function(element, update) {
2530                    if(!update.style.position || update.style.position=='absolute') {
2531                        update.style.position = 'absolute';
2532                        Position.clone(element, update, {
2533                            setHeight: false,
2534                            offsetTop: element.offsetHeight
2535                        });
2536                    }
2537                    Effect.Appear(update,{duration:0});
2538                }
2539
2540            }
2541        );
2542    },
2543
2544    _selectAutocompleteItem : function(element){
2545        if(element.title){
2546            this.field.value = element.title;
2547        }
2548        this.form.submit();
2549    }
2550}
2551
2552Varien.Tabs = Class.create();
2553Varien.Tabs.prototype = {
2554  initialize: function(selector) {
2555    var self=this;
2556    $$(selector+' a').each(this.initTab.bind(this));
2557  },
2558
2559  initTab: function(el) {
2560      el.href = 'javascript:void(0)';
2561      if ($(el.parentNode).hasClassName('active')) {
2562        this.showContent(el);
2563      }
2564      el.observe('click', this.showContent.bind(this, el));
2565  },
2566
2567  showContent: function(a) {
2568    var li = $(a.parentNode), ul = $(li.parentNode);
2569    ul.getElementsBySelector('li', 'ol').each(function(el){
2570      var contents = $(el.id+'_contents');
2571      if (el==li) {
2572        el.addClassName('active');
2573        contents.show();
2574      } else {
2575        el.removeClassName('active');
2576        contents.hide();
2577      }
2578    });
2579  }
2580}
2581
2582Varien.DateElement = Class.create();
2583Varien.DateElement.prototype = {
2584    initialize: function(type, content, required, format) {
2585        if (type == 'id') {
2586            // id prefix
2587            this.day    = $(content + 'day');
2588            this.month  = $(content + 'month');
2589            this.year   = $(content + 'year');
2590            this.full   = $(content + 'full');
2591            this.advice = $(content + 'date-advice');
2592        } else if (type == 'container') {
2593            // content must be container with data
2594            this.day    = content.day;
2595            this.month  = content.month;
2596            this.year   = content.year;
2597            this.full   = content.full;
2598            this.advice = content.advice;
2599        } else {
2600            return;
2601        }
2602
2603        this.required = required;
2604        this.format   = format;
2605
2606        this.day.addClassName('validate-custom');
2607        this.day.validate = this.validate.bind(this);
2608        this.month.addClassName('validate-custom');
2609        this.month.validate = this.validate.bind(this);
2610        this.year.addClassName('validate-custom');
2611        this.year.validate = this.validate.bind(this);
2612
2613        this.setDateRange(false, false);
2614        this.year.setAttribute('autocomplete','off');
2615
2616        this.advice.hide();
2617    },
2618    validate: function() {
2619        var error = false,
2620            day   = parseInt(this.day.value, 10)   || 0,
2621            month = parseInt(this.month.value, 10) || 0,
2622            year  = parseInt(this.year.value, 10)  || 0;
2623        if (this.day.value.strip().empty()
2624            && this.month.value.strip().empty()
2625            && this.year.value.strip().empty()
2626        ) {
2627            if (this.required) {
2628                error = 'This date is a required value.';
2629            } else {
2630                this.full.value = '';
2631            }
2632        } else if (!day || !month || !year) {
2633            error = 'Please enter a valid full date.';
2634        } else {
2635            var date = new Date, countDaysInMonth = 0, errorType = null;
2636            date.setYear(year);date.setMonth(month-1);date.setDate(32);
2637            countDaysInMonth = 32 - date.getDate();
2638            if(!countDaysInMonth || countDaysInMonth>31) countDaysInMonth = 31;
2639
2640            if (day<1 || day>countDaysInMonth) {
2641                errorType = 'day';
2642                error = 'Please enter a valid day (1-%d).';
2643            } else if (month<1 || month>12) {
2644                errorType = 'month';
2645                error = 'Please enter a valid month (1-12).';
2646            } else {
2647                if(day % 10 == day) this.day.value = '0'+day;
2648                if(month % 10 == month) this.month.value = '0'+month;
2649                this.full.value = this.format.replace(/%[mb]/i, this.month.value).replace(/%[de]/i, this.day.value).replace(/%y/i, this.year.value);
2650                var testFull = this.month.value + '/' + this.day.value + '/'+ this.year.value;
2651                var test = new Date(testFull);
2652                if (isNaN(test)) {
2653                    error = 'Please enter a valid date.';
2654                } else {
2655                    this.setFullDate(test);
2656                }
2657            }
2658            var valueError = false;
2659            if (!error && !this.validateData()){//(year<1900 || year>curyear) {
2660                errorType = this.validateDataErrorType;//'year';
2661                valueError = this.validateDataErrorText;//'Please enter a valid year (1900-%d).';
2662                error = valueError;
2663            }
2664        }
2665
2666        if (error !== false) {
2667            try {
2668                error = Translator.translate(error);
2669            }
2670            catch (e) {}
2671            if (!valueError) {
2672                this.advice.innerHTML = error.replace('%d', countDaysInMonth);
2673            } else {
2674                this.advice.innerHTML = this.errorTextModifier(error);
2675            }
2676            this.advice.show();
2677            return false;
2678        }
2679
2680        // fixing elements class
2681        this.day.removeClassName('validation-failed');
2682        this.month.removeClassName('validation-failed');
2683        this.year.removeClassName('validation-failed');
2684
2685        this.advice.hide();
2686        return true;
2687    },
2688    validateData: function() {
2689        var year = this.fullDate.getFullYear();
2690        var date = new Date;
2691        this.curyear = date.getFullYear();
2692        return (year>=1900 && year<=this.curyear);
2693    },
2694    validateDataErrorType: 'year',
2695    validateDataErrorText: 'Please enter a valid year (1900-%d).',
2696    errorTextModifier: function(text) {
2697        return text.replace('%d', this.curyear);
2698    },
2699    setDateRange: function(minDate, maxDate) {
2700        this.minDate = minDate;
2701        this.maxDate = maxDate;
2702    },
2703    setFullDate: function(date) {
2704        this.fullDate = date;
2705    }
2706};
2707
2708Varien.DOB = Class.create();
2709Varien.DOB.prototype = {
2710    initialize: function(selector, required, format) {
2711        var el = $$(selector)[0];
2712        var container       = {};
2713        container.day       = Element.select(el, '.dob-day input')[0];
2714        container.month     = Element.select(el, '.dob-month input')[0];
2715        container.year      = Element.select(el, '.dob-year input')[0];
2716        container.full      = Element.select(el, '.dob-full input')[0];
2717        container.advice    = Element.select(el, '.validation-advice')[0];
2718
2719        new Varien.DateElement('container', container, required, format);
2720    }
2721};
2722
2723Varien.dateRangeDate = Class.create();
2724Varien.dateRangeDate.prototype = Object.extend(new Varien.DateElement(), {
2725    validateData: function() {
2726        var validate = true;
2727        if (this.minDate || this.maxValue) {
2728            if (this.minDate) {
2729                this.minDate = new Date(this.minDate);
2730                this.minDate.setHours(0);
2731                if (isNaN(this.minDate)) {
2732                    this.minDate = new Date('1/1/1900');
2733                }
2734                validate = validate && (this.fullDate >= this.minDate)
2735            }
2736            if (this.maxDate) {
2737                this.maxDate = new Date(this.maxDate)
2738                this.minDate.setHours(0);
2739                if (isNaN(this.maxDate)) {
2740                    this.maxDate = new Date();
2741                }
2742                validate = validate && (this.fullDate <= this.maxDate)
2743            }
2744            if (this.maxDate && this.minDate) {
2745                this.validateDataErrorText = 'Please enter a valid date between %s and %s';
2746            } else if (this.maxDate) {
2747                this.validateDataErrorText = 'Please enter a valid date less than or equal to %s';
2748            } else if (this.minDate) {
2749                this.validateDataErrorText = 'Please enter a valid date equal to or greater than %s';
2750            } else {
2751                this.validateDataErrorText = '';
2752            }
2753        }
2754        return validate;
2755    },
2756    validateDataErrorText: 'Date should be between %s and %s',
2757    errorTextModifier: function(text) {
2758        if (this.minDate) {
2759            text = text.sub('%s', this.dateFormat(this.minDate));
2760        }
2761        if (this.maxDate) {
2762            text = text.sub('%s', this.dateFormat(this.maxDate));
2763        }
2764        return text;
2765    },
2766    dateFormat: function(date) {
2767        return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
2768    }
2769});
2770
2771Varien.FileElement = Class.create();
2772Varien.FileElement.prototype = {
2773    initialize: function (id) {
2774        this.fileElement = $(id);
2775        this.hiddenElement = $(id + '_value');
2776
2777        this.fileElement.observe('change', this.selectFile.bind(this));
2778    },
2779    selectFile: function(event) {
2780        this.hiddenElement.value = this.fileElement.getValue();
2781    }
2782};
2783
2784Validation.addAllThese([
2785    ['validate-custom', ' ', function(v,elm) {
2786        return elm.validate();
2787    }]
2788]);
2789
2790function truncateOptions() {
2791    $$('.truncated').each(function(element){
2792        Event.observe(element, 'mouseover', function(){
2793            if (element.down('div.truncated_full_value')) {
2794                element.down('div.truncated_full_value').addClassName('show')
2795            }
2796        });
2797        Event.observe(element, 'mouseout', function(){
2798            if (element.down('div.truncated_full_value')) {
2799                element.down('div.truncated_full_value').removeClassName('show')
2800            }
2801        });
2802
2803    });
2804}
2805Event.observe(window, 'load', function(){
2806   truncateOptions();
2807});
2808
2809Element.addMethods({
2810    getInnerText: function(element)
2811    {
2812        element = $(element);
2813        if(element.innerText && !Prototype.Browser.Opera) {
2814            return element.innerText
2815        }
2816        return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ').strip();
2817    }
2818});
2819
2820/*
2821if (!("console" in window) || !("firebug" in console))
2822{
2823    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
2824    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
2825
2826    window.console = {};
2827    for (var i = 0; i < names.length; ++i)
2828        window.console[names[i]] = function() {}
2829}
2830*/
2831
2832/**
2833 * Executes event handler on the element. Works with event handlers attached by Prototype,
2834 * in a browser-agnostic fashion.
2835 * @param element The element object
2836 * @param event Event name, like 'change'
2837 *
2838 * @example fireEvent($('my-input', 'click'));
2839 */
2840function fireEvent(element, event) {
2841    if (document.createEvent) {
2842        // dispatch for all browsers except IE before version 9
2843        var evt = document.createEvent("HTMLEvents");
2844        evt.initEvent(event, true, true ); // event type, bubbling, cancelable
2845        return element.dispatchEvent(evt);
2846    } else {
2847        // dispatch for IE before version 9
2848        var evt = document.createEventObject();
2849        return element.fireEvent('on' + event, evt)
2850    }
2851}
2852
2853/**
2854 * Returns more accurate results of floating-point modulo division
2855 * E.g.:
2856 * 0.6 % 0.2 = 0.19999999999999996
2857 * modulo(0.6, 0.2) = 0
2858 *
2859 * @param dividend
2860 * @param divisor
2861 */
2862function modulo(dividend, divisor)
2863{
2864    var epsilon = divisor / 10000;
2865    var remainder = dividend % divisor;
2866
2867    if (Math.abs(remainder - divisor) < epsilon || Math.abs(remainder) < epsilon) {
2868        remainder = 0;
2869    }
2870
2871    return remainder;
2872}
2873
2874/**
2875 * createContextualFragment is not supported in IE9. Adding its support.
2876 */
2877if ((typeof Range != "undefined") && !Range.prototype.createContextualFragment)
2878{
2879    Range.prototype.createContextualFragment = function(html)
2880    {
2881        var frag = document.createDocumentFragment(),
2882        div = document.createElement("div");
2883        frag.appendChild(div);
2884        div.outerHTML = html;
2885        return frag;
2886    };
2887}
2888
2889/**
2890 * Magento
2891 *
2892 * NOTICE OF LICENSE
2893 *
2894 * This source file is subject to the Academic Free License (AFL 3.0)
2895 * that is bundled with this package in the file LICENSE_AFL.txt.
2896 * It is also available through the world-wide-web at this URL:
2897 * http://opensource.org/licenses/afl-3.0.php
2898 * If you did not receive a copy of the license and are unable to
2899 * obtain it through the world-wide-web, please send an email
2900 * to [email protected] so we can send you a copy immediately.
2901 *
2902 * DISCLAIMER
2903 *
2904 * Do not edit or add to this file if you wish to upgrade Magento to newer
2905 * versions in the future. If you wish to customize Magento for your
2906 * needs please refer to http://www.magentocommerce.com for more information.
2907 *
2908 * @category    Varien
2909 * @package     js
2910 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
2911 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
2912 */ (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))}
2912,_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()}};
2913/**
2914 * Magento
2915 *
2916 * NOTICE OF LICENSE
2917 *
2918 * This source file is subject to the Academic Free License (AFL 3.0)
2919 * that is bundled with this package in the file LICENSE_AFL.txt.
2920 * It is also available through the world-wide-web at this URL:
2921 * http://opensource.org/licenses/afl-3.0.php
2922 * If you did not receive a copy of the license and are unable to
2923 * obtain it through the world-wide-web, please send an email
2924 * to [email protected] so we can send you a copy immediately.
2925 *
2926 * DISCLAIMER
2927 *
2928 * Do not edit or add to this file if you wish to upgrade Magento to newer
2929 * versions in the future. If you wish to customize Magento for your
2930 * needs please refer to http://www.magentocommerce.com for more information.
2931 *
2932 * @category    Varien
2933 * @package     js
2934 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
2935 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
2936 */
2937
2938/**
2939 * @classDescription simple Navigation with replacing old handlers
2940 * @param {String} id id of ul element with navigation lists
2941 * @param {Object} settings object with settings
2942 */
2943var mainNav = function() {
2944
2945    var main = {
2946        obj_nav :   $(arguments[0]) || $("nav"),
2947
2948        settings :  {
2949            show_delay      :   0,
2950            hide_delay      :   0,
2951            _ie6            :   /MSIE 6.+Win/.test(navigator.userAgent),
2952            _ie7            :   /MSIE 7.+Win/.test(navigator.userAgent)
2953        },
2954
2955        init :  function(obj, level) {
2956            obj.lists = obj.childElements();
2957            obj.lists.each(function(el,ind){
2958                main.handlNavElement(el);
2959                if((main.settings._ie6 || main.settings._ie7) && level){
2960                    main.ieFixZIndex(el, ind, obj.lists.size());
2961                }
2962            });
2963            if(main.settings._ie6 && !level){
2964                document.execCommand("BackgroundImageCache", false, true);
2965            }
2966        },
2967
2968        handlNavElement :   function(list) {
2969            if(list !== undefined){
2970                list.onmouseover = function(){
2971                    main.fireNavEvent(this,true);
2972                };
2973                list.onmouseout = function(){
2974                    main.fireNavEvent(this,false);
2975                };
2976                if(list.down("ul")){
2977                    main.init(list.down("ul"), true);
2978                }
2979            }
2980        },
2981
2982        ieFixZIndex : function(el, i, l) {
2983            if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){
2984                el.style.zIndex = l - i;
2985            } else {
2986                el.onmouseover = "null";
2987                el.onmouseout = "null";
2988            }
2989        },
2990
2991        fireNavEvent :  function(elm,ev) {
2992            if(ev){
2993                elm.addClassName("over");
2994                elm.down("a").addClassName("over");
2995                if (elm.childElements()[1]) {
2996                    main.show(elm.childElements()[1]);
2997                }
2998            } else {
2999                elm.removeClassName("over");
3000                elm.down("a").removeClassName("over");
3001                if (elm.childElements()[1]) {
3002                    main.hide(elm.childElements()[1]);
3003                }
3004            }
3005        },
3006
3007        show : function (sub_elm) {
3008            if (sub_elm.hide_time_id) {
3009                clearTimeout(sub_elm.hide_time_id);
3010            }
3011            sub_elm.show_time_id = setTimeout(function() {
3012                if (!sub_elm.hasClassName("shown-sub")) {
3013                    sub_elm.addClassName("shown-sub");
3014                }
3015            }, main.settings.show_delay);
3016        },
3017
3018        hide : function (sub_elm) {
3019            if (sub_elm.show_time_id) {
3020                clearTimeout(sub_elm.show_time_id);
3021            }
3022            sub_elm.hide_time_id = setTimeout(function(){
3023                if (sub_elm.hasClassName("shown-sub")) {
3024                    sub_elm.removeClassName("shown-sub");
3025                }
3026            }, main.settings.hide_delay);
3027        }
3028
3029    };
3030    if (arguments[1]) {
3031        main.settings = Object.extend(main.settings, arguments[1]);
3032    }
3033    if (main.obj_nav) {
3034        main.init(main.obj_nav, false);
3035    }
3036};
3037
3038document.observe("dom:loaded", function() {
3039    //run navigation without delays and with default id="#nav"
3040    //mainNav();
3041
3042    //run navigation with delays
3043    mainNav("nav", {"show_delay":"100","hide_delay":"100"});
3044});
3045
3046/**
3047 * Magento
3048 *
3049 * NOTICE OF LICENSE
3050 *
3051 * This source file is subject to the Academic Free License (AFL 3.0)
3052 * that is bundled with this package in the file LICENSE_AFL.txt.
3053 * It is also available through the world-wide-web at this URL:
3054 * http://opensource.org/licenses/afl-3.0.php
3055 * If you did not receive a copy of the license and are unable to
3056 * obtain it through the world-wide-web, please send an email
3057 * to [email protected] so we can send you a copy immediately.
3058 *
3059 * DISCLAIMER
3060 *
3061 * Do not edit or add to this file if you wish to upgrade Magento to newer
3062 * versions in the future. If you wish to customize Magento for your
3063 * needs please refer to http://www.magentocommerce.com for more information.
3064 *
3065 * @category    Mage
3066 * @package     js
3067 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
3068 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
3069 */
3070
3071var Translate = Class.create();
3072Translate.prototype = {
3073    initialize: function(data){
3074        this.data = $H(data);
3075    },
3076
3077    translate : function(){
3078        var args = arguments;
3079        var text = arguments[0];
3080
3081        if(this.data.get(text)){
3082            return this.data.get(text);
3083        }
3084        return text;
3085    },
3086    add : function() {
3087        if (arguments.length > 1) {
3088            this.data.set(arguments[0], arguments[1]);
3089        } else if (typeof arguments[0] =='object') {
3090            $H(arguments[0]).each(function (pair){
3091                this.data.set(pair.key, pair.value);
3092            }.bind(this));
3093        }
3094    }
3095}
3096
3097/**
3098 * Magento
3099 *
3100 * NOTICE OF LICENSE
3101 *
3102 * This source file is subject to the Academic Free License (AFL 3.0)
3103 * that is bundled with this package in the file LICENSE_AFL.txt.
3104 * It is also available through the world-wide-web at this URL:
3105 * http://opensource.org/licenses/afl-3.0.php
3106 * If you did not receive a copy of the license and are unable to
3107 * obtain it through the world-wide-web, please send an email
3108 * to [email protected] so we can send you a copy immediately.
3109 *
3110 * DISCLAIMER
3111 *
3112 * Do not edit or add to this file if you wish to upgrade Magento to newer
3113 * versions in the future. If you wish to customize Magento for your
3114 * needs please refer to http://www.magentocommerce.com for more information.
3115 *
3116 * @category    Mage
3117 * @package     js
3118 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
3119 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
3120 */
3121// old school cookie functions grabbed off the web
3122
3123if (!window.Mage) var Mage = {};
3124
3125Mage.Cookies = {};
3126Mage.Cookies.expires  = null;
3127Mage.Cookies.path     = '/';
3128Mage.Cookies.domain   = null;
3129Mage.Cookies.secure   = false;
3130Mage.Cookies.set = function(name, value){
3131     var argv = arguments;
3132     var argc = arguments.length;
3133     var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires;
3134     var path = (argc > 3) ? argv[3] : Mage.Cookies.path;
3135     var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain;
3136     var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure;
3137     document.cookie = name + "=" + escape (value) +
3138       ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
3139       ((path == null) ? "" : ("; path=" + path)) +
3140       ((domain == null) ? "" : ("; domain=" + domain)) +
3141       ((secure == true) ? "; secure" : "");
3142};
3143
3144Mage.Cookies.get = function(name){
3145    var arg = name + "=";
3146    var alen = arg.length;
3147    var clen = document.cookie.length;
3148    var i = 0;
3149    var j = 0;
3150    while(i < clen){
3151        j = i + alen;
3152        if (document.cookie.substring(i, j) == arg)
3153            return Mage.Cookies.getCookieVal(j);
3154        i = document.cookie.indexOf(" ", i) + 1;
3155        if(i == 0)
3156            break;
3157    }
3158    return null;
3159};
3160
3161Mage.Cookies.clear = function(name) {
3162  if(Mage.Cookies.get(name)){
3163    document.cookie = name + "=" +
3164    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
3165  }
3166};
3167
3168Mage.Cookies.getCookieVal = function(offset){
3169   var endstr = document.cookie.indexOf(";", offset);
3170   if(endstr == -1){
3171       endstr = document.cookie.length;
3172   }
3173   return unescape(document.cookie.substring(offset, endstr));
3174};
3175
3176/*! jQuery v1.8.3 jquery.com | jquery.org/license */�
vendor: 93,525 bytes, lines 3176-3177
3176
3177(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.
3177jQuery&&define("jquery",[],function(){return v})})(window);
3178jQuery.noConflict();
3179jQuery.noConflict();
3180/*!
3181 * jQuery resize event - v1.1 - 3/14/2010
3182 * http://benalman.com/projects/jquery-resize-plugin/
3183 * 
3184 * Copyright (c) 2010 "Cowboy" Ben Alman
3185 * Dual licensed under the MIT and GPL licenses.
3186 * http://benalman.com/about/license/
3187 */
3188
3189// Script: jQuery resize event
3190//
3191// *Version: 1.1, Last updated: 3/14/2010*
3192// 
3193// Project Home - http://benalman.com/projects/jquery-resize-plugin/
3194// GitHub       - http://github.com/cowboy/jquery-resize/
3195// Source       - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.js
3196// (Minified)   - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.min.js (1.0kb)
3197// 
3198// About: License
3199// 
3200// Copyright (c) 2010 "Cowboy" Ben Alman,
3201// Dual licensed under the MIT and GPL licenses.
3202// http://benalman.com/about/license/
3203// 
3204// About: Examples
3205// 
3206// This working example, complete with fully commented code, illustrates a few
3207// ways in which this plugin can be used.
3208// 
3209// resize event - http://benalman.com/code/projects/jquery-resize/examples/resize/
3210// 
3211// About: Support and Testing
3212// 
3213// Information about what version or versions of jQuery this plugin has been
3214// tested with, what browsers it has been tested in, and where the unit tests
3215// reside (so you can test it yourself).
3216// 
3217// jQuery Versions - 1.3.2, 1.4.1, 1.4.2
3218// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome, Opera 9.6-10.1.
3219// Unit Tests      - http://benalman.com/code/projects/jquery-resize/unit/
3220// 
3221// About: Release History
3222// 
3223// 1.1 - (3/14/2010) Fixed a minor bug that was causing the event to trigger
3224//       immediately after bind in some circumstances. Also changed $.fn.data
3225//       to $.data to improve performance.
3226// 1.0 - (2/10/2010) Initial release
3227
3228(function($,window,undefined){
3229  '$:nomunge'; // Used by YUI compressor.
3230  
3231  // A jQuery object containing all non-window elements to which the resize
3232  // event is bound.
3233  var elems = $([]),
3234    
3235    // Extend $.resize if it already exists, otherwise create it.
3236    jq_resize = $.resize = $.extend( $.resize, {} ),
3237    
3238    timeout_id,
3239    
3240    // Reused strings.
3241    str_setTimeout = 'setTimeout',
3242    str_resize = 'resize',
3243    str_data = str_resize + '-special-event',
3244    str_delay = 'delay',
3245    str_throttle = 'throttleWindow';
3246  
3247  // Property: jQuery.resize.delay
3248  // 
3249  // The numeric interval (in milliseconds) at which the resize event polling
3250  // loop executes. Defaults to 250.
3251  
3252  jq_resize[ str_delay ] = 250;
3253  
3254  // Property: jQuery.resize.throttleWindow
3255  // 
3256  // Throttle the native window object resize event to fire no more than once
3257  // every <jQuery.resize.delay> milliseconds. Defaults to true.
3258  // 
3259  // Because the window object has its own resize event, it doesn't need to be
3260  // provided by this plugin, and its execution can be left entirely up to the
3261  // browser. However, since certain browsers fire the resize event continuously
3262  // while others do not, enabling this will throttle the window resize event,
3263  // making event behavior consistent across all elements in all browsers.
3264  // 
3265  // While setting this property to false will disable window object resize
3266  // event throttling, please note that this property must be changed before any
3267  // window object resize event callbacks are bound.
3268  
3269  jq_resize[ str_throttle ] = true;
3270  
3271  // Event: resize event
3272  // 
3273  // Fired when an element's width or height changes. Because browsers only
3274  // provide this event for the window element, for other elements a polling
3275  // loop is initialized, running every <jQuery.resize.delay> milliseconds
3276  // to see if elements' dimensions have changed. You may bind with either
3277  // .resize( fn ) or .bind( "resize", fn ), and unbind with .unbind( "resize" ).
3278  // 
3279  // Usage:
3280  // 
3281  // > jQuery('selector').bind( 'resize', function(e) {
3282  // >   // element's width or height has changed!
3283  // >   ...
3284  // > });
3285  // 
3286  // Additional Notes:
3287  // 
3288  // * The polling loop is not created until at least one callback is actually
3289  //   bound to the 'resize' event, and this single polling loop is shared
3290  //   across all elements.
3291  // 
3292  // Double firing issue in jQuery 1.3.2:
3293  // 
3294  // While this plugin works in jQuery 1.3.2, if an element's event callbacks
3295  // are manually triggered via .trigger( 'resize' ) or .resize() those
3296  // callbacks may double-fire, due to limitations in the jQuery 1.3.2 special
3297  // events system. This is not an issue when using jQuery 1.4+.
3298  // 
3299  // > // While this works in jQuery 1.4+
3300  // > $(elem).css({ width: new_w, height: new_h }).resize();
3301  // > 
3302  // > // In jQuery 1.3.2, you need to do this:
3303  // > var elem = $(elem);
3304  // > elem.css({ width: new_w, height: new_h });
3305  // > elem.data( 'resize-special-event', { width: elem.width(), height: elem.height() } );
3306  // > elem.resize();
3307      
3308  $.event.special[ str_resize ] = {
3309    
3310    // Called only when the first 'resize' event callback is bound per element.
3311    setup: function() {
3312      // Since window has its own native 'resize' event, return false so that
3313      // jQuery will bind the event using DOM methods. Since only 'window'
3314      // objects have a .setTimeout method, this should be a sufficient test.
3315      // Unless, of course, we're throttling the 'resize' event for window.
3316      if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
3317      
3318      var elem = $(this);
3319      
3320      // Add this element to the list of internal elements to monitor.
3321      elems = elems.add( elem );
3322      
3323      // Initialize data store on the element.
3324      $.data( this, str_data, { w: elem.width(), h: elem.height() } );
3325      
3326      // If this is the first element added, start the polling loop.
3327      if ( elems.length === 1 ) {
3328        loopy();
3329      }
3330    },
3331    
3332    // Called only when the last 'resize' event callback is unbound per element.
3333    teardown: function() {
3334      // Since window has its own native 'resize' event, return false so that
3335      // jQuery will unbind the event using DOM methods. Since only 'window'
3336      // objects have a .setTimeout method, this should be a sufficient test.
3337      // Unless, of course, we're throttling the 'resize' event for window.
3338      if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
3339      
3340      var elem = $(this);
3341      
3342      // Remove this element from the list of internal elements to monitor.
3343      elems = elems.not( elem );
3344      
3345      // Remove any data stored on the element.
3346      elem.removeData( str_data );
3347      
3348      // If this is the last element removed, stop the polling loop.
3349      if ( !elems.length ) {
3350        clearTimeout( timeout_id );
3351      }
3352    },
3353    
3354    // Called every time a 'resize' event callback is bound per element (new in
3355    // jQuery 1.4).
3356    add: function( handleObj ) {
3357      // Since window has its own native 'resize' event, return false so that
3358      // jQuery doesn't modify the event object. Unless, of course, we're
3359      // throttling the 'resize' event for window.
3360      if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
3361      
3362      var old_handler;
3363      
3364      // The new_handler function is executed every time the event is triggered.
3365      // This is used to update the internal element data store with the width
3366      // and height when the event is triggered manually, to avoid double-firing
3367      // of the event callback. See the "Double firing issue in jQuery 1.3.2"
3368      // comments above for more information.
3369      
3370      function new_handler( e, w, h ) {
3371        var elem = $(this),
3372          data = $.data( this, str_data );
3373        
3374        // If called from the polling loop, w and h will be passed in as
3375        // arguments. If called manually, via .trigger( 'resize' ) or .resize(),
3376        // those values will need to be computed.
3377        data.w = w !== undefined ? w : elem.width();
3378        data.h = h !== undefined ? h : elem.height();
3379        
3380        old_handler.apply( this, arguments );
3381      };
3382      
3383      // This may seem a little complicated, but it normalizes the special event
3384      // .add method between jQuery 1.4/1.4.1 and 1.4.2+
3385      if ( $.isFunction( handleObj ) ) {
3386        // 1.4, 1.4.1
3387        old_handler = handleObj;
3388        return new_handler;
3389      } else {
3390        // 1.4.2+
3391        old_handler = handleObj.handler;
3392        handleObj.handler = new_handler;
3393      }
3394    }
3395    
3396  };
3397  
3398  function loopy() {
3399    
3400    // Start the polling loop, asynchronously.
3401    timeout_id = window[ str_setTimeout ](function(){
3402      
3403      // Iterate over all elements to which the 'resize' event is bound.
3404      elems.each(function(){
3405        var elem = $(this),
3406          width = elem.width(),
3407          height = elem.height(),
3408          data = $.data( this, str_data );
3409        
3410        // If element size has changed since the last time, update the element
3411        // data store and trigger the 'resize' event.
3412        if ( width !== data.w || height !== data.h ) {
3413          elem.trigger( str_resize, [ data.w = width, data.h = height ] );
3414        }
3415        
3416      });
3417      
3418      // Loop.
3419      loopy();
3420      
3421    }, jq_resize[ str_delay ] );
3422    
3423  };
3424  
3425})(jQuery,this);
3426
3427/**
3428* hoverIntent is similar to jQuery's built-in "hover" function except that
3429* instead of firing the onMouseOver event immediately, hoverIntent checks
3430* to see if the user's mouse has slowed down (beneath the sensitivity
3431* threshold) before firing the onMouseOver event.
3432* 
3433* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
3434* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
3435* 
3436* hoverIntent is currently available for use in all personal or commercial 
3437* projects under both MIT and GPL licenses. This means that you can choose 
3438* the license that best suits your project, and use it accordingly.
3439* 
3440* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
3441* $("ul li").hoverIntent( showNav , hideNav );
3442* 
3443* // advanced usage receives configuration object only
3444* $("ul li").hoverIntent({
3445*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
3446*	interval: 100,   // number = milliseconds of polling interval
3447*	over: showNav,  // function = onMouseOver callback (required)
3448*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
3449*	out: hideNav    // function = onMouseOut callback (required)
3450* });
3451* 
3452* @param  f  onMouseOver function || An object with configuration options
3453* @param  g  onMouseOut function  || Nothing (use configuration options object)
3454* @author    Brian Cherne brian(at)cherne(dot)net
3455*/
3456(function($) {
3457	$.fn.hoverIntent = function(f,g) {
3458		// default configuration options
3459		var cfg = {
3460			sensitivity: 7,
3461			interval: 100,
3462			timeout: 0
3463		};
3464		// override configuration options with user supplied object
3465		cfg = $.extend(cfg, g ? { over: f, out: g } : f );
3466
3467		// instantiate variables
3468		// cX, cY = current X and Y position of mouse, updated by mousemove event
3469		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
3470		var cX, cY, pX, pY;
3471
3472		// A private function for getting mouse position
3473		var track = function(ev) {
3474			cX = ev.pageX;
3475			cY = ev.pageY;
3476		};
3477
3478		// A private function for comparing current and previous mouse position
3479		var compare = function(ev,ob) {
3480			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
3481			// compare mouse positions to see if they've crossed the threshold
3482			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
3483				$(ob).unbind("mousemove",track);
3484				// set hoverIntent state to true (so mouseOut can be called)
3485				ob.hoverIntent_s = 1;
3486				return cfg.over.apply(ob,[ev]);
3487			} else {
3488				// set previous coordinates for next time
3489				pX = cX; pY = cY;
3490				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
3491				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
3492			}
3493		};
3494
3495		// A private function for delaying the mouseOut function
3496		var delay = function(ev,ob) {
3497			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
3498			ob.hoverIntent_s = 0;
3499			return cfg.out.apply(ob,[ev]);
3500		};
3501
3502		// A private function for handling mouse 'hovering'
3503		var handleHover = function(e) {
3504			// copy objects to be passed into t (required for event object to be passed in IE)
3505			var ev = jQuery.extend({},e);
3506			var ob = this;
3507
3508			// cancel hoverIntent timer if it exists
3509			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
3510
3511			// if e.type == "mouseenter"
3512			if (e.type == "mouseenter") {
3513				// set "previous" X and Y position based on initial entry point
3514				pX = ev.pageX; pY = ev.pageY;
3515				// update "current" X and Y position based on mousemove
3516				$(ob).bind("mousemove",track);
3517				// start polling interval (self-calling timeout) to compare mouse coordinates over time
3518				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
3519
3520			// else e.type == "mouseleave"
3521			} else {
3522				// unbind expensive mousemove event
3523				$(ob).unbind("mousemove",track);
3524				// if hoverIntent state is true, then call the mouseOut function after the specified delay
3525				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
3526			}
3527		};
3528
3529		// bind the function to the two event listeners
3530		return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover);
3531	};
3532})(jQuery);
vendor: 5,027 bytes, lines 3533-3685
3533//////////////////////////////////////////////////////////////////////////////////
3534// Cloud Zoom V1.0.2
3535// (c) 2010 by R Cecco. <http://www.professorcloud.com>
3536// MIT License
3537//
3538// Please retain this copyright header in all versions of the software
3539//////////////////////////////////////////////////////////////////////////////////
3540(function ($) {
3541
3542    $(window).load(function () {
3543        $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();
3544    });
3545    $(window).resize(function () {
3546    	if ($('.cloud-zoom, .cloud-zoom-gallery').data('zoom') != null){
3547	    	$('.cloud-zoom, .cloud-zoom-gallery').data('zoom').destroy();
3548	    	$('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();
3549    	}
3550    });
3551    function format(str) {
3552        for (var i = 1; i < arguments.length; i++) {
3553            str = str.replace('%' + (i - 1), arguments[i]);
3554        }
3555        return str;
3556    }
3557
3558    function CloudZoom(jWin, opts) {
3559        var sImg = $('img', jWin);
3560		var	img1;
3561		var	img2;
3562        var zoomDiv = null;
3563		var	$mouseTrap = null;
3564		var	lens = null;
3565		var	$tint = null;
3566		var	softFocus = null;
3567		var	$ie6Fix = null;
3568		var	zoomImage;
3569        var controlTimer = 0;      
3570        var cw, ch;
3571        var destU = 0;
3572		var	destV = 0;
3573        var currV = 0;
3574        var currU = 0;      
3575        var filesLoaded = 0;
3576        var mx,
3577            my; 
3578        var ctx = this, zw;
3579        // Display an image loading message. This message gets deleted when the images have loaded and the zoom init function is called.
3580        // We add a small delay before the message is displayed to avoid the message flicking on then off again virtually immediately if the
3581        // images load really fast, e.g. from the cache. 
3582        //var	ctx = this;
3583        var  timeout = setTimeout(function () {
3584            //						 <img src="/images/loading.gif"/>
3585            if ($mouseTrap === null) {
3586                var w = jWin.width();
3587                jWin.parent().append(format('<div style="width:%0px;position:absolute;top:75%;left:%1px;text-align:center" class="cloud-zoom-loading" >Loading...</div>', w / 3, (w / 2) - (w / 6))).find(':last').css('opacity', 0.5);
3588            }
3589        }, 200);
3590
3591
3592        var ie6FixRemove = function () {
3593
3594            if ($ie6Fix !== null) {
3595                $ie6Fix.remove();
3596                $ie6Fix = null;
3597            }
3598        };
3599
3600        // Removes cursor, tint layer, blur layer etc.
3601        this.removeBits = function () {
3602            //$mouseTrap.unbind();
3603            if (lens) {
3604                lens.remove();
3605                lens = null;             
3606            }
3607            if ($tint) {
3608                $tint.remove();
3609                $tint = null;
3610            }
3611            if (softFocus) {
3612                softFocus.remove();
3613                softFocus = null;
3614            }
3615            ie6FixRemove();
3616
3617            $('.cloud-zoom-loading', jWin.parent()).remove();
3618        };
3619
3620
3621        this.destroy = function () {
3622            jWin.data('zoom', null);
3623            if (sImg) sImg = null;
3624            if (timeout) clearTimeout(timeout);
3625            if ($mouseTrap) {
3626                $mouseTrap.unbind();
3627                $mouseTrap.remove();
3628                $mouseTrap = null;
3629            }
3630            if (zoomDiv) {
3631                zoomDiv.remove();
3632                zoomDiv = null;
3633            }
3634            //ie6FixRemove();
3635            this.removeBits();
3636            // DON'T FORGET TO REMOVE JQUERY 'DATA' VALUES
3637        };
3638
3639
3640        // This is called when the zoom window has faded out so it can be removed.
3641        this.fadedOut = function () {
3642            
3643			if (zoomDiv) {
3644                zoomDiv.remove();
3645                zoomDiv = null;
3646            }
3647			 this.removeBits();
3648            //ie6FixRemove();
3649        };
3650
3651        this.controlLoop = function () {
3652        	
3653            if (lens) {
3654                var x = (mx - sImg.offset().left - (cw * 0.5)) >> 0;
3655                var y = (my - sImg.offset().top - (ch * 0.5)) >> 0;
3656                
3657               
3658                if (x < 0) {
3659                    x = 0;
3660                }
3661                else if (x > (sImg.outerWidth() - cw)) {
3662                    x = (sImg.outerWidth() - cw);
3663                }
3664                if (y < 0) {
3665                    y = 0;
3666                }
3667                else if (y > (sImg.outerHeight() - ch)) {
3668                    y = (sImg.outerHeight() - ch);
3669                }
3670
3671                lens.css({
3672                    left: x,
3673                    top: y
3674                });
3675
3676                lens.css('background-position', (-x) + 'px ' + (-y) + 'px');
3677
3678                destU = (((x) / sImg.outerWidth()) * zoomImage.width) >> 0;
3679                destV = (((y) / sImg.outerHeight()) * zoomImage.height) >> 0;
3680                currU += (destU - currU) / opts.smoothMove;
3681                currV += (destV - currV) / opts.smoothMove;
3682
3683                zoomDiv.css('background-position', (-(currU >> 0) + 'px ') + (-(currV >> 0) + 'px'));              
3684            }
3685            controlTimer = setTimeout(function () {
3686                ctx.controlLoop();
3687            }, 30);
3688        };
3689
3690        this.init2 = function (img, id) {
3691
3692            filesLoaded++;
3693            //console.log(img.src + ' ' + id + ' ' + img.width);	
3694            if (id === 1) {
3695                zoomImage = img;
3696            }
3697            //this.images[id] = img;
3698            if (filesLoaded === 2) {
3699                this.init();
3700            }
3701        };
3702
3703        /* Init function start.  */
3704        this.init = function () {
3705            // Remove loading message (if present);
3706            $('.cloud-zoom-loading', jWin.parent()).remove();
3707
3708
3709/* Add a box (mouseTrap) over the small image to trap mouse events.
3710		It has priority over zoom window to avoid issues with inner zoom.
3711		We need the dummy background image as IE does not trap mouse events on
3712		transparent parts of a div.
3713		*/
3714            var widthImg = 0;
3715            var heightImg = 0;
3716            if(sImg!= null){
3717            	widthImg = sImg.outerWidth();
3718                heightImg = sImg.outerHeight();
3719            }
3720	           $mouseTrap = jWin.parent().append(format("<div class='mousetrap' style='background:#fff;opacity:0;filter:alpha(opacity=0);z-index:999;position:absolute;width:%0px;height:%1px;left:%2px;top:%3px;\'></div>", widthImg, heightImg, 0, 0)).find(':last');
3721
3722			// Detect device type, normal mouse or touchy(ipad android) by albanx
3723            var touchy=("ontouchstart" in document.documentElement)?true:false;
3724			var m_move='touchmove mousemove';
3725			var m_end='touchend mouseleave';
3726			var m_ent='touchstart mouseenter';
3727			var m_click='touchstart click';
3728            //////////////////////////////////////////////////////////////////////			
3729            /* Do as little as possible in mousemove event to prevent slowdown. */
3730            
3731            $mouseTrap.bind(m_move, this, function (e) {
3732                // Just update the mouse position         
3733            	mx=( typeof(e.originalEvent.touches) !='undefined')?
3734            			e.originalEvent.touches[0].pageX:e.pageX;
3735            	my=( typeof(e.originalEvent.touches) !='undefined')?
3736            			e.originalEvent.touches[0].pageY:e.pageY;
3737            });
3738            //////////////////////////////////////////////////////////////////////					
3739            $mouseTrap.bind(m_end, this, function (event) {
3740                clearTimeout(controlTimer);
3741                //event.data.removeBits();                
3742				if(lens) { lens.fadeOut(299); }
3743				if($tint) { $tint.fadeOut(299); }
3744				if(softFocus) { softFocus.fadeOut(299); }
3745				zoomDiv.fadeOut(300, function () {
3746                    ctx.fadedOut();
3747                });																
3748                return false;
3749            });
3750            //////////////////////////////////////////////////////////////////////			
3751            $mouseTrap.bind(m_ent, this, function (event) {
3752            	if(touchy)//i consider only one touches for zooming
3753				{
3754            		event.preventDefault();
3755				}
3756            	mx=( typeof(event.originalEvent.touches) !='undefined')?
3757            			event.originalEvent.touches[0].pageX:event.pageX;
3758            	my=( typeof(event.originalEvent.touches) !='undefined')?
3759            			event.originalEvent.touches[0].pageY:event.pageY;
3760            			
3761                zw = event.data;
3762                if (zoomDiv) {
3763                    zoomDiv.stop(true, false);
3764                    zoomDiv.remove();
3765                }
3766
3767                var xPos = opts.adjustX,
3768                    yPos = opts.adjustY;
3769                             
3770                var siw = sImg.outerWidth();
3771                var sih = sImg.outerHeight();
3772
3773                var w = opts.zoomWidth;
3774                var h = opts.zoomHeight;
3775                if (opts.zoomWidth == 'auto') {
3776                    w = siw;
3777                }
3778                if (opts.zoomHeight == 'auto') {
3779                    h = sih;
3780                }
3781                //$('#info').text( xPos + ' ' + yPos + ' ' + siw + ' ' + sih );
3782                var appendTo = jWin.parent(); // attach to the wrapper			
3783                switch (opts.position) {
3784                case 'top':
3785                    yPos -= h; // + opts.adjustY;
3786                    break;
3787                case 'right':
3788                    xPos += siw; // + opts.adjustX;					
3789                    break;
3790                case 'bottom':
3791                    yPos += sih; // + opts.adjustY;
3792                    break;
3793                case 'left':
3794                    xPos -= w; // + opts.adjustX;					
3795                    break;
3796                case 'inside':
3797                    w = siw;
3798                    h = sih;
3799                    break;
3800                    // All other values, try and find an id in the dom to attach to.
3801                default:
3802                    appendTo = $('#' + opts.position);
3803                    // If dom element doesn't exit, just use 'right' position as default.
3804                    if (!appendTo.length) {
3805                        appendTo = jWin;
3806                        xPos += siw; //+ opts.adjustX;
3807                        yPos += sih; // + opts.adjustY;	
3808                    } else {
3809                        w = appendTo.innerWidth();
3810                        h = appendTo.innerHeight();
3811                    }
3812                }
3813
3814                zoomDiv = appendTo.append(format('<div id="cloud-zoom-big" class="cloud-zoom-big" style="display:none;position:absolute;left:%0px;top:%1px;width:%2px;height:%3px;background-image:url(\'%4\');z-index:99;"></div>', xPos, yPos, w, h, zoomImage.src)).find(':last');
3815
3816                // Add the title from title tag.
3817                if (sImg.attr('title') && opts.showTitle) {
3818                    zoomDiv.append(format('<div class="cloud-zoom-title">%0</div>', sImg.attr('title'))).find(':last').css('opacity', opts.titleOpacity);
3819                }
3820
3821                // Fix ie6 select elements wrong z-index bug. Placing an iFrame over the select element solves the issue...		
3822                if ($.browser.msie && $.browser.version < 7) {
3823                    $ie6Fix = $('<iframe frameborder="0" src="#"></iframe>').css({
3824                        position: "absolute",
3825                        left: xPos,
3826                        top: yPos,
3827                        zIndex: 99,
3828                        width: w,
3829                        height: h
3830                    }).insertBefore(zoomDiv);
3831                }
3832
3833                zoomDiv.fadeIn(500);
3834
3835                if (lens) {
3836                    lens.remove();
3837                    lens = null;
3838                } /* Work out size of cursor */
3839                if(typeof event.data.zoomDivWidth == 'undefined'){
3840                	event.data.zoomDivWidth = zoomDiv.get(0).offsetWidth - (zoomDiv.css('border-left-width').replace(/\D/g, '')*1) - (zoomDiv.css('border-right-width').replace(/\D/g, '')*1);
3841                }
3842                if(typeof event.data.zoomDivHeight == 'undefined'){
3843                	event.data.zoomDivHeight = zoomDiv.get(0).offsetHeight - (zoomDiv.css('border-top-width').replace(/\D/g, '')*1) - (zoomDiv.css('border-bottom-width').replace(/\D/g, '')*1);
3844                }
3845                
3846                cw = (sImg.outerWidth() / zoomImage.width) * event.data.zoomDivWi
3846dth;
3847                if(cw > event.data.zoomDivWidth)
3848					cw = Math.min(sImg.outerWidth(),event.data.zoomDivWidth);
3849				
3850                ch = (sImg.outerHeight() / zoomImage.height) * event.data.zoomDivHeight;
3851				
3852				if(ch > event.data.zoomDivHeight)
3853					ch = Math.min(sImg.outerHeight(),event.data.zoomDivHeight);
3854					
3855                // Attach mouse, initially invisible to prevent first frame glitch
3856                lens = jWin.append(format("<div class = 'cloud-zoom-lens' style='display:none;z-index:98;position:absolute;width:%0px;height:%1px;'></div>", cw, ch)).find(':last');
3857
3858                $mouseTrap.css('cursor', lens.css('cursor'));
3859
3860                var noTrans = false;
3861
3862                // Init tint layer if needed. (Not relevant if using inside mode)			
3863                if (opts.tint) {
3864                    lens.css('background', 'url("' + sImg.attr('src') + '")');
3865                    $tint = jWin.append(format('<div style="display:none;position:absolute; left:0px; top:0px; width:%0px; height:%1px; background-color:%2;" />', sImg.outerWidth(), sImg.outerHeight(), opts.tint)).find(':last');
3866                    $tint.css('opacity', opts.tintOpacity);                    
3867					noTrans = true;
3868					$tint.fadeIn(500);
3869
3870                }
3871                if (opts.softFocus) {
3872                    lens.css('background', 'url("' + sImg.attr('src') + '")');
3873                    softFocus = jWin.append(format('<div style="position:absolute;display:none;top:2px; left:2px; width:%0px; height:%1px;" />', sImg.outerWidth() - 2, sImg.outerHeight() - 2, opts.tint)).find(':last');
3874                    softFocus.css('background', 'url("' + sImg.attr('src') + '")');
3875                    softFocus.css('opacity', 0.5);
3876                    noTrans = true;
3877                    softFocus.fadeIn(500);
3878                }
3879
3880                if (!noTrans) {
3881                    lens.css('opacity', opts.lensOpacity);										
3882                }
3883				if ( opts.position !== 'inside' ) { lens.fadeIn(500); }
3884
3885                // Start processing. 
3886                zw.controlLoop();
3887
3888                return; // Don't return false here otherwise opera will not detect change of the mouse pointer type.
3889            });
3890        };
3891
3892        img1 = new Image();
3893        $(img1).load(function () {
3894            ctx.init2(this, 0);
3895        });
3896        img1.src = sImg.attr('src');
3897
3898        img2 = new Image();
3899        $(img2).load(function () {
3900            ctx.init2(this, 1);
3901        });
3902        img2.src = jWin.attr('href');
3903    }
3904
3905    $.fn.CloudZoom = function (options) {
3906        // IE6 background image flicker fix
3907        try {
3908            document.execCommand("BackgroundImageCache", false, true);
3909        } catch (e) {}
3910        this.each(function () {
3911		var touchy=("ontouchstart" in document.documentElement)?true:false;
3912			var m_move='touchmove mousemove';
3913			var m_end='touchend mouseleave';
3914			var m_ent='touchstart mouseenter';
3915			var m_click='touchstart click';
3916		
3917			var	relOpts, opts;
3918			// Hmm...eval...slap on wrist.
3919			eval('var	a = {' + $(this).attr('rel') + '}');
3920			relOpts = a;
3921            if ($(this).is('.cloud-zoom')) {
3922                $(this).css({
3923                    'position': 'relative',
3924                    'display': 'block'
3925                });
3926                $('img', $(this)).css({
3927                    'display': 'block'
3928                });
3929                // Wrap an outer div around the link so we can attach things without them becoming part of the link.
3930                // But not if wrap already exists.
3931                if ($(this).parent().attr('id') != 'wrap') {
3932                    $(this).wrap('<div id="wrap" style="top:0px;z-index:9999;position:relative;"></div>');
3933                }
3934                opts = $.extend({}, $.fn.CloudZoom.defaults, options);
3935                opts = $.extend({}, opts, relOpts);
3936                $(this).data('zoom', new CloudZoom($(this), opts));
3937
3938            } else if ($(this).is('.cloud-zoom-gallery')) {
3939                opts = $.extend({}, relOpts, options);
3940                $(this).data('relOpts', opts);
3941                $(this).bind(m_click, $(this), function (event) {
3942                    var data = event.data.data('relOpts');
3943                    // Destroy the previous zoom
3944                    $('#' + data.useZoom).data('zoom').destroy();
3945                    // Change the biglink to point to the new big image.
3946                    $('#' + data.useZoom).attr('href', event.data.attr('href'));
3947                    // Change the small image to point to the new small image.
3948                    $('#' + data.useZoom + ' img').attr('src', event.data.data('relOpts').smallImage);
3949					$('#' + data.useZoom + ' img').attr('title', $(this).attr('title'));
3950                    // Init a new zoom with the new images.				
3951                    $('#' + event.data.data('relOpts').useZoom).CloudZoom();
3952                    return false;
3953                });
3954            }
3955        });
3956        return this;
3957    };
3958
3959    $.fn.CloudZoom.defaults = {
3960        zoomWidth: 'auto',
3961        zoomHeight: 'auto',
3962        position: 'right',
3963        tint: false,
3964        tintOpacity: 0.5,
3965        lensOpacity: 0.5,
3966        softFocus: false,
3967        smoothMove: 3,
3968        showTitle: true,
3969        titleOpacity: 0.5,
3970        adjustX: 0,
3971        adjustY: 0
3972    };
3973
3974})(jQuery);
3975
3976/*
3977 * jQuery hashchange event - v1.3 - 7/21/2010
3978 * http://benalman.com/projects/jquery-hashchange-plugin/
3979 * 
3980 * Copyright (c) 2010 "Cowboy" Ben Alman
3981 * Dual licensed under the MIT and GPL licenses.
3982 * http://benalman.com/about/license/
3983 */
3984(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();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
3985/**
3986 * Copyright (C) 2010-2011 Graham Breach
3987 *
3988 * This program is free software: you can redistribute it and/or modify
3989 * it under the terms of the GNU Lesser General Public License as published by
3990 * the Free Software Foundation, either version 3 of the License, or
3991 * (at your option) any later version.
3992 *
3993 * This program is distributed in the hope that it will be useful,
3994 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3995 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3996 * GNU Lesser General Public License for more details.
3997 * 
3998 * You should have received a copy of the GNU Lesser General Public License
3999 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
4000 */
4001/**
4002 * TagCanvas 1.10
4003 * For more information, please contact <[email protected]>
4004 */
4005(function(){
4006var i, j, abs = Math.abs, sin = Math.sin, cos = Math.cos, hexlookup3 = {}, hexlookup2 = {}, hexlookup1 = {
4007	0:"0,",   1:"17,",  2:"34,",  3:"51,",  4:"68,",  5:"85,",
4008	6:"102,", 7:"119,", 8:"136,", 9:"153,", a:"170,", A:"170,",
4009	b:"187,", B:"187,", c:"204,", C:"204,", d:"221,", D:"221,",
4010	e:"238,", E:"238,", f:"255,", F:"255,"	
4011}, Oproto, Tproto, TCproto, doc = document;
4012for(i = 0; i < 256; ++i) {
4013	j = i.toString(16);
4014	if(i < 16)
4015		j = '0' + j;
4016	hexlookup2[j] = hexlookup2[j.toUpperCase()] = i.toString() + ',';
4017}
4018function Defined(d) {
4019	return typeof(d) != 'undefined';
4020}
4021function PointsOnSphere(n) {
4022	var i, y, r, phi, pts = [], inc = Math.PI * (3-Math.sqrt(5)), off = 2/n;
4023	for(i = 0; i < n; ++i) {
4024		y = i * off - 1 + (off / 2);
4025		r = Math.sqrt(1 - y*y);
4026		phi = i * inc;
4027		pts.push([cos(phi)*r, y, sin(phi)*r]);
4028	}
4029	return pts;
4030}
4031function SetAlpha(c,a) {
4032	var d = c, p1, p2, ae = (a*1).toPrecision(3) + ')';
4033	if(c[0] === '#') {
4034		if(!hexlookup3[c])
4035			if(c.length === 4)
4036				hexlookup3[c] = 'rgba(' + hexlookup1[c[1]] + hexlookup1[c[2]] + hexlookup1[c[3]];
4037			else
4038				hexlookup3[c] = 'rgba(' + hexlookup2[c.substr(1,2)] + hexlookup2[c.substr(3,2)] + hexlookup2[c.substr(5,2)];
4039		d = hexlookup3[c] + ae;
4040	} else if(c.substr(0,4) === 'rgb(' || c.substr(0,4) === 'hsl(') {
4041		d = (c.replace('(','a(').replace(')', ',' + ae));
4042	} else if(c.substr(0,5) === 'rgba(' || c.substr(0,5) === 'hsla(') {
4043		p1 = c.lastIndexOf(',') + 1, p2 = c.indexOf(')');
4044		a *= parseFloat(c.substring(p1,p2));
4045		d = c.substr(0,p1) + a.toPrecision(3) + ')';
4046	}
4047	return d;
4048}
4049function NewCanvas(w,h) {
4050	// if using excanvas, give up now
4051	if(window.G_vmlCanvasManager)
4052		return null;
4053	var c = doc.createElement('canvas');
4054	c.width = w;
4055	c.height = h;
4056	return c;
4057}
4058// I think all browsers pass this test now...
4059function ShadowAlphaBroken() {
4060	var cv = NewCanvas(3,3), c, i;
4061	if(!cv)
4062		return false;
4063	c = cv.getContext('2d');
4064	c.strokeStyle = '#000';
4065	c.shadowColor = '#fff';
4066	c.shadowBlur = 3;
4067	c.globalAlpha = 0;
4068	c.strokeRect(2,2,2,2);
4069	c.globalAlpha = 1;
4070	i = c.getImageData(2,2,1,1);
4071	cv = null;
4072	return (i.data[0] > 0);
4073}
4074function FindGradientColour(t,p) {
4075	var l = 1024, g = t.weightGradient, cv, c, i, gd, d;
4076	if(t.gCanvas) {
4077		c = t.gCanvas.getContext('2d');
4078	} else {
4079		t.gCanvas = cv = NewCanvas(l,1);
4080		if(!cv)
4081			return null;
4082		c = cv.getContext('2d');
4083		gd = c.createLinearGradient(0,0,l,0);
4084		for(i in g)
4085			gd.addColorStop(1-i, g[i]);
4086		c.fillStyle = gd;
4087		c.fillRect(0,0,l,1);
4088	}
4089	d = c.getImageData(~~((l-1)*p),0,1,1).data;
4090	return 'rgba(' + d[0] + ',' + d[1] + ',' + d[2] + ',' + (d[3]/255) + ')';
4091}
4092function TextSet(c,f,l,s,sc,sb,so) {
4093	var xo = (sb || 0) + (so && so[0] < 0 ? abs(so[0]) : 0),
4094		yo = (sb || 0) + (so && so[1] < 0 ? abs(so[1]) : 0);
4095	c.font = f;
4096	c.textBaseline = 'top';
4097	c.fillStyle = l;
4098	sc && (c.shadowColor = sc);
4099	sb && (c.shadowBlur = sb);
4100	so && (c.shadowOffsetX = so[0], c.shadowOffsetY = so[1]);
4101	c.fillText(s, xo, yo);
4102}
4103function TextToCanvas(s,f,ht,w,h,l,sc,sb,so) {
4104	var cw = w + abs(so[0]) + sb + sb, ch = h + abs(so[1]) + sb + sb, cv, c;
4105	cv = NewCanvas(cw,ch);
4106	if(!cv)
4107		return null;
4108	c = cv.getContext('2d');
4109	TextSet(c,f,l,s,sc,sb,so);
4110	return cv;
4111}
4112function AddShadowToImage(i,sc,sb,so) {
4113	var cw = i.width + abs(so[0]) + sb + sb, ch = i.height + abs(so[1]) + sb + sb, cv, c,
4114		xo = (sb || 0) + (so && so[0] < 0 ? abs(so[0]) : 0),
4115		yo = (sb || 0) + (so && so[1] < 0 ? abs(so[1]) : 0);
4116	cv = NewCanvas(cw,ch);
4117	if(!cv)
4118		return null;
4119	c = cv.getContext('2d');
4120	sc && (c.shadowColor = sc);
4121	sb && (c.shadowBlur = sb);
4122	so && (c.shadowOffsetX = so[0], c.shadowOffsetY = so[1]);
4123	c.drawImage(i, xo, yo);
4124	return cv;
4125}
4126function FindTextBoundingBox(s,f,ht) {
4127	var w = parseInt(s.length * ht), h = parseInt(ht * 2), cv = NewCanvas(w,h), c, idata, w1, h1, x, y, i, ex;
4128	if(!cv)
4129		return null;
4130	c = cv.getContext('2d');
4131	c.fillStyle = '#000';
4132	c.fillRect(0,0,w,h);
4133	TextSet(c,ht + 'px ' + f,'#fff',s)
4134
4135	idata = c.getImageData(0,0,w,h);
4136	w1 = idata.width; h1 = idata.height;
4137	ex = {
4138		min: { x: w1, y: h1 },
4139		max: { x: -1, y: -1 }
4140	};
4141	for(y = 0; y < h1; ++y) {
4142		for(x = 0; x < w1; ++x) {
4143			i = (y * w1 + x) * 4;
4144			if(idata.data[i+1] > 0) {
4145				if(x < ex.min.x) ex.min.x = x;
4146				if(x > ex.max.x) ex.max.x = x;
4147				if(y < ex.min.y) ex.min.y = y;
4148				if(y > ex.max.y) ex.max.y = y;
4149			}
4150		}
4151	}
4152	// device pixels might not be css pixels
4153	if(w1 != w) {
4154		ex.min.x *= (w / w1);
4155		ex.max.x *= (w / w1);
4156	}
4157	if(h1 != h) {
4158		ex.min.y *= (w / h1);
4159		ex.max.y *= (w / h1);
4160	}
4161
4162	cv = null;
4163	return ex;
4164}
4165function FixFont(f) {
4166	return "'" + f.replace(/(\'|\")/g,'').replace(/\s*,\s*/g, "', '") + "'";
4167}
4168function AddHandler(h,f,e) {
4169	e = e || doc;
4170	if(e.addEventListener)
4171		e.addEventListener(h,f,false);
4172	else
4173		e.attachEvent('on' + h, f);
4174}
4175function AddImage(i,t,tl) {
4176	if(i.complete) {
4177		t.w = i.width;
4178		t.h = i.height;
4179		tl.push(t);
4180	} else {
4181		AddHandler('load',function() {
4182			t.w = this.width;
4183			t.h = this.height;
4184			tl.push(t);
4185		},i);
4186	}
4187}
4188function FindWeight(t,a) {
4189	var w = 1, p;
4190	if(t.weightFrom) {
4191		w = 1 * (a.getAttribute(t.weightFrom) || t.textHeight);
4192	} else if(doc.defaultView && doc.defaultView.getComputedStyle) {
4193		p = doc.defaultView.getComputedStyle(a,null).getPropertyValue('font-size');
4194		w = p.replace('px','') * 1;
4195	} else {
4196		t.weight = false;
4197	}
4198	return w;
4199}
4200function MouseMove(e) {
4201	var i, tc, dd = doc.documentElement, p;
4202	for(i in TagCanvas.tc) {
4203		tc = TagCanvas.tc[i];
4204		p = AbsPos(i);
4205		if(e.pageX) {
4206			tc.mx = e.pageX - p.x;
4207			tc.my = e.pageY - p.y;
4208		} else {
4209			tc.mx = e.clientX + (dd.scrollLeft || doc.body.scrollLeft) - p.x;
4210			tc.my = e.clientY + (dd.scrollTop || doc.body.scrollTop) - p.y;
4211		}
4212	}
4213}
4214function MouseClick(e) {
4215	var t = TagCanvas, cb = doc.addEventListener ? 0 : 1,
4216		tg = e.target && Defined(e.target.id) ? e.target.id : e.srcElement.parentNode.id;
4217	if(tg && e.button == cb && t.tc[tg]) {
4218		MouseMove(e);
4219		t.tc[tg].Clicked(e);
4220	}
4221}
4222function DrawCanvas() {
4223	var t = TagCanvas.tc, i;
4224	for(i in t)
4225		t[i].Draw();
4226}
4227function AbsPos(id) {
4228	var e, p, pn;
4229	e = doc.getElementById(id);
4230	p = {x:e.offsetLeft,y:e.offsetTop};
4231	while(e.offsetParent) {
4232		pn = e.offsetParent;
4233		p.x += pn.offsetLeft;
4234		p.y += pn.offsetTop;
4235		e = pn;
4236	}
4237	return p;
4238}
4239function RotX(p1,t) {
4240	var s = sin(t), c = cos(t); 
4241	return {x:p1.x, y:(p1.y * c) + (p1.z * s), z:(p1.y * -s) + (p1.z * c)};
4242}
4243function RotY(p1,t) {
4244	var s = sin(t), c = cos(t); 
4245	return {x:(p1.x * c) + (p1.z * -s), y:p1.y, z:(p1.x * s) + (p1.z * c)};
4246}
4247function Project(tc,p1,w,h,fov,asp) {
4248	var yn, xn, zn, m = tc.z1 / (tc.z1 + tc.z2 + p1.z);
4249	yn = p1.y * m;
4250	xn = p1.x * m;
4251	zn = tc.z2 + p1.z;
4252	return {x:xn, y:yn, z:zn};
4253}
4254/**
4255 * @constructor
4256 */
4257function Outline(tc) {
4258	this.ts = new Date().valueOf();
4259	this.tc = tc;
4260	this.x = this.y = this.w = this.h = this.sc = 1;
4261	this.z = 0;
4262}
4263Oproto = Outline.prototype;
4264Oproto.Update = function(x,y,w,h,sc,p) {
4265	var o = this.tc.outlineOffset;
4266	this.x = sc * (x - o);
4267	this.y = sc * (y - o);
4268	this.w = sc * (w + o * 2);
4269	this.h = sc * (h + o * 2);
4270	this.sc = sc; // used to determine frontmost
4271	this.z = p.z;
4272};
4273Oproto.Draw = function(c) {
4274	var diff = new Date().valueOf() - this.ts, t = this.tc;
4275	c.setTransform(1,0,0,1,0,0);
4276	c.strokeStyle = t.outlineColour;
4277	c.lineWidth = t.outlineThickness;
4278	c.shadowBlur = c.shadowOffsetX = c.shadowOffsetY = 0;
4279	if(t.pulsateTo < 1)
4280		c.globalAlpha = t.pulsateTo + ((1 - t.pulsateTo) * 
4281			(0.5 + (cos(2 * Math.PI * diff / (1000 * t.pulsateTime)) / 2)));
4282	else
4283		c.globalAlpha = 1;
4284	c.strokeRect(this.x, this.y, this.w, this.h);
4285};
4286Oproto.Active = function(c,x,y) {
4287	return (x >= this.x && y >= this.y &&
4288		x <= this.x + this.w && y <= this.y + this.h);
4289};
4290/**
4291 * @constructor
4292 */
4293function Tag(tc,name,a,v,w,h) {
4294	var c = tc.ctxt, i;
4295	this.tc = tc;
4296	this.image = name.src ? name : null;
4297	this.name = name.src ? '' : name;
4298	this.a = a;
4299	this.p3d = { x: v[0] * tc.radius * 1.1, y: v[1] * tc.radius * 1.1, z: v[2] * tc.radius * 1.1};
4300	this.x = this.y = 0;
4301	this.w = w;
4302	this.h = h;
4303	this.colour = tc.textColour;
4304	this.weight = this.sc = this.alpha = 1;
4305	this.weighted = !tc.weight;
4306	this.outline = new Outline(tc);
4307	if(this.image) {
4308		if(tc.txtOpt && tc.shadow) {
4309			i = AddShadowToImage(this.image,tc.shadow,tc.shadowBlur,tc.shadowOffset);
4310			if(i) {
4311				this.image = i;
4312				this.w = i.width;
4313				this.h = i.height;
4314			}
4315		}
4316	} else {
4317		this.textHeight = tc.textHeight;
4318		this.extents = FindTextBoundingBox(this.name, tc.textFont, this.textHeight);
4319		this.Measure(c,tc);
4320	}
4321	this.SetShadowColour = tc.shadowAlpha ? this.SetShadowColourAlpha : this.SetShadowColourFixed;
4322	this.SetDraw(tc);
4323}
4324Tproto = Tag.prototype;
4325Tproto.SetDraw = function(t) {
4326	this.Draw = this.image ? (t.ie > 7 ? this.DrawImageIE : this.DrawImage) : this.DrawText;
4327};
4328Tproto.Measure = function(c,t) {
4329	this.h = this.extents ? this.extents.max.y + this.extents.min.y : this.textHeight;
4330	c.font = this.font = this.textHeight + 'px ' + t.textFont;
4331	this.w1 = c.measureText(this.name).width;
4332	if(t.txtOpt) {
4333		var s = t.txtScale, th = s * this.textHeight, f = th + 'px ' + t.textFont,
4334			soff = [s*t.shadowOffset[0],s*t.shadowOffset[1]], cw;
4335		c.font = f;
4336		cw = c.measureText(this.name).width;
4337		this.image = TextToCanvas(this.name, f, th, cw, s * this.h, this.colour,
4338			t.shadow, s * t.shadowBlur, soff);
4339		if(this.image) {
4340			this.w = this.image.width / s;
4341			this.h = this.image.height / s;
4342		}
4343		this.SetDraw(t);
4344		t.txtOpt = this.image;
4345	}
4346};
4347Tproto.SetWeight = function(w) {
4348	this.weight = w;
4349	this.Weight(this.tc.ctxt, this.tc);
4350	this.Measure(this.tc.ctxt, this.tc);
4351};
4352Tproto.Weight = function(c,t) {
4353	var w = this.weight, m = t.weightMode;
4354	this.weighted = true;
4355	if(m == 'colour' || m == 'both')
4356		this.colour = FindGradientColour(t, (w - t.min_weight) / (t.max_weight-t.min_weight));
4357	if(m == 'size' || m == 'both')
4358		this.textHeight = w * t.weightSize;
4359	this.extents = FindTextBoundingBox(this.name, t.textFont, this.textHeight);
4360};
4361Tproto.SetShadowColourFixed = function(c,s,a) {
4362	c.shadowColor = s;
4363};
4364Tproto.SetShadowColourAlpha = function(c,s,a) {
4365	c.shadowColor = SetAlpha(s, a);
4366};
4367Tproto.DrawText = function(c,xoff,yoff) {
4368	var t = this.tc, x = this.x, y = this.y, w, h, s = this.sc, o = this.outline;
4369
4370	c.globalAlpha = this.alpha;
4371	c.setTransform(s,0,0,s,0,0);
4372	c.fillStyle = this.colour;
4373	t.shadow && this.SetShadowColour(c,t.shadow,this.alpha);
4374	c.font = this.font;
4375	w = this.w1 * s;
4376	h = this.h * s;
4377	x += 1 + (xoff / s) - (w / 2);
4378	y += 1 + (yoff / s) - (h / 2);
4379
4380	c.fillText(this.name, x, y);
4381	o.Update(x, y, this.w1, this.h, s, this.p3d);
4382	return o.Active(c, t.mx, t.my) ? o : null;
4383};
4384Tproto.DrawImage = function(c,xoff,yoff) {
4385	var t = this.tc, x = this.x, y = this.y, s = this.sc, o = this.outline,
4386		i = this.image, w = this.w, h = this.h;
4387	c.globalAlpha = this.alpha;
4388	c.setTransform(s,0,0,s,0,0);
4389	c.fillStyle = this.colour;
4390	t.shadow && this.SetShadowColour(c,t.shadow,this.alpha);
4391	x += (xoff / s) - (w / 2);
4392	y += (yoff / s) - (h / 2);
4393
4394	c.drawImage(i, x, y, w, h);
4395	o.Update(x, y, w, h, s, this.p3d);
4396	return o.Active(c, t.mx, t.my) ? o : null;
4397};
4398Tproto.DrawImageIE = function(c,xoff,yoff) {
4399	var t = this.tc, i = this.image, s = this.sc, o = this.outline,
4400		w = i.width = this.w*s, h = i.height = this.h * s,
4401		x = (this.x*s) + xoff - (w/2), y = (this.y*s) + yoff - (h/2);
4402	c.globalAlpha = this.alpha;
4403	c.drawImage(i, x, y);
4404	o.Update(x, y, w, h, 1, this.p3d);
4405	return o.Active(c, t.mx, t.my) ? o : null;
4406};
4407Tproto.Calc = function(yaw,pitch) {
4408	var pp = RotY(this.p3d,yaw), t = this.tc, mb = t.minBrightness, r = t.radius;
4409	this.p3d = RotX(pp,pitch);
4410	pp = Project(t, this.p3d, this.w, this.h, Math.PI / 4, 20);
4411	this.x = pp.x;
4412	this.y = pp.y;
4413	this.sc = (t.z1 + t.z2 - pp.z) / t.z2;
4414	this.alpha = Math.max(mb,Math.min(1,mb + 1 - ((pp.z - t.z2 + r) / (2 * r))));
4415};
4416Tproto.Clicked = function(e) {
4417	var a = this.a, t = a.target, h = a.href, evt;
4418	if(t != '' && t != '_self') {
4419		if(self.frames[t])
4420			self.frames[t] = h;
4421		else if(top.frames[t])
4422			top.frames[t] = h;
4423		else
4424			window.open(h, t);
4425		return;
4426	}
4427	if(a.fireEvent) {
4428		if(!a.fireEvent('onclick'))
4429			return;
4430	} else {
4431		evt = doc.createEvent('MouseEvents');
4432		evt.initMouseEvent('click', 1, 1, window, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null);
4433		if(!a.dispatchEvent(evt))
4434			return;
4435	}
4436	doc.location = h;
4437};
4438/**
4439 * @constructor
4440 */
4441function TagCanvas(cid,lctr,opt) {
4442	var i, ctr, tl, vl, p, im, ii, tag, c = doc.getElementById(cid), cp = ['id','class','innerHTML'], w, weights = [];
4443
4444	if(!c) throw 0;
4445	if(Defined(window.G_vmlCanvasManager)) {
4446		c = window.G_vmlCanvasManager.initElement(c);
4447		this.ie = parseFloat(navigator.appVersion.split('MSIE')[1]);
4448	}
4449	if(c && (!c.getContext || !c.getContext('2d').fillText)) {
4450		p = doc.createElement('DIV');
4451		for(i = 0; i < cp.length; ++i)
4452			p[cp[i]] = c[cp[i]];
4453		c.parentNode.insertBefore(p,c);
4454		c.parentNode.removeChild(c);
4455		throw 0;
4456	}
4457	for(i in TagCanvas.options)
4458		this[i] = opt && Defined(opt[i]) ? opt[i] : 
4459			(Defined(TagCanvas[i]) ? TagCanvas[i] : TagCanvas.options[i]);
4460
4461	this.canvas = c;
4462	this.ctxt = c.getContext('2d');
4463	this.z1 = (19800 / (Math.exp(this.depth) * (1-1/Math.E))) +
4464		20000 - 19800 / (1-(1/Math.E));
4465	this.z2 = this.z1 * (1/this.zoom);
4466	this.radius = (c.height > c.width ? c.width : c.height)
4467				* 0.33 * (this.z2 + this.z1) / (this.z1);
4468	this.max_weight = 0;
4469	this.min_weight = 200;
4470	this.textFont = FixFont(this.textFont);
4471	this.ctxt.textBaseline = 'top';
4472	if(this.shadowBlur || this.shadowOffset[0] || this.shadowOffset[1]) {
4473		// let the browser translate "red" into "#ff0000"
4474		this.ctxt.shadowColor = this.shadow;
4475		this.shadow = this.ctxt.shadowColor;
4476		this.shadowAlpha = ShadowAlphaBroken();
4477	} else {
4478		delete this.shadow;
4479	}
4480	try {
4481		ctr = doc.getElementById(lctr || cid);
4482		tl = ctr.getElementsByTagName('a');
4483		this.taglist = [];
4484		if(tl.length) {
4485			vl = PointsOnSphere(tl.length);
4486			for(i = 0; i < tl.length; ++i) {
4487				im = tl[i].getElementsByTagName('img');
4488				if(im.length) {
4489					ii = new Image;
4490					ii.src = im[0].src;
4491					tag = new Tag(this, ii, tl[i], vl[i], 1, 1);
4492					AddImage(ii,tag,this.taglist);
4493				} else {
4494					this.taglist.push(new Tag(this, tl[i].innerText || tl[i].textContent, tl[i],
4495						vl[i], 2, this.textHeight + 2));
4496				}
4497				if(this.weight) {
4498					w = FindWeight(this,tl[i]);
4499					if(w > this.max_weight) this.max_weight = w;
4500					if(w < this.min_weight) this.min_weight = w;
4501					weights.push(w);
4502				}
4503			}
4504			if(this.weight = (this.max_weight > this.min_weight)) {
4505				for(i = 0; i < this.taglist.length; ++i) {
4506					this.taglist[i].SetWeight(weights[i]);
4507				}
4508			}
4509		}
4510		if(lctr && this.hideTags)
4511			ctr.style.display = 'none';
4512	} catch(ex) {
4513		ex;
4514	}
4515
4516	this.yaw = this.initial ? this.initial[0] * this.maxSpeed : 0;
4517	this.pitch = this.initial ? this.initial[1] * this.maxSpeed : 0;
4518	AddHandler('mousemove', MouseMove, c);
4519	AddHandler('mouseout', MouseMove, c);
4520	AddHandler('mouseup', MouseClick, c);
4521	TagCanvas.started || (TagCanvas.started = setInterval(DrawCanvas, this.interval));
4522}
4523TCproto = TagCanvas.prototype;
4524TCproto.Draw = function() {
4525	var cv = this.canvas, cw = cv.width, ch = cv.height, max_sc = 0, yaw = this.yaw, pitch = this.pitch,
4526		x1 = cw / 2, y1 = ch / 2, c = this.ctxt, active, a, i, tl = this.taglist, l = tl.length;
4527	c.setTransform(1,0,0,1,0,0);
4528	this.active = null;
4529	for(i = 0; i < l; ++i)
4530		tl[i].Calc(yaw, pitch);
4531	tl = tl.sort(function(a,b) {return a.sc-b.sc});
4532
4533	if(!this.txtOpt && this.shadow) {
4534		c.shadowBlur = this.shadowBlur;
4535		c.shadowOffsetX = this.shadowOffset[0];
4536		c.shadowOffsetY = this.shadowOffset[1];
4537	}
4538	c.clearRect(0,0,cw,ch);
4539	for(i = 0; i < l; ++i) {
4540		a = tl[i].Draw(c, x1, y1);
4541		if(a && a.sc > max_sc && (!this.frontSelect || a.z <= 0)) {
4542			active = a;
4543			active.index = i;
4544			max_sc = a.sc;
4545		}
4546	}
4547	if(this.freezeActive && active)
4548		this.yaw = this.pitch = 0;
4549	else
4550		this.Animate(cw, ch);
4551	active && (this.active = active).Draw(c);
4552};
4553TCproto.Animate = function(w,h) {
4554	var tc = this, x = tc.mx, y = tc.my, s, ay, ap, r;
4555	if(x >= 0 && y >= 0 && x < w && y < h)
4556	{
4557		s = tc.maxSpeed, r = tc.reverse ? -1 : 1;
4558		this.yaw = r * ((s * 2 * x / w) - s);
4559		this.pitch = r * -((s * 2 * y / h) - s);
4560		this.initial = null;
4561	}
4562	else if(!tc.initial)
4563	{
4564		s = tc.minSpeed, ay = abs(tc.yaw), ap = abs(tc.pitch);
4565		if(ay > s)
4566			this.yaw = ay > tc.z0 ? tc.yaw * tc.decel : 0;
4567		if(ap > s)
4568			this.pitch = ap > tc.z0 ? tc.pitch * tc.decel : 0;
4569	}
4570};
4571TCproto.Clicked = function(e) {
4572	var t = this.taglist, a = this.active;
4573	try {
4574		if(a && t[a.index]) 
4575			t[a.index].Clicked(e);
4576	} catch(ex) {
4577	}
4578};
4579TagCanvas.Start = function(id,l,o) {
4580	TagCanvas.tc[id] = new TagCanvas(id,l,o);
4581};
4582
4583TagCanvas.tc = {};
4584TagCanvas.options = {
4585z1: 20000,
4586z2: 20000,
4587z0: 0.0002,
4588freezeActive: false,
4589pulsateTo: 0.15,
4590pulsateTime: 3,
4591reverse: false,
4592depth: 0.5,
4593maxSpeed: 0.05,
4594minSpeed: 0,
4595decel: 0.95,
4596interval: 20,
4597minBrightness: 0.1,
4598outlineColour: '#ffff99',
4599outlineThickness: 2,
4600outlineOffset: 5,
4601textColour: '#ff99ff',
4602textHeight: 15,
4603textFont: 'Helvetica, Arial, sans-serif',
4604shadow: '#000',
4605shadowBlur: 0,
4606shadowOffset: [0,0],
4607initial: null,
4608hideTags: true,
4609zoom: 1,
4610weight: false,
4611weightMode: 'size',
4612weightFrom: null,
4613weightSize: 1,
4614weightGradient: {0:'#f00', 0.33:'#ff0', 0.66:'#0f0', 1:'#00f'},
4615txtOpt: true,
4616txtScale: 2,
4617frontSelect: false
4618};
4619for(i in TagCanvas.options) TagCanvas[i] = TagCanvas.options[i];
4620window.TagCanvas = TagCanvas;
4621})();
4622
4623/**
4624 * Magento
4625 *
4626 * NOTICE OF LICENSE
4627 *
4628 * This source file is subject to the Academic Free License (AFL 3.0)
4629 * that is bundled with this package in the file LICENSE_AFL.txt.
4630 * It is also available through the world-wide-web at this URL:
4631 * http://opensource.org/licenses/afl-3.0.php
4632 * If you did not receive a copy of the license and are unable to
4633 * obtain it through the world-wide-web, please send an email
4634 * to [email protected] so we can send you a copy immediately.
4635 *
4636 * DISCLAIMER
4637 *
4638 * Do not edit or add to this file if you wish to upgrade Magento to newer
4639 * versions in the future. If you wish to customize Magento for your
4640 * needs please refer to http://www.magentocommerce.com for more information.
4641 *
4642 * @category    Mage
4643 * @package     js
4644 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
4645 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
4646 */
4647var Captcha = Class.create();
4648Captcha.prototype = {
4649    initialize: function(url, formId){
4650        this.url = url;
4651        this.formId = formId;
4652    },
4653    refresh: function(elem) {
4654        formId = this.formId;
4655        if (elem) Element.addClassName(elem, 'refreshing');
4656        new Ajax.Request(this.url, {
4657            onSuccess: function (response) {
4658                if (response.responseText.isJSON()) {
4659                    var json = response.responseText.evalJSON();
4660                    if (!json.error && json.imgSrc) {
4661                        $(formId).writeAttribute('src', json.imgSrc);
4662                        if (elem) Element.removeClassName(elem, 'refreshing');
4663                    } else {
4664                        if (elem) Element.removeClassName(elem, 'refreshing');
4665                    }
4666                }
4667            },
4668            method: 'post',
4669            parameters: {
4670                'formId'   : this.formId
4671            }
4672        });
4673    }
4674};
4675
4676document.observe('billing-request:completed', function(event) {
4677    if (typeof window.checkout != 'undefined') {
4678        if (window.checkout.method == 'guest' && $('guest_checkout')){
4679            $('guest_checkout').captcha.refresh()
4680        }
4681        if (window.checkout.method == 'register' && $('register_during_checkout')){
4682            $('register_during_checkout').captcha.refresh()
4683        }
4684    }
4685});
4686
4687
4688document.observe('login:setMethod', function(event) {
4689    var switchCaptchaElement = function(shown, hidden) {
4690        var inputPrefix = 'captcha-input-box-', imagePrefix = 'captcha-image-box-';
4691        if ($(inputPrefix + hidden)) {
4692            $(inputPrefix + hidden).hide();
4693            $(imagePrefix + hidden).hide();
4694        }
4695        if ($(inputPrefix + shown)) {
4696            $(inputPrefix + shown).show();
4697            $(imagePrefix + shown).show();
4698        }
4699    };
4700
4701    switch (event.memo.method) {
4702        case 'guest':
4703            switchCaptchaElement('guest_checkout', 'register_during_checkout');
4704            break;
4705        case 'register':
4706            switchCaptchaElement('register_during_checkout', 'guest_checkout');
4707            break;
4708    }
4709});
4710
vendor: 10,254 bytes, lines 4711-4962
4711/*!
4712 * jQuery throttle / debounce - v1.1 - 3/7/2010
4713 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
4714 * 
4715 * Copyright (c) 2010 "Cowboy" Ben Alman
4716 * Dual licensed under the MIT and GPL licenses.
4717 * http://benalman.com/about/license/
4718 */
4719
4720// Script: jQuery throttle / debounce: Sometimes, less is more!
4721//
4722// *Version: 1.1, Last updated: 3/7/2010*
4723// 
4724// Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
4725// GitHub       - http://github.com/cowboy/jquery-throttle-debounce/
4726// Source       - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
4727// (Minified)   - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
4728// 
4729// About: License
4730// 
4731// Copyright (c) 2010 "Cowboy" Ben Alman,
4732// Dual licensed under the MIT and GPL licenses.
4733// http://benalman.com/about/license/
4734// 
4735// About: Examples
4736// 
4737// These working examples, complete with fully commented code, illustrate a few
4738// ways in which this plugin can be used.
4739// 
4740// Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
4741// Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
4742// 
4743// About: Support and Testing
4744// 
4745// Information about what version or versions of jQuery this plugin has been
4746// tested with, what browsers it has been tested in, and where the unit tests
4747// reside (so you can test it yourself).
4748// 
4749// jQuery Versions - none, 1.3.2, 1.4.2
4750// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
4751// Unit Tests      - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
4752// 
4753// About: Release History
4754// 
4755// 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
4756//       executed later than they should. Reworked a fair amount of internal
4757//       logic as well.
4758// 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
4759//       from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
4760//       no_trailing throttle parameter and debounce functionality.
4761// 
4762// Topic: Note for non-jQuery users
4763// 
4764// jQuery isn't actually required for this plugin, because nothing internal
4765// uses any jQuery methods or properties. jQuery is just used as a namespace
4766// under which these methods can exist.
4767// 
4768// Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
4769// when this plugin is loaded, the method described below will be created in
4770// the `Cowboy` namespace. Usage will be exactly the same, but instead of
4771// $.method() or jQuery.method(), you'll need to use Cowboy.method().
4772
4773(function(window,undefined){
4774  '$:nomunge'; // Used by YUI compressor.
4775  
4776  // Since jQuery really isn't required for this plugin, use `jQuery` as the
4777  // namespace only if it already exists, otherwise use the `Cowboy` namespace,
4778  // creating it if necessary.
4779  var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
4780    
4781    // Internal method reference.
4782    jq_throttle;
4783  
4784  // Method: jQuery.throttle
4785  // 
4786  // Throttle execution of a function. Especially useful for rate limiting
4787  // execution of handlers on events like resize and scroll. If you want to
4788  // rate-limit execution of a function to a single time, see the
4789  // <jQuery.debounce> method.
4790  // 
4791  // In this visualization, | is a throttled-function call and X is the actual
4792  // callback execution:
4793  // 
4794  // > Throttled with `no_trailing` specified as false or unspecified:
4795  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4796  // > X    X    X    X    X    X        X    X    X    X    X    X
4797  // > 
4798  // > Throttled with `no_trailing` specified as true:
4799  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4800  // > X    X    X    X    X             X    X    X    X    X
4801  // 
4802  // Usage:
4803  // 
4804  // > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
4805  // > 
4806  // > jQuery('selector').bind( 'someevent', throttled );
4807  // > jQuery('selector').unbind( 'someevent', throttled );
4808  // 
4809  // This also works in jQuery 1.4+:
4810  // 
4811  // > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
4812  // > jQuery('selector').unbind( 'someevent', callback );
4813  // 
4814  // Arguments:
4815  // 
4816  //  delay - (Number) A zero-or-greater delay in milliseconds. For event
4817  //    callbacks, values around 100 or 250 (or even higher) are most useful.
4818  //  no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
4819  //    true, callback will only execute every `delay` milliseconds while the
4820  //    throttled-function is being called. If no_trailing is false or
4821  //    unspecified, callback will be executed one final time after the last
4822  //    throttled-function call. (After the throttled-function has not been
4823  //    called for `delay` milliseconds, the internal counter is reset)
4824  //  callback - (Function) A function to be executed after delay milliseconds.
4825  //    The `this` context and all arguments are passed through, as-is, to
4826  //    `callback` when the throttled-function is executed.
4827  // 
4828  // Returns:
4829  // 
4830  //  (Function) A new, throttled, function.
4831  
4832  $.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
4833    // After wrapper has stopped being called, this timeout ensures that
4834    // `callback` is executed at the proper times in `throttle` and `end`
4835    // debounce modes.
4836    var timeout_id,
4837      
4838      // Keep track of the last time `callback` was executed.
4839      last_exec = 0;
4840    
4841    // `no_trailing` defaults to falsy.
4842    if ( typeof no_trailing !== 'boolean' ) {
4843      debounce_mode = callback;
4844      callback = no_trailing;
4845      no_trailing = undefined;
4846    }
4847    
4848    // The `wrapper` function encapsulates all of the throttling / debouncing
4849    // functionality and when executed will limit the rate at which `callback`
4850    // is executed.
4851    function wrapper() {
4852      var that = this,
4853        elapsed = +new Date() - last_exec,
4854        args = arguments;
4855      
4856      // Execute `callback` and update the `last_exec` timestamp.
4857      function exec() {
4858        last_exec = +new Date();
4859        callback.apply( that, args );
4860      };
4861      
4862      // If `debounce_mode` is true (at_begin) this is used to clear the flag
4863      // to allow future `callback` executions.
4864      function clear() {
4865        timeout_id = undefined;
4866      };
4867      
4868      if ( debounce_mode && !timeout_id ) {
4869        // Since `wrapper` is being called for the first time and
4870        // `debounce_mode` is true (at_begin), execute `callback`.
4871        exec();
4872      }
4873      
4874      // Clear any existing timeout.
4875      timeout_id && clearTimeout( timeout_id );
4876      
4877      if ( debounce_mode === undefined && elapsed > delay ) {
4878        // In throttle mode, if `delay` time has been exceeded, execute
4879        // `callback`.
4880        exec();
4881        
4882      } else if ( no_trailing !== true ) {
4883        // In trailing throttle mode, since `delay` time has not been
4884        // exceeded, schedule `callback` to execute `delay` ms after most
4885        // recent execution.
4886        // 
4887        // If `debounce_mode` is true (at_begin), schedule `clear` to execute
4888        // after `delay` ms.
4889        // 
4890        // If `debounce_mode` is false (at end), schedule `callback` to
4891        // execute after `delay` ms.
4892        timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
4893      }
4894    };
4895    
4896    // Set the guid of `wrapper` function to the same of original callback, so
4897    // it can be removed in jQuery 1.4+ .unbind or .die by using the original
4898    // callback as a reference.
4899    if ( $.guid ) {
4900      wrapper.guid = callback.guid = callback.guid || $.guid++;
4901    }
4902    
4903    // Return the wrapper function.
4904    return wrapper;
4905  };
4906  
4907  // Method: jQuery.debounce
4908  // 
4909  // Debounce execution of a function. Debouncing, unlike throttling,
4910  // guarantees that a function is only executed a single time, either at the
4911  // very beginning of a series of calls, or at the very end. If you want to
4912  // simply rate-limit execution of a function, see the <jQuery.throttle>
4913  // method.
4914  // 
4915  // In this visualization, | is a debounced-function call and X is the actual
4916  // callback execution:
4917  // 
4918  // > Debounced with `at_begin` specified as false or unspecified:
4919  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4920  // >                          X                                 X
4921  // > 
4922  // > Debounced with `at_begin` specified as true:
4923  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4924  // > X                                 X
4925  // 
4926  // Usage:
4927  // 
4928  // > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
4929  // > 
4930  // > jQuery('selector').bind( 'someevent', debounced );
4931  // > jQuery('selector').unbind( 'someevent', debounced );
4932  // 
4933  // This also works in jQuery 1.4+:
4934  // 
4935  // > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
4936  // > jQuery('selector').unbind( 'someevent', callback );
4937  // 
4938  // Arguments:
4939  // 
4940  //  delay - (Number) A zero-or-greater delay in milliseconds. For event
4941  //    callbacks, values around 100 or 250 (or even higher) are most useful.
4942  //  at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
4943  //    unspecified, callback will only be executed `delay` milliseconds after
4944  //    the last debounced-function call. If at_begin is true, callback will be
4945  //    executed only at the first debounced-function call. (After the
4946  //    throttled-function has not been called for `delay` milliseconds, the
4947  //    internal counter is reset)
4948  //  callback - (Function) A function to be executed after delay milliseconds.
4949  //    The `this` context and all arguments are passed through, as-is, to
4950  //    `callback` when the debounced-function is executed.
4951  // 
4952  // Returns:
4953  // 
4954  //  (Function) A new, debounced, function.
4955  
4956  $.debounce = function( delay, at_begin, callback ) {
4957    return callback === undefined
4958      ? jq_throttle( delay, at_begin, false )
4959      : jq_throttle( delay, callback, at_begin !== false );
4960  };
4961  
4962})(this);
4963
4964/**
4965 * EM MegaMenuPro
4966 *
4967 * @license commercial software
4968 * @copyright (c) 2012 Codespot Software JSC - EMThemes.com. (http://www.emthemes.com)
4969 */
4970(function($) {
4971	function isMobileView() {
4972		return $(window).width() <= 767;
4973	};
4974	/**
4975	 * Make menu support on mobile
4976	 */
4977
4978	function mobile() {
4979		$('.em_nav').each(function(i) {
4980			var $nav = $('.hnav, .vnav', this);
4981			// prepend a.arrow into parent LI 
4982			var timeout = null;
4983			// bind event when click on a.arrow sliding to the sub menu horizontally
4984            $('a.arrow', $nav).bind(isWindowPhone ? 'mouseenter' : (isMobile ? 'click mouseenter' : 'click'), function(event) {
4985			//$('a.arrow', $nav).bind(isMobile ? 'click mouseenter' : 'click', function(event) {
4986				if (!isMobileView()) return;
4987				event.preventDefault();
4988				event.stopPropagation();
4989				var $li = $(this.parentNode);
4990				if (timeout) {
4991					clearTimeout(timeout);
4992				}
4993				if (!$li.hasClass('cur-toggle') && $('li.cur-toggle', $nav).length > 0 && !($li.parents('li.cur-toggle').length > 0)) {
4994					$('li.cur-toggle', $nav).each(function() {
4995						$(this).removeClass('cur-toggle');
4996						if ($(this).css('display') != 'none') {
4997							$(this).children('ul').slideToggle();
4998						}
4999					});
5000				}
5001				// fix bug event called twice cause menu sub menu showed even not clicked
5002				// don't know why it happens!!!
5003				$li.children('ul').slideToggle();
5004				if ($li.hasClass('cur-toggle')) $li.removeClass('cur-toggle');
5005				else if ($li.parents('li.cur-toggle').length == 0) $li.addClass('cur-toggle');
5006			});
5007		});
5008	};
5009
5010	function fixPc() {
5011		if ($(window).width() > 767) {
5012			$('.em_nav').each(function(i) {
5013				var $nav = $('.hnav, .vnav', this);
5014				//$('a.arrow', $nav).unbind(isMobile ? 'click mouseenter' : 'click');
5015				var $li = $(this.parentNode);
5016				$('li', $nav).each(function() {
5017					$(this).children('ul').css('display', '');
5018				});
5019			});
5020		}
5021	};
5022	/**
5023	 * Fix mega menu drop-down's container overflows the right edge of page.
5024	 *
5025	 * Should be called once when document ready
5026	 */
5027
5028	function fixMegaMenuOverflow() {
5029		function fix($container, $nav) {
5030			var pad = $nav.offset().left + $nav.outerWidth() - ($container.offset().left + $container.outerWidth());
5031			var pad2 = $container.offset().left + pad - $nav.offset().left;
5032			if (pad2 < 0) pad = pad - pad2;
5033			if (pad < 0) {
5034				$container.css('left', pad + 'px');
5035			}
5036		};
5037		$('.em_nav > .hnav > .menu-item-link > .menu-container').parent().hover(function() {
5038			var $container = $(this).children('.menu-container');
5039			if ($(this).hasClass('menu-item-depth-0')) $container.css('left', 0);
5040			var $nav = $(this).parents('.fix_menu').first();
5041			fix($container, $nav);
5042		}, function() {
5043			$(this).children('.menu-container').css('left', '');
5044		});
5045	};
5046
5047	function menuVertical() {
5048		if (!isPhone && $(window).width() > 767) {
5049			if ($('.vnav > .menu-item-link > .menu-container > li.fix-top').length > 0) {
5050				$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().parent().mouseover(function() {
5051					var $container = $(this).children('.menu-container,ul.level0');
5052					var $containerHeight = $container.outerHeight();
5053					var $containerTop = $container.offset().top;
5054					var $winHeight = $(window).height();
5055					var $maxHeight = $containerHeight + $containerTop;
5056					$setTop = $(this).parent().offset().top - $(this).offset().top;
5057					if (($setTop + $containerHeight) < $(this).height()) {
5058						$setTop = $(this).outerHeight() - $containerHeight;
5059					}
5060					var $grid = $(this).parents('.em_nav').first().parents().first();
5061					$container.css('top', $setTop);
5062					if ($maxHeight < $winHeight) {
5063						$('.vnav ul.level0,.vnav > .menu-item-link').children('.fix-top').parent('.menu-container').first().css('top', $setTop - 9 + 'px');
5064					}
5065				});
5066				$('.vnav ul.level0,.vnav > .menu-item-link').children('.fix-top').parent('.menu-container').parent().mouseout(function() {
5067					var $container = $(this).children('.menu-container,ul.level0');
5068					$container.removeAttr('style');
5069				});
5070			}
5071		} else {
5072			$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().parent().off('mouseover mouseon');
5073			$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().off('mouseover mouseon');
5074			$('.vnav .menu-item-link > .menu-container,.vnav ul.level0').parent().off('mouseover mouseon');
5075		}
5076	};
5077	var tm;
5078	$(document).ready(function() {
5079		$('.em_nav').each(function(i) {
5080			var $nav = $('.hnav, .vnav', this);
5081			$('.em-catalog-navigation li.parent, .menu-item-link.menu-item-parent', $nav).each(function() {
5082				$(this).prepend('<a href="javascript:void(0)" class="arrow"><span>&gt;</span></a>');
5083			});
5084		});
5085		menuVertical();
5086		clearTimeout(tm);
5087        if(disableResponsive!=1){
5088            tm = setTimeout(function() {
5089    			mobile();
5090    		}, 100);
5091        }		
5092		fixMegaMenuOverflow();
5093	});
5094    
5095	var temp;
5096	$(window).resize(function() {
5097	   if(disableResponsive!=1){
5098    		menuVertical();
5099    		clearTimeout(temp);
5100    		temp = setTimeout(function() {
5101    			fixPc();
5102    		}, 100);
5103    		fixMegaMenuOverflow();
5104        }
5105	});
5106    
5107})(jQuery);
5108(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);
5109(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)})}
5109else{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}
5109return 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)}
5109else 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);
5110/**
5111 * Galathemes
5112 *
5113 * @license commercial software
5114 * @copyright (c) 2014 Codespot Software JSC - Galathemes.com. (http://www.galathemes.com)
5115 */
5116jQuery(function($) {
5117	var variables = {};
5118	var panel = $('#demotool_variation').css({
5119		'left': '-100%',
5120		'position': 'absolute'
5121	});
5122	$('a.btn-toggle').click(function() {
5123		if (!panel.hasClass('show')) {
5124			$('.variation-cp').show();
5125			panel.css('top', Math.max($(document).scrollTop(), Math.min($(this).offset().top, $(document).scrollTop() + $(window).height() - panel.outerHeight())) + 'px').addClass('show').animate({
5126				'left': $(this).width() + 1 + 'px'
5127			});
5128		} else {
5129			panel.removeClass('show').animate({
5130				'left': -$(this).width() - panel.outerWidth() - 10 + 'px'
5131			}, 500, function() {
5132				$('.variation-cp').hide();
5133			});
5134		}
5135		return false;
5136	});
5137	// toogle section content-title
5138	$('#demotool_variation .content-title').click(function() {
5139		$(this).next('.wrapper-content').slideToggle('fast');
5140	}).trigger('click').first().trigger('click');
5141	// toggle box content
5142	$('#demotool_variation .box .title').click(function() {
5143		var box = $(this).parent();
5144		if (box.children('.content').is(':visible')) {
5145			box.children('.content').slideUp('fast');
5146			box.addClass('close');
5147		} else {
5148			box.children('.content').slideDown('fast');
5149			box.removeClass('close');
5150		}
5151	});
5152	// load google fonts
5153
5154    /* Box Wide Mode */
5155	$('#em_box_wide').change(function() {
5156		var mode = $('#em_box_wide').val();
5157		if (mode == 'box') {
5158			$('#emoption_wideslideshow').hide();
5159			$('#page_boxconfig').show();
5160			$('.wrapper').addClass('em-box-custom');
5161			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5162			if ($('.em_area01').parent().is("div.container")) {
5163				$(".em_area01").unwrap("<div class='container'></div>");
5164			}
5165			$('.em_area02').removeClass('em-wide-custom');
5166		} else {
5167			$('.wrapper').removeClass('em-box-custom');
5168			$('#emoption_wideslideshow').show();
5169			$('#page_boxconfig').hide();
5170			if ($('#wide_full').is(':checked')) {
5171				$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5172				$(".em_area01").wrap("<div class='container'></div>");
5173				$('.em_area02').addClass('em-wide-custom');
5174			} else {
5175				$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5176				if ($('.em_area01').parent().is("div.container")) {
5177					$(".em_area01").unwrap("<div class='container'></div>");
5178				}
5179				$('.em_area02').removeClass('em-wide-custom');
5180			}
5181		}
5182	});
5183	$('#wide_full').change(function() {
5184		if ($('#wide_full').is(':checked')) {
5185			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5186			$(".em_area01").wrap("<div class='container'></div>");
5187			$('.em_area02').addClass('em-wide-custom');
5188		} else {
5189			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5190			if ($('.em_area01').parent().is("div.container")) {
5191				$(".em_area01").unwrap("<div class='container'></div>");
5192			}
5193			$('.em_area02').removeClass('em-wide-custom');
5194		}
5195	});
5196	// reset
5197	$('#demotool_variation .reset-button').click(function() {
5198		$('#demotool_variation input[type=text], #demotool_variation select, #demotool_variation input[type=hidden]').val('').css('background-color', '');
5199		resetVariation();
5200		//box wide
5201		$('#em_box_wide').val(boxwide_selected);
5202		var mode = $('#em_box_wide').val();
5203		if (mode == 'box') {
5204			$('#emoption_wideslideshow').hide();
5205			$('#page_boxconfig').show();
5206			$('.wrapper').addClass('em-box-custom');
5207			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5208			if ($('.em_area01').parent().is("div.container")) {
5209				$(".em_area01").unwrap("<div class='container'></div>");
5210			}
5211			$('.em_area02').removeClass('em-wide-custom');
5212		} else {
5213			$('.wrapper').removeClass('em-box-custom');
5214			$('#emoption_wideslideshow').show();
5215			$('#page_boxconfig').hide();
5216			if ($('#wide_full').is(':checked')) {
5217				$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5218				$(".em_area01").wrap("<div class='container'></div>");
5219				$('.em_area02').addClass('em-wide-custom');
5220			} else {
5221				$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5222				if ($('.em_area01').parent().is("div.container")) {
5223					$(".em_area01").unwrap("<div class='container'></div>");
5224				}
5225				$('.em_area02').removeClass('em-wide-custom');
5226			}
5227		}
5228		// slideshow
5229		if (fullSlideshow) {
5230			$('#wide_full').prop('checked', true); // Uncheck the checkbox
5231		} else {
5232			$('#wide_full').prop('checked', false);
5233		}
5234		if ($('#wide_full').is(':checked')) {
5235			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5236			$('.em_area02').addClass('em-wide-custom');
5237		} else {
5238			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5239			$('.em_area02').removeClass('em-wide-custom');
5240		}
5241		return false;
5242	});
5243	// stripes pattern
5244	$('#demotool_variation a.page_bg_image').click(function() {
5245		$('#demotool_variation a.page_bg_image').removeClass('selected');
5246		$(this).addClass('selected');
5247		$('#demotool_variation input[name=page_bg_image]').val($(this).data('input-value'));
5248		changeVariation('@page_bg_image', $('#demotool_variation input[name=page_bg_image]').val());
5249		return false;
5250	});
5251	$('#demotool_variation a.header_bg_image').click(function() {
5252		$('#demotool_variation a.header_bg_image').removeClass('selected');
5253		$(this).addClass('selected');
5254		$('#demotool_variation input[name=header_bg_image]').val($(this).data('input-value'));
5255		changeVariation('@header_bg_image', $('#demotool_variation input[name=header_bg_image]').val());
5256		return false;
5257	});
5258	$('#demotool_variation a.body_bg_image').click(function() {
5259		$('#demotool_variation a.body_bg_image').removeClass('selected');
5260		$(this).addClass('selected');
5261		$('#demotool_variation input[name=body_bg_image]').val($(this).data('input-value'));
5262		changeVariation('@body_bg_image', $('#demotool_variation input[name=body_bg_image]').val());
5263		return false;
5264	});
5265	$('#demotool_variation a.footer_bg_image').click(function() {
5266		$('#demotool_variation a.footer_bg_image').removeClass('selected');
5267		$(this).addClass('selected');
5268		$('#demotool_variation input[name=footer_bg_image]').val($(this).data('input-value'));
5269		changeVariation('@footer_bg_image', $('#demotool_variation input[name=footer_bg_image]').val());
5270		return false;
5271	});
5272	changeVariation = function(key, value) {
5273		var key = key || null;
5274		var value = value || null;
5275		var temp = {};
5276		if (key) {
5277			if (String(value).indexOf(',') != -1 || String(value).indexOf('.') != -1 || String(value).indexOf('/') != -1 || String(value).indexOf(' ') != -1) variables[key] = '~"' + String(value.replace(/"/g, "'")) + '"';
5278			else
5279			variables[key] = String(value);
5280		}
5281		less.modifyVars(variables);
5282	}; /*return default value when input value is null*/
5283	returnDefault = function(key) {
5284		if (variables[key]) delete(variables[key]);
5285		less.modifyVars(variables);
5286	};
5286 /*reset Variation*/
5287	resetVariation = function() {
5288		variables = {};
5289		less.refresh();
5290	};
5291	$('.color-picker').ColorPicker({
5292		onSubmit: $.throttle(300, function(hsb, hex, rgb, el) {
5293			$(el).val('#' + hex);
5294			$(el).css('backgroundColor', '#' + hex);
5295			//$(el).ColorPickerHide();
5296		}),
5297		onChange: $.debounce(300, function(hsb, hex) {
5298			var el = this.data('colorpicker').el;
5299			$(el).val('#' + hex);
5300			$(el).css('backgroundColor', '#' + hex);
5301			changeVariation('@' + $(el).attr('name'), $(el).val());
5302		}),
5303		onBeforeShow: function() {
5304			$(this).ColorPickerSetColor(this.value);
5305		}
5306	}).bind('keyup', $.debounce(300, function() {
5307		$(this).ColorPickerSetColor(this.value);
5308		if ($(this).val() == "") {
5309			$(this).css('background-color', '');
5310			returnDefault('@' + $(this).attr('name'));
5311		}
5312	}));
5313	$('.colorpicker_submit').click(function() {
5314		var btn = $(this);
5315		var tm;
5316		clearTimeout(tm);
5317		btn.button('loading');
5318		tm = setTimeout(function() {
5319			btn.button('reset');
5320		}, 1000);
5321	});
5322	$('#demotool_variation input.input-text').blur(function(e) {
5323		if ($(this).val() != "") {
5324			changeVariation('@' + $(this).attr('name'), $(this).val());
5325		}
5326	});
5327	$('#demotool_variation input.input-text').bind('keyup', function(e, hbs, hex) {
5328		if ($(this).val() == "") {
5329			returnDefault('@' + $(this).attr('name'));
5330		} else {
5331			if (e.keyCode == 13) {
5332				changeVariation('@' + $(this).attr('name'), $(this).val());
5333			}
5334		}
5335	});
5336	//box wide
5337	var mode = $('#em_box_wide').val();
5338	if (mode == 'box') {
5339		$('#emoption_wideslideshow').hide();
5340		$('#page_boxconfig').show();
5341		$('.wrapper').addClass('em-box-custom');
5342		$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5343		if ($('.em_area01').parent().is("div.container")) {
5344			$(".em_area01").unwrap("<div class='container'></div>");
5345		}
5346		$('.em_area02').removeClass('em-wide-custom');
5347	} else {
5348		$('.wrapper').removeClass('em-box-custom');
5349		$('#emoption_wideslideshow').show();
5350		$('#page_boxconfig').hide();
5351		if ($('#wide_full').is(':checked')) {
5352			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5353			$(".em_area01").wrap("<div class='container'></div>");
5354			$('.em_area02').addClass('em-wide-custom');
5355		} else {
5356			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5357			if ($('.em_area01').parent().is("div.container")) {
5358				$(".em_area01").unwrap("<div class='container'></div>");
5359			}
5360			$('.em_area02').removeClass('em-wide-custom');
5361		}
5362	}
5363});
5364// -----------------------------------------------------------------------------------
5365//
5366//	Lightbox v2.04
5367//	by Lokesh Dhakar - http://www.lokeshdhakar.com
5368//	Last Modification: 2/9/08
5369//
5370//	For more information, visit:
5371//	http://lokeshdhakar.com/projects/lightbox2/
5372//
5373//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
5374//  	- Free for use in both personal and commercial projects
5375//		- Attribution requires leaving author name, author link, and the license info intact.
5376//	
5377//  Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
5378//  		Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
5379//
5380// -----------------------------------------------------------------------------------
5381/*
5382
5383    Table of Contents
5384    -----------------
5385    Configuration
5386
5387    Lightbox Class Declaration
5388    - initialize()
5389    - updateImageList()
5390    - start()
5391    - changeImage()
5392    - resizeImageContainer()
5393    - showImage()
5394    - updateDetails()
5395    - updateNav()
5396    - enableKeyboardNav()
5397    - disableKeyboardNav()
5398    - keyboardAction()
5399    - preloadNeighborImages()
5400    - end()
5401    
5402    Function Calls
5403    - document.observe()
5404   
5405*/
5406// -----------------------------------------------------------------------------------
5407
5408//
5409//  Configurationl
5410//
5411
5412// -----------------------------------------------------------------------------------
5413
5414var Lightbox = Class.create();
5415
5416Lightbox.prototype = {
5417    imageArray: [],
5418    activeImage: undefined,
5419    
5420    // initialize()
5421    // Constructor runs on completion of the DOM loading. Calls updateImageList and then
5422    // the function inserts html at the bottom of the page which is used to display the shadow 
5423    // overlay and the image container.
5424    //
5425    initialize: function() {    
5426        
5427        this.updateImageList();
5428        
5429        this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
5430
5431        if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
5432        if (LightboxOptions.resizeSpeed < 1)  LightboxOptions.resizeSpeed = 1;
5433
5434	    this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
5435	    this.overlayDuration = LightboxOptions.animate ? 0.2 : 0;  // shadow fade in/out duration
5436
5437        // When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
5438        // If animations are turned off, it will be hidden as to prevent a flicker of a
5439        // white 250 by 250 box.
5440        var size = (LightboxOptions.animate ? 250 : 1) + 'px';
5441        
5442
5443        // Code inserts html at the bottom of the page that looks similar to this:
5444        //
5445        //  <div id="overlay"></div>
5446        //  <div id="lightbox">
5447        //      <div id="outerImageContainer">
5448        //          <div id="imageContainer">
5449        //              <img id="lightboxImage">
5450        //              <div style="" id="hoverNav">
5451        //                  <a href="#" id="prevLink"></a>
5452        //                  <a href="#" id="nextLink"></a>
5453        //              </div>
5454        //              <div id="loading">
5455        //                  <a href="#" id="loadingLink">
5456        //                      <img src="images/loading.gif">
5457        //                  </a>
5458        //              </div>
5459        //          </div>
5460        //      </div>
5461        //      <div id="imageDataContainer">
5462        //          <div id="imageData">
5463        //              <div id="imageDetails">
5464        //                  <span id="caption"></span>
5465        //                  <span id="numberDisplay"></span>
5466        //              </div>
5467        //              <div id="bottomNav">
5468        //                  <a href="#" id="bottomNavClose">
5469        //                      <img src="images/close.gif">
5470        //                  </a>
5471        //              </div>
5472        //          </div>
5473        //      </div>
5474        //  </div>
5475
5476
5477        var objBody = $$('body')[0];
5478
5479		objBody.appendChild(Builder.node('div',{id:'overlay'}));
5480	
5481        objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
5482            Builder.node('div',{id:'outerImageContainer'}, 
5483                Builder.node('div',{id:'imageContainer'}, [
5484                    Builder.node('img',{id:'lightboxImage'}), 
5485                    Builder.node('div',{id:'hoverNav'}, [
5486                        Builder.node('a',{id:'prevLink', href: '#' }),
5487                        Builder.node('a',{id:'nextLink', href: '#' })
5488                    ]),
5489                    Builder.node('div',{id:'loading'}, 
5490                        Builder.node('a',{id:'loadingLink', href: '#' }, 
5491                            Builder.node('img', {src: LightboxOptions.fileLoadingImage})
5492                        )
5493                    )
5494                ])
5495            ),
5496            Builder.node('div', {id:'imageDataContainer'},
5497                Builder.node('div',{id:'imageData'}, [
5498                    Builder.node('div',{id:'imageDetails'}, [
5499                        Builder.node('span',{id:'caption'}),
5500                        Builder.node('span',{id:'numberDisplay'})
5501                    ]),
5502                    Builder.node('div',{id:'bottomNav'},
5503                        Builder.node('a',{id:'bottomNavClose', href: '#' },
5504                            Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
5505                        )
5506                    )
5507                ])
5508            )
5509        ]));
5510
5511
5512		$('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
5513		$('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
5514		$('outerImageContainer').setStyle({ width: size, height: size });
5515		$('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
5516		$('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
5517		$('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
5518		$('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
5519
5520        var th = this;
5521        (function(){
5522            var ids = 
5523                'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' + 
5524                'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';   
5525            $w(ids).each(function(id){ th[id] = $(id); });
5526        }).defer();
5527    },
5528
5529    //
5530    // updateImageList()
5531    // Loops through anchor tags looking for 'lightbox' references and applies onclick
5532    // events to appropriate links. You can rerun after dynamically adding images w/ajax.
5533    //
5534    updateImageList: function() {   
5535        this.updateImageList = Prototype.emptyFunction;
5536        
5537        document.observe('click', (function(event){
5538            var rightClick = 0;
5539            switch (event.which) {
5540                case 3:
5541                    rightClick = 1;
5542                    break;
5543                default:
5544                    rightClick = 0;
5545            }
5546            if(rightClick!=1){
5547                var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
5548                if (target && target.rel && target.rel.indexOf('lightbox') >= 0) {
5549                    if ( window.document.documentMode >= 9)
5550                        Event.stop(window.event);
5551                    else
5552                        event.stop();
5553                    this.start(target);
5554                }
5555            }
5556        }).bind(this));
5557    },
5558    
5559    //
5560    //  start()
5561    //  Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
5562    //
5563    start: function(imageLink) {    
5564
5565        $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
5566
5567        // stretch overlay to fill page and fade in
5568        var arrayPageSize = this.getPageSize();
5569        $('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
5570
5571        new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
5572
5573        this.imageArray = [];
5574        var imageNum = 0;       
5575
5576        if ((imageLink.rel == 'lightbox')){
5577            // if image is NOT part of a set, add single image to imageArray
5578            this.imageArray.push([imageLink.href, imageLink.title]);         
5579        } else {
5580            // if image is part of a set..
5581            this.imageArray = 
5582                $$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
5583                collect(function(anchor){ return [anchor.href, anchor.title]; }).
5584                uniq();
5585            
5586            while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
5587        }
5588
5589        // calculate top and left offset for the lightbox 
5590        var arrayPageScroll = document.viewport.getScrollOffsets();
5591        var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
5592        var lightboxLeft = arrayPageScroll[0];
5593        this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
5594        
5595        this.changeImage(imageNum);
5596    },
5597
5598    //
5599    //  changeImage()
5600    //  Hide most elements and preload image in preparation for resizing image container.
5601    //
5602    changeImage: function(imageNum) {   
5603        
5604        this.activeImage = imageNum; // update global var
5605
5606        // hide elements during transition
5607        if (LightboxOptions.animate) this.loading.show();
5608        this.lightboxImage.hide();
5609        this.hoverNav.hide();
5610        this.prevLink.hide();
5611        this.nextLink.hide();
5612		// HACK: Opera9 does not currently support scriptaculous opacity and appear fx
5613        this.imageDataContainer.setStyle({opacity: .0001});
5614        this.numberDisplay.hide();      
5615        
5616        var imgPreloader = new Image();
5617        
5618        // once image is preloaded, resize image container
5619
5620
5621        imgPreloader.onload = (function(){
5622            this.lightboxImage.src = this.imageArray[this.activeImage][0];
5623            this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
5624        }).bind(this);
5625        imgPreloader.src = this.imageArray[this.activeImage][0];
5626    },
5627
5628    //
5629    //  resizeImageContainer()
5630    //
5631    resizeImageContainer: function(imgWidth, imgHeight) {
5632
5633        // get current width and height
5634        var widthCurrent  = this.outerImageContainer.getWidth();
5635        var heightCurrent = this.outerImageContainer.getHeight();
5636
5637        // get new width and height
5638        var widthNew  = (imgWidth  + LightboxOptions.borderSize * 2);
5639        var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
5640
5641        // scalars based on change from old to new
5642        var xScale = (widthNew  / widthCurrent)  * 100;
5643        var yScale = (heightNew / heightCurrent) * 100;
5644
5645        // calculate size difference between new and old image, and resize if necessary
5646        var wDiff = widthCurrent - widthNew;
5647        var hDiff = heightCurrent - heightNew;
5648
5649        if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'}); 
5650        if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration}); 
5651
5652        // if new and old image are same size and no scaling transition is necessary, 
5653        // do a quick pause to prevent image flicker.
5654        var timeout = 0;
5655        if ((hDiff == 0) && (wDiff == 0)){
5656            timeout = 100;
5657            if (Prototype.Browser.IE) timeout = 250;   
5658        }
5659
5660        (function(){
5661            this.prevLink.setStyle({ height: imgHeight + 'px' });
5662            this.nextLink.setStyle({ height: imgHeight + 'px' });
5663            this.imageDataContainer.setStyle({ width: widthNew + 'px' });
5664
5665            this.showImage();
5666        }).bind(this).delay(timeout / 1000);
5667    },
5668    
5669    //
5670    //  showImage()
5671    //  Display image and begin preloading neighbors.
5672    //
5673    showImage: function(){
5674        this.loading.hide();
5675        new Effect.Appear(this.lightboxImage, { 
5676            duration: this.resizeDuration, 
5677            queue: 'end', 
5678            afterFinish: (function(){ this.updateDetails(); }).bind(this) 
5679        });
5680        this.preloadNeighborImages();
5681    },
5682
5683    //
5684    //  updateDetails()
5685    //  Display caption, image number, and bottom nav.
5686    //
5687    updateDetails: function() {
5688    
5689        // if caption is not null
5690        if (this.imageArray[this.activeImage][1] != ""){
5691            this.caption.update(this.imageArray[this.activeImage][1]).show();
5692        }
5693        
5694        // if image is part of set display 'Image x of x' 
5695        if (this.imageArray.length > 1){
5696            this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + '  ' + this.imageArray.length).show();
5697        }
5698
5699        new Effect.Parallel(
5700            [ 
5701                new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }), 
5702                new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration }) 
5703            ], 
5704            { 
5705                duration: this.resizeDuration, 
5706                afterFinish: (function() {
5707	                // update overlay size and update nav
5708	                var arrayPageSize = this.getPageSize();
5709	                this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
5710	                this.updateNav();
5711                }).bind(this)
5712            } 
5713        );
5714    },
5715
5716    //
5717    //  updateNav()
5718    //  Display appropriate previous and next hover navigation.
5719    //
5720    updateNav: function() {
5721
5722        this.hoverNav.show();               
5723
5724        // if not first image in set, display prev image button
5725        if (this.activeImage > 0) this.prevLink.show();
5726
5727        // if not last image in set, display next image button
5728        if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
5729        
5730        this.enableKeyboardNav();
5731    },
5732
5733    //
5734    //  enableKeyboardNav()
5735    //
5736    enableKeyboardNav: function() {
5737        document.observe('keydown', this.keyboardAction); 
5738    },
5739
5740    //
5741    //  disableKeyboardNav()
5742    //
5743    disableKeyboardNav: function() {
5744        document.stopObserving('keydown', this.keyboardAction); 
5745    },
5746
5747    //
5748    //  keyboardAction()
5749    //
5750    keyboardAction: function(event) {
5751        var keycode = event.keyCode;
5752
5753        var escapeKey;
5754        if (event.DOM_VK_ESCAPE) {  // mozilla
5755            escapeKey = event.DOM_VK_ESCAPE;
5756        } else { // ie
5757            escapeKey = 27;
5758        }
5759
5760        var key = String.fromCharCode(keycode).toLowerCase();
5761        
5762        if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
5763            this.end();
5764        } else if ((key == 'p') || (keycode == 37)){ // display previous image
5765            if (this.activeImage != 0){
5766                this.disableKeyboardNav();
5767                this.changeImage(this.activeImage - 1);
5768            }
5769        } else if ((key == 'n') || (keycode == 39)){ // display next image
5770            if (this.activeImage != (this.imageArray.length - 1)){
5771                this.disableKeyboardNav();
5772                this.changeImage(this.activeImage + 1);
5773            }
5774        }
5775    },
5776
5777    //
5778    //  preloadNeighborImages()
5779    //  Preload previous and next images.
5780    //
5781    preloadNeighborImages: function(){
5782        var preloadNextImage, preloadPrevImage;
5783        if (this.imageArray.length > this.activeImage + 1){
5784            preloadNextImage = new Image();
5785            preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
5786        }
5787        if (this.activeImage > 0){
5788            preloadPrevImage = new Image();
5789            preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
5790        }
5791    
5792    },
5793
5794    //
5795    //  end()
5796    //
5797    end: function() {
5798        this.disableKeyboardNav();
5799        this.lightbox.hide();
5800        new Effect.Fade(this.overlay, { duration: this.overlayDuration });
5801        $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
5802    },
5803
5804    //
5805    //  getPageSize()
5806    //
5807    getPageSize: function() {
5808	        
5809	     var xScroll, yScroll;
5810		
5811		if (window.innerHeight && window.scrollMaxY) {	
5812			xScroll = window.innerWidth + window.scrollMaxX;
5813			yScroll = window.innerHeight + window.scrollMaxY;
5814		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
5815			xScroll = document.body.scrollWidth;
5816			yScroll = document.body.scrollHeight;
5817		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
5818			xScroll = document.body.offsetWidth;
5819			yScroll = document.body.offsetHeight + 100;	// fix for quickshop extension in ie
5820		}
5821		
5822		var windowWidth, windowHeight;
5823		
5824		if (self.innerHeight) {	// all except Explorer
5825			if(document.documentElement.clientWidth){
5826				windowWidth = document.documentElement.clientWidth; 
5827			} else {
5828				windowWidth = self.innerWidth;
5829			}
5830			windowHeight = self.innerHeight;
5831		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
5832			windowWidth = document.documentElement.clientWidth;
5833			windowHeight = document.documentElement.clientHeight;
5834		} else if (document.body) { // other Explorers
5835			windowWidth = document.body.clientWidth;
5836			windowHeight = document.body.clientHeight;
5837		}	
5838		
5839		// for small pages with total height less then height of the viewport
5840		if(yScroll < windowHeight){
5841			pageHeight = windowHeight;
5842		} else { 
5843			pageHeight = yScroll;
5844		}
5845	
5846		// for small pages with total width less then width of the viewport
5847		if(xScroll < windowWidth){	
5848			pageWidth = xScroll;		
5849		} else {
5850			pageWidth = windowWidth;
5851		}
5852
5853		return [pageWidth,pageHeight];
5854	}
5855}
5856
5857document.observe('dom:loaded', function () { 
5858	if( !/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ) {
5859		lightbox = new Lightbox();
5860		// hide lightbox when orientation change
5861		//window.addEventListener('orientationchange', function(){ lightbox.end(); });
5862	}
5863});
5864(function($) {
5865	$.fn.selectUl = function() {
5866		var config = {
5867			over: function() {
5868				if ($(this).parent().children().length > 1) {
5869					$(this).parent().children('.toolbar-dropdown').children('ul').addClass('over');
5870				} else {
5871					$(this).addClass('over');
5872					// $('.toolbar-dropdown', this).css({width: $(this).width()+50});
5873				}
5874				$(this).parent().children('.toolbar-dropdown').children('ul').animate({
5875					opacity: 1,
5876					height: 'toggle'
5877				}, 100);
5878				//$('.toolbar-dropdown ul', this).animate({opacity:1, height:'toggle'}, 100);
5879			},
5880			timeout: 0,
5881			// number = milliseconds delay before onMouseOut
5882			out: function() {
5883				var that = this;
5884				$(this).parent().children('.toolbar-dropdown').children('ul').animate({
5885					opacity: 0,
5886					height: 'toggle'
5887				}, 100, function() {
5888					if ($(this).parent().children().length > 1) {
5889						$(that).parent().children('.toolbar-dropdown').children('ul').removeClass('over');
5890					} else {
5891						$(that).removeClass('over');
5892					}
5893				});
5894			}
5895		};
5896		$('.toolbar-title select').css('display', 'none');
5897		$('.toolbar-switch .toolbar-dropdown .current, .toolbar-switch .toolbar-dropdown').hoverIntent(config);
5898	};
5899	$.fn.insertUl = function() {
5900		var numOptions = $(this).children().length;
5901		$('<div class="toolbar-dropdown"><span class="current"/><ul style="display:none" /></div>').insertAfter($(this).toggleClass('.toolbar-switch').parent());
5902		var divSpan = $(this).toggleClass('toolbar-switch').parent().parent().find('span');
5903		divSpan.append($(this).parent().children('select').find('option:selected').text());
5904		var divUl = $(this).toggleClass('toolbar-switch').parent().parent().find('ul');
5905		for (var i = 0; i < numOptions; i++) {
5906			var text = '<li><a href ="' + $(this).find('option').eq(i).val() + '">' + $(this).find('option').eq(i).text() + '</a></li>';
5907			//$('<li />').text(text).appendTo(divUl);
5908			divUl.append(text);
5909		}
5910	};
5911	$.fn.insertUlLanguage = function() {
5912		var numOptions = $(this).children().length;
5913		$('<div class="toolbar-dropdown"><span class="current"/><ul style="display:none" /></div>').insertAfter($(this).toggleClass('.toolbar-switch').parent());
5914		var divSpan = $(this).toggleClass('toolbar-switch').parent().parent().find('span');
5915		divSpan.append($(this).parent().children('select').find('option:selected').text());
5916		imageUrl = language + ($(this).find('option').eq(i).text()).toLowerCase() + '.png';
5917		divSpan.css('background-image', 'url(' + language + ($(this).parent().children('select').find('option:selected').text()).toLowerCase() + '.png)');
5918		divSpan.css('background-repeat', 'no-repeat');
5919		var divUl = $(this).toggleClass('toolbar-switch').parent().parent().find('ul');
5920		for (var i = 0; i < numOptions; i++) {
5921			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>';
5922			divUl.append(text);
5923		}
5924	};
5925})(jQuery);
5926(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
5926ight"):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;
5926return(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);
5927function 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}
5927function 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)};
5928/**
5929 * Galathemes
5930 *
5931 * @license commercial software
5932 * @copyright (c) 2014 Codespot Software JSC - Galathemes.com. (http://www.galathemes.com)
5933 */
5934var timeout = null;
5935var touch = false;
5936var animate = false;
5937(function($) {
5938	if (typeof EM == 'undefined') EM = {};
5939	if (typeof EM.tools == 'undefined') EM.tools = {};
5940	var domLoaded = false;
5941	var windowLoaded = false;
5942	/**
5943	 *   Add class mobile
5944	 **/
5945
5946	function addClassMobile() {
5947		if (isMobile) {
5948			$('body').addClass('mobile-view');
5949		}
5950	};
5951	/**
5952	 * Fix iPhone/iPod auto zoom-in when text fields, select boxes are focus
5953	 */
5954
5955	function fixIPhoneAutoZoomWhenFocus() {
5956		var viewport = $('head meta[name=viewport]');
5957		if (viewport.length == 0) {
5958			$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1.0"/>');
5959			viewport = $('head meta[name=viewport]');
5960		}
5961		var old_content = viewport.attr('content');
5962
5963		function zoomDisable() {
5964			viewport.attr('content', old_content + ', user-scalable=0');
5965		}
5966
5967		function zoomEnable() {
5968			viewport.attr('content', old_content);
5969		}
5970		$("input[type=text], textarea, select").mouseover(zoomDisable).mousedown(zoomEnable);
5971	}; /* hover language currency */
5972
5973	function hoverUl() {
5974		if (!isMobile) {
5975			$('#select-language').each(function() {
5976				$(this).insertUlLanguage();
5977				$(this).selectUl();
5978			});
5979			$('.currency').each(function() {
5980				$(this).insertUl();
5981				$(this).selectUl();
5982			});
5983			$('#select-store').each(function() {
5984				$(this).insertUl();
5985				$(this).selectUl();
5986			});
5987		}
5988	}; /* Menu Left */
5989
5990	function doMenuLeft() {
5991		var wi = $(window).width();
5992		if (isHomePage == 1 || pos_menuleft == true) {
5993			$('.all_categories').attr('id', 'menuleftTextHomepage');
5994			$('#menu-default').css('display', 'block');
5995		} else {
5996			$('.all_categories').attr('id', 'menuleftText');
5997			$('#menu-default').css('display', 'none');
5998		}
5999		var container = $("#menu-default");
6000		if (disableResponsive != 1) {
6001			if ((!isPhone) && (wi > 767)) {
6002				$("#menuleftText,#menuleftTextHomepage").unbind("click");
6003				$(".menu-wrapper").unbind('hover');
6004				container.show();
6005				if (!($("body").hasClass("cms-index-index"))) {
6006					container.hide();
6007					$(".menu-wrapper").hover(
6008
6009					function() {
6010						container.fadeIn(500);
6011						$("#menuleftText").toggleClass('hidden-arrow');
6012						$("#menuleftText").attr('title', 'hide-option');
6013					}, function() {
6014						container.fadeOut(100);
6015						$("#menuleftText").removeClass('hidden-arrow');
6016						$("#menuleftText").attr('title', 'show-option');
6017					});
6018				}
6019			} else {
6020				$("#menu-default").css("display", "none");
6021				$(".menu-wrapper").unbind('hover');
6022				$("#menuleftText,#menuleftTextHomepage").unbind("click");
6023				$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
6024				$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
6025				$("#menuleftText,#menuleftTextHomepage").click(
6026
6027				function(event) {
6028					event.preventDefault();
6029					if (container.is(":visible")) {
6030						container.hide();
6031						$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
6032						$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
6033					} else {
6034						container.show();
6035						$("#menuleftText,#menuleftTextHomepage").toggleClass('hidden-arrow');
6036						$("#menuleftText,#menuleftTextHomepage").attr('title', 'hide-option');
6037					}
6038				});
6039			}
6040		} else {
6041            if(!isMobile){
6042    			$("#menuleftText,#menuleftTextHomepage").unbind("click");
6043    			$(".menu-wrapper").unbind('hover');
6044    			container.show();
6045    			if (!($("body").hasClass("cms-index-index"))) {
6046    				container.hide();
6047    				$(".menu-wrapper").hover(
6048    
6049    				function() {
6050    					container.fadeIn(500);
6051    					$("#menuleftText").toggleClass('hidden-arrow');
6052    					$("#menuleftText").attr('title', 'hide-option');
6053    				}, function() {
6054    					container.fadeOut(100);
6055    					$("#menuleftText").removeClass('hidden-arrow');
6056    					$("#menuleftText").attr('title', 'show-option');
6057    				});
6058    			}
6059            }else{
6060    			container.show();
6061    			if (!($("body").hasClass("cms-index-index"))) {
6062    				container.hide();
6063    				$("#menuleftText,#menuleftTextHomepage").click(
6064
6065    				function(event) {
6066    					event.preventDefault();
6067    					if (container.is(":visible")) {
6068    						container.hide();
6069    						$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
6070    						$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
6071    					} else {
6072    						container.show();
6073    						$("#menuleftText,#menuleftTextHomepage").toggleClass('hidden-arrow');
6074    						$("#menuleftText,#menuleftTextHomepage").attr('title', 'hide-option');
6075    					}
6076    				});
6077    			}
6078            }
6079		}
6080	};
6081
6082	function persistentMenu() {
6083		if (FREEZED_TOP_MENU != 0 && !isPhone) {
6084			var sticky_navigation = function() {
6085				var scroll_top = $(window).scrollTop();
6086				var navpos = $('#navpos').offset().top;
6087				if ($(window).width() > 767) {
6088					if (scroll_top > navpos) {
6089						$('.header-bottom-right').addClass('navbar-fixed-top');
6090					} else {
6091						$('.header-bottom-right').removeClass('navbar-fixed-top');
6092					}
6093				} else {
6094					$('.header-bottom-right').removeClass('navbar-fixed-top');
6095				}
6096			};
6097			$(window).scroll(function() {
6098				sticky_navigation();
6099			});
6100		}
6101		if ($(window).width() <= 767) {
6102			$('.header-bottom-right').removeClass('navbar-fixed-top');
6103		}
6104	};
6105    
6106    function freezedMenuNoResponsive(){
6107        if (FREEZED_TOP_MENU != 0 && !isPhone) {
6108			var sticky_navigation = function() {
6109				var scroll_top = $(window).scrollTop();
6110				var navpos = $('#navpos').offset().top;
6111				if (scroll_top > navpos) {
6112					$('.header-bottom-right').addClass('navbar-fixed-top');
6113				} else {
6114					$('.header-bottom-right').removeClass('navbar-fixed-top');
6115				}
6116			};
6117			$(window).scroll(function() {
6118				sticky_navigation();
6119			});
6120		}
6121		if (isMobile) {
6122			$('.header-bottom-right').removeClass('navbar-fixed-top');
6123		}
6124    };
6125	// Back to top
6126
6127	function backToTop() {
6128		// hide #back-top first
6129		$("#back-top").hide();
6130		// fade in #back-top
6131		if (!isMobile) {
6132			$(window).scroll(function() {
6133				if ($(this).scrollTop() > 100) {
6134					$('#back-top').fadeIn();
6135				} else {
6136					$('#back-top').fadeOut();
6137				}
6138			});
6139			// scroll body to 0px on click
6140			$('#back-top a').click(function() {
6141				$('body,html').animate({
6142					scrollTop: 0
6143				}, 800);
6144				return false;
6145			});
6146		}
6147	};
6148	
6149/**
6150	 Tab On Details Page
6151	 */
6152
6153	function decorateProductCollateralTabs() {
6154		if ($('.box-collateral').length > 1) {
6155			$('.product-collateral').each(function(i) {
6156				$(this).wrap('<div class="tabs_wrapper_detail collateral_wrapper" />');
6157				$(this).prepend('<ul class="tabs_control"></ul>');
6158				$(this).children(".product-collateral-item").addClass("ui-slider-tabs-content-container");
6159				$('.box-collateral', this).addClass('tab-item').each(function(j) {
6160					var id = 'box_collateral_' + i + '_' + j;
6161					$(this).addClass('content_' + id);
6162					$(this).attr('id', id);
6163					$('.tabs_wrapper_detail ul.tabs_control').append('<li><a href="#' + id + '">' + $('h2', this).html() + '</a></li>');
6164				});
6165				$("div.tabs_wrapper_detail .product-collateral").sliderTabs();
6166			});
6167		}
6168	};
6169
6170/**
6171 *   showReviewTab
6172	 **/
6173
6174	function showReviewList() {
6175		if (jQuery('#customer_review_list').size()) {
6176			// scroll to customer review
6177			jQuery('html, body').animate({
6178				scrollTop: jQuery('#customer_review_list').offset().top
6179			}, 500);
6180		} else {
6181			return false;
6182		}
6183		return true;
6184	};
6185
6186	function showReviewForm() {
6187		if (jQuery('#customer_review_form').size()) {
6188			// scroll to customer review
6189			jQuery('html, body').animate({
6190				scrollTop: jQuery('#customer_review_form').offset().top
6191			}, 500);
6192		} else {
6193			return false;
6194		}
6195		return true;
6196	};
6197
6198	function setupReviewLink() {
6199		jQuery('.product-view .product-essential .link_review_list').click(function(e) {
6200			if (showReviewList()) {
6201				e.preventDefault();
6202			}
6203		});
6204		jQuery('.product-view .product-essential .link_review_form').click(function(e) {
6205			if (showReviewForm()) {
6206				e.preventDefault();
6207			}
6208		});
6209	};
6210	/**
6211	 Do Slider
6212	 */
6213
6214	function doSlider($e, $move, $circular, $direction) {
6215		if ($($e + ' ul > li').size() > 1) {
6216			$($e + ' > ul').addClass('slides');
6217			$($e).csslider({
6218				move: $move,
6219				circular: $circular,
6220				direction: $direction,
6221				parentHidden: 'div.slider'
6222			});
6223		}
6224	}; /* Store Switcher */
6225
6226	function toogleStore() {
6227		if (!isMobile) {
6228			doSlider('#slider_storeview', 1, 0, 'horizontal');
6229			$('.storediv').hide();
6230			$(".btn_storeview").click(function() {
6231				store_show();
6232			});
6233			$(".btn_storeclose").click(function() {
6234				store_hide();
6235			});
6236
6237			function store_show() {
6238				var bg = $("#bg_fade_color");
6239				bg.css("opacity", 0.5);
6240				bg.css("display", "block");
6241				var top = ($(window).height() - $(".storediv").height()) / 2;
6242				var left = ($(window).width() - $(".storediv").width()) / 2;
6243				$(".storediv").show();
6244				$(".storediv").css('top', top + 'px');
6245				$(".storediv").css('left', left + 'px');
6246			};
6247
6248			function store_hide() {
6249				var bg = $("#bg_fade_color");
6250				$(".storediv").hide();
6251				bg.css("opacity", 0);
6252				bg.css("display", "none");
6253			};
6254		}
6255	};
6256
6257	function qrCode() {
6258		$('#qr_code .qr_code_name a').mouseover(function(e) {
6259			var $img = $('img', this);
6260			$img.css({
6261				'display': 'block'
6262			}).attr('src', $img.data('originalImg'));
6263			var parent = $img.offsetParent().offset();
6264			//var left = e.pageX - parent.left + 15;
6265			var top = e.pageY - parent.top + 15;
6266			if ((parent.top + top + $img.height()) > ($(document).scrollTop() + $(window).height())) top = $(document).scrollTop() + $(window).height() - $img.height() - parent.top;
6267			if ((parent.top + top) < $(document).scrollTop()) top = $(document).scrollTop() - parent.top;
6268			$img.css({
6269				'left': 48 + 'px',
6270				'position': 'absolute',
6271				'top': 0 + 'px',
6272				'width': 'auto',
6273				'height': 'auto'
6274			}).attr('src', $img.data('originalImg'));
6275		});
6276		$('#qr_code .qr_code_name a').mouseout(function(e) {
6277			var $img = $('img', this);
6278			$img.css({
6279				'display': 'none'
6280			}).attr('src', $img.data('originalImg'));
6281		});
6282	};
6283	/**
6284	 * Adjust elements to make it responsive
6285	 */
6286
6287	function responsive() {
6288		var position = $('.products-grid .item').css('position');
6289		if (position != 'absolute' && position != 'fixed' && position != 'relative') $('.products-grid .item').css('position', 'relative');
6290	};
6291	/**
6292	 *   Toogle Footer Information Mobile View
6293	 **/
6294
6295	function toogleFooter() {
6296		var wi = $(window).width();
6297		if (isPhone || (wi <= 767)) {
6298			$('.link_content > div > .content_links').css('display', 'none');
6299			$('.link_content > div > p.h5').addClass('toogle-icon');
6300			$('.link_content > div > p.h5').unbind('click');
6301			$('.link_content > div > p.h5').removeClass('active');
6302			$('.link_content > div > p.h5').on('click', function() {
6303				$(this).toggleClass("active").parent().find(".content_links").slideToggle();
6304			});
6305		} else {
6306			$('.link_content > div > p.h5').unbind('click');
6307			$('.link_content > div > p.h5').removeClass('toogle-icon');
6308			$('.link_content > div > p.h5').removeClass('active');
6309			$('.link_content > div > .content_links').css('display', 'block');
6310		}
6311	};
6312
6313	function buildBootrapJs() {
6314		$('.link_connect a.icon').tooltip();
6315		$('.reset-button').click(function() {
6316			var btn = $(this);
6317			btn.button('loading');
6318			var tm;
6319			clearTimeout(tm);
6320			tm = setTimeout(function() {
6321				btn.button('reset');
6322			}, 1000);
6323		});
6324	};
6325
6326	function dataAnimate() {
6327		if ($('[data-animate]')) {
6328			$('[data-animate]').each(function() {
6329				var $toAnimateElement = $(this);
6330				var toAnimateDelay = $(this).attr('data-delay');
6331				var toAnimateDelayTime = 0;
6332				if (toAnimateDelay) {
6333					toAnimateDelayTime = Number(toAnimateDelay);
6334				} else {
6335					toAnimateDelayTime = 200;
6336				}
6337				if (!$toAnimateElement.hasClass('animated')) { /*$toAnimateElement.addClass('not-animated');*/
6338					var elementAnimation = $toAnimateElement.attr('data-animate');
6339					setTimeout(function() {
6340						$toAnimateElement.waypoint({
6341							handler: function() {
6342								$toAnimateElement.removeClass('not-animated').addClass(elementAnimation + ' animated');
6343                                /*
6344                                $toAnimateElement.removeClass('not-animated').addClass(elementAnimation + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
6345                                    $(this).removeClass(elementAnimation + ' animated').addClass('not-animated');
6346                                });*/
6347							},
6348							offset: '100%',
6349							triggerOnce: false
6350						});
6351					}, toAnimateDelayTime);
6352				}
6353				if ($toAnimateElement.hasClass('not-animated')) animate = false;
6354			});
6355		}
6356	};
6357
6358	function ieVersion() {
6359		var rv = -1; // Return value assumes failure.
6360		if (navigator.appName == 'Microsoft Internet Explorer') {
6361			var ua = navigator.userAgent;
6362			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
6363			if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
6364		}
6365		return rv;
6366	};
6367
6368	function doAnimate() { /* DETECT PLATFORM */
6369		$.support.touch = 'ontouchend' in document;
6370		if ($.support.touch) {
6371			touch = true;
6372			$('body').addClass('touch');
6373		} else {
6374			$('body').addClass('notouch');
6375		}
6376		if (touch == false && ANIMATION_LOADING == 0) {
6377			if (ieVersion() == -1 || ieVersion() > 9) $('[data-animate]').addClass('not-animated');
6378		}
6379	};
6380
6381	function setAnimate() {
6382		$('.header-top').children('div').each(function() {
6383			$(this).children('div').each(function() {
6384				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_header);
6385			});
6386		});
6387		$('.em_col_left').children('div').each(function() {
6388			$(this).children('div').each(function() {
6389				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_left);
6390			});
6391		});
6392		$('.em_col_right').children('div').each(function() {
6393			$(this).children('div').each(function() {
6394				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_right);
6395			});
6396		});
6397		$('.em_col_main, .em_area03').children('div').each(function() {
6398			$(this).children('div').each(function() {
6399				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_main);
6400			});
6401		});
6402		$('.em_area04, .em_area05, .inner_footer, #footer-information').children('div').each(function() {
6403			$(this).children('div').each(function() {
6404				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_footer);
6405			});
6406		});
6407	};
6408
6409	function fixClickMobile() {
6410		var currentName;
6411		if (isMobile) {
6412			$('.products-grid li.item a').each(function() {
6413				$(this).bind('click', function(event) {
6414					if (currentName != this) {
6415						event.preventDefault();
6416						// next time click this element will open link
6417						currentName = this;
6418					}
6419				});
6420			});
6421		}
6422	};
6423
6424	function colorVariation() {
6425		var screen = "<div id='bg_fade_color'></div>";
6426		$(document.body).append(screen);
6427		$("#bg_fade_color").css("opacity", 0);
6428		$("#bg_fade_color").css("display", "none");
6429		$(".btn_color_variation").click(function() {
6430			var bg = $("#bg_fade_color");
6431			bg.css("opacity", 0.5);
6432			bg.css("display", "block");
6433			var left = ($(window).width() - $(".colordiv").width()) / 2;
6434			$(".colordiv").show();
6435			$(".colordiv").css('top', Math.max($(document).scrollTop(), Math.min($(this).offset().top, $(document).scrollTop() + $(window).height() - $(".colordiv").outerHeight())) + 20 + 'px');
6436			$(".colordiv").css('left', left);
6437		});
6438		$(".btn_color_close").click(function() {
6439			color_hide();
6440		});
6441
6442		function color_hide() {
6443			var bg = $("#bg_fade_color");
6444			$(".colordiv").hide();
6445			bg.css("opacity", 0);
6446			bg.css("display", "none");
6447		}
6448	};
6449	/**
6450	 Ready Function
6451	 */
6452	$(document).ready(function() {
6453		domLoaded = true;
6454		setAnimate();
6455		addClassMobile();
6456		if (disableVariation != 1) {
6457			colorVariation();
6458			qrCode();
6459			toogleStore();
6460		}
6461		// safari hack: remove bold in h5, .h5
6462		if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
6463			$('h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6').css('font-weight', 'normal');
6464		}
6465        if (disableResponsive != 1) {
6466            isMobile && fixIPhoneAutoZoomWhenFocus();
6467        }else{
6468            freezedMenuNoResponsive();
6469        }
6470		hoverUl();
6471		toolbarCategoty();
6472		backToTop();
6473		doMenuLeft();
6474		//hoverTopCart();
6475		alternativeProductImage();
6476		if (useTab) {
6477			decorateProductCollateralTabs();
6478		}
6479		setupReviewLink();
6480		doSlider('#upsell-product-table', 1, 0, 'horizontal');
6481		doSlider('#slider_crosell', 1, 0, 'horizontal');
6482		doSlider('#slider_moreview', 1, 0, 'horizontal');
6483		doSlider('#slider_related', 1, 0, 'horizontal');
6484		responsive();
6485		buildBootrapJs();
6486		doAnimate();
6487		//fixClickMobile();
6488		setupReviewLink();
6489        if (disableResponsive != 1) {
6490			toogleFooter();
6491		}
6492	});
6493	/**
6494	 Load Function
6495	 */
6496	$(window).bind('load', function() {
6497		windowLoaded = true;
6498		$.support.touch = 'ontouchend' in document;
6499		if ($.support.touch) {
6500			touch = true;
6501			$('body').addClass('touch');
6502		} else {
6503			$('body').addClass('notouch');
6504		}
6505		if (touch == false && ANIMATION_LOADING == 0) {
6506			if (ieVersion() == -1 || ieVersion() > 9) {
6507				dataAnimate();
6508			}
6509		}
6510        if (ieVersion() != -1 || ieVersion() < 9){
6511            setTimeout(function() {                
6512				if (typeof em_slider !== 'undefined') {
6513					em_slider.reinit();
6514				}
6515            },8000);
6516        }
6517        setHeightItem('.em_col_main ul.products-grid');
6518	});
6519	var tmresize;
6520	$(window).resize(function() {
6521		if (disableResponsive != 1) {
6522			clearTimeout(tmresize);
6523			tmresize = setTimeout(function() {
6524                setHeightItem('.em_col_main ul.products-grid');
6525				doMenuLeft();
6526				persistentMenu();
6527				toogleFooter();
6528				if (typeof em_slider !== 'undefined') {
6529					em_slider.reinit();
6530				}
6531			}, 300);
6532			if (touch == false && ANIMATION_LOADING == 0) {
6533				if (ieVersion() == -1 || ieVersion() > 9) dataAnimate();
6534			}
6535		}
6536	});
6537	$(window).bind('orientationchange', function() {
6538		if (disableResponsive != 1) {
6539			toogleFooter();
6540		}
6541	});
6542})(jQuery);
6543/**
6544 * Change the alternative product image when hover
6545 */
6546
6547function alternativeProductImage() {
6548	var $ = jQuery;
6549	var tm;
6550
6551	function swap() {
6552		clearTimeout(tm);
6553		tm = setTimeout(function() {
6554			el = $(this).find('img[data-alt-src]');
6555			var newImg = $(el).data('alt-src');
6556			var oldImg = $(el).attr('src');
6557			$(el).attr('src', newImg).data('alt-src', oldImg);
6558		}.bind(this), 200);
6559	}
6560	$('.item .product-image img[data-alt-src]').parents('.item').bind('mouseenter', swap).bind('mouseleave', swap);
6561};
6562
6563function toolbarCategoty() {
6564	var $ = jQuery;
6565	if (!isMobile) {
6566		$('.toolbar-show').each(function() {
6567			$(this).insertUl();
6568			$(this).selectUl();
6569		});
6570		$('.sortby').each(function() {
6571			$(this).insertUl();
6572			$(this).selectUl();
6573		});
6574	}
6575};
6576/**
6577 *   After Layer Update
6578 **/
6579window.afterLayerUpdate = function() {
6580	var $ = jQuery;
6581    setHeightItem('.em_col_main ul.products-grid');
6582	toolbarCategoty();
6583	alternativeProductImage();
6584	if ((typeof EM_QUICKSHOP_DISABLED == 'undefined' || !EM_QUICKSHOP_DISABLED) && !isMobile) {
6585		qs({
6586			itemClass: '.products-grid li.item, .products-list li.item',
6587			//selector for each items in catalog product list,use to insert quickshop image
6588			aClass: 'a.product-image',
6589			//selector for each a tag in product items,give us href for one product
6590			imgClass: '.product-image > img' //class for quickshop href
6591		});
6592	}
6593};
6594
6595function hideAgreementPopup(e) {
6596	jQuery('#checkout-agreements .agreement-content').hide();
6597};
6598
6599function showAgreementPopup(e) {
6600	jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').show().css({
6601		'left': (parseInt(document.viewport.getWidth()) - jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').width()) / 2 + 'px',
6602		'top': (parseInt(document.viewport.getHeight()) - jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').height()) / 2 + 'px'
6603	});
6604};
6605
6606function setHeightItem(e){
6607    var $=jQuery;
6608    if($(e).length){        
6609        $(e).each(function(){
6610            var maxHeight = 0;
6611            $(this).children('li.item').each(function(){
6612                $(this).removeAttr('height');
6613                if(maxHeight<$(this).outerHeight()){
6614                    maxHeight = $(this).outerHeight(); 
6615                }
6616            });
6617            $(this).children('li.item').each(function(){
6618                $(this).removeAttr('height');
6619                $(this).css('height',maxHeight+'px');
6620            });
6621        });    
6622    }
6623};
6624
6625/**
6626 * Isotope v1.5.25
6627 * An exquisite jQuery plugin for magical layouts
6628 * http://isotope.metafizzy.co
6629 *
6630 * Commercial use requires one-time license fee
6631 * http://metafizzy.co/#licenses
6632 *
6633 * Copyright 2012 David DeSandro / Metafizzy
6634 */
6635
6636/*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true */
6637/*global jQuery: false */
6638jQuery.noConflict();
6639(function( window, $, undefined ){
6640
6641  'use strict';
6642
6643  // get global vars
6644  var document = window.document;
6645  var Modernizr = window.Modernizr;
6646
6647  // helper function
6648  var capitalize = function( str ) {
6649    return str.charAt(0).toUpperCase() + str.slice(1);
6650  };
6651
6652  // ========================= getStyleProperty by kangax ===============================
6653  // http://perfectionkills.com/feature-testing-css-properties/
6654
6655  var prefixes = 'Moz Webkit O Ms'.split(' ');
6656
6657  var getStyleProperty = function( propName ) {
6658    var style = document.documentElement.style,
6659        prefixed;
6660
6661    // test standard property first
6662    if ( typeof style[propName] === 'string' ) {
6663      return propName;
6664    }
6665
6666    // capitalize
6667    propName = capitalize( propName );
6668
6669    // test vendor specific properties
6670    for ( var i=0, len = prefixes.length; i < len; i++ ) {
6671      prefixed = prefixes[i] + propName;
6672      if ( typeof style[ prefixed ] === 'string' ) {
6673        return prefixed;
6674      }
6675    }
6676  };
6677
6678  var transformProp = getStyleProperty('transform'),
6679      transitionProp = getStyleProperty('transitionProperty');
6680
6681
6682  // ========================= miniModernizr ===============================
6683  // <3<3<3 and thanks to Faruk and Paul for doing the heavy lifting
6684
6685  /*!
6686   * Modernizr v1.6ish: miniModernizr for Isotope
6687   * http://www.modernizr.com
6688   *
6689   * Developed by:
6690   * - Faruk Ates  http://farukat.es/
6691   * - Paul Irish  http://paulirish.com/
6692   *
6693   * Copyright (c) 2009-2010
6694   * Dual-licensed under the BSD or MIT licenses.
6695   * http://www.modernizr.com/license/
6696   */
6697
6698  /*
6699   * This version whittles down the script just to check support for
6700   * CSS transitions, transforms, and 3D transforms.
6701  */
6702
6703  var tests = {
6704    csstransforms: function() {
6705      return !!transformProp;
6706    },
6707
6708    csstransforms3d: function() {
6709      var test = !!getStyleProperty('perspective');
6710      // double check for Chrome's false positive
6711      if ( test ) {
6712        var vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
6713            mediaQuery = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)',
6714            $style = $('<style>' + mediaQuery + '{#modernizr{height:3px}}' + '</style>')
6715                        .appendTo('head'),
6716            $div = $('<div id="modernizr" />').appendTo('html');
6717
6718        test = $div.height() === 3;
6719
6720        $div.remove();
6721        $style.remove();
6722      }
6723      return test;
6724    },
6725
6726    csstransitions: function() {
6727      return !!transitionProp;
6728    }
6729  };
6730
6731  var testName;
6732
6733  if ( Modernizr ) {
6734    // if there's a previous Modernzir, check if there are necessary tests
6735    for ( testName in tests) {
6736      if ( !Modernizr.hasOwnProperty( testName ) ) {
6737        // if test hasn't been run, use addTest to run it
6738        Modernizr.addTest( testName, tests[ testName ] );
6739      }
6740    }
6741  } else {
6742    // or create new mini Modernizr that just has the 3 tests
6743    Modernizr = window.Modernizr = {
6744      _version : '1.6ish: miniModernizr for Isotope'
6745    };
6746
6747    var classes = ' ';
6748    var result;
6749
6750    // Run through tests
6751    for ( testName in tests) {
6752      result = tests[ testName ]();
6753      Modernizr[ testName ] = result;
6754      classes += ' ' + ( result ?  '' : 'no-' ) + testName;
6755    }
6756
6757    // Add the new classes to the <html> element.
6758    $('html').addClass( classes );
6759  }
6760
6761
6762  // ========================= isoTransform ===============================
6763
6764  /**
6765   *  provides hooks for .css({ scale: value, translate: [x, y] })
6766   *  Progressively enhanced CSS transforms
6767   *  Uses hardware accelerated 3D transforms for Safari
6768   *  or falls back to 2D transforms.
6769   */
6770
6771  if ( Modernizr.csstransforms ) {
6772
6773        // i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)'
6774    var transformFnNotations = Modernizr.csstransforms3d ?
6775      { // 3D transform functions
6776        translate : function ( position ) {
6777          return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) ';
6778        },
6779        scale : function ( scale ) {
6780          return 'scale3d(' + scale + ', ' + scale + ', 1) ';
6781        }
6782      } :
6783      { // 2D transform functions
6784        translate : function ( position ) {
6785          return 'translate(' + position[0] + 'px, ' + position[1] + 'px) ';
6786        },
6787        scale : function ( scale ) {
6788          return 'scale(' + scale + ') ';
6789        }
6790      }
6791    ;
6792
6793    var setIsoTransform = function ( elem, name, value ) {
6794          // unpack current transform data
6795      var data =  $.data( elem, 'isoTransform' ) || {},
6796          newData = {},
6797          fnName,
6798          transformObj = {},
6799          transformValue;
6800
6801      // i.e. newData.scale = 0.5
6802      newData[ name ] = value;
6803      // extend new value over current data
6804      $.extend( data, newData );
6805
6806      for ( fnName in data ) {
6807        transformValue = data[ fnName ];
6808        transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue );
6809      }
6810
6811      // get proper order
6812      // ideally, we could loop through this give an array, but since we only have
6813      // a couple transforms we're keeping track of, we'll do it like so
6814      var translateFn = transformObj.translate || '',
6815          scaleFn = transformObj.scale || '',
6816          // sorting so translate always comes first
6817          valueFns = translateFn + scaleFn;
6818
6819      // set data back in elem
6820      $.data( elem, 'isoTransform', data );
6821
6822      // set name to vendor specific property
6823      elem.style[ transformProp ] = valueFns;
6824    };
6825
6826    // ==================== scale ===================
6827
6828    $.cssNumber.scale = true;
6829
6830    $.cssHooks.scale = {
6831      set: function( elem, value ) {
6832        // uncomment this bit if you want to properly parse strings
6833        // if ( typeof value === 'string' ) {
6834        //   value = parseFloat( value );
6835        // }
6836        setIsoTransform( elem, 'scale', value );
6837      },
6838      get: function( elem, computed ) {
6839        var transform = $.data( elem, 'isoTransform' );
6840        return transform && transform.scale ? transform.scale : 1;
6841      }
6842    };
6843
6844    $.fx.step.scale = function( fx ) {
6845      $.cssHooks.scale.set( fx.elem, fx.now+fx.unit );
6846    };
6847
6848
6849    // ==================== translate ===================
6850
6851    $.cssNumber.translate = true;
6852
6853    $.cssHooks.translate = {
6854      set: function( elem, value ) {
6855
6856        // uncomment this bit if you want to properly parse strings
6857        // if ( typeof value === 'string' ) {
6858        //   value = value.split(' ');
6859        // }
6860        //
6861        // var i, val;
6862        // for ( i = 0; i < 2; i++ ) {
6863        //   val = value[i];
6864        //   if ( typeof val === 'string' ) {
6865        //     val = parseInt( val );
6866        //   }
6867        // }
6868
6869        setIsoTransform( elem, 'translate', value );
6870      },
6871
6872      get: function( elem, computed ) {
6873        var transform = $.data( elem, 'isoTransform' );
6874        return transform && transform.translate ? transform.translate : [ 0, 0 ];
6875      }
6876    };
6877
6878  }
6879
6880  // ========================= get transition-end event ===============================
6881  var transitionEndEvent, transitionDurProp;
6882
6883  if ( Modernizr.csstransitions ) {
6884    transitionEndEvent = {
6885      WebkitTransitionProperty: 'webkitTransitionEnd',  // webkit
6886      MozTransitionProperty: 'transitionend',
6887      OTransitionProperty: 'oTransitionEnd otransitionend',
6888      transitionProperty: 'transitionend'
6889    }[ transitionProp ];
6890
6891    transitionDurProp = getStyleProperty('transitionDuration');
6892  }
6893
6894  // ========================= smartresize ===============================
6895
6896  /*
6897   * smartresize: debounced resize event for jQuery
6898   *
6899   * latest version and complete README available on Github:
6900   * https://github.com/louisremi/jquery.smartresize.js
6901   *
6902   * Copyright 2011 @louis_remi
6903   * Licensed under the MIT license.
6904   */
6905
6906  var $event = $.event,
6907      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
6908      resizeTimeout;
6909
6910  $event.special.smartresize = {
6911    setup: function() {
6912      $(this).bind( "resize", $event.special.smartresize.handler );
6913    },
6914    teardown: function() {
6915      $(this).unbind( "resize", $event.special.smartresize.handler );
6916    },
6917    handler: function( event, execAsap ) {
6918      // Save the context
6919      var context = this,
6920          args = arguments;
6921
6922      // set correct event type
6923      event.type = "smartresize";
6924
6925      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
6926      resizeTimeout = setTimeout(function() {
6927        $event[ dispatchMethod ].apply( context, args );
6928      }, execAsap === "execAsap"? 0 : 100 );
6929    }
6930  };
6931
6932  $.fn.smartresize = function( fn ) {
6933    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
6934  };
6935
6936
6937
6938// ========================= Isotope ===============================
6939
6940
6941  // our "Widget" object constructor
6942  $.Isotope = function( options, element, callback ){
6943    this.element = $( element );
6944
6945    this._create( options );
6946    this._init( callback );
6947  };
6948
6949  // styles of container element we want to keep track of
6950  var isoContainerStyles = [ 'width', 'height' ];
6951
6952  var $window = $(window);
6953
6954  $.Isotope.settings = {
6955    resizable: true,
6956    layoutMode : 'masonry',
6957    containerClass : 'isotope',
6958    itemClass : 'isotope-item',
6959    hiddenClass : 'isotope-hidden',
6960    hiddenStyle: { opacity: 0, scale: 0.001 },
6961    visibleStyle: { opacity: 1, scale: 1 },
6962    containerStyle: {
6963      position: 'relative',
6964      overflow: 'hidden'
6965    },
6966    animationEngine: 'best-available',
6967    animationOptions: {
6968      queue: false,
6969      duration: 800
6970    },
6971    sortBy : 'original-order',
6972    sortAscending : true,
6973    resizesContainer : true,
6974    transformsEnabled: true,
6975    itemPositionDataEnabled: false
6976  };
6977
6978  $.Isotope.prototype = {
6979
6980    // sets up widget
6981    _create : function( options ) {
6982
6983      this.options = $.extend( {}, $.Isotope.settings, options );
6984
6985      this.styleQueue = [];
6986      this.elemCount = 0;
6987
6988      // get original styles in case we re-apply them in .destroy()
6989      var elemStyle = this.element[0].style;
6990      this.originalStyle = {};
6991      // keep track of container styles
6992      var containerStyles = isoContainerStyles.slice(0);
6993      for ( var prop in this.options.containerStyle ) {
6994        containerStyles.push( prop );
6995      }
6996      for ( var i=0, len = containerStyles.length; i < len; i++ ) {
6997        prop = containerStyles[i];
6998        this.originalStyle[ prop ] = elemStyle[ prop ] || '';
6999      }
7000      // apply container style from options
7001      this.element.css( this.options.containerStyle );
7002
7003      this._updateAnimationEngine();
7004      this._updateUsingTransforms();
7005
7006      // sorting
7007      var originalOrderSorter = {
7008        'original-order' : function( $elem, instance ) {
7009          instance.elemCount ++;
7010          return instance.elemCount;
7011        },
7012        random : function() {
7013          return Math.random();
7014        }
7015      };
7016
7017      this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter );
7018
7019      // need to get atoms
7020      this.reloadItems();
7021
7022      // get top left position of where the bricks should be
7023      this.offset = {
7024        left: parseInt( ( this.element.css('padding-left') || 0 ), 10 ),
7025        top: parseInt( ( this.element.css('padding-top') || 0 ), 10 )
7026      };
7027
7028      // add isotope class first time around
7029      var instance = this;
7030      setTimeout( function() {
7031        instance.element.addClass( instance.options.containerClass );
7032      }, 0 );
7033
7034      // bind resize method
7035      if ( this.options.resizable ) {
7036        $window.bind( 'smartresize.isotope', function() {
7037          instance.resize();
7038        });
7039      }
7040
7041      // dismiss all click events from hidden events
7042      this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){
7043        return false;
7044      });
7045
7046    },
7047
7048    _getAtoms : function( $elems ) {
7049      var selector = this.options.itemSelector,
7050          // filter & find
7051          $atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems,
7052          // base style for atoms
7053          atomStyle = { position: 'absolute' };
7054
7055      // filter out text nodes
7056      $atoms = $atoms.filter( function( i, atom ) {
7057        return atom.nodeType === 1;
7058      });
7059
7060      if ( this.usingTransforms ) {
7061        atomStyle.left = 0;
7062        atomStyle.top = 0;
7063      }
7064
7065      $atoms.css( atomStyle ).addClass( this.options.itemClass );
7066
7067      this.updateSortData( $atoms, true );
7068
7069      return $atoms;
7070    },
7071
7072    // _init fires when your instance is first created
7073    // (from the constructor above), and when you
7074    // attempt to initialize the widget again (by the bridge)
7075    // after it has already been initialized.
7076    _init : function( callback ) {
7077
7078      this.$filteredAtoms = this._filter( this.$allAtoms );
7079      this._sort();
7080      this.reLayout( callback );
7081
7082    },
7083
7084    option : function( opts ){
7085      // change options AFTER initialization:
7086      // signature: $('#foo').bar({ cool:false });
7087      if ( $.isPlainObject( opts ) ){
7088        this.options = $.extend( true, this.options, opts );
7089
7090        // trigger _updateOptionName if it exists
7091        var updateOptionFn;
7092        for ( var optionName in opts ) {
7093          updateOptionFn = '_update' + capitalize( optionName );
7094          if ( this[ updateOptionFn ] ) {
7095            this[ updateOptionFn ]();
7096          }
7097        }
7098      }
7099    },
7100
7101    // ====================== updaters ====================== //
7102    // kind of like setters
7103
7104    _updateAnimationEngine : function() {
7105      var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, '');
7106      var isUsingJQueryAnimation;
7107      // set applyStyleFnName
7108      switch ( animationEngine ) {
7109        case 'css' :
7110        case 'none' :
7111          isUsingJQueryAnimation = false;
7112          break;
7113        case 'jquery' :
7114          isUsingJQueryAnimation = true;
7115          break;
7116        default : // best available
7117          isUsingJQueryAnimation = !Modernizr.csstransitions;
7118      }
7119      this.isUsingJQueryAnimation = isUsingJQueryAnimation;
7120      this._updateUsingTransforms();
7121    },
7122
7123    _updateTransformsEnabled : function() {
7124      this._updateUsingTransforms();
7125    },
7126
7127    _updateUsingTransforms : function() {
7128      var usingTransforms = this.usingTransforms = this.options.transformsEnabled &&
7129        Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation;
7130
7131      // prevent scales when transforms are disabled
7132      if ( !usingTransforms ) {
7133        delete this.options.hiddenStyle.scale;
7134        delete this.options.visibleStyle.scale;
7135      }
7136
7137      this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs;
7138    },
7139
7140
7141    // ====================== Filtering ======================
7142
7143    _filter : function( $atoms ) {
7144      var filter = this.options.filter === '' ? '*' : this.options.filter;
7145
7146      if ( !filter ) {
7147        return $atoms;
7148      }
7149
7150      var hiddenClass    = this.options.hiddenClass,
7151          hiddenSelector = '.' + hiddenClass,
7152          $hiddenAtoms   = $atoms.filter( hiddenSelector ),
7153          $atomsToShow   = $hiddenAtoms;
7154
7155      if ( filter !== '*' ) {
7156        $atomsToShow = $hiddenAtoms.filter( filter );
7157        var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass );
7158        this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle });
7159      }
7160
7161      this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle });
7162      $atomsToShow.removeClass( hiddenClass );
7163
7164      return $atoms.filter( filter );
7165    },
7166
7167    // ====================== Sorting ======================
7168
7169    updateSortData : function( $atoms, isIncrementingElemCount ) {
7170      var instance = this,
7171          getSortData = this.options.getSortData,
7172          $this, sortData;
7173      $atoms.each(function(){
7174        $this = $(this);
7175        sortData = {};
7176        // get value for sort data based on fn( $elem ) passed in
7177        for ( var key in getSortData ) {
7178          if ( !isIncrementingElemCount && key === 'original-order' ) {
7179            // keep original order original
7180            sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ];
7181          } else {
7182            sortData[ key ] = getSortData[ key ]( $this, instance );
7183          }
7184        }
7185        // apply sort data to element
7186        $.data( this, 'isotope-sort-data', sortData );
7187      });
7188    },
7189
7190    // used on all the filtered atoms
7191    _sort : function() {
7192
7193      var sortBy = this.options.sortBy,
7194          getSorter = this._getSorter,
7195          sortDir = this.options.sortAscending ? 1 : -1,
7196          sortFn = function( alpha, beta ) {
7197            var a = getSorter( alpha, sortBy ),
7198                b = getSorter( beta, sortBy );
7199            // fall back to original order if data matches
7200            if ( a === b && sortBy !== 'original-order') {
7201              a = getSorter( alpha, 'original-order' );
7202              b = getSorter( beta, 'original-order' );
7203            }
7204            return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
7205          };
7206
7207      this.$filteredAtoms.sort( sortFn );
7208    },
7209
7210    _getSorter : function( elem, sortBy ) {
7211      return $.data( elem, 'isotope-sort-data' )[ sortBy ];
7212    },
7213
7214    // ====================== Layout Helpers ======================
7215
7216    _translate : function( x, y ) {
7217      return { translate : [ x, y ] };
7218    },
7219
7220    _positionAbs : function( x, y ) {
7221      return { left: x, top: y };
7222    },
7223
7224    _pushPosition : function( $elem, x, y ) {
7225      x = Math.round( x + this.offset.left );
7226      y = Math.round( y + this.offset.top );
7227      var position = this.getPositionStyles( x, y );
7228      this.styleQueue.push({ $el: $elem, style: position });
7229      if ( this.options.itemPositionDataEnabled ) {
7230        $elem.data('isotope-item-position', {x: x, y: y} );
7231      }
7232    },
7233
7234
7235    // ====================== General Layout ======================
7236
7237    // used on collection of atoms (should be filtered, and sorted before )
7238    // accepts atoms-to-be-laid-out to start with
7239    layout : function( $elems, callback ) {
7240
7241      var layoutMode = this.options.layoutMode;
7242
7243      // layout logic
7244      this[ '_' +  layoutMode + 'Layout' ]( $elems );
7245
7246      // set the size of the container
7247      if ( this.options.resizesContainer ) {
7248        var containerStyle = this[ '_' +  layoutMode + 'GetContainerSize' ]();
7249        this.styleQueue.push({ $el: this.element, style: containerStyle });
7250      }
7251
7252      this._processStyleQueue( $elems, callback );
7253
7254      this.isLaidOut = true;
7255    },
7256
7257    _processStyleQueue : function( $elems, callback ) {
7258      // are we animating the layout arrangement?
7259      // use plugin-ish syntax for css or animate
7260      var styleFn = !this.isLaidOut ? 'css' : (
7261            this.isUsingJQueryAnimation ? 'animate' : 'css'
7262          ),
7263          animOpts = this.options.animationOptions,
7264          onLayout = this.options.onLayout,
7265          objStyleFn, processor,
7266          triggerCallbackNow, callbackFn;
7267
7268      // default styleQueue processor, may be overwritten down below
7269      processor = function( i, obj ) {
7270        obj.$el[ styleFn ]( obj.style, animOpts );
7271      };
7272
7273      if ( this._isInserting && this.isUsingJQueryAnimation ) {
7274        // if using styleQueue to insert items
7275        processor = function( i, obj ) {
7276          // only animate if it not being inserted
7277          objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn;
7278          obj.$el[ objStyleFn ]( obj.style, animOpts );
7279        };
7280
7281      } else if ( callback || onLayout || animOpts.complete ) {
7282        // has callback
7283        var isCallbackTriggered = false,
7284            // array of possible callbacks to trigger
7285            callbacks = [ callback, onLayout, animOpts.complete ],
7286            instance = this;
7287        triggerCallbackNow = true;
7288        // trigger callback only once
7289        callbackFn = function() {
7290          if ( isCallbackTriggered ) {
7291            return;
7292          }
7293          var hollaback;
7294          for (var i=0, len = callbacks.length; i < len; i++) {
7295            hollaback = callbacks[i];
7296            if ( typeof hollaback === 'function' ) {
7297              hollaback.call( instance.element, $elems, instance );
7298            }
7299          }
7300          isCallbackTriggered = true;
7301        };
7302
7303        if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) {
7304          // add callback to animation options
7305          animOpts.complete = callbackFn;
7306          triggerCallbackNow = false;
7307
7308        } else if ( Modernizr.csstransitions ) {
7309          // detect if first item has transition
7310          var i = 0,
7311              firstItem = this.styleQueue[0],
7312              testElem = firstItem && firstItem.$el,
7313              styleObj;
7314          // get first non-empty jQ object
7315          while ( !testElem || !testElem.length ) {
7316            styleObj = this.styleQueue[ i++ ];
7317            // HACK: sometimes styleQueue[i] is undefined
7318            if ( !styleObj ) {
7319              return;
7320            }
7321            testElem = styleObj.$el;
7322          }
7323          // get transition duration of the first element in that object
7324          // yeah, this is inexact
7325          var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] );
7326          if ( duration > 0 ) {
7327            processor = function( i, obj ) {
7328              obj.$el[ styleFn ]( obj.style, animOpts )
7329                // trigger callback at transition end
7330                .one( transitionEndEvent, callbackFn );
7331            };
7332            triggerCallbackNow = false;
7333          }
7334        }
7335      }
7336
7337      // process styleQueue
7338      $.each( this.styleQueue, processor );
7339
7340      if ( triggerCallbackNow ) {
7341        callbackFn();
7342      }
7343
7344      // clear out queue for next time
7345      this.styleQueue = [];
7346    },
7347
7348
7349    resize : function() {
7350      if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) {
7351        this.reLayout();
7352      }
7353    },
7354
7355
7356    reLayout : function( callback ) {
7357
7358      this[ '_' +  this.options.layoutMode + 'Reset' ]();
7359      this.layout( this.$filteredAtoms, callback );
7360
7361    },
7362
7363    // ====================== Convenience methods ======================
7364
7365    // ====================== Adding items ======================
7366
7367    // adds a jQuery object of items to a isotope container
7368    addItems : function( $content, callback ) {
7369      var $newAtoms = this._getAtoms( $content );
7370      // add new atoms to atoms pools
7371      this.$allAtoms = this.$allAtoms.add( $newAtoms );
7372
7373      if ( callback ) {
7374        callback( $newAtoms );
7375      }
7376    },
7377
7378    // convienence method for adding elements properly to any layout
7379    // positions items, hides them, then animates them back in <--- very sezzy
7380    insert : function( $content, callback ) {
7381      // position items
7382      this.element.append( $content );
7383
7384      var instance = this;
7385      this.addItems( $content, function( $newAtoms ) {
7386        var $newFilteredAtoms = instance._filter( $newAtoms );
7387        instance._addHideAppended( $newFilteredAtoms );
7388        instance._sort();
7389        instance.reLayout();
7390        instance._revealAppended( $newFilteredAtoms, callback );
7391      });
7392
7393    },
7394
7395    // convienence method for working with Infinite Scroll
7396    appended : function( $content, callback ) {
7397      var instance = this;
7398      this.addItems( $content, function( $newAtoms ) {
7399        instance._addHideAppended( $newAtoms );
7400        instance.layout( $newAtoms );
7401        instance._revealAppended( $newAtoms, callback );
7402      });
7403    },
7404
7405    // adds new atoms, then hides them before positioning
7406    _addHideAppended : function( $newAtoms ) {
7407      this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms );
7408      $newAtoms.addClass('no-transition');
7409
7410      this._isInserting = true;
7411
7412      // apply hidden styles
7413      this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle });
7414    },
7415
7416    // sets visible style on new atoms
7417    _revealAppended : function( $newAtoms, callback ) {
7418      var instance = this;
7419      // apply visible style after a sec
7420      setTimeout( function() {
7421        // enable animation
7422        $newAtoms.removeClass('no-transition');
7423        // reveal newly inserted filtered elements
7424        instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle });
7425        instance._isInserting = false;
7426        instance._processStyleQueue( $newAtoms, callback );
7427      }, 10 );
7428    },
7429
7430    // gathers all atoms
7431    reloadItems : function() {
7432      this.$allAtoms = this._getAtoms( this.element.children() );
7433    },
7434
7435    // removes elements from Isotope widget
7436    remove: function( $content, callback ) {
7437      // remove elements immediately from Isotope instance
7438      this.$allAtoms = this.$allAtoms.not( $content );
7439      this.$filteredAtoms = this.$filteredAtoms.not( $content );
7440      // remove() as a callback, for after transition / animation
7441      var instance = this;
7442      var removeContent = function() {
7443        $content.remove();
7444        if ( callback ) {
7445          callback.call( instance.element );
7446        }
7447      };
7448
7449      if ( $content.filter( ':not(.' + this.options.hiddenClass + ')' ).length ) {
7450        // if any non-hidden content needs to be removed
7451        this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle });
7452        this._sort();
7453        this.reLayout( removeContent );
7454      } else {
7455        // remove it now
7456        removeContent();
7457      }
7458
7459    },
7460
7461    shuffle : function( callback ) {
7462      this.updateSortData( this.$allAtoms );
7463      this.options.sortBy = 'random';
7464      this._sort();
7465      this.reLayout( callback );
7466    },
7467
7468    // destroys widget, returns elements and container back (close) to original style
7469    destroy : function() {
7470
7471      var usingTransforms = this.usingTransforms;
7472      var options = this.options;
7473
7474      this.$allAtoms
7475        .removeClass( options.hiddenClass + ' ' + options.itemClass )
7476        .each(function(){
7477          var style = this.style;
7478          style.position = '';
7479          style.top = '';
7480          style.left = '';
7481          style.opacity = '';
7482          if ( usingTransforms ) {
7483            style[ transformProp ] = '';
7484          }
7485        });
7486
7487      // re-apply saved container styles
7488      var elemStyle = this.element[0].style;
7489      for ( var prop in this.originalStyle ) {
7490        elemStyle[ prop ] = this.originalStyle[ prop ];
7491      }
7492
7493      this.element
7494        .unbind('.isotope')
7495        .undelegate( '.' + options.hiddenClass, 'click' )
7496        .removeClass( options.containerClass )
7497        .removeData('isotope');
7498
7499      $window.unbind('.isotope');
7500
7501    },
7502
7503
7504    // ====================== LAYOUTS ======================
7505
7506    // calculates number of rows or columns
7507    // requires columnWidth or rowHeight to be set on namespaced object
7508    // i.e. this.masonry.columnWidth = 200
7509    _getSegments : function( isRows ) {
7510      var namespace = this.options.layoutMode,
7511          measure  = isRows ? 'rowHeight' : 'columnWidth',
7512          size     = isRows ? 'height' : 'width',
7513          segmentsName = isRows ? 'rows' : 'cols',
7514          containerSize = this.element[ size ](),
7515          segments,
7516                    // i.e. options.masonry && options.masonry.columnWidth
7517          segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] ||
7518                    // or use the size of the first item, i.e. outerWidth
7519                    this.$filteredAtoms[ 'outer' + capitalize(size) ](true) ||
7520                    // if there's no items, use size of container
7521                    containerSize;
7522
7523      segments = Math.floor( containerSize / segmentSize );
7524      segments = Math.max( segments, 1 );
7525
7526      // i.e. this.masonry.cols = ....
7527      this[ namespace ][ segmentsName ] = segments;
7528      // i.e. this.masonry.columnWidth = ...
7529      this[ namespace ][ measure ] = segmentSize;
7530
7531    },
7532
7533    _checkIfSegmentsChanged : function( isRows ) {
7534      var namespace = this.options.layoutMode,
7535          segmentsName = isRows ? 'rows' : 'cols',
7536          prevSegments = this[ namespace ][ segmentsName ];
7537      // update cols/rows
7538      this._getSegments( isRows );
7539      // return if updated cols/rows is not equal to previous
7540      return ( this[ namespace ][ segmentsName ] !== prevSegments );
7541    },
7542
7543    // ====================== Masonry ======================
7544
7545    _masonryReset : function() {
7546      // layout-specific props
7547      this.masonry = {};
7548      // FIXME shouldn't have to call this again
7549      this._getSegments();
7550      var i = this.masonry.cols;
7551      this.masonry.colYs = [];
7552      while (i--) {
7553        this.masonry.colYs.push( 0 );
7554      }
7555    },
7556
7557    _masonryLayout : function( $elems ) {
7558      var instance = this,
7559          props = instance.masonry;
7560      $elems.each(function(){
7561        var $this  = $(this),
7562            //how many columns does this brick span
7563            colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth );
7564        colSpan = Math.min( colSpan, props.cols );
7565
7566        if ( colSpan === 1 ) {
7567          // if brick spans only one column, just like singleMode
7568          instance._masonryPlaceBrick( $this, props.colYs );
7569        } else {
7570          // brick spans more than one column
7571          // how many different places could this brick fit horizontally
7572          var groupCount = props.cols + 1 - colSpan,
7573              groupY = [],
7574              groupColY,
7575              i;
7576
7577          // for each group potential horizontal position
7578          for ( i=0; i < groupCount; i++ ) {
7579            // make an array of colY values for that one group
7580            groupColY = props.colYs.slice( i, i+colSpan );
7581            // and get the max value of the array
7582            groupY[i] = Math.max.apply( Math, groupColY );
7583          }
7584
7585          instance._masonryPlaceBrick( $this, groupY );
7586        }
7587      });
7588    },
7589
7590    // worker method that places brick in the columnSet
7591    //   with the the minY
7592    _masonryPlaceBrick : function( $brick, setY ) {
7593      // get the minimum Y value from the columns
7594      var minimumY = Math.min.apply( Math, setY ),
7595          shortCol = 0;
7596
7597      // Find index of short column, the first from the left
7598      for (var i=0, len = setY.length; i < len; i++) {
7599        if ( setY[i] === minimumY ) {
7600          shortCol = i;
7601          break;
7602        }
7603      }
7604
7605      // position the brick
7606      var x = this.masonry.columnWidth * shortCol,
7607          y = minimumY;
7608      this._pushPosition( $brick, x, y );
7609
7610      // apply setHeight to necessary columns
7611      var setHeight = minimumY + $brick.outerHeight(true),
7612          setSpan = this.masonry.cols + 1 - len;
7613      for ( i=0; i < setSpan; i++ ) {
7614        this.masonry.colYs[ shortCol + i ] = setHeight;
7615      }
7616
7617    },
7618
7619    _masonryGetContainerSize : function() {
7620      var containerHeight = Math.max.apply( Math, this.masonry.colYs );
7621      return { height: containerHeight };
7622    },
7623
7624    _masonryResizeChanged : function() {
7625      return this._checkIfSegmentsChanged();
7626    },
7627
7628    // ====================== fitRows ======================
7629
7630    _fitRowsReset : function() {
7631      this.fitRows = {
7632        x : 0,
7633        y : 0,
7634        height : 0
7635      };
7636    },
7637
7638    _fitRowsLayout : function( $elems ) {
7639      var instance = this,
7640          containerWidth = this.element.width(),
7641          props = this.fitRows;
7642
7643      $elems.each( function() {
7644        var $this = $(this),
7645            atomW = $this.outerWidth(true),
7646            atomH = $this.outerHeight(true);
7647
7648        if ( props.x !== 0 && atomW + props.x > containerWidth ) {
7649          // if this element cannot fit in the current row
7650          props.x = 0;
7651          props.y = props.height;
7652        }
7653
7654        // position the atom
7655        instance._pushPosition( $this, props.x, props.y );
7656
7657        props.height = Math.max( props.y + atomH, props.height );
7658        props.x += atomW;
7659
7660      });
7661    },
7662
7663    _fitRowsGetContainerSize : function () {
7664      return { height : this.fitRows.height };
7665    },
7666
7667    _fitRowsResizeChanged : function() {
7668      return true;
7669    },
7670
7671
7672    // ====================== cellsByRow ======================
7673
7674    _cellsByRowReset : function() {
7675      this.cellsByRow = {
7676        index : 0
7677      };
7678      // get this.cellsByRow.columnWidth
7679      this._getSegments();
7680      // get this.cellsByRow.rowHeight
7681      this._getSegments(true);
7682    },
7683
7684    _cellsByRowLayout : function( $elems ) {
7685      var instance = this,
7686          props = this.cellsByRow;
7687      $elems.each( function(){
7688        var $this = $(this),
7689            col = props.index % props.cols,
7690            row = Math.floor( props.index / props.cols ),
7691            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
7692            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2 ;
7693        instance._pushPosition( $this, x, y );
7694        props.index ++;
7695      });
7696    },
7697
7698    _cellsByRowGetContainerSize : function() {
7699      return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top };
7700    },
7701
7702    _cellsByRowResizeChanged : function() {
7703      return this._checkIfSegmentsChanged();
7704    },
7705
7706
7707    // ====================== straightDown ======================
7708
7709    _straightDownReset : function() {
7710      this.straightDown = {
7711        y : 0
7712      };
7713    },
7714
7715    _straightDownLayout : function( $elems ) {
7716      var instance = this;
7717      $elems.each( function( i ){
7718        var $this = $(this);
7719        instance._pushPosition( $this, 0, instance.straightDown.y );
7720        instance.straightDown.y += $this.outerHeight(true);
7721      });
7722    },
7723
7724    _straightDownGetContainerSize : function() {
7725      return { height : this.straightDown.y };
7726    },
7727
7728    _straightDownResizeChanged : function() {
7729      return true;
7730    },
7731
7732
7733    // ====================== masonryHorizontal ======================
7734
7735    _masonryHorizontalReset : function() {
7736      // layout-specific props
7737      this.masonryHorizontal = {};
7738      // FIXME shouldn't have to call this again
7739      this._getSegments( true );
7740      var i = this.masonryHorizontal.rows;
7741      this.masonryHorizontal.rowXs = [];
7742      while (i--) {
7743        this.masonryHorizontal.rowXs.push( 0 );
7744      }
7745    },
7746
7747    _masonryHorizontalLayout : function( $elems ) {
7748      var instance = this,
7749          props = instance.masonryHorizontal;
7750      $elems.each(function(){
7751        var $this  = $(this),
7752            //how many rows does this brick span
7753            rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight );
7754        rowSpan = Math.min( rowSpan, props.rows );
7755
7756        if ( rowSpan === 1 ) {
7757          // if brick spans only one column, just like singleMode
7758          instance._masonryHorizontalPlaceBrick( $this, props.rowXs );
7759        } else {
7760          // brick spans more than one row
7761          // how many different places could this brick fit horizontally
7762          var groupCount = props.rows + 1 - rowSpan,
7763              groupX = [],
7764              groupRowX, i;
7765
7766          // for each group potential horizontal position
7767          for ( i=0; i < groupCount; i++ ) {
7768            // make an array of colY values for that one group
7769            groupRowX = props.rowXs.slice( i, i+rowSpan );
7770            // and get the max value of the array
7771            groupX[i] = Math.max.apply( Math, groupRowX );
7772          }
7773
7774          instance._masonryHorizontalPlaceBrick( $this, groupX );
7775        }
7776      });
7777    },
7778
7779    _masonryHorizontalPlaceBrick : function( $brick, setX ) {
7780      // get the minimum Y value from the columns
7781      var minimumX  = Math.min.apply( Math, setX ),
7782          smallRow  = 0;
7783      // Find index of smallest row, the first from the top
7784      for (var i=0, len = setX.length; i < len; i++) {
7785        if ( setX[i] === minimumX ) {
7786          smallRow = i;
7787          break;
7788        }
7789      }
7790
7791      // position the brick
7792      var x = minimumX,
7793          y = this.masonryHorizontal.rowHeight * smallRow;
7794      this._pushPosition( $brick, x, y );
7795
7796      // apply setHeight to necessary columns
7797      var setWidth = minimumX + $brick.outerWidth(true),
7798          setSpan = this.masonryHorizontal.rows + 1 - len;
7799      for ( i=0; i < setSpan; i++ ) {
7800        this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth;
7801      }
7802    },
7803
7804    _masonryHorizontalGetContainerSize : function() {
7805      var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs );
7806      return { width: containerWidth };
7807    },
7808
7809    _masonryHorizontalResizeChanged : function() {
7810      return this._checkIfSegmentsChanged(true);
7811    },
7812
7813
7814    // ====================== fitColumns ======================
7815
7816    _fitColumnsReset : function() {
7817      this.fitColumns = {
7818        x : 0,
7819        y : 0,
7820        width : 0
7821      };
7822    },
7823
7824    _fitColumnsLayout : function( $elems ) {
7825      var instance = this,
7826          containerHeight = this.element.height(),
7827          props = this.fitColumns;
7828      $elems.each( function() {
7829        var $this = $(this),
7830            atomW = $this.outerWidth(true),
7831            atomH = $this.outerHeight(true);
7832
7833        if ( props.y !== 0 && atomH + props.y > containerHeight ) {
7834          // if this element cannot fit in the current column
7835          props.x = props.width;
7836          props.y = 0;
7837        }
7838
7839        // position the atom
7840        instance._pushPosition( $this, props.x, props.y );
7841
7842        props.width = Math.max( props.x + atomW, props.width );
7843        props.y += atomH;
7844
7845      });
7846    },
7847
7848    _fitColumnsGetContainerSize : function () {
7849      return { width : this.fitColumns.width };
7850    },
7851
7852    _fitColumnsResizeChanged : function() {
7853      return true;
7854    },
7855
7856
7857
7858    // ====================== cellsByColumn ======================
7859
7860    _cellsByColumnReset : function() {
7861      this.cellsByColumn = {
7862        index : 0
7863      };
7864      // get this.cellsByColumn.columnWidth
7865      this._getSegments();
7866      // get this.cellsByColumn.rowHeight
7867      this._getSegments(true);
7868    },
7869
7870    _cellsByColumnLayout : function( $elems ) {
7871      var instance = this,
7872          props = this.cellsByColumn;
7873      $elems.each( function(){
7874        var $this = $(this),
7875            col = Math.floor( props.index / props.rows ),
7876            row = props.index % props.rows,
7877            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
7878            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
7879        instance._pushPosition( $this, x, y );
7880        props.index ++;
7881      });
7882    },
7883
7884    _cellsByColumnGetContainerSize : function() {
7885      return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth };
7886    },
7887
7888    _cellsByColumnResizeChanged : function() {
7889      return this._checkIfSegmentsChanged(true);
7890    },
7891
7892    // ====================== straightAcross ======================
7893
7894    _straightAcrossReset : function() {
7895      this.straightAcross = {
7896        x : 0
7897      };
7898    },
7899
7900    _straightAcrossLayout : function( $elems ) {
7901      var instance = this;
7902      $elems.each( function( i ){
7903        var $this = $(this);
7904        instance._pushPosition( $this, instance.straightAcross.x, 0 );
7905        instance.straightAcross.x += $this.outerWidth(true);
7906      });
7907    },
7908
7909    _straightAcrossGetContainerSize : function() {
7910      return { width : this.straightAcross.x };
7911    },
7912
7913    _straightAcrossResizeChanged : function() {
7914      return true;
7915    }
7916
7917  };
7918
7919
7920  // ======================= imagesLoaded Plugin ===============================
7921  /*!
7922   * jQuery imagesLoaded plugin v1.1.0
7923   * http://github.com/desandro/imagesloaded
7924   *
7925   * MIT License. by Paul Irish et al.
7926   */
7927
7928
7929  // $('#my-container').imagesLoaded(myFunction)
7930  // or
7931  // $('img').imagesLoaded(myFunction)
7932
7933  // execute a callback when all images have loaded.
7934  // needed because .load() doesn't work on cached images
7935
7936  // callback function gets image collection as argument
7937  //  `this` is the container
7938
7939  $.fn.imagesLoaded = function( callback ) {
7940    var $this = this,
7941        $images = $this.find('img').add( $this.filter('img') ),
7942        len = $images.length,
7943        blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==',
7944        loaded = [];
7945
7946    function triggerCallback() {
7947      callback.call( $this, $images );
7948    }
7949
7950    function imgLoaded( event ) {
7951      var img = event.target;
7952      if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
7953        loaded.push( img );
7954        if ( --len <= 0 ){
7955          setTimeout( triggerCallback );
7956          $images.unbind( '.imagesLoaded', imgLoaded );
7957        }
7958      }
7959    }
7960
7961    // if no images, trigger immediately
7962    if ( !len ) {
7963      triggerCallback();
7964    }
7965
7966    $images.bind( 'load.imagesLoaded error.imagesLoaded',  imgLoaded ).each( function() {
7967      // cached images don't fire load sometimes, so we reset src.
7968      var src = this.src;
7969      // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
7970      // data uri bypasses webkit log warning (thx doug jones)
7971      this.src = blank;
7972      this.src = src;
7973    });
7974
7975    return $this;
7976  };
7977
7978
7979  // helper function for logging errors
7980  // $.error breaks jQuery chaining
7981  var logError = function( message ) {
7982    if ( window.console ) {
7983      window.console.error( message );
7984    }
7985  };
7986
7987  // =======================  Plugin bridge  ===============================
7988  // leverages data method to either create or return $.Isotope constructor
7989  // A bit from jQuery UI
7990  //   https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
7991  // A bit from jcarousel
7992  //   https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarou
7992sel.js
7993
7994  $.fn.isotope = function( options, callback ) {
7995    if ( typeof options === 'string' ) {
7996      // call method
7997      var args = Array.prototype.slice.call( arguments, 1 );
7998
7999      this.each(function(){
8000        var instance = $.data( this, 'isotope' );
8001        if ( !instance ) {
8002          logError( "cannot call methods on isotope prior to initialization; " +
8003              "attempted to call method '" + options + "'" );
8004          return;
8005        }
8006        if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
8007          logError( "no such method '" + options + "' for isotope instance" );
8008          return;
8009        }
8010        // apply method
8011        instance[ options ].apply( instance, args );
8012      });
8013    } else {
8014      this.each(function() {
8015        var instance = $.data( this, 'isotope' );
8016        if ( instance ) {
8017          // apply options & init
8018          instance.option( options );
8019          instance._init( callback );
8020        } else {
8021          // initialize new instance
8022          $.data( this, 'isotope', new $.Isotope( options, this, callback ) );
8023        }
8024      });
8025    }
8026    // return jQuery object
8027    // so plugin methods do not have to
8028    return this;
8029  };
8030
8031})( window, jQuery );
8032/*jshint undef: true */
8033/*global jQuery: true */
8034
8035/*
8036   --------------------------------
8037   Infinite Scroll
8038   --------------------------------
8039   + https://github.com/paulirish/infinite-scroll
8040   + version 2.0b2.120519
8041   + Copyright 2011/12 Paul Irish & Luke Shumard
8042   + Licensed under the MIT license
8043
8044   + Documentation: http://infinite-scroll.com/
8045*/
8046
8047(function (window, $, undefined) {
8048	"use strict";
8049
8050    $.infinitescroll = function infscr(options, callback, element) {
8051        this.element = $(element);
8052
8053        // Flag the object in the event of a failed creation
8054        if (!this._create(options, callback)) {
8055            this.failed = true;
8056        }
8057    };
8058
8059    $.infinitescroll.defaults = {
8060        loading: {
8061            finished: undefined,
8062            finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
8063			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
8063HlhskwrTJciZHEXsgaqS4s6PJiCAr1uzYU8kBBSgnWFqpoMJMUjGtDmUwkmfVmVypakWhEKvXsS4nhLW5wNjVroJIoc05wSzTr0PtiigpYe4EC2vj4iWrFu5euWIMRBhacaVJhYQBEFjA9jHjyQ0xEABwGceGAZYjY0YBOrRLCxUp29QM+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
8063iqpQpZ4apwSwRtjqrB3muoF9BboaXKmshlqWqsWiGt2wphJkQbAU5hoCACH5BAUKABsALAcABADOAAsAAAX/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",
8064            msg: null,
8065            msgText: "<em>Loading the next set of products...</em>",
8066            selector: null,
8067            speed: 'fast',
8068            start: undefined
8069        },
8070        state: {
8071            isDuringAjax: false,
8072            isInvalidPage: false,
8073            isDestroyed: false,
8074            isDone: false, // For when it goes all the way through the archive.
8075            isPaused: false,
8076            currPage: 1
8077        },
8078        debug: false,
8079		behavior: undefined,
8080        binder: $(window), // used to cache the selector
8081        nextSelector: "div.navigation a:first",
8082        navSelector: "div.navigation",
8083        contentSelector: null, // rename to pageFragment
8084        extraScrollPx: 150,
8085        itemSelector: "div.post",
8086        animate: false,
8087        pathParse: undefined,
8088        dataType: 'html',
8089        appendCallback: true,
8090        bufferPx: 40,
8091        errorCallback: function () { },
8092        infid: 0, //Instance ID
8093        pixelsFromNavToBottom: undefined,
8094        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
8095		prefill: false, // When the document is smaller than the window, load data until the document is larger or links are exhausted
8096        maxPage: undefined // to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)
8097	};
8098
8099    $.infinitescroll.prototype = {
8100
8101        /*	
8102            ----------------------------
8103            Private methods
8104            ----------------------------
8105            */
8106
8107        // Bind or unbind from scroll
8108        _binding: function infscr_binding(binding) {
8109
8110            var instance = this,
8111            opts = instance.options;
8112
8113            opts.v = '2.0b2.120520';
8114
8115            // if behavior is defined and this function is extended, call that instead of default
8116            if (!!opts.behavior && this['_binding_'+opts.behavior] !== undefined) {
8117                this['_binding_'+opts.behavior].call(this);
8118                return;
8119            }
8120
8121            if (binding !== 'bind' && binding !== 'unbind') {
8122                this._debug('Binding value  ' + binding + ' not valid');
8123                return false;
8124            }
8125
8126            if (binding === 'unbind') {
8127                (this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);
8128            } else {
8129                (this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function () {
8130                    instance.scroll();
8131                });
8132            }
8133
8134            this._debug('Binding', binding);
8135        },
8136
8137        // Fundamental aspects of the plugin are initialized
8138        _create: function infscr_create(options, callback) {
8139
8140            // Add custom options to defaults
8141            var opts = $.extend(true, {}, $.infinitescroll.defaults, options);
8142			this.options = opts;
8143			var $window = $(window);
8144			var instance = this;
8145
8146			// Validate selectors
8147            if (!instance._validate(options)) {
8148				return false;
8149			}
8150
8151            // Validate page fragment path
8152            var path = $(opts.nextSelector).attr('href');
8153            if (!path) {
8154                this._debug('Navigation selector not found');
8155                return false;
8156            }
8157
8158            // Set the path to be a relative URL from root.
8159            opts.path = opts.path || this._determinepath(path);
8160
8161            // contentSelector is 'page fragment' option for .load() / .ajax() calls
8162            opts.contentSelector = opts.contentSelector || this.element;
8163
8164            // loading.selector - if we want to place the load message in a specific selector, defaulted to the contentSelector
8165            opts.loading.selector = opts.loading.selector || opts.contentSelector;
8166
8167            // Define loading.msg
8168            opts.loading.msg = opts.loading.msg || $('<div id="infscr-loading"><img alt="Loading..." src="' + opts.loading.img + '" /><div>' + opts.loading.msgText + '</div></div>');
8169
8170            // Preload loading.img
8171            (new Image()).src = opts.loading.img;
8172
8173            // distance from nav links to bottom
8174            // computed as: height of the document + top offset of container - top offset of nav link
8175            if(opts.pixelsFromNavToBottom === undefined) {
8176				opts.pixelsFromNavToBottom = $(document).height() - $(opts.navSelector).offset().top;
8177			}
8178
8179			var self = this;
8180
8181            // determine loading.start actions
8182            opts.loading.start = opts.loading.start || function() {
8183                $(opts.navSelector).hide();
8184                opts.loading.msg
8185                .appendTo(opts.loading.selector.parent())
8186                .show(opts.loading.speed, $.proxy(function() {
8187					this.beginAjax(opts);
8188				}, self));
8189            };
8190
8191            // determine loading.finished actions
8192            opts.loading.finished = opts.loading.finished || function() {
8193                opts.loading.msg.fadeOut(opts.loading.speed);
8194            };
8195
8196			// callback loading
8197            opts.callback = function(instance, data, url) {
8198                if (!!opts.behavior && instance['_callback_'+opts.behavior] !== undefined) {
8199                    instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data, url);
8200                }
8201
8202                if (callback) {
8203                    callback.call($(opts.contentSelector)[0], data, opts, url);
8204                }
8205
8206				if (opts.prefill) {
8207					$window.bind("resize.infinite-scroll", instance._prefill);
8208				}
8209            };
8210
8211			if (options.debug) {
8212				// Tell IE9 to use its built-in console
8213				if (Function.prototype.bind && (typeof console === 'object' || typeof console === 'function') && typeof console.log === "object") {
8214					["log","info","warn","error","assert","dir","clear","profile","profileEnd"]
8215						.forEach(function (method) {
8216							console[method] = this.call(console[method], console);
8217						}, Function.prototype.bind);
8218				}
8219			}
8220
8221            this._setup();
8222
8223			// Setups the prefill method for use
8224			if (opts.prefill) {
8225				this._prefill();
8226			}
8227
8228            // Return true to indicate successful creation
8229            return true;
8230        },
8231
8232		_prefill: function infscr_prefill() {
8233			var instance = this;
8234			var $document = $(document);
8235			var $window = $(window);
8236
8237			function needsPrefill() {
8238				return ($document.height() <= $window.height());
8239			}
8240
8241			this._prefill = function() {
8242				if (needsPrefill()) {
8243					instance.scroll();
8244				}
8245
8246				$window.bind("resize.infinite-scroll", function() {
8247					if (needsPrefill()) {
8248						$window.unbind("resize.infinite-scroll");
8249						instance.scroll();
8250					}
8251				});
8252			};
8253
8254			// Call self after setting up the new function
8255			this._prefill();
8256		},
8257
8258        // Console log wrapper
8259        _debug: function infscr_debug() {
8260			if (true !== this.options.debug) {
8261				return;
8262			}
8263
8264			if (typeof console !== 'undefined' && typeof console.log === 'function') {
8265				// Modern browsers
8266				// Single argument, which is a string
8267				if ((Array.prototype.slice.call(arguments)).length === 1 && typeof Array.prototype.slice.call(arguments)[0] === 'string') {
8268					console.log( (Array.prototype.slice.call(arguments)).toString() );
8269				} else {
8270					console.log( Array.prototype.slice.call(arguments) );
8271				}
8272			} else if (!Function.prototype.bind && typeof console !== 'undefined' && typeof console.log === 'object') {
8273				// IE8
8274				Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
8275			}
8276        },
8277
8278        // find the number to increment in the path.
8279        _determinepath: function infscr_determinepath(path) {
8280
8281            var opts = this.options;
8282
8283            // if behavior is defined and this function is extended, call that instead of default
8284            if (!!opts.behavior && this['_determinepath_'+opts.behavior] !== undefined) {
8285                return this['_determinepath_'+opts.behavior].call(this,path);
8286            }
8287
8288            if (!!opts.pathParse) {
8289
8290                this._debug('pathParse manual');
8291                return opts.pathParse(path, this.options.state.currPage+1);
8292
8293            } else if (path.match(/^(.*?)\b2\b(.*?$)/)) {
8294                path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
8295
8296                // if there is any 2 in the url at all.    
8297            } else if (path.match(/^(.*?)2(.*?$)/)) {
8298
8299                // page= is used in django:
8300                // http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127
8301                if (path.match(/^(.*?page=)2(\/.*|$)/)) {
8302                    path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
8303                    return path;
8304                }
8305
8306                path = path.match(/^(.*?)2(.*?$)/).slice(1);
8307
8308            } else {
8309
8310                // page= is used in drupal too but second page is page=1 not page=2:
8311                // thx Jerod Fritz, vladikoff
8312                if (path.match(/^(.*?page=)1(\/.*|$)/)) {
8313                    path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
8314                    return path;
8315                } else {
8316                    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.');
8317                    // Get rid of isInvalidPage to allow permalink to state
8318                    opts.state.isInvalidPage = true;  //prevent it from running on this page.
8319                }
8320            }
8321            this._debug('determinePath', path);
8322            return path;
8323
8324        },
8325
8326        // Custom error
8327        _error: function infscr_error(xhr) {
8328
8329            var opts = this.options;
8330
8331            // if behavior is defined and this function is extended, call that instead of default
8332            if (!!opts.behavior && this['_error_'+opts.behavior] !== undefined) {
8333                this['_error_'+opts.behavior].call(this,xhr);
8334                return;
8335            }
8336
8337            if (xhr !== 'destroy' && xhr !== 'end') {
8338                xhr = 'unknown';
8339            }
8340
8341            this._debug('Error', xhr);
8342
8343            if (xhr === 'end') {
8344                this._showdonemsg();
8345            }
8346
8347            opts.state.isDone = true;
8348            opts.state.currPage = 1; // if you need to go back to this instance
8349            opts.state.isPaused = false;
8350            this._binding('unbind');
8351
8352        },
8353
8354        // Load Callback
8355        _loadcallback: function infscr_loadcallback(box, data, url) {
8356            var opts = this.options,
8357            callback = this.options.callback, // GLOBAL OBJECT FOR CALLBACK
8358            result = (opts.state.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
8359            frag;
8360
8361            // if behavior is defined and this function is extended, call that instead of default
8362            if (!!opts.behavior && this['_loadcallback_'+opts.behavior] !== undefined) {
8363                this['_loadcallback_'+opts.behavior].call(this,box,data);
8364                return;
8365            }
8366
8367			switch (result) {
8368				case 'done':
8369					this._showdonemsg();
8370					return false;
8371
8372				case 'no-append':
8373					if (opts.dataType === 'html') {
8374						data = '<div>' + data + '</div>';
8375						data = $(data).find(opts.itemSelector);
8376					}
8377					break;
8378
8379				case 'append':
8380					var children = box.children();
8381					// if it didn't return anything
8382					if (children.length === 0) {
8383						return this._error('end');
8384					}
8385
8386					// use a documentFragment because it works when content is going into a table or UL
8387					frag = document.createDocumentFragment();
8388					while (box[0].firstChild) {
8389						frag.appendChild(box[0].firstChild);
8390					}
8391
8392					this._debug('contentSelector', $(opts.contentSelector)[0]);
8393					$(opts.contentSelector)[0].appendChild(frag);
8394					// previously, we would pass in the new DOM element as context for the callback
8395					// however we're now using a documentfragment, which doesn't have parents or children,
8396					// so the context is the contentContainer guy, and we pass in an array
8397					// of the elements collected as the first argument.
8398
8399					data = children.get();
8400					break;
8401			}
8402
8403            // loadingEnd function
8404            opts.loading.finished.call($(opts.contentSelector)[0],opts);
8405
8406            // smooth scroll to ease in the new content
8407            if (opts.animate) {
8408                var scrollTo = $(window).scrollTop() + $('#infscr-loading').height() + opts.extraScrollPx + 'px';
8409                $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.state.isDuringAjax = false; });
8410            }
8411
8412            if (!opts.animate) {
8413				// once the call is done, we can allow it again.
8414				opts.state.isDuringAjax = false;
8415			}
8416
8417            callback(this, data, url);
8418
8419			if (opts.prefill) {
8420				this._prefill();
8421			}
8422		},
8423
8424        _nearbottom: function infscr_nearbottom() {
8425
8426            var opts = this.options,
8427            pixelsFromWindowBottomToBottom = 0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
8428
8429            // if behavior is defined and this function is extended, call that instead of default
8430            if (!!opts.behavior && this['_nearbottom_'+opts.behavior] !== undefined) {
8431                return this['_nearbottom_'+opts.behavior].call(this);
8432            }
8433
8434            this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
8435
8436            // if distance remaining in the scroll (including buffer) is less than the orignal nav to bottom....
8437            return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
8438
8439        },
8440
8441        // Pause / temporarily disable plugin from firing
8442        _pausing: function infscr_pausing(pause) {
8443
8444            var opts = this.options;
8445
8446            // if behavior is defined and this function is extended, call that instead of default
8447            if (!!opts.behavior && this['_pausing_'+opts.behavior] !== undefined) {
8448                this['_pausing_'+opts.behavior].call(this,pause);
8449                return;
8450            }
8451
8452            // If pause is not 'pause' or 'resume', toggle it's value
8453            if (pause !== 'pause' && pause !== 'resume' && pause !== null) {
8454                this._debug('Invalid argument. Toggling pause value instead');
8455            }
8456
8457            pause = (pause && (pause === 'pause' || pause === 'resume')) ? pause : 'toggle';
8458
8459            switch (pause) {
8460                case 'pause':
8461                    opts.state.isPaused = true;
8462                break;
8463
8464                case 'resume':
8465                    opts.state.isPaused = false;
8466                break;
8467
8468                case 'toggle':
8469                    opts.state.isPaused = !opts.state.isPaused;
8470                break;
8471            }
8472
8473            this._debug('Paused', opts.state.isPaused);
8474            return false;
8475
8476        },
8477
8478        // Behavior is determined
8479        // If the behavior option is undefined, it will set to default and bind to scroll
8480        _setup: function infscr_setup() {
8481
8482            var opts = this.options;
8483
8484            // if behavior is defined and this function is extended, call that instead of default
8485            if (!!opts.behavior && this['_setup_'+opts.behavior] !== undefined) {
8486                this['_setup_'+opts.behavior].call(this);
8487                return;
8488            }
8489
8490            this._binding('bind');
8491
8492            return false;
8493
8494        },
8495
8496        // Show done message
8497        _showdonemsg: function infscr_showdonemsg() {
8498
8499            var opts = this.options;
8500
8501            // if behavior is defined and this function is extended, call that instead of default
8502            if (!!opts.behavior && this['_showdonemsg_'+opts.behavior] !== undefined) {
8503                this['_showdonemsg_'+opts.behavior].call(this);
8504                return;
8505            }
8506
8507            opts.loading.msg
8508            .find('img')
8509            .hide()
8510            .parent()
8511            .find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
8512                $(this).parent().fadeOut(opts.loading.speed);
8513            });
8514
8515            // user provided callback when done    
8516            opts.errorCallback.call($(opts.contentSelector)[0],'done');
8517        },
8518
8519        // grab each selector option and see if any fail
8520        _validate: function infscr_validate(opts) {
8521            for (var key in opts) {
8522                if (key.indexOf && key.indexOf('Selector') > -1 && $(opts[key]).length === 0) {
8523                    this._debug('Your ' + key + ' found no elements.');
8524                    return false;
8525                }
8526            }
8527
8528            return true;
8529        },
8530
8531        /*	
8532            ----------------------------
8533            Public methods
8534            ----------------------------
8535            */
8536
8537        // Bind to scroll
8538        bind: function infscr_bind() {
8539            this._binding('bind');
8540        },
8541
8542        // Destroy current instance of plugin
8543        destroy: function infscr_destroy() {
8544            this.options.state.isDestroyed = true;
8545			this.options.loading.finished();
8546            return this._error('destroy');
8547        },
8548
8549        // Set pause value to false
8550        pause: function infscr_pause() {
8551            this._pausing('pause');
8552        },
8553
8554        // Set pause value to false
8555        resume: function infscr_resume() {
8556            this._pausing('resume');
8557        },
8558
8559		beginAjax: function infscr_ajax(opts) {
8560			var instance = this,
8561				path = opts.path,
8562				box, desturl, method, condition;
8563
8564			// increment the URL bit. e.g. /page/3/
8565			opts.state.currPage++;
8566
8567            // Manually control maximum page 
8568            if ( opts.maxPage != undefined && opts.state.currPage > opts.maxPage ){
8569                this.destroy();
8570                return;
8571            }
8572
8573			// if we're dealing with a table we can't use DIVs
8574			box = $(opts.contentSelector).is('table') ? $('<tbody/>') : $('<div/>');
8575
8576			desturl = (typeof path === 'function') ? path(opts.state.currPage) : path.join(opts.state.currPage);
8577			instance._debug('heading into ajax', desturl);
8578
8579			method = (opts.dataType === 'html' || opts.dataType === 'json' ) ? opts.dataType : 'html+callback';
8580			if (opts.appendCallback && opts.dataType === 'html') {
8581				method += '+callback';
8582			}
8583
8584			switch (method) {
8585				case 'html+callback':
8586					instance._debug('Using HTML via .load() method');
8587					box.load(desturl + ' ' + opts.itemSelector, undefined, function infscr_ajax_callback(responseText) {
8588						instance._loadcallback(box, responseText, desturl);
8589					});
8590
8591					break;
8592
8593				case 'html':
8594					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
8595					$.ajax({
8596						// params
8597						url: desturl,
8598						dataType: opts.dataType,
8599						complete: function infscr_ajax_callback(jqXHR, textStatus) {
8600							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
8601							if (condition) {
8602								instance._loadcallback(box, jqXHR.responseText, desturl);
8603							} else {
8604								instance._error('end');
8605							}
8606						}
8607					});
8608
8609					break;
8610				case 'json':
8611					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
8612					$.ajax({
8613						dataType: 'json',
8614						type: 'GET',
8615						url: desturl,
8616						success: function (data, textStatus, jqXHR) {
8617							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
8618							if (opts.appendCallback) {
8619								// if appendCallback is true, you must defined template in options.
8620								// note that data passed into _loadcallback is already an html (after processed in opts.template(data)).
8621								if (opts.template !== undefined) {
8622									var theData = opts.template(data);
8623									box.append(theData);
8624									if (condition) {
8625										instance._loadcallback(box, theData);
8626									} else {
8627										instance._error('end');
8628									}
8629								} else {
8630									instance._debug("template must be defined.");
8631									instance._error('end');
8632								}
8633							} else {
8634								// if appendCallback is false, we will pass in the JSON object. you should handle it yourself in your callback.
8635								if (condition) {
8636									instance._loadcallback(box, data, desturl);
8637								} else {
8638									instance._error('end');
8639								}
8640							}
8641						},
8642						error: function() {
8643							instance._debug("JSON ajax request failed.");
8644							instance._error('end');
8645						}
8646					});
8647
8648					break;
8649			}
8650		},
8651
8652        // Retrieve next set of content items
8653        retrieve: function infscr_retrieve(pageNum) {
8654			pageNum = pageNum || null;
8655
8656			var instance = this,
8657            opts = instance.options;
8658
8659            // if behavior is defined and this function is extended, call that instead of default
8660            if (!!opts.behavior && this['retrieve_'+opts.behavior] !== undefined) {
8661                this['retrieve_'+opts.behavior].call(this,pageNum);
8662                return;
8663            }
8664
8665            // for manual triggers, if destroyed, get out of here
8666            if (opts.state.isDestroyed) {
8667                this._debug('Instance is destroyed');
8668                return false;
8669            }
8670
8671            // we dont want to fire the ajax multiple times
8672            opts.state.isDuringAjax = true;
8673
8674            opts.loading.start.call($(opts.contentSelector)[0],opts);
8675        },
8676
8677        // Check to see next page is needed
8678        scroll: function infscr_scroll() {
8679
8680            var opts = this.options,
8681            state = opts.state;
8682
8683            // if behavior is defined and this function is extended, call that instead of default
8684            if (!!opts.behavior && this['scroll_'+opts.behavior] !== undefined) {
8685                this['scroll_'+opts.behavior].call(this);
8686                return;
8687            }
8688
8689            if (state.isDuringAjax || state.isInvalidPage || state.isDone || state.isDestroyed || state.isPaused) {
8690				return;
8691			}
8692
8693            if (!this._nearbottom()) {
8694				return;
8695			}
8696
8697            this.retrieve();
8698
8699        },
8700
8701        // Toggle pause value
8702        toggle: function infscr_toggle() {
8703            this._pausing();
8704        },
8705
8706        // Unbind from scroll
8707        unbind: function infscr_unbind() {
8708            this._binding('unbind');
8709        },
8710
8711        // update options
8712        update: function infscr_options(key) {
8713            if ($.isPlainObject(key)) {
8714                this.options = $.extend(true,this.options,key);
8715            }
8716        }
8717    };
8718
8719
8720    /*	
8721        ----------------------------
8722        Infinite Scroll function
8723        ----------------------------
8724
8725        Borrowed logic from the following...
8726
8727        jQuery UI
8728        - https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
8729
8730        jCarousel
8731        - https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
8732
8733        Masonry
8734        - https://github.com/desandro/masonry/blob/master/jquery.masonry.js		
8735
8736*/
8737
8738    $.fn.infinitescroll = function infscr_init(options, callback) {
8739
8740        var thisCall = typeof options;
8741
8742        switch (thisCall) {
8743
8744            // method 
8745            case 'string':
8746                var args = Array.prototype.slice.call(arguments, 1);
8747
8748				this.each(function () {
8749					var instance = $.data(this, 'infinitescroll');
8750
8751					if (!instance) {
8752						// not setup yet
8753						// return $.error('Method ' + options + ' cannot be called until Infinite Scroll is setup');
8754						return false;
8755					}
8756
8757					if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
8758						// return $.error('No such method ' + options + ' for Infinite Scroll');
8759						return false;
8760					}
8761
8762					// no errors!
8763					instance[options].apply(instance, args);
8764				});
8765
8766            break;
8767
8768            // creation 
8769            case 'object':
8770
8771                this.each(function () {
8772
8773                var instance = $.data(this, 'infinitescroll');
8774
8775                if (instance) {
8776
8777                    // update options of current instance
8778                    instance.update(options);
8779
8780                } else {
8781
8782                    // initialize new instance
8783                    instance = new $.infinitescroll(options, callback, this);
8784
8785                    // don't attach if instantiation failed
8786                    if (!instance.failed) {
8787                        $.data(this, 'infinitescroll', instance);
8788                    }
8789
8790                }
8791
8792            });
8793
8794            break;
8795
8796        }
8797
8798        return this;
8799    };
8800
8801
8802
8803    /* 
8804     * smartscroll: debounced scroll event for jQuery *
8805     * https://github.com/lukeshumard/smartscroll
8806     * Based on smartresize by @louis_remi: https://github.com/lrbabe/jquery.smartresize.js *
8807     * Copyright 2011 Louis-Remi & Luke Shumard * Licensed under the MIT license. *
8808     */
8809
8810    var event = $.event,
8811    scrollTimeout;
8812
8813    event.special.smartscroll = {
8814        setup: function () {
8815            $(this).bind("scroll", event.special.smartscroll.handler);
8816        },
8817        teardown: function () {
8818            $(this).unbind("scroll", event.special.smartscroll.handler);
8819        },
8820        handler: function (event, execAsap) {
8821            // Save the context
8822            var context = this,
8823            args = arguments;
8824
8825            // set correct event type
8826            event.type = "smartscroll";
8827
8828            if (scrollTimeout) { clearTimeout(scrollTimeout); }
8829            scrollTimeout = setTimeout(function () {
8830                $(context).trigger('smartscroll', args);
8831            }, execAsap === "execAsap" ? 0 : 100);
8832        }
8833    };
8834
8835    $.fn.smartscroll = function (fn) {
8836        return fn ? this.bind("smartscroll", fn) : this.trigger("smartscroll", ["execAsap"]);
8837    };
8838
8839
8840})(window, jQuery);
8841
8842/*
8843	--------------------------------
8844	Infinite Scroll Behavior
8845	Manual / Twitter-style
8846	--------------------------------
8847	+ https://github.com/paulirish/infinitescroll/
8848	+ version 2.0b2.110617
8849	+ Copyright 2011 Paul Irish & Luke Shumard
8850	+ Licensed under the MIT license
8851	
8852	+ Documentation: http://infinite-scroll.com/
8853	
8854*/
8855
8856(function($, undefined) {
8857	$.extend($.infinitescroll.prototype,{
8858
8859		_setup_click: function infscr_setup_click () {
8860			var opts = this.options,
8861				instance = this;
8862			// Bind nextSelector link to retrieve
8863			$(opts.nextSelector).click(function(e) {
8864				if (e.which == 1 && !e.metaKey && !e.shiftKey) {
8865					e.preventDefault();
8866					instance.retrieve();
8867				}
8868			});
8869
8870			// Define loadingStart to never hide pager
8871			instance.options.loading.start = function (opts) {
8872				opts.loading.msg
8873					.appendTo(opts.loading.selector)
8874					.show(opts.loading.speed, function () {
8875						instance.beginAjax(opts);
8876					});
8877			}
8878		},
8879		_showdonemsg_click: function infscr_showdonemsg_click () {
8880			var opts = this.options,
8881				instance = this;
8882
8883			//Do all the usual stuff
8884			opts.loading.msg
8885				.find('img')
8886				.hide()
8887				.parent()
8888				.find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
8889					$(this).parent().fadeOut('normal');
8890				});
8891
8892			//And also hide the navSelector
8893			$(opts.navSelector).fadeOut('normal');
8894
8895			// user provided callback when done
8896			opts.errorCallback.call($(opts.contentSelector)[0],'done');
8897
8898		}
8899
8900	});
8901})(jQuery);
8902
8903/*!
vendor: 5,629 bytes, lines 8904-9112
8904 * fancyBox - jQuery Plugin
8905 * version: 2.1.3 (Tue, 23 Oct 2012)
8906 * @requires jQuery v1.6 or later
8907 *
8908 * Examples at http://fancyapps.com/fancybox/
8909 * License: www.fancyapps.com/fancybox/#license
8910 *
8911 * Copyright 2012 Janis Skarnelis - [email protected]
8912 *
8913 */
8914
8915(function (window, document, $, undefined) {
8916	"use strict";
8917
8918	var W = $(window),
8919		D = $(document),
8920		F = $.fancybox = function () {
8921			F.open.apply( this, arguments );
8922		},
8923		didUpdate = null,
8924		isTouch	  = document.createTouch !== undefined,
8925
8926		isQuery	= function(obj) {
8927			return obj && obj.hasOwnProperty && obj instanceof $;
8928		},
8929		isString = function(str) {
8930			return str && $.type(str) === "string";
8931		},
8932		isPercentage = function(str) {
8933			return isString(str) && str.indexOf('%') > 0;
8934		},
8935		isScrollable = function(el) {
8936			return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
8937		},
8938		getScalar = function(orig, dim) {
8939			var value = parseInt(orig, 10) || 0;
8940
8941			if (dim && isPercentage(orig)) {
8942				value = F.getViewport()[ dim ] / 100 * value;
8943			}
8944
8945			return Math.ceil(value);
8946		},
8947		getValue = function(value, dim) {
8948			return getScalar(value, dim) + 'px';
8949		};
8950
8951	$.extend(F, {
8952		// The current version of fancyBox
8953		version: '2.1.3',
8954
8955		defaults: {
8956			padding : 15,
8957			margin  : 20,
8958
8959			width     : 800,
8960			height    : 600,
8961			minWidth  : 100,
8962			minHeight : 100,
8963			maxWidth  : 9999,
8964			maxHeight : 9999,
8965
8966			autoSize   : true,
8967			autoHeight : false,
8968			autoWidth  : false,
8969
8970			autoResize  : true,
8971			autoCenter  : !isTouch,
8972			fitToView   : true,
8973			aspectRatio : false,
8974			topRatio    : 0.5,
8975			leftRatio   : 0.5,
8976
8977			scrolling : 'auto', // 'auto', 'yes' or 'no'
8978			wrapCSS   : '',
8979
8980			arrows     : true,
8981			closeBtn   : true,
8982			closeClick : false,
8983			nextClick  : false,
8984			mouseWheel : true,
8985			autoPlay   : false,
8986			playSpeed  : 3000,
8987			preload    : 3,
8988			modal      : false,
8989			loop       : true,
8990
8991			ajax  : {
8992				dataType : 'html',
8993				headers  : { 'X-fancyBox': true }
8994			},
8995			iframe : {
8996				scrolling : 'auto',
8997				preload   : true
8998			},
8999			swf : {
9000				wmode: 'transparent',
9001				allowfullscreen   : 'true',
9002				allowscriptaccess : 'always'
9003			},
9004
9005			keys  : {
9006				next : {
9007					13 : 'left', // enter
9008					34 : 'up',   // page down
9009					39 : 'left', // right arrow
9010					40 : 'up'    // down arrow
9011				},
9012				prev : {
9013					8  : 'right',  // backspace
9014					33 : 'down',   // page up
9015					37 : 'right',  // left arrow
9016					38 : 'down'    // up arrow
9017				},
9018				close  : [27], // escape key
9019				play   : [32], // space - start/stop slideshow
9020				toggle : [70]  // letter "f" - toggle fullscreen
9021			},
9022
9023			direction : {
9024				next : 'left',
9025				prev : 'right'
9026			},
9027
9028			scrollOutside  : true,
9029
9030			// Override some properties
9031			index   : 0,
9032			type    : null,
9033			href    : null,
9034			content : null,
9035			title   : null,
9036
9037			// HTML templates
9038			tpl: {
9039				wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
9040				image    : '<img class="fancybox-image" src="{href}" alt="" />',
9041				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>',
9042				error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
9043				closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
9044				next     : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
9045				prev     : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
9046			},
9047
9048			// Properties for each animation type
9049			// Opening fancyBox
9050			openEffect  : 'fade', // 'elastic', 'fade' or 'none'
9051			openSpeed   : 250,
9052			openEasing  : 'swing',
9053			openOpacity : true,
9054			openMethod  : 'zoomIn',
9055
9056			// Closing fancyBox
9057			closeEffect  : 'fade', // 'elastic', 'fade' or 'none'
9058			closeSpeed   : 250,
9059			closeEasing  : 'swing',
9060			closeOpacity : true,
9061			closeMethod  : 'zoomOut',
9062
9063			// Changing next gallery item
9064			nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
9065			nextSpeed  : 250,
9066			nextEasing : 'swing',
9067			nextMethod : 'changeIn',
9068
9069			// Changing previous gallery item
9070			prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
9071			prevSpeed  : 250,
9072			prevEasing : 'swing',
9073			prevMethod : 'changeOut',
9074
9075			// Enable default helpers
9076			helpers : {
9077				overlay : true,
9078				title   : true
9079			},
9080
9081			// Callbacks
9082			onCancel     : $.noop, // If canceling
9083			beforeLoad   : $.noop, // Before loading
9084			afterLoad    : $.noop, // After loading
9085			beforeShow   : $.noop, // Before changing in current item
9086			afterShow    : $.noop, // After opening
9087			beforeChange : $.noop, // Before changing gallery item
9088			beforeClose  : $.noop, // Before closing
9089			afterClose   : $.noop  // After closing
9090		},
9091
9092		//Current state
9093		group    : {}, // Selected group
9094		opts     : {}, // Group options
9095		previous : null,  // Previous element
9096		coming   : null,  // Element being loaded
9097		current  : null,  // Currently loaded element
9098		isActive : false, // Is activated
9099		isOpen   : false, // Is currently open
9100		isOpened : false, // Have been fully opened at least once
9101
9102		wrap  : null,
9103		skin  : null,
9104		outer : null,
9105		inner : null,
9106
9107		player : {
9108			timer    : null,
9109			isActive : false
9110		},
9111
9112		// Loaders
vendor: 35,360 bytes, lines 9113-10596
9113		ajaxLoad   : null,
9114		imgPreload : null,
9115
9116		// Some collections
9117		transitions : {},
9118		helpers     : {},
9119
9120		/*
9121		 *	Static methods
9122		 */
9123
9124		open: function (group, opts) {
9125			if (!group) {
9126				return;
9127			}
9128
9129			if (!$.isPlainObject(opts)) {
9130				opts = {};
9131			}
9132
9133			// Close if already active
9134			if (false === F.close(true)) {
9135				return;
9136			}
9137
9138			// Normalize group
9139			if (!$.isArray(group)) {
9140				group = isQuery(group) ? $(group).get() : [group];
9141			}
9142
9143			// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
9144			$.each(group, function(i, element) {
9145				var obj = {},
9146					href,
9147					title,
9148					content,
9149					type,
9150					rez,
9151					hrefParts,
9152					selector;
9153
9154				if ($.type(element) === "object") {
9155					// Check if is DOM element
9156					if (element.nodeType) {
9157						element = $(element);
9158					}
9159
9160					if (isQuery(element)) {
9161						obj = {
9162							href    : element.data('fancybox-href') || element.attr('href'),
9163							title   : element.data('fancybox-title') || element.attr('title'),
9164							isDom   : true,
9165							element : element
9166						};
9167
9168						if ($.metadata) {
9169							$.extend(true, obj, element.metadata());
9170						}
9171
9172					} else {
9173						obj = element;
9174					}
9175				}
9176
9177				href  = opts.href  || obj.href || (isString(element) ? element : null);
9178				title = opts.title !== undefined ? opts.title : obj.title || '';
9179
9180				content = opts.content || obj.content;
9181				type    = content ? 'html' : (opts.type  || obj.type);
9182
9183				if (!type && obj.isDom) {
9184					type = element.data('fancybox-type');
9185
9186					if (!type) {
9187						rez  = element.prop('class').match(/fancybox\.(\w+)/);
9188						type = rez ? rez[1] : null;
9189					}
9190				}
9191
9192				if (isString(href)) {
9193					// Try to guess the content type
9194					if (!type) {
9195						if (F.isImage(href)) {
9196							type = 'image';
9197
9198						} else if (F.isSWF(href)) {
9199							type = 'swf';
9200
9201						} else if (href.charAt(0) === '#') {
9202							type = 'inline';
9203
9204						} else if (isString(element)) {
9205							type    = 'html';
9206							content = element;
9207						}
9208					}
9209
9210					// Split url into two pieces with source url and content selector, e.g,
9211					// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
9212					if (type === 'ajax') {
9213						hrefParts = href.split(/\s+/, 2);
9214						href      = hrefParts.shift();
9215						selector  = hrefParts.shift();
9216					}
9217				}
9218
9219				if (!content) {
9220					if (type === 'inline') {
9221						if (href) {
9222							content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
9223
9224						} else if (obj.isDom) {
9225							content = element;
9226						}
9227
9228					} else if (type === 'html') {
9229						content = href;
9230
9231					} else if (!type && !href && obj.isDom) {
9232						type    = 'inline';
9233						content = element;
9234					}
9235				}
9236
9237				$.extend(obj, {
9238					href     : href,
9239					type     : type,
9240					content  : content,
9241					title    : title,
9242					selector : selector
9243				});
9244
9245				group[ i ] = obj;
9246			});
9247
9248			// Extend the defaults
9249			F.opts = $.extend(true, {}, F.defaults, opts);
9250
9251			// All options are merged recursive except keys
9252			if (opts.keys !== undefined) {
9253				F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
9254			}
9255
9256			F.group = group;
9257
9258			return F._start(F.opts.index);
9259		},
9260
9261		// Cancel image loading or abort ajax request
9262		cancel: function () {
9263			var coming = F.coming;
9264
9265			if (!coming || false === F.trigger('onCancel')) {
9266				return;
9267			}
9268
9269			F.hideLoading();
9270
9271			if (F.ajaxLoad) {
9272				F.ajaxLoad.abort();
9273			}
9274
9275			F.ajaxLoad = null;
9276
9277			if (F.imgPreload) {
9278				F.imgPreload.onload = F.imgPreload.onerror = null;
9279			}
9280
9281			if (coming.wrap) {
9282				coming.wrap.stop(true, true).trigger('onReset').remove();
9283			}
9284
9285			F.coming = null;
9286
9287			// If the first item has been canceled, then clear everything
9288			if (!F.current) {
9289				F._afterZoomOut( coming );
9290			}
9291		},
9292
9293		// Start closing animation if is open; remove immediately if opening/closing
9294		close: function (event) {
9295			F.cancel();
9296
9297			if (false === F.trigger('beforeClose')) {
9298				return;
9299			}
9300
9301			F.unbindEvents();
9302
9303			if (!F.isActive) {
9304				return;
9305			}
9306
9307			if (!F.isOpen || event === true) {
9308				$('.fancybox-wrap').stop(true).trigger('onReset').remove();
9309
9310				F._afterZoomOut();
9311
9312			} else {
9313				F.isOpen = F.isOpened = false;
9314				F.isClosing = true;
9315
9316				$('.fancybox-item, .fancybox-nav').remove();
9317
9318				F.wrap.stop(true, true).removeClass('fancybox-opened');
9319
9320				F.transitions[ F.current.closeMethod ]();
9321			}
9322		},
9323
9324		// Manage slideshow:
9325		//   $.fancybox.play(); - toggle slideshow
9326		//   $.fancybox.play( true ); - start
9327		//   $.fancybox.play( false ); - stop
9328		play: function ( action ) {
9329			var clear = function () {
9330					clearTimeout(F.player.timer);
9331				},
9332				set = function () {
9333					clear();
9334
9335					if (F.current && F.player.isActive) {
9336						F.player.timer = setTimeout(F.next, F.current.playSpeed);
9337					}
9338				},
9339				stop = function () {
9340					clear();
9341
9342					$('body').unbind('.player');
9343
9344					F.player.isActive = false;
9345
9346					F.trigger('onPlayEnd');
9347				},
9348				start = function () {
9349					if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
9350						F.player.isActive = true;
9351
9352						$('body').bind({
9353							'afterShow.player onUpdate.player'   : set,
9354							'onCancel.player beforeClose.player' : stop,
9355							'beforeLoad.player' : clear
9356						});
9357
9358						set();
9359
9360						F.trigger('onPlayStart');
9361					}
9362				};
9363
9364			if (action === true || (!F.player.isActive && action !== false)) {
9365				start();
9366			} else {
9367				stop();
9368			}
9369		},
9370
9371		// Navigate to next gallery item
9372		next: function ( direction ) {
9373			var current = F.current;
9374
9375			if (current) {
9376				if (!isString(direction)) {
9377					direction = current.direction.next;
9378				}
9379
9380				F.jumpto(current.index + 1, direction, 'next');
9381			}
9382		},
9383
9384		// Navigate to previous gallery item
9385		prev: function ( direction ) {
9386			var current = F.current;
9387
9388			if (current) {
9389				if (!isString(direction)) {
9390					direction = current.direction.prev;
9391				}
9392
9393				F.jumpto(current.index - 1, direction, 'prev');
9394			}
9395		},
9396
9397		// Navigate to gallery item by index
9398		jumpto: function ( index, direction, router ) {
9399			var current = F.current;
9400
9401			if (!current) {
9402				return;
9403			}
9404
9405			index = getScalar(index);
9406
9407			F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
9408			F.router    = router || 'jumpto';
9409
9410			if (current.loop) {
9411				if (index < 0) {
9412					index = current.group.length + (index % current.group.length);
9413				}
9414
9415				index = index % current.group.length;
9416			}
9417
9418			if (current.group[ index ] !== undefined) {
9419				F.cancel();
9420
9421				F._start(index);
9422			}
9423		},
9424
9425		// Center inside viewport and toggle position type to fixed or absolute if needed
9426		reposition: function (e, onlyAbsolute) {
9427			var current = F.current,
9428				wrap    = current ? current.wrap : null,
9429				pos;
9430
9431			if (wrap) {
9432				pos = F._getPosition(onlyAbsolute);
9433
9434				if (e && e.type === 'scroll') {
9435					delete pos.position;
9436
9437					wrap.stop(true, true).animate(pos, 200);
9438
9439				} else {
9440					wrap.css(pos);
9441
9442					current.pos = $.extend({}, current.dim, pos);
9443				}
9444			}
9445		},
9446
9447		update: function (e) {
9448			var type = (e && e.type),
9449				anyway = !type || type === 'orientationchange';
9450
9451			if (anyway) {
9452				clearTimeout(didUpdate);
9453
9454				didUpdate = null;
9455			}
9456
9457			if (!F.isOpen || didUpdate) {
9458				return;
9459			}
9460
9461			didUpdate = setTimeout(function() {
9462				var current = F.current;
9463
9464				if (!current || F.isClosing) {
9465					return;
9466				}
9467
9468				F.wrap.removeClass('fancybox-tmp');
9469                //alert(type === 'resize');
9470				if (anyway || type === 'load' || (current.autoResize)) {
9471					F._setDimension();
9472				}
9473
9474				if (!(type === 'scroll' && current.canShrink)) {
9475					F.reposition(e);
9476				}
9477
9478				F.trigger('onUpdate');
9479
9480				didUpdate = null;
9481
9482			}, (anyway && !isTouch ? 0 : 300));
9483		},
9484
9485		// Shrink content to fit inside viewport or restore if resized
9486		toggle: function ( action ) {
9487			if (F.isOpen) {
9488				F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
9489
9490				// Help browser to restore document dimensions
9491				if (isTouch) {
9492					F.wrap.removeAttr('style').addClass('fancybox-tmp');
9493
9494					F.trigger('onUpdate');
9495				}
9496
9497				F.update();
9498			}
9499		},
9500
9501		hideLoading: function () {
9502			D.unbind('.loading');
9503
9504			$('#fancybox-loading').remove();
9505		},
9506
9507		showLoading: function () {
9508			var el, viewport;
9509
9510			F.hideLoading();
9511
9512			el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
9513
9514			// If user will press the escape-button, the request will be canceled
9515			D.bind('keydown.loading', function(e) {
9516				if ((e.which || e.keyCode) === 27) {
9517					e.preventDefault();
9518
9519					F.cancel();
9520				}
9521			});
9522
9523			if (!F.defaults.fixed) {
9524				viewport = F.getViewport();
9525
9526				el.css({
9527					position : 'absolute',
9528					top  : (viewport.h * 0.5) + viewport.y,
9529					left : (viewport.w * 0.5) + viewport.x
9530				});
9531			}
9532		},
9533
9534		getViewport: function () {
9535			var locked = (F.current && F.current.locked) || false,
9536				rez    = {
9537					x: W.scrollLeft(),
9538					y: W.scrollTop()
9539				};
9540
9541			if (locked) {
9542				rez.w = locked[0].clientWidth;
9543				rez.h = locked[0].clientHeight;
9544
9545			} else {
9546				// See http://bugs.jquery.com/ticket/6724
9547				rez.w = isTouch && window.innerWidth  ? window.innerWidth  : W.width();
9548				rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
9549			}
9550
9551			return rez;
9552		},
9553
9554		// Unbind the keyboard / clicking actions
9555		unbindEvents: function () {
9556			if (F.wrap && isQuery(F.wrap)) {
9557				F.wrap.unbind('.fb');
9558			}
9559
9560			D.unbind('.fb');
9561			W.unbind('.fb');
9562		},
9563
9564		bindEvents: function () {
9565			var current = F.current,
9566				keys;
9567
9568			if (!current) {
9569				return;
9570			}
9571
9572			// Changing document height on iOS devices triggers a 'resize' event,
9573			// that can change document height... repeating infinitely
9574			// emtheme fix bug auot scroll in IE
9575			//W.bind('orientationchange.fb' + (isTouch || $.browser.msie ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
9576			// backup
9577			W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
9578
9579			keys = current.keys;
9580
9581			if (keys) {
9582				D.bind('keydown.fb', function (e) {
9583					var code   = e.which || e.keyCode,
9584						target = e.target || e.srcElement;
9585
9586					// Skip esc key if loading, because showLoading will cancel preloading
9587					if (code === 27 && F.coming) {
9588						return false;
9589					}
9590
9591					// Ignore key combinations and key events within form elements
9592					if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
9593						$.each(keys, function(i, val) {
9594							if (current.group.length > 1 && val[ code ] !== undefined) {
9595								F[ i ]( val[ code ] );
9596
9597								e.preventDefault();
9598								return false;
9599							}
9600
9601							if ($.inArray(code, val) > -1) {
9602								F[ i ] ();
9603
9604								e.preventDefault();
9605								return false;
9606							}
9607						});
9608					}
9609				});
9610			}
9611
9612			if ($.fn.mousewheel && current.mouseWheel) {
9613				F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
9614					var target = e.target || null,
9615						parent = $(target),
9616						canScroll = false;
9617
9618					while (parent.length) {
9619						if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
9620							break;
9621						}
9622
9623						canScroll = isScrollable( parent[0] );
9624						parent    = $(parent).parent();
9625					}
9626
9627					if (delta !== 0 && !canScroll) {
9628						if (F.group.length > 1 && !current.canShrink) {
9629							if (deltaY > 0 || deltaX > 0) {
9630								F.prev( deltaY > 0 ? 'down' : 'left' );
9631
9632							} else if (deltaY < 0 || deltaX < 0) {
9633								F.next( deltaY < 0 ? 'up' : 'right' );
9634							}
9635
9636							e.preventDefault();
9637						}
9638					}
9639				});
9640			}
9641		},
9642
9643		trigger: function (event, o) {
9644			var ret, obj = o || F.coming || F.current;
9645
9646			if (!obj) {
9647				return;
9648			}
9649
9650			if ($.isFunction( obj[event] )) {
9651				ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
9652			}
9653
9654			if (ret === false) {
9655				return false;
9656			}
9657
9658			if (obj.helpers) {
9659				$.each(obj.helpers, function (helper, opts) {
9660					if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
9661						opts = $.extend(true, {}, F.helpers[helper].defaults, opts);
9662
9663						F.helpers[helper][event](opts, obj);
9664					}
9665				});
9666			}
9667
9668			$.event.trigger(event + '.fb');
9669		},
9670
9671		isImage: function (str) {
9672			return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i);
9673		},
9674
9675		isSWF: function (str) {
9676			return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
9677		},
9678
9679		_start: function (index) {
9680			var coming = {},
9681				obj,
9682				href,
9683				type,
9684				margin,
9685				padding;
9686
9687			index = getScalar( index );
9688			obj   = F.group[ index ] || null;
9689
9690			if (!obj) {
9691				return false;
9692			}
9693
9694			coming = $.extend(true, {}, F.opts, obj);
9695
9696			// Convert margin and padding properties to array - top, right, bottom, left
9697			margin  = coming.margin;
9698			padding = coming.padding;
9699
9700			if ($.type(margin) === 'number') {
9701				coming.margin = [margin, margin, margin, margin];
9702			}
9703
9704			if ($.type(padding) === 'number') {
9705				coming.padding = [padding, padding, padding, padding];
9706			}
9707
9708			// 'modal' propery is just a shortcut
9709			if (coming.modal) {
9710				$.extend(true, coming, {
9711					closeBtn   : false,
9712					closeClick : false,
9713					nextClick  : false,
9714					arrows     : false,
9715					mouseWheel : false,
9716					keys       : null,
9717					helpers: {
9718						overlay : {
9719							closeClick : false
9720						}
9721					}
9722				});
9723			}
9724
9725			// 'autoSize' property is a shortcut, too
9726			if (coming.autoSize) {
9727				coming.autoWidth = coming.autoHeight = true;
9728			}
9729
9730			if (coming.width === 'auto') {
9731				coming.autoWidth = true;
9732			}
9733
9734			if (coming.height === 'auto') {
9735				coming.autoHeight = true;
9736			}
9737
9738			/*
9739			 * Add reference to the group, so it`s possible to access from callbacks, example:
9740			 * afterLoad : function() {
9741			 *     this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
9742			 * }
9743			 */
9744
9745			coming.group  = F.group;
9746			coming.index  = index;
9747
9748			// Give a chance for callback or helpers to update coming item (type, title, etc)
9749			F.coming = coming;
9750
9751			if (false === F.trigger('beforeLoad')) {
9752				F.coming = null;
9753
9754				return;
9755			}
9756
9757			type = coming.type;
9758			href = coming.href;
9759
9760			if (!type) {
9761				F.coming = null;
9762
9763				//If we can not determine content type then drop silently or display next/prev item if looping through gallery
9764				if (F.current && F.router && F.router !== 'jumpto') {
9765					F.current.index = index;
9766
9767					return F[ F.router ]( F.direction );
9768				}
9769
9770				return false;
9771			}
9772
9773			F.isActive = true;
9774
9775			if (type === 'image' || type === 'swf') {
9776				coming.autoHeight = coming.autoWidth = false;
9777				coming.scrolling  = 'visible';
9778			}
9779
9780			if (type === 'image') {
9781				coming.aspectRatio = true;
9782			}
9783
9784			if (type === 'iframe' && isTouch) {
9785				coming.scrolling = 'scroll';
9786			}
9787
9788			// Build the neccessary markup
9789			coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
9790
9791			$.extend(coming, {
9792				skin  : $('.fancybox-skin',  coming.wrap),
9793				outer : $('.fancybox-outer', coming.wrap),
9794				inner : $('.fancybox-inner', coming.wrap)
9795			});
9796
9797			$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
9798				coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
9799			});
9800
9801			F.trigger('onReady');
9802
9803			// Check before try to load; 'inline' and 'html' types need content, others - href
9804			if (type === 'inline' || type === 'html') {
9805				if (!coming.content || !coming.content.length) {
9806					return F._error( 'content' );
9807				}
9808
9809			} else if (!href) {
9810				return F._error( 'href' );
9811			}
9812
9813			if (type === 'image') {
9814				F._loadImage();
9815
9816			} else if (type === 'ajax') {
9817				F._loadAjax();
9818
9819			} else if (type === 'iframe') {
9820				F._loadIframe();
9821
9822			} else {
9823				F._afterLoad();
9824			}
9825		},
9826
9827		_error: function ( type ) {
9828			$.extend(F.coming, {
9829				type       : 'html',
9830				autoWidth  : true,
9831				autoHeight : true,
9832				minWidth   : 0,
9833				minHeight  : 0,
9834				scrolling  : 'no',
9835				hasError   : type,
9836				content    : F.coming.tpl.error
9837			});
9838
9839			F._afterLoad();
9840		},
9841
9842		_loadImage: function () {
9843			// Reset preload image so it is later possible to check "complete" property
9844			var img = F.imgPreload = new Image();
9845
9846			img.onload = function () {
9847				this.onload = this.onerror = null;
9848
9849				F.coming.width  = this.width;
9850				F.coming.height = this.height;
9851
9852				F._afterLoad();
9853			};
9854
9855			img.onerror = function () {
9856				this.onload = this.onerror = null;
9857
9858				F._error( 'image' );
9859			};
9860
9861			img.src = F.coming.href;
9862
9863			if (img.complete !== true) {
9864				F.showLoading();
9865			}
9866		},
9867
9868		_loadAjax: function () {
9869			var coming = F.coming;
9870
9871			F.showLoading();
9872
9873			F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
9874				url: coming.href,
9875				error: function (jqXHR, textStatus) {
9876					if (F.coming && textStatus !== 'abort') {
9877						F._error( 'ajax', jqXHR );
9878
9879					} else {
9880						F.hideLoading();
9881					}
9882				},
9883				success: function (data, textStatus) {
9884					if (textStatus === 'success') {
9885						coming.content = data;
9886
9887						F._afterLoad();
9888					}
9889				}
9890			}));
9891		},
9892
9893		_loadIframe: function() {
9894			var coming = F.coming,
9895				iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
9896					.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
9897					.attr('src', coming.href);
9898
9899			// This helps IE
9900			$(coming.wrap).bind('onReset', function () {
9901				try {
9902					$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
9903				} catch (e) {}
9904			});
9905
9906			if (coming.iframe.preload) {
9907				F.showLoading();
9908
9909				iframe.one('load', function() {
9910					$(this).data('ready', 1);
9911
9912					// iOS will lose scrolling if we resize
9913					if (!isTouch) {
9914						$(this).bind('load.fb', F.update);
9915					}
9916
9917					// Without this trick:
9918					//   - iframe won't scroll on iOS devices
9919					//   - IE7 sometimes displays empty iframe
9920					$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
9921
9922					F._afterLoad();
9923				});
9924			}
9925
9926			coming.content = iframe.appendTo( coming.inner );
9927
9928			if (!coming.iframe.preload) {
9929				F._afterLoad();
9930			}
9931		},
9932
9933		_preloadImages: function() {
9934			var group   = F.group,
9935				current = F.current,
9936				len     = group.length,
9937				cnt     = current.preload ? Math.min(current.preload, len - 1) : 0,
9938				item,
9939				i;
9940
9941			for (i = 1; i <= cnt; i += 1) {
9942				item = group[ (current.index + i ) % len ];
9943
9944				if (item.type === 'image' && item.href) {
9945					new Image().src = item.href;
9946				}
9947			}
9948		},
9949
9950		_afterLoad: function () {
9951			var coming   = F.coming,
9952				previous = F.current,
9953				placeholder = 'fancybox-placeholder',
9954				current,
9955				content,
9956				type,
9957				scrolling,
9958				href,
9959				embed;
9960
9961			F.hideLoading();
9962
9963			if (!coming || F.isActive === false) {
9964				return;
9965			}
9966
9967			if (false === F.trigger('afterLoad', coming, previous)) {
9968				coming.wrap.stop(true).trigger('onReset').remove();
9969
9970				F.coming = null;
9971
9972				return;
9973			}
9974
9975			if (previous) {
9976				F.trigger('beforeChange', previous);
9977
9978				previous.wrap.stop(true).removeClass('fancybox-opened')
9979					.find('.fancybox-item, .fancybox-nav')
9980					.remove();
9981			}
9982
9983			F.unbindEvents();
9984
9985			current   = coming;
9986			content   = coming.content;
9987			type      = coming.type;
9988			scrolling = coming.scrolling;
9989
9990			$.extend(F, {
9991				wrap  : current.wrap,
9992				skin  : current.skin,
9993				outer : current.outer,
9994				inner : current.inner,
9995				current  : current,
9996				previous : previous
9997			});
9998
9999			href = current.href;
10000
10001			switch (type) {
10002				case 'inline':
10003				case 'ajax':
10004				case 'html':
10005					if (current.selector) {
10006						content = $('<div>').html(content).find(current.selector);
10007
10008					} else if (isQuery(content)) {
10009						if (!content.data(placeholder)) {
10010							content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
10011						}
10012
10013						content = content.show().detach();
10014
10015						current.wrap.bind('onReset', function () {
10016							if ($(this).find(content).length) {
10017								content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
10018							}
10019						});
10020					}
10021				break;
10022
10023				case 'image':
10024					content = current.tpl.image.replace('{href}', href);
10025				break;
10026
10027				case 'swf':
10028					content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
10029					embed   = '';
10030
10031					$.each(current.swf, function(name, val) {
10032						content += '<param name="' + name + '" value="' + val + '"></param>';
10033						embed   += ' ' + name + '="' + val + '"';
10034					});
10035
10036					content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
10037				break;
10038			}
10039
10040			if (!(isQuery(content) && content.parent().is(current.inner))) {
10041				current.inner.append( content );
10042			}
10043
10044			// Give a chance for helpers or callbacks to update elements
10045			F.trigger('beforeShow');
10046
10047			// Set scrolling before calculating dimensions
10048			current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
10049
10050			// Set initial dimensions and start position
10051			F._setDimension();
10052
10053			F.reposition();
10054
10055			F.isOpen = false;
10056			F.coming = null;
10057
10058			F.bindEvents();
10059
10060			if (!F.isOpened) {
10061				$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
10062
10063			} else if (previous.prevMethod) {
10064				F.transitions[ previous.prevMethod ]();
10065			}
10066
10067			F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
10068
10069			F._preloadImages();
10070		},
10071
10072		_setDimension: function () {
10073			var viewport   = F.getViewport(),
10074				steps      = 0,
10075				canShrink  = false,
10076				canExpand  = false,
10077				wrap       = F.wrap,
10078				skin       = F.skin,
10079				inner      = F.inner,
10080				current    = F.current,
10081				width      = current.width,
10082				height     = current.height,
10083				minWidth   = current.minWidth,
10084				minHeight  = current.minHeight,
10085				maxWidth   = current.maxWidth,
10086				maxHeight  = current.maxHeight,
10087				scrolling  = current.scrolling,
10088				scrollOut  = current.scrollOutside ? current.scrollbarWidth : 0,
10089				margin     = current.margin,
10090				wMargin    = getScalar(margin[1] + margin[3]),
10091				hMargin    = getScalar(margin[0] + margin[2]),
10092				wPadding,
10093				hPadding,
10094				wSpace,
10095				hSpace,
10096				origWidth,
10097				origHeight,
10098				origMaxWidth,
10099				origMaxHeight,
10100				ratio,
10101				width_,
10102				height_,
10103				maxWidth_,
10104				maxHeight_,
10105				iframe,
10106				body;
10107
10108			// Reset dimensions so we could re-check actual size
10109			wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
10110
10111			wPadding = getScalar(skin.outerWidth(true)  - skin.width());
10112			hPadding = getScalar(skin.outerHeight(true) - skin.height());
10113
10114			// Any space between content and viewport (margin, padding, border, title)
10115			wSpace = wMargin + wPadding;
10116			hSpace = hMargin + hPadding;
10117
10118			origWidth  = isPercentage(width)  ? (viewport.w - wSpace) * getScalar(width)  / 100 : width;
10119			origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
10120
10121			if (current.type === 'iframe') {
10122				iframe = current.content;
10123
10124				if (current.autoHeight && iframe.data('ready') === 1) {
10125					try {
10126						if (iframe[0].contentWindow.document.location) {
10127							inner.width( origWidth ).height(9999);
10128
10129							body = iframe.contents().find('body');
10130
10131							if (scrollOut) {
10132								body.css('overflow-x', 'hidden');
10133							}
10134
10135							origHeight = body.height();
10136						}
10137
10138					} catch (e) {}
10139				}
10140
10141			} else if (current.autoWidth || current.autoHeight) {
10142				inner.addClass( 'fancybox-tmp' );
10143
10144				// Set width or height in case we need to calculate only one dimension
10145				if (!current.autoWidth) {
10146					inner.width( origWidth );
10147				}
10148
10149				if (!current.autoHeight) {
10150					inner.height( origHeight );
10151				}
10152
10153				if (current.autoWidth) {
10154					origWidth = inner.width();
10155				}
10156
10157				if (current.autoHeight) {
10158					origHeight = inner.height();
10159				}
10160
10161				inner.removeClass( 'fancybox-tmp' );
10162			}
10163
10164			width  = getScalar( origWidth );
10165			height = getScalar( origHeight );
10166
10167			ratio  = origWidth / origHeight;
10168
10169			// Calculations for the content
10170			minWidth  = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
10171			maxWidth  = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
10172
10173			minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
10174			maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
10175
10176			// These will be used to determine if wrap can fit in the viewport
10177			origMaxWidth  = maxWidth;
10178			origMaxHeight = maxHeight;
10179
10180			if (current.fitToView) {
10181				maxWidth  = Math.min(viewport.w - wSpace, maxWidth);
10182				maxHeight = Math.min(viewport.h - hSpace, maxHeight);
10183			}
10184
10185			maxWidth_  = viewport.w - wMargin;
10186			maxHeight_ = viewport.h - hMargin;
10187
10188			if (current.aspectRatio) {
10189				if (width > maxWidth) {
10190					width  = maxWidth;
10191					height = getScalar(width / ratio);
10192				}
10193
10194				if (height > maxHeight) {
10195					height = maxHeight;
10196					width  = getScalar(height * ratio);
10197				}
10198
10199				if (width < minWidth) {
10200					width  = minWidth;
10201					height = getScalar(width / ratio);
10202				}
10203
10204				if (height < minHeight) {
10205					height = minHeight;
10206					width  = getScalar(height * ratio);
10207				}
10208
10209			} else {
10210				width = Math.max(minWidth, Math.min(width, maxWidth));
10211
10212				if (current.autoHeight && current.type !== 'iframe') {
10213					inner.width( width );
10214
10215					height = inner.height();
10216				}
10217
10218				height = Math.max(minHeight, Math.min(height, maxHeight));
10219			}
10220
10221			// Try to fit inside viewport (including the title)
10222			if (current.fitToView) {
10223				inner.width( width ).height( height );
10224
10225				wrap.width( width + wPadding );
10226
10227				// Real wrap dimensions
10228				width_  = wrap.width();
10229				height_ = wrap.height();
10230
10231				if (current.aspectRatio) {
10232					while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
10233						if (steps++ > 19) {
10234							break;
10235						}
10236
10237						height = Math.max(minHeight, Math.min(maxHeight, height - 10));
10238						width  = getScalar(height * ratio);
10239
10240						if (width < minWidth) {
10241							width  = minWidth;
10242							height = getScalar(width / ratio);
10243						}
10244
10245						if (width > maxWidth) {
10246							width  = maxWidth;
10247							height = getScalar(width / ratio);
10248						}
10249
10250						inner.width( width ).height( height );
10251
10252						wrap.width( width + wPadding );
10253
10254						width_  = wrap.width();
10255						height_ = wrap.height();
10256					}
10257
10258				} else {
10259					width  = Math.max(minWidth,  Math.min(width,  width  - (width_  - maxWidth_)));
10260					height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
10261				}
10262			}
10263
10264			if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
10265				width += scrollOut;
10266			}
10267
10268			inner.width( width ).height( height );
10269
10270			wrap.width( width + wPadding );
10271
10272			width_  = wrap.width();
10273			height_ = wrap.height();
10274
10275			canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
10276			canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
10277
10278			$.extend(current, {
10279				dim : {
10280					width	: getValue( width_ ),
10281					height	: getValue( height_ )
10282				},
10283				origWidth  : origWidth,
10284				origHeight : origHeight,
10285				canShrink  : canShrink,
10286				canExpand  : canExpand,
10287				wPadding   : wPadding,
10288				hPadding   : hPadding,
10289				wrapSpace  : height_ - skin.outerHeight(true),
10290				skinSpace  : skin.height() - height
10291			});
10292
10293			if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
10294				inner.height('auto');
10295			}
10296		},
10297
10298		_getPosition: function (onlyAbsolute) {
10299			var current  = F.current,
10300				viewport = F.getViewport(),
10301				margin   = current.margin,
10302				width    = F.wrap.width()  + margin[1] + margin[3],
10303				height   = F.wrap.height() + margin[0] + margin[2],
10304				rez      = {
10305					position: 'absolute',
10306					top  : margin[0],
10307					left : margin[3]
10308				};
10309
10310			if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
10311				rez.position = 'fixed';
10312
10313			} else if (!current.locked) {
10314				rez.top  += viewport.y;
10315				rez.left += viewport.x;
10316			}
10317
10318			rez.top  = getValue(Math.max(rez.top,  rez.top  + ((viewport.h - height) * current.topRatio)));
10319			rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width)  * current.leftRatio)));
10320
10321			return rez;
10322		},
10323
10324		_afterZoomIn: function () {
10325			var current = F.current;
10326
10327			if (!current) {
10328				return;
10329			}
10330
10331			F.isOpen = F.isOpened = true;
10332
10333			F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
10334
10335			F.update();
10336
10337			// Assign a click event
10338			if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
10339				F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
10340					if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
10341						e.preventDefault();
10342
10343						F[ current.closeClick ? 'close' : 'next' ]();
10344					}
10345				});
10346			}
10347
10348			// Create a close button
10349			if (current.closeBtn) {
10350				$(current.tpl.closeBtn).appendTo(F.skin).bind( isTouch ? 'touchstart.fb' : 'click.fb', function(e) {
10351					e.preventDefault();
10352
10353					F.close();
10354				});
10355			}
10356
10357			// Create navigation arrows
10358			if (current.arrows && F.group.length > 1) {
10359				if (current.loop || current.index > 0) {
10360					$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
10361				}
10362
10363				if (current.loop || current.index < F.group.length - 1) {
10364					$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
10365				}
10366			}
10367
10368			F.trigger('afterShow');
10369
10370			// Stop the slideshow if this is the last item
10371			if (!current.loop && current.index === current.group.length - 1) {
10372				F.play( false );
10373
10374			} else if (F.opts.autoPlay && !F.player.isActive) {
10375				F.opts.autoPlay = false;
10376
10377				F.play();
10378			}
10379		},
10380
10381		_afterZoomOut: function ( obj ) {
10382			obj = obj || F.current;
10383
10384			$('.fancybox-wrap').trigger('onReset').remove();
10385
10386			$.extend(F, {
10387				group  : {},
10388				opts   : {},
10389				router : false,
10390				current   : null,
10391				isActive  : false,
10392				isOpened  : false,
10393				isOpen    : false,
10394				isClosing : false,
10395				wrap   : null,
10396				skin   : null,
10397				outer  : null,
10398				inner  : null
10399			});
10400
10401			F.trigger('afterClose', obj);
10402		}
10403	});
10404
10405	/*
10406	 *	Default transitions
10407	 */
10408
10409	F.transitions = {
10410		getOrigPosition: function () {
10411			var current  = F.current,
10412				element  = current.element,
10413				orig     = current.orig,
10414				pos      = {},
10415				width    = 50,
10416				height   = 50,
10417				hPadding = current.hPadding,
10418				wPadding = current.wPadding,
10419				viewport = F.getViewport();
10420
10421			if (!orig && current.isDom && element.is(':visible')) {
10422				orig = element.find('img:first');
10423
10424				if (!orig.length) {
10425					orig = element;
10426				}
10427			}
10428
10429			if (isQuery(orig)) {
10430				pos = orig.offset();
10431
10432				if (orig.is('img')) {
10433					width  = orig.outerWidth();
10434					height = orig.outerHeight();
10435				}
10436
10437			} else {
10438				pos.top  = viewport.y + (viewport.h - height) * current.topRatio;
10439				pos.left = viewport.x + (viewport.w - width)  * current.leftRatio;
10440			}
10441
10442			if (F.wrap.css('position') === 'fixed' || current.locked) {
10443				pos.top  -= viewport.y;
10444				pos.left -= viewport.x;
10445			}
10446
10447			pos = {
10448				top     : getValue(pos.top  - hPadding * current.topRatio),
10449				left    : getValue(pos.left - wPadding * current.leftRatio),
10450				width   : getValue(width  + wPadding),
10451				height  : getValue(height + hPadding)
10452			};
10453
10454			return pos;
10455		},
10456
10457		step: function (now, fx) {
10458			var ratio,
10459				padding,
10460				value,
10461				prop       = fx.prop,
10462				current    = F.current,
10463				wrapSpace  = current.wrapSpace,
10464				skinSpace  = current.skinSpace;
10465
10466			if (prop === 'width' || prop === 'height') {
10467				ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
10468
10469				if (F.isClosing) {
10470					ratio = 1 - ratio;
10471				}
10472
10473				padding = prop === 'width' ? current.wPadding : current.hPadding;
10474				value   = now - padding;
10475
10476				F.skin[ prop ](  getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) ) );
10477				F.inner[ prop ]( getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
10478			}
10479		},
10480
10481		zoomIn: function () {
10482			var current  = F.current,
10483				startPos = current.pos,
10484				effect   = current.openEffect,
10485				elastic  = effect === 'elastic',
10486				endPos   = $.extend({opacity : 1}, startPos);
10487
10488			// Remove "position" property that breaks older IE
10489			delete endPos.position;
10490
10491			if (elastic) {
10492				startPos = this.getOrigPosition();
10493
10494				if (current.openOpacity) {
10495					startPos.opacity = 0.1;
10496				}
10497
10498			} else if (effect === 'fade') {
10499				startPos.opacity = 0.1;
10500			}
10501
10502			F.wrap.css(startPos).animate(endPos, {
10503				duration : effect === 'none' ? 0 : current.openSpeed,
10504				easing   : current.openEasing,
10505				step     : elastic ? this.step : null,
10506				complete : F._afterZoomIn
10507			});
10508		},
10509
10510		zoomOut: function () {
10511			var current  = F.current,
10512				effect   = current.closeEffect,
10513				elastic  = effect === 'elastic',
10514				endPos   = {opacity : 0.1};
10515
10516			if (elastic) {
10517				endPos = this.getOrigPosition();
10518
10519				if (current.closeOpacity) {
10520					endPos.opacity = 0.1;
10521				}
10522			}
10523
10524			F.wrap.animate(endPos, {
10525				duration : effect === 'none' ? 0 : current.closeSpeed,
10526				easing   : current.closeEasing,
10527				step     : elastic ? this.step : null,
10528				complete : F._afterZoomOut
10529			});
10530		},
10531
10532		changeIn: function () {
10533			var current   = F.current,
10534				effect    = current.nextEffect,
10535				startPos  = current.pos,
10536				endPos    = { opacity : 1 },
10537				direction = F.direction,
10538				distance  = 200,
10539				field;
10540
10541			startPos.opacity = 0.1;
10542
10543			if (effect === 'elastic') {
10544				field = direction === 'down' || direction === 'up' ? 'top' : 'left';
10545
10546				if (direction === 'down' || direction === 'right') {
10547					startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
10548					endPos[ field ]   = '+=' + distance + 'px';
10549
10550				} else {
10551					startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
10552					endPos[ field ]   = '-=' + distance + 'px';
10553				}
10554			}
10555
10556			// Workaround for http://bugs.jquery.com/ticket/12273
10557			if (effect === 'none') {
10558				F._afterZoomIn();
10559
10560			} else {
10561				F.wrap.css(startPos).animate(endPos, {
10562					duration : current.nextSpeed,
10563					easing   : current.nextEasing,
10564					complete : function() {
10565						// This helps FireFox to properly render the box
10566						setTimeout(F._afterZoomIn, 20);
10567					}
10568				});
10569			}
10570		},
10571
10572		changeOut: function () {
10573			var previous  = F.previous,
10574				effect    = previous.prevEffect,
10575				endPos    = { opacity : 0.1 },
10576				direction = F.direction,
10577				distance  = 200;
10578
10579			if (effect === 'elastic') {
10580				endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
10581			}
10582
10583			previous.wrap.animate(endPos, {
10584				duration : effect === 'none' ? 0 : previous.prevSpeed,
10585				easing   : previous.prevEasing,
10586				complete : function () {
10587					$(this).trigger('onReset').remove();
10588				}
10589			});
10590		}
10591	};
10592
10593	/*
10594	 *	Overlay helper
10595	 */
10596
10597	F.helpers.overlay = {
10598		defaults : {
10599			closeClick : true,  // if true, fancyBox will be closed when user clicks on the overlay
10600			speedOut   : 200,   // duration of fadeOut animation
10601			showEarly  : true,  // indicates if should be opened immediately or wait until the content is ready
10602			css        : {},    // custom CSS properties
10603			locked     : !isTouch,  // if true, the content will be locked into overlay
10604			fixed      : true   // if false, the overlay CSS position property will not be set to "fixed"
10605		},
10606
10607		overlay : null,   // current handle
10608		fixed   : false,  // indicates if the overlay has position "fixed"
10609
10610		// Public methods
10611		create : function(opts) {
10612			opts = $.extend({}, this.defaults, opts);
10613
10614			if (this.overlay) {
10615				this.close();
10616			}
10617
10618			this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( 'body' );
10619			this.fixed   = false;
10620
10621			if (opts.fixed && F.defaults.fixed) {
10622				this.overlay.addClass('fancybox-overlay-fixed');
10623
10624				this.fixed = true;
10625			}
10626		},
10627
10628		open : function(opts) {
10629			var that = this;
10630
10631			opts = $.extend({}, this.defaults, opts);
10632
10633			if (this.overlay) {
10634				this.overlay.unbind('.overlay').width('auto').height('auto');
10635
10636			} else {
10637				this.create(opts);
10638			}
10639
10640			if (!this.fixed) {
10641				W.bind('resize.overlay', $.proxy( this.update, this) );
10642
10643				this.update();
10644			}
10645
10646			if (opts.closeClick) {
10647				this.overlay.bind('click.overlay', function(e) {
10648					if ($(e.target).hasClass('fancybox-overlay')) {
10649						if (F.isActive) {
10650							F.close();
10651						} else {
10652							that.close();
10653						}
10654					}
10655				});
10656			}
10657
10658			this.overlay.css( opts.css ).show();
10659		},
10660
10661		close : function() {
10662			$('.fancybox-overlay').remove();
10663
10664			W.unbind('resize.overlay');
10665
10666			this.overlay = null;
10667
10668			if (this.margin !== false) {
10669				$('body').css('margin-right', this.margin);
10670
10671				this.margin = false;
10672			}
10673
10674			if (this.el) {
10675				this.el.removeClass('fancybox-lock');
10676			}
10677		},
10678
10679		// Private, callbacks
10680
10681		update : function () {
10682			var width = '100%', offsetWidth;
10683
10684			// Reset width/height so it will not mess
10685			this.overlay.width(width).height('100%');
10686
10687			// jQuery does not return reliable result for IE
10688			if ($.browser.msie) {
10689				offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
10690
10691				if (D.width() > offsetWidth) {
10692					width = D.width();
10693				}
10694
10695			} else if (D.width() > W.width()) {
10696				width = D.width();
10697			}
10698
10699			this.overlay.width(width).height(D.height());
10700		},
10701
10702		// This is where we can manipulate DOM, because later it would cause iframes to reload
10703		onReady : function (opts, obj) {
10704			$('.fancybox-overlay').stop(true, true);
10705
10706			if (!this.overlay) {
10707				this.margin = D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false;
10708				this.el     = document.all && !document.querySelector ? $('html') : $('body');
10709
10710				this.create(opts);
10711			}
10712
10713			if (opts.locked && this.fixed) {
10714				obj.locked = this.overlay.append( obj.wrap );
10715				obj.fixed  = false;
10716			}
10717
10718			if (opts.showEarly === true) {
10719				this.beforeShow.apply(this, arguments);
10720			}
10721		},
10722
10723		beforeShow : function(opts, obj) {
10724			if (obj.locked) {
10725				this.el.addClass('fancybox-lock');
10726
10727				if (this.margin !== false) {
10728					$('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth);
10729				}
10730			}
10731
10732			this.open(opts);
10733		},
10734
10735		onUpdate : function() {
10736			if (!this.fixed) {
10737				this.update();
10738			}
10739		},
10740
10741		afterClose: function (opts) {
10742			// Remove overlay if exists and fancyBox is not opening
10743			// (e.g., it is not being open using afterClose callback)
10744			if (this.overlay && !F.isActive) {
10745				this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
10746			}
10747		}
10748	};
10749
10750	/*
10751	 *	Title helper
10752	 */
10753
10754	F.helpers.title = {
10755		defaults : {
10756			type     : 'float', // 'float', 'inside', 'outside' or 'over',
10757			position : 'bottom' // 'top' or 'bottom'
10758		},
10759
10760		beforeShow: function (opts) {
10761			var current = F.current,
10762				text    = current.title,
10763				type    = opts.type,
10764				title,
10765				target;
10766
10767			if ($.isFunction(text)) {
10768				text = text.call(current.element, current);
10769			}
10770
10771			if (!isString(text) || $.trim(text) === '') {
10772				return;
10773			}
10774
10775			title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">
10775' + text + '</div>');
10776
10777			switch (type) {
10778				case 'inside':
10779					target = F.skin;
10780				break;
10781
10782				case 'outside':
10783					target = F.wrap;
10784				break;
10785
10786				case 'over':
10787					target = F.inner;
10788				break;
10789
10790				default: // 'float'
10791					target = F.skin;
10792
10793					title.appendTo('body');
10794
10795					if ($.browser.msie) {
10796						title.width( title.width() );
10797					}
10798
10799					title.wrapInner('<span class="child"></span>');
10800
10801					//Increase bottom margin so this title will also fit into viewport
10802					F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
10803				break;
10804			}
10805
10806			title[ (opts.position === 'top' ? 'prependTo'  : 'appendTo') ](target);
10807		}
10808	};
10809
10810	// jQuery plugin initialization
10811	$.fn.fancybox = function (options) {
10812		var index,
10813			that     = $(this),
10814			selector = this.selector || '',
10815			run      = function(e) {
10816				var what = $(this).blur(), idx = index, relType, relVal;
10817
10818				if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
10819					relType = options.groupAttr || 'data-fancybox-group';
10820					relVal  = what.attr(relType);
10821
10822					if (!relVal) {
10823						relType = 'rel';
10824						relVal  = what.get(0)[ relType ];
10825					}
10826
10827					if (relVal && relVal !== '' && relVal !== 'nofollow') {
10828						what = selector.length ? $(selector) : that;
10829						what = what.filter('[' + relType + '="' + relVal + '"]');
10830						idx  = what.index(this);
10831					}
10832
10833					options.index = idx;
10834
10835					// Stop an event from bubbling if everything is fine
10836					if (F.open(what, options) !== false) {
10837						e.preventDefault();
10838					}
10839				}
10840			};
10841
10842		options = options || {};
10843		index   = options.index || 0;
10844
10845		if (!selector || options.live === false) {
10846			that.unbind('click.fb-start').bind('click.fb-start', run);
10847
10848		} else {
10849			D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
10850		}
10851
10852		this.filter('[data-fancybox-start=1]').trigger('click');
10853
10854		return this;
10855	};
10856
10857	// Tests that need a body at doc ready
10858	D.ready(function() {
10859		if ( $.scrollbarWidth === undefined ) {
10860			// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
10861			$.scrollbarWidth = function() {
10862				var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
10863					child  = parent.children(),
10864					width  = child.innerWidth() - child.height( 99 ).innerWidth();
10865
10866				parent.remove();
10867
10868				return width;
10869			};
10870		}
10871
10872		if ( $.support.fixedPosition === undefined ) {
10873			$.support.fixedPosition = (function() {
10874				var elem  = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
10875					fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
10876
10877				elem.remove();
10878
10879				return fixed;
10880			}());
10881		}
10882
10883		$.extend(F.defaults, {
10884			scrollbarWidth : $.scrollbarWidth(),
10885			fixed  : $.support.fixedPosition,
10886			parent : $('body')
10887		});
10888	});
10889
10890}(window, document, jQuery));
10891
10892/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
10893 * Licensed under the MIT License (LICENSE.txt).
10894 *
10895 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
10896 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
10897 * Thanks to: Seamus Leahy for adding deltaX and deltaY
10898 *
10899 * Version: 3.0.6
10900 * 
10901 * Requires: 1.2.2+
10902 */
10903(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]]=
10904d.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);
10905/**
10906 * EM QuickShop
10907 *
10908 * @license commercial software
10909 * @copyright (c) 2012 Codespot Software JSC - EMThemes.com. (http://www.emthemes.com)
10910 */
10911// disable QuickShop:
10912// EM_QUICKSHOP_DISABLED = true;
10913jQuery.noConflict();
10914qs = null;
10915jQuery(function($) {
10916	//get IE version
10917
10918	function ieVersion() {
10919		var rv = -1; // Return value assumes failure.
10920		if (navigator.appName == 'Microsoft Internet Explorer') {
10921			var ua = navigator.userAgent;
10922			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
10923			if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
10924		}
10925		return rv;
10926	}
10927	//read href attr in a tag
10928
10929	function readHref() {
10930		var result = arguments[0].replace(EM.QuickShop.BASE_URL, '');
10931		var patn = /catalog\/product\/view\/id\/(.*?)\//i;
10932		if (patn.test(result)) {
10933			var s = patn.exec(result);
10934			result = 'catalog/product/view/id/' + s[1];
10935		} else {
10936			result = result.replace(/\//gi, "_!_");
10937		}
10938		return result;
10939	}
10940	//string trim
10941
10942	function strTrim() {
10943		return arguments[0].replace(/^\s+|\s+$/g, "");
10944	}
10945	// quickshop init
10946	var _qsJnit = function() {
10947		var selectorObj = arguments[0];
10948		var listprod = $(selectorObj.itemClass); // selector chon tat ca cac li chua san pham tren luoi
10949		var mypath = 'quickshop/index/view/path/';
10950		var baseUrl = EM.QuickShop.BASE_URL + mypath;
10951		var _qsHref = "<a id=\"em_quickshop_handler\" href=\"#\" style=\"visibility:hidden;position:absolute;top:0;left:0\"><span>" + EM.QuickShop.QS_TEXT + "</span></a>";
10952		$(document.body).append(_qsHref);
10953		var qsHandlerImg = $('#em_quickshop_handler span');
10954		$.each(listprod, function(index, value) {
10955			if ($(value).parents(".no_quickshop").length <= 0) {
10956				var reloadurl = baseUrl;
10957				//get reload url
10958				var prodLinkTag = $(value).find(selectorObj.aClass);
10959				if (!prodLinkTag || prodLinkTag.length == 0) return;
10960				var prodHref = readHref(prodLinkTag.attr('href'));
10961				reloadurl = baseUrl + prodHref;
10962
10963				// show quickshop handle when hover product image aClass selectorObj.imgClass
10964				$(selectorObj.aClass, this).bind('mouseover', function () {
10965					var o = $(this).offset();
10966					$('#em_quickshop_handler').attr('href', reloadurl).show().css({
10967							'top': o.top+($(this).children('img').height() - qsHandlerImg.height() - 30)/2+'px',
10968							'left': o.left+($(this).children('img').width() - qsHandlerImg.width() - 40)/2+'px',
10969							'visibility': 'visible',
10970							'z-index':	999
10971					});
10972				});
10973				$(value).bind('mouseout', function() {
10974					$('#em_quickshop_handler').hide();
10975				});
10976			}
10977		});
10978		//fix bug image disapper when hover
10979		$('#em_quickshop_handler').bind('mouseover', function() {
10980			$(this).show();
10981		}).bind('click', function() {
10982			$(this).hide();
10983		});
10984		//insert quickshop popup
10985		$('#em_quickshop_handler').fancybox({
10986			'width': EM.QuickShop.QS_FRM_WIDTH,
10987			'height': EM.QuickShop.QS_FRM_HEIGHT,
10988			'autoScale': false,
10989			//			'padding': 20,
10990			//			'margin': 20,
10991			//'transitionIn'		: 'none',
10992			//'transitionOut'		: 'none',
10993			'type': 'iframe',
10994			onComplete: function() {
10995				$.fancybox.showActivity();
10996				$('#fancybox-frame').unbind('load');
10997				$('#fancybox-frame').bind('load', function() {
10998					$.fancybox.hideActivity();
10999				});
11000			}
11001		});
11002	}
11003	if ( (typeof EM_QUICKSHOP_DISABLED == 'undefined' || !EM_QUICKSHOP_DISABLED) && !isMobile ) {
11004	   _qsJnit({
11005    		itemClass: '.products-grid li.item, .products-list li.item',
11006    		//selector for each items in catalog product list,use to insert quickshop image
11007    		aClass: 'a.product-image',
11008    		//selector for each a tag in product items,give us href for one product
11009    		imgClass: '.product-image > img' //class for quickshop href
11010    	});
11011	}    
11012	qs = _qsJnit;
11013});
11014function 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)}}}
11014var 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)}};
11015;(function ($) {
11016	 $.fn.inlineStyle = function (prop) {
11017        var styles = $.trim(this.attr("style")),
11018             value;
11019		 
11020		if(styles){
11021			var arr = styles.split(";"),i;
11022			for(i = 0;i < arr.length;i++){
11023				var style = arr[i].split(":");
11024				
11025				if ($.trim(style[0]) === prop) {
11026					value = style[1];           
11027				}	
11028			}
11029		}	 
11030        return value;
11031    };
11032	
11033	$.csslider = function(el,options) {
11034		var defaults = {
11035			selector : ".slides > li.item",
11036			move : 1,
11037			speed : 400,
11038			direction : 'horizontal',
11039			textClassName : '.product-name',
11040			delay : 0,
11041			widthViewport : 0,
11042			heightViewport : 0,
11043			textPrev : 'Prev',
11044			textNext : 'Next',
11045			circular : 0,
11046			parentHidden : ''
11047		}
11048		
11049		var vars = $.extend({}, defaults, options);
11050		var slider = $(el),
11051        //touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
11052        eventType = "click",
11053		vertical = vars.direction === "vertical",
11054		auto = vars.delay > 0;
11055		slider.addClass('csslider'),
11056		rtlStyle = $('div.page').first().css('direction') == 'rtl';
11057		var time = 0;
11058		slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
11059		slider.container = $(slider.containerSelector, slider);
11060		slider.slides = $(vars.selector, slider);
11061		slider.target = 0;
11062		slider.enoughtItem = true;
11063		slider.currentHideNav = 'prev';
11064		if(vertical)
11065			slider.addClass('vertical');
11066		else
11067			slider.addClass('horizontal');
11068		slider.scrolling = false;
11069		slider.reInit = false;
11070		slider.setup = function(){
11071			slider.viewport = $('<div class="viewport"></div>');
11072			slider.viewport.append(slider.container);
11073			slider.append(slider.viewport);
11074			slider.controlNav();
11075			if(vars.widthViewport > 0){
11076				slider.viewport.width(vars.widthViewport);
11077			}
11078			if(vars.heightViewport > 0){
11079				slider.viewport.height(vars.heightViewport);
11080			}
11081			slider.init(true);
11082			slider.hammer = new Hammer(slider.container[0], {"swipe_time": 200/*,"prevent_default" : true*/});
11083			slider.touchHamer();
11084		}
11085		
11086		slider.init = function (first){
11087			if(vars.parentHidden && (slider.parents(vars.parentHidden).length > 0)){
11088				slider.curDisplay = slider.parents(vars.parentHidden).css('display');
11089				if(slider.curDisplay != 'block')
11090					slider.parents(vars.parentHidden).css({visibility:'hidden',display:'block'});
11091			}
11092			//if($(vars.textClassName,slider))
11093				//$(vars.textClassName,slider).hide();
11094			if(slider.interval && auto)
11095				clearTimeout(slider.interval);
11096			// Do not reset when slider is first loaded	
11097			if(!first)	
11098				slider.reset();
11099
11100			var maxWidth = 0,maxOuterWidth = 0,maxHeight = 0,i=0,maxHeight = 0,maxOuterHeight = 0;
11101			slider.slides.each(function(index,value){
11102				// Backup css inline for width and height
11103				if($(this).inlineStyle('width') != undefined){
11104					$(this).attr('data-width',$.trim($(this).inlineStyle('width')));
11105				}
11106				
11107				if($(this).inlineStyle('height') != undefined){
11108					$(this).attr('data-height',$.trim($(this).inlineStyle('height')));
11109				}
11110				
11111				if(maxWidth < $(this).width()){
11112					maxWidth = $(this).width();
11113					maxOuterWidth = $(this).outerWidth(true);
11114					i = index;
11115				}
11116				
11117				if(maxHeight < $(this).height()){
11118					maxHeight = $(this).height();
11119					maxOuterHeight = $(this).outerHeight(true);
11120				}
11121			});
11122			
11123			if(!vertical){ // horizontal
11124				//slider.lengthPx = Math.floor(slider.viewport.width()/maxOuterWidth)*maxOuterWidth;
11125				slider.lengthPx = slider.viewport.width();
11126				//slider.lengthPx = slider.viewport.width();
11127				if(slider.lengthPx < maxOuterWidth){
11128					slider.reInit = true;
11129					slider.container.addClass('no-float');
11130					var newWidth = slider.viewport.width() - (maxOuterWidth - maxWidth);
11131					slider.lengthPx = slider.viewport.width();
11132					var ratio = (newWidth/maxWidth);
11133					var delta = maxWidth - newWidth;
11134					maxWidth = newWidth;
11135					maxOuterWidth = maxOuterWidth - delta;
11136					//maxHeight = Math.ceil(maxHeight*ratio);
11137					//slider.slides.height(maxHeight);
11138					//$('a.product-image',slider).css('float','none');
11139				}
11140				
11141				slider.initHorizontal(maxWidth,maxOuterWidth);
11142				slider.finalInit();
11143			} else { // vertical
11144				if(slider.viewport.width() < maxOuterWidth){
11145					slider.reInit = true;
11146					slider.container.addClass('no-float');
11147					var newWidth = slider.viewport.width() - (maxOuterWidth - maxWidth);
11148					var ratio = (newWidth/maxWidth);
11149					maxWidth = newWidth;
11150					//slider.slides.width(150);
11151					slider.slides.width(maxWidth);
11152					
11153					//$('a.product-image',slider).css('float','none');
11154					/*newHeight = Math.ceil(maxHeight*ratio);
11155					var delta = maxHeight - newHeight;
11156					maxOuterHeight -= delta;
11157					maxHeight = newHeight;*/
11158					
11159					setTimeout(function(){
11160						slider.initVertical(maxHeight,maxOuterHeight);
11161						slider.finalInit();
11162					},300);
11163				} else {
11164					slider.initVertical(maxHeight,maxOuterHeight);
11165					slider.finalInit();
11166				}
11167				
11168			}
11169			//if($(vars.textClassName,slider))
11170				//$(vars.textClassName,slider).show();
11171				
11172			
11173		}
11174		
11175		slider.finalInit = function(){
11176			slider.finalTarget = slider.lengthPx - slider.container.lengthPx;	
11177			//slider.deltaTotal = slider.lengthPx - Math.floor(slider.viewport.width()/maxOuterWidth)*maxOuterWidth;
11178			slider.target = 0;
11179			slider.resetScroll();
11180			slider.slide(slider.target,vars.speed);	
11181			if(vars.circular == 0 && slider.enoughtItem){
11182				slider.prev.hide();
11183				slider.next.show();
11184				slider.currentHideNav = 'prev';
11185			}
11186			/*if(auto)
11187				slider.interval = setTimeout(slider.nextSlide,vars.delay);*/
11188			if(vars.parentHidden && (slider.parents(vars.parentHidden).length > 0)){
11189				if(slider.curDisplay != 'block')
11190					slider.parents(vars.parentHidden).css({visibility:'',display:slider.curDisplay});
11191			}
11192		}
11193		
11194		slider.initHorizontal = function(maxWidth,maxOuterWidth){
11195			slider.reInit = false;
11196			slider.slides.width(maxWidth);
11197			//var first = slider.slides.first();
11198			slider.stepLength = (maxOuterWidth)*vars.move;
11199			var lengthPx = slider.slides.length*(maxOuterWidth);
11200			slider.container.width(lengthPx);
11201			slider.container.lengthPx = lengthPx;
11202			if(slider.container.lengthPx - slider.lengthPx <= maxOuterWidth - maxWidth){
11203				slider.enoughtItem = false;
11204				slider.next.hide();
11205				slider.prev.hide();
11206			} else {
11207				slider.enoughtItem = true;
11208				slider.next.show();
11209				slider.prev.show();
11210			}
11211		}
11212		
11213		slider.initVertical = function(maxHeight,maxOuterHeight){
11214			if(slider.reInit == true){
11215				maxHeight = 0;maxOuterHeight = 0;
11216				slider.slides.each(function(index,value){
11217					$(this).attr('test-height',$(this).height());
11218					if(maxHeight < $(this).height()){
11219						maxHeight = $(this).height();
11220						
11221						maxOuterHeight = $(this).outerHeight(true);
11222					}
11223				});
11224				slider.reInit = false;
11225			}
11226			//slider.lengthPx = Math.floor(slider.viewport.height()/maxOuterHeight)*maxOuterHeight;
11227			slider.lengthPx = slider.viewport.height();
11228			//slider.lengthPx = slider.viewport.height();
11229			slider.slides.height(maxHeight);
11230			//var first = slider.slides.first();
11231			slider.stepLength = (maxOuterHeight)*vars.move;
11232			var lengthPx = slider.slides.length*(maxOuterHeight);
11233			slider.container.height(lengthPx);
11234			slider.container.lengthPx = lengthPx;
11235			if(slider.container.lengthPx - slider.lengthPx <= maxOuterHeight - maxHeight){
11236				slider.enoughtItem = false;
11237				slider.next.hide();
11238				slider.prev.hide();
11239			} else {
11240				slider.enoughtItem = true;
11241				slider.next.show();
11242				slider.prev.show();
11243			}
11244		}
11245		
11246		slider.reset = function(){
11247			slider.container.css('height','');
11248			slider.slides.css('height','');
11249			slider.container.css('width','');
11250			slider.slides.css('width','');
11251			if($('a.product-image',slider).length > 0)
11252				$('a.product-image',slider).css('float','');
11253			// Restore css inline
11254			if(slider.slides.attr('data-width')){
11255				slider.slides.css('width',slider.slides.attr('data-width'));
11256			}
11257			if(slider.slides.attr('data-height')){
11258				slider.slides.css('height',slider.slides.attr('data-height'));
11259			}
11260			slider.container.removeClass('no-float');
11261		}
11262		
11263		slider.resetScroll = function(){
11264			slider.scrolling = false;
11265			if(auto)
11266				slider.interval = setTimeout(slider.nextSlide,vars.delay);
11267		}
11268		
11269		slider.touchHamer = function(){
11270			var targetVirtual,flow, time, distance;
11271			if(typeof addEventListener == 'function'){
11272				el.addEventListener("touchmove", function(ev){
11273					if(ev.touches.length == 1)
11274						ev.preventDefault();
11275				}, false);
11276			}
11277			
11278			function cancelEvent(event)
11279			{
11280				event = event || window.event;
11281				if(event.preventDefault){
11282					event.preventDefault();
11283					event.stopPropagation();
11284				}else{
11285					event.returnValue = false;
11286					event.cancelBubble = true;
11287				}
11288			}
11289			
11290			slider.hammer.ondragstart = function(ev) {
11291				if(slider.interval && auto)
11292					clearTimeout(slider.interval);
11293				if(slider.scrolling 
11294					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
11295					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))){
11296					return;
11297				}	
11298				targetVirtual = 0;
11299				flow = 0;
11300				time = Number( new Date() );
11301				distance = 0;
11302			}
11303			
11304			slider.hammer.ondrag = function(ev) {
11305				if(slider.interval && auto)
11306					clearTimeout(slider.interval);
11307				if(slider.scrolling
11308					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
11309					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))
11310					|| !slider.enoughtItem){
11311					cancelEvent(ev);	
11312					return;
11313				}
11314				if(ev.touches.length > 1 || ev.scale && ev.scale !== 1 || slider.scrolling || !slider.enoughtItem){
11315					cancelEvent(ev);
11316					return;
11317				}	
11318				distance = (vertical) ? ev.distanceY : ev.distanceX;
11319				targetVirtual = slider.target + distance;
11320				if(targetVirtual > slider.stepLength/2){// last slide right
11321					flow = 1;
11322					return;
11323				}	
11324				if(slider.container.lengthPx + targetVirtual < slider.lengthPx - (slider.stepLength/2)){//first slide left
11325					flow = -1;
11326					return;
11327				}	
11328				if(vertical)
11329					slider.container.animate({ marginTop: targetVirtual + 'px'}, 0);
11330				else
11331					slider.container.animate({ marginLeft: targetVirtual + 'px'}, 0);
11332				
11333			};
11334			
11335			slider.hammer.ondragend = function(ev) {
11336				if(slider.scrolling
11337					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
11338					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))
11339					|| !slider.enoughtItem){
11340					cancelEvent(ev);	
11341					return;
11342				}	
11343				//slider.hammer.cancelEvent(ev);	
11344				var oldTarget = slider.target;
11345				if(flow < 0){
11346					slider.target = slider.finalTarget;
11347					/*if(vars.circular == 0){
11348						slider.currentHideNav = 'next';
11349						slider.next.hide();
11350						slider.prev.show();
11351					}		*/			
11352				} else if(flow > 0){
11353					slider.target = 0;
11354					/*if(vars.circular == 0){
11355						slider.currentHideNav = 'prev';
11356						slider.next.show();
11357						slider.prev.hide();
11358					}*/
11359				} else {
11360					var remainDistance = Math.floor(Math.abs(distance)%slider.stepLength),remainStep;
11361					if(remainDistance < (slider.stepLength/2)){
11362						remainStep = (ev.direction == 'left' || ev.direction == 'up') ? remainDistance : remainDistance*(-1);
11363					} else {
11364						remainStep = (ev.direction == 'left' || ev.direction == 'up') ? (slider.stepLength-remainDistance)*(-1) : (slider.stepLength-remainDistance);
11365					}
11366					slider.target = targetVirtual + remainStep;
11367					
11368				}
11369		
11370				if(vars.circular == 0 && (oldTarget != slider.target)){
11371					if(ev.direction == 'left' || ev.direction == 'up'){ // next slide
11372						slider.checkNextSlide();
11373					} else {
11374						slider.checkPrevSlide();
11375					}
11376				}
11377		
11378				slider.slide(slider.target,vars.speed);
11379			};
11380			
11381			slider.hammer.onswipe = function(ev) {
11382				if(slider.scrolling || !slider.enoughtItem){
11383					cancelEvent(ev);	
11384					return;
11385				}	
11386				if(!vertical){
11387					if(ev.direction == 'left')
11388						slider.nextSlide();
11389					else if(ev.direction == 'right')	
11390						slider.prevSlide();
11391				} else {
11392					if(ev.direction == 'up')
11393						slider.nextSlide();
11394					else if(ev.direction == 'down')	
11395						slider.prevSlide();
11396				}
11397			}
11398			
11399		}		
11400		
11401		slider.slide = function(target, durationVal){
11402			if(slider.interval && auto)
11403				clearTimeout(slider.interval);
11404			slider.scrolling = true;
11405			var targetCss = target + 'px';
11406			if(!vertical)
11407				if(rtlStyle)
11408					slider.container.animate({ marginRight: targetCss}, durationVal, 'swing',slider.resetScroll);
11409				else	
11410					slider.container.animate({ marginLeft: targetCss}, durationVal, 'swing',slider.resetScroll);
11411			else	
11412				slider.container.animate({ marginTop: targetCss}, durationVal, 'swing',slider.resetScroll);
11413		}
11414		
11415		slider.checkNextSlide = function(){
11416			if(slider.currentHideNav != 'next' && vars.circular == 0){
11417				if(slider.currentHideNav == 'prev'){
11418					slider.prev.show();
11419					slider.currentHideNav = '';
11420				}	
11421				//if(slider.container.lengthPx + slider.target - slider.stepLength <= slider.lengthPx - slider.stepLength/2){
11422				if(slider.target <= slider.finalTarget){
11423					slider.currentHideNav = 'next';
11424					slider.next.hide();
11425				} 					
11426			}	
11427		}
11428		
11429		slider.checkPrevSlide = function(){
11430			if(slider.currentHideNav != 'prev' && vars.circular == 0){	
11431				if((slider.currentHideNav == 'next')){
11432					slider.next.show();
11433					slider.currentHideNav = '';
11434				}	
11435				if(slider.target + slider.stepLength > slider.stepLength/2){
11436					slider.currentHideNav = 'prev';
11437					slider.prev.hide();
11438				}									
11439			}
11440		}
11441		
11442		slider.nextSlide = function(){
11443			if(!slider.scrolling && slider.enoughtItem){
11444				if(slider.interval && auto)
11445					clearTimeout(slider.interval);
11446				slider.target -= slider.stepLength;
11447				if(slider.target < slider.finalTarget ){
11448					if((vars.circular > 0) && (Math.abs(slider.target-slider.finalTarget) >= slider.stepLength))
11449						slider.target = 0;
11450					else 
11451						slider.target = slider.finalTarget;
11452				}
11453				slider.slide(slider.target,vars.speed);	
11454				
11455				// Check show/hide prev/next button when circular is disabled
11456				slider.checkNextSlide();					
11457			}
11458		}
11459		
11460		slider.prevSlide = function(){
11461			if(!slider.scrolling && slider.enoughtItem){
11462				if(slider.interval && auto)
11463					clearTimeout(slider.interval);
11464				if(slider.target <= slider.finalTarget){
11465					slider.target += slider.stepLength + (Math.abs(slider.finalTarget)%slider.stepLength);
11466					if(slider.target >= 0){
11467						if((slider.target >= slider.stepLength) && (vars.circular > 0))
11468							slider.target = slider.finalTarget;
11469						else	
11470							slider.target = 0;
11471					}
11472				} else {
11473					slider.target += slider.stepLength;
11474					if(slider.target >= 0){
11475						if((slider.target >= slider.stepLength) && (vars.circular > 0))
11476							slider.target = slider.finalTarget;
11477						else	
11478							slider.target = 0;
11479					}
11480				}	
11481				slider.slide(slider.target,vars.speed);	
11482				
11483				// Check show/hide prev/next button when circular is disabled
11484				slider.checkPrevSlide();
11485			}	
11486		}
11487		
11488		slider.controlNav = function(){
11489			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>");
11490			slider.append(navHtml);
11491			slider.next = $('a.next',slider);
11492			slider.prev = $('a.prev',slider);
11493			slider.next.bind(eventType, function(event) {
11494				event.preventDefault();
11495				slider.nextSlide();
11496			});
11497			
11498			slider.prev.bind(eventType, function(event) {
11499				event.preventDefault();
11500				slider.prevSlide();
11501			});
11502		}
11503		
11504		slider.showHideNav = function(){
11505			if(slider.target < 0){
11506				slider.prev.show();
11507			} else {
11508				slider.prev.hide();
11509			}
11510		}
11511		
11512		slider.setup();
11513		$(window).resize(function() {
11514			//slider.reset();
11515			setTimeout(function(){slider.init(false);},300);
11516		});
11517	}
11518	
11519	$.fn.csslider = function(options) {
11520		return this.each(function(){
11521			new $.csslider(this,options);
11522		});
11523	}
11524})(jQuery);
11525
11526(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}}
11526);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}
11526,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)
11527function revslider_showDoubleJqueryError(sliderID){var errorMessage="Revolution Slider Error: You have some jquery.js library include that c
11527omes 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>"
11528jQuery(sliderID).show().html(errorMessage);}
11529/**************************************************************************
11530 * jquery.themepunch.revolution.js - jQuery Plugin for kenburn Slider
11531 * @version: 2.3.9 (03.04.2013)
11532 * @requires jQuery v1.7 or later (tested on 1.9)
11533 * @author ThemePunch
11534**************************************************************************/
11535
11536(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"});
11536if(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");
11536if(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);
11536if(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}
11536,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}
11536)}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}
11536);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()})}}
11536if(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"})}
11536if(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}
11536,{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
11536ight: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)
11537/*
11538 * jQuery SliderTabs v1.1
11539 * http://lopatin.github.com/sliderTabs
11540 *
11541 * Copyright 2012, Alex Lopatin
11542 * Free to use under the MIT license.
11543 * http://www.opensource.org/licenses/mit-license.php
11544 *
11545 */
11546
11547jQuery.noConflict();
11548 (function( $ ){
11549	/*
11550	 * The sliderTabs tabs class
11551	 */
11552	$.sliderTabs = function(container, options){
11553		var plugin = this;
11554
11555		var defaults = {
11556			autoplay: false,
11557			tabArrowWidth: 35,
11558			classes: {
11559				leftTabArrow: '',
11560				panel: '',
11561				panelActive: '',
11562				panelsContainer: '',
11563				rightTabArrow: '',
11564				tab: '',
11565				tabActive: '',	
11566				tabsList: ''
11567			},
11568			defaultTab: 1,
11569			height: null,
11570			indicators: false,
11571			mousewheel: false,
11572			position: "top",
11573			panelArrows: false,
11574			panelArrowsShowOnHover: false,
11575			tabs: true,
11576			tabHeight: 46,
11577			tabArrows: true,
11578			tabSlideLength: 100,
11579			tabSlideSpeed: 200,
11580			transition: 'slide',
11581			transitionEasing: 'easeOutCubic',
11582			transitionSpeed: 500,
11583			width: null
11584		};
11585
11586		// jQuery objects of important elements
11587		var $container = $(container),
11588			$indicators,
11589			$tabsList,
11590			$contentDivs,
11591			$tabsListContainer,
11592			$tabsListWrapper,
11593			$contentDivsContainer,
11594			$leftTabArrow,
11595			$rightTabArrow,
11596			$leftPanelArrow,
11597			$rightPanelArrow;
11598
11599		// Locks to stop out of sync behavior
11600		var selectLock = false,
11601			heightLock = true;
11602		
11603		var settings, minMargin;
11604
11605		// Index of currently selected tab
11606		plugin.selectedTab = defaults.defaultTab;
11607		plugin.lock = false;
11608		plugin.init = function(){
11609			settings = plugin.settings = $.extend({}, defaults, options);
11610			$container.addClass('ui-slider-tabs');
11611
11612			/* 
11613			 * Rebuild structure of container
11614			 */
11615			$contentDivs = $container.children("div").addClass('ui-slider-tab-content');//.remove();
11616			
11617			// Tabs
11618			$tabsList = $container.children("ul").addClass('ui-slider-tabs-list').remove();
11619			$tabsList.children("li").remove().appendTo($tabsList);
11620			plugin.count = $tabsList.children('li').length;
11621			$tabsListWrapper = $("<div class='ui-slider-tabs-list-wrapper'>");
11622			$tabsListContainer = $("<div class='ui-slider-tabs-list-container'>").append($tabsList).appendTo($tabsListWrapper);
11623			$tabsListContainer.find('li').css('height', settings.tabHeight+2);
11624			$tabsListContainer.find('li a').css('height', settings.tabHeight+2);
11625			
11626			// Tab arrows
11627			$leftTabArrow = $("<a href='#' class='ui-slider-left-arrow'><div></div></a>").css({
11628				'width': settings.tabArrowWidth,
11629				'height': settings.tabHeight+2
11630			}).appendTo($tabsListContainer).click(function(e){
11631				plugin.slideTabs('right', settings.tabSlideLength);
11632				return false;
11633			});
11634			$rightTabArrow = $("<a href='#' class='ui-slider-right-arrow'><div></div></a>").css({
11635				'width': settings.tabArrowWidth,
11636				'height': settings.tabHeight+2
11637			}).appendTo($tabsListContainer).click(function(e){
11638				plugin.slideTabs('left', settings.tabSlideLength);
11639				return false;
11640			});
11641
11642			// Content container
11643			$contentDivsContainer = $("<div class='ui-slider-tabs-content-container'>").append($contentDivs);
11644
11645			// Position the tabs on top or bottom
11646			if(settings.position == 'bottom')
11647				$container.append($contentDivsContainer).append($tabsListWrapper.addClass('bottom'));
11648			else
11649				$container.append($tabsListWrapper).append($contentDivsContainer);
11650			
11651
11652			if(settings.width)
11653				$container.width(parseInt(settings.width));
11654			if(settings.height)
11655				$contentDivsContainer.height(parseInt(settings.height)- settings.tabHeight);
11656
11657			// Create and show indicators
11658			if(settings.indicators)
11659				plugin.showIndicators();
11660			resizePanels();
11661
11662			// Select default tab
11663			plugin.selectTab(settings.defaultTab);
11664			plugin.slideTabs('left', 0);
11665
11666			reorderPanels();
11667
11668			
11669
11670			// When tab is clicked
11671			$container.delegate('.ui-slider-tabs-list li a', 'click', function(){
11672				if(!$(this).parent().hasClass('selected') && !selectLock){
11673					plugin.selectTab($(this).parent());
11674				}
11675				return false;
11676			});
11677
11678			// When indicator is clicked
11679			if($indicators)
11680				$indicators.delegate('.ui-slider-tabs-indicator', 'click', function(){
11681					if(!$(this).hasClass('selected') && !selectLock)
11682						plugin.selectTab($(this).index()+1);
11683				});
11684
11685			// Set classes
11686			$.each(settings.classes, function(i, c){
11687				switch(i){
11688					case 'leftTabArrow': 
11689						$leftTabArrow.addClass(c);
11690						break;
11691					case 'rightTabArrow':
11692						$rightTabArrow.addClass(c);
11693						break;
11694					case 'panel':
11695						$contentDivs.addClass(c);
11696						break;
11697					case 'panelsContainer':
11698						$contentDivsContainer.addClass(c);
11699						break;
11700					case 'tab':
11701						$tabsList.find('li').addClass(c);
11702						break;
11703					case 'tabsList':
11704						$tabsList.addClass(c);
11705						break;
11706					default:
11707						break;
11708				}
11709			});
11710
11711			// Panel arrows
11712			// Creates them if they don't exist
11713			if(settings.panelArrows)
11714				positionPanelArrows();
11715
11716			if(settings.panelArrowsShowOnHover){
11717				if($leftPanelArrow)
11718					$leftPanelArrow.addClass('showOnHover');
11719				if($rightPanelArrow)
11720					$rightPanelArrow.addClass('showOnHover');
11721			}
11722
11723			$contentDivsContainer.resize(positionPanelArrows);
11724
11725			// Make responsive to changes in dimensions
11726			$tabsListWrapper.resize(function(){
11727				resizeTabsList();
11728				resizePanels();
11729				setTimeout(function(){
11730					plugin.reCalContent(plugin.selectedTab);
11731				},500);
11732				
11733				/*if(!plugin.lock){
11734					if(plugin.selectedTab == 1)
11735						plugin.selectTab1(2);
11736					else
11737						plugin.selectTab(1);
11738				}*/
11739			});
11740			
11741			// Resize content container height if inner panels change
11742			//setInterval(function(){
11743				var $panel = $contentDivsContainer.children('.selected');
11744				//console.log(heightLock);
11745				if($panel.outerHeight() > $contentDivsContainer.outerHeight() && heightLock)
11746					resizeContentContainer($panel);
11747			//}, 100);
11748
11749			resizeTabsList();
11750
11751			// Hide tabs wrapper if option if false
11752			if(!settings.tabs)
11753				$tabsListWrapper.hide();
11754
11755			// Auto play
11756			if(settings.autoplay)
11757				setInterval(plugin.next, settings.autoplay);
11758
11759			// Panel arrows
11760
11761			// Mousehweel
11762			if(settings.mousewheel){
11763				$container.bind('mousewheel', function(event, delta, deltaX, deltaY) {
11764					if(delta > 0)
11765						plugin.next();
11766					else if(delta < 0)
11767						plugin.prev();
11768					return false;
11769				});
11770			}
11771		}
11772
11773		/*
11774		 * Public methods
11775		 */
11776
11777		// Select tab
11778		// param: tab is a tab index (1 ... n) or jQuery object of tab li element
11779		plugin.selectTab = function(tab){
11780			heightLock = false;
11781
11782			// Find $targetPanel, the panel to show
11783			var $clicked = (typeof tab === 'number') ? $tabsList.children("li:nth-child("+tab+")") : tab;
11784			var targetId = ($clicked.find('a').attr('href')).substr(1);
11785			var $targetPanel = $contentDivsContainer.children("#"+targetId);
11786
11787			// Update selected tab
11788			plugin.selectedTab = (typeof tab === 'number') ? tab : tab.index()+1;
11789
11790			// Resize the main contant container to the size of $targetPanel
11791			resizeContentContainer($targetPanel);
11792
11793			// Lock selections until transitions finished
11794			selectLock = true;
11795
11796			// Direction to slide panel on hide
11797			var direction = ($tabsList.find('.selected').index() < $clicked.index()) ? 'left' : 'right';
11798			// Update selected classes
11799			$clicked.siblings().removeClass('selected');
11800			if(settings.classes.tabActive != '') $clicked.siblings().removeClass(settings.classes.tabActive);
11801			$clicked.addClass('selected').addClass(settings.classes.tabActive);
11802			
11803			// Hide and show appropriate panels
11804			hidePanel($contentDivsContainer.children(".ui-slider-tab-content:visible"), direction);
11805			showPanel($targetPanel);
11806
11807			// Slide tabs so that they fit in $tabsListContainer
11808			fitTabInContainer($clicked);
11809
11810			// Select the proper indicator
11811			selectIndicator();
11812		};
11813		
11814		plugin.reCalContent = function(tab){
11815			heightLock = false;
11816
11817			// Find $targetPanel, the panel to show
11818			var $clicked = (typeof tab === 'number') ? $tabsList.children("li:nth-child("+tab+")") : tab;			
11819			var targetId = ($clicked.find('a').attr('href')).substr(1);
11820			var $targetPanel = $contentDivsContainer.children("#"+targetId);
11821
11822			// Update selected tab
11823			resizeContentContainer($targetPanel);
11824			showPanel($targetPanel);
11825		};
11826
11827		// Select the next (right) panel
11828		plugin.next = function(){
11829			if(!selectLock){
11830				if(plugin.count === plugin.selectedTab)
11831					plugin.selectTab(1);
11832				else plugin.selectTab(plugin.selectedTab+1);
11833			}	
11834		};
11835
11836		// Select the previous panel
11837		plugin.prev = function(){
11838			if(!selectLock){
11839				if(plugin.selectedTab === 1)
11840					plugin.selectTab(plugin.count);
11841				else plugin.selectTab(plugin.selectedTab-1);
11842			}
11843		};
11844
11845		// Slide tabs left/right within $tabsListContainer
11846		plugin.slideTabs = function(direction, length){
11847			var margin = parseInt($tabsList.css('margin-left'));
11848			var newMargin = margin;
11849
11850			// Reset 'edge' classes on tab arrows
11851			$leftTabArrow.removeClass('edge');
11852			$rightTabArrow.removeClass('edge');
11853
11854			// Calculate delta to slide by
11855			if(direction=='right') newMargin += length;
11856			else if(direction=='left') newMargin -= length;
11857			if(newMargin >= 0) {
11858				newMargin = 0;
11859				$leftTabArrow.addClass('edge');
11860			}
11861			else if(newMargin <= minMargin){
11862				newMargin = minMargin;
11863				$rightTabArrow.addClass('edge');
11864			}
11865
11866			// Animate
11867			$tabsList.animate({'margin-left': newMargin}, settings.tabSlideSpeed);
11868		};
11869
11870		// Show panel indicators
11871		// Create indicators if they don't exist yet
11872		plugin.showIndicators = function(){
11873			if(!$indicators){
11874				$indicators = $("<div class='ui-slider-tabs-indicator-container'>");
11875				for(var i = 0; i < $contentDivs.length; i++){
11876					$indicators.append("<div class='ui-slider-tabs-indicator'></div>");
11877				}
11878				$contentDivsContainer.append($indicators);
11879			}
11880			else
11881				$indicators.show();
11882		};
11883
11884		// Hide panel indicators
11885		plugin.hideIndicators = function(){
11886			if($indicators)
11887				$indicators.hide();
11888		};
11889
11890		plugin.showTabArrows = function(){
11891			if(!settings.tabArrows)
11892				return;
11893			$leftTabArrow.show();
11894			$rightTabArrow.show();
11895			$tabsListContainer.css('margin', '0 ' + settings.tabArrowWidth + 'px');
11896			$tabsListContainer.removeClass("wrapper_no_tabs_slider");
11897			$tabsList.removeClass("ul_no_tabs_slider");
11898		};
11899		// Hide arrows that slide tabs left and right
11900		plugin.hideTabArrows = function() {
11901			$leftTabArrow.hide();
11902			$rightTabArrow.hide();
11903			$tabsListContainer.css('margin', '0');
11904			$tabsListContainer.addClass("wrapper_no_tabs_slider");
11905			$tabsList.addClass("ul_no_tabs_slider");
11906		};
11907
11908		// Show panel arrows
11909		plugin.showPanelArrows = function(){
11910			if($leftPanelArrow) $leftPanelArrow.show();
11911			if($rightPanelArrow) $rightPanelArrow.show();
11912		};
11913
11914		// Hide panel arrows
11915		plugin.hidePanelArrows = function(){
11916			if($leftPanelArrow) $leftPanelArrow.hide();
11917			if($rightPanelArrow) $rightPanelArrow.hide();
11918		};
11919
11920		/*
11921		 * Private methods
11922		 */
11923
11924		// Add the selected class to the plugin.selectedTab tab. Remove from all others.
11925		var selectIndicator = function(){
11926			if(settings.indicators && $indicators){
11927				var $indicator = $indicators.children("div:nth-child("+plugin.selectedTab+")");
11928				$indicator.siblings().removeClass('selected');
11929				$indicator.addClass('selected');
11930			}	
11931		};
11932
11933		// 	Slide tabs inside of $tabsListContainer so that the selected one fits inside
11934		var fitTabInContainer = function(tab){
11935			var tabOffset = tab.offset(),
11936				containerOffset = $tabsListContainer.offset(),
11937				leftOffset = tabOffset.left - containerOffset.left,
11938				rightOffset = (containerOffset.left + $tabsListContainer.outerWidth()) - (tabOffset.left + tab.outerWidth() );
11939			
11940			if(leftOffset < 0)
11941				plugin.slideTabs('right', -leftOffset);
11942			else if(rightOffset < 0)
11943				plugin.slideTabs('left', -rightOffset);
11944		};
11945
11946		// Reposition content panels so that they are ready to be transitioned in and out.
11947		// This depends on whether the transition is set to slide or fade
11948		var reorderPanels = function(){
11949			// Position content divs
11950			if(settings.transition == 'slide')
11951				// Move panels left/right basedon their index relative to the selected panel
11952				$tabsList.children('li').each(function(index, el){
11953					var selectedIndex = $tabsList.children('.selected').index(),
11954						thisIndex = $(el).index();
11955					var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1));
11956					if(selectedIndex < thisIndex)
11957						panel.css({left: $contentDivsContainer.width()+'px'});
11958					else if(selectedIndex > thisIndex)
11959						panel.css({left: '-'+$contentDivsContainer.width()+'px'});
11960					else
11961						panel.addClass(settings.classes.panelActive);
11962				});
11963			
11964			if(settings.transition == 'fade')
11965				// Set opacity to correct value for non selected panels.
11966				$tabsList.children('li').each(function(index, el){
11967					var selectedIndex = $tabsList.children('.selected').index(),
11968						thisIndex = $(el).index();
11969					var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1));
11970					if(selectedIndex != thisIndex)
11971						panel.css({opacity: 0});
11972					else
11973						panel.addClass(settings.classes.panelActive);
11974				});
11975		};
11976		
11977		// Object determining css properties to be animated to based on various actions, transitions, and directions
11978		var panelAnimationCSS = function(width){
11979			return {
11980					hide: {
11981						slideleft: {
11982							left: '-'+width+'px'
11983						},
11984						slideright: {
11985							left: width+'px'
11986						},
11987						fade: {
11988							opacity: 0
11989						}
11990					},
11991					show: {
11992						slide: {
11993							left: 0
11994						},
11995						fade: {
11996							opacity: 1
11997						}
11998					}
11999				}
12000		};
12001		
12002		// Transition out the passed in panel.
12003		// param: 	panel is the jQuery object of the panel to be hidden
12004		//			direction is either 'left' or 'right' for sliding transitions
12005		var hidePanel = function(panel, direction){
12006			// Calculate correct key in panelAnimationCSS
12007			if(settings.transition == 'slide')
12008				var trans = 'slide'+direction;
12009			else var trans = settings.transition;
12010
12011			// Animate the panel out
12012			panel.animate(panelAnimationCSS($contentDivsContainer.width())['hide'][trans], settings.transitionSpeed, settings.transitionEasing, function(){
12013				panel.hide();
12014				panel.removeClass('selected');
12015				//if(settings.classes.panelActive != '') panel.removeClass(settings.classes.panelActive);
12016				selectLock = false;
12017				reorderPanels();
12018			});
12019		};
12020
12021		// Transition in the parameter panel
12022		// param: 	panel is the jQuery object of the panel to be shown
12023		var showPanel = function(panel){
12024			// Show first
12025			panel.show();
12026			panel.addClass(settings.classes.panelActive).addClass('selected');
12027
12028			// Then animate css properties
12029			panel.animate(panelAnimationCSS($contentDivsContainer.width())['show'][settings.transition], settings.transitionSpeed, settings.transitionEasing, function(){
12030				selectLock = false;
12031				heightLock = true;
12032				reorderPanels();
12033			});
12034		};
12035
12036		// Animate the height of the content container to height target
12037		// params:  target (int) is the new height
12038		var resizeContentContainer = function(target){
12039			//console.log(target);
12040			//resizePanels();
12041			if(!settings.height)
12042				$contentDivsContainer.animate({
12043					height: actualHeight(target)
12044				}, 200);
12045		};
12046
12047		// Position the panel arrows
12048		var positionPanelArrows = function(){
12049			if(settings.panelArrows){
12050				// Initialize them if you need to
12051				if(!$leftPanelArrow && !$rightPanelArrow){
12052					$leftPanelArrow = $("<div class='ui-slider-tabs-leftPanelArrow'>").click(function(){
12053						plugin.prev();
12054					});
12055					$rightPanelArrow = $("<div class='ui-slider-tabs-rightPanelArrow'>").click(function(){
12056						plugin.next();
12057					});
12058
12059					$leftPanelArrow.appendTo($contentDivsContainer);
12060					$rightPanelArrow.appendTo($contentDivsContainer);
12061				}
12062
12063				// Set correct CSS 'top' attribute of each panel arrow
12064				$rightPanelArrow.css({
12065					"top": $contentDivsContainer.height()/2 - $rightPanelArrow.outerHeight()/2
12066				});
12067				$leftPanelArrow.css({
12068					"top": $contentDivsContainer.height()/2 - $leftPanelArrow.outerHeight()/2
12069				});
12070			}
12071		};
12072
12073		// Change the width of $tabsList to the sum of the outer widths of all tabs
12074		var resizeTabsList = function(){
12075			// Calculate total width
12076			var width = 0;
12077			$tabsList.children().each(function(index, element){				
12078				width += $(element).outerWidth(true);
12079			});
12080			// Set new width of $tabsList
12081			// Hack by emthemes
12082			if($.browser.msie && $.browser.version == 8){
12083				width = width-16;
12084				$tabsList.width(width + 16);
12085				if($tabsListContainer.width() < width && settings.tabArrows){
12086					plugin.showTabArrows();
12087					minMargin = $tabsListContainer.width() - width;
12088				}
12089				else plugin.hideTabArrows();
12090			}else{
12091				width = width + 10;
12092				$tabsList.width(width);
12093				if($tabsListContainer.width() < width && settings.tabArrows){
12094					plugin.showTabArrows();
12095					minMargin = $tabsListContainer.width() - width;
12096				}
12097				else plugin.hideTabArrows();
12098			}
12099			
12100			// Original version :$tabsList.width(width);
12101
12102			// Update minMargin. Hide tab arrows if no overflow
12103			//console.log(width);
12104			
12105
12106			$tabsList.animate({'margin-left': 0});
12107		}
12108
12109		// Resize indiviual panels to the width of the new container
12110		var resizePanels = function(){
12111			$contentDivs.width($contentDivsContainer.width() - ($contentDivs.outerWidth() - $contentDivs.width()));
12112		};
12113
12114		// Get height of a hidden element
12115		var actualHeight = function(element){
12116
12117			var prevCSS = {
12118				'display': element.css('display'),
12119				'left': element.css('left'),
12120				'position': element.css('position')
12121			};
12122			element.css({
12123				'display': 'normal',
12124				'left': -5000,
12125				'position': 'absolute'
12126			});
12127			var height = element.outerHeight();
12128			element.css(prevCSS);
12129
12130			return height;
12131		};
12132		
12133
12134		// Initialize the plugin
12135		plugin.init();
12136	};
12137
12138	/*
12139	 * Handle input. Call public functions and initializers
12140	 */
12141	$.fn.sliderTabs = function( data ) {
12142		return this.each(function(){
12143			var _this = $(this),
12144				plugin = _this.data('sliderTabs');
12145
12146			// Method calling logic
12147		    if (!plugin) {
12148		    	// If no plugin, initialize it
12149				plugin = new $.sliderTabs(this, data);
12150				_this.data('sliderTabs', plugin);
12151				return plugin;
12152			}
12153			if (plugin.methods[data]){
12154				// If plugin exists, call a public method
12155				return plugin.methods[ data ].apply( this, Array.prototype.slice.call( arguments, 1 ));
12156			}
12157		});
12158  	};
12159})( jQuery );
12160
12161
12162
12163
12164
12165/*
12166 * Additional easing functions
12167 * Taken from jQuery UI source code
12168 * 
12169 * https://github.com/jquery/jquery-ui
12170 */
12171
12172jQuery.extend($.easing,
12173{
12174    def: 'easeOutQuad',
12175    swing: function (x, t, b, c, d) {
12176        //alert($.easing.default);
12177        return $.easing[$.easing.def](x, t, b, c, d);
12178    },
12179    easeInQuad: function (x, t, b, c, d) {
12180        return c*(t/=d)*t + b;
12181    },
12182    easeOutQuad: function (x, t, b, c, d) {
12183        return -c *(t/=d)*(t-2) + b;
12184    },
12185    easeInOutQuad: function (x, t, b, c, d) {
12186        if ((t/=d/2) < 1) return c/2*t*t + b;
12187        return -c/2 * ((--t)*(t-2) - 1) + b;
12188    },
12189    easeInCubic: function (x, t, b, c, d) {
12190        return c*(t/=d)*t*t + b;
12191    },
12192    easeOutCubic: function (x, t, b, c, d) {
12193        return c*((t=t/d-1)*t*t + 1) + b;
12194    },
12195    easeInOutCubic: function (x, t, b, c, d) {
12196        if ((t/=d/2) < 1) return c/2*t*t*t + b;
12197        return c/2*((t-=2)*t*t + 2) + b;
12198    },
12199    easeInQuart: function (x, t, b, c, d) {
12200        return c*(t/=d)*t*t*t + b;
12201    },
12202    easeOutQuart: function (x, t, b, c, d) {
12203        return -c * ((t=t/d-1)*t*t*t - 1) + b;
12204    },
12205    easeInOutQuart: function (x, t, b, c, d) {
12206        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
12207        return -c/2 * ((t-=2)*t*t*t - 2) + b;
12208    },
12209    easeInQuint: function (x, t, b, c, d) {
12210        return c*(t/=d)*t*t*t*t + b;
12211    },
12212    easeOutQuint: function (x, t, b, c, d) {
12213        return c*((t=t/d-1)*t*t*t*t + 1) + b;
12214    },
12215    easeInOutQuint: function (x, t, b, c, d) {
12216        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
12217        return c/2*((t-=2)*t*t*t*t + 2) + b;
12218    },
12219    easeInSine: function (x, t, b, c, d) {
12220        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
12221    },
12222    easeOutSine: function (x, t, b, c, d) {
12223        return c * Math.sin(t/d * (Math.PI/2)) + b;
12224    },
12225    easeInOutSine: function (x, t, b, c, d) {
12226        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
12227    },
12228    easeInExpo: function (x, t, b, c, d) {
12229        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
12230    },
12231    easeOutExpo: function (x, t, b, c, d) {
12232        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
12233    },
12234    easeInOutExpo: function (x, t, b, c, d) {
12235        if (t==0) return b;
12236        if (t==d) return b+c;
12237        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
12238        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
12239    },
12240    easeInCirc: function (x, t, b, c, d) {
12241        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
12242    },
12243    easeOutCirc: function (x, t, b, c, d) {
12244        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
12245    },
12246    easeInOutCirc: function (x, t, b, c, d) {
12247        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
12248        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
12249    },
12250    easeInElastic: function (x, t, b, c, d) {
12251        var s=1.70158;var p=0;var a=c;
12252        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
12253        if (a < Math.abs(c)) { a=c; var s=p/4; }
12254        else var s = p/(2*Math.PI) * Math.asin (c/a);
12255        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
12256    },
12257    easeOutElastic: function (x, t, b, c, d) {
12258        var s=1.70158;var p=0;var a=c;
12259        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
12260        if (a < Math.abs(c)) { a=c; var s=p/4; }
12261        else var s = p/(2*Math.PI) * Math.asin (c/a);
12262        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
12263    },
12264    easeInOutElastic: function (x, t, b, c, d) {
12265        var s=1.70158;var p=0;var a=c;
12266        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
12267        if (a < Math.abs(c)) { a=c; var s=p/4; }
12268        else var s = p/(2*Math.PI) * Math.asin (c/a);
12269        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
12270        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
12271    },
12272    easeInBack: function (x, t, b, c, d, s) {
12273        if (s == undefined) s = 1.70158;
12274        return c*(t/=d)*t*((s+1)*t - s) + b;
12275    },
12276    easeOutBack: function (x, t, b, c, d, s) {
12277        if (s == undefined) s = 1.70158;
12278        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
12279    },
12280    easeInOutBack: function (x, t, b, c, d, s) {
12281        if (s == undefined) s = 1.70158;
12282        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
12283        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
12284    },
12285    easeInBounce: function (x, t, b, c, d) {
12286        return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
12287    },
12288    easeOutBounce: function (x, t, b, c, d) {
12289        if ((t/=d) < (1/2.75)) {
12290            return c*(7.5625*t*t) + b;
12291        } else if (t < (2/2.75)) {
12292            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
12293        } else if (t < (2.5/2.75)) {
12294            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
12295        } else {
12296            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
12297        }
12298    },
12299    easeInOutBounce: function (x, t, b, c, d) {
12300        if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
12301        return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
12302    }
12303});
12304
12305
12306
12307
12308
12309/*
12310 * The following is the jQuery Mousewheel plugin. Full credit goes to 
12311 * Brandon Aaron. (https://github.com/brandonaaron/jquery-mousewheel)
12312 * /
12313
12314
12315/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
12316 * Licensed under the MIT License (LICENSE.txt).
12317 *
12318 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
12319 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
12320 * Thanks to: Seamus Leahy for adding deltaX and deltaY
12321 *
12322 * Version: 3.0.6
12323 * 
12324 * Requires: 1.2.2+
12325 */
12326
12327(function($) {
12328
12329var types = ['DOMMouseScroll', 'mousewheel'];
12330
12331if ($.event.fixHooks) {
12332    for ( var i=types.length; i; ) {
12333        $.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
12334    }
12335}
12336
12337$.event.special.mousewheel = {
12338    setup: function() {
12339        if ( this.addEventListener ) {
12340            for ( var i=types.length; i; ) {
12341                this.addEventListener( types[--i], handler, false );
12342            }
12343        } else {
12344            this.onmousewheel = handler;
12345        }
12346    },
12347    
12348    teardown: function() {
12349        if ( this.removeEventListener ) {
12350            for ( var i=types.length; i; ) {
12351                this.removeEventListener( types[--i], handler, false );
12352            }
12353        } else {
12354            this.onmousewheel = null;
12355        }
12356    }
12357};
12358
12359$.fn.extend({
12360    mousewheel: function(fn) {
12361        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
12362    },
12363    
12364    unmousewheel: function(fn) {
12365        return this.unbind("mousewheel", fn);
12366    }
12367});
12368
12369
12370function handler(event) {
12371    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
12372    event = $.event.fix(orgEvent);
12373    event.type = "mousewheel";
12374    
12375    // Old school scrollwheel delta
12376    if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
12377    if ( orgEvent.detail     ) { delta = -orgEvent.detail/3; }
12378    
12379    // New school multidimensional scroll (touchpads) deltas
12380    deltaY = delta;
12381    
12382    // Gecko
12383    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
12384        deltaY = 0;
12385        deltaX = -1*delta;
12386    }
12387    
12388    // Webkit
12389    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
12390    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
12391    
12392    // Add event and delta to the front of the arguments
12393    args.unshift(event, delta, deltaX, deltaY);
12394    
12395    return ($.event.dispatch || $.event.handle).apply(this, args);
12396}
12397
12398})(jQuery);
12399
12400
12401
12402/*
12403 * The following is the jQuery Resize plugin. Full credit goes to 
12404 * "Cowboy" Ben Alman. (https://github.com/cowboy/jquery-resize)
12405 * /
12406
12407/*
12408 * jQuery resize event - v1.1 - 3/14/2010
12409 * http://benalman.com/projects/jquery-resize-plugin/
12410 * 
12411 * Copyright (c) 2010 "Cowboy" Ben Alman
12412 * Dual licensed under the MIT and GPL licenses.
12413 * http://benalman.com/about/license/
12414 */
12415(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}
12415var 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.