var Prototype={Version:"1.6.1",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.*Safari/.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");var B=document.createElement("form");var A=false;if(C["__proto__"]&&(C["__proto__"]!==B["__proto__"])){A=true}C=B=null;return A})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(A){return A}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var B;for(var C=0,A=arguments.length;C<A;C++){var D=arguments[C];try{B=D();break}catch(E){}}return B}};var Class=(function(){function C(){}function B(){var E=null,F=$A(arguments);if(Object.isFunction(F[0])){E=F.shift()}function D(){this.initialize.apply(this,arguments)}Object.extend(D,Class.Methods);D.superclass=E;D.subclasses=[];if(E){C.prototype=E.prototype;D.prototype=new C;E.subclasses.push(D)}for(var G=0;G<F.length;G++){D.addMethods(F[G])}if(!D.prototype.initialize){D.prototype.initialize=Prototype.emptyFunction}D.prototype.constructor=D;return D}function A(E){var H=this.superclass&&this.superclass.prototype;var G=Object.keys(E);if(!Object.keys({toString:true}).length){if(E.toString!=Object.prototype.toString){G.push("toString")}if(E.valueOf!=Object.prototype.valueOf){G.push("valueOf")}}for(var I=0,F=G.length;I<F;I++){var D=G[I],J=E[D];if(H&&Object.isFunction(J)&&J.argumentNames().first()=="$super"){var K=J;J=(function(L){return function(){return H[L].apply(this,arguments)}})(D).wrap(K);J.valueOf=K.valueOf.bind(K);J.toString=K.toString.bind(K)}this.prototype[D]=J}return this}return{create:B,Methods:{addMethods:A}}})();(function(){var E=Object.prototype.toString;function A(S,R){for(var Q in R){S[Q]=R[Q]}return S}function N(Q){try{if(C(Q)){return"undefined"}if(Q===null){return"null"}return Q.inspect?Q.inspect():String(Q)}catch(R){if(R instanceof RangeError){return"..."}throw R}}function P(S){var T=typeof S;switch(T){case"undefined":case"function":case"unknown":return ;case"boolean":return S.toString()}if(S===null){return"null"}if(S.toJSON){return S.toJSON()}if(I(S)){return }var R=[];for(var Q in S){var U=P(S[Q]);if(!C(U)){R.push(Q.toJSON()+": "+U)}}return"{"+R.join(", ")+"}"}function G(Q){return $H(Q).toQueryString()}function D(Q){return Q&&Q.toHTML?Q.toHTML():String.interpret(Q)}function O(S){var R=[];for(var Q in S){R.push(Q)}return R}function M(S){var R=[];for(var Q in S){R.push(S[Q])}return R}function J(Q){return A({},Q)}function I(Q){return !!(Q&&Q.nodeType==1)}function F(Q){return E.call(Q)=="[object Array]"}function K(Q){return Q instanceof Hash}function B(Q){return typeof Q==="function"}function H(Q){return E.call(Q)=="[object String]"}function L(Q){return E.call(Q)=="[object Number]"}function C(Q){return typeof Q==="undefined"}A(Object,{extend:A,inspect:N,toJSON:P,toQueryString:G,toHTML:D,keys:O,values:M,clone:J,isElement:I,isArray:F,isHash:K,isFunction:B,isString:H,isNumber:L,isUndefined:C})})();Object.extend(Function.prototype,(function(){var K=Array.prototype.slice;function D(O,M){var N=O.length,L=M.length;while(L--){O[N+L]=M[L]}return O}function J(M,L){M=K.call(M,0);return D(M,L)}function C(){var L=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return L.length==1&&!L[0]?[]:L}function H(M){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var N=this,L=K.call(arguments,1);return function(){var O=J(L,arguments);return N.apply(M,O)}}function F(M){var N=this,L=K.call(arguments,1);return function(P){var O=D([P||window.event],L);return N.apply(M,O)}}function I(){if(!arguments.length){return this}var M=this,L=K.call(arguments,0);return function(){var N=J(L,arguments);return M.apply(this,N)}}function E(L){var N=this,M=K.call(arguments,1);L=L*1000;return window.setTimeout(function(){return N.apply(N,M)},L)}function A(){var L=D([0.01],arguments);return this.delay.apply(this,L)}function B(M){var L=this;return function(){var N=D([L.bind(this)],arguments);return M.apply(this,N)}}function G(){if(this._methodized){return this._methodized}var L=this;return this._methodized=function(){var M=D([this],arguments);return L.apply(null,M)}}return{argumentNames:C,bind:H,bindAsEventListener:F,curry:I,delay:E,defer:A,wrap:B,methodize:G}})());Date.prototype.toJSON=function(){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"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(A){return String(A).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(A,B){this.callback=A;this.frequency=B;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(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){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;return 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");var 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());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){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(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}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 toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===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?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,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(B,A){this.template=B.toString();this.pattern=A||Template.Pattern},evaluate:function(A){if(A&&Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(F){if(A==null){return(F[1]+"")}var C=F[1]||"";if(C=="\\"){return F[2]}var D=A,G=F[3];var B=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;F=B.exec(G);if(F==null){return C}while(F!=null){var E=F[1].startsWith("[")?F[2].replace(/\\\\]/g,"]"):F[1];D=D[E];if(null==D||""==F[3]){break}G=G.substring("["==F[3]?F[1].length:F[0].length);F=B.exec(G)}return C+String.interpret(D)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function D(Y,X){var W=0;try{this._each(function(a){Y.call(X,a,W++)})}catch(Z){if(Z!=$break){throw Z}}return this}function O(W,Z,Y){var X=-W,a=[],b=this.toArray();if(W<1){return b}while((X+=W)<b.length){a.push(b.slice(X,X+W))}return a.collect(Z,Y)}function C(X,W){X=X||Prototype.K;var Y=true;this.each(function(a,Z){Y=Y&&!!X.call(W,a,Z);if(!Y){throw $break}});return Y}function I(X,W){X=X||Prototype.K;var Y=false;this.each(function(a,Z){if(Y=!!X.call(W,a,Z)){throw $break}});return Y}function J(Y,X){Y=Y||Prototype.K;var W=[];this.each(function(a,Z){W.push(Y.call(X,a,Z))});return W}function M(X,W){var Y;this.each(function(a,Z){if(X.call(W,a,Z)){Y=a;throw $break}});return Y}function B(Y,X){var W=[];this.each(function(a,Z){if(Y.call(X,a,Z)){W.push(a)}});return W}function H(W,Z,Y){Z=Z||Prototype.K;var X=[];if(Object.isString(W)){W=new RegExp(RegExp.escape(W))}this.each(function(b,a){if(W.match(b)){X.push(Z.call(Y,b,a))}});return X}function A(W){if(Object.isFunction(this.indexOf)){if(this.indexOf(W)!=-1){return true}}var X=false;this.each(function(Y){if(Y==W){X=true;throw $break}});return X}function P(W,X){X=Object.isUndefined(X)?null:X;return this.eachSlice(W,function(Y){while(Y.length<W){Y.push(X)}return Y})}function U(W,Y,X){this.each(function(a,Z){W=Y.call(X,W,a,Z)});return W}function K(X){var W=$A(arguments).slice(1);return this.map(function(Y){return Y[X].apply(Y,W)})}function Q(X,W){X=X||Prototype.K;var Y;this.each(function(a,Z){a=X.call(W,a,Z);if(Y==null||a>=Y){Y=a}});return Y}function N(X,W){X=X||Prototype.K;var Y;this.each(function(a,Z){a=X.call(W,a,Z);if(Y==null||a<Y){Y=a}});return Y}function E(Z,X){Z=Z||Prototype.K;var Y=[],W=[];this.each(function(b,a){(Z.call(X,b,a)?Y:W).push(b)});return[Y,W]}function F(W){var X=[];this.each(function(Y){X.push(Y[W])});return X}function G(Y,X){var W=[];this.each(function(a,Z){if(!Y.call(X,a,Z)){W.push(a)}});return W}function T(X,W){return this.map(function(Z,Y){return{value:Z,criteria:X.call(W,Z,Y)}}).sort(function(d,c){var Z=d.criteria,Y=c.criteria;return Z<Y?-1:Z>Y?1:0}).pluck("value")}function R(){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 L(){return this.toArray().length}function V(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:D,eachSlice:O,all:C,every:C,any:I,some:I,collect:J,map:J,detect:M,findAll:B,select:B,filter:B,grep:H,include:A,member:A,inGroupsOf:P,inject:U,invoke:K,max:Q,min:N,partition:E,pluck:F,reject:G,sortBy:T,toArray:R,entries:R,zip:S,size:L,inspect:V,find:M}})();function $A(C){if(!C){return[]}if("toArray" in Object(C)){return C.toArray()}var A=C.length||0,B=new Array(A);while(A--){B[A]=C[A]}return B}function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}Array.from=$A;(function(){var M=Array.prototype,P=M.slice,R=M.forEach;function B(X){for(var W=0,V=this.length;W<V;W++){X(this[W])}}if(!R){R=B}function N(){this.length=0;return this}function D(){return this[0]}function G(){return this[this.length-1]}function J(){return this.select(function(V){return V!=null})}function I(){return this.inject([],function(W,V){if(Object.isArray(V)){return W.concat(V.flatten())}W.push(V);return W})}function H(){var V=P.call(arguments,0);return this.select(function(W){return !V.include(W)})}function F(V){return(V!==false?this:this.toArray())._reverse()}function L(V){return this.inject([],function(Y,X,W){if(0==W||(V?Y.last()!=X:!Y.include(X))){Y.push(X)}return Y})}function S(V){return this.uniq().findAll(function(W){return V.detect(function(X){return W===X})})}function T(){return P.call(this,0)}function K(){return this.length}function U(){return"["+this.map(Object.inspect).join(", ")+"]"}function O(){var V=[];this.each(function(W){var X=Object.toJSON(W);if(!Object.isUndefined(X)){V.push(X)}});return"["+V.join(", ")+"]"}function A(X,W){W||(W=0);var V=this.length;if(W<0){W=V+W}for(;W<V;W++){if(this[W]===X){return W}}return -1}function Q(W,V){V=isNaN(V)?this.length:(V<0?this.length+V:V)+1;var X=this.slice(0,V).reverse().indexOf(W);return(X<0)?X:V-X-1}function C(){var a=P.call(this,0),Y;for(var X=0,V=arguments.length;X<V;X++){Y=arguments[X];if(Object.isArray(Y)&&!("callee" in Y)){for(var W=0,Z=Y.length;W<Z;W++){a.push(Y[W])}}else{a.push(Y)}}return a}Object.extend(M,Enumerable);if(!M._reverse){M._reverse=M.reverse}Object.extend(M,{_each:R,clear:N,first:D,last:G,compact:J,flatten:I,without:H,reverse:F,uniq:L,intersect:S,clone:T,toArray:T,size:K,inspect:U,toJSON:O});var E=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(E){M.concat=C}if(!M.indexOf){M.indexOf=A}if(!M.lastIndexOf){M.lastIndexOf=Q}})();function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function D(Q){this._object=Object.isHash(Q)?Q.toObject():Object.clone(Q)}function E(R){for(var Q in this._object){var S=this._object[Q],T=[Q,S];T.key=Q;T.value=S;R(T)}}function K(Q,R){return this._object[Q]=R}function B(Q){if(this._object[Q]!==Object.prototype[Q]){return this._object[Q]}}function P(Q){var R=this._object[Q];delete this._object[Q];return R}function J(){return Object.clone(this._object)}function O(){return this.pluck("key")}function M(){return this.pluck("value")}function G(R){var Q=this.detect(function(S){return S.value===R});return Q&&Q.key}function I(Q){return this.clone().update(Q)}function C(Q){return new Hash(Q).inject(this,function(R,S){R.set(S.key,S.value);return R})}function A(Q,R){if(Object.isUndefined(R)){return Q}return Q+"="+encodeURIComponent(String.interpret(R))}function F(){return this.inject([],function(R,T){var Q=encodeURIComponent(T.key),S=T.value;if(S&&typeof S=="object"){if(Object.isArray(S)){return R.concat(S.map(A.curry(Q)))}}else{R.push(A(Q,S))}return R}).join("&")}function L(){return"#<Hash:{"+this.map(function(Q){return Q.map(Object.inspect).join(": ")}).join(", ")+"}>"}function N(){return Object.toJSON(this.toObject())}function H(){return new Hash(this)}return{initialize:D,_each:E,set:K,get:B,unset:P,toObject:J,toTemplateReplacements:J,keys:O,values:M,index:G,merge:I,update:C,toQueryString:F,inspect:L,toJSON:N,clone:H}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function D(){return this.toPaddedString(2,16)}function E(){return this+1}function A(K,J){$R(0,this,true).each(K,J);return this}function B(J,L){var K=this.toString(L||10);return"0".times(J-K.length)+K}function H(){return isFinite(this)?this.toString():"null"}function I(){return Math.abs(this)}function G(){return Math.round(this)}function F(){return Math.ceil(this)}function C(){return Math.floor(this)}return{toColorPart:D,succ:E,times:A,toPaddedString:B,toJSON:H,abs:I,round:G,ceil:F,floor:C}})());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(D){var E=this.start;while(this.include(E)){D(E);E=E.succ()}}function 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 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(A){this.responders._each(A)},register:function(A){if(!this.include(A)){this.responders.push(A)}},unregister:function(A){this.responders=this.responders.without(A)},dispatch:function(C,B,D,A){this.each(function(E){if(Object.isFunction(E[C])){try{E[C].apply(E,[B,D,A])}catch(F){}}})}};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.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,A,B){$super(B);this.transport=Ajax.getTransport();this.request(A)},request:function(A){this.url=A;this.method=this.options.method;var D=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){D["_method"]=this.method;this.method="post"}this.parameters=D;if(D=Object.toQueryString(D)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+D}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){D+="&_="}}}try{var B=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(B)}Ajax.Responders.dispatch("onCreate",this,B);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 B=this.options.requestHeaders;if(Object.isFunction(B.push)){for(var D=0,A=B.length;D<A;D+=2){E[B[D]]=B[D+1]}}else{$H(B).each(function(F){E[F.key]=F.value})}}for(var C in E){this.transport.setRequestHeader(C,E[C])}},success:function(){var A=this.getStatus();return !A||(A>=200&&A<300)},getStatus:function(){try{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(E){this.dispatchException(E)}var D=B.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&D&&D.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(E){this.dispatchException(E)}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)}});Ajax.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}A=decodeURIComponent(escape(A));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,C,A,B){this.container={success:(C.success||C),failure:(C.failure||(C.success?null:C))};B=Object.clone(B);var D=B.onComplete;B.onComplete=(function(F,E){this.updateContent(F.responseText);if(Object.isFunction(D)){D(F,E)}}).bind(this);$super(A,B)},updateContent:function(D){var B=this.container[this.success()?"success":"failure"],C=this.options;if(!C.evalScripts){D=D.stripScripts()}if(B=$(B)){if(C.insertion){if(Object.isString(C.insertion)){var A={};A[C.insertion]=D;B.insert(A)}else{C.insertion(B,D)}}else{B.update(D)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,C,A,B){$super(B);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=C;this.url=A;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 $(C){if(arguments.length>1){for(var D=0,A=[],B=arguments.length;D<B;D++){A.push($(arguments[D]))}return A}if(Object.isString(C)){C=document.getElementById(C)}return Element.extend(C)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,D){var C=[];var E=document.evaluate(F,$(D)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var B=0,A=E.snapshotLength;B<A;B++){C.push(Element.extend(E.snapshotItem(B)))}return C}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(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})}(function(A){var B=(function(){var E=document.createElement("form");var F=document.createElement("input");var D=document.documentElement;F.setAttribute("name","test");E.appendChild(F);D.appendChild(E);var G=E.elements?(typeof E.elements.test=="undefined"):null;D.removeChild(E);E=F=null;return G})();var C=A.Element;A.Element=function(F,E){E=E||{};F=F.toLowerCase();var D=Element.cache;if(B&&E.name){F="<"+F+' name="'+E.name+'">';delete E.name;return Element.writeAttribute(document.createElement(F),E)}if(!D[F]){D[F]=Element.extend(document.createElement(F))}return Element.writeAttribute(D[F].cloneNode(false),E)};Object.extend(A.Element,C||{});if(C){A.Element.prototype=C.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(A){return $(A).style.display!="none"},toggle:function(A){A=$(A);Element[Element.visible(A)?"hide":"show"](A);return A},hide:function(A){A=$(A);A.style.display="none";return A},show:function(A){A=$(A);A.style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:(function(){var B=(function(){var E=document.createElement("select"),F=true;E.innerHTML='<option value="test">test</option>';if(E.options&&E.options[0]){F=E.options[0].nodeName.toUpperCase()!=="OPTION"}E=null;return F})();var A=(function(){try{var E=document.createElement("table");if(E&&E.tBodies){E.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var G=typeof E.tBodies[0]=="undefined";E=null;return G}}catch(F){return true}})();var D=(function(){var E=document.createElement("script"),G=false;try{E.appendChild(document.createTextNode(""));G=!E.firstChild||E.firstChild&&E.firstChild.nodeType!==3}catch(F){G=true}E=null;return G})();function C(F,G){F=$(F);if(G&&G.toElement){G=G.toElement()}if(Object.isElement(G)){return F.update().insert(G)}G=Object.toHTML(G);var E=F.tagName.toUpperCase();if(E==="SCRIPT"&&D){F.text=G;return F}if(B||A){if(E in Element._insertionTranslations.tags){while(F.firstChild){F.removeChild(F.firstChild)}Element._getContentFromAnonymousElement(E,G.stripScripts()).each(function(H){F.appendChild(H)})}else{F.innerHTML=G.stripScripts()}}else{F.innerHTML=G.stripScripts()}G.evalScripts.bind(G).defer();return F}return C})(),replace:function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}else{if(!Object.isElement(C)){C=Object.toHTML(C);var A=B.ownerDocument.createRange();A.selectNode(B);C.evalScripts.bind(C).defer();C=A.createContextualFragment(C.stripScripts())}}B.parentNode.replaceChild(C,B);return B},insert:function(D,F){D=$(D);if(Object.isString(F)||Object.isNumber(F)||Object.isElement(F)||(F&&(F.toElement||F.toHTML))){F={bottom:F}}var E,B,C,G;for(var A in F){E=F[A];A=A.toLowerCase();B=Element._insertionTranslations[A];if(E&&E.toElement){E=E.toElement()}if(Object.isElement(E)){B(D,E);continue}E=Object.toHTML(E);C=((A=="before"||A=="after")?D.parentNode:D).tagName.toUpperCase();G=Element._getContentFromAnonymousElement(C,E.stripScripts());if(A=="top"||A=="after"){G.reverse()}G.each(B.curry(D));E.evalScripts.bind(E).defer()}return D},wrap:function(B,C,A){B=$(B);if(Object.isElement(C)){$(C).writeAttribute(A||{})}else{if(Object.isString(C)){C=new Element(C,A)}else{C=new Element("div",C)}}if(B.parentNode){B.parentNode.replaceChild(C,B)}C.appendChild(B);return C},inspect:function(A){A=$(A);var B="<"+A.tagName.toLowerCase();$H({"id":"id","className":"class"}).each(function(F){var C=F.first(),D=F.last();var E=(A[C]||"").toString();if(E){B+=" "+D+"="+E.inspect(true)}});return B+">"},recursivelyCollect:function(C,B){C=$(C);var A=[];while(C=C[B]){if(C.nodeType==1){A.push(Element.extend(C))}}return A},ancestors:function(A){return Element.recursivelyCollect(A,"parentNode")},descendants:function(A){return Element.select(A,"*")},firstDescendant:function(A){A=$(A).firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}return $(A)},immediateDescendants:function(A){if(!(A=$(A).firstChild)){return[]}while(A&&A.nodeType!=1){A=A.nextSibling}if(A){return[A].concat($(A).nextSiblings())}return[]},previousSiblings:function(A){return Element.recursivelyCollect(A,"previousSibling")},nextSiblings:function(A){return Element.recursivelyCollect(A,"nextSibling")},siblings:function(A){A=$(A);return Element.previousSiblings(A).reverse().concat(Element.nextSiblings(A))},match:function(B,A){if(Object.isString(A)){A=new Selector(A)}return A.match($(B))},up:function(C,D,B){C=$(C);if(arguments.length==1){return $(C.parentNode)}var A=Element.ancestors(C);return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)},down:function(B,C,A){B=$(B);if(arguments.length==1){return Element.firstDescendant(B)}return Object.isNumber(C)?Element.descendants(B)[C]:Element.select(B,C)[A||0]},previous:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var C=Element.previousSiblings(B);return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},next:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(B))}var C=Element.nextSiblings(B);return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},select:function(B){var A=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(B,A)},adjacent:function(B){var A=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(B.parentNode,A).without(B)},identify:function(A){A=$(A);var B=Element.readAttribute(A,"id");if(B){return B}do{B="anonymous_element_"+Element.idCounter++}while($(B));Element.writeAttribute(A,"id",B);return B},readAttribute:function(B,A){B=$(B);if(Prototype.Browser.IE){var C=Element._attributeTranslations.read;if(C.values[A]){return C.values[A](B,A)}if(C.names[A]){A=C.names[A]}if(A.include(":")){return(!B.attributes||!B.attributes[A])?null:B.attributes[A].value}}return B.getAttribute(A)},writeAttribute:function(D,C,F){D=$(D);var B={},E=Element._attributeTranslations.write;if(typeof C=="object"){B=C}else{B[C]=Object.isUndefined(F)?true:F}for(var A in B){C=E.names[A]||A;F=B[A];if(E.values[A]){C=E.values[A](D,F)}if(F===false||F===null){D.removeAttribute(C)}else{if(F===true){D.setAttribute(C,C)}else{D.setAttribute(C,F)}}}return D},getHeight:function(A){return Element.getDimensions(A).height},getWidth:function(A){return Element.getDimensions(A).width},classNames:function(A){return new Element.ClassNames(A)},hasClassName:function(B,A){if(!(B=$(B))){return }var C=B.className;return(C.length>0&&(C==A||new RegExp("(^|\\s)"+A+"(\\s|$)").test(C)))},addClassName:function(B,A){if(!(B=$(B))){return }if(!Element.hasClassName(B,A)){B.className+=(B.className?" ":"")+A}return B},removeClassName:function(B,A){if(!(B=$(B))){return }B.className=B.className.replace(new RegExp("(^|\\s+)"+A+"(\\s+|$)")," ").strip();return B},toggleClassName:function(B,A){if(!(B=$(B))){return }return Element[Element.hasClassName(B,A)?"removeClassName":"addClassName"](B,A)},cleanWhitespace:function(B){B=$(B);var C=B.firstChild;while(C){var A=C.nextSibling;if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)}C=A}return B},empty:function(A){return $(A).innerHTML.blank()},descendantOf:function(B,A){B=$(B),A=$(A);if(B.compareDocumentPosition){return(B.compareDocumentPosition(A)&8)===8}if(A.contains){return A.contains(B)&&A!==B}while(B=B.parentNode){if(B==A){return true}}return false},scrollTo:function(A){A=$(A);var B=Element.cumulativeOffset(A);window.scrollTo(B[0],B[1]);return A},getStyle:function(A,C){A=$(A);C=C=="float"?"cssFloat":C.camelize();var D=A.style[C];if(!D||D=="auto"){var B=document.defaultView.getComputedStyle(A,null);D=B?B[C]:null}if(C=="opacity"){return D?parseFloat(D):1}return D=="auto"?null:D},getOpacity:function(A){return $(A).getStyle("opacity")},setStyle:function(E,C){E=$(E);var B=E.style,D;if(Object.isString(C)){E.style.cssText+=";"+C;return C.include("opacity")?E.setOpacity(C.match(/opacity:\s*(\d?\.?\d*)/)[1]):E}for(var A in C){if(A=="opacity"){E.setOpacity(C[A])}else{B[(A=="float"||A=="cssFloat")?(Object.isUndefined(B.styleFloat)?"cssFloat":"styleFloat"):A]=C[A]}}return E},setOpacity:function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;return A},getDimensions:function(C){C=$(C);var G=Element.getStyle(C,"display");if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}}var E=C.style;var A=E.visibility;var B=E.position;var D=E.display;E.visibility="hidden";if(B!="fixed"){E.position="absolute"}E.display="block";var H=C.clientWidth;var F=C.clientHeight;E.display=D;E.position=B;E.visibility=A;return{width:H,height:F}},makePositioned:function(A){A=$(A);var B=Element.getStyle(A,"position");if(B=="static"||!B){A._madePositioned=true;A.style.position="relative";if(Prototype.Browser.Opera){A.style.top=0;A.style.left=0}}return A},undoPositioned:function(A){A=$(A);if(A._madePositioned){A._madePositioned=undefined;A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""}return A},makeClipping:function(A){A=$(A);if(A._overflow){return A}A._overflow=Element.getStyle(A,"overflow")||"auto";if(A._overflow!=="hidden"){A.style.overflow="hidden"}return A},undoClipping:function(A){A=$(A);if(!A._overflow){return A}A.style.overflow=A._overflow=="auto"?"":A._overflow;A._overflow=null;return A},cumulativeOffset:function(A){var B=0,C=0;do{B+=A.offsetTop||0;C+=A.offsetLeft||0;A=A.offsetParent}while(A);return Element._returnOffset(C,B)},positionedOffset:function(A){var B=0,D=0;do{B+=A.offsetTop||0;D+=A.offsetLeft||0;A=A.offsetParent;if(A){if(A.tagName.toUpperCase()=="BODY"){break}var C=Element.getStyle(A,"position");if(C!=="static"){break}}}while(A);return Element._returnOffset(D,B)},absolutize:function(B){B=$(B);if(Element.getStyle(B,"position")=="absolute"){return B}var A=Element.positionedOffset(B);var F=A[1];var E=A[0];var C=B.clientWidth;var D=B.clientHeight;B._originalLeft=E-parseFloat(B.style.left||0);B._originalTop=F-parseFloat(B.style.top||0);B._originalWidth=B.style.width;B._originalHeight=B.style.height;B.style.position="absolute";B.style.top=F+"px";B.style.left=E+"px";B.style.width=C+"px";B.style.height=D+"px";return B},relativize:function(A){A=$(A);if(Element.getStyle(A,"position")=="relative"){return A}A.style.position="relative";var C=parseFloat(A.style.top||0)-(A._originalTop||0);var B=parseFloat(A.style.left||0)-(A._originalLeft||0);A.style.top=C+"px";A.style.left=B+"px";A.style.height=A._originalHeight;A.style.width=A._originalWidth;return A},cumulativeScrollOffset:function(A){var B=0,C=0;do{B+=A.scrollTop||0;C+=A.scrollLeft||0;A=A.parentNode}while(A);return Element._returnOffset(C,B)},getOffsetParent:function(A){if(A.offsetParent){return $(A.offsetParent)}if(A==document.body){return $(A)}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return $(A)}}return $(document.body)},viewportOffset:function(C){var B=0,D=0;var A=C;do{B+=A.offsetTop||0;D+=A.offsetLeft||0;if(A.offsetParent==document.body&&Element.getStyle(A,"position")=="absolute"){break}}while(A=A.offsetParent);A=C;do{if(!Prototype.Browser.Opera||(A.tagName&&(A.tagName.toUpperCase()=="BODY"))){B-=A.scrollTop||0;D-=A.scrollLeft||0}}while(A=A.parentNode);return Element._returnOffset(D,B)},clonePosition:function(C,A){var D=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});A=$(A);var E=Element.viewportOffset(A);C=$(C);var F=[0,0];var B=null;if(Element.getStyle(C,"position")=="absolute"){B=Element.getOffsetParent(C);F=Element.viewportOffset(B)}if(B==document.body){F[0]-=document.body.offsetLeft;F[1]-=document.body.offsetTop}if(D.setLeft){C.style.left=(E[0]-F[0]+D.offsetLeft)+"px"}if(D.setTop){C.style.top=(E[1]-F[1]+D.offsetTop)+"px"}if(D.setWidth){C.style.width=A.offsetWidth+"px"}if(D.setHeight){C.style.height=A.offsetHeight+"px"}return C}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(A,C,D){switch(D){case"left":case"top":case"right":case"bottom":if(A(C,"position")==="static"){return null}case"height":case"width":if(!Element.visible(C)){return null}var E=parseInt(A(C,D),10);if(E!==C["offset"+D.capitalize()]){return E+"px"}var B;if(D==="height"){B=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{B=["border-left-width","padding-left","padding-right","border-right-width"]}return B.inject(E,function(G,F){var H=A(C,F);return H===null?G:G-parseInt(H,10)})+"px";default:return A(C,D)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(A,B,C){if(C==="title"){return B.title}return A(B,C)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(B,C){C=$(C);try{C.offsetParent}catch(E){return $(document.body)}var A=C.getStyle("position");if(A!=="static"){return B(C)}C.setStyle({position:"relative"});var D=B(C);C.setStyle({position:A});return D});$w("positionedOffset viewportOffset").each(function(A){Element.Methods[A]=Element.Methods[A].wrap(function(C,D){D=$(D);try{D.offsetParent}catch(G){return Element._returnOffset(0,0)}var B=D.getStyle("position");if(B!=="static"){return C(D)}var E=D.getOffsetParent();if(E&&E.getStyle("position")==="fixed"){E.setStyle({zoom:1})}D.setStyle({position:"relative"});var F=C(D);D.setStyle({position:B});return F})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(A,B){try{B.offsetParent}catch(C){return Element._returnOffset(0,0)}return A(B)});Element.Methods.getStyle=function(A,B){A=$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.Methods.setOpacity=function(C,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}C=$(C);var B=C.currentStyle;if((B&&!B.hasLayout)||(!B&&C.style.zoom=="normal")){C.style.zoom=1}var A=C.getStyle("filter"),D=C.style;if(E==1||E===""){(A=F(A))?D.filter=A:D.removeAttribute("filter");return C}else{if(E<0.00001){E=0}}D.filter=F(A)+"alpha(opacity="+(E*100)+")";return C};Element._attributeTranslations=(function(){var C="className";var B="for";var A=document.createElement("div");A.setAttribute(C,"x");if(A.className!=="x"){A.setAttribute("class","x");if(A.className==="x"){C="class"}}A=null;A=document.createElement("label");A.setAttribute(B,"x");if(A.htmlFor!=="x"){A.setAttribute("htmlFor","x");if(A.htmlFor==="x"){B="htmlFor"}}A=null;return{read:{names:{"class":C,"className":C,"for":B,"htmlFor":B},values:{_getAttr:function(D,E){return D.getAttribute(E)},_getAttr2:function(D,E){return D.getAttribute(E,2)},_getAttrNode:function(D,F){var E=D.getAttributeNode(F);return E?E.value:""},_getEv:(function(){var D=document.createElement("div");D.onclick=Prototype.emptyFunction;var F=D.getAttribute("onclick");var E;if(String(F).indexOf("{")>-1){E=function(G,H){H=G.getAttribute(H);if(!H){return null}H=H.toString();H=H.split("{")[1];H=H.split("}")[0];return H.strip()}}else{if(F===""){E=function(G,H){H=G.getAttribute(H);if(!H){return null}return H.strip()}}}D=null;return E})(),_flag:function(D,E){return $(D).hasAttribute(E)?E:null},style:function(D){return D.style.cssText.toLowerCase()},title:function(D){return D.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(A,B){A.checked=!!B},style:function(A,B){A.style.cssText=B?B:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex "+"encType maxLength readOnly longDesc frameBorder").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr2,src:A._getAttr2,type:A._getAttr,action:A._getAttrNode,disabled:A._flag,checked:A._flag,readonly:A._flag,multiple:A._flag,onload:A._getEv,onunload:A._getEv,onclick:A._getEv,ondblclick:A._getEv,onmousedown:A._getEv,onmouseup:A._getEv,onmouseover:A._getEv,onmousemove:A._getEv,onmouseout:A._getEv,onfocus:A._getEv,onblur:A._getEv,onkeypress:A._getEv,onkeydown:A._getEv,onkeyup:A._getEv,onsubmit:A._getEv,onreset:A._getEv,onselect:A._getEv,onchange:A._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function A(C){var B=C.getElementsByTagName("*"),E=[];for(var D=0,F;F=B[D];D++){if(F.tagName!=="!"){E.push(F)}}return E}Element.Methods.down=function(C,D,B){C=$(C);if(arguments.length==1){return C.firstDescendant()}return Object.isNumber(D)?A(C)[D]:Element.select(C,D)[B||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;return A}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(A,B){A=$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName.toUpperCase()=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A};Element.Methods.cumulativeOffset=function(A){var B=0,C=0;do{B+=A.offsetTop||0;C+=A.offsetLeft||0;if(A.offsetParent==document.body){if(Element.getStyle(A,"position")=="absolute"){break}}A=A.offsetParent}while(A);return Element._returnOffset(C,B)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(E,F){E=$(E);if(F&&F.toElement){F=F.toElement()}if(Object.isElement(F)){E.parentNode.replaceChild(F,E);return E}F=Object.toHTML(F);var C=E.parentNode,D=C.tagName.toUpperCase();if(Element._insertionTranslations.tags[D]){var B=E.next();var A=Element._getContentFromAnonymousElement(D,F.stripScripts());C.removeChild(E);if(B){A.each(function(G){C.insertBefore(G,B)})}else{A.each(function(G){C.appendChild(G)})}}else{E.outerHTML=F.stripScripts()}F.evalScripts.bind(F).defer();return E}}Element._returnOffset=function(A,B){var C=[A,B];C.left=A;C.top=B;return C};Element._getContentFromAnonymousElement=function(A,C){var D=new Element("div"),B=Element._insertionTranslations.tags[A];if(B){D.innerHTML=B[0]+C+B[1];B[2].times(function(){D=D.firstChild})}else{D.innerHTML=C}return $A(D.childNodes)};Element._insertionTranslations={before:function(A,B){A.parentNode.insertBefore(B,A)},top:function(A,B){A.insertBefore(B,A.firstChild)},bottom:function(A,B){A.appendChild(B)},after:function(A,B){A.parentNode.insertBefore(B,A.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]}};(function(){var A=Element._insertionTranslations.tags;Object.extend(A,{THEAD:A.TBODY,TFOOT:A.TBODY,TH:A.TD})})();Element.Methods.Simulated={hasAttribute:function(A,C){C=Element._attributeTranslations.has[C]||C;var B=$(A).getAttributeNode(C);return !!(B&&B.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(A){if(!Prototype.BrowserFeatures.ElementExtensions&&A["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=A["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}A=null})(document.createElement("div"));Element.extend=(function(){function C(G){if(typeof window.Element!="undefined"){var I=window.Element.prototype;if(I){var K="_"+(Math.random()+"").slice(2);var H=document.createElement(G);I[K]="x";var J=(H[K]!=="x");delete I[K];H=null;return J}}return false}function B(I,H){for(var G in H){var J=H[G];if(Object.isFunction(J)&&!(G in I)){I[G]=J.methodize()}}}var A=C("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(A){return function(G){if(G&&typeof G._extendedByPrototype=="undefined"){var H=G.tagName;if(H&&(/^(?:object|applet|embed)$/i.test(H))){B(G,Element.Methods);B(G,Element.Methods.Simulated);B(G,Element.Methods.ByTag[H.toUpperCase()])}}return G}}return Prototype.K}var E={},D=Element.Methods.ByTag;var F=Object.extend(function(I){if(!I||typeof I._extendedByPrototype!="undefined"||I.nodeType!=1||I==window){return I}var G=Object.clone(E),H=I.tagName.toUpperCase();if(D[H]){Object.extend(G,D[H])}B(I,G);I._extendedByPrototype=Prototype.emptyFunction;return I},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(E,Element.Methods);Object.extend(E,Element.Methods.Simulated)}}});F.refresh();return F})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};Element.addMethods=function(C){var J=Prototype.BrowserFeatures,D=Element.Methods.ByTag;if(!C){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.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)})}if(arguments.length==2){var G=C;C=arguments[1]}if(!G){Object.extend(Element.Methods,C||{})}else{if(Object.isArray(G)){G.each(A)}else{A(G)}}function A(F){F=F.toUpperCase();if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}}Object.extend(Element.Methods.ByTag[F],C)}function B(L,O,N){N=N||false;for(var F in L){var M=L[F];if(!Object.isFunction(M)){continue}if(!N||!(F in O)){O[F]=M.methodize()}}}function E(M){var F;var N={"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(N[M]){F="HTML"+N[M]+"Element"}if(window[F]){return window[F]}F="HTML"+M+"Element";if(window[F]){return window[F]}F="HTML"+M.capitalize()+"Element";if(window[F]){return window[F]}var L=document.createElement(M);var O=L["__proto__"]||L.constructor.prototype;L=null;return O}var I=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(J.ElementExtensions){B(Element.Methods,I);B(Element.Methods.Simulated,I,true)}if(J.SpecificElementExtensions){for(var K in Element.Methods.ByTag){var H=E(K);if(Object.isUndefined(H)){continue}B(D[K],H.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(D){var H=Prototype.Browser,G=document,E,C={};function A(){if(H.WebKit&&!G.evaluate){return document}if(H.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function F(B){if(!E){E=A()}C[B]="client"+B;D["get"+B]=function(){return E[C[B]]};return D["get"+B]()}D.getWidth=F.curry("Width");D.getHeight=F.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(A){if(!(A=$(A))){return }var B;if(A===window){B=0}else{if(typeof A._prototypeUID==="undefined"){A._prototypeUID=[Element.Storage.UID++]}B=A._prototypeUID[0]}if(!Element.Storage[B]){Element.Storage[B]=$H()}return Element.Storage[B]},store:function(A,B,C){if(!(A=$(A))){return }if(arguments.length===2){Element.getStorage(A).update(B)}else{Element.getStorage(A).set(B,C)}return A},retrieve:function(A,B,C){if(!(A=$(A))){return }var E=Element.getStorage(A),D=E.get(B);if(Object.isUndefined(D)){E.set(B,C);D=C}return D},clone:function(B,A){if(!(B=$(B))){return }var E=B.cloneNode(A);E._prototypeUID=void 0;if(A){var D=Element.select(E,"*"),C=D.length;while(C--){D[C]._prototypeUID=void 0}}return Element.extend(E)}});var Selector=Class.create({initialize:function(A){this.expression=A.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var A=(function(){var E=false;if(document.evaluate&&window.XPathResult){var C=document.createElement("div");C.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var B=".//*[local-name()='ul' or local-name()='UL']"+"//*[local-name()='li' or local-name()='LI']";var D=document.evaluate(B,C,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);E=(D.snapshotLength!==2);C=null}return E})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var B=this.expression;if(Prototype.Browser.WebKit&&(B.include("-of-type")||B.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(B)){return false}if(A){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(A){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return }this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var G=this.expression,H=Selector.patterns,C=Selector.xpath,F,B,A=H.length,D;if(Selector._cache[G]){this.xpath=Selector._cache[G];return }this.matcher=[".//*"];while(G&&F!=G&&(/\S/).test(G)){F=G;for(var E=0;E<A;E++){D=H[E].name;if(B=G.match(H[E].re)){this.matcher.push(Object.isFunction(C[D])?C[D](B):new Template(C[D]).evaluate(B));G=G.replace(B[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;var C=this.expression,B;switch(this.mode){case"selectorsAPI":if(A!==document){var D=A.id,E=$(A).identify();E=E.replace(/([\.:])/g,"\\$1");C="#"+E+" "+C}B=$A(A.querySelectorAll(C)).map(Element.extend);A.id=D;return B;case"xpath":return document._getElementsByXPath(this.xpath,A);default:return this.matcher(A)}},match:function(H){this.tokens=[];var M=this.expression,B=Selector.patterns,F=Selector.assertions;var A,D,E,L=B.length,C;while(M&&A!==M&&(/\S/).test(M)){A=M;for(var I=0;I<L;I++){D=B[I].re;C=B[I].name;if(E=M.match(D)){if(F[C]){this.tokens.push([C,Object.clone(E)]);M=M.replace(E[0],"")}else{return this.findElements(document).include(H)}}}}var K=true,C,J;for(var I=0,G;G=this.tokens[I];I++){C=G[0],J=G[1];if(!Selector.assertions[C](H,J)){K=false;break}}return K},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var C=document.createElement("div"),A=document.createElement("span");C.id="prototype_test_id";A.className="Test";C.appendChild(A);var B=(C.querySelector("#prototype_test_id .test")!==null);C=A=null;return B})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(A){A[1]=A[1].toLowerCase();return new Template("[@#{1}]").evaluate(A)},attr:function(A){A[1]=A[1].toLowerCase();A[3]=A[5]||A[6];return new Template(Selector.xpath.operators[A[2]]).evaluate(A)},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];if(!B){return""}if(Object.isFunction(B)){return B(A)}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]","empty":"[count(*) = 0 and (count(text()) = 0)]","checked":"[@checked]","disabled":"[(@disabled) and (@type!='hidden')]","enabled":"[not(@disabled) and (@type!='hidden')]","not":function(E){var H=E[6],C=Selector.patterns,I=Selector.xpath,A,J,G=C.length,B;var D=[];while(H&&A!=H&&(/\S/).test(H)){A=H;for(var F=0;F<G;F++){B=C[F].name;if(E=H.match(C[F].re)){J=Object.isFunction(I[B])?I[B](E):new Template(I[B]).evaluate(E);D.push("("+J.substring(1,J.length-1)+")");H=H.replace(E[0],"");break}}}return"[not("+D.join(" and ")+")]"},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)},"first-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-of-type"](A)},"last-of-type":function(A){A[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](A)},"only-of-type":function(A){var B=Selector.xpath.pseudos;return B["first-of-type"](A)+B["last-of-type"](A)},nth:function(D,B){var G,F=B[6],E;if(F=="even"){F="2n+0"}if(F=="odd"){F="2n+1"}if(G=F.match(/^(\d+)$/)){return"["+D+"= "+G[1]+"]"}if(G=F.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(G[1]=="-"){G[1]=-1}var C=G[1]?Number(G[1]):1;var A=G[2]?Number(G[2]):0;E="[((#{fragment} - #{b}) mod #{a} = 0) and "+"((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(E).evaluate({fragment:D,a:C,b:A})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(A){A[3]=(A[5]||A[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(A)},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(A,B){return B[1].toUpperCase()==A.tagName.toUpperCase()},className:function(A,B){return Element.hasClassName(A,B[1])},id:function(A,B){return A.id===B[1]},attrPresence:function(A,B){return Element.hasAttribute(A,B[1])},attr:function(B,C){var A=Element.readAttribute(B,C[1]);return A&&Selector.operators[C[2]](A,C[5]||C[6])}},handlers:{concat:function(B,A){for(var C=0,D;D=A[C];C++){B.push(D)}return B},mark:function(A){var D=Prototype.emptyFunction;for(var B=0,C;C=A[B];B++){C._countedByPrototype=D}return A},unmark:(function(){var A=(function(){var C=document.createElement("div"),E=false,B="_countedByPrototype",D="x";C[B]=D;E=(C.getAttribute(B)===D);C=null;return E})();return A?function(B){for(var C=0,D;D=B[C];C++){D.removeAttribute("_countedByPrototype")}return B}:function(B){for(var C=0,D;D=B[C];C++){D._countedByPrototype=void 0}return B}})(),index:function(F,C,G){F._countedByPrototype=Prototype.emptyFunction;if(C){for(var A=F.childNodes,D=A.length-1,B=1;D>=0;D--){var E=A[D];if(E.nodeType==1&&(!G||E._countedByPrototype)){E.nodeIndex=B++}}}else{for(var D=0,B=1,A=F.childNodes;E=A[D];D++){if(E.nodeType==1&&(!G||E._countedByPrototype)){E.nodeIndex=B++}}}},unique:function(B){if(B.length==0){return B}var D=[],E;for(var C=0,A=B.length;C<A;C++){if(typeof (E=B[C])._countedByPrototype=="undefined"){E._countedByPrototype=Prototype.emptyFunction;D.push(Element.extend(E))}}return Selector.handlers.unmark(D)},descendant:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,E.getElementsByTagName("*"))}return B},child:function(A){var E=Selector.handlers;for(var D=0,C=[],F;F=A[D];D++){for(var B=0,G;G=F.childNodes[B];B++){if(G.nodeType==1&&G.tagName!="!"){C.push(G)}}}return C},adjacent:function(A){for(var C=0,B=[],E;E=A[C];C++){var D=this.nextElementSibling(E);if(D){B.push(D)}}return B},laterSibling:function(A){var D=Selector.handlers;for(var C=0,B=[],E;E=A[C];C++){D.concat(B,Element.nextSiblings(E))}return B},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A}}return null},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A}}return null},tagName:function(A,H,F,G){var I=F.toUpperCase();var D=[],E=Selector.handlers;if(A){if(G){if(G=="descendant"){for(var C=0,B;B=A[C];C++){E.concat(D,B.getElementsByTagName(F))}return D}else{A=this[G](A)}if(F=="*"){return A}}for(var C=0,B;B=A[C];C++){if(B.tagName.toUpperCase()===I){D.push(B)}}return D}else{return H.getElementsByTagName(F)}},id:function(A,I,B,G){var H=$(B),F=Selector.handlers;if(I==document){if(!H){return[]}if(!A){return[H]}}else{if(!I.sourceIndex||I.sourceIndex<1){var A=I.getElementsByTagName("*");for(var D=0,C;C=A[D];D++){if(C.id===B){return[C]}}}}if(A){if(G){if(G=="child"){for(var E=0,C;C=A[E];E++){if(H.parentNode==C){return[H]}}}else{if(G=="descendant"){for(var E=0,C;C=A[E];E++){if(Element.descendantOf(H,C)){return[H]}}}else{if(G=="adjacent"){for(var E=0,C;C=A[E];E++){if(Selector.handlers.previousElementSibling(H)==C){return[H]}}}else{A=F[G](A)}}}}for(var E=0,C;C=A[E];E++){if(C==H){return[H]}}return[]}return(H&&Element.descendantOf(H,I))?[H]:[]},className:function(D,B,C,A){if(D&&A){D=this[A](D)}return Selector.handlers.byClassName(D,B,C)},byClassName:function(C,A,B){if(!C){C=Selector.handlers.descendant([A])}var H=" "+B+" ";for(var E=0,D=[],G,F;G=C[E];E++){F=G.className;if(F.length==0){continue}if(F==B||(" "+F+" ").include(H)){D.push(G)}}return D},attrPresence:function(D,C,A,B){if(!D){D=C.getElementsByTagName("*")}if(D&&B){D=this[B](D)}var F=[];for(var E=0,G;G=D[E];E++){if(Element.hasAttribute(G,A)){F.push(G)}}return F},attr:function(A,I,H,J,G,F){if(!A){A=I.getElementsByTagName("*")}if(A&&F){A=this[F](A)}var K=Selector.operators[G],D=[];for(var C=0,B;B=A[C];C++){var E=Element.readAttribute(B,H);if(E===null){continue}if(K(E,J)){D.push(B)}}return D},pseudo:function(C,D,E,B,A){if(C&&A){C=this[A](C)}if(!C){C=B.getElementsByTagName("*")}return Selector.pseudos[D](C,E,B)}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.previousElementSibling(E)){continue}C.push(E)}return C},"last-child":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(Selector.handlers.nextElementSibling(E)){continue}C.push(E)}return C},"only-child":function(B,G,A){var E=Selector.handlers;for(var D=0,C=[],F;F=B[D];D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)}}return C},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)},"only-of-type":function(B,D,A){var C=Selector.pseudos;return C["last-of-type"](C["first-of-type"](B,D,A),D,A)},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)}return D})},nth:function(A,B,N,L,K){if(A.length==0){return[]}if(B=="even"){B="2n+0"}if(B=="odd"){B="2n+1"}var J=Selector.handlers,I=[],C=[],E;J.mark(A);for(var H=0,D;D=A[H];H++){if(!D.parentNode._countedByPrototype){J.index(D.parentNode,L,K);C.push(D.parentNode)}}if(B.match(/^\d+$/)){B=Number(B);for(var H=0,D;D=A[H];H++){if(D.nodeIndex==B){I.push(D)}}}else{if(E=B.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1}var O=E[1]?Number(E[1]):1;var M=E[2]?Number(E[2]):0;var P=Selector.pseudos.getIndices(O,M,A.length);for(var H=0,D,F=P.length;D=A[H];H++){for(var G=0;G<F;G++){if(D.nodeIndex==P[G]){I.push(D)}}}}}J.unmark(A);J.unmark(C);return I},"empty":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.tagName=="!"||E.firstChild){continue}C.push(E)}return C},"not":function(A,D,I){var G=Selector.handlers,J,C;var H=new Selector(D).findElements(I);G.mark(H);for(var F=0,E=[],B;B=A[F];F++){if(!B._countedByPrototype){E.push(B)}}G.unmark(H);return E},"enabled":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(!E.disabled&&(!E.type||E.type!=="hidden")){C.push(E)}}return C},"disabled":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.disabled){C.push(E)}}return C},"checked":function(B,F,A){for(var D=0,C=[],E;E=B[D];D++){if(E.checked){C.push(E)}}return C}},operators:{"=":function(B,A){return B==A},"!=":function(B,A){return B!=A},"^=":function(B,A){return B==A||B&&B.startsWith(A)},"$=":function(B,A){return B==A||B&&B.endsWith(A)},"*=":function(B,A){return B==A||B&&B.include(A)},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")},"|=":function(B,A){return("-"+(B||"").toUpperCase()+"-").include("-"+(A||"").toUpperCase()+"-")}},split:function(B){var A=[];B.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(C){A.push(C[1].strip())});return A},matchElements:function(A,G){var F=$$(G),E=Selector.handlers;E.mark(F);for(var D=0,C=[],B;B=A[D];D++){if(B._countedByPrototype){C.push(B)}}E.unmark(F);return C},findElement:function(A,C,B){if(Object.isNumber(C)){B=C;C=false}return Selector.matchElements(A,C||"*")[B||0]},findChildElements:function(C,G){G=Selector.split(G.join(","));var E=[],F=Selector.handlers;for(var D=0,B=G.length,A;D<B;D++){A=new Selector(G[D].strip());F.concat(E,A.findElements(C))}return(B>1)?F.unique(E):E}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(B,A){for(var C=0,D;D=A[C];C++){if(D.tagName!=="!"){B.push(D)}}return B}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(A){A=$(A);A.reset();return A},serializeElements:function(C,E){if(typeof E!="object"){E={hash:!!E}}else{if(Object.isUndefined(E.hash)){E.hash=true}}var D,G,B=false,A=E.submit;var F=C.inject({},function(I,H){if(!H.disabled&&H.name){D=H.name;G=$(H).getValue();if(G!=null&&H.type!="file"&&(H.type!="submit"||(!B&&A!==false&&(!A||D==A)&&(B=true)))){if(D in I){if(!Object.isArray(I[D])){I[D]=[I[D]]}I[D].push(G)}else{I[D]=G}}}return I});return E.hash?F:Object.toQueryString(F)}};Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)},getElements:function(F){var B=$(F).getElementsByTagName("*"),D,A=[],C=Form.Element.Serializers;for(var E=0;D=B[E];E++){A.push(D)}return A.inject([],function(G,H){if(C[H.tagName.toLowerCase()]){G.push(Element.extend(H))}return G})},getInputs:function(G,E,C){G=$(G);var F=G.getElementsByTagName("input");if(!E&&!C){return $A(F).map(Element.extend)}for(var D=0,H=[],A=F.length;D<A;D++){var B=F[D];if((E&&B.type!=E)||(C&&B.name!=C)){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(C){var A=$(C).getElements().findAll(function(D){return"hidden"!=D.type&&!D.disabled});var B=A.findAll(function(D){return D.hasAttribute("tabIndex")&&D.tabIndex>=0}).sortBy(function(D){return D.tabIndex}).first();return B?B:A.find(function(D){return/^(?:input|select|textarea)$/i.test(D.tagName)})},focusFirstElement:function(A){A=$(A);A.findFirstElement().activate();return A},request:function(C,B){C=$(C),B=Object.clone(B||{});var D=B.parameters,A=C.readAttribute("action")||"";if(A.blank()){A=window.location.href}B.parameters=C.serialize(true);if(D){if(Object.isString(D)){D=D.toQueryParams()}Object.extend(B.parameters,D)}if(C.hasAttribute("method")&&!B.method){B.method=C.method}return new Ajax.Request(A,B)}};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={input:function(A,B){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A,B);default:return Form.Element.Serializers.textarea(A,B)}},inputSelector:function(A,B){if(Object.isUndefined(B)){return A.checked?A.value:null}else{A.checked=!!B}},textarea:function(A,B){if(Object.isUndefined(B)){return A.value}else{A.value=B}},select:function(B,F){if(Object.isUndefined(F)){return this[B.type=="select-one"?"selectOne":"selectMany"](B)}else{var D,E,G=!Object.isArray(F);for(var C=0,A=B.length;C<A;C++){D=B.options[C];E=this.optionValue(D);if(G){if(E==F){D.selected=true;return }}else{D.selected=F.include(E)}}}},selectOne:function(B){var A=B.selectedIndex;return A>=0?this.optionValue(B.options[A]):null},selectMany:function(B){var E,A=B.length;if(!A){return null}for(var D=0,E=[];D<A;D++){var C=B.options[D];if(C.selected){E.push(this.optionValue(C))}}return E},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,A,C,B){$super(B,C);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(){var W={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,cache:{}};var G=document.documentElement;var M="onmouseenter" in G&&"onmouseleave" in G;var R;if(Prototype.Browser.IE){var I={0:1,1:4,2:2};R=function(Y,X){return Y.button===I[X]}}else{if(Prototype.Browser.WebKit){R=function(Y,X){switch(X){case 0:return Y.which==1&&!Y.metaKey;case 1:return Y.which==1&&Y.metaKey;default:return false}}}else{R=function(Y,X){return Y.which?(Y.which===X+1):(Y.button===X)}}}function P(X){return R(X,0)}function Q(X){return R(X,1)}function L(X){return R(X,2)}function J(Z){Z=W.extend(Z);var Y=Z.target,X=Z.type,a=Z.currentTarget;if(a&&a.tagName){if(X==="load"||X==="error"||(X==="click"&&a.tagName.toLowerCase()==="input"&&a.type==="radio")){Y=a}}if(Y.nodeType==Node.TEXT_NODE){Y=Y.parentNode}return Element.extend(Y)}function U(Z,a){var Y=W.element(Z);if(!a){return Y}var X=[Y].concat(Y.ancestors());return Selector.findElement(X,a,0)}function S(X){return{x:D(X),y:C(X)}}function D(Z){var Y=document.documentElement,X=document.body||{scrollLeft:0};return Z.pageX||(Z.clientX+(Y.scrollLeft||X.scrollLeft)-(Y.clientLeft||0))}function C(Z){var Y=document.documentElement,X=document.body||{scrollTop:0};return Z.pageY||(Z.clientY+(Y.scrollTop||X.scrollTop)-(Y.clientTop||0))}function O(X){W.extend(X);X.preventDefault();X.stopPropagation();X.stopped=true}W.Methods={isLeftClick:P,isMiddleClick:Q,isRightClick:L,element:J,findElement:U,pointer:S,pointerX:D,pointerY:C,stop:O};var T=Object.keys(W.Methods).inject({},function(X,Y){X[Y]=W.Methods[Y].methodize();return X});if(Prototype.Browser.IE){function F(Y){var X;switch(Y.type){case"mouseover":X=Y.fromElement;break;case"mouseout":X=Y.toElement;break;default:return null}return Element.extend(X)}Object.extend(T,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});W.extend=function(Y,X){if(!Y){return false}if(Y._extendedByPrototype){return Y}Y._extendedByPrototype=Prototype.emptyFunction;var Z=W.pointer(Y);Object.extend(Y,{target:Y.srcElement||X,relatedTarget:F(Y),pageX:Z.x,pageY:Z.y});return Object.extend(Y,T)}}else{W.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(W.prototype,T);W.extend=Prototype.K}function B(Y,X,b){var a=Element.retrieve(Y,"prototype_event_registry");if(Object.isUndefined(a)){E.push(Y);a=Element.retrieve(Y,"prototype_event_registry",$H())}var c=a.get(X);if(Object.isUndefined(c)){c=[];a.set(X,c)}if(c.pluck("handler").include(b)){return false}var Z;if(X.include(":")){Z=function(d){if(Object.isUndefined(d.eventName)){return false}if(d.eventName!==X){return false}W.extend(d,Y);b.call(Y,d)}}else{if(!M&&(X==="mouseenter"||X==="mouseleave")){if(X==="mouseenter"||X==="mouseleave"){Z=function(f){W.extend(f,Y);var d=f.relatedTarget;while(d&&d!==Y){try{d=d.parentNode}catch(g){d=Y}}if(d===Y){return }b.call(Y,f)}}}else{Z=function(d){W.extend(d,Y);b.call(Y,d)}}}Z.handler=b;c.push(Z);return Z}function H(){for(var Y=0,X=E.length;Y<X;Y++){W.stopObserving(E[Y]);E[Y]=null}}var E=[];if(Prototype.Browser.IE){window.attachEvent("onunload",H)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var A=Prototype.K;if(!M){A=function(X){var Y={mouseenter:"mouseover",mouseleave:"mouseout"};return X in Y?Y[X]:X}}function N(Y,X,b){Y=$(Y);var a=B(Y,X,b);if(!a){return Y}if(X.include(":")){if(Y.addEventListener){Y.addEventListener("dataavailable",a,false)}else{Y.attachEvent("ondataavailable",a);Y.attachEvent("onfilterchange",a)}}else{var Z=A(X);if(Y.addEventListener){Y.addEventListener(Z,a,false)}else{Y.attachEvent("on"+Z,a)}}return Y}function K(Y,X,d){Y=$(Y);var c=Element.retrieve(Y,"prototype_event_registry");if(Object.isUndefined(c)){return Y}if(X&&!d){var Z=c.get(X);if(Object.isUndefined(Z)){return Y}Z.each(function(e){Element.stopObserving(Y,X,e.handler)});return Y}else{if(!X){c.each(function(g){var e=g.key,f=g.value;f.each(function(h){Element.stopObserving(Y,e,h.handler)})});return Y}}var Z=c.get(X);if(!Z){return }var b=Z.find(function(e){return e.handler===d});if(!b){return Y}var a=A(X);if(X.include(":")){if(Y.removeEventListener){Y.removeEventListener("dataavailable",b,false)}else{Y.detachEvent("ondataavailable",b);Y.detachEvent("onfilterchange",b)}}else{if(Y.removeEventListener){Y.removeEventListener(a,b,false)}else{Y.detachEvent("on"+a,b)}}c.set(X,Z.without(b));return Y}function V(Z,Y,X,b){Z=$(Z);if(Object.isUndefined(b)){b=true}if(Z==document&&document.createEvent&&!Z.dispatchEvent){Z=document.documentElement}var a;if(document.createEvent){a=document.createEvent("HTMLEvents");a.initEvent("dataavailable",true,true)}else{a=document.createEventObject();a.eventType=b?"ondataavailable":"onfilterchange"}a.eventName=Y;a.memo=X||{};if(document.createEvent){Z.dispatchEvent(a)}else{Z.fireEvent(a.eventType,a)}return W.extend(a)}Object.extend(W,W.Methods);Object.extend(W,{fire:V,observe:N,stopObserving:K});Element.addMethods({fire:V,observe:N,stopObserving:K});Object.extend(document,{fire:V.methodize(),observe:N.methodize(),stopObserving:K.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,W)}else{window.Event=W}})();(function(){var D;function A(){if(document.loaded){return }if(D){window.clearTimeout(D)}document.loaded=true;document.fire("dom:loaded")}function C(){if(document.readyState==="complete"){document.stopObserving("readystatechange",C);A()}}function B(){try{document.documentElement.doScroll("left")}catch(E){D=B.defer();return }A()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",A,false)}else{document.observe("readystatechange",C);if(window==top){D=B.defer()}}Event.observe(window,"load",A)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.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(A,C,B){B=B||{};return Element.clonePosition(C,A,B)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(B){function A(C){return C.blank()?null:"[contains(concat(' ', @class, ' '), ' "+C+" ')]"}B.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(D,C){C=C.toString().strip();var E=/\s/.test(C)?$w(C).map(A).join(""):A(C);return E?document._getElementsByXPath(".//*"+E,D):[]}:function(F,E){E=E.toString().strip();var C=[],H=(/\s/.test(E)?$w(E):null);if(!H&&!E){return C}var D=$(F).getElementsByTagName("*");E=" "+E+" ";for(var G=0,J,I;J=D[G];G++){if(J.className&&(I=" "+J.className+" ")&&(I.include(E)||(H&&H.all(function(K){return !K.toString().blank()&&I.include(" "+K+" ")})))){C.push(Element.extend(J))}}return C};return function(C,D){return $(D||document.body).getElementsByClassName(C)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(A){this.element=$(A)},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0})._each(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);var $PNGFIX=true;var _pngfix=function(){};if(Prototype&&Prototype.Browser.IE){(function(){var E="DXImageTransform.Microsoft.AlphaImageLoader";var C="progid:"+E+"(src='%1',sizingMethod='scale')";var A=function(G){if(!G.filters){return }var H=G.filters[E];if(H){H.src=G.src;H.enabled=true}else{G.runtimeStyle.filter=C.replace(/%1/,G.src)}G.onload=function(){};G.src="http://img.jamendo.com/spacer.gif"};_pngfix=function(G){if(!$PNGFIX){return }var H=new Image();H.onload=function(){G.width=H.width;G.height=H.height;H=null};H.src=G.src;A(G)};var B=function(H){var G=H.currentStyle.backgroundImage;var I=G.substring(5,G.length-2);H.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+I+"', sizingMethod='crop')";H.style.backgroundImage="url(http://img.jamendo.com/spacer.gif)"};var D=function(){if(window.event.propertyName=="style.backgroundImage"){var H=window.event.srcElement;if(!H.currentStyle.backgroundImage.match(/x\.gif/i)){var G=H.currentStyle.backgroundImage;var I=G.substring(5,G.length-2);H.filters.item(0).src=I;H.style.backgroundImage="url(http://img.jamendo.com/spacer.gif)"}}};var F=function(){for(var G=document.all.length-1,H=null;(H=document.all[G]);G--){if(H.className.match(/pngfix/)&&H.currentStyle.backgroundImage.match(/\.png/i)!==null){B(H);H.attachEvent("onpropertychange",D)}}};document.observe("load",F)})()}var Jamendo=Class.create();Jamendo.prototype={Version:"0.1",initialize:function(){this.activeSerials={};this.ajaxSemaphore=0;this.nextSerial=0;this.observers=[];this.domReady=false;this.forms={};this.formElements={};this.classes={};this.onReady(Prototype.emptyFunction);this.ajaxFeedbackElements=[];this.i18n={}},getStr:function(A){return Jamendo.i18n[A]?Jamendo.i18n[A]:"??"+A+"??"},getEnv:function(A){return{"USERID":Jamendo_ENV["USERID"]||0,"VISITORID":Jamendo_ENV["VISITORID"]||0,"AUTH":(Jamendo_ENV["USERID"]>0),"LANG":Jamendo_ENV["LANG"]||"en","GMAPS_KEY":Jamendo_ENV["GMAPS_KEY"]||"ABQIAAAACQNZjYy0Iy0nQ5vLbXfm5BQWecC8V4p8CO_SECQLRybVH7QL5xRpjsbcv3pCduXiFULF1vFo8LlFkw","USERNAME":Jamendo_ENV["USERNAME"]||"","HTTPHOST":Jamendo_ENV["HTTPHOST"]||"http://www.jamendo.com/","HTTPHOSTI18N":Jamendo_ENV["HTTPHOSTI18N"]||"http://www.jamendo.com/","IMGJAM":Jamendo_ENV["IMGJAM"]||"http://imgjam.com/","PREFS":Jamendo_ENV["PREFS"]||{"stream":"","download":""},"TZOFFSET":Jamendo_ENV["TZOFFSET"]||"","REMOTEPLAYER_URL":Jamendo_ENV["REMOTEPLAYER_URL"]||false,"INTERRUPTS":Jamendo_ENV["INTERRUPTS"]||{},"USER_AGENT":Jamendo_ENV["USER_AGENT"]||"","LISTENERIDSTR":Jamendo_ENV["LISTENERIDSTR"]||"0","NOCACHE":Jamendo_ENV["NOCACHE"]||"0","MOD":Jamendo_ENV["MOD"]||"www","CURRENCY":Jamendo_ENV["CURRENCY"]||"EUR","FBCONNECTED":Jamendo_ENV["FBCONNECTED"]||false}[A]},fixObjectLeaks:function(){if(Prototype.Browser.IE){Event.observe(window,"unload",function(){var C=document.getElementsByTagName("object");if(C){var A=C.length;for(var B=0;B<A;B++){for(j in C[B]){if(Object.isFunction(C[B].j)){C[B].j=Prototype.K}}C[B].style.display="none";C[B].parentNode.innerHTML=""}}})}},log:function(D){var B=this.debug;if(Prototype.Browser.Gecko){try{console.log(D);B=false}catch(C){}}if(B){if(Jamendo.debug){var E=$("Jamendo_log");if(!E){var A=document.getElementsByTagName("body")[0];A.innerHTML='<div id="Jamendo_log"></div>'+A.innerHTML;var E=$("Jamendo_log");E.setStyle("position:absolute;bottom:0;right:0;background:lightyellow;border-top:4px double red;height:120px;width:100%;overflow:auto;")}E.innerHTML=D+"<br />"+E.innerHTML}}},setupAjaxFeedbackElement:function(B,A){B=$(B);var C=new Jamendo.DelayedSwitch(B.show.bind(B),B.hide.bind(B),A);this.addObserver(["ajax","semaphore"],function(E,D){if(D>0){C.on()}else{C.off()}});this.ajaxFeedbackElements.push([B,A,C])},ajaxAbortAllRequests:function(){this.activeSerials={};this.ajaxSemaphore=0;this.sendEvent(["ajax","semaphore"],0)},ajaxAbortRequest:function(A){try{if(A in this.activeSerials){delete this.activeSerials[A];this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore)}}catch(B){}},ajaxRequest:function(B){B=Object.extend({"url":"","params":{},"method":"post","callback":false,"tryback":function(){return true},"errback":false,"serial":true,"timeout":7000,"timeoutId":false,"timeouted":false,"retryDelay":3000,"retryCount":5,"showFeedback":false,"onLoading":Prototype.K,"asynchronous":true},B);if(B.serial){B.serial=(++this.nextSerial);this.activeSerials[B.serial]=true}this.sendEvent(["ajax","semaphore"],++this.ajaxSemaphore);var C={};$H(B.params).each(function(G){C[G.key]=G.value});var A=function(G){if((G.status==401)||(G.status==403)||(G.status==404)||(G.status==500)){B.retryCount=0}clearTimeout(B.timeoutId);delete this.activeSerials[B.serial];if((--B.retryCount)>=0&&B.tryback(B.retryCount)){this.ajaxSemaphore--;setTimeout(function(){this.ajaxRequest(B)}.bind(this),B.retryDelay)}else{this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore);if(B.errback){B.errback()}Jamendo.page.updateFeedbacks([{"type":"warning","text":Jamendo.getStr("FEEDBACK_NOCONNECT")}])}}.bind(this);var E=function(I){clearTimeout(B.timeoutId);if(!B.serial||(B.serial in this.activeSerials)){delete this.activeSerials[B.serial];this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore);if(B.callback){try{B.callback(I.responseText,I)}catch(H){Jamendo.log("error in callback: "+H.name+" => "+H.message);if(false){if(!$("errordiv")){var G=$("page");G.insert({bottom:'<div id="errordiv" style="width:1000px;height:200px;visibility:hidden;"></div>'})}$("errordiv").update(H.message.gsub(/\\n/,""));SuperBox.call("localdiv","errordiv")}}}}}.bind(this);_success=false;try{if((typeof ClickTaleIsPlayback=="function")&&ClickTaleIsPlayback()){B.url=B.url.replace(new RegExp("^(http://([^/]+))?/"),Jamendo.getEnv("HTTPHOST"))}var D=new Ajax.Request(B.url,{asynchronous:B.asynchronous,method:B.method,parameters:C,onFailure:A,onSuccess:E,onLoading:B.onLoading});_success=true}catch(F){if(!B.asynchronous){A(D.transport)}}if(!B.asynchronous){E(D.transport)}if(B.timeout&&B.asynchronous){B.timeoutId=setTimeout(function(){B.timeouted=true;if(D.transport.readyState>0&&D.transport.readyState<4){D.options["onFailure"](D.transport,D.json)}},B.timeout)}return{"options":B,"serial":B.serial,"abort":function(){this.ajaxAbortRequest(B.serial)}.bind(this)}},prependObject:function(C,D,B){var A={};A[D]=C;$H(B).each(function(E){A[E.key]=E.value});return A},jsonRequest:function(A,D,C,B){B=Object.extend(B||{},{"callback":function(F,G){var E=F.evalJSON();if(this.showFeedback&&E&&E.feedback){Jamendo.page.updateFeedbacks(E.feedback)}if(C){C(E,G)}},"params":D||{},"url":A});return this.ajaxRequest(B)},writeApi:function(G,C,I,B,H){try{if(!H){H={}}var A={};if(C){$A(C).each(function(K,J){if(typeof (K)=="number"){A["p"+J]=K}else{A["p"+J]=Object.toJSON(K)}})}if(Jamendo.getEnv("NOCACHE")=="1"&&G.substring(0,7)=="cached "){G=G.substring(7)}if(G.indexOf("jscached")!=-1){G=G.gsub("jscached ","");if(Jamendo.getEnv("NOCACHE")!="1"){if(typeof (this._cached_writeapi_results)=="undefined"){this._cached_writeapi_results=$H()}var F=G+"__"+Object.toJSON(C).gsub(/[\n \"\']/,"");if(typeof (this._cached_writeapi_results.get(F))!="undefined"){if(String(window.location).indexOf("debug=")!=-1){console.group("do not fetch [/set/"+G+"/postjson/json]");console.log("params=%o",C);console.log("options=%o",H);console.log("hashkey=%s",F);console.groupEnd()}I(Jamendo._cached_writeapi_results.get(F));return true}else{var D=I;I=function(J){Jamendo._cached_writeapi_results.set(F,J);D(J)}}}}if(typeof (B)=="function"){H.errback=B}return this.jsonRequest("/"+Jamendo.getEnv("HTTPHOSTI18N").replace(/.*\.[a-z]+\//,"")+"set/"+G+"/postjson/json",A,I,H)}catch(E){Jamendo.log(E);if(B){B()}return false}},writeApiWithFeedback:function(F,G,E,B,A){A=Object.extend({"showFeedback":true},A);try{var D={};if(G){$A(G).each(function(I,H){if(typeof (I)=="number"){D["p"+H]=I}else{D["p"+H]=Object.toJSON(I)}})}if(typeof (B)=="function"){A.errback=B}return this.jsonRequest("/"+Jamendo.getEnv("HTTPHOSTI18N").replace(/.*\.[a-z]+\//,"")+"set/"+F+"/postjson/jsonfeedback",D,E,A)}catch(C){Jamendo.log(C);if(B){B()}}},get2:function(B,F,E,D,C){C=C||{};F=F||{};if(D){C.errback=D}B=B.replace(/^[^\?]*\/?get2\//,"");var A=B.indexOf("?");if(A>=0){$H(B.substr(A+1).toQueryParams()).each(function(G){if(!$H(F).keys().include(G.key)){F[G.key]=G.value}});B=B.substr(0,A)}B=B.split("/");if(!B[2]){B[2]="json"}B=B.join("/");return Jamendo.jsonRequest("/get2/"+B,F,E,C)},parseStrId:function(D){var C={"originalStrId":D,"relations":[],"targets":[],"format":""};C["params"]=$H();var A=D.indexOf("?");if(A>=0){C["params"]=$H(D.substring(A+1).gsub(/\+/," ").toQueryParams());D=D.substring(0,A)}var B=D.split("/");C["unit"]=B[1];if(B[3]){C["relations"]=B[3].split(" ")}C["strId"]=Jamendo.unparseStrId(C);return C},unparseStrId:function(B,A){if(A){if(A["params_merge"]){A["params"]=$H(B["params"]).merge(A["params_merge"])}B=Object.extend(B,A)}return B["targets"].join(" ")+"/"+B["unit"]+"/"+B["format"]+"/"+B["relations"].join(" ")+"?"+B["params"].toQueryString()},patchUrl:function(B,D){var C=B.substr(0,B.indexOf("?"));var A=B.substr(B.indexOf("?")+1,B.length).toQueryParams();$H(D).each(function(E){A[E.key]=E.value});return C+"?"+Object.toQueryString(D)},stripStrId:function(B){if(!B){return B}var A=null;var D=B.indexOf("|");if(D>0){A=Jamendo.stripStrId(B.substring(0,D));A+="|";A+=Jamendo.stripStrId(B.substr(D+1))}else{var C=null;var D=B.indexOf("#");if(D>0){C=B.substr(D+1);B=B.substring(0,D)}A=Jamendo.unparseStrId(Jamendo.parseStrId(B));if(C){A+="#"+C}}return A},id2ml2:function(B){B=B.split("/");switch(B[0]){case"artist":var A=B[1].split("|");return"/artist//unique/?id="+A[0]+"|id/track//track_album+album_artist/?track_id="+A[1]+"&order=fromparams&n=all";case"tag":return"/tag//?tag_idstr="+B[1];case"radio":return"stream/track/m3u/radio_track_inradioplaylist/?order=numradio_asc&n=50&radio_id="+B[1];case"track_similar":var A=B[1].split("|");return"/track//track_album+album_artist/?order=similarity_desc&n=50&similarid="+A[0]+"."+A[1];default:return"/"+B[0]+"//?"+B[0]+"_id="+B[1]+"&order=num"+B[0]+"_asc&n=all"}return null},musiclistFromHref:function(A,C){var B=this.musiclistParseHref(A);return this.musiclistFromParams(B["params1"],B["params2"],C)},musiclistFromParams:function(A,B,C){if(typeof (A)=="string"){A=A.split(/\//)}this.jsonRequest("/get/"+A.join("/"),B,C)},musiclistParams2Href:function(A,B){return(A.join("/"))+"/?"+$H(B).toQueryString()},musiclistParsed2Href:function(A){return(A["params1"].join("/"))+"/?"+$H(A["params2"]).toQueryString()},musiclistParseHref:function(A){var C={};C["strId"]=A.replace(/^[^\?]*\/?get\//,"");var B=C["strId"].indexOf("?");if(B==-1){C["params2str"]="";C["params1str"]=C["strId"]}else{C["params2str"]=C["strId"].slice(B);C["params1str"]=C["strId"].slice(0,B)}C["params1"]=C["params1str"].split(/\//);C["strId"]=C["params1str"]+C["params2str"];C["params2"]=$H();$H(C["params2str"].toQueryParams()).each(function(D){C["params2"].set(D.key,decodeURIComponent(D.value).replace(/\+/g," "))});return C},JSONCallback:function(B,A){},formatNumber:function(C,A){if(isNaN(C)){return 0}if(C==""){return 0}var H=new String(C);var D=H.split(".");var E=parseFloat(D[0]);var F="";if(D.length>1){var G=new String(D[1]);G=String(parseFloat(D[1])/Math.pow(10,(G.length-A)));G=String(E+Math.round(parseFloat(G))/Math.pow(10,A));var B=G.indexOf(".");if(B==-1){G+=".";B=G.indexOf(".")}while(G.length<=B+A){G+="0"}F=G}else{var B;var G=new String(E);G+=".";B=G.indexOf(".");while(G.length<=B+A){G+="0"}F=G}return F},logEvents:function(A){Jamendo.addObserver(A,function(B,C){var D="[";B.each(function(F,E){D+="'"+F+"'";if(E<B.length-1){D+=", "}});D+="] ";Jamendo.log("sendEvent : "+D+" with data: "+C)})},sendEvent:function(A,C){for(var B=0;B<this.observers.length;B++){if(this.eventIdMatches(A,this.observers[B][0])){try{this.observers[B][1](A,C)}catch(D){Jamendo.log("Error while calling event "+this.observers[B][0]+" with data "+this.observers[B][1]);Jamendo.log(D)}}}},sendEventDefered:function(A,B){(function(){Jamendo.sendEvent(A,B)}).defer()},observeOnce:function(A,B){Jamendo.forwardEvent(A,null,{"callback":B})},forwardEvent:function(G,D,B){if(!G){throw new Error("You have to provide an eventToObserve")}B=B||{};if(!D&&!B.callback){throw new Error("What are you doing ? give a callback or and event to forward !")}var F=B.permanent||false;var C=B.data||null;var A=B.callback||Prototype.K;var E=function(H,I){A(H,C||I);if(D){Jamendo.sendEvent(D,C||I)}if(!F){Jamendo.removeObserver(G,E)}};Jamendo.addObserver(G,E)},secondsToLabel:function(B){var A=Math.floor(B/60);var B=B-A*60;if(B<10){B="0"+B}return A+":"+B},addObserver:function(A,B){this.observers.push([A,B])},removeObserver:function(A,B){this.observers=this.observers.reject(function(C){return(this.eventIdEquals(A,C[0])&&B==C[1])}.bind(this))},removeObserversByEventId:function(A){this.observers=this.observers.reject(function(B){return this.eventIdEquals(A,B[0])}.bind(this))},eventIdMatches:function(C,B){for(var A=0;A<B.length;A++){if(C[A]!=B[A]){return false}}return true},eventIdEquals:function(A,B){return this.eventIdMatches(A,B)&&this.eventIdMatches(B,A)},onReady:function(A){if(this.domReady){return A()}document.observe("dom:loaded",A)},requestUri:function(A){var B=A.indexOf("jamendo.com/");if(B>=0){A=A.substr(B+11)}return A},insertScript:function(B,E){var C=document.createElement("script");C.type="text/javascript";C.charset="utf-8";C.defer=true;var D=function(){if(C.readyState&&C.readyState!="loaded"&&C.readyState!="complete"){return }C.onreadystatechange=C.onload=null;if(E){E()}$(C).remove()};C.onload=C.onreadystatechange=D;C.src=B;document.getElementsByTagName("head").item(0).appendChild(C);if(Prototype.Browser.WebKit&&E&&navigator.userAgent.match(/AppleWebKit\/([0-9]+)/)[1]<522){var A=document.createElement("iframe");A.style.width="0px";A.style.height="0px";A.setAttribute("src",B);document.getElementsByTagName("body").item(0).appendChild(A);A.onload=function(){D();try{$(A).remove()}catch(F){}}}},insertGoogleJsApi:function(A){Jamendo._googlejsapicalback=A;setTimeout(function(){Jamendo.insertScript("http://www.google.com/jsapi?key="+Jamendo.getEnv("GMAPS_KEY")+"&callback=Jamendo._googlejsapicalback")},250)},getTemplate:function(A){return new Template($(A).innerHTML,/(^|.|\r|\n)(\$([a-z0-9]+)\$)/)},isUrl:function(B){var A=/^(http\:\/\/|ftp\:\/\/|)\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#]\w+)*\/?$/i;return A.test(B)},get_url_param:function(A){A=A.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var C="[\\?&]"+A+"=([^&#]*)";var D=new RegExp(C);var B=D.exec(window.location.href);if(B==null){return""}else{return B[1]}},errorUnimplemented:function(){Jamendo.log("Error : unimplemented")},stacktrace:function(){var I=[];var C=false;try{B.dont.exist+=0}catch(F){if(F.stack){var J=F.stack.split("\n");for(var B=0,E=J.length;B<E;B++){if(J[B].match(/^\s*[A-Za-z0-9\-_\$]+\(/)){I.push(J[B])}}I.shift();C=true}else{if(window.opera&&F.message){var J=F.message.split("\n");for(var B=0,E=J.length;B<E;B++){if(J[B].match(/^\s*[A-Za-z0-9\-_\$]+\(/)){var H=J[B];if(J[B+1]){H+=" at "+J[B+1];B++}I.push(H)}}I.shift();C=true}}}if(!C){var D=arguments.callee.caller;while(D){var G=D.toString();var A=G.substring(G.indexOf("function")+8,G.indexOf(""))||"anonymous";I.push(A);D=D.caller}}return(I)}};Hash.prototype.diff=function(B){var A=[[],[]];for(key in this){if(this[key]!=B[key]){A[0].push(key)}}for(key in B){if(!(key in this)){A[1].push(key)}}return A};if(!Jamendo_ENV){var Jamendo_ENV={}}var Jamendo=new Jamendo();Jamendo.onReady(function(){Jamendo.domReady=true});Element.addMethods({"jamPosition":function(A,B){A=$(A);A.style.left=parseInt(B[0])+"px";A.style.top=parseInt(B[1])+"px";return A},"jamSize":function(A,B){A=$(A);A.style.width=parseInt(B[0])+"px";A.style.height=parseInt(B[1])+"px";return A}});Jamendo.DelayedSwitch=Class.create();Jamendo.DelayedSwitch.prototype={initialize:function(C,B,A){this._on=C;this._off=B;this.delayON=A;this.timer=false},on:function(){if(!this.delayON){if(this._on){this._on()}}else{if(!this.timer){this.timer=setTimeout(function(){this.timer=false;if(this._on){this._on()}}.bind(this),this.delayON)}}},off:function(){if(this.timer){clearTimeout(this.timer);this.timer=false}if(this._off){this._off()}},reset:function(){this.off();this.on()}};String.prototype.pad=function(A,C,B){return C||(C=" "),(A-=this.length)>0?(C=new Array(Math.ceil(A/C.length)+1).join(C)).substr(0,B=!B?A:B==1?0:Math.ceil(A/2))+this+C.substr(0,A-B):this};Jamendo.Queue=Class.create();Object.extend(Jamendo.Queue.prototype,Enumerable);Object.extend(Jamendo.Queue.prototype,{initialize:function(){this.queue=[];this.queueSpace=0;this.length=0},push:function(B,A){this.queue.push(B);return(++this.length)},shift:function(){if(this.queue.length){var A=this.queue[this.queueSpace];if(++this.queueSpace*2>=this.queue.length){for(var B=this.queueSpace;B<this.queue.length;B++){this.queue[B-this.queueSpace]=this.queue[B]}this.queue.length-=this.queueSpace;this.queueSpace=0}this.length--;return A}else{return undefined}},concat:function(A){return this.toArray().concat(A)},unshift:function(A){if(this.queueSpace>0){this.queue[--this.queueSpace]=A}else{this.queue.unshift(A)}return(++this.length)},pop:function(){this.length--;return this.queue.pop()},_each:function(C){for(var B=this.queueSpace,A=this.queue.length;B<A;B++){C(this.queue[B])}},pick:function(B){var A=this.queue[this.queueSpace+B];for(var C=(this.queueSpace+B);C>(this.queueSpace);C--){this.queue[C]=this.queue[C-1]}this.queue[this.queueSpace]=A;return this.shift()},pushArray:function(A){this.queue=this.queue.concat(A);this.length+=A.length;return this.toArray()},get:function(A){return this.queue[this.queueSpace+A]},set:function(B,A){this.queue[this.queueSpace+B]=A},toArray:function(){return this.queue.slice(this.queueSpace)},extendItem:function(A,B){Object.extend(this.queue[this.queueSpace+A],B)}});String.prototype.size=function(){return this.length};var Cookie={set:function(B,E,D){var C="";if(D!=undefined){var F=new Date();F.setTime(F.getTime()+(86400000*parseFloat(D)));C=";expires="+F.toGMTString()}var A=escape(B)+"="+escape(E||"")+C+";path=/;domain=.jamendo.com";return(document.cookie=A)},get:function(B){var A=document.cookie.match(new RegExp("(^|;)\\s*"+escape(B)+"=([^;\\s]*)"));return(A?unescape(A[2]):null)},erase:function(B){var A=Cookie.get(B)||true;Cookie.set(B,"",-1);return A},accept:function(){if(typeof (navigator.cookieEnabled)=="boolean"){return navigator.cookieEnabled}Cookie.set("_test","1");return(Cookie.erase("_test")=="1")},log:function(){document.cookie.split("; ").each(function(A,B){Jamendo.log("Cookie:"+A)})}};Jamendo.page={hasPlayedOnce:false,_fbPublish:null,updateFeedbacks:function(C,B){var A=$H({"ok":"ok","nok":"error","wait":"wait","warning":"warning","info":"info"});var E=$("page_content_inner");var D=".page_content_leftc";if(!E){E=$("content");var D="#content_text"}if(!E){E=$("page_content_outer");var D="#page_content_fit"}var F=(!E);if(!F){if(B){B=$(B)}else{var B=E.down(".pageFeedbacks")}if(!B){B=new Element("div",{className:"pageFeedbacks"});B.addClassName("pageFeedbacks");E.down(D).insert({top:B})}B.getElementsBySelector(".boxok, .boxerror, .boxwait, .boxinfo, .boxwarning").invoke("remove")}C.each(function(I){if(F){return alert(I.text)}var G="jamfeedback-"+(Math.random()*1000000);var H=new Element("div",{"class":"box"+A.get(I.type),"id":G}).update(I.text).insert({"top":new Element("a",{"href":"#","onclick":"$('"+G+"').remove(); return false;","style":"float:right;display:block;"}).update(Jamendo.getStr("SUPERBOX_CLOSE"))});H.addClassName("box"+A.get(I.type));if(I.help){var J=new Element("div",{"class":"feedback_help"});if(I.help.text){J.update(I.help.text)}else{if(I.help.link){J.update(new Element("a",I.help.link).update(I.help.link.text))}}H.insert(J)}B.insert({"top":H})})},clientSideInfos:function(){return{"TZOFFSET":(new Date()).getTimezoneOffset()}},fixClientSideInfos:function(){var A=Jamendo.page.clientSideInfos();if(Jamendo.getEnv("TZOFFSET")!==""&&Jamendo.getEnv("TZOFFSET")!=A.TZOFFSET){Jamendo.onReady(function(){Jamendo.writeApi("user_clientsideinfos",[A])})}},preloadJamButtons:function(A){Jamendo.onReady(function(){var B=new Image();A.each(function(C){B.src=C})})},showLogin:function(B){if(B){var A=$("login_box").previous(".boxerror");if(A){A.hide()}}$("page_login").show();$("box_overlay").show();$("page_login").setStyle({opacity:1,zIndex:20005});$("box_overlay").setStyle({opacity:0.5,backgroundColor:"#000",width:"100%",height:document.body.offsetHeight+38+"px",position:"absolute",top:0,left:0,zIndex:10005});$("page_loginform_pseudo").focus();return false},logintabs:["page_loginform_pseudo","page_loginform_pass","loginbutton","resendpass","signuplink"],spLoginOnKeypress:function(B){var C=Event.element(B);if(B.keyCode==Event.KEY_RETURN){if($("page_loginform_pseudo").value!=""&&$("page_loginform_pass").value!=""){$("login_form").submit()}else{if(C.id=="page_loginform_pass"){$("loginerror").show()}}}else{if(B.keyCode==Event.KEY_ESC){$("loginerror").hide()}else{if(B.keyCode==Event.KEY_TAB){var A=Jamendo.page.logintabs.indexOf(C.id);if(Jamendo.page.logintabs[A+1]){$(Jamendo.page.logintabs[A+1]).focus()}else{$(Jamendo.page.logintabs.first()).focus()}}else{if(B.type=="click"&&C.up(".jambutton_bigaction_button")&&C.up(".jambutton_bigaction_button").id=="loginbutton"){if($("page_loginform_pseudo").value!=""&&$("page_loginform_pass").value!=""){$("login_form").submit()}else{$("loginerror").show()}}else{return B}}}}return false},refresh:function(){if(typeof (window.location.reload)=="function"){window.location.reload(false)}else{window.location.href=unescape(window.location.pathname+window.location.search)}},refreshWithParams:function(D,A){if(A==null){A=false}else{if(A){A=true}else{A=false}}var B=window.location.toString().indexOf("?");if(A){var C="".toQueryParams()}else{var C=(B>0?window.location.toString().substring(B):"").toQueryParams()}C=Object.extend(C,D);window.location=(B>0?window.location.toString().substring(0,B):window.location)+"?"+$H(C).toQueryString()},popup:function(A){return window.open(A,"jamendopopup_"+Math.round(Math.random()*1000000),"menubar=yes,location=yes,toolbar=yes,directories=yes,personalbar=yes,status=yes,resizable=yes,scrollbars=yes")},download:function(C,E){if(!C||!E){Jamendo.writeApi("quicklog",["emptydownloadunitid",window.location.toString()]);return false}if(!Jamendo.getEnv("PREFS")["download"]||C!="album"){var B=Jamendo.getEnv("HTTPHOSTI18N").replace("torrents","www")+"download/"+C+"/"+E+"/";var D="width=920,height=400";if(C=="playlist"){D="width=750,height=400"}var A=function(){window.open(B+"?output=contentonly","jamdownload_"+Math.round(Math.random()*1000000),D+",menubar=no,location=no,toolbar=no,directories=no,personalbar=no,status=no,resizable=yes")};if(Jamendo.getEnv("INTERRUPTS")["download"]){Jamendo.getEnv("INTERRUPTS")["download"]=0;SuperBox.cb_remove.push(function(){SuperBox.cb_remove=[];A()});SuperBox.call("remote",Jamendo.getEnv("HTTPHOSTI18N")+"whysignup/download/?sbw=680&sbh=400&whysignup_redirect="+encodeURIComponent(B))}else{A()}}else{window.location=Jamendo.getEnv("HTTPHOSTI18N")+"get2/bittorrent/file/redirect/?type=archive&album_id="+E+"&class="+(Jamendo.getEnv("PREFS")["download"].split(/_/)[1])}return false},usePlayer:function(){return !Jamendo.getEnv("PREFS")["stream"]},parsePlayML2s:function(E,B){var A=Jamendo.getEnv("PREFS")["stream"].split(/_/);var D=Jamendo.parseStrId((B||E).replace(/^.*\|/,""));if(D["unit"]!="track"){if(D["unit"]=="album"){D["params"].set("order","numalbum_asc")}if(D["unit"]=="playlist"){D["params"].set("order","numplaylist_asc")}D["relations"].push("track9_"+D["unit"]);D["unit"]="track9"}var C=Jamendo.unparseStrId(D,{"format":A[0],"targets":["stream"],"params_merge":{"streamencoding":A[1]}});return C},play:function(E,A,D,C){Jamendo.page.hasPlayedOnce=true;if(C){var B=Jamendo.getEnv("HTTPHOSTI18N")+"widgets/create?url="+encodeURIComponent(E);if(C=="newwindow"){Jamendo.page.popup(B);return false}if(Prototype.Browser.Gecko&&Jamendo.getEnv("USER_AGENT").match(new RegExp(" Mac","g"))){document.location=B;return false}return SuperBox.call("remote",Jamendo.getEnv("HTTPHOSTI18N")+"get2/"+E,"",function(){SuperBox.setDim("200","300")})}else{if(!Jamendo.page.usePlayer()){if(E.substr(0,4)=="misc"){E="track"+E.substr(4)}var B=this.parsePlayML2s(Jamendo.id2ml2(E),A);window.location=Jamendo.getEnv("HTTPHOSTI18N")+"get2/"+B;return false}else{if(D){Jamendo.sendEvent(["jamplayer2","remote","control","play"],Jamendo.id2ml2(E));return false}else{return Jamendo.page.remoteplayer.command("play",E)}}}},star:function(B,F,C,A,E){if(!B||!F){Jamendo.writeApi("quicklog",["emptystarunitid",window.location.toString()]);return false}var D=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},500,200);D.on();return Jamendo.writeApiWithFeedback("user_log",[B,"star",F,C],function(H,I,G,J){D.off();if(typeof (G.result)!="undefined"&&(G.result=="true"||G.result==true)){A.up(".jambutton").switchButton();if(H){Jamendo.writeApi("social_networks_action_enabled_networks",["star"],function(L,K,O,M,N){$A(N).each(function(R,Q,T,S,P){R.shareOnSocialNetworks(P,Q,T,"star",S,true)}.curry(L,K,O,M))}.curry(this,B,F,I),function(){D.off()})}}}.bind(this,C,E),function(){D.off()})},concertToggleUser:function(C,A,B){SuperBox.call("wait");return Jamendo.writeApiWithFeedback("concert_user",["toggle",C],function(D,E){if(typeof (D.result)!="undefined"){if(B){Jamendo.page.refresh()}else{if(parseInt(D.result)>0){$$("."+A).each(function(F){F.select("span").invoke("update",Jamendo.getStr("CONCERT_USER_dont_go"))})}else{$$("."+A).each(function(F){F.select("span").invoke("update",Jamendo.getStr("CONCERT_USER_go"))})}SuperBox.remove()}}else{SuperBox.remove()}},function(){feedbackSwitch.off()})},seenlive:function(E,B,A,D){if(!E){Jamendo.writeApi("quicklog",["emptyseenliveid",window.location.toString()]);return false}var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();return Jamendo.writeApiWithFeedback("user_log",["artist","seenlive",E,(B?1:0)],function(G,H,F,I){C.off();if(typeof (F.result)!="undefined"&&(F.result=="true"||F.result==true)){A.up(".jambutton").switchButton();if(G){Jamendo.writeApi("social_networks_action_enabled_networks",["seenlive"],function(J,M,K,L){$A(L).each(function(O,Q,P,N){O.shareOnSocialNetworks(N,"artist",Q,"seenlive",P,true)}.curry(J,M,K))}.curry(this,E,H),function(){C.off()})}}}.bind(this,B,D),function(){C.off()})},shareOnSocialNetworks:function(C,B,F,A,D,E){switch(C){case"facebook":return this.shareOnFacebook(B,F,A,D,E);case"twitter":return this.shareOnTwitter(B,F,A,D)}},shareOnFacebook:function(C,F,A,D,E){if(!this._fbPublish){this._fbPublish=new Jamendo.classes.FacebookPublishStory()}var B=function(G){G.auto=E;G.callback=this.shareCallback.bind(this,"facebook",C,F,A);this._fbPublish.publishOnMyWall(G)}.bind(this);Jamendo.writeApi("social_networks_facebook_story_formatter",[C,F,A,D],B,null,{"asynchronous":Jamendo.getEnv("FBCONNECTED")})},shareCallback:function(C,B,D,A){Jamendo.writeApi("social_networks_story_published",[C,B,D,A],function(){})},shareOnTwitter:function(B,D,A,C){Jamendo.writeApi("social_networks_share_on_twitter",[B,D,A,C],function(E){if(E[0]){Jamendo.page.updateFeedbacks([{text:E[1],type:"info"}]);this.shareCallback.bind(this,"twitter",B,D,A)}else{window.location.replace(E[1])}}.bind(this))},friendship:function(B,D,C,F){if(B&&D&&C>0){var A=({"asked":"user_addfriend","accepted":"user_addfriend","deleted":"user_deletefriend","refused":"user_deletefriend"})[B];var E=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);return Jamendo.writeApiWithFeedback(A,[D,C,true],function(G,H){E.off();if(typeof (F=="function")){F(G,H)}},function(){E.off()})}},usergroup:function(A,B){var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();Jamendo.writeApi("user_log",["usergroup","joined",A,B],function(D){var E=(D=="ok");C.off();alert(Jamendo.getStr((B?"FEEDBACK_usergroupjoin_ok":"FEEDBACK_usergroupleave_ok")));Jamendo.page.refresh()},function(){C.off()})},usergroupWithFeedback:function(A,B){var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();return Jamendo.writeApiWithFeedback("user_log",["usergroup","joined",A,B],function(D,E){C.off()},function(){C.off()})},deleteplaylist:function(A){if(confirm(Jamendo.getStr("PLAYLIST_DELETE_QUESTION"))){Jamendo.writeApi("playlist_set",[[["deleteplaylist",A]],true],function(B){Jamendo.page.refresh()},function(){feedbackSwitch.off()})}},agreeToReview:function(B,A,D){if(B>0){var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();Jamendo.writeApiWithFeedback("review_agree",[B,A],function(E,F){C.off();if(typeof (D)=="function"){D(E,F)}},function(){C.off()})}},newsAction:function(C,D,E,F,G){var B=({"hide":["viewed",1,{"ids":D}]})[C];var A=function(H,I){Jamendo.page.shiftNewsfeed(1,E);if(typeof (F=="function")){F(H,I)}};if(G){Jamendo.writeApi("news_setflag",B,F,function(){feedbackSwitch.off()})}else{Jamendo.writeApiWithFeedback("news_setflag",B,A,function(){feedbackSwitch.off()})}},newsActionWithoutFeedback:function(A,D,B,C){Jamendo.page.newsAction(A,[D],B,C,true)},shiftNewsfeed:function(B,A,C){var D=Jamendo.Newsfeed.displayedItems.sortBy(function(E){return E}).first();if(!D){return }Jamendo.writeApi("news_get",[D,B,A],function(E,F){$("newsfeed").insert(E);Jamendo.page.hideNewsFeedIfNeeded();if(typeof (C)=="function"){C(E,F)}},function(){feedbackSwitch.off()})},hideNewsFeedIfNeeded:function(){var B=$("newsfeed");var A=B.select(".itemnewsfeed").find(function(C){return C.visible()});if(typeof (A)=="undefined"){Jamendo.page.updateFeedbacks([]);B.update('<div class="noitems_message">'+Jamendo.getStr("NEWSFEEDVIEWER_NOITEMS")+"</div>")}},reviewReport:function(A){var B=prompt(Jamendo.getStr("REPORT_BAD_REVIEW_REASON")+" ?",Jamendo.getStr("REPORT_BAD_REVIEW_YOUR_REASON"));if(B){Jamendo.writeApiWithFeedback("review_report",[A,"alert",{"type":B}])}},initRemoteplayer:function(B){if(!swfobject.hasFlashPlayerVersion("8.0.0")){var A=$("player_no_flash");if(A){A.setStyle({"display":"block"})}Jamendo.page.remoteplayer=null}else{Jamendo.page.remoteplayer=new Jamendo.classes.remotePlayer(B)}},searchRedirect:function(B,C){if(typeof (C)=="undefined"){C=true}if(["!","~","*","'","(",")","/"].all(function(D){return !B.include(D)})){var A="search/all/"+encodeURIComponent(B);if(C){window.location=Jamendo.getEnv("HTTPHOSTI18N")+A;return false}else{return"/"+A}}return true},joinGroupFromNewsfeed:function(A,C,B){this.usergroupWithFeedback(C,1);if($("item_details"+A).down("ul").getElementsByTagName("li").length==1){this.newsAction("hide",[A],function(D){this.hide();Jamendo.Newsfeed.displayedItems=Jamendo.Newsfeed.displayedItems.without(A)}.bind($("itemnewsfeed"+A)),1)}else{$(B).up("li").remove()}},remoteplayer:null,flashCallback:function(B,A){Jamendo.sendEvent(["flashcallback",B],A)},showPopupInfo:function(){var B=$("popupblocker_info");if(B){B.scrollTo();return }if(Prototype.Browser.WebKit||Prototype.Browser.MobileSafari){var A=document.getElementsByTagName("body")[0];A.insert({before:'<div id="popupblocker_info">'+Jamendo.getStr("POPUPBLOCKER_INFO")+"</div>"});$("popupblocker_info").scrollTo()}},graph2:function(A,F,E,C,B){if(typeof (Jamendo.classes.Graph2)=="undefined"){Jamendo.log('It seems you hav not loaded the "Graph2" chart engine');return }if(typeof (Jamendo.page.graphobject)=="undefined"){var D=new Jamendo.classes.Graph2();Jamendo.page.graphobject=D}Jamendo.page.graphobject.insertGraph(A,F,E,C,B)},isMacOS:function(){return(Jamendo.getEnv("USER_AGENT").match(new RegExp(" Mac","g")))},toggleExpander:function(B,C,A){B.toggleClassName("expander_closed");B.toggleClassName("expander_opened");if(B.hasClassName("expander_opened")&&typeof (C)=="function"){C()}else{if(B.hasClassName("expander_closed")&&typeof (A)=="function"){A()}}},changeDeviceInstores:function(A){$("select_a_format").select("li a.active").invoke("removeClassName","active");$("select_a_format").select("div.display_product_zone").invoke("hide");$("li_"+A).addClassName("active");$("details_"+A).show();return true},load_artist_admin:function(B,F,D,C,A){var E=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);E.on();Jamendo.writeApi("artist_admin",[B,F,D,C],function(G){E.off();A(G)},function(){E.off()})}};Object.extend(Jamendo.page,{pro_popup_player:null,pro_bottom_player:false,_clicktaletags:{},hide_pro_bottom_player:function(){$("pro_page_bottomplayer_flashinsert").remove();$("pro_page_bottomplayer").hide();if($("iecrap_iframe")){$("iecrap_iframe").hide()}this.pro_bottom_player=false},proPlay:function(F,E,C){if(E==null){var E="search"}var A=false;if(E=="cart"){if(Jamendo.Pro.Cart){Jamendo.page.play("misc/"+Jamendo.Pro.Cart.tracks.join("+")+"/"+F,"/track//?id="+F,C);A=true}else{Jamendo.page.play("track/"+F,"/track//?id="+F,C);A=true}}else{if(E=="search"){if(Jamendo.classes.trackSearch){Jamendo.page.play("misc/"+Jamendo.classes.trackSearch.current_trackids.join("+")+"/"+F,"/track//?id="+F,C);A=true}else{E="results_zone_content"}}}if($(E)&&!A){var B=$(E).select(".item_track").pluck("id");var D=[];B.each(function(G){D.push(G.substr(G.indexOf("_")+1))});if(B.length>0){Jamendo.page.play("misc/"+D.join("+")+"/"+F,"/track//?id="+F,C);A=true}}if(!A){Jamendo.page.play("track/"+F,"/track//?id="+F,C)}},nowPlaying:function(B){var A=$("results_zone_content");if(A&&B>0){A.getElementsBySelector(".item_track").each(function(C){C.removeClassName("played");if(C.id.indexOf("_"+B)>-1){C.addClassName("played")}})}},proTracking:function(A,B){if(A!="referer"){var C=A;if(A=="user_id"||A=="sale_id"||A=="minisite_id"||A=="trackingcode_id"||A=="promocode_id"){C=A.replace("id",B)}if(C){this.smartClickTaleTag(C)}}if(/^cut_searchfield/.test(A)){Jamendo.writeApi("pro_tracking",[A,B])}},smartClickTaleTag:function(A){if(this._clicktaletags[A]){return }this._clicktaletags[A]=true;Jamendo.onReady(function(){Jamendo.log("CT tag "+A);if(typeof ClickTaleTag=="function"){ClickTaleTag(A)}})},showBottomPlayer:function(A){if(A=="tutorial"){$("pro_page_bottomplayer_tutorial").show();$("pro_page_bottomplayer_player").hide()}else{if(A=="play"){$("pro_page_bottomplayer_tutorial").hide();$("pro_page_bottomplayer_player").show()}}$("page").style.marginBottom="70px";$("pro_page_bottomplayer").show();if($("iecrap_iframe")){$("iecrap_iframe").show()}},play:function(H,B,D){if(!Jamendo.page.usePlayer()){var C=this.parsePlayML2s(Jamendo.id2ml2(H),B);window.location=Jamendo.getEnv("HTTPHOSTI18N")+"get2/"+C;return false}else{var G=H.substring(H.lastIndexOf("/")+1);this.showBottomPlayer("play");var A=$("pro_page_bottomplayer_buy_zone_a");if(D&&D.nobuy){A.up().hide()}else{A.up().show();A.unit_id=G;A.href=Jamendo.getEnv("HTTPHOSTI18N")+"addtocart/licensing?add="+G}var E=$("pro_page_bottomplayer_download_zone_lowfi_a");if(E){E.unit_id=G;if(Jamendo.getEnv("USERID")){E.href=Jamendo.getEnv("HTTPHOSTI18N")+"download/track/"+G+"/lowfi"}else{E.href=Jamendo.getEnv("HTTPHOSTI18N")+"loginsignup?action=download_lowfi&action_unit=track&action_id="+G}}try{if(!this.pro_bottom_player){$("pro_page_bottomplayer_flashinsert_outer").innerHTML='<div id="pro_page_bottomplayer_flashinsert"></div>';this.pro_bottom_player=new Jamendo.classes.PlayerFlashObj(true,"pro_page_bottomplayer_flashinsert",H,{"l":"0"},Jamendo.page._probottom_playerurl,[625,58],function(I){Jamendo.page.playAfterInsert(H)})}else{Jamendo.page.playAfterInsert(H)}}catch(F){Jamendo.log(F)}Jamendo.page.proTracking("cut_play");return false}},playAfterInsert:function(A,B){if(B==null){var B=1}if(B>100){return null}if(typeof this.pro_bottom_player.isReady=="function"){if(this.pro_bottom_player.isReady()){this.pro_bottom_player.jsFlashAction("play",A)}else{setTimeout(function(){Jamendo.page.playAfterInsert(A,++B)},100)}}else{setTimeout(function(){Jamendo.page.playAfterInsert(A,++B)},100)}},setupLicensingAutocomplete:function(A,B){if(!B){B={}}return new Jamendo.classes.Autocompleter(Object.extend({"delay":150,"minChars":2,"dataSource":"remote","cacheGroup":"pro_search","selectCallback":Prototype.K,"fixMenu":Prototype.K,"formatItem":function(C){return"<div class='r'>"+C[0]+"</div>"},"autoSelect":true,"cached":false,"categs":[],"disableReturnSubmit":true,"autoSubmitOnBlur":true,"n":10,"input":A,"postFillMenu":function(D){var C="";D.choices.each(function(E,F){if(E[2]!=C){C=E[2];Insertion.Before(D.choices[F]._e,"<div align='left'><i>"+Jamendo.getStr("PRO_AUTOCOMPLETE_BYUNIT_"+C)+"</i></div>")}})}},B))},initProPopupPlayer:function(A){if((this.pro_popup_player==null)||(this.pro_popup_player&&this.pro_popup_player.closed)){this.pro_popup_player=window.open(A,"jamendo_pro_popup_player","width=750,height=650,menubar=no,location=no,toolbar=no,directories=no,personalbar=no,status=no,resizable=yes");if(!this.pro_popup_player){Jamendo.page.showPopupInfo();return false}}return false},showCallbackLogin:function(A,C){Jamendo.page.showLogin(A);var B=$("login_form");if(!B._submit){B._submit=B.submit}B.submit=function(){if(typeof (C)=="function"){C($("page_loginform_pseudo").getValue(),$("page_loginform_pass").getValue());return false}};return false},star:function(B,E,C,A){if(!B||!E){Jamendo.writeApi("quicklog",["emptystarunitid",window.location.toString()]);return false}var D=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},500,200);D.on();Jamendo.page.proTracking("cut_star");Jamendo.writeApiWithFeedback("pro_client_log",[B,"star",E,null,null,C],function(F,I){D.off();if(typeof (F.result)!="undefined"&&F.result!="false"&&F.result!=false){if($("playlist_stars")){var H=$("playlist_stars");var G=parseInt(F.result.gsub('"',""));H.setAttribute("href","#playlist=&profavorites="+G);H.setAttribute("onclick","return Jamendo.classes.trackSearch.profavorites_click('"+G+"');")}}});return false}});Jamendo.Pro={starred_tracks:[],loadChildSales:function(B,C,A){C=$(C);if(!C){return false}Jamendo.writeApi("pro_order",["get_children",{"parent_id":B}],function(D){return D.map(function(E){C.insert(A.interpolate(E))})})},_load_radios_superbox:function(A){SuperBox.call("localdiv","Jamform_"+A+"_radios_checkboxes_group-container","",function(){var B=Jamendo.forms[A].elements["Jamform_"+A+"_radios_ids"].value;if(B&&B.length>0){B.each(function(C){$("Jamform_pro_order_background_radios_checkboxes_"+C).checked="checked"})}},function(){chosen_radio=Jamendo.forms[A].elements["Jamform_"+A+"_radios_checkboxes"].getValue();if(chosen_radio.length>0){var B=$A();chosen_radio.each(function(C){B[C]=$$("#Jamform_"+A+"_radios_checkboxes_"+C+"-container label").first().innerHTML});B=B.compact();$("selected_radio_idstr").innerHTML=B;$("audiocds_details_container").style.visibility="visible";Jamendo.forms[A].elements["Jamform_"+A+"_radios_ids"].value=chosen_radio}});return false},_deviceClicked:function(C,B){var A=Jamendo.forms[C].elements["Jamform_"+C+"_devices_checkboxes"].getValue();if(B=="audiocds"&&A.indexOf("audiocds")>-1){Jamendo.Pro._load_radios_superbox(C)}else{if(B=="audiocds"){$("audiocds_details_container").style.visibility="hidden"}}},_radioClicked:function(A,B){var C=Jamendo.forms[B].elements["Jamform_"+B+"_radios_checkboxes"].getValue();if(C.length>3){$("Jamform_"+B+"_radios_checkboxes_"+A).checked=""}else{}return false},_backgroundTypeClicked:function(A,B){var C=$("Jamform_pro_order_surface_unit").getValue();if(A=="publicspace"){$("Jamform_pro_order_needs__publicspace-container").show();$("Jamform_pro_order_needs__event-container").hide();Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__publicspace",true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__publicspace_"+C,true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__event",false);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_datestart",false);Jamendo.Pro.surface_units.each(function(D){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__event_"+D,false);if(D!=C){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__publicspace_"+D,false)}});Jamendo.formElements.pro_totalbuilder_licensing.params["product_idstr"]="publicspace";Jamendo.formElements.pro_totalbuilder_licensing.params["nature_idstr"]="publicspace";Jamendo.formElements.pro_totalbuilder_licensing.params["unit"]="month";Jamendo.formElements.pro_totalbuilder_licensing.update()}else{if(A=="event"){$("Jamform_pro_order_needs__publicspace-container").hide();$("Jamform_pro_order_needs__event-container").show();Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__event",true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__event_"+C,true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_datestart",true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__publicspace",false);Jamendo.Pro.surface_units.each(function(D){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__publicspace_"+D,false);if(D!=C){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__event_"+D,false)}});Jamendo.formElements.pro_totalbuilder_licensing.params["product_idstr"]="event";Jamendo.formElements.pro_totalbuilder_licensing.params["nature_idstr"]="event";Jamendo.formElements.pro_totalbuilder_licensing.params["unit"]="day";Jamendo.formElements.pro_totalbuilder_licensing.update()}else{$("Jamform_"+B+"_background_type_publicspace").checked=true;Jamendo.Pro._backgroundTypeClicked("publicspace",B)}}},_surfaceUnitChanged:function(C,B){var A=$("Jamform_"+B+"_size__publicspace_"+(C=="sqm"?"sqf":"sqm")).selectedIndex;Jamendo.Pro.surface_units.each(function(D){Jamendo.forms[B].toggleRules("Jamform_"+B+"_size__publicspace_"+D,false);$("Jamform_"+B+"_size__publicspace_"+D+"-container").hide();if(D==C){$("Jamform_"+B+"_size__publicspace_"+D).selectedIndex=A}});Jamendo.forms[B].toggleRules("Jamform_"+B+"_size__publicspace_"+C,true);$("Jamform_"+B+"_size__publicspace_"+C+"-container").show();$("Jamform_"+B+"_surface_unit").value=C},_countryChanged:function(F){var B=Jamendo.forms[F]._country;var G="Jamform_"+F+"_billing_location-country";var D=$("Jamform_"+F+"_toggle_billing_location");if(!$(G)||(D&&!D.checked)){G="Jamform_"+F+"_place_location-country"}var A=Jamendo.forms[F].elements[G].getValue();if(Jamendo.Pro.squared_feet_countries){var C=(Jamendo.Pro.squared_feet_countries.indexOf(B)>-1)?"sqf":"sqm";var E=(Jamendo.Pro.squared_feet_countries.indexOf(A)>-1)?"sqf":"sqm";if(C!=E){Jamendo.Pro._surfaceUnitChanged(E,F)}}Jamendo.forms[F]._country=A;Jamendo.formElements.pro_totalbuilder_licensing.update()},_showOrHideVATNumber:function(A,B){if($("Jamform_"+B+"_tva_line-container")){if(A){$("Jamform_"+B+"_tva_line-container").show()}else{$("Jamform_"+B+"_tva_line-container").hide()}}},refreshSearchStarredResults:function(){this.starred_tracks.each(function(A){var B=$("star_"+A+"_out");if(B){B.show()}var B=$("star_"+A+"_in");if(B){B.hide()}})},updateStarButton:function(){var A=$("playlist_stars");if(!A){return }A=A.up();if(this.starred_tracks.length>0){A.show()}else{A.hide()}if(this.starred_tracks.size()==1){$("prosearch_header_favcount_multiple").hide();$("prosearch_header_favcount_one").show()}else{if(this.starred_tracks.size()>1){$("prosearch_header_favcount").update(this.starred_tracks.size());$("prosearch_header_favcount_multiple").show();$("prosearch_header_favcount_one").hide()}}},isStarred:function(A){return this.starred_tracks.include(A)},addStarred:function(A){this.starred_tracks.push(A);if($("star_"+A+"_in")){$("star_"+A+"_in").hide()}if($("star_"+A+"_out")){$("star_"+A+"_out").show()}this.updateStarButton()},removeStarred:function(A){this.starred_tracks=this.starred_tracks.without(A);if($("star_"+A+"_in")){$("star_"+A+"_in").show()}if($("star_"+A+"_out")){$("star_"+A+"_out").hide()}this.updateStarButton()}};Jamendo.classes.Cart=Class.create({itemsCount:0,tracks:[],pricePerTrack:null,currentData:{},initialize:function(){Jamendo.addObserver(["cart","add"],function(A,B){this.add(B["unit"],B["unit_id"]);window.location.search.scan(/for_replace=[\d]+/,function(C){if(this._has_replaced){return }var D=parseInt(C[0].gsub("for_replace=",""));if(D>0){this._has_replaced=true;Jamendo.ajaxRequest({"url":"/addtocart?remove="+D,"method":"post","callback":function(){Jamendo.sendEvent(["cart","remove"],{"unit":"track","unit_id":D})}})}},this)}.bind(this));Jamendo.addObserver(["cart","remove"],function(A,B){this.remove(B["unit"],B["unit_id"])}.bind(this))},add:function(B,A){this.tracks.push(A);this.reloadSidebarBlock();this.refreshSearchResults();this.reloadCartData()},remove:function(B,A){this.tracks=this.tracks.without(A);this.reloadSidebarBlock();this.refreshSearchResults();this.reloadCartData()},reloadSidebarBlock:function(){var A=$("pro_cart");if(!A){return }Jamendo.writeApi("jamblock",["pro_cart",{}],function(B){$("pro_cart").remove();$("sidebar").insert({"top":B})})},reloadCartData:function(){Jamendo.writeApi("pro_pricing",["","current_sale_rebuild_and_get_pricing",{"currency":Jamendo.getEnv("CURRENCY")}],function(A){this.currentData=A;this.updateCartData()}.bind(this))},updateCartData:function(){if(!this.currentData.nb_tracks&&!this.currentData.nature_str){$("header_cart").hide();return }if(this.currentData.nature){Jamendo.page.proTracking("cut_nature_"+this.currentData.nature)}$("header_cart_getprice").hide();$("header_cart_price").hide();$("header_cart_order").hide();if(this.currentData.nature_str){$("header_cart_nature").update(this.currentData.nature_str.capitalize());$("header_cart_nature_container").show()}else{$("header_cart_nature_container").hide();$("header_cart_getprice").show()}if(this.currentData.nb_tracks){$("header_cart_tracks_count").update(this.currentData.nb_tracks);if(this.currentData.nb_tracks>1){$("header_cart_tracks1").hide();$("header_cart_tracks2").show()}else{$("header_cart_tracks1").show();$("header_cart_tracks2").hide()}$("header_cart_tracks").show()}else{$("header_cart_tracks").hide()}if(this.currentData.nb_tracks&&this.currentData.total_ht&&this.currentData.total_ht.raw>0){$("header_cart_hasprice").show();$("header_cart_nature_container").addClassName("with_price");$("header_cart_order").show();$("header_cart_price").show().down().update(this.currentData.total_ht.sym.replace(".00",""))}else{$("header_cart_hasprice").hide();$("header_cart_nature_container").removeClassName("with_price");$("header_cart_price").hide();$("header_cart_order").hide()}$("header_cart").show()},reloadSidebarBlockWithParams:function(B){var A=$("pro_cart");if(!A){return }if(!B){B={}}Jamendo.writeApi("jamblock",["pro_cart",B],function(C){$("pro_cart").remove();$("sidebar").insert({"top":C})})},refreshSearchResults:function(){if($("results_zone")){this.tracks.each(function(A){if($("add2cart_"+A)){$("add2cart_"+A).hide();$("incart_"+A).show();$("listen_"+A).addClassName("incart")}});if(this.pricePerTrack){Jamendo.page.proTracking("cut_haspricing");if(this.currentData.nb_tracks==0){Jamendo.page.proTracking("cut_haspricingbeforecart")}$$("#results_zone .getaprice").each(function(A){A.hide()});$$("#results_zone .hasaprice").each(function(A){if(A.down()){A.down().update(this.pricePerTrack.replace(".00",""))}A.show()}.bind(this))}}if(this.pricePerTrack){$("pro_page_bottomplayer_tutorial_price").hide()}}});Jamendo.Pro.Cut={natures:{},updatePrice_nature:function(B,C,A){Jamendo.writeApi("pro_pricing",["licensing","get_minimum_pricing",{"nature":B,"currency":A}],function(D){if(D){$(C).update(D["total_ht"]["sym"])}})},_updateContactFieldsVisibility:function(A,B){if(!$("Jamform_"+A+"_client_location-container")){return }if(!$("Jamform_"+A+"__your_company-container")){return }if(B=="private"){$("Jamform_"+A+"_client_location-container").show();$A(["billing_name","legal_name","tva_number","billing_location","billing_location-address","billing_location-country","billing_location-zipcode","billing_location-city"]).each(function(C){Jamendo.forms[A].toggleRules("Jamform_"+A+"_"+C,false)});Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-address",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-country",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-zipcode",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-city",true);if(Jamendo.forms.pro_order_licensing){Jamendo.forms.pro_order_licensing._countryChanged($("Jamform_"+A+"_client_location-country").value)}}else{$("Jamform_"+A+"_client_location-container").hide();$("Jamform_"+A+"__your_company-container").show();$A(["billing_name","legal_name","tva_number","billing_location","billing_location-address","billing_location-country","billing_location-zipcode","billing_location-city"]).each(function(C){Jamendo.forms[A].toggleRules("Jamform_"+A+"_"+C,true)});Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-address",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-country",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-zipcode",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-city",false);if(Jamendo.forms.pro_order_licensing){Jamendo.forms.pro_order_licensing._countryChanged($("Jamform_"+A+"_billing_location-country").value)}}}};Jamendo.Pro_VIP={confirmProject:function(A){SuperBox.call("remote","/vip/confirm_project?id="+A,null,Prototype.K,Prototype.K,false,{"timeout":10000})},associateTracks:function(){var B=$("warnselect");var A=[];$$("#pro_vip_tracks_table input.vip_use_cb").each(function(C){if(C.checked){A.push(parseInt(C.id.gsub("boxuse_","")))}});if(!A.length){if(B){B.show()}return }else{if(B){B.hide()}}SuperBox.call("remote","/vip/associate?tracks="+A.join(" "),null,Prototype.K,Prototype.K,false,{"timeout":10000})},selectAll:function(){var A=true;$$("#pro_vip_tracks_table input.vip_use_cb").each(function(B){if(!B.checked){B.checked=true;A=false}});if(A){$$("#pro_vip_tracks_table input.vip_use_cb").each(function(B){B.checked=false})}}};var swfobject=function(){var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",FLASH_MIME_TYPE="application/x-shockwave-flash",EXPRESS_INSTALL_ID="SWFObjectExprInst",win=window,doc=document,nav=navigator,domLoadFnArr=[],regObjArr=[],timer=null,storedAltContent=null,storedAltContentId=null,isDomLoaded=false,isExpressInstallActive=false;var ua=function(){var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF&&typeof doc.appendChild!=UNDEF&&typeof doc.replaceChild!=UNDEF&&typeof doc.removeChild!=UNDEF&&typeof doc.cloneNode!=UNDEF,playerVersion=[0,0,0],d=null;if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){d=nav.plugins[SHOCKWAVE_FLASH].description;if(d){d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);playerVersion[2]=/r/.test(d)?parseInt(d.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof win.ActiveXObject!=UNDEF){var a=null,fp6Crash=false;try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".7")}catch(e){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".6");playerVersion=[6,0,21];a.AllowScriptAccess="always"}catch(e){if(playerVersion[0]==6){fp6Crash=true}}if(!fp6Crash){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX)}catch(e){}}}if(!fp6Crash&&a){try{d=a.GetVariable("$version");if(d){d=d.split(" ")[1].split(",");playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)]}}catch(e){}}}}var u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=false,windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u);/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/return{w3cdom:w3cdom,pv:playerVersion,webkit:webkit,ie:ie,win:windows,mac:mac}}();var onDomLoad=function(){if(!ua.w3cdom){return }addDomLoadEvent(main);if(ua.ie&&ua.win){try{doc.write("<scr"+"ipt id=__ie_ondomload defer=true src=//:></scr"+"ipt>");var s=getElementById("__ie_ondomload");if(s){s.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);callDomLoadFunctions()}}}}catch(e){}}if(ua.webkit&&typeof doc.readyState!=UNDEF){timer=setInterval(function(){if(/loaded|complete/.test(doc.readyState)){callDomLoadFunctions()}},10)}if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,null)}addLoadEvent(callDomLoadFunctions)}();function callDomLoadFunctions(){if(isDomLoaded){return }if(ua.ie&&ua.win){var s=createElement("span");try{var t=doc.getElementsByTagName("body")[0].appendChild(s);t.parentNode.removeChild(t)}catch(e){return }}isDomLoaded=true;if(timer){clearInterval(timer);timer=null}var dl=domLoadFnArr.length;for(var i=0;i<dl;i++){domLoadFnArr[i]()}}function addDomLoadEvent(fn){if(isDomLoaded){fn()}else{domLoadFnArr[domLoadFnArr.length]=fn}}function addLoadEvent(fn){if(typeof win.addEventListener!=UNDEF){win.addEventListener("load",fn,false)}else{if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("load",fn,false)}else{if(typeof win.attachEvent!=UNDEF){win.attachEvent("onload",fn)}else{if(typeof win.onload=="function"){var fnOld=win.onload;win.onload=function(){fnOld();fn()}}else{win.onload=fn}}}}}function main(){var rl=regObjArr.length;for(var i=0;i<rl;i++){var id=regObjArr[i].id;if(ua.pv[0]>0){var obj=getElementById(id);if(obj){regObjArr[i].width=obj.getAttribute("width")?obj.getAttribute("width"):"0";regObjArr[i].height=obj.getAttribute("height")?obj.getAttribute("height"):"0";if(hasPlayerVersion(regObjArr[i].swfVersion)){if(ua.webkit&&ua.webkit<312){fixParams(obj)}setVisibility(id,true)}else{if(regObjArr[i].expressInstall&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)){showExpressInstall(regObjArr[i])}else{displayAltContent(obj)}}}}else{setVisibility(id,true)}}}function fixParams(obj){var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var e=createElement("embed"),a=nestedObj.attributes;if(a){var al=a.length;for(var i=0;i<al;i++){if(a[i].nodeName.toLowerCase()=="data"){e.setAttribute("src",a[i].nodeValue)}else{e.setAttribute(a[i].nodeName,a[i].nodeValue)}}}var c=nestedObj.childNodes;if(c){var cl=c.length;for(var j=0;j<cl;j++){if(c[j].nodeType==1&&c[j].nodeName.toLowerCase()=="param"){e.setAttribute(c[j].getAttribute("name"),c[j].getAttribute("value"))}}}obj.parentNode.replaceChild(e,obj)}}function fixObjectLeaks(id){if(ua.ie&&ua.win&&hasPlayerVersion("8.0.0")){win.attachEvent("onunload",function(){var obj=getElementById(id);if(obj){for(var i in obj){if(typeof obj[i]=="function"){obj[i]=function(){}}}obj.parentNode.removeChild(obj)}})}}function showExpressInstall(regObj){isExpressInstallActive=true;var obj=getElementById(regObj.id);if(obj){if(regObj.altContentId){var ac=getElementById(regObj.altContentId);if(ac){storedAltContent=ac;storedAltContentId=regObj.altContentId}}else{storedAltContent=abstractAltContent(obj)}if(!(/%$/.test(regObj.width))&&parseInt(regObj.width,10)<310){regObj.width="310"}if(!(/%$/.test(regObj.height))&&parseInt(regObj.height,10)<137){regObj.height="137"}doc.title=doc.title.slice(0,47)+" - Flash Player Installation";var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",dt=doc.title,fv="MMredirectURL="+win.location+"&MMplayerType="+pt+"&MMdoctitle="+dt,replaceId=regObj.id;if(ua.ie&&ua.win&&obj.readyState!=4){var newObj=createElement("div");replaceId+="SWFObjectNew";newObj.setAttribute("id",replaceId);obj.parentNode.insertBefore(newObj,obj);obj.style.display="none";win.attachEvent("onload",function(){obj.parentNode.removeChild(obj)})}createSWF({data:regObj.expressInstall,id:EXPRESS_INSTALL_ID,width:regObj.width,height:regObj.height},{flashvars:fv},replaceId)}}function displayAltContent(obj){if(ua.ie&&ua.win&&obj.readyState!=4){var el=createElement("div");obj.parentNode.insertBefore(el,obj);el.parentNode.replaceChild(abstractAltContent(obj),el);obj.style.display="none";win.attachEvent("onload",function(){obj.parentNode.removeChild(obj)})}else{obj.parentNode.replaceChild(abstractAltContent(obj),obj)}}function abstractAltContent(obj){var ac=createElement("div");if(ua.win&&ua.ie){ac.innerHTML=obj.innerHTML}else{var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var c=nestedObj.childNodes;if(c){var cl=c.length;for(var i=0;i<cl;i++){if(!(c[i].nodeType==1&&c[i].nodeName.toLowerCase()=="param")&&!(c[i].nodeType==8)){ac.appendChild(c[i].cloneNode(true))}}}}}return ac}function createSWF(attObj,parObj,id){var r,el=getElementById(id);if(typeof attObj.id==UNDEF){attObj.id=id}if(ua.ie&&ua.win){var att="";for(var i in attObj){if(attObj[i]!=Object.prototype[i]){if(i=="data"){parObj.movie=attObj[i]}else{if(i.toLowerCase()=="styleclass"){att+=' class="'+attObj[i]+'"'}else{if(i!="classid"){att+=" "+i+'="'+attObj[i]+'"'}}}}}var par="";for(var j in parObj){if(parObj[j]!=Object.prototype[j]){par+='<param name="'+j+'" value="'+parObj[j]+'" />'}}el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+">"+par+"</object>";fixObjectLeaks(attObj.id);r=getElementById(attObj.id)}else{if(ua.webkit&&ua.webkit<312){var e=createElement("embed");e.setAttribute("type",FLASH_MIME_TYPE);for(var k in attObj){if(attObj[k]!=Object.prototype[k]){if(k=="data"){e.setAttribute("src",attObj[k])}else{if(k.toLowerCase()=="styleclass"){e.setAttribute("class",attObj[k])}else{if(k!="classid"){e.setAttribute(k,attObj[k])}}}}}for(var l in parObj){if(parObj[l]!=Object.prototype[l]){if(l!="movie"){e.setAttribute(l,parObj[l])}}}el.parentNode.replaceChild(e,el);r=e}else{var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);for(var m in attObj){if(attObj[m]!=Object.prototype[m]){if(m.toLowerCase()=="styleclass"){o.setAttribute("class",attObj[m])}else{if(m!="classid"){o.setAttribute(m,attObj[m])}}}}for(var n in parObj){if(parObj[n]!=Object.prototype[n]&&n!="movie"){createObjParam(o,n,parObj[n])}}el.parentNode.replaceChild(o,el);r=o}}return r}function createObjParam(el,pName,pValue){var p=createElement("param");p.setAttribute("name",pName);p.setAttribute("value",pValue);el.appendChild(p)}function getElementById(id){return doc.getElementById(id)}function createElement(el){return doc.createElement(el)}function hasPlayerVersion(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10);v[2]=parseInt(v[2],10);return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false}function createCSS(sel,decl){if(ua.ie&&ua.mac){return }var h=doc.getElementsByTagName("head")[0],s=createElement("style");s.setAttribute("type","text/css");s.setAttribute("media","screen");if(!(ua.ie&&ua.win)&&typeof doc.createTextNode!=UNDEF){s.appendChild(doc.createTextNode(sel+" {"+decl+"}"))}h.appendChild(s);if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0){var ls=doc.styleSheets[doc.styleSheets.length-1];if(typeof ls.addRule==OBJECT){ls.addRule(sel,decl)}}}function setVisibility(id,isVisible){var v=isVisible?"visible":"hidden";if(isDomLoaded){getElementById(id).style.visibility=v}else{createCSS("#"+id,"visibility:"+v)}}return{registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr){if(!ua.w3cdom||!objectIdStr||!swfVersionStr){return }var regObj={};regObj.id=objectIdStr;regObj.swfVersion=swfVersionStr;regObj.expressInstall=xiSwfUrlStr?xiSwfUrlStr:false;regObjArr[regObjArr.length]=regObj;setVisibility(objectIdStr,false)},getObjectById:function(objectIdStr){var r=null;if(ua.w3cdom&&isDomLoaded){var o=getElementById(objectIdStr);if(o){var n=o.getElementsByTagName(OBJECT)[0];if(!n||(n&&typeof o.SetVariable!=UNDEF)){r=o}else{if(typeof n.SetVariable!=UNDEF){r=n}}}}return r},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj){if(!ua.w3cdom||!swfUrlStr||!replaceElemIdStr||!widthStr||!heightStr||!swfVersionStr){return }widthStr+="";heightStr+="";if(hasPlayerVersion(swfVersionStr)){setVisibility(replaceElemIdStr,false);var att=(typeof attObj==OBJECT)?attObj:{};att.data=swfUrlStr;att.width=widthStr;att.height=heightStr;var par=(typeof parObj==OBJECT)?parObj:{};if(typeof flashvarsObj==OBJECT){for(var i in flashvarsObj){if(flashvarsObj[i]!=Object.prototype[i]){if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+i+"="+flashvarsObj[i]}else{par.flashvars=i+"="+flashvarsObj[i]}}}}addDomLoadEvent(function(){createSWF(att,par,replaceElemIdStr);if(att.id==replaceElemIdStr){setVisibility(replaceElemIdStr,true)}})}else{if(xiSwfUrlStr&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)){setVisibility(replaceElemIdStr,false);addDomLoadEvent(function(){var regObj={};regObj.id=regObj.altContentId=replaceElemIdStr;regObj.width=widthStr;regObj.height=heightStr;regObj.expressInstall=xiSwfUrlStr;showExpressInstall(regObj)})}}},getFlashPlayerVersion:function(){return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]}},hasFlashPlayerVersion:hasPlayerVersion,createSWF:function(attObj,parObj,replaceElemIdStr){if(ua.w3cdom&&isDomLoaded){return createSWF(attObj,parObj,replaceElemIdStr)}else{return undefined}},createCSS:function(sel,decl){if(ua.w3cdom){createCSS(sel,decl)}},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,getQueryParamValue:function(param){var q=doc.location.search||doc.location.hash;if(param==null){return q}if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(isExpressInstallActive&&storedAltContent){var obj=getElementById(EXPRESS_INSTALL_ID);if(obj){obj.parentNode.replaceChild(storedAltContent,obj);if(storedAltContentId){setVisibility(storedAltContentId,true);if(ua.ie&&ua.win){storedAltContent.style.display="block"}}storedAltContent=null;storedAltContentId=null;isExpressInstallActive=false}}}}}();Jamendo.classes.SuperBox=Class.create({closeWord:"close",loadImage:"http://img.jamendo.com/superboxloading.gif",widthParam:"sbw",heightParam:"sbh",addUrlParams:"output=superbox",cb_show:[],removable:true,cb_remove:[],defaultWidth:0,defaultHeight:0,mode:null,jamform:false,fastmode:false,initialize:function(){Jamendo.onReady(function(){if(!this.fastmode){this.cb_show.push(this.hideObjects.bind(this));this.cb_remove.push(this.showObjects.bind(this))}}.bind(this))},hideObjects:function(){var A=$A(document.getElementsByTagName("object"));A.each(function(B){B=$(B);if(!B.up("#SuperBox_ajaxContent")){B.setStyle({"visibility":"hidden"})}});if($("pro_page_bottomplayer")&&$("pro_page_bottomplayer").style.display!="none"){$("pro_page_bottomplayer")._hiddenBySuperbox=true;$("pro_page_bottomplayer").style.visibility="hidden"}},showObjects:function(){var A=$A(document.getElementsByTagName("object"));A.each(function(B){B=$(B);if(!B.up("#SuperBox_ajaxContent")){B.setStyle({"visibility":"visible"})}});if($("pro_page_bottomplayer")&&$("pro_page_bottomplayer")._hiddenBySuperbox){$("pro_page_bottomplayer")._hiddenBySuperbox=false;$("pro_page_bottomplayer").style.visibility="visible"}},reset:function(){this.w=this.defaultWidth;this.h=this.defaultHeight;this.t="";this.s=false;this.shown=false},registerNow:function(A,B){$$(A).each(function(C){SuperBox.registerElt(C,B)})},register:function(A,B){Jamendo.onReady(function(){this.registerNow(A,B)}.bind(this))},registerElt:function(B,A){B.onclick=function(){return false}.bindAsEventListener(B);Event.observe(B,"click",function(){var C=this.title||this.innerHTML||this.href;SuperBox.call("remote",A||this.href,C);this.blur()}.bindAsEventListener(B))},call:function(F,A,M,B,J,L,H){try{if(typeof ClickTaleExec=="function"){ClickTaleExec("SuperBox.call.apply(SuperBox,"+Object.toJSON($A(arguments))+");")}if(!F){F="remote"}this.jamform=(L===true);this._remove_cb=J;if(F=="remote"&&(typeof A)!="string"&&("href" in A)){this.url=A.href}else{this.url=A}this.mode=F;this.reset();this.caption=M;this.baseinsert();if(this.jamform&&Prototype.Browser.IE){this.show();$("SuperBox_window").setStyle({opacity:0})}if(Prototype.Browser.IE){$$("select").each(function(N){Element.hide(N)})}if(Prototype.Browser.Opera){$$("iframe").each(function(N){Element.hide(N)})}this.wro=this.position.bindAsEventListener(this);this.position();if(!this.fastmode){Event.observe(window,"resize",this.wro)}if(F=="remote"&&this.url.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){this.t="img";this.img=new Image();this.img.onload=this.show.bindAsEventListener(this);this.img.src=this.url}else{if(F=="wait"){}else{this.t="html";if(F=="remote"){var I=this.url.replace(/^[^\?]+\??/,"");var C=this.parseQuery(I);if(C[this.widthParam]){this.setDim(C[this.widthParam],C[this.heightParam],true)}else{this.setDim(950,500,true)}}this.htmlinsert();if(F=="remote"){var K={"callback":function(N){if(!$("SuperBox_ajaxContent")){return this.remove()}$("SuperBox_ajaxContent").update(N);$("SuperBox_ajaxUrl").update(this.urlcat(this.url,this.addUrlParams));if(typeof (B)=="function"){B()}if(this.jamform&&Prototype.Browser.IE){$("SuperBox_load").hide();$("SuperBox_window").setStyle({opacity:1})}else{this.show()}}.bind(this),"url":this.urlcat(this.url,this.addUrlParams),"timeout":4000,"retryDelay":0,"errback":function(){this.remove()}.bind(this)};if(typeof (H)!="undefined"){K=Object.extend(K,H)}Jamendo.ajaxRequest(K);$("SuperBox_ajaxContent").addClassName("superbox_remote")}else{if(F=="localdiv"){var E=$(A).innerHTML;var D=$(A).getDimensions();if(!(D.width>0)){D={width:parseInt($(A).style.width),height:parseInt($(A).style.height)}}$(A).innerHTML="";$("SuperBox_ajaxContent").innerHTML=E;if(typeof (B)=="function"){B()}this.setDim(D.width,D.height);this.show()}}}}}catch(G){Jamendo.log(G);return true}return false},urlcat:function(A,B){if(A.indexOf("?")<0){return A+"?"+B}else{return A+"&"+B}},baseinsert:function(){if(this.fastmode){return new Insertion.Bottom($("body"),"<div id='SuperBox_global'><div id='SuperBox_window' style='display:none;'></div></div>")}else{return new Insertion.Bottom($$("body")[0],"<div id='SuperBox_global'><div id='SuperBox_overlay' onclick='return SuperBox.remove();'></div><div id='SuperBox_window' style='display:none;'></div><div id='SuperBox_load' onclick='return SuperBox.remove();'><div id='SuperBox_loadContent'><img src='"+this.loadImage+"' /></div></div></div>")}},htmlinsert:function(){return new Insertion.Bottom("SuperBox_window","<div id='SuperBox_closeAjaxWindow' ><a href='#' id='SuperBox_closeWindowButton' onclick='SuperBox.remove();return false;'>"+this.closeWord+"</a></div><div id='SuperBox_ajaxContent'></div><div style='background: none repeat scroll 0% 0% black; position: absolute; opacity: 0.6; display:none;' id='SuperBox_overlay_inner'><img style='position: absolute; right: 50%; top: 50%;' src='"+this.loadImage+"' /></div><div style='display:none;' id='SuperBox_ajaxUrl'></div>")},imginsert:function(){try{$("SuperBox_Img").remove()}catch(A){}return new Insertion.Bottom("SuperBox_window","<div id='SuperBox_Img'><a href='' onclick='return SuperBox.remove();' id='SuperBox_ImageOff' title='Close'><img id='SuperBox_Image' src='"+this.url+"' style='"+this.ciw+"px;height:"+this.cih+"px' alt='"+this.caption+"'/></a><div id='SuperBox_caption'>"+this.caption+"</div><div id='SuperBox_closeWindow' onclick='SuperBox.remove(); return false;'><a href='#' id='SuperBox_closeWindowButton'>"+this.closeWord+"</a></div></div>")},show:function(){this.s=true;if(this.t=="img"){this.iw=this.img.width;this.ih=this.img.height;this.position();this.imginsert()}else{this.position()}this.shown=true;if(this.w>0||this.jamform){if(!this.fastmode&&!(this.jamform&&Prototype.Browser.IE)){$("SuperBox_load").hide()}$("SuperBox_window").show()}this.cb_show.each(function(A){A()})},remove:function(C){if(!this.removable&&(C!==true)){return false}if(typeof ClickTaleExec=="function"){ClickTaleExec("SuperBox.remove(true);")}this.shown=false;var A=$("SuperBox_global");if(!A){return }this.cb_remove.each(function(D){D()});if(this._remove_cb){this._remove_cb()}A.hide();if(!this.fastmode){Event.stopObserving(window,"resize",this.wro)}if(this.mode=="localdiv"){var B=$("SuperBox_ajaxContent").innerHTML;$("SuperBox_ajaxContent").innerHTML="";new Insertion.Bottom(this.url,B)}A.remove();if(Prototype.Browser.IE){$$("select").each(function(D){Element.show(D)})}if(Prototype.Browser.Opera){$$("iframe").each(function(D){Element.show(D)})}return false},position:function(){if(this.fastmode){if(this.t=="img"){this.imgsize();this.imginsert()}else{if(this.t=="html"){if(!$("SuperBox_ajaxContent")){return this.remove()}$("SuperBox_window").setStyle({position:"fixed",top:"30px",left:"30px"});if(this.h==0){$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px"})}else{$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px",height:(this.h-49)+"px"})}}}}else{var A=this.getPageSize();if(window.innerHeight&&window.scrollMaxY){yScroll=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){yScroll=document.body.scrollHeight}else{yScroll=document.body.offsetHeight}}var B=this.getPageScrollTop();if(this.t=="img"){this.imgsize();this.imginsert()}else{if(this.t=="html"){if(!$("SuperBox_ajaxContent")){return this.remove()}if(this.h==0){$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px"})}else{$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px",height:(this.h-49)+"px"})}}}if(this.h==0){$("SuperBox_window").setStyle({width:this.w+"px",left:((A[0]-this.w)/2)+"px",top:(B[1]+30)+"px"});$("SuperBox_load").setStyle({top:(B[1]+40+((A[1])/2))+"px"})}else{$("SuperBox_window").setStyle({width:this.w+"px",height:this.h+"px",left:((A[0]-this.w)/2)+"px",top:(B[1]+((A[1]-this.h)/2))+"px"});$("SuperBox_load").setStyle({top:(B[1]+40+((A[1])/2))+"px"})}if(this.s&&$("SuperBox_overlay_inner")){$("SuperBox_overlay_inner").setStyle({width:this.w+"px",height:this.h+"px",left:0,top:0})}var C=0;if(typeof (window.innerHeight)=="number"){C=window.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){C=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){C=document.body.clientHeight}}}$("SuperBox_overlay").setStyle({"height":Math.max(C,yScroll)+"px"})}},setDim:function(A,B,C){this.w=A*1+30;if(!B){this.h=0}else{this.h=B*1+40}if(this.s&&!C){this.show()}},imgsize:function(){var B=this.getPageSize();var A=B[0]-100;var C=B[1]-100;this.ciw=this.iw;this.cih=this.ih;(2).times(function(){if(this.ciw>A){this.cih=this.cih*(A/this.ciw);this.ciw=A}if(this.cih>C){this.ciw=this.ciw*(C/this.cih);this.cih=C}}.bind(this));this.w=this.ciw+30;this.h=this.cih+60},getPageScrollTop:function(){var B;var A=document.documentElement;if(self.pageYOffset){B=self.pageYOffset}else{if(A&&A.scrollTop){B=A.scrollTop}else{if(document.body){B=document.body.scrollTop}}}arrayPageScroll=new Array("",B);return arrayPageScroll},getPageSize:function(){var C=document.documentElement;var A=self.innerWidth||(C&&C.clientWidth)||document.body.clientWidth;var B=self.innerHeight||(C&&C.clientHeight)||document.body.clientHeight;arrayPageSize=new Array(A,B);return arrayPageSize},parseQuery:function(D){var G=new Object();if(!D){return G}var A=D.split(/[;&]/);for(var C=0;C<A.length;C++){var E=A[C].split("=");if(!E||E.length!=2){continue}var B=unescape(E[0]);var F=unescape(E[1]);F=F.replace(/\+/g," ");G[B]=F}return G}});var SuperBox=new Jamendo.classes.SuperBox();Jamendo.classes.PlayerFlashObj=Class.create({_obj:null,initialize:function(B,D,G,A,C,K,E){if(!this._obj){var F=K[0];var J=K[1];var H="http://img.jamendo.com/orange/player/expressinstall.swf";var I={"lang":Jamendo.getEnv("LANG"),"p":B?1:0};if(location.href){I.m=G}I.refuid=Jamendo.getEnv("USERID");I.refuname=Jamendo.getEnv("USERNAME");I.sessid=Cookie.get("jamI");if(I.sessid){I.sessid=I.sessid.split("|")[0]}else{I.sessid=false}I.httphosti18n=Jamendo.getEnv("HTTPHOSTI18N");I.external=Jamendo.page.usePlayer()?0:1;I.debug="debug" in location.href.toQueryParams();if(A){$H(A).each(function(L){I[L.key]=L.value})}swfobject.isExpressInstallActive=true;if(Jamendo.getEnv("MOD")=="pro"){swfobject.embedSWF(C,D,F,J,"8.0.0",H,I,{allowScriptAccess:"always",swLiveConnect:"true"},{id:D,name:D})}else{swfobject.embedSWF(C,D,F,J,"8.0.0",H,I,{allowScriptAccess:"always",swLiveConnect:"true",wmode:"transparent"},{id:D,name:D})}swfobject.addDomLoadEvent(function(){var M=document.getElementById(D);var L=M.getElementsByTagName("object")[0];if(M){if(!L||(L&&typeof M.SetVariable!="undefined")){this._obj=M}else{if(typeof L.SetVariable!="undefined"){this._obj=L}else{return }}if(E){E(this._obj)}}}.bind(this))}},isReady:function(){if(this._obj){if(typeof this._obj.isReady=="function"){if(this._obj.isReady()==true){return true}}}return false},jsFlashAction:function(B,A){if(typeof this._obj.jsFlashAction=="function"){this._obj.jsFlashAction(B,A)}}});Jamendo.classes.Autocompleter=Class.create({initialize:function(A){this.active=false;this.shown=false;this.hasFocus=false;this.currentHover=-1;this.currentRequest=false;this.o=Object.extend({"name":"jamAC_"+Math.random(),"delay":150,"minChars":2,"breakChars":[],"dataSource":"remote","cacheGroup":"","selectCallback":Prototype.K,"fixMenu":Prototype.K,"formatItem":function(B){return B[0]},"postFillMenu":Prototype.K,"autoSelect":false,"cached":true,"categs":[],"disableReturnSubmit":true,"autoSubmitOnBlur":false,"n":10,"input":false},A);this.buildInput();this.buildMenu()},getChoices:function(B,C){if(this.o.breakChars.length>0&&B.gsub(new RegExp("["+this.o.breakChars.join("")+"]+"),"")!=B){return setTimeout(function(){C([])},10)}if(B.length<this.o.minChars){return setTimeout(function(){C([])},10)}B=B.toLowerCase();if(this.o.dataSource=="remote"){if(this.currentRequest){this.currentRequest.abort()}this.currentRequest=Jamendo.writeApi((this.o.cached?"cached ":"")+"autocomplete",[B,this.o.categs,this.o.n,this.o.cacheGroup],C)}else{var A=(B?this.o.data.findAll(function(D){if(D[0].toLowerCase().indexOf(B)>=0){return true}}):this.o.data);setTimeout(function(){C({"r":A})},10)}},buildInput:function(){if(this.o.input){this.input=$(this.o.input)}if(!this.input){return }this.input.setAttribute("autocomplete","off");Event.observe(this.input,"keydown",this.onKeyDown.bindAsEventListener(this));Event.observe(this.input,"keypress",this.onKeyPress.bindAsEventListener(this));Event.observe(this.input,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.input,"focus",this.onFocus.bindAsEventListener(this))},buildMenu:function(){this.menu=document.createElement("div");this.menu.id="jamACMenu_"+this.o.name;this.menu.className="jamACMenu";this.menu.style.display="none";this.menu.style.position="absolute";$("jamBodyInsert").appendChild(this.menu);this.menu=$(this.menu);this.menuInner=document.createElement("div");this.menuInner.id="jamACMenuInner_"+this.o.name;this.menuInner.className="jamACMenuInner";this.menu.appendChild(this.menuInner);this.menuInner=$(this.menuInner)},fillMenu:function(A,B){this.currentHover=-1;this.menuInner.innerHTML="";this.choices=A.r||[];this.choices.each(function(C,D){this.choices[D]._e=document.createElement("div");this.choices[D]._e.className="jamACMenuItem";this.choices[D]._e.innerHTML=this.o.formatItem(C);Event.observe(this.choices[D]._e,"mouseover",this.hoverItemByIndex.bind(this,D));Event.observe(this.choices[D]._e,"mouseout",this.unhoverItemByIndex.bind(this,D));Event.observe(this.choices[D]._e,"mousedown",this.selectItemByIndex.bind(this,D));this.menuInner.appendChild(this.choices[D]._e);this.choices[D]._e=$(this.choices[D]._e)}.bind(this));this.o.postFillMenu(this);if(B){if(this.choices.length==0){this.hideMenu()}else{this.showMenu()}}},selectItemByIndex:function(B){var A=this.input.value;this.input.value=this.choices[B][0];this.hideMenu();this.o.selectCallback(this.choices[B],A)},hoverItemByIndex:function(A){if(this.choices.length==0){return }if(A==-2){A=-1}if(this.currentHover>=0){this.unhoverItemByIndex(this.currentHover)}this.currentHover=(A+this.choices.length)%(this.choices.length);this.choices[this.currentHover]._e.addClassName("jamACMenuItem_hover")},unhoverItemByIndex:function(A){this.choices[A]._e.removeClassName("jamACMenuItem_hover")},showMenu:function(){if(this.input){var B=this.input.getDimensions();var A=this.menu.getDimensions();if(this.menu.getDimensions().width>B.width){this.menu.clonePosition(this.input,{"offsetTop":B.height,"setWidth":false})}else{this.menu.clonePosition(this.input,{"offsetTop":B.height});this.o.fixMenu.bind(this)(this.menu)}}if(this.currentHover==-1&&this.o.autoSelect){this.hoverItemByIndex(0)}this.menu.show();this.shown=true},hideMenu:function(A){if(A&&this.currentRequest){this.currentRequest.abort()}this.shown=false;this.currentHover=-1;this.menu.hide()},onBlur:function(){if(this.o.autoSubmitOnBlur){if(this.currentHover>=0){this.selectItemByIndex(this.currentHover);this.needsKeyPressFix=true;Event.stop(event)}}else{if(this.currentRequest){this.currentRequest.abort()}}this.hideMenu();this.active=false;this.hasFocus=false},onFocus:function(){this.hideMenu();this.active=true;this.hasFocus=true;this.getChoicesFromInput()},onKeyPress:function(A){if(this.needsKeyPressFix&&A.keyCode==Event.KEY_RETURN&&this.o.disableReturnSubmit){Event.stop(A);this.needsKeyPressFix=false}},onKeyDown:function(A){this.needsKeyPressFix=false;if(!this.hasFocus){this.onFocus()}if(this.shown){switch(A.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:if(this.currentHover>=0){this.selectItemByIndex(this.currentHover);this.needsKeyPressFix=true;Event.stop(A)}else{if(A.keyCode==Event.KEY_TAB){return }}case Event.KEY_ESC:this.hideMenu();Event.stop(A);return ;case Event.KEY_LEFT:case Event.KEY_RIGHT:return ;case 63232:case Event.KEY_UP:this.hoverItemByIndex(this.currentHover-1);if(Prototype.Browser.WebKit){Event.stop(A)}return ;case 63233:case Event.KEY_DOWN:this.hoverItemByIndex(this.currentHover+1);if(Prototype.Browser.WebKit){Event.stop(A)}return }}else{if(A.keyCode==Event.KEY_TAB||A.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&A.keyCode==0)){return }}if(this.queryTimeout){clearTimeout(this.queryTimeout)}this.queryTimeout=setTimeout(this.getChoicesFromInput.bind(this),this.o.delay)},getChoicesFromInput:function(){this.getChoices(this.input.value,function(A){this.fillMenu(A,true)}.bind(this))}})
