var Prototype={Version:"1.6.0.2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},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 Class={create:function(){var B=null,C=$A(arguments);if(Object.isFunction(C[0])){B=C.shift()}function A(){this.initialize.apply(this,arguments)}Object.extend(A,Class.Methods);A.superclass=B;A.subclasses=[];if(B){var E=function(){};E.prototype=B.prototype;A.prototype=new E;B.subclasses.push(A)}for(var D=0;D<C.length;D++){A.addMethods(C[D])}if(!A.prototype.initialize){A.prototype.initialize=Prototype.emptyFunction}A.prototype.constructor=A;return A}};Class.Methods={addMethods:function(B){var E=this.superclass&&this.superclass.prototype;var D=Object.keys(B);if(!Object.keys({toString:true}).length){D.push("toString","valueOf")}for(var F=0,C=D.length;F<C;F++){var A=D[F],G=B[A];if(E&&Object.isFunction(G)&&G.argumentNames().first()=="$super"){var H=G,G=Object.extend((function(I){return function(){return E[I].apply(this,arguments)}})(A).wrap(H),{valueOf:function(){return H},toString:function(){return H.toString()}})}this.prototype[A]=G}return this}};var Abstract={};Object.extend=function(C,B){for(var A in B){C[A]=B[A]}return C};Object.extend(Object,{inspect:function(A){try{if(Object.isUndefined(A)){return"undefined"}if(A===null){return"null"}return A.inspect?A.inspect():String(A)}catch(B){if(B instanceof RangeError){return"..."}throw B}},toJSON:function(C){var D=typeof C;switch(D){case"undefined":case"function":case"unknown":return ;case"boolean":return C.toString()}if(C===null){return"null"}if(C.toJSON){return C.toJSON()}if(Object.isElement(C)){return }var B=[];for(var A in C){var E=Object.toJSON(C[A]);if(!Object.isUndefined(E)){B.push(A.toJSON()+": "+E)}}return"{"+B.join(", ")+"}"},toQueryString:function(A){return $H(A).toQueryString()},toHTML:function(A){return A&&A.toHTML?A.toHTML():String.interpret(A)},keys:function(B){var C=[];for(var A in B){C.push(A)}return C},values:function(B){var C=[];for(var A in B){C.push(B[A])}return C},clone:function(A){return Object.extend({},A)},isElement:function(A){return A&&A.nodeType==1},isArray:function(A){return A!=null&&typeof A=="object"&&"splice" in A&&"join" in A},isHash:function(A){return A instanceof Hash},isFunction:function(A){return typeof A=="function"},isString:function(A){return typeof A=="string"},isNumber:function(A){return typeof A=="number"},isUndefined:function(A){return typeof A=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var A=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return A.length==1&&!A[0]?[]:A},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var C=this,A=$A(arguments),B=A.shift();return function(){return C.apply(B,A.concat($A(arguments)))}},bindAsEventListener:function(){var C=this,A=$A(arguments),B=A.shift();return function(D){return C.apply(B,[D||window.event].concat(A))}},curry:function(){if(!arguments.length){return this}var B=this,A=$A(arguments);return function(){return B.apply(this,A.concat($A(arguments)))}},delay:function(){var C=this,B=$A(arguments),A=B.shift()*1000;return window.setTimeout(function(){return C.apply(C,B)},A)},wrap:function(B){var A=this;return function(){return B.apply(this,[A.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized){return this._methodized}var A=this;return this._methodized=function(){return A.apply(null,[this].concat($A(arguments)))}}});Function.prototype.defer=Function.prototype.delay.curry(0.01);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"'};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}};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()}finally{this.currentlyExecuting=false}}}});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,{gsub:function(B,D){var E="",A=this,C;D=arguments.callee.prepareReplacement(D);while(A.length>0){if(C=A.match(B)){E+=A.slice(0,C.index);E+=String.interpret(D(C));A=A.slice(C.index+C[0].length)}else{E+=A,A=""}}return E},sub:function(A,B,C){B=this.gsub.prepareReplacement(B);C=Object.isUndefined(C)?1:C;return this.gsub(A,function(D){if(--C<0){return D[0]}return B(D)})},scan:function(A,B){this.gsub(A,B);return String(this)},truncate:function(A,B){A=A||30;B=Object.isUndefined(B)?"...":B;return this.length>A?this.slice(0,A-B.length)+B:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var B=new RegExp(Prototype.ScriptFragment,"img");var A=new RegExp(Prototype.ScriptFragment,"im");return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var A=arguments.callee;A.text.data=this;return A.div.innerHTML},unescapeHTML:function(){var A=new Element("div");A.innerHTML=this.stripTags();return A.childNodes[0]?(A.childNodes.length>1?$A(A.childNodes).inject("",function(B,C){return B+C.nodeValue}):A.childNodes[0].nodeValue):""},toQueryParams:function(B){var A=this.strip().match(/([^?#]*)(#.*)?$/);if(!A){return{}}return A[1].split(B||"&").inject({},function(E,F){if((F=F.split("="))[0]){var C=decodeURIComponent(F.shift());var D=F.length>1?F.join("="):F[0];if(D!=undefined){D=decodeURIComponent(D)}if(C in E){if(!Object.isArray(E[C])){E[C]=[E[C]]}E[C].push(D)}else{E[C]=D}}return E})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(A){return A<1?"":new Array(A+1).join(this)},camelize:function(){var D=this.split("-"),A=D.length;if(A==1){return D[0]}var B=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];for(var C=1;C<A;C++){B+=D[C].charAt(0).toUpperCase()+D[C].substring(1)}return B},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(B){var A=this.gsub(/[\x00-\x1f\\]/,function(C){var D=String.specialChar[C[0]];return D?D:"\\u00"+C[0].charCodeAt().toPaddedString(2,16)});if(B){return'"'+A.replace(/"/g,'\\"')+'"'}return"'"+A.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(A){return this.sub(A||Prototype.JSONFilter,"#{1}")},isJSON:function(){var A=this;if(A.blank()){return false}A=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(A)},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(A){return this.indexOf(A)>-1},startsWith:function(A){return this.indexOf(A)===0},endsWith:function(A){var B=this.length-A.length;return B>=0&&this.lastIndexOf(A)===B},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(B,A){return new Template(this,A).evaluate(B)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(B){if(Object.isFunction(B)){return B}var A=new Template(B);return function(C){return A.evaluate(C)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text)}var Template=Class.create({initialize:function(B,A){this.template=B.toString();this.pattern=A||Template.Pattern},evaluate:function(A){if(Object.isFunction(A.toTemplateReplacements)){A=A.toTemplateReplacements()}return this.template.gsub(this.pattern,function(F){if(A==null){return""}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].gsub("\\\\]","]"):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={each:function(C,B){var A=0;C=C.bind(B);try{this._each(function(E){C(E,A++)})}catch(D){if(D!=$break){throw D}}return this},eachSlice:function(A,D,C){D=D?D.bind(C):Prototype.K;var B=-A,E=[],F=this.toArray();while((B+=A)<F.length){E.push(F.slice(B,B+A))}return E.collect(D,C)},all:function(B,A){B=B?B.bind(A):Prototype.K;var C=true;this.each(function(E,D){C=C&&!!B(E,D);if(!C){throw $break}});return C},any:function(B,A){B=B?B.bind(A):Prototype.K;var C=false;this.each(function(E,D){if(C=!!B(E,D)){throw $break}});return C},collect:function(C,B){C=C?C.bind(B):Prototype.K;var A=[];this.each(function(E,D){A.push(C(E,D))});return A},detect:function(B,A){B=B.bind(A);var C;this.each(function(E,D){if(B(E,D)){C=E;throw $break}});return C},findAll:function(C,B){C=C.bind(B);var A=[];this.each(function(E,D){if(C(E,D)){A.push(E)}});return A},grep:function(A,D,C){D=D?D.bind(C):Prototype.K;var B=[];if(Object.isString(A)){A=new RegExp(A)}this.each(function(F,E){if(A.match(F)){B.push(D(F,E))}});return B},include:function(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B},inGroupsOf:function(A,B){B=Object.isUndefined(B)?null:B;return this.eachSlice(A,function(C){while(C.length<A){C.push(B)}return C})},inject:function(A,C,B){C=C.bind(B);this.each(function(E,D){A=C(A,E,D)});return A},invoke:function(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})},max:function(B,A){B=B?B.bind(A):Prototype.K;var C;this.each(function(E,D){E=B(E,D);if(C==null||E>=C){C=E}});return C},min:function(B,A){B=B?B.bind(A):Prototype.K;var C;this.each(function(E,D){E=B(E,D);if(C==null||E<C){C=E}});return C},partition:function(D,B){D=D?D.bind(B):Prototype.K;var C=[],A=[];this.each(function(F,E){(D(F,E)?C:A).push(F)});return[C,A]},pluck:function(A){var B=[];this.each(function(C){B.push(C[A])});return B},reject:function(C,B){C=C.bind(B);var A=[];this.each(function(E,D){if(!C(E,D)){A.push(E)}});return A},sortBy:function(B,A){B=B.bind(A);return this.map(function(D,C){return{value:D,criteria:B(D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){return B(C.pluck(D))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(C){if(!C){return[]}if(C.toArray){return C.toArray()}var A=C.length||0,B=new Array(A);while(A--){B[A]=C[A]}return B}if(Prototype.Browser.WebKit){$A=function(C){if(!C){return[]}if(!(Object.isFunction(C)&&C=="[object NodeList]")&&C.toArray){return C.toArray()}var A=C.length||0,B=new Array(A);while(A--){B[A]=C[A]}return B}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(C){for(var B=0,A=this.length;B<A;B++){C(this[B])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(A){return A!=null})},flatten:function(){return this.inject([],function(B,A){return B.concat(Object.isArray(A)?A.flatten():[A])})},without:function(){var A=$A(arguments);return this.select(function(B){return !A.include(B)})},reverse:function(A){return(A!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C)}return D})},intersect:function(A){return this.uniq().findAll(function(B){return A.detect(function(C){return B===C})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var A=[];this.each(function(B){var C=Object.toJSON(B);if(!Object.isUndefined(C)){A.push(C)}});return"["+A.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,B){B||(B=0);var A=this.length;if(B<0){B=A+B}for(;B<A;B++){if(this[B]===C){return B}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(B,A){A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;var C=this.slice(0,A).reverse().indexOf(B);return(C<0)?C:A-C-1}}Array.prototype.toArray=Array.prototype.clone;function $w(A){if(!Object.isString(A)){return[]}A=A.strip();return A?A.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var E=[];for(var C=0,A=this.length;C<A;C++){E.push(this[C])}for(var C=0,A=arguments.length;C<A;C++){if(Object.isArray(arguments[C])){for(var B=0,D=arguments[C].length;B<D;B++){E.push(arguments[C][B])}}else{E.push(arguments[C])}}return E}}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(A){$R(0,this,true).each(A);return this},toPaddedString:function(A,C){var B=this.toString(C||10);return"0".times(A-B.length)+B},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(A){Number.prototype[A]=Math[A].methodize()});function $H(A){return new Hash(A)}var Hash=Class.create(Enumerable,(function(){function A(B,C){if(Object.isUndefined(C)){return B}return B+"="+encodeURIComponent(String.interpret(C))}return{initialize:function(B){this._object=Object.isHash(B)?B.toObject():Object.clone(B)},_each:function(C){for(var B in this._object){var D=this._object[B],E=[B,D];E.key=B;E.value=D;C(E)}},set:function(B,C){return this._object[B]=C},get:function(B){return this._object[B]},unset:function(B){var C=this._object[B];delete this._object[B];return C},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(C){var B=this.detect(function(D){return D.value===C});return B&&B.key},merge:function(B){return this.clone().update(B)},update:function(B){return new Hash(B).inject(this,function(C,D){C.set(D.key,D.value);return C})},toQueryString:function(){return this.map(function(D){var B=encodeURIComponent(D.key),C=D.value;if(C&&typeof C=="object"){if(Object.isArray(C)){return C.map(A.curry(B)).join("&")}}return A(B,C)}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(B){return B.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(C,A,B){this.start=C;this.end=A;this.exclusive=B},_each:function(A){var B=this.start;while(this.include(B)){A(B);B=B.succ()}},include:function(A){if(A<this.start){return false}if(this.exclusive){return A<this.end}return A<=this.end}});var $R=function(C,A,B){return new ObjectRange(C,A,B)};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(){var A=this.Element;this.Element=function(D,C){C=C||{};D=D.toLowerCase();var B=Element.cache;if(Prototype.Browser.IE&&C.name){D="<"+D+' name="'+C.name+'">';delete C.name;return Element.writeAttribute(document.createElement(D),C)}if(!B[D]){B[D]=Element.extend(document.createElement(D))}return Element.writeAttribute(B[D].cloneNode(false),C)};Object.extend(this.Element,A||{})}).call(window);Element.cache={};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).style.display="none";return A},show:function(A){$(A).style.display="";return A},remove:function(A){A=$(A);A.parentNode.removeChild(A);return A},update:function(A,B){A=$(A);if(B&&B.toElement){B=B.toElement()}if(Object.isElement(B)){return A.update().insert(B)}B=Object.toHTML(B);A.innerHTML=B.stripScripts();B.evalScripts.bind(B).defer();return A},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 $(A).recursivelyCollect("parentNode")},descendants:function(A){return $(A).select("*")},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 $(A).recursivelyCollect("previousSibling")},nextSiblings:function(A){return $(A).recursivelyCollect("nextSibling")},siblings:function(A){A=$(A);return A.previousSiblings().reverse().concat(A.nextSiblings())},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=C.ancestors();return Object.isNumber(D)?A[D]:Selector.findElement(A,D,B)},down:function(B,C,A){B=$(B);if(arguments.length==1){return B.firstDescendant()}return Object.isNumber(C)?B.descendants()[C]:B.select(C)[A||0]},previous:function(B,D,A){B=$(B);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))}var C=B.previousSiblings();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=B.nextSiblings();return Object.isNumber(D)?C[D]:Selector.findElement(C,D,A)},select:function(){var B=$A(arguments),A=$(B.shift());return Selector.findChildElements(A,B)},adjacent:function(){var B=$A(arguments),A=$(B.shift());return Selector.findChildElements(A.parentNode,B).without(A)},identify:function(B){B=$(B);var C=B.readAttribute("id"),A=arguments.callee;if(C){return C}do{C="anonymous_element_"+A.counter++}while($(C));B.writeAttribute("id",C);return C},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 $(A).getDimensions().height},getWidth:function(A){return $(A).getDimensions().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(!B.hasClassName(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 B[B.hasClassName(A)?"removeClassName":"addClassName"](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(C,B){C=$(C),B=$(B);var F=B;if(C.compareDocumentPosition){return(C.compareDocumentPosition(B)&8)===8}if(C.sourceIndex&&!Prototype.Browser.Opera){var E=C.sourceIndex,A=B.sourceIndex,D=B.nextSibling;if(!D){do{B=B.parentNode}while(!(D=B.nextSibling)&&B.parentNode)}if(D&&D.sourceIndex){return(E>A&&E<D.sourceIndex)}}while(C=C.parentNode){if(C==F){return true}}return false},scrollTo:function(A){A=$(A);var B=A.cumulativeOffset();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){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=$(C).getStyle("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";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(window.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=="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(B.getStyle("position")=="absolute"){return }var A=B.positionedOffset();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(A.getStyle("position")=="relative"){return }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=="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=A.viewportOffset();C=$(C);var F=[0,0];var B=null;if(Element.getStyle(C,"position")=="absolute"){B=C.getOffsetParent();F=B.viewportOffset()}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}};Element.Methods.identify.counter=1;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);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);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.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={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(A,B){return A.getAttribute(B,2)},_getAttrNode:function(A,C){var B=A.getAttributeNode(C);return B?B.value:""},_getEv:function(A,B){B=A.getAttribute(B);return B?B.toString().slice(23,-2):null},_flag:function(A,B){return $(A).hasAttribute(B)?B:null},style:function(A){return A.style.cssText.toLowerCase()},title:function(A){return A.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").each(function(A){Element._attributeTranslations.write.names[A.toLowerCase()]=A;Element._attributeTranslations.has[A.toLowerCase()]=A});(function(A){Object.extend(A,{href:A._getAttr,src:A._getAttr,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)}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=="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(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(B,C){B=$(B);if(C&&C.toElement){C=C.toElement()}if(Object.isElement(C)){return B.update().insert(C)}C=Object.toHTML(C);var A=B.tagName.toUpperCase();if(A in Element._insertionTranslations.tags){$A(B.childNodes).each(function(D){B.removeChild(D)});Element._getContentFromAnonymousElement(A,C.stripScripts()).each(function(D){B.appendChild(D)})}else{B.innerHTML=C.stripScripts()}C.evalScripts.bind(C).defer();return B}}if("outerHTML" in document.createElement("div")){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(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);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);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K}var B={},A=Element.Methods.ByTag;var C=Object.extend(function(G){if(!G||G._extendedByPrototype||G.nodeType!=1||G==window){return G}var E=Object.clone(B),F=G.tagName,D,H;if(A[F]){Object.extend(E,A[F])}for(D in E){H=E[D];if(Object.isFunction(H)&&!(D in G)){G[D]=H.methodize()}}G._extendedByPrototype=Prototype.emptyFunction;return G},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(B,Element.Methods);Object.extend(B,Element.Methods.Simulated)}}});C.refresh();return C})();Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)}return Element.Methods.Simulated.hasAttribute(A,B)};Element.addMethods=function(C){var I=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(K,N,M){M=M||false;for(var F in K){var L=K[F];if(!Object.isFunction(L)){continue}if(!M||!(F in N)){N[F]=L.methodize()}}}function E(K){var F;var L={"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(L[K]){F="HTML"+L[K]+"Element"}if(window[F]){return window[F]}F="HTML"+K+"Element";if(window[F]){return window[F]}F="HTML"+K.capitalize()+"Element";if(window[F]){return window[F]}window[F]={};window[F].prototype=document.createElement(K).__proto__;return window[F]}if(I.ElementExtensions){B(Element.Methods,HTMLElement.prototype);B(Element.Methods.Simulated,HTMLElement.prototype,true)}if(I.SpecificElementExtensions){for(var J in Element.Methods.ByTag){var H=E(J);if(Object.isUndefined(H)){continue}B(D[J],H.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var A={};var C=Prototype.Browser;$w("width height").each(function(E){var B=E.capitalize();A[E]=(C.WebKit&&!document.evaluate)?self["inner"+B]:(C.Opera)?document.body["client"+B]:document.documentElement["client"+B]});return A},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(A){this.expression=A.strip();this.compileMatcher()},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false}var A=this.expression;if(Prototype.Browser.WebKit&&(A.include("-of-type")||A.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(this.expression)){return false}return true},compileMatcher:function(){if(this.shouldUseXPath()){return this.compileXPathMatcher()}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;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 in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).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 E=this.expression,F=Selector.patterns,B=Selector.xpath,D,A;if(Selector._cache[E]){this.xpath=Selector._cache[E];return }this.matcher=[".//*"];while(E&&D!=E&&(/\S/).test(E)){D=E;for(var C in F){if(A=E.match(F[C])){this.matcher.push(Object.isFunction(B[C])?B[C](A):new Template(B[C]).evaluate(A));E=E.replace(A[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(A){A=A||document;if(this.xpath){return document._getElementsByXPath(this.xpath,A)}return this.matcher(A)},match:function(H){this.tokens=[];var L=this.expression,B=Selector.patterns,F=Selector.assertions;var A,D,E;while(L&&A!==L&&(/\S/).test(L)){A=L;for(var I in B){D=B[I];if(E=L.match(D)){if(F[I]){this.tokens.push([I,Object.clone(E)]);L=L.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()+">"}});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 or translate(text(), ' \t\r\n', '') = '')]","checked":"[@checked]","disabled":"[@disabled]","enabled":"[not(@disabled)]","not":function(B){var H=B[6],G=Selector.patterns,A=Selector.xpath,E,C;var F=[];while(H&&E!=H&&(/\S/).test(H)){E=H;for(var D in G){if(B=H.match(G[D])){C=Object.isFunction(A[D])?A[D](B):new Template(A[D]).evaluate(B);F.push("("+C.substring(1,C.length-1)+")");H=H.replace(B[0],"");break}}}return"[not("+F.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:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\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(A){for(var B=0,C;C=A[B];B++){C._countedByPrototype=undefined}return A},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(!(E=B[C])._countedByPrototype){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(C,B,H,A){var G=$(H),E=Selector.handlers;if(!G){return[]}if(!C&&B==document){return[G]}if(C){if(A){if(A=="child"){for(var D=0,F;F=C[D];D++){if(G.parentNode==F){return[G]}}}else{if(A=="descendant"){for(var D=0,F;F=C[D];D++){if(Element.descendantOf(G,F)){return[G]}}}else{if(A=="adjacent"){for(var D=0,F;F=C[D];D++){if(Selector.handlers.previousElementSibling(G)==F){return[G]}}}else{C=E[A](C)}}}}for(var D=0,F;F=C[D];D++){if(F==G){return[G]}}return[]}return(G&&Element.descendantOf(G,B))?[G]:[]},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&&!E.innerHTML.match(/^\s*$/))){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){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.startsWith(A)},"$=":function(B,A){return B.endsWith(A)},"*=":function(B,A){return 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},unmark:function(A){for(var B=0,C;C=A[B];B++){C.removeAttribute("_countedByPrototype")}return A}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(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!="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(A){return $A($(A).getElementsByTagName("*")).inject([],function(B,C){if(Form.Element.Serializers[C.tagName.toLowerCase()]){B.push(Element.extend(C))}return B})},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"].include(D.tagName.toLowerCase())})},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"].include(A.type))){A.select()}}catch(B){}return A},disable:function(A){A=$(A);A.blur();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(C,B){if(Object.isUndefined(B)){return this[C.type=="select-one"?"selectOne":"selectMany"](C)}else{var E,F,G=!Object.isArray(B);for(var D=0,A=C.length;D<A;D++){E=C.options[D];F=this.optionValue(E);if(G){if(F==B){E.selected=true;return }}else{E.selected=B.include(F)}}}},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)}});if(!window.Event){var Event={}}Object.extend(Event,{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:{},relatedTarget:function(B){var A;switch(B.type){case"mouseover":A=B.fromElement;break;case"mouseout":A=B.toElement;break;default:return null}return Element.extend(A)}});Event.Methods=(function(){var B;if(Prototype.Browser.IE){var A={0:1,1:4,2:2};B=function(D,C){return D.button==A[C]}}else{if(Prototype.Browser.WebKit){B=function(D,C){switch(C){case 0:return D.which==1&&!D.metaKey;case 1:return D.which==1&&D.metaKey;default:return false}}}else{B=function(D,C){return D.which?(D.which===C+1):(D.button===C)}}}return{isLeftClick:function(C){return B(C,0)},isMiddleClick:function(C){return B(C,1)},isRightClick:function(C){return B(C,2)},element:function(D){var C=Event.extend(D).target;return Element.extend(C.nodeType==Node.TEXT_NODE?C.parentNode:C)},findElement:function(E,F){var D=Event.element(E);if(!F){return D}var C=[D].concat(D.ancestors());return Selector.findElement(C,F,0)},pointer:function(C){return{x:C.pageX||(C.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:C.pageY||(C.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}},pointerX:function(C){return Event.pointer(C).x},pointerY:function(C){return Event.pointer(C).y},stop:function(C){Event.extend(C);C.preventDefault();C.stopPropagation();C.stopped=true}}})();Event.extend=(function(){var A=Object.keys(Event.Methods).inject({},function(B,C){B[C]=Event.Methods[C].methodize();return B});if(Prototype.Browser.IE){Object.extend(A,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(B){if(!B){return false}if(B._extendedByPrototype){return B}B._extendedByPrototype=Prototype.emptyFunction;var C=Event.pointer(B);Object.extend(B,{target:B.srcElement,relatedTarget:Event.relatedTarget(B),pageX:C.x,pageY:C.y});return Object.extend(B,A)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(Event.prototype,A);return Prototype.K}})();Object.extend(Event,(function(){var A=Event.cache;function D(J){if(J._prototypeEventID){return J._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return J._prototypeEventID=[++arguments.callee.id]}function E(J){if(J&&J.include(":")){return"dataavailable"}return J}function G(J){return A[J]=A[J]||{}}function F(L,J){var K=G(L);return K[J]=K[J]||[]}function I(K,J,L){var O=D(K);var N=F(O,J);if(N.pluck("handler").include(L)){return false}var M=function(P){if(!Event||!Event.extend||(P.eventName&&P.eventName!=J)){return false}Event.extend(P);L.call(K,P)};M.handler=L;N.push(M);return M}function H(M,J,K){var L=F(M,J);return L.find(function(N){return N.handler==K})}function B(M,J,K){var L=G(M);if(!L[J]){return false}L[J]=L[J].without(H(M,J,K))}function C(){for(var K in A){for(var J in A[K]){A[K][J]=null}}}if(window.attachEvent){window.attachEvent("onunload",C)}return{observe:function(L,J,M){L=$(L);var K=E(J);var N=I(L,J,M);if(!N){return L}if(L.addEventListener){L.addEventListener(K,N,false)}else{L.attachEvent("on"+K,N)}return L},stopObserving:function(L,J,M){L=$(L);var O=D(L),K=E(J);if(!M&&J){F(O,J).each(function(P){L.stopObserving(J,P.handler)});return L}else{if(!J){Object.keys(G(O)).each(function(P){L.stopObserving(P)});return L}}var N=H(O,J,M);if(!N){return L}if(L.removeEventListener){L.removeEventListener(K,N,false)}else{L.detachEvent("on"+K,N)}B(O,J,M);return L},fire:function(L,K,J){L=$(L);if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",true,true)}else{M=document.createEventObject();M.eventType="ondataavailable"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return Event.extend(M)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var B;function A(){if(document.loaded){return }if(B){window.clearInterval(B)}document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){B=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){A()}},0);Event.observe(window,"load",A)}else{document.addEventListener("DOMContentLoaded",A,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:></"+"script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;A()}}}})();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);Element.addMethods();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,"AUTH":(Jamendo_ENV["USERID"]>0),"USERNAME":Jamendo_ENV["USERNAME"]||"","HTTPHOSTI18N":Jamendo_ENV["HTTPHOSTI18N"]||"http://www.jamendo.com/","PREFS":Jamendo_ENV["PREFS"]||{"stream":"","download":""},"TZOFFSET":Jamendo_ENV["TZOFFSET"]||"","REMOTEPLAYERINFO":Jamendo_ENV["REMOTEPLAYERINFO"]||false,"INTERRUPTS":Jamendo_ENV["INTERRUPTS"]||{}}[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(A){A=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},A);if(A.serial){A.serial=(++this.nextSerial);this.activeSerials[A.serial]=true}this.sendEvent(["ajax","semaphore"],++this.ajaxSemaphore);var B={};$H(A.params).each(function(D){B[D.key]=D.value});var C=new Ajax.Request(A.url,{method:A.method,parameters:B,onFailure:function(){clearTimeout(A.timeoutId);delete this.activeSerials[A.serial];if((--A.retryCount)>=0&&A.tryback(A.retryCount)){this.ajaxSemaphore--;setTimeout(function(){this.ajaxRequest(A)}.bind(this),A.retryDelay)}else{this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore);if(A.errback){A.errback()}}}.bind(this),onSuccess:function(E){clearTimeout(A.timeoutId);if(!A.serial||(A.serial in this.activeSerials)){delete this.activeSerials[A.serial];this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore);if(A.callback){try{A.callback(E.responseText,E)}catch(D){Jamendo.log("error in callback: "+D.name+" => "+D.message)}}}}.bind(this)});if(A.timeout){A.timeoutId=setTimeout(function(){A.timeouted=true;if(C.transport.readyState>0&&C.transport.readyState<4){C.options["onFailure"](C.transport,C.json)}},A.timeout)}return{"options":A,"serial":A.serial,"abort":function(){this.ajaxAbortRequest(A.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(E,F){if(C){C(E.evalJSON(),F)}},"params":D||{},"url":A});return this.ajaxRequest(B)},writeApi:function(F,G,E,B,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)}})}return this.jsonRequest("/set/"+F+"/postjson/json",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()},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},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){},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,B){this.observers.each(function(D){if(this.eventIdMatches(A,D[0])){try{D[1](A,B)}catch(C){Jamendo.log("Error while calling event "+D[0]+" with data "+D[1]);Jamendo.log(C)}}}.bind(this))},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(B,A){return A.all(function(D,C){return B[C]==D})},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;Jamendo.insertScript("http://www.google.com/jsapi?key=ABQIAAAACQNZjYy0Iy0nQ5vLbXfm5BQWecC8V4p8CO_SECQLRybVH7QL5xRpjsbcv3pCduXiFULF1vFo8LlFkw&callback=Jamendo._googlejsapicalback")},getTemplate:function(A){return new Template($(A).innerHTML,/(^|.|\r|\n)(\$([a-z0-9]+)\$)/)},errorUnimplemented:function(){Jamendo.log("Error : unimplemented")}};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()}};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={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])})}},showLogin:function(C){if(C){var B=$("login_box").previous(".boxerror");if(B){B.hide()}}var A=SuperBox.call("localdiv","page_login");$("page_loginform_pseudo").focus();return A},spLoginOnKeypress:function(A){if($("page_loginform_pseudo").value!=""&&$("page_loginform_pass").value!=""){$("login_form").submit()}return false},refresh:function(){if(typeof (window.location.reload)=="function"){window.location.reload(false)}else{window.location.href=unescape(window.location.pathname)}},refreshWithParams:function(C){var A=window.location.toString().indexOf("?");var B=(A>0?window.location.toString().substring(A):"").toQueryParams();B=Object.extend(B,C);window.location=(A>0?window.location.toString().substring(0,A):window.location)+"?"+$H(B).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,D){if(!C||!D){Jamendo.writeApi("quicklog",["emptydownloadunitid",window.location.toString()]);return false}if(!Jamendo.getEnv("PREFS")["download"]||C!="album"){var B=Jamendo.getEnv("HTTPHOSTI18N")+"download/"+C+"/"+D+"/";var A=function(){window.open(B+"?output=contentonly","jamdownload_"+Math.round(Math.random()*1000000),"width=750,height=380,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="+D+"&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(D,A,C){if(!Jamendo.page.usePlayer()){var B=this.parsePlayML2s(D,A);window.location=Jamendo.getEnv("HTTPHOSTI18N")+"get2/"+B;return false}else{if(C){Jamendo.sendEvent(["jamplayer2","remote","control","play"],D);return false}else{return Jamendo.page.remoteplayer.command("play",D)}}},star:function(A,B){if(!A||!B){Jamendo.writeApi("quicklog",["emptystarunitid",window.location.toString()]);return false}Jamendo.writeApi("user_log",[A,"star",B],function(){alert(Jamendo.getStr("JAMPLAYER2_STARRED_"+A.toUpperCase()+"_CONFIRM"))})},friendship:function(B,E,D,G,C){if(B&&E&&D>0){var A=({"asked":"user_addfriend","accepted":"user_addfriend","deleted":"user_deletefriend","refused":"user_deletefriend"})[B];var F=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);F.on();Jamendo.writeApi(A,[E,D,true],function(H){var I=(H=="ok");F.off();alert(Jamendo.getStr(I?"USER_FRIENDSHIP_"+B.toUpperCase():"USER_FRIENDSHIP_PROBLEM"));if(typeof (G)=="function"){G(I)}if(!C){Jamendo.page.refresh()}})}},deleteplaylist:function(A){if(confirm(Jamendo.getStr("PLAYLIST_DELETE_QUESTION"))){Jamendo.writeApi("playlist_set",[[["deleteplaylist",A]]],function(B){var C=(B!=["false"]);alert(Jamendo.getStr(C?"PLAYLIST_DELETE_SUCCESS":"PLAYLIST_DELETE_PROBLEM"));Jamendo.page.refresh()})}},agreeToReview:function(C,B,E,A){if(C>0){var D=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);D.on();Jamendo.writeApi("review_agree",[C,B],function(F){var G=(F==null);D.off();alert(Jamendo.getStr(G?"REVIEW_AGREE_SENT":"REVIEW_AGREE_PROBLEM"));if(typeof (E)=="function"){E(G)}if(!A){Jamendo.page.refresh()}})}},initRemoteplayer:function(){var A=new Jamendo.classes.playerHandler();Jamendo.page.remoteplayer=new Jamendo.classes.remotePlayer(A);Jamendo.page.remoteplayer.gui=new Jamendo.classes.remotePlayerGui()},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},remoteplayer:null};var $PNGFIX=true;var _pngfix=function(){};if(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)}}};Jamendo.onReady(F)})()}Jamendo.classes.SuperBox=Class.create({closeWord:"close",loadImage:"http://img.jamendo.com/superboxloading.gif",widthParam:"sbw",heightParam:"sbh",addUrlParams:"output=superbox",cb_show:[],cb_remove:[],defaultWidth:0,defaultHeight:0,mode:null,initialize:function(){},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(H,B,A){try{if(!H){H="remote"}if(H=="remote"&&(typeof B)!="string"&&("href" in B)){this.url=B.href}else{this.url=B}this.mode=H;this.reset();this.caption=A;this.baseinsert();if(/MSIE/.test(navigator.userAgent)){$$("select").each(function(I){Element.hide(I)})}if(window.opera){$$("iframe").each(function(I){Element.hide(I)})}this.wro=this.position.bindAsEventListener(this);this.position();Event.observe(window,"resize",this.wro);if(H=="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(H=="wait"){}else{this.t="html";if(H=="remote"){var F=this.url.replace(/^[^\?]+\??/,"");var G=this.parseQuery(F);if(G[this.widthParam]){this.setDim(G[this.widthParam],G[this.heightParam],true)}}this.htmlinsert();$("SuperBox_closeWindowButton").onclick=this.remove.bindAsEventListener(this);if(H=="remote"){Jamendo.ajaxRequest({"callback":function(I){$("SuperBox_ajaxContent").update(I);this.show()}.bind(this),"url":this.urlcat(this.url,this.addUrlParams),"timeout":4000,"retryDelay":0,"errback":function(){this.remove()}.bind(this)})}else{if(H=="localdiv"){var C=$(B).innerHTML;var E=$(B).getDimensions();if(!(E.width>0)){E={width:parseInt($(B).style.width),height:parseInt($(B).style.height)}}$(B).innerHTML="";$("SuperBox_ajaxContent").innerHTML=C;this.setDim(E.width,E.height);this.show()}}}}}catch(D){return true}return false},urlcat:function(A,B){if(A.indexOf("?")<0){return A+"?"+B}else{return A+"&"+B}},baseinsert:function(){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'>"+this.closeWord+"</a></div><div id='SuperBox_ajaxContent'></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='return SuperBox.remove();'><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){$("SuperBox_load").hide();$("SuperBox_window").show()}this.cb_show.each(function(A){A()})},remove:function(){this.shown=false;var A=$("SuperBox_global");if(!A){return }this.cb_remove.each(function(C){C()});A.hide();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(/MSIE/.test(navigator.userAgent)){$$("select").each(function(C){Element.show(C)})}if(window.opera){$$("iframe").each(function(C){Element.show(C)})}return false},position:function(){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"){$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px",height:(this.h-49)+"px"})}}$("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"});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;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();var swfobject=function(){var domLoadFnArr=[];var regObjArr=[];var timer=null;var storedAltContent=null;var isDomLoaded=false;var isExpressInstallActive=false;var ua=function(){var w3cdom=typeof document.getElementById!="undefined"&&typeof document.getElementsByTagName!="undefined"&&typeof document.createElement!="undefined"&&typeof document.appendChild!="undefined"&&typeof document.replaceChild!="undefined"&&typeof document.removeChild!="undefined"&&typeof document.cloneNode!="undefined";var playerVersion=[0,0,0];var d=null;if(typeof navigator.plugins!="undefined"&&typeof navigator.plugins["Shockwave Flash"]=="object"){d=navigator.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 window.ActiveXObject!="undefined"){var a=null;var fp6Crash=false;try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(e){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");playerVersion=[6,0,21];a.AllowScriptAccess="always"}catch(e){if(playerVersion[0]==6){fp6Crash=true}}if(!fp6Crash){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}}}if(!fp6Crash&&typeof a=="object"){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=navigator.userAgent.toLowerCase();var p=navigator.platform.toLowerCase();var webkit=/webkit/.test(u);var webkitVersion=webkit?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):0;var ie=false;var win=p?/win/.test(p):/win/.test(u);var mac=p?/mac/.test(p):/mac/.test(u);/*@cc_on 		                 
	            ie = true; 	 	 
	            @if (@_win32) 	 	 
	                    win = true; 	 	 
	            @elif (@_mac) 	 	 
	                    mac = true; 	 	 
	            @end 	 	 
	    @*/return{"w3cdom":w3cdom,"playerVersion":playerVersion,"webkit":webkit,"webkitVersion":webkitVersion,"ie":ie,"win":win,"mac":mac}}();var onDomLoad=function(){if(!ua.w3cdom){return }addDomLoadEvent(main);if(ua.ie&&ua.win){try{document.write("<script id=__ie_ondomload defer=true src=//:></"+"script>");var s=document.getElementById("__ie_ondomload");if(s){s.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);callDomLoadFunctions()}}}}catch(e){}}if(ua.webkit&&typeof document.readyState!="undefined"){timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){callDomLoadFunctions()}},10)}if(typeof document.addEventListener!="undefined"){document.addEventListener("DOMContentLoaded",callDomLoadFunctions,null)}addLoadEvent(callDomLoadFunctions)}();function callDomLoadFunctions(){if(isDomLoaded){return }if(ua.ie&&ua.win){var s=document.createElement("span");try{var t=document.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){return fn()}domLoadFnArr[domLoadFnArr.length]=fn}function addLoadEvent(fn){if(typeof window.addEventListener!="undefined"){window.addEventListener("load",fn,false)}else{if(typeof document.addEventListener!="undefined"){document.addEventListener("load",fn,false)}else{if(typeof window.attachEvent!="undefined"){window.attachEvent("onload",fn)}else{if(typeof window.onload=="function"){var fnOld=window.onload;window.onload=function(){fnOld();fn()}}else{window.onload=fn}}}}}function main(){if(!regObjArr){return }var rl=regObjArr.length;for(var i=0;i<rl;i++){var id=regObjArr[i].id;if(ua.playerVersion[0]>0){var obj=document.getElementById(id);if(obj){if(hasPlayerVersion(regObjArr[i].swfVersion)){if(ua.webkit&&ua.webkitVersion<312){fixParams(obj)}}else{if(regObjArr[i].expressInstall&&!isExpressInstallActive&&hasPlayerVersion([6,0,65])&&(ua.win||ua.mac)){showExpressInstall(regObjArr[i])}else{displayAltContent(obj)}}}}createCSS("#"+id,"visibility:visible")}}function fixParams(obj){var nestedObj=obj.getElementsByTagName("object")[0];if(nestedObj){var e=document.createElement("embed");var 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(){if(ua.ie&&ua.win&&hasPlayerVersion([8,0,0])){window.attachEvent("onunload",function(){var o=document.getElementsByTagName("object");if(o){var ol=o.length;for(var i=0;i<ol;i++){o[i].style.display="none";for(var x in o[i]){if(typeof o[i][x]=="function"){o[i][x]=function(){}}}}}})}}function showExpressInstall(regObj){isExpressInstallActive=true;var obj=document.getElementById(regObj.id);if(obj){if(regObj.altContentId){var ac=document.getElementById(regObj.altContentId);if(ac){storedAltContent=ac}}else{storedAltContent=abstractAltContent(obj)}var w=regObj.width?regObj.width:(obj.getAttribute("width")?obj.getAttribute("width"):0);if(parseInt(w,10)<310){w="310"}var h=regObj.height?regObj.height:(obj.getAttribute("height")?obj.getAttribute("height"):0);if(parseInt(h,10)<137){h="137"}var pt=ua.ie&&ua.win?"ActiveX":"PlugIn";document.title=document.title.slice(0,47)+" - Flash Player Installation";var dt=document.title;var fv="MMredirectURL="+window.location+"&MMplayerType="+pt+"&MMdoctitle="+dt;var el=obj;if(ua.ie&&ua.win&&obj.readyState!=4){el=document.createElement("div");obj.parentNode.insertBefore(el,obj);obj.style.display="none";window.attachEvent("onload",function(){obj.parentNode.removeChild(obj)})}createSWF({data:regObj.expressInstall,id:"SWFObjectExprInst",width:w,height:h},{flashvars:fv},el)}}function displayAltContent(obj){if(ua.ie&&ua.win&&obj.readyState!=4){var el=document.createElement("div");obj.parentNode.insertBefore(el,obj);el.parentNode.replaceChild(abstractAltContent(obj),el);obj.style.display="none";window.attachEvent("onload",function(){obj.parentNode.removeChild(obj)})}else{obj.parentNode.replaceChild(abstractAltContent(obj),obj)}}function abstractAltContent(obj){var ac=document.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,el){if(ua.ie&&ua.win){var att="";for(var i in attObj){if(typeof attObj[i]=="string"){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(typeof parObj[j]=="string"){par+='<param name="'+j+'" value="'+parObj[j]+'" />'}}el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+">"+par+"</object>";fixObjectLeaks()}else{if(ua.webkit&&ua.webkitVersion<312){var e=document.createElement("embed");e.setAttribute("type","application/x-shockwave-flash");for(var k in attObj){if(typeof attObj[k]=="string"){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(typeof parObj[l]=="string"){if(l!="movie"){e.setAttribute(l,parObj[l])}}}el.parentNode.replaceChild(e,el)}else{var o=document.createElement("object");o.setAttribute("type","application/x-shockwave-flash");for(var m in attObj){if(typeof attObj[m]=="string"){if(m.toLowerCase()=="styleclass"){o.setAttribute("class",attObj[m])}else{if(m!="classid"){o.setAttribute(m,attObj[m])}}}}for(var n in parObj){if(typeof parObj[n]=="string"&&n!="movie"){createObjParam(o,n,parObj[n])}}el.parentNode.replaceChild(o,el)}}}function createObjParam(el,pName,pValue){var p=document.createElement("param");p.setAttribute("name",pName);p.setAttribute("value",pValue);el.appendChild(p)}function hasPlayerVersion(rv){return(ua.playerVersion[0]>rv[0]||(ua.playerVersion[0]==rv[0]&&ua.playerVersion[1]>rv[1])||(ua.playerVersion[0]==rv[0]&&ua.playerVersion[1]==rv[1]&&ua.playerVersion[2]>=rv[2]))?true:false}function createCSS(sel,decl){if(ua.ie&&ua.mac){return }var h=document.getElementsByTagName("head")[0];var s=document.createElement("style");s.setAttribute("type","text/css");s.setAttribute("media","screen");if(!(ua.ie&&ua.win)&&typeof document.createTextNode!="undefined"){s.appendChild(document.createTextNode(sel+" {"+decl+"}"))}h.appendChild(s);if(ua.ie&&ua.win&&typeof document.styleSheets!="undefined"&&document.styleSheets.length>0){var ls=document.styleSheets[document.styleSheets.length-1];if(typeof ls.addRule=="object"){ls.addRule(sel,decl)}}}return{registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr){if(!ua.w3cdom||!objectIdStr||!swfVersionStr){return }var regObj={};regObj.id=objectIdStr;var v=swfVersionStr.split(".");regObj.swfVersion=[parseInt(v[0],10),parseInt(v[1],10),parseInt(v[2],10)];regObj.expressInstall=xiSwfUrlStr?xiSwfUrlStr:false;regObjArr[regObjArr.length]=regObj;createCSS("#"+objectIdStr,"visibility:hidden")},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj){if(!ua.w3cdom||!swfUrlStr||!replaceElemIdStr||!widthStr||!heightStr||!swfVersionStr){return }if(hasPlayerVersion(swfVersionStr.split("."))){createCSS("#"+replaceElemIdStr,"visibility:hidden");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(typeof flashvarsObj[i]=="string"){if(typeof par.flashvars!="undefined"){par.flashvars+="&"+i+"="+flashvarsObj[i]}else{par.flashvars=i+"="+flashvarsObj[i]}}}}addDomLoadEvent(function(){createSWF(att,par,document.getElementById(replaceElemIdStr));createCSS("#"+replaceElemIdStr,"visibility:visible")})}else{if(xiSwfUrlStr&&!isExpressInstallActive&&hasPlayerVersion([6,0,65])&&(ua.win||ua.mac)){createCSS("#"+replaceElemIdStr,"visibility:hidden");addDomLoadEvent(function(){var regObj={};regObj.id=regObj.altContentId=replaceElemIdStr;regObj.width=widthStr;regObj.height=heightStr;regObj.expressInstall=xiSwfUrlStr;showExpressInstall(regObj);createCSS("#"+replaceElemIdStr,"visibility:visible")})}}},getFlashPlayerVersion:function(){return{major:ua.playerVersion[0],minor:ua.playerVersion[1],release:ua.playerVersion[2]}},hasFlashPlayerVersion:function(versionStr){return hasPlayerVersion(versionStr.split("."))},createSWF:function(attObj,parObj,el){if(ua.w3cdom&&isDomLoaded){createSWF(attObj,parObj,el)}},createCSS:function(sel,decl){if(ua.w3cdom){createCSS(sel,decl)}},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,expressInstallCallback:function(){if(isExpressInstallActive&&storedAltContent){var obj=document.getElementById("SWFObjectExprInst");if(obj){obj.parentNode.replaceChild(storedAltContent,obj);storedAltContent=null;isExpressInstallActive=false}}}}}();if(!Control){var Control={}}Control.Slider=Class.create();Control.Slider.prototype={initialize:function(A,C,D){var B=this;if(A instanceof Array){this.handles=A.collect(function(E){return $(E)})}else{this.handles=[$(A)]}this.track=$(C);this.options=D||{};this.axis=this.options.axis||"horizontal";this.increment=this.options.increment||1;this.step=parseInt(this.options.step||"1");this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(E){return $(E)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||"0");this.alignY=parseInt(this.options.alignY||"0");this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled){this.setDisabled()}this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max()}this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(F,E){E=B.handles.length-1-E;B.setValue(parseFloat((B.options.sliderValue instanceof Array?B.options.sliderValue[E]:B.options.sliderValue)||B.range.start),E);Element.makePositioned(F);Event.observe(F,"mousedown",B.eventMouseDown)});Event.observe(this.track,"mousedown",this.eventMouseDown);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var A=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(B){Event.stopObserving(B,"mousedown",A.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(A){if(this.allowedValues){if(A>=this.allowedValues.max()){return(this.allowedValues.max())}if(A<=this.allowedValues.min()){return(this.allowedValues.min())}var C=Math.abs(this.allowedValues[0]-A);var B=this.allowedValues[0];this.allowedValues.each(function(D){var E=Math.abs(D-A);if(E<=C){B=D;C=E}});return B}if(A>this.range.end){return this.range.end}if(A<this.range.start){return this.range.start}return A},setValue:function(B,A){if(!this.active){this.activeHandleIdx=A||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}A=A||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((A>0)&&(B<this.values[A-1])){B=this.values[A-1]}if((A<(this.handles.length-1))&&(B>this.values[A+1])){B=this.values[A+1]}}B=this.getNearestValue(B);this.values[A]=B;this.value=this.values[0];this.handles[A].style[this.isVertical()?"top":"left"]=this.translateToPx(B);this.drawSpans();if(!this.dragging||!this.event){this.updateFinished()}},setValueBy:function(B,A){this.setValue(this.values[A||this.activeHandleIdx||0]+B,A||this.activeHandleIdx||0)},translateToPx:function(A){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(A-this.range.start))+"px"},translateToValue:function(A){return((A/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start)},getRange:function(B){var A=this.values.sortBy(Prototype.K);B=B||0;return $R(A[B],A[B+1])},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX)},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignY)},isVertical:function(){return(this.axis=="vertical")},drawSpans:function(){var A=this;if(this.spans){$R(0,this.spans.length-1).each(function(B){A.setSpan(A.spans[B],A.getRange(B))})}if(this.options.startSpan){this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))}if(this.options.endSpan){this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))}},setSpan:function(B,A){if(this.isVertical()){B.style.top=this.translateToPx(A.start);B.style.height=this.translateToPx(A.end-A.start+this.range.start)}else{B.style.left=this.translateToPx(A.start);B.style.width=this.translateToPx(A.end-A.start+this.range.start)}},updateStyles:function(){this.handles.each(function(A){Element.removeClassName(A,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(D){if(Event.isLeftClick(D)){if(!this.disabled){this.active=true;var A=Event.element(D);var E=[Event.pointerX(D),Event.pointerY(D)];var C=A;if(C==this.track){var B=Position.cumulativeOffset(this.track);this.event=D;this.setValue(this.translateToValue((this.isVertical()?E[1]-B[1]:E[0]-B[0])-(this.handleLength/2)));var B=Position.cumulativeOffset(this.activeHandle);this.offsetX=(E[0]-B[0]);this.offsetY=(E[1]-B[1])}else{while((this.handles.indexOf(A)==-1)&&A.parentNode){A=A.parentNode}if(this.handles.indexOf(A)!=-1){this.activeHandle=A;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var B=Position.cumulativeOffset(this.activeHandle);this.offsetX=(E[0]-B[0]);this.offsetY=(E[1]-B[1])}}}Event.stop(D)}},update:function(A){if(this.active){if(!this.dragging){this.dragging=true}this.draw(A);if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(A)}},draw:function(B){var C=[Event.pointerX(B),Event.pointerY(B)];var A=Position.cumulativeOffset(this.track);C[0]-=this.offsetX+A[0];C[1]-=this.offsetY+A[1];this.event=B;this.setValue(this.translateToValue(this.isVertical()?C[1]:C[0]));if(this.initialized&&this.options.onSlide){this.options.onSlide(this.values.length>1?this.values:this.value,this)}},endDrag:function(A){if(this.active&&this.dragging){this.finishDrag(A,true);Event.stop(A)}this.active=false;this.dragging=false},finishDrag:function(A,B){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){if(this.initialized&&this.options.onChange){this.options.onChange(this.values.length>1?this.values:this.value,this)}this.event=null}};Jamendo.classes.Playlists=Class.create({initialize:function(A){this.playlists={};this.positions=new Array();this.currentPos=0;this.reserved=new Array();this.j=A;this.log=false},prepend:function(B,A){if(this.log){Jamendo.log("prepend: ");Jamendo.log(B);Jamendo.log(this.positions)}this.playlists[B.getStrId()]=B;var C=this.positions.indexOf(B.getStrId());if(C>=0){delete this.positions[C];this.positions=this.positions.compact()}this.positions.unshift(B.getStrId());if(A){A(B)}else{Jamendo.sendEvent(["jamplayer2","playlists","update","prepend"],B)}},append:function(C,B){if(this.log){Jamendo.log("append");Jamendo.log(C)}var A=C.getStrId?C.getStrId():C.strId;this.playlists[A]=C;var D=this.positions.indexOf(A);if(D>=0){delete this.positions[D];this.positions=this.positions.compact()}this.positions.push(A);if(B){B(C)}else{Jamendo.sendEvent(["jamplayer2","playlists","update","append"],C)}},appendAll:function(D,E){if(this.log){Jamendo.log("apendAll: ");Jamendo.log(D)}this.countReserved=0;this.totalReserved=0;var C=new Array();if(typeof (D.length)=="number"){if(!D.length){return }D=D.uniq();this.positions.each(function(F){D=D.without(F)});if(!D.length){return }Jamendo.writeApi("jamplayer2_get",[D],function(F){this.appendAll(F,E);return }.bind(this))}else{var B=$H(D);this.totalReserved=B.keys().length;if(this.totalReserved==0){return }C=B.keys();this.reservePositions(C);B.each(function(F){PlaylistFactory.get(this.j,F.value,function(G){this.set(G,function(){this.countReserved++}.bind(this))}.bind(this)).strId}.bind(this))}var A=setInterval(function(){if(this.countReserved==this.totalReserved){clearInterval(A);A=null;this.unreserve(C);if(E){E(this)}else{Jamendo.sendEvent(["jamplayer2","playlists","update","append","all"],this)}}}.bind(this),300)},current:function(){var A=this.playlists[this.positions[this.currentPos]];return A||null},reservePositions:function(A){if(this.log){Jamendo.log("reservePosition: ");Jamendo.log(A)}$A(A).each(function(B){this.reserved.push(B);this.append({strId:B},Prototype.emptyFunction)}.bind(this))},isReserved:function(A){return(this.reserved.indexOf(A)!=-1)},unreserve:function(A){if(this.log){Jamendo.log("unreserve");Jamendo.log(A)}$A(A).each(function(C,B){if(this.isReserved(C)){delete this.reserved[B]}}.bind(this));this.reserved=this.reserved.compact()},next:function(A){this.currentPos++;if(this.currentPos>=this.positions.length){this.currentPos=0}if(A){A()}else{Jamendo.sendEvent(["jamplayer2","playlists","next"],this.current())}},prev:function(A){this.currentPos--;if(this.currentPos<0){this.currentPos=this.positions.length-1}if(A){A(this.current())}else{Jamendo.sendEvent(["jamplayer2","playlists","prev"],this.current())}},all:function(){var A=$H(this.playlists);this.reserved.each(function(B){A.unset(B)});return A},set:function(B,A){if(this.log){Jamendo.log("set");Jamendo.log(B)}if(!B.getStrId||!B.getStrId()){return }if(this.positions.indexOf(B.getStrId())==-1){this.append(B,A);return true}this.playlists[B.getStrId()]=B;if(A){A(B)}else{Jamendo.sendEvent(["jamplayer2","playlists","update","set"],B)}},get:function(A){A=Jamendo.stripStrId(A);if(this.reserved.indexOf(A)!=-1){return null}return this.playlists[A]||null},count:function(){return this.all().keys().length},select:function(B,A){this.currentPos=this.positions.indexOf(B);if(A){A(this.current())}else{Jamendo.sendEvent(["playlists","select"],this.current())}},nextTrack:function(){this.current().nextTrack()},prevTrack:function(){this.current().prevTrack()}});var PlaylistFactory={get:function(E,H,F){var G,B,C,A;var D=function(I,M,L){try{if(M&&M["type"]){var K=new Jamendo.classes[("Playlist-"+M["type"]).camelize()](I,M["containerStrId"],M["tracksStrId"],M["pointer"],null,L);K.fetchLocal(M);return K}return null}catch(J){}};if(typeof (H)=="object"){return D(E,H,F)}else{if(typeof (H)=="string"){Jamendo.writeApi("jamplayer2_get",[[H]],function(I){return D(E,$H(I).values().pop(),F)})}}return null}};Jamendo.classes.Playlist=Class.create({initialize:function(B,F,A,E,D,C){this.j=B;this.containerType=null;this.totalCount=null;this.duration=null;this.strId=null;this.pointer=E||0;this.originalPointer=this.pointer;this.fetchContainerTargets=$w("id name image");this.fetchTracksTargets=$w("id name duration album_name album_id artist_name artist_idstr");this.fetchTracksParams={};this.callback=null;this.containerCallback=D||Prototype.K;this.tracksCallback=C||Prototype.K;if(F){this.containerStrId=F}if(A){this.tracksStrId=A}if(F){this.strId=Jamendo.parseStrId(F).strId;if(A){this.strId+="|"+A}}else{if(!F&&A){this.strId=Jamendo.parseStrId(A).strId}}this.init()},init:Jamendo.errorUnimplemented,_guessTracksStrId:Jamendo.errorUnimplemented,_fetchError:function(){Jamendo.sendEvent(["jamplayer2","error"],arguments)},_fetch:Jamendo.errorUnimplemented,actualTrack:function(){return this.tracks[this.pointer]},getStrIdWithoutPointer:function(){var A=this.getStrId();if(A.indexOf("#")>=0){return A.substring(0,A.indexOf("#"))}else{return A}},getStrId:function(){if(!this.strId){return null}var A=Jamendo.stripStrId(this.strId);if(parseInt(this.pointer)>0){A+="#"+this.pointer}return A},resetPointer:function(){this.pointer=this.originalPointer},nextTrack:function(){this.pointer=(parseInt(this.pointer)+1)%this.totalCount;Jamendo.sendEvent(["jamplayer2","playlist","next"],this.actualTrack())},prevTrack:function(){this.pointer=(parseInt(this.pointer)-1+this.totalCount)%this.totalCount;Jamendo.sendEvent(["jamplayer2","playlist","prev"],this.actualTrack())},_setTracks:function(B){this.tracks=B;this.totalCount=this.tracks.length;var C=0;for(var A=this.tracks.length-1;A>=0;A--){C+=this.tracks[A].duration;this.tracks[A].strId="id/track/json/?id="+this.tracks[A].id}this.duration=Jamendo.secondsToLabel(C)},fetch:function(A,C){var A={"targets":this.fetchContainerTargets};var B=Jamendo.unparseStrId(Jamendo.parseStrId(this.containerStrId),A);Jamendo.get2(B,{},function(D){this.containerData=D;this.containerCallback(this);if(C){this.fetchTracks()}}.bind(this),this._fetchError)},fetchTracks:function(){if(!this.tracksStrId){var B=this._guessTracksStrId()}else{var A={"targets":this.fetchTracksTargets};var B=Jamendo.unparseStrId(Jamendo.parseStrId(this.tracksStrId),A)}Jamendo.get2(B,{},function(C){this._setTracks(C);this.tracksCallback(this);Jamendo.sendEvent(["jamplayer2","playlist","loaded"],this)}.bind(this),this._fetchError)},fetchLocal:function(A){for(key in A){this[key]=A[key]}this._setTracks(this.tracks);this.containerCallback(this);this.tracksCallback(this);Jamendo.sendEvent(["jamplayer2","playlist","loaded"],this)}});Jamendo.classes.PlaylistAlbum=Class.create(Jamendo.classes.Playlist,{init:function(){this.fetchContainerTargets=$w("id name artist_name artist_url artist_ahrefname ahrefname url image");this.containerType="album"},_guessTracksStrId:function(){return this.fetchTracksTargets.join(" ")+"/track/json/artist_album+album_track/?album_id="+this.containerData.pluck("id").join(" ")+"&order=numalbum_asc&n=all"}});Jamendo.classes.PlaylistPlaylist=Class.create(Jamendo.classes.Playlist,{init:function(){this.fetchContainerTargets=$w("id name user_name user_url user_image ahrefname user_ahrefname");this.containerType="playlist"},_guessTracksStrId:function(){return this.fetchTracksTargets.join(" ")+"/track/json/artist_album+playlist_track+album_track/?playlist_id="+this.containerData.pluck("id").join(" ")+"&order=numplaylist_asc&n=all"}});Jamendo.classes.PlaylistNone=Class.create(Jamendo.classes.Playlist,{init:function(){this.containerType="none"},_guessTracksStrId:function(){},fetch:function(A,B){this.containerData=[];this.containerCallback(this);if(B){this.fetchTracks()}}});Jamendo.classes.LinkPlayers=Class.create({established:false,handle:null,interval:null,callback:null,initialize:function(){this.handle=null;this.callback=null;Jamendo.addObserver(["jamplayer2","link","confirm"],this._observeConfirmLink.bind(this));Jamendo.addObserver(["jamplayer2","link","close"],this._observeLinkClose.bind(this))},establish:function(A){if(!this.handle){return }this.callback=A||null;if(!this.interval){this.interval=setInterval(function(){if(this.handle&&this.handle.Jamendo){this.handle.Jamendo.sendEvent(["jamplayer2","link","do"],window)}}.bind(this),500)}},_observeConfirmLink:function(A,B){if(this.interval){clearInterval(this.interval);this.interval=null}this.established=true;if(this.callback){this.callback()}},_observeLinkClose:function(A,B){this.established=false;this.handle=null}});Jamendo.classes.playerHandler=Class.create({link:null,popuphandle:null,initialize:function(A){this.o=Object.extend({"popupLocation":"/player/","debug":false},A);this.popuphandle=false;this.link=new Jamendo.classes.LinkPlayers()},popup:function(D,A){A=A||null;if(this.interval){clearInterval(this.interval);this.interval=null}try{if(!this.popuphandle||(this.popuphandle&&this.popuphandle.closed)){this.popuphandle=window.open("","jamendo_player2","width=800,height=450,menubar=no,location=no,toolbar=no,directories=no,personalbar=no,status=no,resizable=yes");if(this.popuphandle.location.href.indexOf("player")==-1){this.popuphandle.location=this.o.popupLocation}}this.link.handle=this.popuphandle;var C=null;if(D){C=function(){this.popuphandle.Jamendo.sendEvent(["jamplayer2","remote","control",D],A)}.bind(this)}if(this.link.established){C()}else{this.link.establish(C)}}catch(B){if(this.o.debug){alert($H(B).inspect())}return true}return false},redoLink:function(A,B){this.link.handle=null;this.interval=setInterval(function(){if(Cookie.get("jps")=="open"){this.popup("touch");clearInterval(this.interval);this.interval=null}}.bind(this),500)}});Jamendo.classes.JamPlayer2=Class.create({linkedWindows:{},infoBroadcastInterval:null,initialize:function(A){this.o=Object.extend({"htmlDebugEvents":false,"apiDomain":"","userId":false,"firebugLog":false,"popup":false},A);this.guis={};this.drivers={};this.apiCache={};this.pls=new Jamendo.classes.PlaylistsManager(this);try{if(document.domain==this.o.apiDomain){this.o.apiDomain=""}}catch(B){}if(this.o.popup){try{this.h=new Jamendo.classes.History(this)}catch(B){this.h=null}Jamendo.addObserver(["jamplayer2","link","do"],this._observeLink.bind(this));Jamendo.addObserver(["jamplayer2","error"],this._observeError.bind(this));Jamendo.addObserver(["jamplayer2","openUrl"],this._observeOpenUrl.bind(this));Event.observe(window,"unload",this._observeWindowClose.bind(this));Event.observe(window,"resize",this._observeWindowResize);this._observeWindowResize.defer(0.3);this.infoBroadcastInterval=setInterval(this.postBroadcast.bind(this),500);Cookie.set("jps","open")}},p:function(){return this.pls.get()},auth:function(){return Jamendo.getEnv("USERID")},addGui:function(A){A.connect(this);this.guis[A.name]=A},switchGui:function(A){this.gui=this.guis[A];this.gui.switched()},addDriver:function(A){A.connect(this);this.drivers[A.name]=A},switchDriver:function(A){this.driver=this.drivers[A];this.driver.switched()},setAudio:function(B,A){this.audio=new B(this,A);this.audio.enable()},getTrackLowfiURL:function(A){return"http://www.jamendo.com/get/track/id/track/audio/redirect/"+A+"/?aue=mp31"},postBroadcast:function(){if(!this.audio){return }var C=this.audio.getPosition()||[0,0,0];if(!this.p()||!this.p().current()||!this.p().current().actualTrack){return }var A=this.p().current().actualTrack();if(!A){return }var B={"actualTrack":A,"lengths":{"pos":C[0],"len":Math.max(A.duration*1000,C[1]),"buf":C[2]},"status":this.audio.status,"volume":Cookie.get("jpv")};B.lengths.timeRemaining="-"+Jamendo.secondsToLabel(Math.ceil((B.lengths.len-B.lengths.pos)/1000));$H(this.linkedWindows).each(function(E){try{if(E.value&&E.value.Jamendo){E.value.Jamendo.page.remoteplayer.gui.broadcast=B}else{delete this.linkedWindows[E.key]}}catch(D){delete this.linkedWindows[E.key]}}.bind(this))},_observeError:function(A,B){var C=$("jamPlayer_error");if(C){C.innerHTML=B;return SuperBox.call("localdiv","jamPlayer_error")}alert(B)},_observeLink:function(B,A){if(!this.linkedWindows[A._uniq]){this.linkedWindows[A._uniq]=A;A.Jamendo.sendEvent(["jamplayer2","link","confirm"])}},_observeWindowClose:function(A){Jamendo.fixObjectLeaks();if(this.infoBroadcastInterval){clearInterval(this.infoBroadcastInterval)}if(this.o.popup){Cookie.set("jps","closed")}$H(this.linkedWindows).each(function(C){try{if(C.value&&C.value.Jamendo){C.value.Jamendo.sendEvent(["jamplayer2","link","close"])}else{delete this.linkedWindows[C.key]}}catch(B){delete this.linkedWindows[C.key]}}.bind(this))},_observeOpenUrl:function(C,D){if(D.indexOf("/")!==0&&D.indexOf("http")==-1){D="/"+D}var B=this.linkedWindows[$H(this.linkedWindows).keys()[0]];if(B){B.location=D;B.focus()}else{var A=Jamendo.page.popup(D)}},applyHref:function(A){A.descendants().each(function(C,B){if((C.nodeName=="A")&&!C.onclick&&!C.hasClassName("container")){Event.observe(C,"click",function(D){D.stop();Jamendo.sendEvent(["jamplayer2","openUrl"],Jamendo.requestUri(this.href));return false})}})},playing:function(A){if(!A){return false}if(A.indexOf("#")>0){A=A.substring(0,A.indexOf("#"))}if(!this.p()||!this.p().current()){return false}return A==this.p().current().strId},tabMenu:function(){return this.gui.getComponent("datatable").section},_observeWindowResize:function(A){Jamendo.sendEvent(["jamplayer2","resize"],{"width":parseInt(document.documentElement.clientWidth),"height":parseInt(document.documentElement.clientHeight)})}});Jamendo.classes.audios={};Jamendo.classes.Audio=Class.create({initialize:function(B,A){this.loaded=false;this.enabled=false;this.status="notready";this.offset=0;this.volume=100;this.j=B;this.o=Object.extend({},A);Jamendo.addObserver(["jamplayer2","playlists","track","play"],this._observePlaylistPlayTrack.bind(this));Jamendo.addObserver(["jamplayer2","playlists","track","pause"],this._observePlaylistPauseTrack.bind(this));Jamendo.addObserver(["jamplayer2","setVolume"],this._observeVolume.bind(this));this.init()},init:function(){this.name="generic"},sendEvent:function(A,B){Jamendo.sendEvent(["jamplayer2","audio",this.name,A],B);Jamendo.sendEvent(["jamplayer2","audio","all",A],B)},setStatus:function(A){this.status=A;this.sendEvent("statusChange",A)},audioOK:function(){this.loaded=true;this.enabled=true;this.sendEvent("enable",true);this.setStatus("ready")},audioNOK:function(){this.loaded=true;this.enabled=false;this.sendEvent("enable",false);this.setStatus("notready")},setVolume:function(A){this.volume=A},getVolume:function(){return this.volume},getPosition:function(){return[0,0,0]},adjustOffset:function(A){A=A||false;this.offset=A?0:this.getPosition()[0]},playTrack:function(B,A){if(!this.enabled){return }},playFile:function(A,B){},pauseTrack:function(){},_observePlaylistPlayTrack:function(A,B){this.offset=(B>=0)?B:this.getPosition()[0];this.playTrack(this.j.p().current(),this.offset)},_observePlaylistPauseTrack:function(A,B){this.pauseTrack()},_observeVolume:function(A,B){this.setVolume(B)}});Jamendo.classes.audios.Flash=Class.create(Jamendo.classes.Audio,{init:function(){this.o=Object.extend({"loadTimeout":3000,"audioInsertId":false,"flashObjectURL":"/res/js_aflax/jamSound2.swf","flashInsertColor":"transparent"},this.o);this.name="flash";this.audioObject=false;this.volume=75;this.buffer=1},jamSoundCheckCommands:function(){if(!this.audioObject){return }try{var A=this.audioObject.GetVariable("jsCommand");if(A!=""){this.sendEvent("flashVar",A)}if(A=="init"){this.audioOK()}else{if(A=="statusPlaying"){this.setStatus("playing");this.sendEvent("soundStart")}else{if(A=="soundComplete"){this.setStatus("ready");this.sendEvent("soundComplete")}}}this.audioObject.SetVariable("jsCommand","")}catch(B){}},getPosition:function(){if(!this.loaded){return false}return[this.audioObject.GetVariable("jsPosition")||0,this.audioObject.GetVariable("jsDuration")||0,this.audioObject.GetVariable("jsLoadedPercent")||0]},enable:function(){if(swfobject.hasFlashPlayerVersion("6.0.40")){swfobject.embedSWF(this.o.flashObjectURL,this.o.audioInsertId,"1","1","6.0.40",null,{},{allowScriptAccess:"always",swLiveConnect:"true"},{id:this.o.audioInsertId,name:this.o.audioInsertId});swfobject.addDomLoadEvent(function(){var B=document.getElementById(this.o.audioInsertId);var A=B.getElementsByTagName("object")[0];this.audioObject=false;if(B){if(!A||(A&&typeof B.SetVariable!="undefined")){this.audioObject=B}else{if(typeof A.SetVariable!="undefined"){this.audioObject=A}else{Jamendo.sendEvent(["jamplayer2","error"],"Unable to locate an object on the page");return }}}setInterval(this.jamSoundCheckCommands.bind(this),100);setTimeout(this.loadTimeout.bind(this),1000);setTimeout(this.loadTimeoutFatal.bind(this),this.o.loadTimeout)}.bind(this))}else{Jamendo.sendEvent(["jamplayer2","error"],'You need <a href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">Flash 6+</a> to run jamPlayerWeb!');this.flashError=true;this.switchToExternalAudio()}},checkForFlashBlock:function(C,B){var A=document.getElementById(C).firstChild;if(A&&A.style&&(A.style.backgroundImage=="url(chrome://flashblock/content/flash.png)"||A.style.backgroundImage=="url(chrome://flashblock/content/flashplay.png)")){if(B){A.onclick()}return true}else{return false}},loadTimeout:function(){this.checkForFlashBlock(this.o.audioInsertId,true)},loadTimeoutFatal:function(){this.loadTimeout();if(!this.loaded&&!this.flashError){Jamendo.sendEvent(["jamplayer2","error"],"Problem with Flash audio backend. <br/><br/>If you have AdBlock or FlashBlock installed, please whitelist www.jamendo.com. <br/><br/>If not, please mail us: contact@jamendo.com. Thanks!");this.switchToExternalAudio()}},switchToExternalAudio:function(){this.audioNOK();this.j.setAudio(Jamendo.classes.audios.External,{"audioInsertId":this.o.audioInsertId})},setVolume:function(A){this.volume=A;if(this.status=="playing"){this.audioObject.SetVariable("jamCommand","volume|"+this.volume)}},getVolume:function(){return this.volume},playTrack:function(B,A){if(!B){return }if(!this.enabled){Jamendo.observeOnce(["audio","flash","enable"],function(){this.playTrack(B,A)}.bind(this));return }this.playFile(this.j.getTrackLowfiURL(B.actualTrack().id),A)},playFile:function(A,B){B=B?B:0;this.setStatus("loading");this.audioObject.SetVariable("jamCommand","playMP3|"+A+"|"+this.offset+"|"+(11250*this.buffer)+"|"+this.getVolume())},pauseTrack:function(){if(!this.enabled){return }this.setStatus("paused");this.audioObject.SetVariable("jamCommand","stop")}});Jamendo.classes.audios.External=Class.create(Jamendo.classes.Audio,{init:function(){this.o=Object.extend({"audioInsertId":false},this.o);this.name="external"},enable:function(){$(this.o.audioInsertId).innerHTML="<iframe src='/blank.html' frameborder='0' scrollbars='no'  id='"+this.o.audioInsertId+"_jamPlayerIFrame' name='"+this.o.audioInsertId+"_jamPlayerIFrame' style='border:0px;width:1px;height:1px;overflow:hidden;'></iframe>";this.audioOK()},playTrack:function(B,A){trackId=B.actualTrack().id;if(!this.enabled){return }frames[this.o.audioInsertId+"_jamPlayerIFrame"].location.href="/get/track/id/track/audio/play/"+trackId+"/";this.setStatus("playing")},pauseTrack:function(){if(!this.enabled){return }this.setStatus("paused")}});Jamendo.classes.drivers={};Jamendo.classes.Driver=Class.create({initialize:function(A){this.o=Object.extend({},A)},init:function(){this.name="generic"},switched:function(){Jamendo.addObserver(["jamplayer2","audio","all","soundComplete"],this._observeAudioSoundComplete.bind(this));Jamendo.addObserver(["jamplayer2","audio","all","soundNearlyComplete"],this._observeAudioSoundNearlyComplete.bind(this));this._switched()},_switched:function(){},connect:function(A){this.j=A;this.init()},disconnect:function(){delete this.j},action:function(A){Jamendo.sendEvent(["jamplayer2","driver","action"],A);this[A]()},play:function(){},next:function(){},prev:function(){},pause:function(){},stop:function(){},onSoundNearlyComplete:function(){},onSoundComplete:function(){},playlistPlay:function(){var B=this.j.p().current();if(!B){return }var A=B.actualTrack();if(A){Jamendo.sendEvent(["jamplayer2","playlists","track","play"],this.j.audio.offset);if((this.j.audio.offset==0)&&!this.o.dontSendPlayingTrack){Jamendo.sendEvent(["jamplayer2","history","playing"],A.strId)}return true}else{Jamendo.sendEvent(["jamplayer2","error"],"No tracks to play");return false}},playlistPause:function(){this.j.audio.adjustOffset();Jamendo.sendEvent(["jamplayer2","playlists","track","pause"])},playlistStop:function(){this.j.audio.adjustOffset(true);Jamendo.sendEvent(["jamplayer2","playlists","track","pause"]);Jamendo.sendEvent(["jamplayer2","playlists","track","stop"])},playlistNext:function(){var B=this.j.p();if(B){var A=this._playStatus();this.playlistStop();B.nextTrack();if(A){this.playlistPlay()}}},playlistPrev:function(){var B=this.j.p();if(B){var A=this._playStatus();this.playlistStop();B.prevTrack();if(A){this.playlistPlay()}}},_playStatus:function(){var A=this.j.audio.status;return(A=="playing")||(A=="ready")},_observeAudioSoundComplete:function(A,B){this.onSoundComplete(B)},_observeAudioSoundNearlyComplete:function(A,B){this.onSoundNearlyComplete(B)}});Jamendo.classes.drivers.RemotePlayer=Class.create(Jamendo.classes.Driver,{init:function(){this.name="remoteplayer";Jamendo.addObserver(["jamplayer2","remote","control"],this._observeControl.bind(this));Jamendo.forwardEvent(["jamplayer2","globalplay","control","play"],["jamplayer2","remote","control","play"],{permanent:true})},play:function(B){if(!this.j.audio||(this.j.audio.status=="notready")){Jamendo.forwardEvent(["jamplayer2","audio","all","statusChange"],["jamplayer2","remote","control","play"],{data:B});return }if(B&&((this.j.audio.status!="paused")||(B!=this.j.p().current().getStrId()))){var A=function(D){Jamendo.sendEvent(["jamplayer2","history","register"],D);Jamendo.sendEvent(["jamplayer2","playlists","update","prepend"],D);Jamendo.sendEvent(["jamplayer2","playlists","track","play"],0);Jamendo.sendEvent(["jamplayer2","component","tabMenus","selection"],"nowPlaying");Jamendo.sendEvent(["jamplayer2","playlists","playlist","selection","nowPlaying"],0)};var C=this.j.pls.fetch(B);if(C){this.j.pls.get("nowPlaying").prepend(C,A)}else{PlaylistFactory.get(this.j,B,function(D){this.j.p().prepend(D,A)}.bind(this))}}else{if(this.j.audio.status!="playing"){this.playlistPlay()}}},next:function(){this.playlistNext()},prev:function(){this.playlistPrev()},pause:function(){this.playlistPause()},stop:function(){this.playlistStop()},seek:function(B){var C=this.j.p().current();var A=Math.max(C?C.actualTrack().duration*1000:0,this.j.audio.getPosition()[1]);var D=Math.floor(A*B/100);Jamendo.sendEvent(["jamplayer2","playlists","track","play"],D)},touch:function(){window.focus()},setVolume:function(A){this.j.gui.getComponent("volumeslider").control.setValue(A/100)},_observeControl:function(A,B){var C=A[A.length-1];if(this[C]){this[C].apply(this,[B])}}});Jamendo.classes.drivers.Localuser=Class.create(Jamendo.classes.Driver,{init:function(){this.name="localuser";Jamendo.addObserver(["jamplayer2","playlists","track","selection"],this._observeTrackSelection.bind(this))},play:function(){this.playlistPlay()},next:function(){this.playlistNext()},prev:function(){this.playlistPrev()},pause:function(){this.playlistPause()},stop:function(){this.playlistStop()},onSoundNearlyComplete:function(){},onSoundComplete:function(){this.next()},_observePlaylistSelection:function(B,A){this.stop();if(this.j.p().current()){this.j.p().current().resetPointer()}this.j.p().currentPos=A;this.play();var C=this.j.p().current();Jamendo.sendEvent(["jamplayer2","history","register"],C.strId);Jamendo.sendEvent(["jamplayer2","playlists","update","selected"],C)},_observeTrackSelection:function(B,A){this.stop();this.j.p().current().pointer=A;this.play()}});Jamendo.classes.guis={};Jamendo.classes.Gui=Class.create({initialize:function(A){this.c=$H({});this.o=A||{}},switched:function(){},init:function(){this.name="generic"},connect:function(A){this.j=A;this.init()},disconnect:function(){delete this.j;delete this.c},getInnerWindowDimensions:function(){var A=[[],[]];if(window.innerWidth>0){A[0].push(window.innerWidth);A[1].push(window.innerHeight)}if(document.body.clientWidth>0){A[0].push(document.body.clientWidth);A[1].push(document.body.clientHeight)}if(document.documentElement&&document.documentElement.clientWidth>0){A[0].push(document.documentElement.clientWidth);A[1].push(document.documentElement.clientHeight)}if(document.body.offsetWidth>0){A[0].push(document.body.offsetWidth);A[1].push(document.body.offsetHeight)}return{"width":Math.min.apply(null,A[0]),"height":Math.min.apply(null,A[1])}},addComponent:function(A,B){A.connect(this.j);this.c.set(A.name,A);if(B){this.c.get(A.name).enable();this.c.get(A.name).load(true)}},getComponent:function(A){return this.c.get(A)}});Jamendo.classes.NoGui=Class.create(Jamendo.classes.Gui,{init:function(){this.name="nogui"},switched:function(){}});Jamendo.classes.components={};Jamendo.classes.Component=Class.create({initialize:function(A){this.o=Object.extend({"htmlBindings":{}},A);this._bindingsThatUseLoading=[];this._loadingTimeout=false;this._loadingStatus=0;this.o.htmlBindings=$H(this.o.htmlBindings);this.addBindings(this.o.htmlBindings)},addBindings:function(A){$H(A).each(function(B){this.o.htmlBindings.set(B.key,Object.extend({"useLoading":false,"loadingShown":false,"imgLoading":false,"e":$(B.value.id)},B.value));if(B.value.useLoading){this._bindingsThatUseLoading.push(B.key)}}.bind(this))},connect:function(A){this.j=A;this.enabled=false;this.shown=false;this.init();this.sendEvent("init")},init:function(){this.name="generic";this.type="generic";this.icon=false;this.dispname="JW_CMP_GENERIC"},sendEvent:function(A,B){Jamendo.sendEvent(["jamplayer2","component",this.name,A],B)},enable:function(){this._enable();this.enabled=true;this.sendEvent("status","enabled")},disable:function(){this._disable();this.enabled=false;this.sendEvent("status","disabled")},toggleEnable:function(){if(this.enabled){this.disable()}else{this.enable()}},_enable:function(){},_disable:function(){},show:function(){this.hideLoading();this.o.htmlBindings.each(function(A){Element.show(A.value.e)});this.shown=true;this.sendEvent("status","shown")},hide:function(){this.hideLoading();this.o.htmlBindings.each(function(A){Element.hide(A.value.e)});this.shown=false;this.sendEvent("status","hidden")},toggleShow:function(){if(this.e&&this.enabled){if(this.shown){this.hide()}else{this.show()}}},load:function(A,B){this.showLoading();this._load(function(){this.sendEvent("status","loaded");if(B){B()}if(A){this.show()}}.bind(this))},_load:function(A){A()},showLoading:function(){this._loadingStatus=1;this._loadingTimeout=setTimeout(this._showLoading.bind(this),100)},_showLoading:function(){this._loadingTimeout=false;this._loadingStatus=2;this._bindingsThatUseLoading.each(function(C){var E=this.o.htmlBindings.get(C);var A=24;var D="http://img.jamendo.com/superboxloading.gif";E.divLoading=document.createElement("span");E.divLoading.style.position=E.e.style.position;E.divLoading.style.width=E.e.style.width;E.divLoading.style.height=E.e.style.height;E.divLoading.style.top=E.e.style.top;E.divLoading.style.left=E.e.style.left;E.e.parentNode.insertBefore(E.divLoading,E.e);var B=Element.getDimensions(E.divLoading);E.imgLoading=document.createElement("img");E.imgLoading.setAttribute("src",D);E.imgLoading.style.marginLeft=Math.floor(B.width/2-A)+"px";E.imgLoading.style.marginTop=Math.floor(B.height/2-A)+"px";E.divLoading.appendChild(E.imgLoading)}.bind(this));this._loadingStatus=3},hideLoading:function(){if(!(this._loadingTimeout===false)){clearTimeout(this._loadingTimeout)}else{if(this._loadingStatus==2){setTimeout(this.hideLoading.bind(this),100)}else{if(this._loadingStatus==3){this._bindingsThatUseLoading.each(function(A){Element.remove(this.o.htmlBindings.get(A).divLoading)}.bind(this))}}}this._loadingStatus=0}});Jamendo.classes.components.Playcontrols=Class.create(Jamendo.classes.Component,{init:function(){this.name="playcontrols";this.buttons=$H();$A(["play","pause","stop","next","prev","star","ign"]).each(function(B){var A=$(this.o.htmlElementPrefix+B);if(A){this.buttons.set(B,A);Event.observe(A,"click",function(){if(B=="play"&&this.o.externalPlayer){Jamendo.page.play(this.j.p().current().getStrId())}else{this.j.driver.action(B)}}.bind(this))}}.bind(this));Jamendo.addObserver(["jamplayer2","audio","all","statusChange"],this._observeAudioStatusChange.bind(this));if(this.j.audio){this._observeAudioStatusChange(this.j.audio.status)}},_observeAudioStatusChange:function(A,B){switch(B){case"playing":this.buttonsShowHide(["pause","stop","next","prev","star","ign"],["play"],[]);break;case"paused":this.buttonsShowHide(["stop","next","prev","play","star","ign"],["pause"],[]);break;case"loading":this.buttonsShowHide(["pause","stop","next","prev"],["play"],["star","ign"]);break;case"ready":this.buttonsShowHide(["play","stop","next","prev"],["pause"],["star","ign"]);break;case"notready":this.buttonsShowHide([],["pause"],["play","stop","next","prev","star","ign"]);break}},buttonsShowHide:function(A,C,B){this.buttons.each(function(D){if(C.include(D.key)){Element.hide(D.value)}else{if(A.include(D.key)){Element.show(D.value);if(this.o.enabledClass){Element.addClassName(D.value,this.o.enabledClass)}if(this.o.disabledClass){Element.removeClassName(D.value,this.o.disabledClass)}}else{if(B.include(D.key)){if(this.o.enabledClass){Element.removeClassName(D.value,this.o.enabledClass)}if(this.o.disabledClass){Element.addClassName(D.value,this.o.disabledClass);Element.show(D.value)}else{Element.hide(D.value)}}}}}.bind(this))}});Jamendo.classes.components.Volumeslider=Class.create(Jamendo.classes.Component,{init:function(){this.name="volumeslider";this.muted=false;this.o.sliderOptions=Object.extend({"maximum":100,"onChange":function(A){Jamendo.sendEvent(["jamplayer2","setVolume"],A*100)}},this.o.sliderOptions);this.control=new Control.Slider("jamplayerControls_volume_handle","jamplayerControls_volume_track",this.o.sliderOptions);Jamendo.addObserver(["jamplayer2","setVolume"],this._observeSetVolume.bind(this));Event.observe($("jamplayerControls_volume_volumeMin"),"click",function(){this.mute()}.bind(this));Event.observe($("jamplayerControls_volume_volumeMax"),"click",function(){this.control.setValue(100)}.bind(this));Jamendo.observeOnce(["jamplayer2","audio","flash","statusChange"],function(){if(Cookie.accept()&&Cookie.get("jpv")){volume=Cookie.get("jpv");this.control.setValue(volume/100)}else{this.control.setValue(75/100)}}.bind(this))},_observeSetVolume:function(B,A){if(Cookie.accept()){Cookie.set("jpv",A)}},mute:function(){if(this.muted){this.control.setValue(this.muted/100);this.muted=false}else{this.muted=this.j.audio.volume;this.control.setValue(0)}}});Jamendo.classes.components.ProgressBar=Class.create(Jamendo.classes.Component,{container:null,bar:null,bufferBar:null,timeRemaining:null,label:null,timer:null,bufferTimer:null,init:function(){this.name="progressBar";this.container=this.o.htmlElement;this.bar=$(this.o.htmlElementPrefix+"_bar");this.bar.hide();this.bufferBar=$(this.o.htmlElementPrefix+"_bufferBar");this.bufferBar.hide();this.label=$(this.o.htmlElementPrefix+"_label");this.timeRemaining=$(this.o.htmlElementPrefix+"_timeRemaining");Event.observe(this.container,"click",this._onProgressbarClick.bind(this));Jamendo.addObserver(["jamplayer2","playlists"],this._observePlaylists.bind(this));Jamendo.addObserver(["jamplayer2","audio","all","statusChange"],this._observeAudioStatusChange.bind(this));Jamendo.addObserver(["jamplayer2","audio","flash","flashVar"],this._observeFlashvar.bind(this))},_infos:function(){if(!this.j.audio){return{"pos":0,"len":0,"buf":0,"width":0,"offset":0}}var C=this.j.audio.getPosition();var B=this.j.p().current();if(B&&B.actualTrack){var A=B.actualTrack();if(A){return{"pos":C[0],"len":Math.max(A.duration*1000,C[1]),"buf":C[2],"width":parseInt(this.container.offsetWidth),"offset":Position.cumulativeOffset(this.container)}}}return{"pos":C[0],"len":C[1],"buf":C[2],"width":parseInt(this.container.offsetWidth),"offset":Position.cumulativeOffset(this.container)}},_observePlaylists:function(A,B){switch(A[2]){case"track":switch(A[3]){case"play":if(this.timer===null){this.bar.show();this.timer=setInterval(function(){var C=this._infos();this.bar.setStyle({"width":Math.floor(C.width*C.pos/C.len)+"px"});this.timeRemaining.innerHTML="-"+Jamendo.secondsToLabel(Math.ceil((C.len-C.pos)/1000))}.bind(this),500)}break;case"pause":clearTimeout(this.timer);this.timer=null;break;case"stop":this.bar.style.width="0";this.bar.hide();this.timeRemaining.innerHTML="";break}break;case"tracks":if(this.j.audio.status!="playing"){this._observeAudioStatusChange(null,"playing");this.bufferBar.setStyle({"width":"0"});this.bufferBar.hide()}break}},_observeFlashvar:function(A,B){if((B=="statusBuffering")&&(this.bufferTimer===null)){this.bufferBar.show();this.label.innerHTML=Jamendo.getStr("JAMPLAYER2_BUFFERING");this.bufferTimer=setInterval(function(){var C=this._infos();if(C.buf==100){this.bufferBar.setStyle({"width":"100%"});clearTimeout(this.bufferTimer);this.bufferTimer=null}else{this.bufferBar.setStyle({"width":Math.floor(C.width*C.buf/100)+"px"})}}.bind(this),400)}},_observeAudioStatusChange:function(B,C){if(C=="playing"){var A=this.j.p().current().actualTrack();if(A){this.label.innerHTML=(this.j.o.popup?"<b>"+(A.artist_name?A.artist_name:A.album_name)+"</b> - ":"")+A.name}}},_onProgressbarClick:function(D){if(!this.j.p().current().actualTrack()){return }var E=this._infos();var B=D.clientX-E.offset[0];if(B>this.bufferBar.offsetWidth){return }var A=Math.round(B/this.container.offsetWidth*10000)/100;var C=Math.floor(E.len*A/100);Jamendo.sendEvent(["jamplayer2","playlists","track","play"],C);return false}});Jamendo.classes.GuiFirsttime=Class.create(Jamendo.classes.Gui,{init:function(){this.name="firsttime";this.hi=$H();this.he=$H();["controls","progressBar","volume"].each(function(A){this.hi.set(A,this.o.htmlPrefix+A);this.he.set(A,$(this.hi.get(A)))}.bind(this))},switched:function(){this.addComponent(new Jamendo.classes.components.Playcontrols({"htmlElementPrefix":this.hi.get("controls"),"externalPlayer":!Jamendo.page.usePlayer()}),true);this.addComponent(new Jamendo.classes.components.Volumeslider({"htmlBindings":{"track":{"id":"jamplayerControls_volume_track"},"handle":{"id":"jamplayerControls_volume_handle"}}}),true);this.addComponent(new Jamendo.classes.components.ProgressBar({"htmlElementPrefix":this.hi.get("progressBar"),"htmlElement":this.he.get("progressBar")}),true);this.addComponent(new Jamendo.classes.components.AlbumSwitcher({}),true);this.addComponent(new Jamendo.classes.components.BigCoverController({"img_id":"bigcover_img"}),true);this.addComponent(new Jamendo.classes.components.AlbumInfo({}),true)}});Jamendo.classes.components.BigCoverController=Class.create(Jamendo.classes.Component,{coverElt:null,covers:{},init:function(){this.name="bigCoverController";this.o=Object.extend({"size":"300"},this.o);Jamendo.onReady(function(){this.coverElt=$(this.o.img_id)}.bind(this));Jamendo.addObserver(["jamplayer2","playlist","loaded"],this._observePlayTrack.bind(this));Jamendo.addObserver(["jamplayer2","playlists","track","play"],this._observePlayTrack.bind(this));if(Cookie.accept()&&(Cookie.get("jps")=="open")){Jamendo.observeOnce(["jamplayer2","playlists","track","play"],function(){var A=new Jamendo.classes.playerHandler();A.popup("pause")})}},_observePlayTrack:function(B,C){if(!this.coverElt){return }var A=this.j.p().current().actualTrack();if(A){this._updateImgSrc(A.album_id)}},_updateImgSrc:function(B){if(this.covers[B]){this.coverElt.src=this.covers[B];return }Jamendo.get2("image/album/json/",{id:B,imagesize:this.o.size},function(C){this.covers[B]=C;if(this.coverElt.src!=C){this.coverElt.show();this.coverElt.src=C}}.bind(this));var A=this.coverElt.parentNode;if(A.nodeName=="A"){A.href="album/"+B}}});Jamendo.classes.components.AlbumSwitcher=Class.create(Jamendo.classes.Component,{albums:null,init:function(){this.name="albumSwitcher";Jamendo.onReady(function(){this.albums=$$(".album_browser")}.bind(this));Jamendo.addObserver(["jamplayer2","playlists","track","play"],this._observePlayTrack.bind(this))},_observePlayTrack:function(A,D){var C=this.j.p().current().containerData[0];if(C){var B=$("album-"+C.id);if(B){$$(".hidden")[0].removeClassName("hidden");B.addClassName("hidden")}}}});Jamendo.classes.components.AlbumInfo=Class.create(Jamendo.classes.Component,{container:null,cover:null,content:null,init:function(){this.name="albumInfo";Jamendo.onReady(function(){this.container=$("firsttime_album");if(this.container){this.artist_name=this.container.down(".g_artist_name");this.album_name=this.container.down(".g_album_name");this.tags=this.container.down(".g_tag_name");this.download_link=this.container.down(".g_album_download");Jamendo.addObserver(["jamplayer2","playlists","track","play"],this._observePlayTrack.bind(this))}}.bind(this))},_observePlayTrack:function(C,E){var D=this.j.p().current();this.artist_name.innerHTML='<a class="g_artist_name" href="artist/'+D.containerData[0].artist_url+'">'+D.containerData[0].artist_name+"</a>";this.album_name.innerHTML='<a class="g_album_name" href="album/'+D.containerData[0].id+'">'+D.containerData[0].name+"</a>";var B=this.download_link.down("img");this.download_link.descendants().each(function(F){if(F.nodeName=="A"){F.setAttribute("onclick","return Jamendo.page.download('album', "+D.containerData[0].id+");");F.setAttribute("href","/download/album/"+D.containerData[0].id)}});var A=this.download_link.down("a");A.insertBefore(B,A.firstChild);Jamendo.get2("id+ahrefname/tag/json/album_tag_soundslike/",{album_id:D.containerData[0].id},function(G){var F=new Array();G.each(function(I,H){F.push(I.ahrefname)});this.tags.innerHTML=F.join(" ")}.bind(this))}});Jamendo.classes.PlaylistsManager=Class.create({playlistss:{},initialize:function(A){this.j=A},get:function(A){A=A||"nowPlaying";if(!this.playlistss[A]){this.playlistss[A]=new Jamendo.classes.Playlists(this.j)}return this.playlistss[A]},fetch:function(C){var A=null;if(C.indexOf("#")>=0){A=C.substring(C.indexOf("#")+1);C=C.substring(0,C.indexOf("#"))}var B=null;$H(this.playlistss).each(function(E){if(!B){var D=null;$H(E.value.playlists).each(function(G){var F=G.value;if(F.strId==C){D=F}});if(D){B=D}}});if(B&&A){B.pointer=A}return B}})