PageSourceSearch

https://www.dedoshop.com/media/js/adfc7a200f0babf35abd973129667ef3.js

js dedoshop.com collected 2026-10-10 02:21:32 UTC 773,871 bytes, 12,364 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    Varien
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 */
4647
4648/**************************** WEEE STUFF ********************************/
4649function taxToggle(details, switcher, expandedClassName)
4650{
4651    if ($(details).style.display == 'none') {
4652        $(details).show();
4653        $(switcher).addClassName(expandedClassName);
4654    } else {
4655        $(details).hide();
4656        $(switcher).removeClassName(expandedClassName);
4657    }
4658}
4659
4660/*!
4661 * jQuery throttle / debounce - v1.1 - 3/7/2010
4662 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
4663 * 
4664 * Copyright (c) 2010 "Cowboy" Ben Alman
4665 * Dual licensed under the MIT and GPL licenses.
4666 * http://benalman.com/about/license/
4667 */
4668
4669// Script: jQuery throttle / debounce: Sometimes, less is more!
4670//
4671// *Version: 1.1, Last updated: 3/7/2010*
4672// 
4673// Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
4674// GitHub       - http://github.com/cowboy/jquery-throttle-debounce/
4675// Source       - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
4676// (Minified)   - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
4677// 
4678// About: License
4679// 
4680// Copyright (c) 2010 "Cowboy" Ben Alman,
4681// Dual licensed under the MIT and GPL licenses.
4682// http://benalman.com/about/license/
4683// 
4684// About: Examples
4685// 
4686// These working examples, complete with fully commented code, illustrate a few
4687// ways in which this plugin can be used.
4688// 
4689// Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
4690// Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
4691// 
4692// About: Support and Testing
4693// 
4694// Information about what version or versions of jQuery this plugin has been
4695// tested with, what browsers it has been tested in, and where the unit tests
4696// reside (so you can test it yourself).
4697// 
4698// jQuery Versions - none, 1.3.2, 1.4.2
4699// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
4700// Unit Tests      - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
4701// 
4702// About: Release History
4703// 
4704// 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
4705//       executed later than they should. Reworked a fair amount of internal
4706//       logic as well.
4707// 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
4708//       from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
4709//       no_trailing throttle parameter and debounce functionality.
4710// 
4711// Topic: Note for non-jQuery users
4712// 
4713// jQuery isn't actually required for this plugin, because nothing internal
4714// uses any jQuery methods or properties. jQuery is just used as a namespace
4715// under which these methods can exist.
4716// 
4717// Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
4718// when this plugin is loaded, the method described below will be created in
4719// the `Cowboy` namespace. Usage will be exactly the same, but instead of
4720// $.method() or jQuery.method(), you'll need to use Cowboy.method().
4721
4722(function(window,undefined){
4723  '$:nomunge'; // Used by YUI compressor.
4724  
4725  // Since jQuery really isn't required for this plugin, use `jQuery` as the
4726  // namespace only if it already exists, otherwise use the `Cowboy` namespace,
4727  // creating it if necessary.
4728  var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
4729    
4730    // Internal method reference.
4731    jq_throttle;
4732  
4733  // Method: jQuery.throttle
4734  // 
4735  // Throttle execution of a function. Especially useful for rate limiting
4736  // execution of handlers on events like resize and scroll. If you want to
4737  // rate-limit execution of a function to a single time, see the
4738  // <jQuery.debounce> method.
4739  // 
4740  // In this visualization, | is a throttled-function call and X is the actual
4741  // callback execution:
4742  // 
4743  // >
vendor: 4,881 bytes, lines 4743-4867
4743 Throttled with `no_trailing` specified as false or unspecified:
4744  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4745  // > X    X    X    X    X    X        X    X    X    X    X    X
4746  // > 
4747  // > Throttled with `no_trailing` specified as true:
4748  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4749  // > X    X    X    X    X             X    X    X    X    X
4750  // 
4751  // Usage:
4752  // 
4753  // > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
4754  // > 
4755  // > jQuery('selector').bind( 'someevent', throttled );
4756  // > jQuery('selector').unbind( 'someevent', throttled );
4757  // 
4758  // This also works in jQuery 1.4+:
4759  // 
4760  // > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
4761  // > jQuery('selector').unbind( 'someevent', callback );
4762  // 
4763  // Arguments:
4764  // 
4765  //  delay - (Number) A zero-or-greater delay in milliseconds. For event
4766  //    callbacks, values around 100 or 250 (or even higher) are most useful.
4767  //  no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
4768  //    true, callback will only execute every `delay` milliseconds while the
4769  //    throttled-function is being called. If no_trailing is false or
4770  //    unspecified, callback will be executed one final time after the last
4771  //    throttled-function call. (After the throttled-function has not been
4772  //    called for `delay` milliseconds, the internal counter is reset)
4773  //  callback - (Function) A function to be executed after delay milliseconds.
4774  //    The `this` context and all arguments are passed through, as-is, to
4775  //    `callback` when the throttled-function is executed.
4776  // 
4777  // Returns:
4778  // 
4779  //  (Function) A new, throttled, function.
4780  
4781  $.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
4782    // After wrapper has stopped being called, this timeout ensures that
4783    // `callback` is executed at the proper times in `throttle` and `end`
4784    // debounce modes.
4785    var timeout_id,
4786      
4787      // Keep track of the last time `callback` was executed.
4788      last_exec = 0;
4789    
4790    // `no_trailing` defaults to falsy.
4791    if ( typeof no_trailing !== 'boolean' ) {
4792      debounce_mode = callback;
4793      callback = no_trailing;
4794      no_trailing = undefined;
4795    }
4796    
4797    // The `wrapper` function encapsulates all of the throttling / debouncing
4798    // functionality and when executed will limit the rate at which `callback`
4799    // is executed.
4800    function wrapper() {
4801      var that = this,
4802        elapsed = +new Date() - last_exec,
4803        args = arguments;
4804      
4805      // Execute `callback` and update the `last_exec` timestamp.
4806      function exec() {
4807        last_exec = +new Date();
4808        callback.apply( that, args );
4809      };
4810      
4811      // If `debounce_mode` is true (at_begin) this is used to clear the flag
4812      // to allow future `callback` executions.
4813      function clear() {
4814        timeout_id = undefined;
4815      };
4816      
4817      if ( debounce_mode && !timeout_id ) {
4818        // Since `wrapper` is being called for the first time and
4819        // `debounce_mode` is true (at_begin), execute `callback`.
4820        exec();
4821      }
4822      
4823      // Clear any existing timeout.
4824      timeout_id && clearTimeout( timeout_id );
4825      
4826      if ( debounce_mode === undefined && elapsed > delay ) {
4827        // In throttle mode, if `delay` time has been exceeded, execute
4828        // `callback`.
4829        exec();
4830        
4831      } else if ( no_trailing !== true ) {
4832        // In trailing throttle mode, since `delay` time has not been
4833        // exceeded, schedule `callback` to execute `delay` ms after most
4834        // recent execution.
4835        // 
4836        // If `debounce_mode` is true (at_begin), schedule `clear` to execute
4837        // after `delay` ms.
4838        // 
4839        // If `debounce_mode` is false (at end), schedule `callback` to
4840        // execute after `delay` ms.
4841        timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
4842      }
4843    };
4844    
4845    // Set the guid of `wrapper` function to the same of original callback, so
4846    // it can be removed in jQuery 1.4+ .unbind or .die by using the original
4847    // callback as a reference.
4848    if ( $.guid ) {
4849      wrapper.guid = callback.guid = callback.guid || $.guid++;
4850    }
4851    
4852    // Return the wrapper function.
4853    return wrapper;
4854  };
4855  
4856  // Method: jQuery.debounce
4857  // 
4858  // Debounce execution of a function. Debouncing, unlike throttling,
4859  // guarantees that a function is only executed a single time, either at the
4860  // very beginning of a series of calls, or at the very end. If you want to
4861  // simply rate-limit execution of a function, see the <jQuery.throttle>
4862  // method.
4863  // 
4864  // In this visualization, | is a debounced-function call and X is the actual
4865  // callback execution:
4866  // 
4867  // >
4867 Debounced with `at_begin` specified as false or unspecified:
4868  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4869  // >                          X                                 X
4870  // > 
4871  // > Debounced with `at_begin` specified as true:
4872  // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
4873  // > X                                 X
4874  // 
4875  // Usage:
4876  // 
4877  // > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
4878  // > 
4879  // > jQuery('selector').bind( 'someevent', debounced );
4880  // > jQuery('selector').unbind( 'someevent', debounced );
4881  // 
4882  // This also works in jQuery 1.4+:
4883  // 
4884  // > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
4885  // > jQuery('selector').unbind( 'someevent', callback );
4886  // 
4887  // Arguments:
4888  // 
4889  //  delay - (Number) A zero-or-greater delay in milliseconds. For event
4890  //    callbacks, values around 100 or 250 (or even higher) are most useful.
4891  //  at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
4892  //    unspecified, callback will only be executed `delay` milliseconds after
4893  //    the last debounced-function call. If at_begin is true, callback will be
4894  //    executed only at the first debounced-function call. (After the
4895  //    throttled-function has not been called for `delay` milliseconds, the
4896  //    internal counter is reset)
4897  //  callback - (Function) A function to be executed after delay milliseconds.
4898  //    The `this` context and all arguments are passed through, as-is, to
4899  //    `callback` when the debounced-function is executed.
4900  // 
4901  // Returns:
4902  // 
4903  //  (Function) A new, debounced, function.
4904  
4905  $.debounce = function( delay, at_begin, callback ) {
4906    return callback === undefined
4907      ? jq_throttle( delay, at_begin, false )
4908      : jq_throttle( delay, callback, at_begin !== false );
4909  };
4910  
4911})(this);
4912
4913/**
4914 * EM MegaMenuPro
4915 *
4916 * @license commercial software
4917 * @copyright (c) 2012 Codespot Software JSC - EMThemes.com. (http://www.emthemes.com)
4918 */
4919(function($) {
4920	function isMobileView() {
4921		return $(window).width() <= 767;
4922	};
4923	/**
4924	 * Make menu support on mobile
4925	 */
4926
4927	function mobile() {
4928		$('.em_nav').each(function(i) {
4929			var $nav = $('.hnav, .vnav', this);
4930			// prepend a.arrow into parent LI 
4931			var timeout = null;
4932			// bind event when click on a.arrow sliding to the sub menu horizontally
4933            $('a.arrow', $nav).bind(isWindowPhone ? 'mouseenter' : (isMobile ? 'click mouseenter' : 'click'), function(event) {
4934			//$('a.arrow', $nav).bind(isMobile ? 'click mouseenter' : 'click', function(event) {
4935				if (!isMobileView()) return;
4936				event.preventDefault();
4937				event.stopPropagation();
4938				var $li = $(this.parentNode);
4939				if (timeout) {
4940					clearTimeout(timeout);
4941				}
4942				if (!$li.hasClass('cur-toggle') && $('li.cur-toggle', $nav).length > 0 && !($li.parents('li.cur-toggle').length > 0)) {
4943					$('li.cur-toggle', $nav).each(function() {
4944						$(this).removeClass('cur-toggle');
4945						if ($(this).css('display') != 'none') {
4946							$(this).children('ul').slideToggle();
4947						}
4948					});
4949				}
4950				// fix bug event called twice cause menu sub menu showed even not clicked
4951				// don't know why it happens!!!
4952				$li.children('ul').slideToggle();
4953				if ($li.hasClass('cur-toggle')) $li.removeClass('cur-toggle');
4954				else if ($li.parents('li.cur-toggle').length == 0) $li.addClass('cur-toggle');
4955			});
4956		});
4957	};
4958
4959	function fixPc() {
4960		if ($(window).width() > 767) {
4961			$('.em_nav').each(function(i) {
4962				var $nav = $('.hnav, .vnav', this);
4963				//$('a.arrow', $nav).unbind(isMobile ? 'click mouseenter' : 'click');
4964				var $li = $(this.parentNode);
4965				$('li', $nav).each(function() {
4966					$(this).children('ul').css('display', '');
4967				});
4968			});
4969		}
4970	};
4971	/**
4972	 * Fix mega menu drop-down's container overflows the right edge of page.
4973	 *
4974	 * Should be called once when document ready
4975	 */
4976
4977	function fixMegaMenuOverflow() {
4978		function fix($container, $nav) {
4979			var pad = $nav.offset().left + $nav.outerWidth() - ($container.offset().left + $container.outerWidth());
4980			var pad2 = $container.offset().left + pad - $nav.offset().left;
4981			if (pad2 < 0) pad = pad - pad2;
4982			if (pad < 0) {
4983				$container.css('left', pad + 'px');
4984			}
4985		};
4986		$('.em_nav > .hnav > .menu-item-link > .menu-container').parent().hover(function() {
4987			var $container = $(this).children('.menu-container');
4988			if ($(this).hasClass('menu-item-depth-0')) $container.css('left', 0);
4989			var $nav = $(this).parents('.fix_menu').first();
4990			fix($container, $nav);
4991		}, function() {
4992			$(this).children('.menu-container').css('left', '');
4993		});
4994	};
4995
4996	function menuVertical() {
4997		if (!isPhone && $(window).width() > 767) {
4998			if ($('.vnav > .menu-item-link > .menu-container > li.fix-top').length > 0) {
4999				$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().parent().mouseover(function() {
5000					var $container = $(this).children('.menu-container,ul.level0');
5001					var $containerHeight = $container.outerHeight();
5002					var $containerTop = $container.offset().top;
5003					var $winHeight = $(window).height();
5004					var $maxHeight = $containerHeight + $containerTop;
5005					$setTop = $(this).parent().offset().top - $(this).offset().top;
5006					if (($setTop + $containerHeight) < $(this).height()) {
5007						$setTop = $(this).outerHeight() - $containerHeight;
5008					}
5009					var $grid = $(this).parents('.em_nav').first().parents().first();
5010					$container.css('top', $setTop);
5011					if ($maxHeight < $winHeight) {
5012						$('.vnav ul.level0,.vnav > .menu-item-link').children('.fix-top').parent('.menu-container').first().css('top', $setTop - 9 + 'px');
5013					}
5014				});
5015				$('.vnav ul.level0,.vnav > .menu-item-link').children('.fix-top').parent('.menu-container').parent().mouseout(function() {
5016					var $container = $(this).children('.menu-container,ul.level0');
5017					$container.removeAttr('style');
5018				});
5019			}
5020		} else {
5021			$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().parent().off('mouseover mouseon');
5022			$('.vnav > .menu-item-link > .menu-container > li.fix-top').parent().off('mouseover mouseon');
5023			$('.vnav .menu-item-link > .menu-container,.vnav ul.level0').parent().off('mouseover mouseon');
5024		}
5025	};
5026	var tm;
5027	$(document).ready(function() {
5028		$('.em_nav').each(function(i) {
5029			var $nav = $('.hnav, .vnav', this);
5030			$('.em-catalog-navigation li.parent, .menu-item-link.menu-item-parent', $nav).each(function() {
5031				$(this).prepend('<a href="javascript:void(0)" class="arrow"><span>&gt;</span></a>');
5032			});
5033		});
5034		menuVertical();
5035		clearTimeout(tm);
5036        if(disableResponsive!=1){
5037            tm = setTimeout(function() {
5038    			mobile();
5039    		}, 100);
5040        }		
5041		fixMegaMenuOverflow();
5042	});
5043    
5044	var temp;
5045	$(window).resize(function() {
5046	   if(disableResponsive!=1){
5047    		menuVertical();
5048    		clearTimeout(temp);
5049    		temp = setTimeout(function() {
5050    			fixPc();
5051    		}, 100);
5052    		fixMegaMenuOverflow();
5053        }
5054	});
5055    
5056})(jQuery);
5057(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);
5057if((!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);
5058(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)})}else{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("c
5058olorpicker").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}
5058return 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)}
5058else 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);
5059/**
5060 * Galathemes
5061 *
5062 * @license commercial software
5063 * @copyright (c) 2014 Codespot Software JSC - Galathemes.com. (http://www.galathemes.com)
5064 */
5065jQuery(function($) {
5066	var variables = {};
5067	var panel = $('#demotool_variation').css({
5068		'left': '-100%',
5069		'position': 'absolute'
5070	});
5071	$('a.btn-toggle').click(function() {
5072		if (!panel.hasClass('show')) {
5073			$('.variation-cp').show();
5074			panel.css('top', Math.max($(document).scrollTop(), Math.min($(this).offset().top, $(document).scrollTop() + $(window).height() - panel.outerHeight())) + 'px').addClass('show').animate({
5075				'left': $(this).width() + 1 + 'px'
5076			});
5077		} else {
5078			panel.removeClass('show').animate({
5079				'left': -$(this).width() - panel.outerWidth() - 10 + 'px'
5080			}, 500, function() {
5081				$('.variation-cp').hide();
5082			});
5083		}
5084		return false;
5085	});
5086	// toogle section content-title
5087	$('#demotool_variation .content-title').click(function() {
5088		$(this).next('.wrapper-content').slideToggle('fast');
5089	}).trigger('click').first().trigger('click');
5090	// toggle box content
5091	$('#demotool_variation .box .title').click(function() {
5092		var box = $(this).parent();
5093		if (box.children('.content').is(':visible')) {
5094			box.children('.content').slideUp('fast');
5095			box.addClass('close');
5096		} else {
5097			box.children('.content').slideDown('fast');
5098			box.removeClass('close');
5099		}
5100	});
5101	// load google fonts
5102
5103    /* Box Wide Mode */
5104	$('#em_box_wide').change(function() {
5105		var mode = $('#em_box_wide').val();
5106		if (mode == 'box') {
5107			$('#emoption_wideslideshow').hide();
5108			$('#page_boxconfig').show();
5109			$('.wrapper').addClass('em-box-custom');
5110			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5111			if ($('.em_area01').parent().is("div.container")) {
5112				$(".em_area01").unwrap("<div class='container'></div>");
5113			}
5114			$('.em_area02').removeClass('em-wide-custom');
5115		} else {
5116			$('.wrapper').removeClass('em-box-custom');
5117			$('#emoption_wideslideshow').show();
5118			$('#page_boxconfig').hide();
5119			if ($('#wide_full').is(':checked')) {
5120				$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5121				$(".em_area01").wrap("<div class='container'></div>");
5122				$('.em_area02').addClass('em-wide-custom');
5123			} else {
5124				$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5125				if ($('.em_area01').parent().is("div.container")) {
5126					$(".em_area01").unwrap("<div class='container'></div>");
5127				}
5128				$('.em_area02').removeClass('em-wide-custom');
5129			}
5130		}
5131	});
5132	$('#wide_full').change(function() {
5133		if ($('#wide_full').is(':checked')) {
5134			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5135			$(".em_area01").wrap("<div class='container'></div>");
5136			$('.em_area02').addClass('em-wide-custom');
5137		} else {
5138			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5139			if ($('.em_area01').parent().is("div.container")) {
5140				$(".em_area01").unwrap("<div class='container'></div>");
5141			}
5142			$('.em_area02').removeClass('em-wide-custom');
5143		}
5144	});
5145	// reset
5146	$('#demotool_variation .reset-button').click(function() {
5147		$('#demotool_variation input[type=text], #demotool_variation select, #demotool_variation input[type=hidden]').val('').css('background-color', '');
5148		resetVariation();
5149		//box wide
5150		$('#em_box_wide').val(boxwide_selected);
5151		var mode = $('#em_box_wide').val();
5152		if (mode == 'box') {
5153			$('#emoption_wideslideshow').hide();
5154			$('#page_boxconfig').show();
5155			$('.wrapper').addClass('em-box-custom');
5156			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5157			if ($('.em_area01').parent().is("div.container")) {
5158				$(".em_area01").unwrap("<div class='container'></div>");
5159			}
5160			$('.em_area02').removeClass('em-wide-custom');
5161		} else {
5162			$('.wrapper').removeClass('em-box-custom');
5163			$('#emoption_wideslideshow').show();
5164			$('#page_boxconfig').hide();
5165			if ($('#wide_full').is(':checked')) {
5166				$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5167				$(".em_area01").wrap("<div class='container'></div>");
5168				$('.em_area02').addClass('em-wide-custom');
5169			} else {
5170				$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5171				if ($('.em_area01').parent().is("div.container")) {
5172					$(".em_area01").unwrap("<div class='container'></div>");
5173				}
5174				$('.em_area02').removeClass('em-wide-custom');
5175			}
5176		}
5177		// slideshow
5178		if (fullSlideshow) {
5179			$('#wide_full').prop('checked', true); // Uncheck the checkbox
5180		} else {
5181			$('#wide_full').prop('checked', false);
5182		}
5183		if ($('#wide_full').is(':checked')) {
5184			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5185			$('.em_area02').addClass('em-wide-custom');
5186		} else {
5187			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5188			$('.em_area02').removeClass('em-wide-custom');
5189		}
5190		return false;
5191	});
5192	// stripes pattern
5193	$('#demotool_variation a.page_bg_image').click(function() {
5194		$('#demotool_variation a.page_bg_image').removeClass('selected');
5195		$(this).addClass('selected');
5196		$('#demotool_variation input[name=page_bg_image]').val($(this).data('input-value'));
5197		changeVariation('@page_bg_image', $('#demotool_variation input[name=page_bg_image]').val());
5198		return false;
5199	});
5200	$('#demotool_variation a.header_bg_image').click(function() {
5201		$('#demotool_variation a.header_bg_image').removeClass('selected');
5202		$(this).addClass('selected');
5203		$('#demotool_variation input[name=header_bg_image]').val($(this).data('input-value'));
5204		changeVariation('@header_bg_image', $('#demotool_variation input[name=header_bg_image]').val());
5205		return false;
5206	});
5207	$('#demotool_variation a.body_bg_image').click(function() {
5208		$('#demotool_variation a.body_bg_image').removeClass('selected');
5209		$(this).addClass('selected');
5210		$('#demotool_variation input[name=body_bg_image]').val($(this).data('input-value'));
5211		changeVariation('@body_bg_image', $('#demotool_variation input[name=body_bg_image]').val());
5212		return false;
5213	});
5214	$('#demotool_variation a.footer_bg_image').click(function() {
5215		$('#demotool_variation a.footer_bg_image').removeClass('selected');
5216		$(this).addClass('selected');
5217		$('#demotool_variation input[name=footer_bg_image]').val($(this).data('input-value'));
5218		changeVariation('@footer_bg_image', $('#demotool_variation input[name=footer_bg_image]').val());
5219		return false;
5220	});
5221	changeVariation = function(key, value) {
5222		var key = key || null;
5223		var value = value || null;
5224		var temp = {};
5225		if (key) {
5226			if (String(value).indexOf(',') != -1 || String(value).indexOf('.') != -1 || String(value).indexOf('/') != -1 || String(value).indexOf(' ') != -1) variables[key] = '~"' + String(value.replace(/"/g, "'")) + '"';
5227			else
5228			variables[key] = String(value);
5229		}
5230		less.modifyVars(variables);
5231	}; /*return default value when input value is null*/
5232	returnDefault = function(key) {
5233		if (variables[key]) delete(variables[key]);
5234		less.modifyVars(variables);
5235	};
5235 /*reset Variation*/
5236	resetVariation = function() {
5237		variables = {};
5238		less.refresh();
5239	};
5240	$('.color-picker').ColorPicker({
5241		onSubmit: $.throttle(300, function(hsb, hex, rgb, el) {
5242			$(el).val('#' + hex);
5243			$(el).css('backgroundColor', '#' + hex);
5244			//$(el).ColorPickerHide();
5245		}),
5246		onChange: $.debounce(300, function(hsb, hex) {
5247			var el = this.data('colorpicker').el;
5248			$(el).val('#' + hex);
5249			$(el).css('backgroundColor', '#' + hex);
5250			changeVariation('@' + $(el).attr('name'), $(el).val());
5251		}),
5252		onBeforeShow: function() {
5253			$(this).ColorPickerSetColor(this.value);
5254		}
5255	}).bind('keyup', $.debounce(300, function() {
5256		$(this).ColorPickerSetColor(this.value);
5257		if ($(this).val() == "") {
5258			$(this).css('background-color', '');
5259			returnDefault('@' + $(this).attr('name'));
5260		}
5261	}));
5262	$('.colorpicker_submit').click(function() {
5263		var btn = $(this);
5264		var tm;
5265		clearTimeout(tm);
5266		btn.button('loading');
5267		tm = setTimeout(function() {
5268			btn.button('reset');
5269		}, 1000);
5270	});
5271	$('#demotool_variation input.input-text').blur(function(e) {
5272		if ($(this).val() != "") {
5273			changeVariation('@' + $(this).attr('name'), $(this).val());
5274		}
5275	});
5276	$('#demotool_variation input.input-text').bind('keyup', function(e, hbs, hex) {
5277		if ($(this).val() == "") {
5278			returnDefault('@' + $(this).attr('name'));
5279		} else {
5280			if (e.keyCode == 13) {
5281				changeVariation('@' + $(this).attr('name'), $(this).val());
5282			}
5283		}
5284	});
5285	//box wide
5286	var mode = $('#em_box_wide').val();
5287	if (mode == 'box') {
5288		$('#emoption_wideslideshow').hide();
5289		$('#page_boxconfig').show();
5290		$('.wrapper').addClass('em-box-custom');
5291		$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5292		if ($('.em_area01').parent().is("div.container")) {
5293			$(".em_area01").unwrap("<div class='container'></div>");
5294		}
5295		$('.em_area02').removeClass('em-wide-custom');
5296	} else {
5297		$('.wrapper').removeClass('em-box-custom');
5298		$('#emoption_wideslideshow').show();
5299		$('#page_boxconfig').hide();
5300		if ($('#wide_full').is(':checked')) {
5301			$('.em_area02').parents('.menu_slideshow_container').removeClass('container').addClass('container-fluid');
5302			$(".em_area01").wrap("<div class='container'></div>");
5303			$('.em_area02').addClass('em-wide-custom');
5304		} else {
5305			$('.em_area02').parents('.menu_slideshow_container').removeClass('container-fluid').addClass('container');
5306			if ($('.em_area01').parent().is("div.container")) {
5307				$(".em_area01").unwrap("<div class='container'></div>");
5308			}
5309			$('.em_area02').removeClass('em-wide-custom');
5310		}
5311	}
5312});
5313// -----------------------------------------------------------------------------------
5314//
5315//	Lightbox v2.04
5316//	by Lokesh Dhakar - http://www.lokeshdhakar.com
5317//	Last Modification: 2/9/08
5318//
5319//	For more information, visit:
5320//	http://lokeshdhakar.com/projects/lightbox2/
5321//
5322//	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
5323//  	- Free for use in both personal and commercial projects
5324//		- Attribution requires leaving author name, author link, and the license info intact.
5325//	
5326//  Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
5327//  		Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
5328//
5329// -----------------------------------------------------------------------------------
5330/*
5331
5332    Table of Contents
5333    -----------------
5334    Configuration
5335
5336    Lightbox Class Declaration
5337    - initialize()
5338    - updateImageList()
5339    - start()
5340    - changeImage()
5341    - resizeImageContainer()
5342    - showImage()
5343    - updateDetails()
5344    - updateNav()
5345    - enableKeyboardNav()
5346    - disableKeyboardNav()
5347    - keyboardAction()
5348    - preloadNeighborImages()
5349    - end()
5350    
5351    Function Calls
5352    - document.observe()
5353   
5354*/
5355// -----------------------------------------------------------------------------------
5356
5357//
5358//  Configurationl
5359//
5360
5361// -----------------------------------------------------------------------------------
5362
5363var Lightbox = Class.create();
5364
5365Lightbox.prototype = {
5366    imageArray: [],
5367    activeImage: undefined,
5368    
5369    // initialize()
5370    // Constructor runs on completion of the DOM loading. Calls updateImageList and then
5371    // the function inserts html at the bottom of the page which is used to display the shadow 
5372    // overlay and the image container.
5373    //
5374    initialize: function() {    
5375        
5376        this.updateImageList();
5377        
5378        this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
5379
5380        if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
5381        if (LightboxOptions.resizeSpeed < 1)  LightboxOptions.resizeSpeed = 1;
5382
5383	    this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
5384	    this.overlayDuration = LightboxOptions.animate ? 0.2 : 0;  // shadow fade in/out duration
5385
5386        // When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
5387        // If animations are turned off, it will be hidden as to prevent a flicker of a
5388        // white 250 by 250 box.
5389        var size = (LightboxOptions.animate ? 250 : 1) + 'px';
5390        
5391
5392        // Code inserts html at the bottom of the page that looks similar to this:
5393        //
5394        //  <div id="overlay"></div>
5395        //  <div id="lightbox">
5396        //      <div id="outerImageContainer">
5397        //          <div id="imageContainer">
5398        //              <img id="lightboxImage">
5399        //              <div style="" id="hoverNav">
5400        //                  <a href="#" id="prevLink"></a>
5401        //                  <a href="#" id="nextLink"></a>
5402        //              </div>
5403        //              <div id="loading">
5404        //                  <a href="#" id="loadingLink">
5405        //                      <img src="images/loading.gif">
5406        //                  </a>
5407        //              </div>
5408        //          </div>
5409        //      </div>
5410        //      <div id="imageDataContainer">
5411        //          <div id="imageData">
5412        //              <div id="imageDetails">
5413        //                  <span id="caption"></span>
5414        //                  <span id="numberDisplay"></span>
5415        //              </div>
5416        //              <div id="bottomNav">
5417        //                  <a href="#" id="bottomNavClose">
5418        //                      <img src="images/close.gif">
5419        //                  </a>
5420        //              </div>
5421        //          </div>
5422        //      </div>
5423        //  </div>
5424
5425
5426        var objBody = $$('body')[0];
5427
5428		objBody.appendChild(Builder.node('div',{id:'overlay'}));
5429	
5430        objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
5431            Builder.node('div',{id:'outerImageContainer'}, 
5432                Builder.node('div',{id:'imageContainer'}, [
5433                    Builder.node('img',{id:'lightboxImage'}), 
5434                    Builder.node('div',{id:'hoverNav'}, [
5435                        Builder.node('a',{id:'prevLink', href: '#' }),
5436                        Builder.node('a',{id:'nextLink', href: '#' })
5437                    ]),
5438                    Builder.node('div',{id:'loading'}, 
5439                        Builder.node('a',{id:'loadingLink', href: '#' }, 
5440                            Builder.node('img', {src: LightboxOptions.fileLoadingImage})
5441                        )
5442                    )
5443                ])
5444            ),
5445            Builder.node('div', {id:'imageDataContainer'},
5446                Builder.node('div',{id:'imageData'}, [
5447                    Builder.node('div',{id:'imageDetails'}, [
5448                        Builder.node('span',{id:'caption'}),
5449                        Builder.node('span',{id:'numberDisplay'})
5450                    ]),
5451                    Builder.node('div',{id:'bottomNav'},
5452                        Builder.node('a',{id:'bottomNavClose', href: '#' },
5453                            Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
5454                        )
5455                    )
5456                ])
5457            )
5458        ]));
5459
5460
5461		$('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
5462		$('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
5463		$('outerImageContainer').setStyle({ width: size, height: size });
5464		$('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
5465		$('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
5466		$('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
5467		$('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
5468
5469        var th = this;
5470        (function(){
5471            var ids = 
5472                'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' + 
5473                'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';   
5474            $w(ids).each(function(id){ th[id] = $(id); });
5475        }).defer();
5476    },
5477
5478    //
5479    // updateImageList()
5480    // Loops through anchor tags looking for 'lightbox' references and applies onclick
5481    // events to appropriate links. You can rerun after dynamically adding images w/ajax.
5482    //
5483    updateImageList: function() {   
5484        this.updateImageList = Prototype.emptyFunction;
5485        
5486        document.observe('click', (function(event){
5487            var rightClick = 0;
5488            switch (event.which) {
5489                case 3:
5490                    rightClick = 1;
5491                    break;
5492                default:
5493                    rightClick = 0;
5494            }
5495            if(rightClick!=1){
5496                var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
5497                if (target && target.rel && target.rel.indexOf('lightbox') >= 0) {
5498                    if ( window.document.documentMode >= 9)
5499                        Event.stop(window.event);
5500                    else
5501                        event.stop();
5502                    this.start(target);
5503                }
5504            }
5505        }).bind(this));
5506    },
5507    
5508    //
5509    //  start()
5510    //  Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
5511    //
5512    start: function(imageLink) {    
5513
5514        $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
5515
5516        // stretch overlay to fill page and fade in
5517        var arrayPageSize = this.getPageSize();
5518        $('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
5519
5520        new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
5521
5522        this.imageArray = [];
5523        var imageNum = 0;       
5524
5525        if ((imageLink.rel == 'lightbox')){
5526            // if image is NOT part of a set, add single image to imageArray
5527            this.imageArray.push([imageLink.href, imageLink.title]);         
5528        } else {
5529            // if image is part of a set..
5530            this.imageArray = 
5531                $$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
5532                collect(function(anchor){ return [anchor.href, anchor.title]; }).
5533                uniq();
5534            
5535            while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
5536        }
5537
5538        // calculate top and left offset for the lightbox 
5539        var arrayPageScroll = document.viewport.getScrollOffsets();
5540        var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
5541        var lightboxLeft = arrayPageScroll[0];
5542        this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
5543        
5544        this.changeImage(imageNum);
5545    },
5546
5547    //
5548    //  changeImage()
5549    //  Hide most elements and preload image in preparation for resizing image container.
5550    //
5551    changeImage: function(imageNum) {   
5552        
5553        this.activeImage = imageNum; // update global var
5554
5555        // hide elements during transition
5556        if (LightboxOptions.animate) this.loading.show();
5557        this.lightboxImage.hide();
5558        this.hoverNav.hide();
5559        this.prevLink.hide();
5560        this.nextLink.hide();
5561		// HACK: Opera9 does not currently support scriptaculous opacity and appear fx
5562        this.imageDataContainer.setStyle({opacity: .0001});
5563        this.numberDisplay.hide();      
5564        
5565        var imgPreloader = new Image();
5566        
5567        // once image is preloaded, resize image container
5568
5569
5570        imgPreloader.onload = (function(){
5571            this.lightboxImage.src = this.imageArray[this.activeImage][0];
5572            this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
5573        }).bind(this);
5574        imgPreloader.src = this.imageArray[this.activeImage][0];
5575    },
5576
5577    //
5578    //  resizeImageContainer()
5579    //
5580    resizeImageContainer: function(imgWidth, imgHeight) {
5581
5582        // get current width and height
5583        var widthCurrent  = this.outerImageContainer.getWidth();
5584        var heightCurrent = this.outerImageContainer.getHeight();
5585
5586        // get new width and height
5587        var widthNew  = (imgWidth  + LightboxOptions.borderSize * 2);
5588        var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
5589
5590        // scalars based on change from old to new
5591        var xScale = (widthNew  / widthCurrent)  * 100;
5592        var yScale = (heightNew / heightCurrent) * 100;
5593
5594        // calculate size difference between new and old image, and resize if necessary
5595        var wDiff = widthCurrent - widthNew;
5596        var hDiff = heightCurrent - heightNew;
5597
5598        if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'}); 
5599        if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration}); 
5600
5601        // if new and old image are same size and no scaling transition is necessary, 
5602        // do a quick pause to prevent image flicker.
5603        var timeout = 0;
5604        if ((hDiff == 0) && (wDiff == 0)){
5605            timeout = 100;
5606            if (Prototype.Browser.IE) timeout = 250;   
5607        }
5608
5609        (function(){
5610            this.prevLink.setStyle({ height: imgHeight + 'px' });
5611            this.nextLink.setStyle({ height: imgHeight + 'px' });
5612            this.imageDataContainer.setStyle({ width: widthNew + 'px' });
5613
5614            this.showImage();
5615        }).bind(this).delay(timeout / 1000);
5616    },
5617    
5618    //
5619    //  showImage()
5620    //  Display image and begin preloading neighbors.
5621    //
5622    showImage: function(){
5623        this.loading.hide();
5624        new Effect.Appear(this.lightboxImage, { 
5625            duration: this.resizeDuration, 
5626            queue: 'end', 
5627            afterFinish: (function(){ this.updateDetails(); }).bind(this) 
5628        });
5629        this.preloadNeighborImages();
5630    },
5631
5632    //
5633    //  updateDetails()
5634    //  Display caption, image number, and bottom nav.
5635    //
5636    updateDetails: function() {
5637    
5638        // if caption is not null
5639        if (this.imageArray[this.activeImage][1] != ""){
5640            this.caption.update(this.imageArray[this.activeImage][1]).show();
5641        }
5642        
5643        // if image is part of set display 'Image x of x' 
5644        if (this.imageArray.length > 1){
5645            this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + '  ' + this.imageArray.length).show();
5646        }
5647
5648        new Effect.Parallel(
5649            [ 
5650                new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }), 
5651                new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration }) 
5652            ], 
5653            { 
5654                duration: this.resizeDuration, 
5655                afterFinish: (function() {
5656	                // update overlay size and update nav
5657	                var arrayPageSize = this.getPageSize();
5658	                this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
5659	                this.updateNav();
5660                }).bind(this)
5661            } 
5662        );
5663    },
5664
5665    //
5666    //  updateNav()
5667    //  Display appropriate previous and next hover navigation.
5668    //
5669    updateNav: function() {
5670
5671        this.hoverNav.show();               
5672
5673        // if not first image in set, display prev image button
5674        if (this.activeImage > 0) this.prevLink.show();
5675
5676        // if not last image in set, display next image button
5677        if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
5678        
5679        this.enableKeyboardNav();
5680    },
5681
5682    //
5683    //  enableKeyboardNav()
5684    //
5685    enableKeyboardNav: function() {
5686        document.observe('keydown', this.keyboardAction); 
5687    },
5688
5689    //
5690    //  disableKeyboardNav()
5691    //
5692    disableKeyboardNav: function() {
5693        document.stopObserving('keydown', this.keyboardAction); 
5694    },
5695
5696    //
5697    //  keyboardAction()
5698    //
5699    keyboardAction: function(event) {
5700        var keycode = event.keyCode;
5701
5702        var escapeKey;
5703        if (event.DOM_VK_ESCAPE) {  // mozilla
5704            escapeKey = event.DOM_VK_ESCAPE;
5705        } else { // ie
5706            escapeKey = 27;
5707        }
5708
5709        var key = String.fromCharCode(keycode).toLowerCase();
5710        
5711        if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
5712            this.end();
5713        } else if ((key == 'p') || (keycode == 37)){ // display previous image
5714            if (this.activeImage != 0){
5715                this.disableKeyboardNav();
5716                this.changeImage(this.activeImage - 1);
5717            }
5718        } else if ((key == 'n') || (keycode == 39)){ // display next image
5719            if (this.activeImage != (this.imageArray.length - 1)){
5720                this.disableKeyboardNav();
5721                this.changeImage(this.activeImage + 1);
5722            }
5723        }
5724    },
5725
5726    //
5727    //  preloadNeighborImages()
5728    //  Preload previous and next images.
5729    //
5730    preloadNeighborImages: function(){
5731        var preloadNextImage, preloadPrevImage;
5732        if (this.imageArray.length > this.activeImage + 1){
5733            preloadNextImage = new Image();
5734            preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
5735        }
5736        if (this.activeImage > 0){
5737            preloadPrevImage = new Image();
5738            preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
5739        }
5740    
5741    },
5742
5743    //
5744    //  end()
5745    //
5746    end: function() {
5747        this.disableKeyboardNav();
5748        this.lightbox.hide();
5749        new Effect.Fade(this.overlay, { duration: this.overlayDuration });
5750        $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
5751    },
5752
5753    //
5754    //  getPageSize()
5755    //
5756    getPageSize: function() {
5757	        
5758	     var xScroll, yScroll;
5759		
5760		if (window.innerHeight && window.scrollMaxY) {	
5761			xScroll = window.innerWidth + window.scrollMaxX;
5762			yScroll = window.innerHeight + window.scrollMaxY;
5763		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
5764			xScroll = document.body.scrollWidth;
5765			yScroll = document.body.scrollHeight;
5766		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
5767			xScroll = document.body.offsetWidth;
5768			yScroll = document.body.offsetHeight + 100;	// fix for quickshop extension in ie
5769		}
5770		
5771		var windowWidth, windowHeight;
5772		
5773		if (self.innerHeight) {	// all except Explorer
5774			if(document.documentElement.clientWidth){
5775				windowWidth = document.documentElement.clientWidth; 
5776			} else {
5777				windowWidth = self.innerWidth;
5778			}
5779			windowHeight = self.innerHeight;
5780		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
5781			windowWidth = document.documentElement.clientWidth;
5782			windowHeight = document.documentElement.clientHeight;
5783		} else if (document.body) { // other Explorers
5784			windowWidth = document.body.clientWidth;
5785			windowHeight = document.body.clientHeight;
5786		}	
5787		
5788		// for small pages with total height less then height of the viewport
5789		if(yScroll < windowHeight){
5790			pageHeight = windowHeight;
5791		} else { 
5792			pageHeight = yScroll;
5793		}
5794	
5795		// for small pages with total width less then width of the viewport
5796		if(xScroll < windowWidth){	
5797			pageWidth = xScroll;		
5798		} else {
5799			pageWidth = windowWidth;
5800		}
5801
5802		return [pageWidth,pageHeight];
5803	}
5804}
5805
5806document.observe('dom:loaded', function () { 
5807	if( !/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ) {
5808		lightbox = new Lightbox();
5809		// hide lightbox when orientation change
5810		//window.addEventListener('orientationchange', function(){ lightbox.end(); });
5811	}
5812});
5813(function($) {
5814	$.fn.selectUl = function() {
5815		var config = {
5816			over: function() {
5817				if ($(this).parent().children().length > 1) {
5818					$(this).parent().children('.toolbar-dropdown').children('ul').addClass('over');
5819				} else {
5820					$(this).addClass('over');
5821					// $('.toolbar-dropdown', this).css({width: $(this).width()+50});
5822				}
5823				$(this).parent().children('.toolbar-dropdown').children('ul').animate({
5824					opacity: 1,
5825					height: 'toggle'
5826				}, 100);
5827				//$('.toolbar-dropdown ul', this).animate({opacity:1, height:'toggle'}, 100);
5828			},
5829			timeout: 0,
5830			// number = milliseconds delay before onMouseOut
5831			out: function() {
5832				var that = this;
5833				$(this).parent().children('.toolbar-dropdown').children('ul').animate({
5834					opacity: 0,
5835					height: 'toggle'
5836				}, 100, function() {
5837					if ($(this).parent().children().length > 1) {
5838						$(that).parent().children('.toolbar-dropdown').children('ul').removeClass('over');
5839					} else {
5840						$(that).removeClass('over');
5841					}
5842				});
5843			}
5844		};
5845		$('.toolbar-title select').css('display', 'none');
5846		$('.toolbar-switch .toolbar-dropdown .current, .toolbar-switch .toolbar-dropdown').hoverIntent(config);
5847	};
5848	$.fn.insertUl = function() {
5849		var numOptions = $(this).children().length;
5850		$('<div class="toolbar-dropdown"><span class="current"/><ul style="display:none" /></div>').insertAfter($(this).toggleClass('.toolbar-switch').parent());
5851		var divSpan = $(this).toggleClass('toolbar-switch').parent().parent().find('span');
5852		divSpan.append($(this).parent().children('select').find('option:selected').text());
5853		var divUl = $(this).toggleClass('toolbar-switch').parent().parent().find('ul');
5854		for (var i = 0; i < numOptions; i++) {
5855			var text = '<li><a href ="' + $(this).find('option').eq(i).val() + '">' + $(this).find('option').eq(i).text() + '</a></li>';
5856			//$('<li />').text(text).appendTo(divUl);
5857			divUl.append(text);
5858		}
5859	};
5860	$.fn.insertUlLanguage = function() {
5861		var numOptions = $(this).children().length;
5862		$('<div class="toolbar-dropdown"><span class="current"/><ul style="display:none" /></div>').insertAfter($(this).toggleClass('.toolbar-switch').parent());
5863		var divSpan = $(this).toggleClass('toolbar-switch').parent().parent().find('span');
5864		divSpan.append($(this).parent().children('select').find('option:selected').text());
5865		imageUrl = language + ($(this).find('option').eq(i).text()).toLowerCase() + '.png';
5866		divSpan.css('background-image', 'url(' + language + ($(this).parent().children('select').find('option:selected').text()).toLowerCase() + '.png)');
5867		divSpan.css('background-repeat', 'no-repeat');
5868		var divUl = $(this).toggleClass('toolbar-switch').parent().parent().find('ul');
5869		for (var i = 0; i < numOptions; i++) {
5870			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>';
5871			divUl.append(text);
5872		}
5873	};
5874})(jQuery);
5875(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
5875ight"):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;
5875return(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);
5876function 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}
5876function 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)};
5877/**
5878 * Galathemes
5879 *
5880 * @license commercial software
5881 * @copyright (c) 2014 Codespot Software JSC - Galathemes.com. (http://www.galathemes.com)
5882 */
5883var timeout = null;
5884var touch = false;
5885var animate = false;
5886(function($) {
5887	if (typeof EM == 'undefined') EM = {};
5888	if (typeof EM.tools == 'undefined') EM.tools = {};
5889	var domLoaded = false;
5890	var windowLoaded = false;
5891	/**
5892	 *   Add class mobile
5893	 **/
5894
5895	function addClassMobile() {
5896		if (isMobile) {
5897			$('body').addClass('mobile-view');
5898		}
5899	};
5900	/**
5901	 * Fix iPhone/iPod auto zoom-in when text fields, select boxes are focus
5902	 */
5903
5904	function fixIPhoneAutoZoomWhenFocus() {
5905		var viewport = $('head meta[name=viewport]');
5906		if (viewport.length == 0) {
5907			$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1.0"/>');
5908			viewport = $('head meta[name=viewport]');
5909		}
5910		var old_content = viewport.attr('content');
5911
5912		function zoomDisable() {
5913			viewport.attr('content', old_content + ', user-scalable=0');
5914		}
5915
5916		function zoomEnable() {
5917			viewport.attr('content', old_content);
5918		}
5919		$("input[type=text], textarea, select").mouseover(zoomDisable).mousedown(zoomEnable);
5920	}; /* hover language currency */
5921
5922	function hoverUl() {
5923		if (!isMobile) {
5924			$('#select-language').each(function() {
5925				$(this).insertUlLanguage();
5926				$(this).selectUl();
5927			});
5928			$('.currency').each(function() {
5929				$(this).insertUl();
5930				$(this).selectUl();
5931			});
5932			$('#select-store').each(function() {
5933				$(this).insertUl();
5934				$(this).selectUl();
5935			});
5936		}
5937	}; /* Menu Left */
5938
5939	function doMenuLeft() {
5940		var wi = $(window).width();
5941		if (isHomePage == 1 || pos_menuleft == true) {
5942			$('.all_categories').attr('id', 'menuleftTextHomepage');
5943			$('#menu-default').css('display', 'block');
5944		} else {
5945			$('.all_categories').attr('id', 'menuleftText');
5946			$('#menu-default').css('display', 'none');
5947		}
5948		var container = $("#menu-default");
5949		if (disableResponsive != 1) {
5950			if ((!isPhone) && (wi > 767)) {
5951				$("#menuleftText,#menuleftTextHomepage").unbind("click");
5952				$(".menu-wrapper").unbind('hover');
5953				container.show();
5954				if (!($("body").hasClass("cms-index-index"))) {
5955					container.hide();
5956					$(".menu-wrapper").hover(
5957
5958					function() {
5959						container.fadeIn(500);
5960						$("#menuleftText").toggleClass('hidden-arrow');
5961						$("#menuleftText").attr('title', 'hide-option');
5962					}, function() {
5963						container.fadeOut(100);
5964						$("#menuleftText").removeClass('hidden-arrow');
5965						$("#menuleftText").attr('title', 'show-option');
5966					});
5967				}
5968			} else {
5969				$("#menu-default").css("display", "none");
5970				$(".menu-wrapper").unbind('hover');
5971				$("#menuleftText,#menuleftTextHomepage").unbind("click");
5972				$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
5973				$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
5974				$("#menuleftText,#menuleftTextHomepage").click(
5975
5976				function(event) {
5977					event.preventDefault();
5978					if (container.is(":visible")) {
5979						container.hide();
5980						$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
5981						$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
5982					} else {
5983						container.show();
5984						$("#menuleftText,#menuleftTextHomepage").toggleClass('hidden-arrow');
5985						$("#menuleftText,#menuleftTextHomepage").attr('title', 'hide-option');
5986					}
5987				});
5988			}
5989		} else {
5990            if(!isMobile){
5991    			$("#menuleftText,#menuleftTextHomepage").unbind("click");
5992    			$(".menu-wrapper").unbind('hover');
5993    			container.show();
5994    			if (!($("body").hasClass("cms-index-index"))) {
5995    				container.hide();
5996    				$(".menu-wrapper").hover(
5997    
5998    				function() {
5999    					container.fadeIn(500);
6000    					$("#menuleftText").toggleClass('hidden-arrow');
6001    					$("#menuleftText").attr('title', 'hide-option');
6002    				}, function() {
6003    					container.fadeOut(100);
6004    					$("#menuleftText").removeClass('hidden-arrow');
6005    					$("#menuleftText").attr('title', 'show-option');
6006    				});
6007    			}
6008            }else{
6009    			container.show();
6010    			if (!($("body").hasClass("cms-index-index"))) {
6011    				container.hide();
6012    				$("#menuleftText,#menuleftTextHomepage").click(
6013
6014    				function(event) {
6015    					event.preventDefault();
6016    					if (container.is(":visible")) {
6017    						container.hide();
6018    						$("#menuleftText,#menuleftTextHomepage").removeClass('hidden-arrow');
6019    						$("#menuleftText,#menuleftTextHomepage").attr('title', 'show-option');
6020    					} else {
6021    						container.show();
6022    						$("#menuleftText,#menuleftTextHomepage").toggleClass('hidden-arrow');
6023    						$("#menuleftText,#menuleftTextHomepage").attr('title', 'hide-option');
6024    					}
6025    				});
6026    			}
6027            }
6028		}
6029	};
6030
6031	function persistentMenu() {
6032		if (FREEZED_TOP_MENU != 0 && !isPhone) {
6033			var sticky_navigation = function() {
6034				var scroll_top = $(window).scrollTop();
6035				var navpos = $('#navpos').offset().top;
6036				if ($(window).width() > 767) {
6037					if (scroll_top > navpos) {
6038						$('.header-bottom-right').addClass('navbar-fixed-top');
6039					} else {
6040						$('.header-bottom-right').removeClass('navbar-fixed-top');
6041					}
6042				} else {
6043					$('.header-bottom-right').removeClass('navbar-fixed-top');
6044				}
6045			};
6046			$(window).scroll(function() {
6047				sticky_navigation();
6048			});
6049		}
6050		if ($(window).width() <= 767) {
6051			$('.header-bottom-right').removeClass('navbar-fixed-top');
6052		}
6053	};
6054    
6055    function freezedMenuNoResponsive(){
6056        if (FREEZED_TOP_MENU != 0 && !isPhone) {
6057			var sticky_navigation = function() {
6058				var scroll_top = $(window).scrollTop();
6059				var navpos = $('#navpos').offset().top;
6060				if (scroll_top > navpos) {
6061					$('.header-bottom-right').addClass('navbar-fixed-top');
6062				} else {
6063					$('.header-bottom-right').removeClass('navbar-fixed-top');
6064				}
6065			};
6066			$(window).scroll(function() {
6067				sticky_navigation();
6068			});
6069		}
6070		if (isMobile) {
6071			$('.header-bottom-right').removeClass('navbar-fixed-top');
6072		}
6073    };
6074	// Back to top
6075
6076	function backToTop() {
6077		// hide #back-top first
6078		$("#back-top").hide();
6079		// fade in #back-top
6080		if (!isMobile) {
6081			$(window).scroll(function() {
6082				if ($(this).scrollTop() > 100) {
6083					$('#back-top').fadeIn();
6084				} else {
6085					$('#back-top').fadeOut();
6086				}
6087			});
6088			// scroll body to 0px on click
6089			$('#back-top a').click(function() {
6090				$('body,html').animate({
6091					scrollTop: 0
6092				}, 800);
6093				return false;
6094			});
6095		}
6096	};
6097	
6098/**
6099	 Tab On Details Page
6100	 */
6101
6102	function decorateProductCollateralTabs() {
6103		if ($('.box-collateral').length > 1) {
6104			$('.product-collateral').each(function(i) {
6105				$(this).wrap('<div class="tabs_wrapper_detail collateral_wrapper" />');
6106				$(this).prepend('<ul class="tabs_control"></ul>');
6107				$(this).children(".product-collateral-item").addClass("ui-slider-tabs-content-container");
6108				$('.box-collateral', this).addClass('tab-item').each(function(j) {
6109					var id = 'box_collateral_' + i + '_' + j;
6110					$(this).addClass('content_' + id);
6111					$(this).attr('id', id);
6112					$('.tabs_wrapper_detail ul.tabs_control').append('<li><a href="#' + id + '">' + $('h2', this).html() + '</a></li>');
6113				});
6114				$("div.tabs_wrapper_detail .product-collateral").sliderTabs();
6115			});
6116		}
6117	};
6118
6119/**
6120 *   showReviewTab
6121	 **/
6122
6123	function showReviewList() {
6124		if (jQuery('#customer_review_list').size()) {
6125			// scroll to customer review
6126			jQuery('html, body').animate({
6127				scrollTop: jQuery('#customer_review_list').offset().top
6128			}, 500);
6129		} else {
6130			return false;
6131		}
6132		return true;
6133	};
6134
6135	function showReviewForm() {
6136		if (jQuery('#customer_review_form').size()) {
6137			// scroll to customer review
6138			jQuery('html, body').animate({
6139				scrollTop: jQuery('#customer_review_form').offset().top
6140			}, 500);
6141		} else {
6142			return false;
6143		}
6144		return true;
6145	};
6146
6147	function setupReviewLink() {
6148		jQuery('.product-view .product-essential .link_review_list').click(function(e) {
6149			if (showReviewList()) {
6150				e.preventDefault();
6151			}
6152		});
6153		jQuery('.product-view .product-essential .link_review_form').click(function(e) {
6154			if (showReviewForm()) {
6155				e.preventDefault();
6156			}
6157		});
6158	};
6159	/**
6160	 Do Slider
6161	 */
6162
6163	function doSlider($e, $move, $circular, $direction) {
6164		if ($($e + ' ul > li').size() > 1) {
6165			$($e + ' > ul').addClass('slides');
6166			$($e).csslider({
6167				move: $move,
6168				circular: $circular,
6169				direction: $direction,
6170				parentHidden: 'div.slider'
6171			});
6172		}
6173	}; /* Store Switcher */
6174
6175	function toogleStore() {
6176		if (!isMobile) {
6177			doSlider('#slider_storeview', 1, 0, 'horizontal');
6178			$('.storediv').hide();
6179			$(".btn_storeview").click(function() {
6180				store_show();
6181			});
6182			$(".btn_storeclose").click(function() {
6183				store_hide();
6184			});
6185
6186			function store_show() {
6187				var bg = $("#bg_fade_color");
6188				bg.css("opacity", 0.5);
6189				bg.css("display", "block");
6190				var top = ($(window).height() - $(".storediv").height()) / 2;
6191				var left = ($(window).width() - $(".storediv").width()) / 2;
6192				$(".storediv").show();
6193				$(".storediv").css('top', top + 'px');
6194				$(".storediv").css('left', left + 'px');
6195			};
6196
6197			function store_hide() {
6198				var bg = $("#bg_fade_color");
6199				$(".storediv").hide();
6200				bg.css("opacity", 0);
6201				bg.css("display", "none");
6202			};
6203		}
6204	};
6205
6206	function qrCode() {
6207		$('#qr_code .qr_code_name a').mouseover(function(e) {
6208			var $img = $('img', this);
6209			$img.css({
6210				'display': 'block'
6211			}).attr('src', $img.data('originalImg'));
6212			var parent = $img.offsetParent().offset();
6213			//var left = e.pageX - parent.left + 15;
6214			var top = e.pageY - parent.top + 15;
6215			if ((parent.top + top + $img.height()) > ($(document).scrollTop() + $(window).height())) top = $(document).scrollTop() + $(window).height() - $img.height() - parent.top;
6216			if ((parent.top + top) < $(document).scrollTop()) top = $(document).scrollTop() - parent.top;
6217			$img.css({
6218				'left': 48 + 'px',
6219				'position': 'absolute',
6220				'top': 0 + 'px',
6221				'width': 'auto',
6222				'height': 'auto'
6223			}).attr('src', $img.data('originalImg'));
6224		});
6225		$('#qr_code .qr_code_name a').mouseout(function(e) {
6226			var $img = $('img', this);
6227			$img.css({
6228				'display': 'none'
6229			}).attr('src', $img.data('originalImg'));
6230		});
6231	};
6232	/**
6233	 * Adjust elements to make it responsive
6234	 */
6235
6236	function responsive() {
6237		var position = $('.products-grid .item').css('position');
6238		if (position != 'absolute' && position != 'fixed' && position != 'relative') $('.products-grid .item').css('position', 'relative');
6239	};
6240	/**
6241	 *   Toogle Footer Information Mobile View
6242	 **/
6243
6244	function toogleFooter() {
6245		var wi = $(window).width();
6246		if (isPhone || (wi <= 767)) {
6247			$('.link_content > div > .content_links').css('display', 'none');
6248			$('.link_content > div > p.h5').addClass('toogle-icon');
6249			$('.link_content > div > p.h5').unbind('click');
6250			$('.link_content > div > p.h5').removeClass('active');
6251			$('.link_content > div > p.h5').on('click', function() {
6252				$(this).toggleClass("active").parent().find(".content_links").slideToggle();
6253			});
6254		} else {
6255			$('.link_content > div > p.h5').unbind('click');
6256			$('.link_content > div > p.h5').removeClass('toogle-icon');
6257			$('.link_content > div > p.h5').removeClass('active');
6258			$('.link_content > div > .content_links').css('display', 'block');
6259		}
6260	};
6261
6262	function buildBootrapJs() {
6263		$('.link_connect a.icon').tooltip();
6264		$('.reset-button').click(function() {
6265			var btn = $(this);
6266			btn.button('loading');
6267			var tm;
6268			clearTimeout(tm);
6269			tm = setTimeout(function() {
6270				btn.button('reset');
6271			}, 1000);
6272		});
6273	};
6274
6275	function dataAnimate() {
6276		if ($('[data-animate]')) {
6277			$('[data-animate]').each(function() {
6278				var $toAnimateElement = $(this);
6279				var toAnimateDelay = $(this).attr('data-delay');
6280				var toAnimateDelayTime = 0;
6281				if (toAnimateDelay) {
6282					toAnimateDelayTime = Number(toAnimateDelay);
6283				} else {
6284					toAnimateDelayTime = 200;
6285				}
6286				if (!$toAnimateElement.hasClass('animated')) { /*$toAnimateElement.addClass('not-animated');*/
6287					var elementAnimation = $toAnimateElement.attr('data-animate');
6288					setTimeout(function() {
6289						$toAnimateElement.waypoint({
6290							handler: function() {
6291								$toAnimateElement.removeClass('not-animated').addClass(elementAnimation + ' animated');
6292                                /*
6293                                $toAnimateElement.removeClass('not-animated').addClass(elementAnimation + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
6294                                    $(this).removeClass(elementAnimation + ' animated').addClass('not-animated');
6295                                });*/
6296							},
6297							offset: '100%',
6298							triggerOnce: false
6299						});
6300					}, toAnimateDelayTime);
6301				}
6302				if ($toAnimateElement.hasClass('not-animated')) animate = false;
6303			});
6304		}
6305	};
6306
6307	function ieVersion() {
6308		var rv = -1; // Return value assumes failure.
6309		if (navigator.appName == 'Microsoft Internet Explorer') {
6310			var ua = navigator.userAgent;
6311			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
6312			if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
6313		}
6314		return rv;
6315	};
6316
6317	function doAnimate() { /* DETECT PLATFORM */
6318		$.support.touch = 'ontouchend' in document;
6319		if ($.support.touch) {
6320			touch = true;
6321			$('body').addClass('touch');
6322		} else {
6323			$('body').addClass('notouch');
6324		}
6325		if (touch == false && ANIMATION_LOADING == 0) {
6326			if (ieVersion() == -1 || ieVersion() > 9) $('[data-animate]').addClass('not-animated');
6327		}
6328	};
6329
6330	function setAnimate() {
6331		$('.header-top').children('div').each(function() {
6332			$(this).children('div').each(function() {
6333				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_header);
6334			});
6335		});
6336		$('.em_col_left').children('div').each(function() {
6337			$(this).children('div').each(function() {
6338				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_left);
6339			});
6340		});
6341		$('.em_col_right').children('div').each(function() {
6342			$(this).children('div').each(function() {
6343				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_right);
6344			});
6345		});
6346		$('.em_col_main, .em_area03').children('div').each(function() {
6347			$(this).children('div').each(function() {
6348				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_main);
6349			});
6350		});
6351		$('.em_area04, .em_area05, .inner_footer, #footer-information').children('div').each(function() {
6352			$(this).children('div').each(function() {
6353				if (!$(this).hasClass('clear') && !$(this).hasClass('bkg-hover')) $(this).attr('data-animate', animate_footer);
6354			});
6355		});
6356	};
6357
6358	function fixClickMobile() {
6359		var currentName;
6360		if (isMobile) {
6361			$('.products-grid li.item a').each(function() {
6362				$(this).bind('click', function(event) {
6363					if (currentName != this) {
6364						event.preventDefault();
6365						// next time click this element will open link
6366						currentName = this;
6367					}
6368				});
6369			});
6370		}
6371	};
6372
6373	function colorVariation() {
6374		var screen = "<div id='bg_fade_color'></div>";
6375		$(document.body).append(screen);
6376		$("#bg_fade_color").css("opacity", 0);
6377		$("#bg_fade_color").css("display", "none");
6378		$(".btn_color_variation").click(function() {
6379			var bg = $("#bg_fade_color");
6380			bg.css("opacity", 0.5);
6381			bg.css("display", "block");
6382			var left = ($(window).width() - $(".colordiv").width()) / 2;
6383			$(".colordiv").show();
6384			$(".colordiv").css('top', Math.max($(document).scrollTop(), Math.min($(this).offset().top, $(document).scrollTop() + $(window).height() - $(".colordiv").outerHeight())) + 20 + 'px');
6385			$(".colordiv").css('left', left);
6386		});
6387		$(".btn_color_close").click(function() {
6388			color_hide();
6389		});
6390
6391		function color_hide() {
6392			var bg = $("#bg_fade_color");
6393			$(".colordiv").hide();
6394			bg.css("opacity", 0);
6395			bg.css("display", "none");
6396		}
6397	};
6398	/**
6399	 Ready Function
6400	 */
6401	$(document).ready(function() {
6402		domLoaded = true;
6403		setAnimate();
6404		addClassMobile();
6405		if (disableVariation != 1) {
6406			colorVariation();
6407			qrCode();
6408			toogleStore();
6409		}
6410		// safari hack: remove bold in h5, .h5
6411		if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
6412			$('h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6').css('font-weight', 'normal');
6413		}
6414        if (disableResponsive != 1) {
6415            isMobile && fixIPhoneAutoZoomWhenFocus();
6416        }else{
6417            freezedMenuNoResponsive();
6418        }
6419		hoverUl();
6420		toolbarCategoty();
6421		backToTop();
6422		doMenuLeft();
6423		//hoverTopCart();
6424		alternativeProductImage();
6425		if (useTab) {
6426			decorateProductCollateralTabs();
6427		}
6428		setupReviewLink();
6429		doSlider('#upsell-product-table', 1, 0, 'horizontal');
6430		doSlider('#slider_crosell', 1, 0, 'horizontal');
6431		doSlider('#slider_moreview', 1, 0, 'horizontal');
6432		doSlider('#slider_related', 1, 0, 'horizontal');
6433		responsive();
6434		buildBootrapJs();
6435		doAnimate();
6436		//fixClickMobile();
6437		setupReviewLink();
6438        if (disableResponsive != 1) {
6439			toogleFooter();
6440		}
6441	});
6442	/**
6443	 Load Function
6444	 */
6445	$(window).bind('load', function() {
6446		windowLoaded = true;
6447		$.support.touch = 'ontouchend' in document;
6448		if ($.support.touch) {
6449			touch = true;
6450			$('body').addClass('touch');
6451		} else {
6452			$('body').addClass('notouch');
6453		}
6454		if (touch == false && ANIMATION_LOADING == 0) {
6455			if (ieVersion() == -1 || ieVersion() > 9) {
6456				dataAnimate();
6457			}
6458		}
6459        if (ieVersion() != -1 || ieVersion() < 9){
6460            setTimeout(function() {                
6461				if (typeof em_slider !== 'undefined') {
6462					em_slider.reinit();
6463				}
6464            },8000);
6465        }
6466        setHeightItem('.em_col_main ul.products-grid');
6467	});
6468	var tmresize;
6469	$(window).resize(function() {
6470		if (disableResponsive != 1) {
6471			clearTimeout(tmresize);
6472			tmresize = setTimeout(function() {
6473                setHeightItem('.em_col_main ul.products-grid');
6474				doMenuLeft();
6475				persistentMenu();
6476				toogleFooter();
6477				if (typeof em_slider !== 'undefined') {
6478					em_slider.reinit();
6479				}
6480			}, 300);
6481			if (touch == false && ANIMATION_LOADING == 0) {
6482				if (ieVersion() == -1 || ieVersion() > 9) dataAnimate();
6483			}
6484		}
6485	});
6486	$(window).bind('orientationchange', function() {
6487		if (disableResponsive != 1) {
6488			toogleFooter();
6489		}
6490	});
6491})(jQuery);
6492/**
6493 * Change the alternative product image when hover
6494 */
6495
6496function alternativeProductImage() {
6497	var $ = jQuery;
6498	var tm;
6499
6500	function swap() {
6501		clearTimeout(tm);
6502		tm = setTimeout(function() {
6503			el = $(this).find('img[data-alt-src]');
6504			var newImg = $(el).data('alt-src');
6505			var oldImg = $(el).attr('src');
6506			$(el).attr('src', newImg).data('alt-src', oldImg);
6507		}.bind(this), 200);
6508	}
6509	$('.item .product-image img[data-alt-src]').parents('.item').bind('mouseenter', swap).bind('mouseleave', swap);
6510};
6511
6512function toolbarCategoty() {
6513	var $ = jQuery;
6514	if (!isMobile) {
6515		$('.toolbar-show').each(function() {
6516			$(this).insertUl();
6517			$(this).selectUl();
6518		});
6519		$('.sortby').each(function() {
6520			$(this).insertUl();
6521			$(this).selectUl();
6522		});
6523	}
6524};
6525/**
6526 *   After Layer Update
6527 **/
6528window.afterLayerUpdate = function() {
6529	var $ = jQuery;
6530    setHeightItem('.em_col_main ul.products-grid');
6531	toolbarCategoty();
6532	alternativeProductImage();
6533	if ((typeof EM_QUICKSHOP_DISABLED == 'undefined' || !EM_QUICKSHOP_DISABLED) && !isMobile) {
6534		qs({
6535			itemClass: '.products-grid li.item, .products-list li.item',
6536			//selector for each items in catalog product list,use to insert quickshop image
6537			aClass: 'a.product-image',
6538			//selector for each a tag in product items,give us href for one product
6539			imgClass: '.product-image > img' //class for quickshop href
6540		});
6541	}
6542};
6543
6544function hideAgreementPopup(e) {
6545	jQuery('#checkout-agreements .agreement-content').hide();
6546};
6547
6548function showAgreementPopup(e) {
6549	jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').show().css({
6550		'left': (parseInt(document.viewport.getWidth()) - jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').width()) / 2 + 'px',
6551		'top': (parseInt(document.viewport.getHeight()) - jQuery('#checkout-agreements label.a-click').parent().parent().children('.agreement-content').height()) / 2 + 'px'
6552	});
6553};
6554
6555function setHeightItem(e){
6556    var $=jQuery;
6557    if($(e).length){        
6558        $(e).each(function(){
6559            var maxHeight = 0;
6560            $(this).children('li.item').each(function(){
6561                $(this).removeAttr('height');
6562                if(maxHeight<$(this).outerHeight()){
6563                    maxHeight = $(this).outerHeight(); 
6564                }
6565            });
6566            $(this).children('li.item').each(function(){
6567                $(this).removeAttr('height');
6568                $(this).css('height',maxHeight+'px');
6569            });
6570        });    
6571    }
6572};
6573
6574/**
6575 * Isotope v1.5.25
6576 * An exquisite jQuery plugin for magical layouts
6577 * http://isotope.metafizzy.co
6578 *
6579 * Commercial use requires one-time license fee
6580 * http://metafizzy.co/#licenses
6581 *
6582 * Copyright 2012 David DeSandro / Metafizzy
6583 */
6584
6585/*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true */
6586/*global jQuery: false */
6587jQuery.noConflict();
6588(function( window, $, undefined ){
6589
6590  'use strict';
6591
6592  // get global vars
6593  var document = window.document;
6594  var Modernizr = window.Modernizr;
6595
6596  // helper function
6597  var capitalize = function( str ) {
6598    return str.charAt(0).toUpperCase() + str.slice(1);
6599  };
6600
6601  // ========================= getStyleProperty by kangax ===============================
6602  // http://perfectionkills.com/feature-testing-css-properties/
6603
6604  var prefixes = 'Moz Webkit O Ms'.split(' ');
6605
6606  var getStyleProperty = function( propName ) {
6607    var style = document.documentElement.style,
6608        prefixed;
6609
6610    // test standard property first
6611    if ( typeof style[propName] === 'string' ) {
6612      return propName;
6613    }
6614
6615    // capitalize
6616    propName = capitalize( propName );
6617
6618    // test vendor specific properties
6619    for ( var i=0, len = prefixes.length; i < len; i++ ) {
6620      prefixed = prefixes[i] + propName;
6621      if ( typeof style[ prefixed ] === 'string' ) {
6622        return prefixed;
6623      }
6624    }
6625  };
6626
6627  var transformProp = getStyleProperty('transform'),
6628      transitionProp = getStyleProperty('transitionProperty');
6629
6630
6631  // ========================= miniModernizr ===============================
6632  // <3<3<3 and thanks to Faruk and Paul for doing the heavy lifting
6633
6634  /*!
6635   * Modernizr v1.6ish: miniModernizr for Isotope
6636   * http://www.modernizr.com
6637   *
6638   * Developed by:
6639   * - Faruk Ates  http://farukat.es/
6640   * - Paul Irish  http://paulirish.com/
6641   *
6642   * Copyright (c) 2009-2010
6643   * Dual-licensed under the BSD or MIT licenses.
6644   * http://www.modernizr.com/license/
6645   */
6646
6647  /*
6648   * This version whittles down the script just to check support for
6649   * CSS transitions, transforms, and 3D transforms.
6650  */
6651
6652  var tests = {
6653    csstransforms: function() {
6654      return !!transformProp;
6655    },
6656
6657    csstransforms3d: function() {
6658      var test = !!getStyleProperty('perspective');
6659      // double check for Chrome's false positive
6660      if ( test ) {
6661        var vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
6662            mediaQuery = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)',
6663            $style = $('<style>' + mediaQuery + '{#modernizr{height:3px}}' + '</style>')
6664                        .appendTo('head'),
6665            $div = $('<div id="modernizr" />').appendTo('html');
6666
6667        test = $div.height() === 3;
6668
6669        $div.remove();
6670        $style.remove();
6671      }
6672      return test;
6673    },
6674
6675    csstransitions: function() {
6676      return !!transitionProp;
6677    }
6678  };
6679
6680  var testName;
6681
6682  if ( Modernizr ) {
6683    // if there's a previous Modernzir, check if there are necessary tests
6684    for ( testName in tests) {
6685      if ( !Modernizr.hasOwnProperty( testName ) ) {
6686        // if test hasn't been run, use addTest to run it
6687        Modernizr.addTest( testName, tests[ testName ] );
6688      }
6689    }
6690  } else {
6691    // or create new mini Modernizr that just has the 3 tests
6692    Modernizr = window.Modernizr = {
6693      _version : '1.6ish: miniModernizr for Isotope'
6694    };
6695
6696    var classes = ' ';
6697    var result;
6698
6699    // Run through tests
6700    for ( testName in tests) {
6701      result = tests[ testName ]();
6702      Modernizr[ testName ] = result;
6703      classes += ' ' + ( result ?  '' : 'no-' ) + testName;
6704    }
6705
6706    // Add the new classes to the <html> element.
6707    $('html').addClass( classes );
6708  }
6709
6710
6711  // ========================= isoTransform ===============================
6712
6713  /**
6714   *  provides hooks for .css({ scale: value, translate: [x, y] })
6715   *  Progressively enhanced CSS transforms
6716   *  Uses hardware accelerated 3D transforms for Safari
6717   *  or falls back to 2D transforms.
6718   */
6719
6720  if ( Modernizr.csstransforms ) {
6721
6722        // i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)'
6723    var transformFnNotations = Modernizr.csstransforms3d ?
6724      { // 3D transform functions
6725        translate : function ( position ) {
6726          return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) ';
6727        },
6728        scale : function ( scale ) {
6729          return 'scale3d(' + scale + ', ' + scale + ', 1) ';
6730        }
6731      } :
6732      { // 2D transform functions
6733        translate : function ( position ) {
6734          return 'translate(' + position[0] + 'px, ' + position[1] + 'px) ';
6735        },
6736        scale : function ( scale ) {
6737          return 'scale(' + scale + ') ';
6738        }
6739      }
6740    ;
6741
6742    var setIsoTransform = function ( elem, name, value ) {
6743          // unpack current transform data
6744      var data =  $.data( elem, 'isoTransform' ) || {},
6745          newData = {},
6746          fnName,
6747          transformObj = {},
6748          transformValue;
6749
6750      // i.e. newData.scale = 0.5
6751      newData[ name ] = value;
6752      // extend new value over current data
6753      $.extend( data, newData );
6754
6755      for ( fnName in data ) {
6756        transformValue = data[ fnName ];
6757        transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue );
6758      }
6759
6760      // get proper order
6761      // ideally, we could loop through this give an array, but since we only have
6762      // a couple transforms we're keeping track of, we'll do it like so
6763      var translateFn = transformObj.translate || '',
6764          scaleFn = transformObj.scale || '',
6765          // sorting so translate always comes first
6766          valueFns = translateFn + scaleFn;
6767
6768      // set data back in elem
6769      $.data( elem, 'isoTransform', data );
6770
6771      // set name to vendor specific property
6772      elem.style[ transformProp ] = valueFns;
6773    };
6774
6775    // ==================== scale ===================
6776
6777    $.cssNumber.scale = true;
6778
6779    $.cssHooks.scale = {
6780      set: function( elem, value ) {
6781        // uncomment this bit if you want to properly parse strings
6782        // if ( typeof value === 'string' ) {
6783        //   value = parseFloat( value );
6784        // }
6785        setIsoTransform( elem, 'scale', value );
6786      },
6787      get: function( elem, computed ) {
6788        var transform = $.data( elem, 'isoTransform' );
6789        return transform && transform.scale ? transform.scale : 1;
6790      }
6791    };
6792
6793    $.fx.step.scale = function( fx ) {
6794      $.cssHooks.scale.set( fx.elem, fx.now+fx.unit );
6795    };
6796
6797
6798    // ==================== translate ===================
6799
6800    $.cssNumber.translate = true;
6801
6802    $.cssHooks.translate = {
6803      set: function( elem, value ) {
6804
6805        // uncomment this bit if you want to properly parse strings
6806        // if ( typeof value === 'string' ) {
6807        //   value = value.split(' ');
6808        // }
6809        //
6810        // var i, val;
6811        // for ( i = 0; i < 2; i++ ) {
6812        //   val = value[i];
6813        //   if ( typeof val === 'string' ) {
6814        //     val = parseInt( val );
6815        //   }
6816        // }
6817
6818        setIsoTransform( elem, 'translate', value );
6819      },
6820
6821      get: function( elem, computed ) {
6822        var transform = $.data( elem, 'isoTransform' );
6823        return transform && transform.translate ? transform.translate : [ 0, 0 ];
6824      }
6825    };
6826
6827  }
6828
6829  // ========================= get transition-end event ===============================
6830  var transitionEndEvent, transitionDurProp;
6831
6832  if ( Modernizr.csstransitions ) {
6833    transitionEndEvent = {
6834      WebkitTransitionProperty: 'webkitTransitionEnd',  // webkit
6835      MozTransitionProperty: 'transitionend',
6836      OTransitionProperty: 'oTransitionEnd otransitionend',
6837      transitionProperty: 'transitionend'
6838    }[ transitionProp ];
6839
6840    transitionDurProp = getStyleProperty('transitionDuration');
6841  }
6842
6843  // ========================= smartresize ===============================
6844
6845  /*
6846   * smartresize: debounced resize event for jQuery
6847   *
6848   * latest version and complete README available on Github:
6849   * https://github.com/louisremi/jquery.smartresize.js
6850   *
6851   * Copyright 2011 @louis_remi
6852   * Licensed under the MIT license.
6853   */
6854
6855  var $event = $.event,
6856      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
6857      resizeTimeout;
6858
6859  $event.special.smartresize = {
6860    setup: function() {
6861      $(this).bind( "resize", $event.special.smartresize.handler );
6862    },
6863    teardown: function() {
6864      $(this).unbind( "resize", $event.special.smartresize.handler );
6865    },
6866    handler: function( event, execAsap ) {
6867      // Save the context
6868      var context = this,
6869          args = arguments;
6870
6871      // set correct event type
6872      event.type = "smartresize";
6873
6874      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
6875      resizeTimeout = setTimeout(function() {
6876        $event[ dispatchMethod ].apply( context, args );
6877      }, execAsap === "execAsap"? 0 : 100 );
6878    }
6879  };
6880
6881  $.fn.smartresize = function( fn ) {
6882    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
6883  };
6884
6885
6886
6887// ========================= Isotope ===============================
6888
6889
6890  // our "Widget" object constructor
6891  $.Isotope = function( options, element, callback ){
6892    this.element = $( element );
6893
6894    this._create( options );
6895    this._init( callback );
6896  };
6897
6898  // styles of container element we want to keep track of
6899  var isoContainerStyles = [ 'width', 'height' ];
6900
6901  var $window = $(window);
6902
6903  $.Isotope.settings = {
6904    resizable: true,
6905    layoutMode : 'masonry',
6906    containerClass : 'isotope',
6907    itemClass : 'isotope-item',
6908    hiddenClass : 'isotope-hidden',
6909    hiddenStyle: { opacity: 0, scale: 0.001 },
6910    visibleStyle: { opacity: 1, scale: 1 },
6911    containerStyle: {
6912      position: 'relative',
6913      overflow: 'hidden'
6914    },
6915    animationEngine: 'best-available',
6916    animationOptions: {
6917      queue: false,
6918      duration: 800
6919    },
6920    sortBy : 'original-order',
6921    sortAscending : true,
6922    resizesContainer : true,
6923    transformsEnabled: true,
6924    itemPositionDataEnabled: false
6925  };
6926
6927  $.Isotope.prototype = {
6928
6929    // sets up widget
6930    _create : function( options ) {
6931
6932      this.options = $.extend( {}, $.Isotope.settings, options );
6933
6934      this.styleQueue = [];
6935      this.elemCount = 0;
6936
6937      // get original styles in case we re-apply them in .destroy()
6938      var elemStyle = this.element[0].style;
6939      this.originalStyle = {};
6940      // keep track of container styles
6941      var containerStyles = isoContainerStyles.slice(0);
6942      for ( var prop in this.options.containerStyle ) {
6943        containerStyles.push( prop );
6944      }
6945      for ( var i=0, len = containerStyles.length; i < len; i++ ) {
6946        prop = containerStyles[i];
6947        this.originalStyle[ prop ] = elemStyle[ prop ] || '';
6948      }
6949      // apply container style from options
6950      this.element.css( this.options.containerStyle );
6951
6952      this._updateAnimationEngine();
6953      this._updateUsingTransforms();
6954
6955      // sorting
6956      var originalOrderSorter = {
6957        'original-order' : function( $elem, instance ) {
6958          instance.elemCount ++;
6959          return instance.elemCount;
6960        },
6961        random : function() {
6962          return Math.random();
6963        }
6964      };
6965
6966      this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter );
6967
6968      // need to get atoms
6969      this.reloadItems();
6970
6971      // get top left position of where the bricks should be
6972      this.offset = {
6973        left: parseInt( ( this.element.css('padding-left') || 0 ), 10 ),
6974        top: parseInt( ( this.element.css('padding-top') || 0 ), 10 )
6975      };
6976
6977      // add isotope class first time around
6978      var instance = this;
6979      setTimeout( function() {
6980        instance.element.addClass( instance.options.containerClass );
6981      }, 0 );
6982
6983      // bind resize method
6984      if ( this.options.resizable ) {
6985        $window.bind( 'smartresize.isotope', function() {
6986          instance.resize();
6987        });
6988      }
6989
6990      // dismiss all click events from hidden events
6991      this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){
6992        return false;
6993      });
6994
6995    },
6996
6997    _getAtoms : function( $elems ) {
6998      var selector = this.options.itemSelector,
6999          // filter & find
7000          $atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems,
7001          // base style for atoms
7002          atomStyle = { position: 'absolute' };
7003
7004      // filter out text nodes
7005      $atoms = $atoms.filter( function( i, atom ) {
7006        return atom.nodeType === 1;
7007      });
7008
7009      if ( this.usingTransforms ) {
7010        atomStyle.left = 0;
7011        atomStyle.top = 0;
7012      }
7013
7014      $atoms.css( atomStyle ).addClass( this.options.itemClass );
7015
7016      this.updateSortData( $atoms, true );
7017
7018      return $atoms;
7019    },
7020
7021    // _init fires when your instance is first created
7022    // (from the constructor above), and when you
7023    // attempt to initialize the widget again (by the bridge)
7024    // after it has already been initialized.
7025    _init : function( callback ) {
7026
7027      this.$filteredAtoms = this._filter( this.$allAtoms );
7028      this._sort();
7029      this.reLayout( callback );
7030
7031    },
7032
7033    option : function( opts ){
7034      // change options AFTER initialization:
7035      // signature: $('#foo').bar({ cool:false });
7036      if ( $.isPlainObject( opts ) ){
7037        this.options = $.extend( true, this.options, opts );
7038
7039        // trigger _updateOptionName if it exists
7040        var updateOptionFn;
7041        for ( var optionName in opts ) {
7042          updateOptionFn = '_update' + capitalize( optionName );
7043          if ( this[ updateOptionFn ] ) {
7044            this[ updateOptionFn ]();
7045          }
7046        }
7047      }
7048    },
7049
7050    // ====================== updaters ====================== //
7051    // kind of like setters
7052
7053    _updateAnimationEngine : function() {
7054      var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, '');
7055      var isUsingJQueryAnimation;
7056      // set applyStyleFnName
7057      switch ( animationEngine ) {
7058        case 'css' :
7059        case 'none' :
7060          isUsingJQueryAnimation = false;
7061          break;
7062        case 'jquery' :
7063          isUsingJQueryAnimation = true;
7064          break;
7065        default : // best available
7066          isUsingJQueryAnimation = !Modernizr.csstransitions;
7067      }
7068      this.isUsingJQueryAnimation = isUsingJQueryAnimation;
7069      this._updateUsingTransforms();
7070    },
7071
7072    _updateTransformsEnabled : function() {
7073      this._updateUsingTransforms();
7074    },
7075
7076    _updateUsingTransforms : function() {
7077      var usingTransforms = this.usingTransforms = this.options.transformsEnabled &&
7078        Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation;
7079
7080      // prevent scales when transforms are disabled
7081      if ( !usingTransforms ) {
7082        delete this.options.hiddenStyle.scale;
7083        delete this.options.visibleStyle.scale;
7084      }
7085
7086      this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs;
7087    },
7088
7089
7090    // ====================== Filtering ======================
7091
7092    _filter : function( $atoms ) {
7093      var filter = this.options.filter === '' ? '*' : this.options.filter;
7094
7095      if ( !filter ) {
7096        return $atoms;
7097      }
7098
7099      var hiddenClass    = this.options.hiddenClass,
7100          hiddenSelector = '.' + hiddenClass,
7101          $hiddenAtoms   = $atoms.filter( hiddenSelector ),
7102          $atomsToShow   = $hiddenAtoms;
7103
7104      if ( filter !== '*' ) {
7105        $atomsToShow = $hiddenAtoms.filter( filter );
7106        var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass );
7107        this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle });
7108      }
7109
7110      this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle });
7111      $atomsToShow.removeClass( hiddenClass );
7112
7113      return $atoms.filter( filter );
7114    },
7115
7116    // ====================== Sorting ======================
7117
7118    updateSortData : function( $atoms, isIncrementingElemCount ) {
7119      var instance = this,
7120          getSortData = this.options.getSortData,
7121          $this, sortData;
7122      $atoms.each(function(){
7123        $this = $(this);
7124        sortData = {};
7125        // get value for sort data based on fn( $elem ) passed in
7126        for ( var key in getSortData ) {
7127          if ( !isIncrementingElemCount && key === 'original-order' ) {
7128            // keep original order original
7129            sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ];
7130          } else {
7131            sortData[ key ] = getSortData[ key ]( $this, instance );
7132          }
7133        }
7134        // apply sort data to element
7135        $.data( this, 'isotope-sort-data', sortData );
7136      });
7137    },
7138
7139    // used on all the filtered atoms
7140    _sort : function() {
7141
7142      var sortBy = this.options.sortBy,
7143          getSorter = this._getSorter,
7144          sortDir = this.options.sortAscending ? 1 : -1,
7145          sortFn = function( alpha, beta ) {
7146            var a = getSorter( alpha, sortBy ),
7147                b = getSorter( beta, sortBy );
7148            // fall back to original order if data matches
7149            if ( a === b && sortBy !== 'original-order') {
7150              a = getSorter( alpha, 'original-order' );
7151              b = getSorter( beta, 'original-order' );
7152            }
7153            return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
7154          };
7155
7156      this.$filteredAtoms.sort( sortFn );
7157    },
7158
7159    _getSorter : function( elem, sortBy ) {
7160      return $.data( elem, 'isotope-sort-data' )[ sortBy ];
7161    },
7162
7163    // ====================== Layout Helpers ======================
7164
7165    _translate : function( x, y ) {
7166      return { translate : [ x, y ] };
7167    },
7168
7169    _positionAbs : function( x, y ) {
7170      return { left: x, top: y };
7171    },
7172
7173    _pushPosition : function( $elem, x, y ) {
7174      x = Math.round( x + this.offset.left );
7175      y = Math.round( y + this.offset.top );
7176      var position = this.getPositionStyles( x, y );
7177      this.styleQueue.push({ $el: $elem, style: position });
7178      if ( this.options.itemPositionDataEnabled ) {
7179        $elem.data('isotope-item-position', {x: x, y: y} );
7180      }
7181    },
7182
7183
7184    // ====================== General Layout ======================
7185
7186    // used on collection of atoms (should be filtered, and sorted before )
7187    // accepts atoms-to-be-laid-out to start with
7188    layout : function( $elems, callback ) {
7189
7190      var layoutMode = this.options.layoutMode;
7191
7192      // layout logic
7193      this[ '_' +  layoutMode + 'Layout' ]( $elems );
7194
7195      // set the size of the container
7196      if ( this.options.resizesContainer ) {
7197        var containerStyle = this[ '_' +  layoutMode + 'GetContainerSize' ]();
7198        this.styleQueue.push({ $el: this.element, style: containerStyle });
7199      }
7200
7201      this._processStyleQueue( $elems, callback );
7202
7203      this.isLaidOut = true;
7204    },
7205
7206    _processStyleQueue : function( $elems, callback ) {
7207      // are we animating the layout arrangement?
7208      // use plugin-ish syntax for css or animate
7209      var styleFn = !this.isLaidOut ? 'css' : (
7210            this.isUsingJQueryAnimation ? 'animate' : 'css'
7211          ),
7212          animOpts = this.options.animationOptions,
7213          onLayout = this.options.onLayout,
7214          objStyleFn, processor,
7215          triggerCallbackNow, callbackFn;
7216
7217      // default styleQueue processor, may be overwritten down below
7218      processor = function( i, obj ) {
7219        obj.$el[ styleFn ]( obj.style, animOpts );
7220      };
7221
7222      if ( this._isInserting && this.isUsingJQueryAnimation ) {
7223        // if using styleQueue to insert items
7224        processor = function( i, obj ) {
7225          // only animate if it not being inserted
7226          objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn;
7227          obj.$el[ objStyleFn ]( obj.style, animOpts );
7228        };
7229
7230      } else if ( callback || onLayout || animOpts.complete ) {
7231        // has callback
7232        var isCallbackTriggered = false,
7233            // array of possible callbacks to trigger
7234            callbacks = [ callback, onLayout, animOpts.complete ],
7235            instance = this;
7236        triggerCallbackNow = true;
7237        // trigger callback only once
7238        callbackFn = function() {
7239          if ( isCallbackTriggered ) {
7240            return;
7241          }
7242          var hollaback;
7243          for (var i=0, len = callbacks.length; i < len; i++) {
7244            hollaback = callbacks[i];
7245            if ( typeof hollaback === 'function' ) {
7246              hollaback.call( instance.element, $elems, instance );
7247            }
7248          }
7249          isCallbackTriggered = true;
7250        };
7251
7252        if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) {
7253          // add callback to animation options
7254          animOpts.complete = callbackFn;
7255          triggerCallbackNow = false;
7256
7257        } else if ( Modernizr.csstransitions ) {
7258          // detect if first item has transition
7259          var i = 0,
7260              firstItem = this.styleQueue[0],
7261              testElem = firstItem && firstItem.$el,
7262              styleObj;
7263          // get first non-empty jQ object
7264          while ( !testElem || !testElem.length ) {
7265            styleObj = this.styleQueue[ i++ ];
7266            // HACK: sometimes styleQueue[i] is undefined
7267            if ( !styleObj ) {
7268              return;
7269            }
7270            testElem = styleObj.$el;
7271          }
7272          // get transition duration of the first element in that object
7273          // yeah, this is inexact
7274          var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] );
7275          if ( duration > 0 ) {
7276            processor = function( i, obj ) {
7277              obj.$el[ styleFn ]( obj.style, animOpts )
7278                // trigger callback at transition end
7279                .one( transitionEndEvent, callbackFn );
7280            };
7281            triggerCallbackNow = false;
7282          }
7283        }
7284      }
7285
7286      // process styleQueue
7287      $.each( this.styleQueue, processor );
7288
7289      if ( triggerCallbackNow ) {
7290        callbackFn();
7291      }
7292
7293      // clear out queue for next time
7294      this.styleQueue = [];
7295    },
7296
7297
7298    resize : function() {
7299      if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) {
7300        this.reLayout();
7301      }
7302    },
7303
7304
7305    reLayout : function( callback ) {
7306
7307      this[ '_' +  this.options.layoutMode + 'Reset' ]();
7308      this.layout( this.$filteredAtoms, callback );
7309
7310    },
7311
7312    // ====================== Convenience methods ======================
7313
7314    // ====================== Adding items ======================
7315
7316    // adds a jQuery object of items to a isotope container
7317    addItems : function( $content, callback ) {
7318      var $newAtoms = this._getAtoms( $content );
7319      // add new atoms to atoms pools
7320      this.$allAtoms = this.$allAtoms.add( $newAtoms );
7321
7322      if ( callback ) {
7323        callback( $newAtoms );
7324      }
7325    },
7326
7327    // convienence method for adding elements properly to any layout
7328    // positions items, hides them, then animates them back in <--- very sezzy
7329    insert : function( $content, callback ) {
7330      // position items
7331      this.element.append( $content );
7332
7333      var instance = this;
7334      this.addItems( $content, function( $newAtoms ) {
7335        var $newFilteredAtoms = instance._filter( $newAtoms );
7336        instance._addHideAppended( $newFilteredAtoms );
7337        instance._sort();
7338        instance.reLayout();
7339        instance._revealAppended( $newFilteredAtoms, callback );
7340      });
7341
7342    },
7343
7344    // convienence method for working with Infinite Scroll
7345    appended : function( $content, callback ) {
7346      var instance = this;
7347      this.addItems( $content, function( $newAtoms ) {
7348        instance._addHideAppended( $newAtoms );
7349        instance.layout( $newAtoms );
7350        instance._revealAppended( $newAtoms, callback );
7351      });
7352    },
7353
7354    // adds new atoms, then hides them before positioning
7355    _addHideAppended : function( $newAtoms ) {
7356      this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms );
7357      $newAtoms.addClass('no-transition');
7358
7359      this._isInserting = true;
7360
7361      // apply hidden styles
7362      this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle });
7363    },
7364
7365    // sets visible style on new atoms
7366    _revealAppended : function( $newAtoms, callback ) {
7367      var instance = this;
7368      // apply visible style after a sec
7369      setTimeout( function() {
7370        // enable animation
7371        $newAtoms.removeClass('no-transition');
7372        // reveal newly inserted filtered elements
7373        instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle });
7374        instance._isInserting = false;
7375        instance._processStyleQueue( $newAtoms, callback );
7376      }, 10 );
7377    },
7378
7379    // gathers all atoms
7380    reloadItems : function() {
7381      this.$allAtoms = this._getAtoms( this.element.children() );
7382    },
7383
7384    // removes elements from Isotope widget
7385    remove: function( $content, callback ) {
7386      // remove elements immediately from Isotope instance
7387      this.$allAtoms = this.$allAtoms.not( $content );
7388      this.$filteredAtoms = this.$filteredAtoms.not( $content );
7389      // remove() as a callback, for after transition / animation
7390      var instance = this;
7391      var removeContent = function() {
7392        $content.remove();
7393        if ( callback ) {
7394          callback.call( instance.element );
7395        }
7396      };
7397
7398      if ( $content.filter( ':not(.' + this.options.hiddenClass + ')' ).length ) {
7399        // if any non-hidden content needs to be removed
7400        this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle });
7401        this._sort();
7402        this.reLayout( removeContent );
7403      } else {
7404        // remove it now
7405        removeContent();
7406      }
7407
7408    },
7409
7410    shuffle : function( callback ) {
7411      this.updateSortData( this.$allAtoms );
7412      this.options.sortBy = 'random';
7413      this._sort();
7414      this.reLayout( callback );
7415    },
7416
7417    // destroys widget, returns elements and container back (close) to original style
7418    destroy : function() {
7419
7420      var usingTransforms = this.usingTransforms;
7421      var options = this.options;
7422
7423      this.$allAtoms
7424        .removeClass( options.hiddenClass + ' ' + options.itemClass )
7425        .each(function(){
7426          var style = this.style;
7427          style.position = '';
7428          style.top = '';
7429          style.left = '';
7430          style.opacity = '';
7431          if ( usingTransforms ) {
7432            style[ transformProp ] = '';
7433          }
7434        });
7435
7436      // re-apply saved container styles
7437      var elemStyle = this.element[0].style;
7438      for ( var prop in this.originalStyle ) {
7439        elemStyle[ prop ] = this.originalStyle[ prop ];
7440      }
7441
7442      this.element
7443        .unbind('.isotope')
7444        .undelegate( '.' + options.hiddenClass, 'click' )
7445        .removeClass( options.containerClass )
7446        .removeData('isotope');
7447
7448      $window.unbind('.isotope');
7449
7450    },
7451
7452
7453    // ====================== LAYOUTS ======================
7454
7455    // calculates number of rows or columns
7456    // requires columnWidth or rowHeight to be set on namespaced object
7457    // i.e. this.masonry.columnWidth = 200
7458    _getSegments : function( isRows ) {
7459      var namespace = this.options.layoutMode,
7460          measure  = isRows ? 'rowHeight' : 'columnWidth',
7461          size     = isRows ? 'height' : 'width',
7462          segmentsName = isRows ? 'rows' : 'cols',
7463          containerSize = this.element[ size ](),
7464          segments,
7465                    // i.e. options.masonry && options.masonry.columnWidth
7466          segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] ||
7467                    // or use the size of the first item, i.e. outerWidth
7468                    this.$filteredAtoms[ 'outer' + capitalize(size) ](true) ||
7469                    // if there's no items, use size of container
7470                    containerSize;
7471
7472      segments = Math.floor( containerSize / segmentSize );
7473      segments = Math.max( segments, 1 );
7474
7475      // i.e. this.masonry.cols = ....
7476      this[ namespace ][ segmentsName ] = segments;
7477      // i.e. this.masonry.columnWidth = ...
7478      this[ namespace ][ measure ] = segmentSize;
7479
7480    },
7481
7482    _checkIfSegmentsChanged : function( isRows ) {
7483      var namespace = this.options.layoutMode,
7484          segmentsName = isRows ? 'rows' : 'cols',
7485          prevSegments = this[ namespace ][ segmentsName ];
7486      // update cols/rows
7487      this._getSegments( isRows );
7488      // return if updated cols/rows is not equal to previous
7489      return ( this[ namespace ][ segmentsName ] !== prevSegments );
7490    },
7491
7492    // ====================== Masonry ======================
7493
7494    _masonryReset : function() {
7495      // layout-specific props
7496      this.masonry = {};
7497      // FIXME shouldn't have to call this again
7498      this._getSegments();
7499      var i = this.masonry.cols;
7500      this.masonry.colYs = [];
7501      while (i--) {
7502        this.masonry.colYs.push( 0 );
7503      }
7504    },
7505
7506    _masonryLayout : function( $elems ) {
7507      var instance = this,
7508          props = instance.masonry;
7509      $elems.each(function(){
7510        var $this  = $(this),
7511            //how many columns does this brick span
7512            colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth );
7513        colSpan = Math.min( colSpan, props.cols );
7514
7515        if ( colSpan === 1 ) {
7516          // if brick spans only one column, just like singleMode
7517          instance._masonryPlaceBrick( $this, props.colYs );
7518        } else {
7519          // brick spans more than one column
7520          // how many different places could this brick fit horizontally
7521          var groupCount = props.cols + 1 - colSpan,
7522              groupY = [],
7523              groupColY,
7524              i;
7525
7526          // for each group potential horizontal position
7527          for ( i=0; i < groupCount; i++ ) {
7528            // make an array of colY values for that one group
7529            groupColY = props.colYs.slice( i, i+colSpan );
7530            // and get the max value of the array
7531            groupY[i] = Math.max.apply( Math, groupColY );
7532          }
7533
7534          instance._masonryPlaceBrick( $this, groupY );
7535        }
7536      });
7537    },
7538
7539    // worker method that places brick in the columnSet
7540    //   with the the minY
7541    _masonryPlaceBrick : function( $brick, setY ) {
7542      // get the minimum Y value from the columns
7543      var minimumY = Math.min.apply( Math, setY ),
7544          shortCol = 0;
7545
7546      // Find index of short column, the first from the left
7547      for (var i=0, len = setY.length; i < len; i++) {
7548        if ( setY[i] === minimumY ) {
7549          shortCol = i;
7550          break;
7551        }
7552      }
7553
7554      // position the brick
7555      var x = this.masonry.columnWidth * shortCol,
7556          y = minimumY;
7557      this._pushPosition( $brick, x, y );
7558
7559      // apply setHeight to necessary columns
7560      var setHeight = minimumY + $brick.outerHeight(true),
7561          setSpan = this.masonry.cols + 1 - len;
7562      for ( i=0; i < setSpan; i++ ) {
7563        this.masonry.colYs[ shortCol + i ] = setHeight;
7564      }
7565
7566    },
7567
7568    _masonryGetContainerSize : function() {
7569      var containerHeight = Math.max.apply( Math, this.masonry.colYs );
7570      return { height: containerHeight };
7571    },
7572
7573    _masonryResizeChanged : function() {
7574      return this._checkIfSegmentsChanged();
7575    },
7576
7577    // ====================== fitRows ======================
7578
7579    _fitRowsReset : function() {
7580      this.fitRows = {
7581        x : 0,
7582        y : 0,
7583        height : 0
7584      };
7585    },
7586
7587    _fitRowsLayout : function( $elems ) {
7588      var instance = this,
7589          containerWidth = this.element.width(),
7590          props = this.fitRows;
7591
7592      $elems.each( function() {
7593        var $this = $(this),
7594            atomW = $this.outerWidth(true),
7595            atomH = $this.outerHeight(true);
7596
7597        if ( props.x !== 0 && atomW + props.x > containerWidth ) {
7598          // if this element cannot fit in the current row
7599          props.x = 0;
7600          props.y = props.height;
7601        }
7602
7603        // position the atom
7604        instance._pushPosition( $this, props.x, props.y );
7605
7606        props.height = Math.max( props.y + atomH, props.height );
7607        props.x += atomW;
7608
7609      });
7610    },
7611
7612    _fitRowsGetContainerSize : function () {
7613      return { height : this.fitRows.height };
7614    },
7615
7616    _fitRowsResizeChanged : function() {
7617      return true;
7618    },
7619
7620
7621    // ====================== cellsByRow ======================
7622
7623    _cellsByRowReset : function() {
7624      this.cellsByRow = {
7625        index : 0
7626      };
7627      // get this.cellsByRow.columnWidth
7628      this._getSegments();
7629      // get this.cellsByRow.rowHeight
7630      this._getSegments(true);
7631    },
7632
7633    _cellsByRowLayout : function( $elems ) {
7634      var instance = this,
7635          props = this.cellsByRow;
7636      $elems.each( function(){
7637        var $this = $(this),
7638            col = props.index % props.cols,
7639            row = Math.floor( props.index / props.cols ),
7640            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
7641            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2 ;
7642        instance._pushPosition( $this, x, y );
7643        props.index ++;
7644      });
7645    },
7646
7647    _cellsByRowGetContainerSize : function() {
7648      return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top };
7649    },
7650
7651    _cellsByRowResizeChanged : function() {
7652      return this._checkIfSegmentsChanged();
7653    },
7654
7655
7656    // ====================== straightDown ======================
7657
7658    _straightDownReset : function() {
7659      this.straightDown = {
7660        y : 0
7661      };
7662    },
7663
7664    _straightDownLayout : function( $elems ) {
7665      var instance = this;
7666      $elems.each( function( i ){
7667        var $this = $(this);
7668        instance._pushPosition( $this, 0, instance.straightDown.y );
7669        instance.straightDown.y += $this.outerHeight(true);
7670      });
7671    },
7672
7673    _straightDownGetContainerSize : function() {
7674      return { height : this.straightDown.y };
7675    },
7676
7677    _straightDownResizeChanged : function() {
7678      return true;
7679    },
7680
7681
7682    // ====================== masonryHorizontal ======================
7683
7684    _masonryHorizontalReset : function() {
7685      // layout-specific props
7686      this.masonryHorizontal = {};
7687      // FIXME shouldn't have to call this again
7688      this._getSegments( true );
7689      var i = this.masonryHorizontal.rows;
7690      this.masonryHorizontal.rowXs = [];
7691      while (i--) {
7692        this.masonryHorizontal.rowXs.push( 0 );
7693      }
7694    },
7695
7696    _masonryHorizontalLayout : function( $elems ) {
7697      var instance = this,
7698          props = instance.masonryHorizontal;
7699      $elems.each(function(){
7700        var $this  = $(this),
7701            //how many rows does this brick span
7702            rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight );
7703        rowSpan = Math.min( rowSpan, props.rows );
7704
7705        if ( rowSpan === 1 ) {
7706          // if brick spans only one column, just like singleMode
7707          instance._masonryHorizontalPlaceBrick( $this, props.rowXs );
7708        } else {
7709          // brick spans more than one row
7710          // how many different places could this brick fit horizontally
7711          var groupCount = props.rows + 1 - rowSpan,
7712              groupX = [],
7713              groupRowX, i;
7714
7715          // for each group potential horizontal position
7716          for ( i=0; i < groupCount; i++ ) {
7717            // make an array of colY values for that one group
7718            groupRowX = props.rowXs.slice( i, i+rowSpan );
7719            // and get the max value of the array
7720            groupX[i] = Math.max.apply( Math, groupRowX );
7721          }
7722
7723          instance._masonryHorizontalPlaceBrick( $this, groupX );
7724        }
7725      });
7726    },
7727
7728    _masonryHorizontalPlaceBrick : function( $brick, setX ) {
7729      // get the minimum Y value from the columns
7730      var minimumX  = Math.min.apply( Math, setX ),
7731          smallRow  = 0;
7732      // Find index of smallest row, the first from the top
7733      for (var i=0, len = setX.length; i < len; i++) {
7734        if ( setX[i] === minimumX ) {
7735          smallRow = i;
7736          break;
7737        }
7738      }
7739
7740      // position the brick
7741      var x = minimumX,
7742          y = this.masonryHorizontal.rowHeight * smallRow;
7743      this._pushPosition( $brick, x, y );
7744
7745      // apply setHeight to necessary columns
7746      var setWidth = minimumX + $brick.outerWidth(true),
7747          setSpan = this.masonryHorizontal.rows + 1 - len;
7748      for ( i=0; i < setSpan; i++ ) {
7749        this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth;
7750      }
7751    },
7752
7753    _masonryHorizontalGetContainerSize : function() {
7754      var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs );
7755      return { width: containerWidth };
7756    },
7757
7758    _masonryHorizontalResizeChanged : function() {
7759      return this._checkIfSegmentsChanged(true);
7760    },
7761
7762
7763    // ====================== fitColumns ======================
7764
7765    _fitColumnsReset : function() {
7766      this.fitColumns = {
7767        x : 0,
7768        y : 0,
7769        width : 0
7770      };
7771    },
7772
7773    _fitColumnsLayout : function( $elems ) {
7774      var instance = this,
7775          containerHeight = this.element.height(),
7776          props = this.fitColumns;
7777      $elems.each( function() {
7778        var $this = $(this),
7779            atomW = $this.outerWidth(true),
7780            atomH = $this.outerHeight(true);
7781
7782        if ( props.y !== 0 && atomH + props.y > containerHeight ) {
7783          // if this element cannot fit in the current column
7784          props.x = props.width;
7785          props.y = 0;
7786        }
7787
7788        // position the atom
7789        instance._pushPosition( $this, props.x, props.y );
7790
7791        props.width = Math.max( props.x + atomW, props.width );
7792        props.y += atomH;
7793
7794      });
7795    },
7796
7797    _fitColumnsGetContainerSize : function () {
7798      return { width : this.fitColumns.width };
7799    },
7800
7801    _fitColumnsResizeChanged : function() {
7802      return true;
7803    },
7804
7805
7806
7807    // ====================== cellsByColumn ======================
7808
7809    _cellsByColumnReset : function() {
7810      this.cellsByColumn = {
7811        index : 0
7812      };
7813      // get this.cellsByColumn.columnWidth
7814      this._getSegments();
7815      // get this.cellsByColumn.rowHeight
7816      this._getSegments(true);
7817    },
7818
7819    _cellsByColumnLayout : function( $elems ) {
7820      var instance = this,
7821          props = this.cellsByColumn;
7822      $elems.each( function(){
7823        var $this = $(this),
7824            col = Math.floor( props.index / props.rows ),
7825            row = props.index % props.rows,
7826            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
7827            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
7828        instance._pushPosition( $this, x, y );
7829        props.index ++;
7830      });
7831    },
7832
7833    _cellsByColumnGetContainerSize : function() {
7834      return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth };
7835    },
7836
7837    _cellsByColumnResizeChanged : function() {
7838      return this._checkIfSegmentsChanged(true);
7839    },
7840
7841    // ====================== straightAcross ======================
7842
7843    _straightAcrossReset : function() {
7844      this.straightAcross = {
7845        x : 0
7846      };
7847    },
7848
7849    _straightAcrossLayout : function( $elems ) {
7850      var instance = this;
7851      $elems.each( function( i ){
7852        var $this = $(this);
7853        instance._pushPosition( $this, instance.straightAcross.x, 0 );
7854        instance.straightAcross.x += $this.outerWidth(true);
7855      });
7856    },
7857
7858    _straightAcrossGetContainerSize : function() {
7859      return { width : this.straightAcross.x };
7860    },
7861
7862    _straightAcrossResizeChanged : function() {
7863      return true;
7864    }
7865
7866  };
7867
7868
7869  // ======================= imagesLoaded Plugin ===============================
7870  /*!
7871   * jQuery imagesLoaded plugin v1.1.0
7872   * http://github.com/desandro/imagesloaded
7873   *
7874   * MIT License. by Paul Irish et al.
7875   */
7876
7877
7878  // $('#my-container').imagesLoaded(myFunction)
7879  // or
7880  // $('img').imagesLoaded(myFunction)
7881
7882  // execute a callback when all images have loaded.
7883  // needed because .load() doesn't work on cached images
7884
7885  // callback function gets image collection as argument
7886  //  `this` is the container
7887
7888  $.fn.imagesLoaded = function( callback ) {
7889    var $this = this,
7890        $images = $this.find('img').add( $this.filter('img') ),
7891        len = $images.length,
7892        blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==',
7893        loaded = [];
7894
7895    function triggerCallback() {
7896      callback.call( $this, $images );
7897    }
7898
7899    function imgLoaded( event ) {
7900      var img = event.target;
7901      if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
7902        loaded.push( img );
7903        if ( --len <= 0 ){
7904          setTimeout( triggerCallback );
7905          $images.unbind( '.imagesLoaded', imgLoaded );
7906        }
7907      }
7908    }
7909
7910    // if no images, trigger immediately
7911    if ( !len ) {
7912      triggerCallback();
7913    }
7914
7915    $images.bind( 'load.imagesLoaded error.imagesLoaded',  imgLoaded ).each( function() {
7916      // cached images don't fire load sometimes, so we reset src.
7917      var src = this.src;
7918      // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
7919      // data uri bypasses webkit log warning (thx doug jones)
7920      this.src = blank;
7921      this.src = src;
7922    });
7923
7924    return $this;
7925  };
7926
7927
7928  // helper function for logging errors
7929  // $.error breaks jQuery chaining
7930  var logError = function( message ) {
7931    if ( window.console ) {
7932      window.console.error( message );
7933    }
7934  };
7935
7936  // =======================  Plugin bridge  ===============================
7937  // leverages data method to either create or return $.Isotope constructor
7938  // A bit from jQuery UI
7939  //   https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
7940  // A bit from jcarousel
7941  //   https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarou
7941sel.js
7942
7943  $.fn.isotope = function( options, callback ) {
7944    if ( typeof options === 'string' ) {
7945      // call method
7946      var args = Array.prototype.slice.call( arguments, 1 );
7947
7948      this.each(function(){
7949        var instance = $.data( this, 'isotope' );
7950        if ( !instance ) {
7951          logError( "cannot call methods on isotope prior to initialization; " +
7952              "attempted to call method '" + options + "'" );
7953          return;
7954        }
7955        if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
7956          logError( "no such method '" + options + "' for isotope instance" );
7957          return;
7958        }
7959        // apply method
7960        instance[ options ].apply( instance, args );
7961      });
7962    } else {
7963      this.each(function() {
7964        var instance = $.data( this, 'isotope' );
7965        if ( instance ) {
7966          // apply options & init
7967          instance.option( options );
7968          instance._init( callback );
7969        } else {
7970          // initialize new instance
7971          $.data( this, 'isotope', new $.Isotope( options, this, callback ) );
7972        }
7973      });
7974    }
7975    // return jQuery object
7976    // so plugin methods do not have to
7977    return this;
7978  };
7979
7980})( window, jQuery );
7981/*jshint undef: true */
7982/*global jQuery: true */
7983
7984/*
7985   --------------------------------
7986   Infinite Scroll
7987   --------------------------------
7988   + https://github.com/paulirish/infinite-scroll
7989   + version 2.0b2.120519
7990   + Copyright 2011/12 Paul Irish & Luke Shumard
7991   + Licensed under the MIT license
7992
7993   + Documentation: http://infinite-scroll.com/
7994*/
7995
7996(function (window, $, undefined) {
7997	"use strict";
7998
7999    $.infinitescroll = function infscr(options, callback, element) {
8000        this.element = $(element);
8001
8002        // Flag the object in the event of a failed creation
8003        if (!this._create(options, callback)) {
8004            this.failed = true;
8005        }
8006    };
8007
8008    $.infinitescroll.defaults = {
8009        loading: {
8010            finished: undefined,
8011            finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
8012			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
8012HlhskwrTJciZHEXsgaqS4s6PJiCAr1uzYU8kBBSgnWFqpoMJMUjGtDmUwkmfVmVypakWhEKvXsS4nhLW5wNjVroJIoc05wSzTr0PtiigpYe4EC2vj4iWrFu5euWIMRBhacaVJhYQBEFjA9jHjyQ0xEABwGceGAZYjY0YBOrRLCxUp29QM+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
8012iqpQpZ4apwSwRtjqrB3muoF9BboaXKmshlqWqsWiGt2wphJkQbAU5hoCACH5BAUKABsALAcABADOAAsAAAX/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",
8013            msg: null,
8014            msgText: "<em>Loading the next set of products...</em>",
8015            selector: null,
8016            speed: 'fast',
8017            start: undefined
8018        },
8019        state: {
8020            isDuringAjax: false,
8021            isInvalidPage: false,
8022            isDestroyed: false,
8023            isDone: false, // For when it goes all the way through the archive.
8024            isPaused: false,
8025            currPage: 1
8026        },
8027        debug: false,
8028		behavior: undefined,
8029        binder: $(window), // used to cache the selector
8030        nextSelector: "div.navigation a:first",
8031        navSelector: "div.navigation",
8032        contentSelector: null, // rename to pageFragment
8033        extraScrollPx: 150,
8034        itemSelector: "div.post",
8035        animate: false,
8036        pathParse: undefined,
8037        dataType: 'html',
8038        appendCallback: true,
8039        bufferPx: 40,
8040        errorCallback: function () { },
8041        infid: 0, //Instance ID
8042        pixelsFromNavToBottom: undefined,
8043        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
8044		prefill: false, // When the document is smaller than the window, load data until the document is larger or links are exhausted
8045        maxPage: undefined // to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)
8046	};
8047
8048    $.infinitescroll.prototype = {
8049
8050        /*	
8051            ----------------------------
8052            Private methods
8053            ----------------------------
8054            */
8055
8056        // Bind or unbind from scroll
8057        _binding: function infscr_binding(binding) {
8058
8059            var instance = this,
8060            opts = instance.options;
8061
8062            opts.v = '2.0b2.120520';
8063
8064            // if behavior is defined and this function is extended, call that instead of default
8065            if (!!opts.behavior && this['_binding_'+opts.behavior] !== undefined) {
8066                this['_binding_'+opts.behavior].call(this);
8067                return;
8068            }
8069
8070            if (binding !== 'bind' && binding !== 'unbind') {
8071                this._debug('Binding value  ' + binding + ' not valid');
8072                return false;
8073            }
8074
8075            if (binding === 'unbind') {
8076                (this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);
8077            } else {
8078                (this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function () {
8079                    instance.scroll();
8080                });
8081            }
8082
8083            this._debug('Binding', binding);
8084        },
8085
8086        // Fundamental aspects of the plugin are initialized
8087        _create: function infscr_create(options, callback) {
8088
8089            // Add custom options to defaults
8090            var opts = $.extend(true, {}, $.infinitescroll.defaults, options);
8091			this.options = opts;
8092			var $window = $(window);
8093			var instance = this;
8094
8095			// Validate selectors
8096            if (!instance._validate(options)) {
8097				return false;
8098			}
8099
8100            // Validate page fragment path
8101            var path = $(opts.nextSelector).attr('href');
8102            if (!path) {
8103                this._debug('Navigation selector not found');
8104                return false;
8105            }
8106
8107            // Set the path to be a relative URL from root.
8108            opts.path = opts.path || this._determinepath(path);
8109
8110            // contentSelector is 'page fragment' option for .load() / .ajax() calls
8111            opts.contentSelector = opts.contentSelector || this.element;
8112
8113            // loading.selector - if we want to place the load message in a specific selector, defaulted to the contentSelector
8114            opts.loading.selector = opts.loading.selector || opts.contentSelector;
8115
8116            // Define loading.msg
8117            opts.loading.msg = opts.loading.msg || $('<div id="infscr-loading"><img alt="Loading..." src="' + opts.loading.img + '" /><div>' + opts.loading.msgText + '</div></div>');
8118
8119            // Preload loading.img
8120            (new Image()).src = opts.loading.img;
8121
8122            // distance from nav links to bottom
8123            // computed as: height of the document + top offset of container - top offset of nav link
8124            if(opts.pixelsFromNavToBottom === undefined) {
8125				opts.pixelsFromNavToBottom = $(document).height() - $(opts.navSelector).offset().top;
8126			}
8127
8128			var self = this;
8129
8130            // determine loading.start actions
8131            opts.loading.start = opts.loading.start || function() {
8132                $(opts.navSelector).hide();
8133                opts.loading.msg
8134                .appendTo(opts.loading.selector.parent())
8135                .show(opts.loading.speed, $.proxy(function() {
8136					this.beginAjax(opts);
8137				}, self));
8138            };
8139
8140            // determine loading.finished actions
8141            opts.loading.finished = opts.loading.finished || function() {
8142                opts.loading.msg.fadeOut(opts.loading.speed);
8143            };
8144
8145			// callback loading
8146            opts.callback = function(instance, data, url) {
8147                if (!!opts.behavior && instance['_callback_'+opts.behavior] !== undefined) {
8148                    instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data, url);
8149                }
8150
8151                if (callback) {
8152                    callback.call($(opts.contentSelector)[0], data, opts, url);
8153                }
8154
8155				if (opts.prefill) {
8156					$window.bind("resize.infinite-scroll", instance._prefill);
8157				}
8158            };
8159
8160			if (options.debug) {
8161				// Tell IE9 to use its built-in console
8162				if (Function.prototype.bind && (typeof console === 'object' || typeof console === 'function') && typeof console.log === "object") {
8163					["log","info","warn","error","assert","dir","clear","profile","profileEnd"]
8164						.forEach(function (method) {
8165							console[method] = this.call(console[method], console);
8166						}, Function.prototype.bind);
8167				}
8168			}
8169
8170            this._setup();
8171
8172			// Setups the prefill method for use
8173			if (opts.prefill) {
8174				this._prefill();
8175			}
8176
8177            // Return true to indicate successful creation
8178            return true;
8179        },
8180
8181		_prefill: function infscr_prefill() {
8182			var instance = this;
8183			var $document = $(document);
8184			var $window = $(window);
8185
8186			function needsPrefill() {
8187				return ($document.height() <= $window.height());
8188			}
8189
8190			this._prefill = function() {
8191				if (needsPrefill()) {
8192					instance.scroll();
8193				}
8194
8195				$window.bind("resize.infinite-scroll", function() {
8196					if (needsPrefill()) {
8197						$window.unbind("resize.infinite-scroll");
8198						instance.scroll();
8199					}
8200				});
8201			};
8202
8203			// Call self after setting up the new function
8204			this._prefill();
8205		},
8206
8207        // Console log wrapper
8208        _debug: function infscr_debug() {
8209			if (true !== this.options.debug) {
8210				return;
8211			}
8212
8213			if (typeof console !== 'undefined' && typeof console.log === 'function') {
8214				// Modern browsers
8215				// Single argument, which is a string
8216				if ((Array.prototype.slice.call(arguments)).length === 1 && typeof Array.prototype.slice.call(arguments)[0] === 'string') {
8217					console.log( (Array.prototype.slice.call(arguments)).toString() );
8218				} else {
8219					console.log( Array.prototype.slice.call(arguments) );
8220				}
8221			} else if (!Function.prototype.bind && typeof console !== 'undefined' && typeof console.log === 'object') {
8222				// IE8
8223				Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
8224			}
8225        },
8226
8227        // find the number to increment in the path.
8228        _determinepath: function infscr_determinepath(path) {
8229
8230            var opts = this.options;
8231
8232            // if behavior is defined and this function is extended, call that instead of default
8233            if (!!opts.behavior && this['_determinepath_'+opts.behavior] !== undefined) {
8234                return this['_determinepath_'+opts.behavior].call(this,path);
8235            }
8236
8237            if (!!opts.pathParse) {
8238
8239                this._debug('pathParse manual');
8240                return opts.pathParse(path, this.options.state.currPage+1);
8241
8242            } else if (path.match(/^(.*?)\b2\b(.*?$)/)) {
8243                path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
8244
8245                // if there is any 2 in the url at all.    
8246            } else if (path.match(/^(.*?)2(.*?$)/)) {
8247
8248                // page= is used in django:
8249                // http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127
8250                if (path.match(/^(.*?page=)2(\/.*|$)/)) {
8251                    path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
8252                    return path;
8253                }
8254
8255                path = path.match(/^(.*?)2(.*?$)/).slice(1);
8256
8257            } else {
8258
8259                // page= is used in drupal too but second page is page=1 not page=2:
8260                // thx Jerod Fritz, vladikoff
8261                if (path.match(/^(.*?page=)1(\/.*|$)/)) {
8262                    path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
8263                    return path;
8264                } else {
8265                    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.');
8266                    // Get rid of isInvalidPage to allow permalink to state
8267                    opts.state.isInvalidPage = true;  //prevent it from running on this page.
8268                }
8269            }
8270            this._debug('determinePath', path);
8271            return path;
8272
8273        },
8274
8275        // Custom error
8276        _error: function infscr_error(xhr) {
8277
8278            var opts = this.options;
8279
8280            // if behavior is defined and this function is extended, call that instead of default
8281            if (!!opts.behavior && this['_error_'+opts.behavior] !== undefined) {
8282                this['_error_'+opts.behavior].call(this,xhr);
8283                return;
8284            }
8285
8286            if (xhr !== 'destroy' && xhr !== 'end') {
8287                xhr = 'unknown';
8288            }
8289
8290            this._debug('Error', xhr);
8291
8292            if (xhr === 'end') {
8293                this._showdonemsg();
8294            }
8295
8296            opts.state.isDone = true;
8297            opts.state.currPage = 1; // if you need to go back to this instance
8298            opts.state.isPaused = false;
8299            this._binding('unbind');
8300
8301        },
8302
8303        // Load Callback
8304        _loadcallback: function infscr_loadcallback(box, data, url) {
8305            var opts = this.options,
8306            callback = this.options.callback, // GLOBAL OBJECT FOR CALLBACK
8307            result = (opts.state.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
8308            frag;
8309
8310            // if behavior is defined and this function is extended, call that instead of default
8311            if (!!opts.behavior && this['_loadcallback_'+opts.behavior] !== undefined) {
8312                this['_loadcallback_'+opts.behavior].call(this,box,data);
8313                return;
8314            }
8315
8316			switch (result) {
8317				case 'done':
8318					this._showdonemsg();
8319					return false;
8320
8321				case 'no-append':
8322					if (opts.dataType === 'html') {
8323						data = '<div>' + data + '</div>';
8324						data = $(data).find(opts.itemSelector);
8325					}
8326					break;
8327
8328				case 'append':
8329					var children = box.children();
8330					// if it didn't return anything
8331					if (children.length === 0) {
8332						return this._error('end');
8333					}
8334
8335					// use a documentFragment because it works when content is going into a table or UL
8336					frag = document.createDocumentFragment();
8337					while (box[0].firstChild) {
8338						frag.appendChild(box[0].firstChild);
8339					}
8340
8341					this._debug('contentSelector', $(opts.contentSelector)[0]);
8342					$(opts.contentSelector)[0].appendChild(frag);
8343					// previously, we would pass in the new DOM element as context for the callback
8344					// however we're now using a documentfragment, which doesn't have parents or children,
8345					// so the context is the contentContainer guy, and we pass in an array
8346					// of the elements collected as the first argument.
8347
8348					data = children.get();
8349					break;
8350			}
8351
8352            // loadingEnd function
8353            opts.loading.finished.call($(opts.contentSelector)[0],opts);
8354
8355            // smooth scroll to ease in the new content
8356            if (opts.animate) {
8357                var scrollTo = $(window).scrollTop() + $('#infscr-loading').height() + opts.extraScrollPx + 'px';
8358                $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.state.isDuringAjax = false; });
8359            }
8360
8361            if (!opts.animate) {
8362				// once the call is done, we can allow it again.
8363				opts.state.isDuringAjax = false;
8364			}
8365
8366            callback(this, data, url);
8367
8368			if (opts.prefill) {
8369				this._prefill();
8370			}
8371		},
8372
8373        _nearbottom: function infscr_nearbottom() {
8374
8375            var opts = this.options,
8376            pixelsFromWindowBottomToBottom = 0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
8377
8378            // if behavior is defined and this function is extended, call that instead of default
8379            if (!!opts.behavior && this['_nearbottom_'+opts.behavior] !== undefined) {
8380                return this['_nearbottom_'+opts.behavior].call(this);
8381            }
8382
8383            this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
8384
8385            // if distance remaining in the scroll (including buffer) is less than the orignal nav to bottom....
8386            return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
8387
8388        },
8389
8390        // Pause / temporarily disable plugin from firing
8391        _pausing: function infscr_pausing(pause) {
8392
8393            var opts = this.options;
8394
8395            // if behavior is defined and this function is extended, call that instead of default
8396            if (!!opts.behavior && this['_pausing_'+opts.behavior] !== undefined) {
8397                this['_pausing_'+opts.behavior].call(this,pause);
8398                return;
8399            }
8400
8401            // If pause is not 'pause' or 'resume', toggle it's value
8402            if (pause !== 'pause' && pause !== 'resume' && pause !== null) {
8403                this._debug('Invalid argument. Toggling pause value instead');
8404            }
8405
8406            pause = (pause && (pause === 'pause' || pause === 'resume')) ? pause : 'toggle';
8407
8408            switch (pause) {
8409                case 'pause':
8410                    opts.state.isPaused = true;
8411                break;
8412
8413                case 'resume':
8414                    opts.state.isPaused = false;
8415                break;
8416
8417                case 'toggle':
8418                    opts.state.isPaused = !opts.state.isPaused;
8419                break;
8420            }
8421
8422            this._debug('Paused', opts.state.isPaused);
8423            return false;
8424
8425        },
8426
8427        // Behavior is determined
8428        // If the behavior option is undefined, it will set to default and bind to scroll
8429        _setup: function infscr_setup() {
8430
8431            var opts = this.options;
8432
8433            // if behavior is defined and this function is extended, call that instead of default
8434            if (!!opts.behavior && this['_setup_'+opts.behavior] !== undefined) {
8435                this['_setup_'+opts.behavior].call(this);
8436                return;
8437            }
8438
8439            this._binding('bind');
8440
8441            return false;
8442
8443        },
8444
8445        // Show done message
8446        _showdonemsg: function infscr_showdonemsg() {
8447
8448            var opts = this.options;
8449
8450            // if behavior is defined and this function is extended, call that instead of default
8451            if (!!opts.behavior && this['_showdonemsg_'+opts.behavior] !== undefined) {
8452                this['_showdonemsg_'+opts.behavior].call(this);
8453                return;
8454            }
8455
8456            opts.loading.msg
8457            .find('img')
8458            .hide()
8459            .parent()
8460            .find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
8461                $(this).parent().fadeOut(opts.loading.speed);
8462            });
8463
8464            // user provided callback when done    
8465            opts.errorCallback.call($(opts.contentSelector)[0],'done');
8466        },
8467
8468        // grab each selector option and see if any fail
8469        _validate: function infscr_validate(opts) {
8470            for (var key in opts) {
8471                if (key.indexOf && key.indexOf('Selector') > -1 && $(opts[key]).length === 0) {
8472                    this._debug('Your ' + key + ' found no elements.');
8473                    return false;
8474                }
8475            }
8476
8477            return true;
8478        },
8479
8480        /*	
8481            ----------------------------
8482            Public methods
8483            ----------------------------
8484            */
8485
8486        // Bind to scroll
8487        bind: function infscr_bind() {
8488            this._binding('bind');
8489        },
8490
8491        // Destroy current instance of plugin
8492        destroy: function infscr_destroy() {
8493            this.options.state.isDestroyed = true;
8494			this.options.loading.finished();
8495            return this._error('destroy');
8496        },
8497
8498        // Set pause value to false
8499        pause: function infscr_pause() {
8500            this._pausing('pause');
8501        },
8502
8503        // Set pause value to false
8504        resume: function infscr_resume() {
8505            this._pausing('resume');
8506        },
8507
8508		beginAjax: function infscr_ajax(opts) {
8509			var instance = this,
8510				path = opts.path,
8511				box, desturl, method, condition;
8512
8513			// increment the URL bit. e.g. /page/3/
8514			opts.state.currPage++;
8515
8516            // Manually control maximum page 
8517            if ( opts.maxPage != undefined && opts.state.currPage > opts.maxPage ){
8518                this.destroy();
8519                return;
8520            }
8521
8522			// if we're dealing with a table we can't use DIVs
8523			box = $(opts.contentSelector).is('table') ? $('<tbody/>') : $('<div/>');
8524
8525			desturl = (typeof path === 'function') ? path(opts.state.currPage) : path.join(opts.state.currPage);
8526			instance._debug('heading into ajax', desturl);
8527
8528			method = (opts.dataType === 'html' || opts.dataType === 'json' ) ? opts.dataType : 'html+callback';
8529			if (opts.appendCallback && opts.dataType === 'html') {
8530				method += '+callback';
8531			}
8532
8533			switch (method) {
8534				case 'html+callback':
8535					instance._debug('Using HTML via .load() method');
8536					box.load(desturl + ' ' + opts.itemSelector, undefined, function infscr_ajax_callback(responseText) {
8537						instance._loadcallback(box, responseText, desturl);
8538					});
8539
8540					break;
8541
8542				case 'html':
8543					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
8544					$.ajax({
8545						// params
8546						url: desturl,
8547						dataType: opts.dataType,
8548						complete: function infscr_ajax_callback(jqXHR, textStatus) {
8549							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
8550							if (condition) {
8551								instance._loadcallback(box, jqXHR.responseText, desturl);
8552							} else {
8553								instance._error('end');
8554							}
8555						}
8556					});
8557
8558					break;
8559				case 'json':
8560					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
8561					$.ajax({
8562						dataType: 'json',
8563						type: 'GET',
8564						url: desturl,
8565						success: function (data, textStatus, jqXHR) {
8566							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
8567							if (opts.appendCallback) {
8568								// if appendCallback is true, you must defined template in options.
8569								// note that data passed into _loadcallback is already an html (after processed in opts.template(data)).
8570								if (opts.template !== undefined) {
8571									var theData = opts.template(data);
8572									box.append(theData);
8573									if (condition) {
8574										instance._loadcallback(box, theData);
8575									} else {
8576										instance._error('end');
8577									}
8578								} else {
8579									instance._debug("template must be defined.");
8580									instance._error('end');
8581								}
8582							} else {
8583								// if appendCallback is false, we will pass in the JSON object. you should handle it yourself in your callback.
8584								if (condition) {
8585									instance._loadcallback(box, data, desturl);
8586								} else {
8587									instance._error('end');
8588								}
8589							}
8590						},
8591						error: function() {
8592							instance._debug("JSON ajax request failed.");
8593							instance._error('end');
8594						}
8595					});
8596
8597					break;
8598			}
8599		},
8600
8601        // Retrieve next set of content items
8602        retrieve: function infscr_retrieve(pageNum) {
8603			pageNum = pageNum || null;
8604
8605			var instance = this,
8606            opts = instance.options;
8607
8608            // if behavior is defined and this function is extended, call that instead of default
8609            if (!!opts.behavior && this['retrieve_'+opts.behavior] !== undefined) {
8610                this['retrieve_'+opts.behavior].call(this,pageNum);
8611                return;
8612            }
8613
8614            // for manual triggers, if destroyed, get out of here
8615            if (opts.state.isDestroyed) {
8616                this._debug('Instance is destroyed');
8617                return false;
8618            }
8619
8620            // we dont want to fire the ajax multiple times
8621            opts.state.isDuringAjax = true;
8622
8623            opts.loading.start.call($(opts.contentSelector)[0],opts);
8624        },
8625
8626        // Check to see next page is needed
8627        scroll: function infscr_scroll() {
8628
8629            var opts = this.options,
8630            state = opts.state;
8631
8632            // if behavior is defined and this function is extended, call that instead of default
8633            if (!!opts.behavior && this['scroll_'+opts.behavior] !== undefined) {
8634                this['scroll_'+opts.behavior].call(this);
8635                return;
8636            }
8637
8638            if (state.isDuringAjax || state.isInvalidPage || state.isDone || state.isDestroyed || state.isPaused) {
8639				return;
8640			}
8641
8642            if (!this._nearbottom()) {
8643				return;
8644			}
8645
8646            this.retrieve();
8647
8648        },
8649
8650        // Toggle pause value
8651        toggle: function infscr_toggle() {
8652            this._pausing();
8653        },
8654
8655        // Unbind from scroll
8656        unbind: function infscr_unbind() {
8657            this._binding('unbind');
8658        },
8659
8660        // update options
8661        update: function infscr_options(key) {
8662            if ($.isPlainObject(key)) {
8663                this.options = $.extend(true,this.options,key);
8664            }
8665        }
8666    };
8667
8668
8669    /*	
8670        ----------------------------
8671        Infinite Scroll function
8672        ----------------------------
8673
8674        Borrowed logic from the following...
8675
8676        jQuery UI
8677        - https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
8678
8679        jCarousel
8680        - https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
8681
8682        Masonry
8683        - https://github.com/desandro/masonry/blob/master/jquery.masonry.js		
8684
8685*/
8686
8687    $.fn.infinitescroll = function infscr_init(options, callback) {
8688
8689        var thisCall = typeof options;
8690
8691        switch (thisCall) {
8692
8693            // method 
8694            case 'string':
8695                var args = Array.prototype.slice.call(arguments, 1);
8696
8697				this.each(function () {
8698					var instance = $.data(this, 'infinitescroll');
8699
8700					if (!instance) {
8701						// not setup yet
8702						// return $.error('Method ' + options + ' cannot be called until Infinite Scroll is setup');
8703						return false;
8704					}
8705
8706					if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
8707						// return $.error('No such method ' + options + ' for Infinite Scroll');
8708						return false;
8709					}
8710
8711					// no errors!
8712					instance[options].apply(instance, args);
8713				});
8714
8715            break;
8716
8717            // creation 
8718            case 'object':
8719
8720                this.each(function () {
8721
8722                var instance = $.data(this, 'infinitescroll');
8723
8724                if (instance) {
8725
8726                    // update options of current instance
8727                    instance.update(options);
8728
8729                } else {
8730
8731                    // initialize new instance
8732                    instance = new $.infinitescroll(options, callback, this);
8733
8734                    // don't attach if instantiation failed
8735                    if (!instance.failed) {
8736                        $.data(this, 'infinitescroll', instance);
8737                    }
8738
8739                }
8740
8741            });
8742
8743            break;
8744
8745        }
8746
8747        return this;
8748    };
8749
8750
8751
8752    /* 
8753     * smartscroll: debounced scroll event for jQuery *
8754     * https://github.com/lukeshumard/smartscroll
8755     * Based on smartresize by @louis_remi: https://github.com/lrbabe/jquery.smartresize.js *
8756     * Copyright 2011 Louis-Remi & Luke Shumard * Licensed under the MIT license. *
8757     */
8758
8759    var event = $.event,
8760    scrollTimeout;
8761
8762    event.special.smartscroll = {
8763        setup: function () {
8764            $(this).bind("scroll", event.special.smartscroll.handler);
8765        },
8766        teardown: function () {
8767            $(this).unbind("scroll", event.special.smartscroll.handler);
8768        },
8769        handler: function (event, execAsap) {
8770            // Save the context
8771            var context = this,
8772            args = arguments;
8773
8774            // set correct event type
8775            event.type = "smartscroll";
8776
8777            if (scrollTimeout) { clearTimeout(scrollTimeout); }
8778            scrollTimeout = setTimeout(function () {
8779                $(context).trigger('smartscroll', args);
8780            }, execAsap === "execAsap" ? 0 : 100);
8781        }
8782    };
8783
8784    $.fn.smartscroll = function (fn) {
8785        return fn ? this.bind("smartscroll", fn) : this.trigger("smartscroll", ["execAsap"]);
8786    };
8787
8788
8789})(window, jQuery);
8790
8791/*
8792	--------------------------------
8793	Infinite Scroll Behavior
8794	Manual / Twitter-style
8795	--------------------------------
8796	+ https://github.com/paulirish/infinitescroll/
8797	+ version 2.0b2.110617
8798	+ Copyright 2011 Paul Irish & Luke Shumard
8799	+ Licensed under the MIT license
8800	
8801	+ Documentation: http://infinite-scroll.com/
8802	
8803*/
8804
8805(function($, undefined) {
8806	$.extend($.infinitescroll.prototype,{
8807
8808		_setup_click: function infscr_setup_click () {
8809			var opts = this.options,
8810				instance = this;
8811			// Bind nextSelector link to retrieve
8812			$(opts.nextSelector).click(function(e) {
8813				if (e.which == 1 && !e.metaKey && !e.shiftKey) {
8814					e.preventDefault();
8815					instance.retrieve();
8816				}
8817			});
8818
8819			// Define loadingStart to never hide pager
8820			instance.options.loading.start = function (opts) {
8821				opts.loading.msg
8822					.appendTo(opts.loading.selector)
8823					.show(opts.loading.speed, function () {
8824						instance.beginAjax(opts);
8825					});
8826			}
8827		},
8828		_showdonemsg_click: function infscr_showdonemsg_click () {
8829			var opts = this.options,
8830				instance = this;
8831
8832			//Do all the usual stuff
8833			opts.loading.msg
8834				.find('img')
8835				.hide()
8836				.parent()
8837				.find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
8838					$(this).parent().fadeOut('normal');
8839				});
8840
8841			//And also hide the navSelector
8842			$(opts.navSelector).fadeOut('normal');
8843
8844			// user provided callback when done
8845			opts.errorCallback.call($(opts.contentSelector)[0],'done');
8846
8847		}
8848
8849	});
8850})(jQuery);
8851
8852/*!
vendor: 5,629 bytes, lines 8853-9061
8853 * fancyBox - jQuery Plugin
8854 * version: 2.1.3 (Tue, 23 Oct 2012)
8855 * @requires jQuery v1.6 or later
8856 *
8857 * Examples at http://fancyapps.com/fancybox/
8858 * License: www.fancyapps.com/fancybox/#license
8859 *
8860 * Copyright 2012 Janis Skarnelis - [email protected]
8861 *
8862 */
8863
8864(function (window, document, $, undefined) {
8865	"use strict";
8866
8867	var W = $(window),
8868		D = $(document),
8869		F = $.fancybox = function () {
8870			F.open.apply( this, arguments );
8871		},
8872		didUpdate = null,
8873		isTouch	  = document.createTouch !== undefined,
8874
8875		isQuery	= function(obj) {
8876			return obj && obj.hasOwnProperty && obj instanceof $;
8877		},
8878		isString = function(str) {
8879			return str && $.type(str) === "string";
8880		},
8881		isPercentage = function(str) {
8882			return isString(str) && str.indexOf('%') > 0;
8883		},
8884		isScrollable = function(el) {
8885			return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
8886		},
8887		getScalar = function(orig, dim) {
8888			var value = parseInt(orig, 10) || 0;
8889
8890			if (dim && isPercentage(orig)) {
8891				value = F.getViewport()[ dim ] / 100 * value;
8892			}
8893
8894			return Math.ceil(value);
8895		},
8896		getValue = function(value, dim) {
8897			return getScalar(value, dim) + 'px';
8898		};
8899
8900	$.extend(F, {
8901		// The current version of fancyBox
8902		version: '2.1.3',
8903
8904		defaults: {
8905			padding : 15,
8906			margin  : 20,
8907
8908			width     : 800,
8909			height    : 600,
8910			minWidth  : 100,
8911			minHeight : 100,
8912			maxWidth  : 9999,
8913			maxHeight : 9999,
8914
8915			autoSize   : true,
8916			autoHeight : false,
8917			autoWidth  : false,
8918
8919			autoResize  : true,
8920			autoCenter  : !isTouch,
8921			fitToView   : true,
8922			aspectRatio : false,
8923			topRatio    : 0.5,
8924			leftRatio   : 0.5,
8925
8926			scrolling : 'auto', // 'auto', 'yes' or 'no'
8927			wrapCSS   : '',
8928
8929			arrows     : true,
8930			closeBtn   : true,
8931			closeClick : false,
8932			nextClick  : false,
8933			mouseWheel : true,
8934			autoPlay   : false,
8935			playSpeed  : 3000,
8936			preload    : 3,
8937			modal      : false,
8938			loop       : true,
8939
8940			ajax  : {
8941				dataType : 'html',
8942				headers  : { 'X-fancyBox': true }
8943			},
8944			iframe : {
8945				scrolling : 'auto',
8946				preload   : true
8947			},
8948			swf : {
8949				wmode: 'transparent',
8950				allowfullscreen   : 'true',
8951				allowscriptaccess : 'always'
8952			},
8953
8954			keys  : {
8955				next : {
8956					13 : 'left', // enter
8957					34 : 'up',   // page down
8958					39 : 'left', // right arrow
8959					40 : 'up'    // down arrow
8960				},
8961				prev : {
8962					8  : 'right',  // backspace
8963					33 : 'down',   // page up
8964					37 : 'right',  // left arrow
8965					38 : 'down'    // up arrow
8966				},
8967				close  : [27], // escape key
8968				play   : [32], // space - start/stop slideshow
8969				toggle : [70]  // letter "f" - toggle fullscreen
8970			},
8971
8972			direction : {
8973				next : 'left',
8974				prev : 'right'
8975			},
8976
8977			scrollOutside  : true,
8978
8979			// Override some properties
8980			index   : 0,
8981			type    : null,
8982			href    : null,
8983			content : null,
8984			title   : null,
8985
8986			// HTML templates
8987			tpl: {
8988				wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
8989				image    : '<img class="fancybox-image" src="{href}" alt="" />',
8990				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>',
8991				error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
8992				closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
8993				next     : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
8994				prev     : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
8995			},
8996
8997			// Properties for each animation type
8998			// Opening fancyBox
8999			openEffect  : 'fade', // 'elastic', 'fade' or 'none'
9000			openSpeed   : 250,
9001			openEasing  : 'swing',
9002			openOpacity : true,
9003			openMethod  : 'zoomIn',
9004
9005			// Closing fancyBox
9006			closeEffect  : 'fade', // 'elastic', 'fade' or 'none'
9007			closeSpeed   : 250,
9008			closeEasing  : 'swing',
9009			closeOpacity : true,
9010			closeMethod  : 'zoomOut',
9011
9012			// Changing next gallery item
9013			nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
9014			nextSpeed  : 250,
9015			nextEasing : 'swing',
9016			nextMethod : 'changeIn',
9017
9018			// Changing previous gallery item
9019			prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
9020			prevSpeed  : 250,
9021			prevEasing : 'swing',
9022			prevMethod : 'changeOut',
9023
9024			// Enable default helpers
9025			helpers : {
9026				overlay : true,
9027				title   : true
9028			},
9029
9030			// Callbacks
9031			onCancel     : $.noop, // If canceling
9032			beforeLoad   : $.noop, // Before loading
9033			afterLoad    : $.noop, // After loading
9034			beforeShow   : $.noop, // Before changing in current item
9035			afterShow    : $.noop, // After opening
9036			beforeChange : $.noop, // Before changing gallery item
9037			beforeClose  : $.noop, // Before closing
9038			afterClose   : $.noop  // After closing
9039		},
9040
9041		//Current state
9042		group    : {}, // Selected group
9043		opts     : {}, // Group options
9044		previous : null,  // Previous element
9045		coming   : null,  // Element being loaded
9046		current  : null,  // Currently loaded element
9047		isActive : false, // Is activated
9048		isOpen   : false, // Is currently open
9049		isOpened : false, // Have been fully opened at least once
9050
9051		wrap  : null,
9052		skin  : null,
9053		outer : null,
9054		inner : null,
9055
9056		player : {
9057			timer    : null,
9058			isActive : false
9059		},
9060
9061		// Loaders
vendor: 35,360 bytes, lines 9062-10545
9062		ajaxLoad   : null,
9063		imgPreload : null,
9064
9065		// Some collections
9066		transitions : {},
9067		helpers     : {},
9068
9069		/*
9070		 *	Static methods
9071		 */
9072
9073		open: function (group, opts) {
9074			if (!group) {
9075				return;
9076			}
9077
9078			if (!$.isPlainObject(opts)) {
9079				opts = {};
9080			}
9081
9082			// Close if already active
9083			if (false === F.close(true)) {
9084				return;
9085			}
9086
9087			// Normalize group
9088			if (!$.isArray(group)) {
9089				group = isQuery(group) ? $(group).get() : [group];
9090			}
9091
9092			// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
9093			$.each(group, function(i, element) {
9094				var obj = {},
9095					href,
9096					title,
9097					content,
9098					type,
9099					rez,
9100					hrefParts,
9101					selector;
9102
9103				if ($.type(element) === "object") {
9104					// Check if is DOM element
9105					if (element.nodeType) {
9106						element = $(element);
9107					}
9108
9109					if (isQuery(element)) {
9110						obj = {
9111							href    : element.data('fancybox-href') || element.attr('href'),
9112							title   : element.data('fancybox-title') || element.attr('title'),
9113							isDom   : true,
9114							element : element
9115						};
9116
9117						if ($.metadata) {
9118							$.extend(true, obj, element.metadata());
9119						}
9120
9121					} else {
9122						obj = element;
9123					}
9124				}
9125
9126				href  = opts.href  || obj.href || (isString(element) ? element : null);
9127				title = opts.title !== undefined ? opts.title : obj.title || '';
9128
9129				content = opts.content || obj.content;
9130				type    = content ? 'html' : (opts.type  || obj.type);
9131
9132				if (!type && obj.isDom) {
9133					type = element.data('fancybox-type');
9134
9135					if (!type) {
9136						rez  = element.prop('class').match(/fancybox\.(\w+)/);
9137						type = rez ? rez[1] : null;
9138					}
9139				}
9140
9141				if (isString(href)) {
9142					// Try to guess the content type
9143					if (!type) {
9144						if (F.isImage(href)) {
9145							type = 'image';
9146
9147						} else if (F.isSWF(href)) {
9148							type = 'swf';
9149
9150						} else if (href.charAt(0) === '#') {
9151							type = 'inline';
9152
9153						} else if (isString(element)) {
9154							type    = 'html';
9155							content = element;
9156						}
9157					}
9158
9159					// Split url into two pieces with source url and content selector, e.g,
9160					// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
9161					if (type === 'ajax') {
9162						hrefParts = href.split(/\s+/, 2);
9163						href      = hrefParts.shift();
9164						selector  = hrefParts.shift();
9165					}
9166				}
9167
9168				if (!content) {
9169					if (type === 'inline') {
9170						if (href) {
9171							content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
9172
9173						} else if (obj.isDom) {
9174							content = element;
9175						}
9176
9177					} else if (type === 'html') {
9178						content = href;
9179
9180					} else if (!type && !href && obj.isDom) {
9181						type    = 'inline';
9182						content = element;
9183					}
9184				}
9185
9186				$.extend(obj, {
9187					href     : href,
9188					type     : type,
9189					content  : content,
9190					title    : title,
9191					selector : selector
9192				});
9193
9194				group[ i ] = obj;
9195			});
9196
9197			// Extend the defaults
9198			F.opts = $.extend(true, {}, F.defaults, opts);
9199
9200			// All options are merged recursive except keys
9201			if (opts.keys !== undefined) {
9202				F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
9203			}
9204
9205			F.group = group;
9206
9207			return F._start(F.opts.index);
9208		},
9209
9210		// Cancel image loading or abort ajax request
9211		cancel: function () {
9212			var coming = F.coming;
9213
9214			if (!coming || false === F.trigger('onCancel')) {
9215				return;
9216			}
9217
9218			F.hideLoading();
9219
9220			if (F.ajaxLoad) {
9221				F.ajaxLoad.abort();
9222			}
9223
9224			F.ajaxLoad = null;
9225
9226			if (F.imgPreload) {
9227				F.imgPreload.onload = F.imgPreload.onerror = null;
9228			}
9229
9230			if (coming.wrap) {
9231				coming.wrap.stop(true, true).trigger('onReset').remove();
9232			}
9233
9234			F.coming = null;
9235
9236			// If the first item has been canceled, then clear everything
9237			if (!F.current) {
9238				F._afterZoomOut( coming );
9239			}
9240		},
9241
9242		// Start closing animation if is open; remove immediately if opening/closing
9243		close: function (event) {
9244			F.cancel();
9245
9246			if (false === F.trigger('beforeClose')) {
9247				return;
9248			}
9249
9250			F.unbindEvents();
9251
9252			if (!F.isActive) {
9253				return;
9254			}
9255
9256			if (!F.isOpen || event === true) {
9257				$('.fancybox-wrap').stop(true).trigger('onReset').remove();
9258
9259				F._afterZoomOut();
9260
9261			} else {
9262				F.isOpen = F.isOpened = false;
9263				F.isClosing = true;
9264
9265				$('.fancybox-item, .fancybox-nav').remove();
9266
9267				F.wrap.stop(true, true).removeClass('fancybox-opened');
9268
9269				F.transitions[ F.current.closeMethod ]();
9270			}
9271		},
9272
9273		// Manage slideshow:
9274		//   $.fancybox.play(); - toggle slideshow
9275		//   $.fancybox.play( true ); - start
9276		//   $.fancybox.play( false ); - stop
9277		play: function ( action ) {
9278			var clear = function () {
9279					clearTimeout(F.player.timer);
9280				},
9281				set = function () {
9282					clear();
9283
9284					if (F.current && F.player.isActive) {
9285						F.player.timer = setTimeout(F.next, F.current.playSpeed);
9286					}
9287				},
9288				stop = function () {
9289					clear();
9290
9291					$('body').unbind('.player');
9292
9293					F.player.isActive = false;
9294
9295					F.trigger('onPlayEnd');
9296				},
9297				start = function () {
9298					if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
9299						F.player.isActive = true;
9300
9301						$('body').bind({
9302							'afterShow.player onUpdate.player'   : set,
9303							'onCancel.player beforeClose.player' : stop,
9304							'beforeLoad.player' : clear
9305						});
9306
9307						set();
9308
9309						F.trigger('onPlayStart');
9310					}
9311				};
9312
9313			if (action === true || (!F.player.isActive && action !== false)) {
9314				start();
9315			} else {
9316				stop();
9317			}
9318		},
9319
9320		// Navigate to next gallery item
9321		next: function ( direction ) {
9322			var current = F.current;
9323
9324			if (current) {
9325				if (!isString(direction)) {
9326					direction = current.direction.next;
9327				}
9328
9329				F.jumpto(current.index + 1, direction, 'next');
9330			}
9331		},
9332
9333		// Navigate to previous gallery item
9334		prev: function ( direction ) {
9335			var current = F.current;
9336
9337			if (current) {
9338				if (!isString(direction)) {
9339					direction = current.direction.prev;
9340				}
9341
9342				F.jumpto(current.index - 1, direction, 'prev');
9343			}
9344		},
9345
9346		// Navigate to gallery item by index
9347		jumpto: function ( index, direction, router ) {
9348			var current = F.current;
9349
9350			if (!current) {
9351				return;
9352			}
9353
9354			index = getScalar(index);
9355
9356			F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
9357			F.router    = router || 'jumpto';
9358
9359			if (current.loop) {
9360				if (index < 0) {
9361					index = current.group.length + (index % current.group.length);
9362				}
9363
9364				index = index % current.group.length;
9365			}
9366
9367			if (current.group[ index ] !== undefined) {
9368				F.cancel();
9369
9370				F._start(index);
9371			}
9372		},
9373
9374		// Center inside viewport and toggle position type to fixed or absolute if needed
9375		reposition: function (e, onlyAbsolute) {
9376			var current = F.current,
9377				wrap    = current ? current.wrap : null,
9378				pos;
9379
9380			if (wrap) {
9381				pos = F._getPosition(onlyAbsolute);
9382
9383				if (e && e.type === 'scroll') {
9384					delete pos.position;
9385
9386					wrap.stop(true, true).animate(pos, 200);
9387
9388				} else {
9389					wrap.css(pos);
9390
9391					current.pos = $.extend({}, current.dim, pos);
9392				}
9393			}
9394		},
9395
9396		update: function (e) {
9397			var type = (e && e.type),
9398				anyway = !type || type === 'orientationchange';
9399
9400			if (anyway) {
9401				clearTimeout(didUpdate);
9402
9403				didUpdate = null;
9404			}
9405
9406			if (!F.isOpen || didUpdate) {
9407				return;
9408			}
9409
9410			didUpdate = setTimeout(function() {
9411				var current = F.current;
9412
9413				if (!current || F.isClosing) {
9414					return;
9415				}
9416
9417				F.wrap.removeClass('fancybox-tmp');
9418                //alert(type === 'resize');
9419				if (anyway || type === 'load' || (current.autoResize)) {
9420					F._setDimension();
9421				}
9422
9423				if (!(type === 'scroll' && current.canShrink)) {
9424					F.reposition(e);
9425				}
9426
9427				F.trigger('onUpdate');
9428
9429				didUpdate = null;
9430
9431			}, (anyway && !isTouch ? 0 : 300));
9432		},
9433
9434		// Shrink content to fit inside viewport or restore if resized
9435		toggle: function ( action ) {
9436			if (F.isOpen) {
9437				F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
9438
9439				// Help browser to restore document dimensions
9440				if (isTouch) {
9441					F.wrap.removeAttr('style').addClass('fancybox-tmp');
9442
9443					F.trigger('onUpdate');
9444				}
9445
9446				F.update();
9447			}
9448		},
9449
9450		hideLoading: function () {
9451			D.unbind('.loading');
9452
9453			$('#fancybox-loading').remove();
9454		},
9455
9456		showLoading: function () {
9457			var el, viewport;
9458
9459			F.hideLoading();
9460
9461			el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
9462
9463			// If user will press the escape-button, the request will be canceled
9464			D.bind('keydown.loading', function(e) {
9465				if ((e.which || e.keyCode) === 27) {
9466					e.preventDefault();
9467
9468					F.cancel();
9469				}
9470			});
9471
9472			if (!F.defaults.fixed) {
9473				viewport = F.getViewport();
9474
9475				el.css({
9476					position : 'absolute',
9477					top  : (viewport.h * 0.5) + viewport.y,
9478					left : (viewport.w * 0.5) + viewport.x
9479				});
9480			}
9481		},
9482
9483		getViewport: function () {
9484			var locked = (F.current && F.current.locked) || false,
9485				rez    = {
9486					x: W.scrollLeft(),
9487					y: W.scrollTop()
9488				};
9489
9490			if (locked) {
9491				rez.w = locked[0].clientWidth;
9492				rez.h = locked[0].clientHeight;
9493
9494			} else {
9495				// See http://bugs.jquery.com/ticket/6724
9496				rez.w = isTouch && window.innerWidth  ? window.innerWidth  : W.width();
9497				rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
9498			}
9499
9500			return rez;
9501		},
9502
9503		// Unbind the keyboard / clicking actions
9504		unbindEvents: function () {
9505			if (F.wrap && isQuery(F.wrap)) {
9506				F.wrap.unbind('.fb');
9507			}
9508
9509			D.unbind('.fb');
9510			W.unbind('.fb');
9511		},
9512
9513		bindEvents: function () {
9514			var current = F.current,
9515				keys;
9516
9517			if (!current) {
9518				return;
9519			}
9520
9521			// Changing document height on iOS devices triggers a 'resize' event,
9522			// that can change document height... repeating infinitely
9523			// emtheme fix bug auot scroll in IE
9524			//W.bind('orientationchange.fb' + (isTouch || $.browser.msie ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
9525			// backup
9526			W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
9527
9528			keys = current.keys;
9529
9530			if (keys) {
9531				D.bind('keydown.fb', function (e) {
9532					var code   = e.which || e.keyCode,
9533						target = e.target || e.srcElement;
9534
9535					// Skip esc key if loading, because showLoading will cancel preloading
9536					if (code === 27 && F.coming) {
9537						return false;
9538					}
9539
9540					// Ignore key combinations and key events within form elements
9541					if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
9542						$.each(keys, function(i, val) {
9543							if (current.group.length > 1 && val[ code ] !== undefined) {
9544								F[ i ]( val[ code ] );
9545
9546								e.preventDefault();
9547								return false;
9548							}
9549
9550							if ($.inArray(code, val) > -1) {
9551								F[ i ] ();
9552
9553								e.preventDefault();
9554								return false;
9555							}
9556						});
9557					}
9558				});
9559			}
9560
9561			if ($.fn.mousewheel && current.mouseWheel) {
9562				F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
9563					var target = e.target || null,
9564						parent = $(target),
9565						canScroll = false;
9566
9567					while (parent.length) {
9568						if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
9569							break;
9570						}
9571
9572						canScroll = isScrollable( parent[0] );
9573						parent    = $(parent).parent();
9574					}
9575
9576					if (delta !== 0 && !canScroll) {
9577						if (F.group.length > 1 && !current.canShrink) {
9578							if (deltaY > 0 || deltaX > 0) {
9579								F.prev( deltaY > 0 ? 'down' : 'left' );
9580
9581							} else if (deltaY < 0 || deltaX < 0) {
9582								F.next( deltaY < 0 ? 'up' : 'right' );
9583							}
9584
9585							e.preventDefault();
9586						}
9587					}
9588				});
9589			}
9590		},
9591
9592		trigger: function (event, o) {
9593			var ret, obj = o || F.coming || F.current;
9594
9595			if (!obj) {
9596				return;
9597			}
9598
9599			if ($.isFunction( obj[event] )) {
9600				ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
9601			}
9602
9603			if (ret === false) {
9604				return false;
9605			}
9606
9607			if (obj.helpers) {
9608				$.each(obj.helpers, function (helper, opts) {
9609					if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
9610						opts = $.extend(true, {}, F.helpers[helper].defaults, opts);
9611
9612						F.helpers[helper][event](opts, obj);
9613					}
9614				});
9615			}
9616
9617			$.event.trigger(event + '.fb');
9618		},
9619
9620		isImage: function (str) {
9621			return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i);
9622		},
9623
9624		isSWF: function (str) {
9625			return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
9626		},
9627
9628		_start: function (index) {
9629			var coming = {},
9630				obj,
9631				href,
9632				type,
9633				margin,
9634				padding;
9635
9636			index = getScalar( index );
9637			obj   = F.group[ index ] || null;
9638
9639			if (!obj) {
9640				return false;
9641			}
9642
9643			coming = $.extend(true, {}, F.opts, obj);
9644
9645			// Convert margin and padding properties to array - top, right, bottom, left
9646			margin  = coming.margin;
9647			padding = coming.padding;
9648
9649			if ($.type(margin) === 'number') {
9650				coming.margin = [margin, margin, margin, margin];
9651			}
9652
9653			if ($.type(padding) === 'number') {
9654				coming.padding = [padding, padding, padding, padding];
9655			}
9656
9657			// 'modal' propery is just a shortcut
9658			if (coming.modal) {
9659				$.extend(true, coming, {
9660					closeBtn   : false,
9661					closeClick : false,
9662					nextClick  : false,
9663					arrows     : false,
9664					mouseWheel : false,
9665					keys       : null,
9666					helpers: {
9667						overlay : {
9668							closeClick : false
9669						}
9670					}
9671				});
9672			}
9673
9674			// 'autoSize' property is a shortcut, too
9675			if (coming.autoSize) {
9676				coming.autoWidth = coming.autoHeight = true;
9677			}
9678
9679			if (coming.width === 'auto') {
9680				coming.autoWidth = true;
9681			}
9682
9683			if (coming.height === 'auto') {
9684				coming.autoHeight = true;
9685			}
9686
9687			/*
9688			 * Add reference to the group, so it`s possible to access from callbacks, example:
9689			 * afterLoad : function() {
9690			 *     this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
9691			 * }
9692			 */
9693
9694			coming.group  = F.group;
9695			coming.index  = index;
9696
9697			// Give a chance for callback or helpers to update coming item (type, title, etc)
9698			F.coming = coming;
9699
9700			if (false === F.trigger('beforeLoad')) {
9701				F.coming = null;
9702
9703				return;
9704			}
9705
9706			type = coming.type;
9707			href = coming.href;
9708
9709			if (!type) {
9710				F.coming = null;
9711
9712				//If we can not determine content type then drop silently or display next/prev item if looping through gallery
9713				if (F.current && F.router && F.router !== 'jumpto') {
9714					F.current.index = index;
9715
9716					return F[ F.router ]( F.direction );
9717				}
9718
9719				return false;
9720			}
9721
9722			F.isActive = true;
9723
9724			if (type === 'image' || type === 'swf') {
9725				coming.autoHeight = coming.autoWidth = false;
9726				coming.scrolling  = 'visible';
9727			}
9728
9729			if (type === 'image') {
9730				coming.aspectRatio = true;
9731			}
9732
9733			if (type === 'iframe' && isTouch) {
9734				coming.scrolling = 'scroll';
9735			}
9736
9737			// Build the neccessary markup
9738			coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
9739
9740			$.extend(coming, {
9741				skin  : $('.fancybox-skin',  coming.wrap),
9742				outer : $('.fancybox-outer', coming.wrap),
9743				inner : $('.fancybox-inner', coming.wrap)
9744			});
9745
9746			$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
9747				coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
9748			});
9749
9750			F.trigger('onReady');
9751
9752			// Check before try to load; 'inline' and 'html' types need content, others - href
9753			if (type === 'inline' || type === 'html') {
9754				if (!coming.content || !coming.content.length) {
9755					return F._error( 'content' );
9756				}
9757
9758			} else if (!href) {
9759				return F._error( 'href' );
9760			}
9761
9762			if (type === 'image') {
9763				F._loadImage();
9764
9765			} else if (type === 'ajax') {
9766				F._loadAjax();
9767
9768			} else if (type === 'iframe') {
9769				F._loadIframe();
9770
9771			} else {
9772				F._afterLoad();
9773			}
9774		},
9775
9776		_error: function ( type ) {
9777			$.extend(F.coming, {
9778				type       : 'html',
9779				autoWidth  : true,
9780				autoHeight : true,
9781				minWidth   : 0,
9782				minHeight  : 0,
9783				scrolling  : 'no',
9784				hasError   : type,
9785				content    : F.coming.tpl.error
9786			});
9787
9788			F._afterLoad();
9789		},
9790
9791		_loadImage: function () {
9792			// Reset preload image so it is later possible to check "complete" property
9793			var img = F.imgPreload = new Image();
9794
9795			img.onload = function () {
9796				this.onload = this.onerror = null;
9797
9798				F.coming.width  = this.width;
9799				F.coming.height = this.height;
9800
9801				F._afterLoad();
9802			};
9803
9804			img.onerror = function () {
9805				this.onload = this.onerror = null;
9806
9807				F._error( 'image' );
9808			};
9809
9810			img.src = F.coming.href;
9811
9812			if (img.complete !== true) {
9813				F.showLoading();
9814			}
9815		},
9816
9817		_loadAjax: function () {
9818			var coming = F.coming;
9819
9820			F.showLoading();
9821
9822			F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
9823				url: coming.href,
9824				error: function (jqXHR, textStatus) {
9825					if (F.coming && textStatus !== 'abort') {
9826						F._error( 'ajax', jqXHR );
9827
9828					} else {
9829						F.hideLoading();
9830					}
9831				},
9832				success: function (data, textStatus) {
9833					if (textStatus === 'success') {
9834						coming.content = data;
9835
9836						F._afterLoad();
9837					}
9838				}
9839			}));
9840		},
9841
9842		_loadIframe: function() {
9843			var coming = F.coming,
9844				iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
9845					.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
9846					.attr('src', coming.href);
9847
9848			// This helps IE
9849			$(coming.wrap).bind('onReset', function () {
9850				try {
9851					$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
9852				} catch (e) {}
9853			});
9854
9855			if (coming.iframe.preload) {
9856				F.showLoading();
9857
9858				iframe.one('load', function() {
9859					$(this).data('ready', 1);
9860
9861					// iOS will lose scrolling if we resize
9862					if (!isTouch) {
9863						$(this).bind('load.fb', F.update);
9864					}
9865
9866					// Without this trick:
9867					//   - iframe won't scroll on iOS devices
9868					//   - IE7 sometimes displays empty iframe
9869					$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
9870
9871					F._afterLoad();
9872				});
9873			}
9874
9875			coming.content = iframe.appendTo( coming.inner );
9876
9877			if (!coming.iframe.preload) {
9878				F._afterLoad();
9879			}
9880		},
9881
9882		_preloadImages: function() {
9883			var group   = F.group,
9884				current = F.current,
9885				len     = group.length,
9886				cnt     = current.preload ? Math.min(current.preload, len - 1) : 0,
9887				item,
9888				i;
9889
9890			for (i = 1; i <= cnt; i += 1) {
9891				item = group[ (current.index + i ) % len ];
9892
9893				if (item.type === 'image' && item.href) {
9894					new Image().src = item.href;
9895				}
9896			}
9897		},
9898
9899		_afterLoad: function () {
9900			var coming   = F.coming,
9901				previous = F.current,
9902				placeholder = 'fancybox-placeholder',
9903				current,
9904				content,
9905				type,
9906				scrolling,
9907				href,
9908				embed;
9909
9910			F.hideLoading();
9911
9912			if (!coming || F.isActive === false) {
9913				return;
9914			}
9915
9916			if (false === F.trigger('afterLoad', coming, previous)) {
9917				coming.wrap.stop(true).trigger('onReset').remove();
9918
9919				F.coming = null;
9920
9921				return;
9922			}
9923
9924			if (previous) {
9925				F.trigger('beforeChange', previous);
9926
9927				previous.wrap.stop(true).removeClass('fancybox-opened')
9928					.find('.fancybox-item, .fancybox-nav')
9929					.remove();
9930			}
9931
9932			F.unbindEvents();
9933
9934			current   = coming;
9935			content   = coming.content;
9936			type      = coming.type;
9937			scrolling = coming.scrolling;
9938
9939			$.extend(F, {
9940				wrap  : current.wrap,
9941				skin  : current.skin,
9942				outer : current.outer,
9943				inner : current.inner,
9944				current  : current,
9945				previous : previous
9946			});
9947
9948			href = current.href;
9949
9950			switch (type) {
9951				case 'inline':
9952				case 'ajax':
9953				case 'html':
9954					if (current.selector) {
9955						content = $('<div>').html(content).find(current.selector);
9956
9957					} else if (isQuery(content)) {
9958						if (!content.data(placeholder)) {
9959							content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
9960						}
9961
9962						content = content.show().detach();
9963
9964						current.wrap.bind('onReset', function () {
9965							if ($(this).find(content).length) {
9966								content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
9967							}
9968						});
9969					}
9970				break;
9971
9972				case 'image':
9973					content = current.tpl.image.replace('{href}', href);
9974				break;
9975
9976				case 'swf':
9977					content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
9978					embed   = '';
9979
9980					$.each(current.swf, function(name, val) {
9981						content += '<param name="' + name + '" value="' + val + '"></param>';
9982						embed   += ' ' + name + '="' + val + '"';
9983					});
9984
9985					content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
9986				break;
9987			}
9988
9989			if (!(isQuery(content) && content.parent().is(current.inner))) {
9990				current.inner.append( content );
9991			}
9992
9993			// Give a chance for helpers or callbacks to update elements
9994			F.trigger('beforeShow');
9995
9996			// Set scrolling before calculating dimensions
9997			current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
9998
9999			// Set initial dimensions and start position
10000			F._setDimension();
10001
10002			F.reposition();
10003
10004			F.isOpen = false;
10005			F.coming = null;
10006
10007			F.bindEvents();
10008
10009			if (!F.isOpened) {
10010				$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
10011
10012			} else if (previous.prevMethod) {
10013				F.transitions[ previous.prevMethod ]();
10014			}
10015
10016			F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
10017
10018			F._preloadImages();
10019		},
10020
10021		_setDimension: function () {
10022			var viewport   = F.getViewport(),
10023				steps      = 0,
10024				canShrink  = false,
10025				canExpand  = false,
10026				wrap       = F.wrap,
10027				skin       = F.skin,
10028				inner      = F.inner,
10029				current    = F.current,
10030				width      = current.width,
10031				height     = current.height,
10032				minWidth   = current.minWidth,
10033				minHeight  = current.minHeight,
10034				maxWidth   = current.maxWidth,
10035				maxHeight  = current.maxHeight,
10036				scrolling  = current.scrolling,
10037				scrollOut  = current.scrollOutside ? current.scrollbarWidth : 0,
10038				margin     = current.margin,
10039				wMargin    = getScalar(margin[1] + margin[3]),
10040				hMargin    = getScalar(margin[0] + margin[2]),
10041				wPadding,
10042				hPadding,
10043				wSpace,
10044				hSpace,
10045				origWidth,
10046				origHeight,
10047				origMaxWidth,
10048				origMaxHeight,
10049				ratio,
10050				width_,
10051				height_,
10052				maxWidth_,
10053				maxHeight_,
10054				iframe,
10055				body;
10056
10057			// Reset dimensions so we could re-check actual size
10058			wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
10059
10060			wPadding = getScalar(skin.outerWidth(true)  - skin.width());
10061			hPadding = getScalar(skin.outerHeight(true) - skin.height());
10062
10063			// Any space between content and viewport (margin, padding, border, title)
10064			wSpace = wMargin + wPadding;
10065			hSpace = hMargin + hPadding;
10066
10067			origWidth  = isPercentage(width)  ? (viewport.w - wSpace) * getScalar(width)  / 100 : width;
10068			origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
10069
10070			if (current.type === 'iframe') {
10071				iframe = current.content;
10072
10073				if (current.autoHeight && iframe.data('ready') === 1) {
10074					try {
10075						if (iframe[0].contentWindow.document.location) {
10076							inner.width( origWidth ).height(9999);
10077
10078							body = iframe.contents().find('body');
10079
10080							if (scrollOut) {
10081								body.css('overflow-x', 'hidden');
10082							}
10083
10084							origHeight = body.height();
10085						}
10086
10087					} catch (e) {}
10088				}
10089
10090			} else if (current.autoWidth || current.autoHeight) {
10091				inner.addClass( 'fancybox-tmp' );
10092
10093				// Set width or height in case we need to calculate only one dimension
10094				if (!current.autoWidth) {
10095					inner.width( origWidth );
10096				}
10097
10098				if (!current.autoHeight) {
10099					inner.height( origHeight );
10100				}
10101
10102				if (current.autoWidth) {
10103					origWidth = inner.width();
10104				}
10105
10106				if (current.autoHeight) {
10107					origHeight = inner.height();
10108				}
10109
10110				inner.removeClass( 'fancybox-tmp' );
10111			}
10112
10113			width  = getScalar( origWidth );
10114			height = getScalar( origHeight );
10115
10116			ratio  = origWidth / origHeight;
10117
10118			// Calculations for the content
10119			minWidth  = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
10120			maxWidth  = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
10121
10122			minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
10123			maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
10124
10125			// These will be used to determine if wrap can fit in the viewport
10126			origMaxWidth  = maxWidth;
10127			origMaxHeight = maxHeight;
10128
10129			if (current.fitToView) {
10130				maxWidth  = Math.min(viewport.w - wSpace, maxWidth);
10131				maxHeight = Math.min(viewport.h - hSpace, maxHeight);
10132			}
10133
10134			maxWidth_  = viewport.w - wMargin;
10135			maxHeight_ = viewport.h - hMargin;
10136
10137			if (current.aspectRatio) {
10138				if (width > maxWidth) {
10139					width  = maxWidth;
10140					height = getScalar(width / ratio);
10141				}
10142
10143				if (height > maxHeight) {
10144					height = maxHeight;
10145					width  = getScalar(height * ratio);
10146				}
10147
10148				if (width < minWidth) {
10149					width  = minWidth;
10150					height = getScalar(width / ratio);
10151				}
10152
10153				if (height < minHeight) {
10154					height = minHeight;
10155					width  = getScalar(height * ratio);
10156				}
10157
10158			} else {
10159				width = Math.max(minWidth, Math.min(width, maxWidth));
10160
10161				if (current.autoHeight && current.type !== 'iframe') {
10162					inner.width( width );
10163
10164					height = inner.height();
10165				}
10166
10167				height = Math.max(minHeight, Math.min(height, maxHeight));
10168			}
10169
10170			// Try to fit inside viewport (including the title)
10171			if (current.fitToView) {
10172				inner.width( width ).height( height );
10173
10174				wrap.width( width + wPadding );
10175
10176				// Real wrap dimensions
10177				width_  = wrap.width();
10178				height_ = wrap.height();
10179
10180				if (current.aspectRatio) {
10181					while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
10182						if (steps++ > 19) {
10183							break;
10184						}
10185
10186						height = Math.max(minHeight, Math.min(maxHeight, height - 10));
10187						width  = getScalar(height * ratio);
10188
10189						if (width < minWidth) {
10190							width  = minWidth;
10191							height = getScalar(width / ratio);
10192						}
10193
10194						if (width > maxWidth) {
10195							width  = maxWidth;
10196							height = getScalar(width / ratio);
10197						}
10198
10199						inner.width( width ).height( height );
10200
10201						wrap.width( width + wPadding );
10202
10203						width_  = wrap.width();
10204						height_ = wrap.height();
10205					}
10206
10207				} else {
10208					width  = Math.max(minWidth,  Math.min(width,  width  - (width_  - maxWidth_)));
10209					height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
10210				}
10211			}
10212
10213			if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
10214				width += scrollOut;
10215			}
10216
10217			inner.width( width ).height( height );
10218
10219			wrap.width( width + wPadding );
10220
10221			width_  = wrap.width();
10222			height_ = wrap.height();
10223
10224			canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
10225			canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
10226
10227			$.extend(current, {
10228				dim : {
10229					width	: getValue( width_ ),
10230					height	: getValue( height_ )
10231				},
10232				origWidth  : origWidth,
10233				origHeight : origHeight,
10234				canShrink  : canShrink,
10235				canExpand  : canExpand,
10236				wPadding   : wPadding,
10237				hPadding   : hPadding,
10238				wrapSpace  : height_ - skin.outerHeight(true),
10239				skinSpace  : skin.height() - height
10240			});
10241
10242			if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
10243				inner.height('auto');
10244			}
10245		},
10246
10247		_getPosition: function (onlyAbsolute) {
10248			var current  = F.current,
10249				viewport = F.getViewport(),
10250				margin   = current.margin,
10251				width    = F.wrap.width()  + margin[1] + margin[3],
10252				height   = F.wrap.height() + margin[0] + margin[2],
10253				rez      = {
10254					position: 'absolute',
10255					top  : margin[0],
10256					left : margin[3]
10257				};
10258
10259			if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
10260				rez.position = 'fixed';
10261
10262			} else if (!current.locked) {
10263				rez.top  += viewport.y;
10264				rez.left += viewport.x;
10265			}
10266
10267			rez.top  = getValue(Math.max(rez.top,  rez.top  + ((viewport.h - height) * current.topRatio)));
10268			rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width)  * current.leftRatio)));
10269
10270			return rez;
10271		},
10272
10273		_afterZoomIn: function () {
10274			var current = F.current;
10275
10276			if (!current) {
10277				return;
10278			}
10279
10280			F.isOpen = F.isOpened = true;
10281
10282			F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
10283
10284			F.update();
10285
10286			// Assign a click event
10287			if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
10288				F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
10289					if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
10290						e.preventDefault();
10291
10292						F[ current.closeClick ? 'close' : 'next' ]();
10293					}
10294				});
10295			}
10296
10297			// Create a close button
10298			if (current.closeBtn) {
10299				$(current.tpl.closeBtn).appendTo(F.skin).bind( isTouch ? 'touchstart.fb' : 'click.fb', function(e) {
10300					e.preventDefault();
10301
10302					F.close();
10303				});
10304			}
10305
10306			// Create navigation arrows
10307			if (current.arrows && F.group.length > 1) {
10308				if (current.loop || current.index > 0) {
10309					$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
10310				}
10311
10312				if (current.loop || current.index < F.group.length - 1) {
10313					$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
10314				}
10315			}
10316
10317			F.trigger('afterShow');
10318
10319			// Stop the slideshow if this is the last item
10320			if (!current.loop && current.index === current.group.length - 1) {
10321				F.play( false );
10322
10323			} else if (F.opts.autoPlay && !F.player.isActive) {
10324				F.opts.autoPlay = false;
10325
10326				F.play();
10327			}
10328		},
10329
10330		_afterZoomOut: function ( obj ) {
10331			obj = obj || F.current;
10332
10333			$('.fancybox-wrap').trigger('onReset').remove();
10334
10335			$.extend(F, {
10336				group  : {},
10337				opts   : {},
10338				router : false,
10339				current   : null,
10340				isActive  : false,
10341				isOpened  : false,
10342				isOpen    : false,
10343				isClosing : false,
10344				wrap   : null,
10345				skin   : null,
10346				outer  : null,
10347				inner  : null
10348			});
10349
10350			F.trigger('afterClose', obj);
10351		}
10352	});
10353
10354	/*
10355	 *	Default transitions
10356	 */
10357
10358	F.transitions = {
10359		getOrigPosition: function () {
10360			var current  = F.current,
10361				element  = current.element,
10362				orig     = current.orig,
10363				pos      = {},
10364				width    = 50,
10365				height   = 50,
10366				hPadding = current.hPadding,
10367				wPadding = current.wPadding,
10368				viewport = F.getViewport();
10369
10370			if (!orig && current.isDom && element.is(':visible')) {
10371				orig = element.find('img:first');
10372
10373				if (!orig.length) {
10374					orig = element;
10375				}
10376			}
10377
10378			if (isQuery(orig)) {
10379				pos = orig.offset();
10380
10381				if (orig.is('img')) {
10382					width  = orig.outerWidth();
10383					height = orig.outerHeight();
10384				}
10385
10386			} else {
10387				pos.top  = viewport.y + (viewport.h - height) * current.topRatio;
10388				pos.left = viewport.x + (viewport.w - width)  * current.leftRatio;
10389			}
10390
10391			if (F.wrap.css('position') === 'fixed' || current.locked) {
10392				pos.top  -= viewport.y;
10393				pos.left -= viewport.x;
10394			}
10395
10396			pos = {
10397				top     : getValue(pos.top  - hPadding * current.topRatio),
10398				left    : getValue(pos.left - wPadding * current.leftRatio),
10399				width   : getValue(width  + wPadding),
10400				height  : getValue(height + hPadding)
10401			};
10402
10403			return pos;
10404		},
10405
10406		step: function (now, fx) {
10407			var ratio,
10408				padding,
10409				value,
10410				prop       = fx.prop,
10411				current    = F.current,
10412				wrapSpace  = current.wrapSpace,
10413				skinSpace  = current.skinSpace;
10414
10415			if (prop === 'width' || prop === 'height') {
10416				ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
10417
10418				if (F.isClosing) {
10419					ratio = 1 - ratio;
10420				}
10421
10422				padding = prop === 'width' ? current.wPadding : current.hPadding;
10423				value   = now - padding;
10424
10425				F.skin[ prop ](  getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) ) );
10426				F.inner[ prop ]( getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
10427			}
10428		},
10429
10430		zoomIn: function () {
10431			var current  = F.current,
10432				startPos = current.pos,
10433				effect   = current.openEffect,
10434				elastic  = effect === 'elastic',
10435				endPos   = $.extend({opacity : 1}, startPos);
10436
10437			// Remove "position" property that breaks older IE
10438			delete endPos.position;
10439
10440			if (elastic) {
10441				startPos = this.getOrigPosition();
10442
10443				if (current.openOpacity) {
10444					startPos.opacity = 0.1;
10445				}
10446
10447			} else if (effect === 'fade') {
10448				startPos.opacity = 0.1;
10449			}
10450
10451			F.wrap.css(startPos).animate(endPos, {
10452				duration : effect === 'none' ? 0 : current.openSpeed,
10453				easing   : current.openEasing,
10454				step     : elastic ? this.step : null,
10455				complete : F._afterZoomIn
10456			});
10457		},
10458
10459		zoomOut: function () {
10460			var current  = F.current,
10461				effect   = current.closeEffect,
10462				elastic  = effect === 'elastic',
10463				endPos   = {opacity : 0.1};
10464
10465			if (elastic) {
10466				endPos = this.getOrigPosition();
10467
10468				if (current.closeOpacity) {
10469					endPos.opacity = 0.1;
10470				}
10471			}
10472
10473			F.wrap.animate(endPos, {
10474				duration : effect === 'none' ? 0 : current.closeSpeed,
10475				easing   : current.closeEasing,
10476				step     : elastic ? this.step : null,
10477				complete : F._afterZoomOut
10478			});
10479		},
10480
10481		changeIn: function () {
10482			var current   = F.current,
10483				effect    = current.nextEffect,
10484				startPos  = current.pos,
10485				endPos    = { opacity : 1 },
10486				direction = F.direction,
10487				distance  = 200,
10488				field;
10489
10490			startPos.opacity = 0.1;
10491
10492			if (effect === 'elastic') {
10493				field = direction === 'down' || direction === 'up' ? 'top' : 'left';
10494
10495				if (direction === 'down' || direction === 'right') {
10496					startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
10497					endPos[ field ]   = '+=' + distance + 'px';
10498
10499				} else {
10500					startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
10501					endPos[ field ]   = '-=' + distance + 'px';
10502				}
10503			}
10504
10505			// Workaround for http://bugs.jquery.com/ticket/12273
10506			if (effect === 'none') {
10507				F._afterZoomIn();
10508
10509			} else {
10510				F.wrap.css(startPos).animate(endPos, {
10511					duration : current.nextSpeed,
10512					easing   : current.nextEasing,
10513					complete : function() {
10514						// This helps FireFox to properly render the box
10515						setTimeout(F._afterZoomIn, 20);
10516					}
10517				});
10518			}
10519		},
10520
10521		changeOut: function () {
10522			var previous  = F.previous,
10523				effect    = previous.prevEffect,
10524				endPos    = { opacity : 0.1 },
10525				direction = F.direction,
10526				distance  = 200;
10527
10528			if (effect === 'elastic') {
10529				endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
10530			}
10531
10532			previous.wrap.animate(endPos, {
10533				duration : effect === 'none' ? 0 : previous.prevSpeed,
10534				easing   : previous.prevEasing,
10535				complete : function () {
10536					$(this).trigger('onReset').remove();
10537				}
10538			});
10539		}
10540	};
10541
10542	/*
10543	 *	Overlay helper
10544	 */
10545
10546	F.helpers.overlay = {
10547		defaults : {
10548			closeClick : true,  // if true, fancyBox will be closed when user clicks on the overlay
10549			speedOut   : 200,   // duration of fadeOut animation
10550			showEarly  : true,  // indicates if should be opened immediately or wait until the content is ready
10551			css        : {},    // custom CSS properties
10552			locked     : !isTouch,  // if true, the content will be locked into overlay
10553			fixed      : true   // if false, the overlay CSS position property will not be set to "fixed"
10554		},
10555
10556		overlay : null,   // current handle
10557		fixed   : false,  // indicates if the overlay has position "fixed"
10558
10559		// Public methods
10560		create : function(opts) {
10561			opts = $.extend({}, this.defaults, opts);
10562
10563			if (this.overlay) {
10564				this.close();
10565			}
10566
10567			this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( 'body' );
10568			this.fixed   = false;
10569
10570			if (opts.fixed && F.defaults.fixed) {
10571				this.overlay.addClass('fancybox-overlay-fixed');
10572
10573				this.fixed = true;
10574			}
10575		},
10576
10577		open : function(opts) {
10578			var that = this;
10579
10580			opts = $.extend({}, this.defaults, opts);
10581
10582			if (this.overlay) {
10583				this.overlay.unbind('.overlay').width('auto').height('auto');
10584
10585			} else {
10586				this.create(opts);
10587			}
10588
10589			if (!this.fixed) {
10590				W.bind('resize.overlay', $.proxy( this.update, this) );
10591
10592				this.update();
10593			}
10594
10595			if (opts.closeClick) {
10596				this.overlay.bind('click.overlay', function(e) {
10597					if ($(e.target).hasClass('fancybox-overlay')) {
10598						if (F.isActive) {
10599							F.close();
10600						} else {
10601							that.close();
10602						}
10603					}
10604				});
10605			}
10606
10607			this.overlay.css( opts.css ).show();
10608		},
10609
10610		close : function() {
10611			$('.fancybox-overlay').remove();
10612
10613			W.unbind('resize.overlay');
10614
10615			this.overlay = null;
10616
10617			if (this.margin !== false) {
10618				$('body').css('margin-right', this.margin);
10619
10620				this.margin = false;
10621			}
10622
10623			if (this.el) {
10624				this.el.removeClass('fancybox-lock');
10625			}
10626		},
10627
10628		// Private, callbacks
10629
10630		update : function () {
10631			var width = '100%', offsetWidth;
10632
10633			// Reset width/height so it will not mess
10634			this.overlay.width(width).height('100%');
10635
10636			// jQuery does not return reliable result for IE
10637			if ($.browser.msie) {
10638				offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
10639
10640				if (D.width() > offsetWidth) {
10641					width = D.width();
10642				}
10643
10644			} else if (D.width() > W.width()) {
10645				width = D.width();
10646			}
10647
10648			this.overlay.width(width).height(D.height());
10649		},
10650
10651		// This is where we can manipulate DOM, because later it would cause iframes to reload
10652		onReady : function (opts, obj) {
10653			$('.fancybox-overlay').stop(true, true);
10654
10655			if (!this.overlay) {
10656				this.margin = D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false;
10657				this.el     = document.all && !document.querySelector ? $('html') : $('body');
10658
10659				this.create(opts);
10660			}
10661
10662			if (opts.locked && this.fixed) {
10663				obj.locked = this.overlay.append( obj.wrap );
10664				obj.fixed  = false;
10665			}
10666
10667			if (opts.showEarly === true) {
10668				this.beforeShow.apply(this, arguments);
10669			}
10670		},
10671
10672		beforeShow : function(opts, obj) {
10673			if (obj.locked) {
10674				this.el.addClass('fancybox-lock');
10675
10676				if (this.margin !== false) {
10677					$('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth);
10678				}
10679			}
10680
10681			this.open(opts);
10682		},
10683
10684		onUpdate : function() {
10685			if (!this.fixed) {
10686				this.update();
10687			}
10688		},
10689
10690		afterClose: function (opts) {
10691			// Remove overlay if exists and fancyBox is not opening
10692			// (e.g., it is not being open using afterClose callback)
10693			if (this.overlay && !F.isActive) {
10694				this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
10695			}
10696		}
10697	};
10698
10699	/*
10700	 *	Title helper
10701	 */
10702
10703	F.helpers.title = {
10704		defaults : {
10705			type     : 'float', // 'float', 'inside', 'outside' or 'over',
10706			position : 'bottom' // 'top' or 'bottom'
10707		},
10708
10709		beforeShow: function (opts) {
10710			var current = F.current,
10711				text    = current.title,
10712				type    = opts.type,
10713				title,
10714				target;
10715
10716			if ($.isFunction(text)) {
10717				text = text.call(current.element, current);
10718			}
10719
10720			if (!isString(text) || $.trim(text) === '') {
10721				return;
10722			}
10723
10724			title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">
10724' + text + '</div>');
10725
10726			switch (type) {
10727				case 'inside':
10728					target = F.skin;
10729				break;
10730
10731				case 'outside':
10732					target = F.wrap;
10733				break;
10734
10735				case 'over':
10736					target = F.inner;
10737				break;
10738
10739				default: // 'float'
10740					target = F.skin;
10741
10742					title.appendTo('body');
10743
10744					if ($.browser.msie) {
10745						title.width( title.width() );
10746					}
10747
10748					title.wrapInner('<span class="child"></span>');
10749
10750					//Increase bottom margin so this title will also fit into viewport
10751					F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
10752				break;
10753			}
10754
10755			title[ (opts.position === 'top' ? 'prependTo'  : 'appendTo') ](target);
10756		}
10757	};
10758
10759	// jQuery plugin initialization
10760	$.fn.fancybox = function (options) {
10761		var index,
10762			that     = $(this),
10763			selector = this.selector || '',
10764			run      = function(e) {
10765				var what = $(this).blur(), idx = index, relType, relVal;
10766
10767				if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
10768					relType = options.groupAttr || 'data-fancybox-group';
10769					relVal  = what.attr(relType);
10770
10771					if (!relVal) {
10772						relType = 'rel';
10773						relVal  = what.get(0)[ relType ];
10774					}
10775
10776					if (relVal && relVal !== '' && relVal !== 'nofollow') {
10777						what = selector.length ? $(selector) : that;
10778						what = what.filter('[' + relType + '="' + relVal + '"]');
10779						idx  = what.index(this);
10780					}
10781
10782					options.index = idx;
10783
10784					// Stop an event from bubbling if everything is fine
10785					if (F.open(what, options) !== false) {
10786						e.preventDefault();
10787					}
10788				}
10789			};
10790
10791		options = options || {};
10792		index   = options.index || 0;
10793
10794		if (!selector || options.live === false) {
10795			that.unbind('click.fb-start').bind('click.fb-start', run);
10796
10797		} else {
10798			D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
10799		}
10800
10801		this.filter('[data-fancybox-start=1]').trigger('click');
10802
10803		return this;
10804	};
10805
10806	// Tests that need a body at doc ready
10807	D.ready(function() {
10808		if ( $.scrollbarWidth === undefined ) {
10809			// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
10810			$.scrollbarWidth = function() {
10811				var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
10812					child  = parent.children(),
10813					width  = child.innerWidth() - child.height( 99 ).innerWidth();
10814
10815				parent.remove();
10816
10817				return width;
10818			};
10819		}
10820
10821		if ( $.support.fixedPosition === undefined ) {
10822			$.support.fixedPosition = (function() {
10823				var elem  = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
10824					fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
10825
10826				elem.remove();
10827
10828				return fixed;
10829			}());
10830		}
10831
10832		$.extend(F.defaults, {
10833			scrollbarWidth : $.scrollbarWidth(),
10834			fixed  : $.support.fixedPosition,
10835			parent : $('body')
10836		});
10837	});
10838
10839}(window, document, jQuery));
10840
10841/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
10842 * Licensed under the MIT License (LICENSE.txt).
10843 *
10844 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
10845 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
10846 * Thanks to: Seamus Leahy for adding deltaX and deltaY
10847 *
10848 * Version: 3.0.6
10849 * 
10850 * Requires: 1.2.2+
10851 */
10852(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]]=
10853d.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);
10854/**
10855 * EM QuickShop
10856 *
10857 * @license commercial software
10858 * @copyright (c) 2012 Codespot Software JSC - EMThemes.com. (http://www.emthemes.com)
10859 */
10860// disable QuickShop:
10861// EM_QUICKSHOP_DISABLED = true;
10862jQuery.noConflict();
10863qs = null;
10864jQuery(function($) {
10865	//get IE version
10866
10867	function ieVersion() {
10868		var rv = -1; // Return value assumes failure.
10869		if (navigator.appName == 'Microsoft Internet Explorer') {
10870			var ua = navigator.userAgent;
10871			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
10872			if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
10873		}
10874		return rv;
10875	}
10876	//read href attr in a tag
10877
10878	function readHref() {
10879		var result = arguments[0].replace(EM.QuickShop.BASE_URL, '');
10880		var patn = /catalog\/product\/view\/id\/(.*?)\//i;
10881		if (patn.test(result)) {
10882			var s = patn.exec(result);
10883			result = 'catalog/product/view/id/' + s[1];
10884		} else {
10885			result = result.replace(/\//gi, "_!_");
10886		}
10887		return result;
10888	}
10889	//string trim
10890
10891	function strTrim() {
10892		return arguments[0].replace(/^\s+|\s+$/g, "");
10893	}
10894	// quickshop init
10895	var _qsJnit = function() {
10896		var selectorObj = arguments[0];
10897		var listprod = $(selectorObj.itemClass); // selector chon tat ca cac li chua san pham tren luoi
10898		var mypath = 'quickshop/index/view/path/';
10899		var baseUrl = EM.QuickShop.BASE_URL + mypath;
10900		var _qsHref = "<a id=\"em_quickshop_handler\" href=\"#\" style=\"visibility:hidden;position:absolute;top:0;left:0\"><span>" + EM.QuickShop.QS_TEXT + "</span></a>";
10901		$(document.body).append(_qsHref);
10902		var qsHandlerImg = $('#em_quickshop_handler span');
10903		$.each(listprod, function(index, value) {
10904			if ($(value).parents(".no_quickshop").length <= 0) {
10905				var reloadurl = baseUrl;
10906				//get reload url
10907				var prodLinkTag = $(value).find(selectorObj.aClass);
10908				if (!prodLinkTag || prodLinkTag.length == 0) return;
10909				var prodHref = readHref(prodLinkTag.attr('href'));
10910				reloadurl = baseUrl + prodHref;
10911
10912				// show quickshop handle when hover product image aClass selectorObj.imgClass
10913				$(selectorObj.aClass, this).bind('mouseover', function () {
10914					var o = $(this).offset();
10915					$('#em_quickshop_handler').attr('href', reloadurl).show().css({
10916							'top': o.top+($(this).children('img').height() - qsHandlerImg.height() - 30)/2+'px',
10917							'left': o.left+($(this).children('img').width() - qsHandlerImg.width() - 40)/2+'px',
10918							'visibility': 'visible',
10919							'z-index':	999
10920					});
10921				});
10922				$(value).bind('mouseout', function() {
10923					$('#em_quickshop_handler').hide();
10924				});
10925			}
10926		});
10927		//fix bug image disapper when hover
10928		$('#em_quickshop_handler').bind('mouseover', function() {
10929			$(this).show();
10930		}).bind('click', function() {
10931			$(this).hide();
10932		});
10933		//insert quickshop popup
10934		$('#em_quickshop_handler').fancybox({
10935			'width': EM.QuickShop.QS_FRM_WIDTH,
10936			'height': EM.QuickShop.QS_FRM_HEIGHT,
10937			'autoScale': false,
10938			//			'padding': 20,
10939			//			'margin': 20,
10940			//'transitionIn'		: 'none',
10941			//'transitionOut'		: 'none',
10942			'type': 'iframe',
10943			onComplete: function() {
10944				$.fancybox.showActivity();
10945				$('#fancybox-frame').unbind('load');
10946				$('#fancybox-frame').bind('load', function() {
10947					$.fancybox.hideActivity();
10948				});
10949			}
10950		});
10951	}
10952	if ( (typeof EM_QUICKSHOP_DISABLED == 'undefined' || !EM_QUICKSHOP_DISABLED) && !isMobile ) {
10953	   _qsJnit({
10954    		itemClass: '.products-grid li.item, .products-list li.item',
10955    		//selector for each items in catalog product list,use to insert quickshop image
10956    		aClass: 'a.product-image',
10957    		//selector for each a tag in product items,give us href for one product
10958    		imgClass: '.product-image > img' //class for quickshop href
10959    	});
10960	}    
10961	qs = _qsJnit;
10962});
10963function 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)}}}
10963var 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)}};
10964;(function ($) {
10965	 $.fn.inlineStyle = function (prop) {
10966        var styles = $.trim(this.attr("style")),
10967             value;
10968		 
10969		if(styles){
10970			var arr = styles.split(";"),i;
10971			for(i = 0;i < arr.length;i++){
10972				var style = arr[i].split(":");
10973				
10974				if ($.trim(style[0]) === prop) {
10975					value = style[1];           
10976				}	
10977			}
10978		}	 
10979        return value;
10980    };
10981	
10982	$.csslider = function(el,options) {
10983		var defaults = {
10984			selector : ".slides > li.item",
10985			move : 1,
10986			speed : 400,
10987			direction : 'horizontal',
10988			textClassName : '.product-name',
10989			delay : 0,
10990			widthViewport : 0,
10991			heightViewport : 0,
10992			textPrev : 'Prev',
10993			textNext : 'Next',
10994			circular : 0,
10995			parentHidden : ''
10996		}
10997		
10998		var vars = $.extend({}, defaults, options);
10999		var slider = $(el),
11000        //touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
11001        eventType = "click",
11002		vertical = vars.direction === "vertical",
11003		auto = vars.delay > 0;
11004		slider.addClass('csslider'),
11005		rtlStyle = $('div.page').first().css('direction') == 'rtl';
11006		var time = 0;
11007		slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
11008		slider.container = $(slider.containerSelector, slider);
11009		slider.slides = $(vars.selector, slider);
11010		slider.target = 0;
11011		slider.enoughtItem = true;
11012		slider.currentHideNav = 'prev';
11013		if(vertical)
11014			slider.addClass('vertical');
11015		else
11016			slider.addClass('horizontal');
11017		slider.scrolling = false;
11018		slider.reInit = false;
11019		slider.setup = function(){
11020			slider.viewport = $('<div class="viewport"></div>');
11021			slider.viewport.append(slider.container);
11022			slider.append(slider.viewport);
11023			slider.controlNav();
11024			if(vars.widthViewport > 0){
11025				slider.viewport.width(vars.widthViewport);
11026			}
11027			if(vars.heightViewport > 0){
11028				slider.viewport.height(vars.heightViewport);
11029			}
11030			slider.init(true);
11031			slider.hammer = new Hammer(slider.container[0], {"swipe_time": 200/*,"prevent_default" : true*/});
11032			slider.touchHamer();
11033		}
11034		
11035		slider.init = function (first){
11036			if(vars.parentHidden && (slider.parents(vars.parentHidden).length > 0)){
11037				slider.curDisplay = slider.parents(vars.parentHidden).css('display');
11038				if(slider.curDisplay != 'block')
11039					slider.parents(vars.parentHidden).css({visibility:'hidden',display:'block'});
11040			}
11041			//if($(vars.textClassName,slider))
11042				//$(vars.textClassName,slider).hide();
11043			if(slider.interval && auto)
11044				clearTimeout(slider.interval);
11045			// Do not reset when slider is first loaded	
11046			if(!first)	
11047				slider.reset();
11048
11049			var maxWidth = 0,maxOuterWidth = 0,maxHeight = 0,i=0,maxHeight = 0,maxOuterHeight = 0;
11050			slider.slides.each(function(index,value){
11051				// Backup css inline for width and height
11052				if($(this).inlineStyle('width') != undefined){
11053					$(this).attr('data-width',$.trim($(this).inlineStyle('width')));
11054				}
11055				
11056				if($(this).inlineStyle('height') != undefined){
11057					$(this).attr('data-height',$.trim($(this).inlineStyle('height')));
11058				}
11059				
11060				if(maxWidth < $(this).width()){
11061					maxWidth = $(this).width();
11062					maxOuterWidth = $(this).outerWidth(true);
11063					i = index;
11064				}
11065				
11066				if(maxHeight < $(this).height()){
11067					maxHeight = $(this).height();
11068					maxOuterHeight = $(this).outerHeight(true);
11069				}
11070			});
11071			
11072			if(!vertical){ // horizontal
11073				//slider.lengthPx = Math.floor(slider.viewport.width()/maxOuterWidth)*maxOuterWidth;
11074				slider.lengthPx = slider.viewport.width();
11075				//slider.lengthPx = slider.viewport.width();
11076				if(slider.lengthPx < maxOuterWidth){
11077					slider.reInit = true;
11078					slider.container.addClass('no-float');
11079					var newWidth = slider.viewport.width() - (maxOuterWidth - maxWidth);
11080					slider.lengthPx = slider.viewport.width();
11081					var ratio = (newWidth/maxWidth);
11082					var delta = maxWidth - newWidth;
11083					maxWidth = newWidth;
11084					maxOuterWidth = maxOuterWidth - delta;
11085					//maxHeight = Math.ceil(maxHeight*ratio);
11086					//slider.slides.height(maxHeight);
11087					//$('a.product-image',slider).css('float','none');
11088				}
11089				
11090				slider.initHorizontal(maxWidth,maxOuterWidth);
11091				slider.finalInit();
11092			} else { // vertical
11093				if(slider.viewport.width() < maxOuterWidth){
11094					slider.reInit = true;
11095					slider.container.addClass('no-float');
11096					var newWidth = slider.viewport.width() - (maxOuterWidth - maxWidth);
11097					var ratio = (newWidth/maxWidth);
11098					maxWidth = newWidth;
11099					//slider.slides.width(150);
11100					slider.slides.width(maxWidth);
11101					
11102					//$('a.product-image',slider).css('float','none');
11103					/*newHeight = Math.ceil(maxHeight*ratio);
11104					var delta = maxHeight - newHeight;
11105					maxOuterHeight -= delta;
11106					maxHeight = newHeight;*/
11107					
11108					setTimeout(function(){
11109						slider.initVertical(maxHeight,maxOuterHeight);
11110						slider.finalInit();
11111					},300);
11112				} else {
11113					slider.initVertical(maxHeight,maxOuterHeight);
11114					slider.finalInit();
11115				}
11116				
11117			}
11118			//if($(vars.textClassName,slider))
11119				//$(vars.textClassName,slider).show();
11120				
11121			
11122		}
11123		
11124		slider.finalInit = function(){
11125			slider.finalTarget = slider.lengthPx - slider.container.lengthPx;	
11126			//slider.deltaTotal = slider.lengthPx - Math.floor(slider.viewport.width()/maxOuterWidth)*maxOuterWidth;
11127			slider.target = 0;
11128			slider.resetScroll();
11129			slider.slide(slider.target,vars.speed);	
11130			if(vars.circular == 0 && slider.enoughtItem){
11131				slider.prev.hide();
11132				slider.next.show();
11133				slider.currentHideNav = 'prev';
11134			}
11135			/*if(auto)
11136				slider.interval = setTimeout(slider.nextSlide,vars.delay);*/
11137			if(vars.parentHidden && (slider.parents(vars.parentHidden).length > 0)){
11138				if(slider.curDisplay != 'block')
11139					slider.parents(vars.parentHidden).css({visibility:'',display:slider.curDisplay});
11140			}
11141		}
11142		
11143		slider.initHorizontal = function(maxWidth,maxOuterWidth){
11144			slider.reInit = false;
11145			slider.slides.width(maxWidth);
11146			//var first = slider.slides.first();
11147			slider.stepLength = (maxOuterWidth)*vars.move;
11148			var lengthPx = slider.slides.length*(maxOuterWidth);
11149			slider.container.width(lengthPx);
11150			slider.container.lengthPx = lengthPx;
11151			if(slider.container.lengthPx - slider.lengthPx <= maxOuterWidth - maxWidth){
11152				slider.enoughtItem = false;
11153				slider.next.hide();
11154				slider.prev.hide();
11155			} else {
11156				slider.enoughtItem = true;
11157				slider.next.show();
11158				slider.prev.show();
11159			}
11160		}
11161		
11162		slider.initVertical = function(maxHeight,maxOuterHeight){
11163			if(slider.reInit == true){
11164				maxHeight = 0;maxOuterHeight = 0;
11165				slider.slides.each(function(index,value){
11166					$(this).attr('test-height',$(this).height());
11167					if(maxHeight < $(this).height()){
11168						maxHeight = $(this).height();
11169						
11170						maxOuterHeight = $(this).outerHeight(true);
11171					}
11172				});
11173				slider.reInit = false;
11174			}
11175			//slider.lengthPx = Math.floor(slider.viewport.height()/maxOuterHeight)*maxOuterHeight;
11176			slider.lengthPx = slider.viewport.height();
11177			//slider.lengthPx = slider.viewport.height();
11178			slider.slides.height(maxHeight);
11179			//var first = slider.slides.first();
11180			slider.stepLength = (maxOuterHeight)*vars.move;
11181			var lengthPx = slider.slides.length*(maxOuterHeight);
11182			slider.container.height(lengthPx);
11183			slider.container.lengthPx = lengthPx;
11184			if(slider.container.lengthPx - slider.lengthPx <= maxOuterHeight - maxHeight){
11185				slider.enoughtItem = false;
11186				slider.next.hide();
11187				slider.prev.hide();
11188			} else {
11189				slider.enoughtItem = true;
11190				slider.next.show();
11191				slider.prev.show();
11192			}
11193		}
11194		
11195		slider.reset = function(){
11196			slider.container.css('height','');
11197			slider.slides.css('height','');
11198			slider.container.css('width','');
11199			slider.slides.css('width','');
11200			if($('a.product-image',slider).length > 0)
11201				$('a.product-image',slider).css('float','');
11202			// Restore css inline
11203			if(slider.slides.attr('data-width')){
11204				slider.slides.css('width',slider.slides.attr('data-width'));
11205			}
11206			if(slider.slides.attr('data-height')){
11207				slider.slides.css('height',slider.slides.attr('data-height'));
11208			}
11209			slider.container.removeClass('no-float');
11210		}
11211		
11212		slider.resetScroll = function(){
11213			slider.scrolling = false;
11214			if(auto)
11215				slider.interval = setTimeout(slider.nextSlide,vars.delay);
11216		}
11217		
11218		slider.touchHamer = function(){
11219			var targetVirtual,flow, time, distance;
11220			if(typeof addEventListener == 'function'){
11221				el.addEventListener("touchmove", function(ev){
11222					if(ev.touches.length == 1)
11223						ev.preventDefault();
11224				}, false);
11225			}
11226			
11227			function cancelEvent(event)
11228			{
11229				event = event || window.event;
11230				if(event.preventDefault){
11231					event.preventDefault();
11232					event.stopPropagation();
11233				}else{
11234					event.returnValue = false;
11235					event.cancelBubble = true;
11236				}
11237			}
11238			
11239			slider.hammer.ondragstart = function(ev) {
11240				if(slider.interval && auto)
11241					clearTimeout(slider.interval);
11242				if(slider.scrolling 
11243					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
11244					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))){
11245					return;
11246				}	
11247				targetVirtual = 0;
11248				flow = 0;
11249				time = Number( new Date() );
11250				distance = 0;
11251			}
11252			
11253			slider.hammer.ondrag = function(ev) {
11254				if(slider.interval && auto)
11255					clearTimeout(slider.interval);
11256				if(slider.scrolling
11257					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
11258					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))
11259					|| !slider.enoughtItem){
11260					cancelEvent(ev);	
11261					return;
11262				}
11263				if(ev.touches.length > 1 || ev.scale && ev.scale !== 1 || slider.scrolling || !slider.enoughtItem){
11264					cancelEvent(ev);
11265					return;
11266				}	
11267				distance = (vertical) ? ev.distanceY : ev.distanceX;
11268				targetVirtual = slider.target + distance;
11269				if(targetVirtual > slider.stepLength/2){// last slide right
11270					flow = 1;
11271					return;
11272				}	
11273				if(slider.container.lengthPx + targetVirtual < slider.lengthPx - (slider.stepLength/2)){//first slide left
11274					flow = -1;
11275					return;
11276				}	
11277				if(vertical)
11278					slider.container.animate({ marginTop: targetVirtual + 'px'}, 0);
11279				else
11280					slider.container.animate({ marginLeft: targetVirtual + 'px'}, 0);
11281				
11282			};
11283			
11284			slider.hammer.ondragend = function(ev) {
11285				if(slider.scrolling
11286					|| (vertical && (ev.direction == 'left' || ev.direction == 'right')) 
11287					|| (!vertical && (ev.direction == 'up' || ev.direction == 'down'))
11288					|| !slider.enoughtItem){
11289					cancelEvent(ev);	
11290					return;
11291				}	
11292				//slider.hammer.cancelEvent(ev);	
11293				var oldTarget = slider.target;
11294				if(flow < 0){
11295					slider.target = slider.finalTarget;
11296					/*if(vars.circular == 0){
11297						slider.currentHideNav = 'next';
11298						slider.next.hide();
11299						slider.prev.show();
11300					}		*/			
11301				} else if(flow > 0){
11302					slider.target = 0;
11303					/*if(vars.circular == 0){
11304						slider.currentHideNav = 'prev';
11305						slider.next.show();
11306						slider.prev.hide();
11307					}*/
11308				} else {
11309					var remainDistance = Math.floor(Math.abs(distance)%slider.stepLength),remainStep;
11310					if(remainDistance < (slider.stepLength/2)){
11311						remainStep = (ev.direction == 'left' || ev.direction == 'up') ? remainDistance : remainDistance*(-1);
11312					} else {
11313						remainStep = (ev.direction == 'left' || ev.direction == 'up') ? (slider.stepLength-remainDistance)*(-1) : (slider.stepLength-remainDistance);
11314					}
11315					slider.target = targetVirtual + remainStep;
11316					
11317				}
11318		
11319				if(vars.circular == 0 && (oldTarget != slider.target)){
11320					if(ev.direction == 'left' || ev.direction == 'up'){ // next slide
11321						slider.checkNextSlide();
11322					} else {
11323						slider.checkPrevSlide();
11324					}
11325				}
11326		
11327				slider.slide(slider.target,vars.speed);
11328			};
11329			
11330			slider.hammer.onswipe = function(ev) {
11331				if(slider.scrolling || !slider.enoughtItem){
11332					cancelEvent(ev);	
11333					return;
11334				}	
11335				if(!vertical){
11336					if(ev.direction == 'left')
11337						slider.nextSlide();
11338					else if(ev.direction == 'right')	
11339						slider.prevSlide();
11340				} else {
11341					if(ev.direction == 'up')
11342						slider.nextSlide();
11343					else if(ev.direction == 'down')	
11344						slider.prevSlide();
11345				}
11346			}
11347			
11348		}		
11349		
11350		slider.slide = function(target, durationVal){
11351			if(slider.interval && auto)
11352				clearTimeout(slider.interval);
11353			slider.scrolling = true;
11354			var targetCss = target + 'px';
11355			if(!vertical)
11356				if(rtlStyle)
11357					slider.container.animate({ marginRight: targetCss}, durationVal, 'swing',slider.resetScroll);
11358				else	
11359					slider.container.animate({ marginLeft: targetCss}, durationVal, 'swing',slider.resetScroll);
11360			else	
11361				slider.container.animate({ marginTop: targetCss}, durationVal, 'swing',slider.resetScroll);
11362		}
11363		
11364		slider.checkNextSlide = function(){
11365			if(slider.currentHideNav != 'next' && vars.circular == 0){
11366				if(slider.currentHideNav == 'prev'){
11367					slider.prev.show();
11368					slider.currentHideNav = '';
11369				}	
11370				//if(slider.container.lengthPx + slider.target - slider.stepLength <= slider.lengthPx - slider.stepLength/2){
11371				if(slider.target <= slider.finalTarget){
11372					slider.currentHideNav = 'next';
11373					slider.next.hide();
11374				} 					
11375			}	
11376		}
11377		
11378		slider.checkPrevSlide = function(){
11379			if(slider.currentHideNav != 'prev' && vars.circular == 0){	
11380				if((slider.currentHideNav == 'next')){
11381					slider.next.show();
11382					slider.currentHideNav = '';
11383				}	
11384				if(slider.target + slider.stepLength > slider.stepLength/2){
11385					slider.currentHideNav = 'prev';
11386					slider.prev.hide();
11387				}									
11388			}
11389		}
11390		
11391		slider.nextSlide = function(){
11392			if(!slider.scrolling && slider.enoughtItem){
11393				if(slider.interval && auto)
11394					clearTimeout(slider.interval);
11395				slider.target -= slider.stepLength;
11396				if(slider.target < slider.finalTarget ){
11397					if((vars.circular > 0) && (Math.abs(slider.target-slider.finalTarget) >= slider.stepLength))
11398						slider.target = 0;
11399					else 
11400						slider.target = slider.finalTarget;
11401				}
11402				slider.slide(slider.target,vars.speed);	
11403				
11404				// Check show/hide prev/next button when circular is disabled
11405				slider.checkNextSlide();					
11406			}
11407		}
11408		
11409		slider.prevSlide = function(){
11410			if(!slider.scrolling && slider.enoughtItem){
11411				if(slider.interval && auto)
11412					clearTimeout(slider.interval);
11413				if(slider.target <= slider.finalTarget){
11414					slider.target += slider.stepLength + (Math.abs(slider.finalTarget)%slider.stepLength);
11415					if(slider.target >= 0){
11416						if((slider.target >= slider.stepLength) && (vars.circular > 0))
11417							slider.target = slider.finalTarget;
11418						else	
11419							slider.target = 0;
11420					}
11421				} else {
11422					slider.target += slider.stepLength;
11423					if(slider.target >= 0){
11424						if((slider.target >= slider.stepLength) && (vars.circular > 0))
11425							slider.target = slider.finalTarget;
11426						else	
11427							slider.target = 0;
11428					}
11429				}	
11430				slider.slide(slider.target,vars.speed);	
11431				
11432				// Check show/hide prev/next button when circular is disabled
11433				slider.checkPrevSlide();
11434			}	
11435		}
11436		
11437		slider.controlNav = function(){
11438			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>");
11439			slider.append(navHtml);
11440			slider.next = $('a.next',slider);
11441			slider.prev = $('a.prev',slider);
11442			slider.next.bind(eventType, function(event) {
11443				event.preventDefault();
11444				slider.nextSlide();
11445			});
11446			
11447			slider.prev.bind(eventType, function(event) {
11448				event.preventDefault();
11449				slider.prevSlide();
11450			});
11451		}
11452		
11453		slider.showHideNav = function(){
11454			if(slider.target < 0){
11455				slider.prev.show();
11456			} else {
11457				slider.prev.hide();
11458			}
11459		}
11460		
11461		slider.setup();
11462		$(window).resize(function() {
11463			//slider.reset();
11464			setTimeout(function(){slider.init(false);},300);
11465		});
11466	}
11467	
11468	$.fn.csslider = function(options) {
11469		return this.each(function(){
11470			new $.csslider(this,options);
11471		});
11472	}
11473})(jQuery);
11474
11475(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}}
11475);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}
11475,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)
11476function revslider_showDoubleJqueryError(sliderID){var errorMessage="Revolution Slider Error: You have some jquery.js library include that c
11476omes 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>"
11477jQuery(sliderID).show().html(errorMessage);}
11478/**************************************************************************
11479 * jquery.themepunch.revolution.js - jQuery Plugin for kenburn Slider
11480 * @version: 2.3.9 (03.04.2013)
11481 * @requires jQuery v1.7 or later (tested on 1.9)
11482 * @author ThemePunch
11483**************************************************************************/
11484
11485(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"});
11485if(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");
11485if(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);
11485if(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}
11485,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}
11485)}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}
11485);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()})}}
11485if(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"})}
11485if(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}
11485,{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
11485ight: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)
11486/*
11487 * jQuery SliderTabs v1.1
11488 * http://lopatin.github.com/sliderTabs
11489 *
11490 * Copyright 2012, Alex Lopatin
11491 * Free to use under the MIT license.
11492 * http://www.opensource.org/licenses/mit-license.php
11493 *
11494 */
11495
11496jQuery.noConflict();
11497 (function( $ ){
11498	/*
11499	 * The sliderTabs tabs class
11500	 */
11501	$.sliderTabs = function(container, options){
11502		var plugin = this;
11503
11504		var defaults = {
11505			autoplay: false,
11506			tabArrowWidth: 35,
11507			classes: {
11508				leftTabArrow: '',
11509				panel: '',
11510				panelActive: '',
11511				panelsContainer: '',
11512				rightTabArrow: '',
11513				tab: '',
11514				tabActive: '',	
11515				tabsList: ''
11516			},
11517			defaultTab: 1,
11518			height: null,
11519			indicators: false,
11520			mousewheel: false,
11521			position: "top",
11522			panelArrows: false,
11523			panelArrowsShowOnHover: false,
11524			tabs: true,
11525			tabHeight: 46,
11526			tabArrows: true,
11527			tabSlideLength: 100,
11528			tabSlideSpeed: 200,
11529			transition: 'slide',
11530			transitionEasing: 'easeOutCubic',
11531			transitionSpeed: 500,
11532			width: null
11533		};
11534
11535		// jQuery objects of important elements
11536		var $container = $(container),
11537			$indicators,
11538			$tabsList,
11539			$contentDivs,
11540			$tabsListContainer,
11541			$tabsListWrapper,
11542			$contentDivsContainer,
11543			$leftTabArrow,
11544			$rightTabArrow,
11545			$leftPanelArrow,
11546			$rightPanelArrow;
11547
11548		// Locks to stop out of sync behavior
11549		var selectLock = false,
11550			heightLock = true;
11551		
11552		var settings, minMargin;
11553
11554		// Index of currently selected tab
11555		plugin.selectedTab = defaults.defaultTab;
11556		plugin.lock = false;
11557		plugin.init = function(){
11558			settings = plugin.settings = $.extend({}, defaults, options);
11559			$container.addClass('ui-slider-tabs');
11560
11561			/* 
11562			 * Rebuild structure of container
11563			 */
11564			$contentDivs = $container.children("div").addClass('ui-slider-tab-content');//.remove();
11565			
11566			// Tabs
11567			$tabsList = $container.children("ul").addClass('ui-slider-tabs-list').remove();
11568			$tabsList.children("li").remove().appendTo($tabsList);
11569			plugin.count = $tabsList.children('li').length;
11570			$tabsListWrapper = $("<div class='ui-slider-tabs-list-wrapper'>");
11571			$tabsListContainer = $("<div class='ui-slider-tabs-list-container'>").append($tabsList).appendTo($tabsListWrapper);
11572			$tabsListContainer.find('li').css('height', settings.tabHeight+2);
11573			$tabsListContainer.find('li a').css('height', settings.tabHeight+2);
11574			
11575			// Tab arrows
11576			$leftTabArrow = $("<a href='#' class='ui-slider-left-arrow'><div></div></a>").css({
11577				'width': settings.tabArrowWidth,
11578				'height': settings.tabHeight+2
11579			}).appendTo($tabsListContainer).click(function(e){
11580				plugin.slideTabs('right', settings.tabSlideLength);
11581				return false;
11582			});
11583			$rightTabArrow = $("<a href='#' class='ui-slider-right-arrow'><div></div></a>").css({
11584				'width': settings.tabArrowWidth,
11585				'height': settings.tabHeight+2
11586			}).appendTo($tabsListContainer).click(function(e){
11587				plugin.slideTabs('left', settings.tabSlideLength);
11588				return false;
11589			});
11590
11591			// Content container
11592			$contentDivsContainer = $("<div class='ui-slider-tabs-content-container'>").append($contentDivs);
11593
11594			// Position the tabs on top or bottom
11595			if(settings.position == 'bottom')
11596				$container.append($contentDivsContainer).append($tabsListWrapper.addClass('bottom'));
11597			else
11598				$container.append($tabsListWrapper).append($contentDivsContainer);
11599			
11600
11601			if(settings.width)
11602				$container.width(parseInt(settings.width));
11603			if(settings.height)
11604				$contentDivsContainer.height(parseInt(settings.height)- settings.tabHeight);
11605
11606			// Create and show indicators
11607			if(settings.indicators)
11608				plugin.showIndicators();
11609			resizePanels();
11610
11611			// Select default tab
11612			plugin.selectTab(settings.defaultTab);
11613			plugin.slideTabs('left', 0);
11614
11615			reorderPanels();
11616
11617			
11618
11619			// When tab is clicked
11620			$container.delegate('.ui-slider-tabs-list li a', 'click', function(){
11621				if(!$(this).parent().hasClass('selected') && !selectLock){
11622					plugin.selectTab($(this).parent());
11623				}
11624				return false;
11625			});
11626
11627			// When indicator is clicked
11628			if($indicators)
11629				$indicators.delegate('.ui-slider-tabs-indicator', 'click', function(){
11630					if(!$(this).hasClass('selected') && !selectLock)
11631						plugin.selectTab($(this).index()+1);
11632				});
11633
11634			// Set classes
11635			$.each(settings.classes, function(i, c){
11636				switch(i){
11637					case 'leftTabArrow': 
11638						$leftTabArrow.addClass(c);
11639						break;
11640					case 'rightTabArrow':
11641						$rightTabArrow.addClass(c);
11642						break;
11643					case 'panel':
11644						$contentDivs.addClass(c);
11645						break;
11646					case 'panelsContainer':
11647						$contentDivsContainer.addClass(c);
11648						break;
11649					case 'tab':
11650						$tabsList.find('li').addClass(c);
11651						break;
11652					case 'tabsList':
11653						$tabsList.addClass(c);
11654						break;
11655					default:
11656						break;
11657				}
11658			});
11659
11660			// Panel arrows
11661			// Creates them if they don't exist
11662			if(settings.panelArrows)
11663				positionPanelArrows();
11664
11665			if(settings.panelArrowsShowOnHover){
11666				if($leftPanelArrow)
11667					$leftPanelArrow.addClass('showOnHover');
11668				if($rightPanelArrow)
11669					$rightPanelArrow.addClass('showOnHover');
11670			}
11671
11672			$contentDivsContainer.resize(positionPanelArrows);
11673
11674			// Make responsive to changes in dimensions
11675			$tabsListWrapper.resize(function(){
11676				resizeTabsList();
11677				resizePanels();
11678				setTimeout(function(){
11679					plugin.reCalContent(plugin.selectedTab);
11680				},500);
11681				
11682				/*if(!plugin.lock){
11683					if(plugin.selectedTab == 1)
11684						plugin.selectTab1(2);
11685					else
11686						plugin.selectTab(1);
11687				}*/
11688			});
11689			
11690			// Resize content container height if inner panels change
11691			//setInterval(function(){
11692				var $panel = $contentDivsContainer.children('.selected');
11693				//console.log(heightLock);
11694				if($panel.outerHeight() > $contentDivsContainer.outerHeight() && heightLock)
11695					resizeContentContainer($panel);
11696			//}, 100);
11697
11698			resizeTabsList();
11699
11700			// Hide tabs wrapper if option if false
11701			if(!settings.tabs)
11702				$tabsListWrapper.hide();
11703
11704			// Auto play
11705			if(settings.autoplay)
11706				setInterval(plugin.next, settings.autoplay);
11707
11708			// Panel arrows
11709
11710			// Mousehweel
11711			if(settings.mousewheel){
11712				$container.bind('mousewheel', function(event, delta, deltaX, deltaY) {
11713					if(delta > 0)
11714						plugin.next();
11715					else if(delta < 0)
11716						plugin.prev();
11717					return false;
11718				});
11719			}
11720		}
11721
11722		/*
11723		 * Public methods
11724		 */
11725
11726		// Select tab
11727		// param: tab is a tab index (1 ... n) or jQuery object of tab li element
11728		plugin.selectTab = function(tab){
11729			heightLock = false;
11730
11731			// Find $targetPanel, the panel to show
11732			var $clicked = (typeof tab === 'number') ? $tabsList.children("li:nth-child("+tab+")") : tab;
11733			var targetId = ($clicked.find('a').attr('href')).substr(1);
11734			var $targetPanel = $contentDivsContainer.children("#"+targetId);
11735
11736			// Update selected tab
11737			plugin.selectedTab = (typeof tab === 'number') ? tab : tab.index()+1;
11738
11739			// Resize the main contant container to the size of $targetPanel
11740			resizeContentContainer($targetPanel);
11741
11742			// Lock selections until transitions finished
11743			selectLock = true;
11744
11745			// Direction to slide panel on hide
11746			var direction = ($tabsList.find('.selected').index() < $clicked.index()) ? 'left' : 'right';
11747			// Update selected classes
11748			$clicked.siblings().removeClass('selected');
11749			if(settings.classes.tabActive != '') $clicked.siblings().removeClass(settings.classes.tabActive);
11750			$clicked.addClass('selected').addClass(settings.classes.tabActive);
11751			
11752			// Hide and show appropriate panels
11753			hidePanel($contentDivsContainer.children(".ui-slider-tab-content:visible"), direction);
11754			showPanel($targetPanel);
11755
11756			// Slide tabs so that they fit in $tabsListContainer
11757			fitTabInContainer($clicked);
11758
11759			// Select the proper indicator
11760			selectIndicator();
11761		};
11762		
11763		plugin.reCalContent = function(tab){
11764			heightLock = false;
11765
11766			// Find $targetPanel, the panel to show
11767			var $clicked = (typeof tab === 'number') ? $tabsList.children("li:nth-child("+tab+")") : tab;			
11768			var targetId = ($clicked.find('a').attr('href')).substr(1);
11769			var $targetPanel = $contentDivsContainer.children("#"+targetId);
11770
11771			// Update selected tab
11772			resizeContentContainer($targetPanel);
11773			showPanel($targetPanel);
11774		};
11775
11776		// Select the next (right) panel
11777		plugin.next = function(){
11778			if(!selectLock){
11779				if(plugin.count === plugin.selectedTab)
11780					plugin.selectTab(1);
11781				else plugin.selectTab(plugin.selectedTab+1);
11782			}	
11783		};
11784
11785		// Select the previous panel
11786		plugin.prev = function(){
11787			if(!selectLock){
11788				if(plugin.selectedTab === 1)
11789					plugin.selectTab(plugin.count);
11790				else plugin.selectTab(plugin.selectedTab-1);
11791			}
11792		};
11793
11794		// Slide tabs left/right within $tabsListContainer
11795		plugin.slideTabs = function(direction, length){
11796			var margin = parseInt($tabsList.css('margin-left'));
11797			var newMargin = margin;
11798
11799			// Reset 'edge' classes on tab arrows
11800			$leftTabArrow.removeClass('edge');
11801			$rightTabArrow.removeClass('edge');
11802
11803			// Calculate delta to slide by
11804			if(direction=='right') newMargin += length;
11805			else if(direction=='left') newMargin -= length;
11806			if(newMargin >= 0) {
11807				newMargin = 0;
11808				$leftTabArrow.addClass('edge');
11809			}
11810			else if(newMargin <= minMargin){
11811				newMargin = minMargin;
11812				$rightTabArrow.addClass('edge');
11813			}
11814
11815			// Animate
11816			$tabsList.animate({'margin-left': newMargin}, settings.tabSlideSpeed);
11817		};
11818
11819		// Show panel indicators
11820		// Create indicators if they don't exist yet
11821		plugin.showIndicators = function(){
11822			if(!$indicators){
11823				$indicators = $("<div class='ui-slider-tabs-indicator-container'>");
11824				for(var i = 0; i < $contentDivs.length; i++){
11825					$indicators.append("<div class='ui-slider-tabs-indicator'></div>");
11826				}
11827				$contentDivsContainer.append($indicators);
11828			}
11829			else
11830				$indicators.show();
11831		};
11832
11833		// Hide panel indicators
11834		plugin.hideIndicators = function(){
11835			if($indicators)
11836				$indicators.hide();
11837		};
11838
11839		plugin.showTabArrows = function(){
11840			if(!settings.tabArrows)
11841				return;
11842			$leftTabArrow.show();
11843			$rightTabArrow.show();
11844			$tabsListContainer.css('margin', '0 ' + settings.tabArrowWidth + 'px');
11845			$tabsListContainer.removeClass("wrapper_no_tabs_slider");
11846			$tabsList.removeClass("ul_no_tabs_slider");
11847		};
11848		// Hide arrows that slide tabs left and right
11849		plugin.hideTabArrows = function() {
11850			$leftTabArrow.hide();
11851			$rightTabArrow.hide();
11852			$tabsListContainer.css('margin', '0');
11853			$tabsListContainer.addClass("wrapper_no_tabs_slider");
11854			$tabsList.addClass("ul_no_tabs_slider");
11855		};
11856
11857		// Show panel arrows
11858		plugin.showPanelArrows = function(){
11859			if($leftPanelArrow) $leftPanelArrow.show();
11860			if($rightPanelArrow) $rightPanelArrow.show();
11861		};
11862
11863		// Hide panel arrows
11864		plugin.hidePanelArrows = function(){
11865			if($leftPanelArrow) $leftPanelArrow.hide();
11866			if($rightPanelArrow) $rightPanelArrow.hide();
11867		};
11868
11869		/*
11870		 * Private methods
11871		 */
11872
11873		// Add the selected class to the plugin.selectedTab tab. Remove from all others.
11874		var selectIndicator = function(){
11875			if(settings.indicators && $indicators){
11876				var $indicator = $indicators.children("div:nth-child("+plugin.selectedTab+")");
11877				$indicator.siblings().removeClass('selected');
11878				$indicator.addClass('selected');
11879			}	
11880		};
11881
11882		// 	Slide tabs inside of $tabsListContainer so that the selected one fits inside
11883		var fitTabInContainer = function(tab){
11884			var tabOffset = tab.offset(),
11885				containerOffset = $tabsListContainer.offset(),
11886				leftOffset = tabOffset.left - containerOffset.left,
11887				rightOffset = (containerOffset.left + $tabsListContainer.outerWidth()) - (tabOffset.left + tab.outerWidth() );
11888			
11889			if(leftOffset < 0)
11890				plugin.slideTabs('right', -leftOffset);
11891			else if(rightOffset < 0)
11892				plugin.slideTabs('left', -rightOffset);
11893		};
11894
11895		// Reposition content panels so that they are ready to be transitioned in and out.
11896		// This depends on whether the transition is set to slide or fade
11897		var reorderPanels = function(){
11898			// Position content divs
11899			if(settings.transition == 'slide')
11900				// Move panels left/right basedon their index relative to the selected panel
11901				$tabsList.children('li').each(function(index, el){
11902					var selectedIndex = $tabsList.children('.selected').index(),
11903						thisIndex = $(el).index();
11904					var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1));
11905					if(selectedIndex < thisIndex)
11906						panel.css({left: $contentDivsContainer.width()+'px'});
11907					else if(selectedIndex > thisIndex)
11908						panel.css({left: '-'+$contentDivsContainer.width()+'px'});
11909					else
11910						panel.addClass(settings.classes.panelActive);
11911				});
11912			
11913			if(settings.transition == 'fade')
11914				// Set opacity to correct value for non selected panels.
11915				$tabsList.children('li').each(function(index, el){
11916					var selectedIndex = $tabsList.children('.selected').index(),
11917						thisIndex = $(el).index();
11918					var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1));
11919					if(selectedIndex != thisIndex)
11920						panel.css({opacity: 0});
11921					else
11922						panel.addClass(settings.classes.panelActive);
11923				});
11924		};
11925		
11926		// Object determining css properties to be animated to based on various actions, transitions, and directions
11927		var panelAnimationCSS = function(width){
11928			return {
11929					hide: {
11930						slideleft: {
11931							left: '-'+width+'px'
11932						},
11933						slideright: {
11934							left: width+'px'
11935						},
11936						fade: {
11937							opacity: 0
11938						}
11939					},
11940					show: {
11941						slide: {
11942							left: 0
11943						},
11944						fade: {
11945							opacity: 1
11946						}
11947					}
11948				}
11949		};
11950		
11951		// Transition out the passed in panel.
11952		// param: 	panel is the jQuery object of the panel to be hidden
11953		//			direction is either 'left' or 'right' for sliding transitions
11954		var hidePanel = function(panel, direction){
11955			// Calculate correct key in panelAnimationCSS
11956			if(settings.transition == 'slide')
11957				var trans = 'slide'+direction;
11958			else var trans = settings.transition;
11959
11960			// Animate the panel out
11961			panel.animate(panelAnimationCSS($contentDivsContainer.width())['hide'][trans], settings.transitionSpeed, settings.transitionEasing, function(){
11962				panel.hide();
11963				panel.removeClass('selected');
11964				//if(settings.classes.panelActive != '') panel.removeClass(settings.classes.panelActive);
11965				selectLock = false;
11966				reorderPanels();
11967			});
11968		};
11969
11970		// Transition in the parameter panel
11971		// param: 	panel is the jQuery object of the panel to be shown
11972		var showPanel = function(panel){
11973			// Show first
11974			panel.show();
11975			panel.addClass(settings.classes.panelActive).addClass('selected');
11976
11977			// Then animate css properties
11978			panel.animate(panelAnimationCSS($contentDivsContainer.width())['show'][settings.transition], settings.transitionSpeed, settings.transitionEasing, function(){
11979				selectLock = false;
11980				heightLock = true;
11981				reorderPanels();
11982			});
11983		};
11984
11985		// Animate the height of the content container to height target
11986		// params:  target (int) is the new height
11987		var resizeContentContainer = function(target){
11988			//console.log(target);
11989			//resizePanels();
11990			if(!settings.height)
11991				$contentDivsContainer.animate({
11992					height: actualHeight(target)
11993				}, 200);
11994		};
11995
11996		// Position the panel arrows
11997		var positionPanelArrows = function(){
11998			if(settings.panelArrows){
11999				// Initialize them if you need to
12000				if(!$leftPanelArrow && !$rightPanelArrow){
12001					$leftPanelArrow = $("<div class='ui-slider-tabs-leftPanelArrow'>").click(function(){
12002						plugin.prev();
12003					});
12004					$rightPanelArrow = $("<div class='ui-slider-tabs-rightPanelArrow'>").click(function(){
12005						plugin.next();
12006					});
12007
12008					$leftPanelArrow.appendTo($contentDivsContainer);
12009					$rightPanelArrow.appendTo($contentDivsContainer);
12010				}
12011
12012				// Set correct CSS 'top' attribute of each panel arrow
12013				$rightPanelArrow.css({
12014					"top": $contentDivsContainer.height()/2 - $rightPanelArrow.outerHeight()/2
12015				});
12016				$leftPanelArrow.css({
12017					"top": $contentDivsContainer.height()/2 - $leftPanelArrow.outerHeight()/2
12018				});
12019			}
12020		};
12021
12022		// Change the width of $tabsList to the sum of the outer widths of all tabs
12023		var resizeTabsList = function(){
12024			// Calculate total width
12025			var width = 0;
12026			$tabsList.children().each(function(index, element){				
12027				width += $(element).outerWidth(true);
12028			});
12029			// Set new width of $tabsList
12030			// Hack by emthemes
12031			if($.browser.msie && $.browser.version == 8){
12032				width = width-16;
12033				$tabsList.width(width + 16);
12034				if($tabsListContainer.width() < width && settings.tabArrows){
12035					plugin.showTabArrows();
12036					minMargin = $tabsListContainer.width() - width;
12037				}
12038				else plugin.hideTabArrows();
12039			}else{
12040				width = width + 10;
12041				$tabsList.width(width);
12042				if($tabsListContainer.width() < width && settings.tabArrows){
12043					plugin.showTabArrows();
12044					minMargin = $tabsListContainer.width() - width;
12045				}
12046				else plugin.hideTabArrows();
12047			}
12048			
12049			// Original version :$tabsList.width(width);
12050
12051			// Update minMargin. Hide tab arrows if no overflow
12052			//console.log(width);
12053			
12054
12055			$tabsList.animate({'margin-left': 0});
12056		}
12057
12058		// Resize indiviual panels to the width of the new container
12059		var resizePanels = function(){
12060			$contentDivs.width($contentDivsContainer.width() - ($contentDivs.outerWidth() - $contentDivs.width()));
12061		};
12062
12063		// Get height of a hidden element
12064		var actualHeight = function(element){
12065
12066			var prevCSS = {
12067				'display': element.css('display'),
12068				'left': element.css('left'),
12069				'position': element.css('position')
12070			};
12071			element.css({
12072				'display': 'normal',
12073				'left': -5000,
12074				'position': 'absolute'
12075			});
12076			var height = element.outerHeight();
12077			element.css(prevCSS);
12078
12079			return height;
12080		};
12081		
12082
12083		// Initialize the plugin
12084		plugin.init();
12085	};
12086
12087	/*
12088	 * Handle input. Call public functions and initializers
12089	 */
12090	$.fn.sliderTabs = function( data ) {
12091		return this.each(function(){
12092			var _this = $(this),
12093				plugin = _this.data('sliderTabs');
12094
12095			// Method calling logic
12096		    if (!plugin) {
12097		    	// If no plugin, initialize it
12098				plugin = new $.sliderTabs(this, data);
12099				_this.data('sliderTabs', plugin);
12100				return plugin;
12101			}
12102			if (plugin.methods[data]){
12103				// If plugin exists, call a public method
12104				return plugin.methods[ data ].apply( this, Array.prototype.slice.call( arguments, 1 ));
12105			}
12106		});
12107  	};
12108})( jQuery );
12109
12110
12111
12112
12113
12114/*
12115 * Additional easing functions
12116 * Taken from jQuery UI source code
12117 * 
12118 * https://github.com/jquery/jquery-ui
12119 */
12120
12121jQuery.extend($.easing,
12122{
12123    def: 'easeOutQuad',
12124    swing: function (x, t, b, c, d) {
12125        //alert($.easing.default);
12126        return $.easing[$.easing.def](x, t, b, c, d);
12127    },
12128    easeInQuad: function (x, t, b, c, d) {
12129        return c*(t/=d)*t + b;
12130    },
12131    easeOutQuad: function (x, t, b, c, d) {
12132        return -c *(t/=d)*(t-2) + b;
12133    },
12134    easeInOutQuad: function (x, t, b, c, d) {
12135        if ((t/=d/2) < 1) return c/2*t*t + b;
12136        return -c/2 * ((--t)*(t-2) - 1) + b;
12137    },
12138    easeInCubic: function (x, t, b, c, d) {
12139        return c*(t/=d)*t*t + b;
12140    },
12141    easeOutCubic: function (x, t, b, c, d) {
12142        return c*((t=t/d-1)*t*t + 1) + b;
12143    },
12144    easeInOutCubic: function (x, t, b, c, d) {
12145        if ((t/=d/2) < 1) return c/2*t*t*t + b;
12146        return c/2*((t-=2)*t*t + 2) + b;
12147    },
12148    easeInQuart: function (x, t, b, c, d) {
12149        return c*(t/=d)*t*t*t + b;
12150    },
12151    easeOutQuart: function (x, t, b, c, d) {
12152        return -c * ((t=t/d-1)*t*t*t - 1) + b;
12153    },
12154    easeInOutQuart: function (x, t, b, c, d) {
12155        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
12156        return -c/2 * ((t-=2)*t*t*t - 2) + b;
12157    },
12158    easeInQuint: function (x, t, b, c, d) {
12159        return c*(t/=d)*t*t*t*t + b;
12160    },
12161    easeOutQuint: function (x, t, b, c, d) {
12162        return c*((t=t/d-1)*t*t*t*t + 1) + b;
12163    },
12164    easeInOutQuint: function (x, t, b, c, d) {
12165        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
12166        return c/2*((t-=2)*t*t*t*t + 2) + b;
12167    },
12168    easeInSine: function (x, t, b, c, d) {
12169        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
12170    },
12171    easeOutSine: function (x, t, b, c, d) {
12172        return c * Math.sin(t/d * (Math.PI/2)) + b;
12173    },
12174    easeInOutSine: function (x, t, b, c, d) {
12175        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
12176    },
12177    easeInExpo: function (x, t, b, c, d) {
12178        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
12179    },
12180    easeOutExpo: function (x, t, b, c, d) {
12181        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
12182    },
12183    easeInOutExpo: function (x, t, b, c, d) {
12184        if (t==0) return b;
12185        if (t==d) return b+c;
12186        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
12187        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
12188    },
12189    easeInCirc: function (x, t, b, c, d) {
12190        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
12191    },
12192    easeOutCirc: function (x, t, b, c, d) {
12193        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
12194    },
12195    easeInOutCirc: function (x, t, b, c, d) {
12196        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
12197        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
12198    },
12199    easeInElastic: function (x, t, b, c, d) {
12200        var s=1.70158;var p=0;var a=c;
12201        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
12202        if (a < Math.abs(c)) { a=c; var s=p/4; }
12203        else var s = p/(2*Math.PI) * Math.asin (c/a);
12204        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
12205    },
12206    easeOutElastic: function (x, t, b, c, d) {
12207        var s=1.70158;var p=0;var a=c;
12208        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
12209        if (a < Math.abs(c)) { a=c; var s=p/4; }
12210        else var s = p/(2*Math.PI) * Math.asin (c/a);
12211        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
12212    },
12213    easeInOutElastic: function (x, t, b, c, d) {
12214        var s=1.70158;var p=0;var a=c;
12215        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
12216        if (a < Math.abs(c)) { a=c; var s=p/4; }
12217        else var s = p/(2*Math.PI) * Math.asin (c/a);
12218        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
12219        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
12220    },
12221    easeInBack: function (x, t, b, c, d, s) {
12222        if (s == undefined) s = 1.70158;
12223        return c*(t/=d)*t*((s+1)*t - s) + b;
12224    },
12225    easeOutBack: function (x, t, b, c, d, s) {
12226        if (s == undefined) s = 1.70158;
12227        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
12228    },
12229    easeInOutBack: function (x, t, b, c, d, s) {
12230        if (s == undefined) s = 1.70158;
12231        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
12232        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
12233    },
12234    easeInBounce: function (x, t, b, c, d) {
12235        return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
12236    },
12237    easeOutBounce: function (x, t, b, c, d) {
12238        if ((t/=d) < (1/2.75)) {
12239            return c*(7.5625*t*t) + b;
12240        } else if (t < (2/2.75)) {
12241            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
12242        } else if (t < (2.5/2.75)) {
12243            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
12244        } else {
12245            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
12246        }
12247    },
12248    easeInOutBounce: function (x, t, b, c, d) {
12249        if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
12250        return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
12251    }
12252});
12253
12254
12255
12256
12257
12258/*
12259 * The following is the jQuery Mousewheel plugin. Full credit goes to 
12260 * Brandon Aaron. (https://github.com/brandonaaron/jquery-mousewheel)
12261 * /
12262
12263
12264/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
12265 * Licensed under the MIT License (LICENSE.txt).
12266 *
12267 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
12268 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
12269 * Thanks to: Seamus Leahy for adding deltaX and deltaY
12270 *
12271 * Version: 3.0.6
12272 * 
12273 * Requires: 1.2.2+
12274 */
12275
12276(function($) {
12277
12278var types = ['DOMMouseScroll', 'mousewheel'];
12279
12280if ($.event.fixHooks) {
12281    for ( var i=types.length; i; ) {
12282        $.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
12283    }
12284}
12285
12286$.event.special.mousewheel = {
12287    setup: function() {
12288        if ( this.addEventListener ) {
12289            for ( var i=types.length; i; ) {
12290                this.addEventListener( types[--i], handler, false );
12291            }
12292        } else {
12293            this.onmousewheel = handler;
12294        }
12295    },
12296    
12297    teardown: function() {
12298        if ( this.removeEventListener ) {
12299            for ( var i=types.length; i; ) {
12300                this.removeEventListener( types[--i], handler, false );
12301            }
12302        } else {
12303            this.onmousewheel = null;
12304        }
12305    }
12306};
12307
12308$.fn.extend({
12309    mousewheel: function(fn) {
12310        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
12311    },
12312    
12313    unmousewheel: function(fn) {
12314        return this.unbind("mousewheel", fn);
12315    }
12316});
12317
12318
12319function handler(event) {
12320    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
12321    event = $.event.fix(orgEvent);
12322    event.type = "mousewheel";
12323    
12324    // Old school scrollwheel delta
12325    if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
12326    if ( orgEvent.detail     ) { delta = -orgEvent.detail/3; }
12327    
12328    // New school multidimensional scroll (touchpads) deltas
12329    deltaY = delta;
12330    
12331    // Gecko
12332    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
12333        deltaY = 0;
12334        deltaX = -1*delta;
12335    }
12336    
12337    // Webkit
12338    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
12339    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
12340    
12341    // Add event and delta to the front of the arguments
12342    args.unshift(event, delta, deltaX, deltaY);
12343    
12344    return ($.event.dispatch || $.event.handle).apply(this, args);
12345}
12346
12347})(jQuery);
12348
12349
12350
12351/*
12352 * The following is the jQuery Resize plugin. Full credit goes to 
12353 * "Cowboy" Ben Alman. (https://github.com/cowboy/jquery-resize)
12354 * /
12355
12356/*
12357 * jQuery resize event - v1.1 - 3/14/2010
12358 * http://benalman.com/projects/jquery-resize-plugin/
12359 * 
12360 * Copyright (c) 2010 "Cowboy" Ben Alman
12361 * Dual licensed under the MIT and GPL licenses.
12362 * http://benalman.com/about/license/
12363 */
12364(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}
12364var 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.