PageSourceSearch

https://www.dedoshop.com/media/js/13fd069c518309ec32a782c85c42bec4.js

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