var $PNGFIX=true;var _pngfix=function(){};if(typeof (Prototype)!="undefined"&&Prototype.Browser.IE){(function(){var E="DXImageTransform.Microsoft.AlphaImageLoader";var C="progid:"+E+"(src='%1',sizingMethod='scale')";var A=function(G){if(!G.filters){return }var H=G.filters[E];if(H){H.src=G.src;H.enabled=true}else{G.runtimeStyle.filter=C.replace(/%1/,G.src)}G.onload=function(){};G.src="http://img.jamendo.com/spacer.gif"};_pngfix=function(G){if(!$PNGFIX){return }var H=new Image();H.onload=function(){G.width=H.width;G.height=H.height;H=null};H.src=G.src;A(G)};var B=function(H){var G=H.currentStyle.backgroundImage;var I=G.substring(5,G.length-2);H.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+I+"', sizingMethod='crop')";H.style.backgroundImage="url(http://img.jamendo.com/spacer.gif)"};var D=function(){if(window.event.propertyName=="style.backgroundImage"){var H=window.event.srcElement;if(!H.currentStyle.backgroundImage.match(/x\.gif/i)){var G=H.currentStyle.backgroundImage;var I=G.substring(5,G.length-2);H.filters.item(0).src=I;H.style.backgroundImage="url(http://img.jamendo.com/spacer.gif)"}}};var F=function(){for(var G=document.all.length-1,H=null;(H=document.all[G]);G--){if(H.className.match(/pngfix/)&&H.currentStyle.backgroundImage.match(/\.png/i)!==null){B(H);H.attachEvent("onpropertychange",D)}}};document.observe("load",F)})()}var Jamendo=Class.create();Jamendo.prototype={Version:"0.1",initialize:function(){this.activeSerials={};this.ajaxSemaphore=0;this.nextSerial=0;this.observers=[];this.domReady=false;this.forms={};this.formElements={};this.classes={};this.onReady(Prototype.emptyFunction);this.ajaxFeedbackElements=[];this.i18n={}},getStr:function(A){return Jamendo.i18n[A]?Jamendo.i18n[A]:"??"+A+"??"},getEnv:function(A){return{"USERID":Jamendo_ENV["USERID"]||0,"AUTH":(Jamendo_ENV["USERID"]>0),"LANG":Jamendo_ENV["LANG"]||"en","GMAPS_KEY":Jamendo_ENV["GMAPS_KEY"]||"ABQIAAAACQNZjYy0Iy0nQ5vLbXfm5BQWecC8V4p8CO_SECQLRybVH7QL5xRpjsbcv3pCduXiFULF1vFo8LlFkw","USERNAME":Jamendo_ENV["USERNAME"]||"","HTTPHOST":Jamendo_ENV["HTTPHOST"]||"http://www.jamendo.com/","HTTPHOSTI18N":Jamendo_ENV["HTTPHOSTI18N"]||"http://www.jamendo.com/","IMGJAM":Jamendo_ENV["IMGJAM"]||"http://imgjam.com/","PREFS":Jamendo_ENV["PREFS"]||{"stream":"","download":""},"TZOFFSET":Jamendo_ENV["TZOFFSET"]||"","REMOTEPLAYER_URL":Jamendo_ENV["REMOTEPLAYER_URL"]||false,"INTERRUPTS":Jamendo_ENV["INTERRUPTS"]||{},"USER_AGENT":Jamendo_ENV["USER_AGENT"]||"","LISTENERIDSTR":Jamendo_ENV["LISTENERIDSTR"]||"0","NOCACHE":Jamendo_ENV["NOCACHE"]||"0","MOD":Jamendo_ENV["MOD"]||"www","CURRENCY":Jamendo_ENV["CURRENCY"]||"EUR","FACEBOOK_CONNECTED":Jamendo_ENV["FACEBOOK_CONNECTED"]||false,"LOCALE":Jamendo_ENV["LOCALE"]||"en_US"}[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{B=false}catch(C){}}if(B){if(Jamendo.debug){var E=$("Jamendo_log");if(!E){var A=document.getElementsByTagName("body")[0];A.innerHTML='<div id="Jamendo_log"></div>'+A.innerHTML;var E=$("Jamendo_log");E.setStyle("position:absolute;bottom:0;right:0;background:lightyellow;border-top:4px double red;height:120px;width:100%;overflow:auto;")}E.innerHTML=D+"<br />"+E.innerHTML}}},setupAjaxFeedbackElement:function(B,A){B=$(B);var C=new Jamendo.DelayedSwitch(B.show.bind(B),B.hide.bind(B),A);this.addObserver(["ajax","semaphore"],function(E,D){if(D>0){C.on()}else{C.off()}});this.ajaxFeedbackElements.push([B,A,C])},ajaxAbortAllRequests:function(){this.activeSerials={};this.ajaxSemaphore=0;this.sendEvent(["ajax","semaphore"],0)},ajaxAbortRequest:function(A){try{if(A in this.activeSerials){delete this.activeSerials[A];this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore)}}catch(B){}},ajaxRequest:function(B){B=Object.extend({"url":"","params":{},"method":"post","callback":false,"tryback":function(){return true},"errback":false,"serial":true,"timeout":7000,"timeoutId":false,"timeouted":false,"retryDelay":3000,"retryCount":5,"showFeedback":false,"onLoading":Prototype.K,"asynchronous":true},B);if(B.serial){B.serial=(++this.nextSerial);this.activeSerials[B.serial]=true}this.sendEvent(["ajax","semaphore"],++this.ajaxSemaphore);var C={};$H(B.params).each(function(G){C[G.key]=G.value});var A=function(G){if((G.status==401)||(G.status==403)||(G.status==404)||(G.status==500)){B.retryCount=0}clearTimeout(B.timeoutId);delete this.activeSerials[B.serial];if((--B.retryCount)>=0&&B.tryback(B.retryCount)){this.ajaxSemaphore--;setTimeout(function(){this.ajaxRequest(B)}.bind(this),B.retryDelay)}else{this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore);if(B.errback){B.errback()}Jamendo.page.updateFeedbacks([{"type":"warning","text":Jamendo.getStr("FEEDBACK_NOCONNECT")}])}}.bind(this);var E=function(I){clearTimeout(B.timeoutId);if(!B.serial||(B.serial in this.activeSerials)){delete this.activeSerials[B.serial];this.sendEvent(["ajax","semaphore"],--this.ajaxSemaphore);if(B.callback){try{B.callback(I.responseText,I)}catch(H){Jamendo.log("error in callback: "+H.name+" => "+H.message);if(console&&console.trace){console.trace(H)}if(false){if(!$("errordiv")){var G=$("page");G.insert({bottom:'<div id="errordiv" style="width:1000px;height:200px;visibility:hidden;"></div>'})}$("errordiv").update(H.message.gsub(/\\n/,""));SuperBox.call("localdiv","errordiv")}}}}}.bind(this);_success=false;try{if((typeof ClickTaleIsPlayback=="function")&&ClickTaleIsPlayback()){B.url=B.url.replace(new RegExp("^(http://([^/]+))?/"),Jamendo.getEnv("HTTPHOST"))}var D=new Ajax.Request(B.url,{asynchronous:B.asynchronous,method:B.method,parameters:C,onFailure:A,onSuccess:E,onLoading:B.onLoading});_success=true}catch(F){if(!B.asynchronous){A(D.transport)}}if(!B.asynchronous){E(D.transport)}if(B.timeout&&B.asynchronous){B.timeoutId=setTimeout(function(){B.timeouted=true;if(D.transport.readyState>0&&D.transport.readyState<4){D.options["onFailure"](D.transport,D.json)}},B.timeout)}return{"options":B,"serial":B.serial,"abort":function(){this.ajaxAbortRequest(B.serial)}.bind(this)}},prependObject:function(C,D,B){var A={};A[D]=C;$H(B).each(function(E){A[E.key]=E.value});return A},jsonRequest:function(A,D,C,B){B=Object.extend(B||{},{"callback":function(F,G){var E=F.evalJSON();if(this.showFeedback&&E&&E.feedback){Jamendo.page.updateFeedbacks(E.feedback)}if(C){C(E,G)}},"params":D||{},"url":A});return this.ajaxRequest(B)},writeApi:function(G,C,I,B,H){try{if(!H){H={}}var A={};if(C){$A(C).each(function(K,J){if(typeof (K)=="number"){A["p"+J]=K}else{A["p"+J]=Object.toJSON(K)}})}if(Jamendo.getEnv("NOCACHE")=="1"&&G.substring(0,7)=="cached "){G=G.substring(7)}if(G.indexOf("jscached")!=-1){G=G.gsub("jscached ","");if(Jamendo.getEnv("NOCACHE")!="1"){if(typeof (this._cached_writeapi_results)=="undefined"){this._cached_writeapi_results=$H()}var F=G+"__"+Object.toJSON(C).gsub(/[\n \"\']/,"");if(typeof (this._cached_writeapi_results.get(F))!="undefined"){I(Jamendo._cached_writeapi_results.get(F));return true}else{var D=I;I=function(J){Jamendo._cached_writeapi_results.set(F,J);D(J)}}}}if(typeof (B)=="function"){H.errback=B}return this.jsonRequest("/"+Jamendo.getEnv("HTTPHOSTI18N").replace(/.*\.[a-z]+\//,"")+"set/"+G+"/postjson/json",A,I,H)}catch(E){Jamendo.log(E);if(B){B()}return false}},writeApiWithFeedback:function(F,G,E,B,A){A=Object.extend({"showFeedback":true},A);try{var D={};if(G){$A(G).each(function(I,H){if(typeof (I)=="number"){D["p"+H]=I}else{D["p"+H]=Object.toJSON(I)}})}if(typeof (B)=="function"){A.errback=B}return this.jsonRequest("/"+Jamendo.getEnv("HTTPHOSTI18N").replace(/.*\.[a-z]+\//,"")+"set/"+F+"/postjson/jsonfeedback",D,E,A)}catch(C){Jamendo.log(C);if(B){B()}}},get2:function(B,F,E,D,C){C=C||{};F=F||{};if(D){C.errback=D}B=B.replace(/^[^\?]*\/?get2\//,"");var A=B.indexOf("?");if(A>=0){$H(B.substr(A+1).toQueryParams()).each(function(G){if(!$H(F).keys().include(G.key)){F[G.key]=G.value}});B=B.substr(0,A)}B=B.split("/");if(!B[2]){B[2]="json"}B=B.join("/");return Jamendo.jsonRequest("/get2/"+B,F,E,C)},get2parse:function(D){var C={"url":D,"relations":[],"targets":[],"format":"","params":$H(),"position":0};var A=D.indexOf("#");if(A>=0){C["position"]=parseInt("0"+D.substring(A+1));D=D.substring(0,A)}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(/\s+|\+/)}C["targets"]=B[0].split(/\s+|\+/);C["canonicalUrl"]=Jamendo.get2unparse(C);return C},get2unparse: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"].uniq().join("+")+"/"+B["unit"]+"/"+B["format"]+"/"+B["relations"].uniq().join("+")+"?"+B["params"].toQueryString()+(B["position"]?"#"+B["position"]:"")},patchUrl:function(B,D){var C=B.substr(0,B.indexOf("?"));var A=B.substr(B.indexOf("?")+1,B.length).toQueryParams();$H(D).each(function(E){A[E.key]=E.value});return C+"?"+Object.toQueryString(D)},id2ml2:function(B){B=B.split("/");switch(B[0]){case"artist":var A=B[1].split("|");return"/artist//unique/?id="+A[0]+"|id/track//track_album+album_artist/?track_id="+A[1]+"&order=fromparams&n=all";case"tag":return"/tag//?tag_idstr="+B[1];case"radio":return"stream/track/m3u/radio_track_inradioplaylist/?order=numradio_asc&n=50&radio_id="+B[1];case"track_similar":var A=B[1].split("|");return"/track//track_album+album_artist/?order=similarity_desc&n=50&similarid="+A[0]+"."+A[1];default:return"/"+B[0]+"//?"+B[0]+"_id="+B[1]+"&order=num"+B[0]+"_asc&n=all"}return null},JSONCallback:function(B,A){},formatNumber:function(C,A){if(isNaN(C)){return 0}if(C==""){return 0}var H=new String(C);var D=H.split(".");var E=parseFloat(D[0]);var F="";if(D.length>1){var G=new String(D[1]);G=String(parseFloat(D[1])/Math.pow(10,(G.length-A)));G=String(E+Math.round(parseFloat(G))/Math.pow(10,A));var B=G.indexOf(".");if(B==-1){G+=".";B=G.indexOf(".")}while(G.length<=B+A){G+="0"}F=G}else{var B;var G=new String(E);G+=".";B=G.indexOf(".");while(G.length<=B+A){G+="0"}F=G}return F},logEvents:function(A){Jamendo.addObserver(A,function(B,C){var D="[";B.each(function(F,E){D+="'"+F+"'";if(E<B.length-1){D+=", "}});D+="] ";Jamendo.log("sendEvent : "+D+" with data: "+C)})},sendEvent:function(A,C){for(var B=0;B<this.observers.length;B++){if(this.eventIdMatches(A,this.observers[B][0])){try{this.observers[B][1](A,C)}catch(D){Jamendo.log("Error while calling event "+this.observers[B][0]+" with data "+this.observers[B][1]);Jamendo.log(D)}}}},sendEventDefered:function(A,B){(function(){Jamendo.sendEvent(A,B)}).defer()},observeOnce:function(A,B){Jamendo.forwardEvent(A,null,{"callback":B})},forwardEvent:function(G,D,B){if(!G){throw new Error("You have to provide an eventToObserve")}B=B||{};if(!D&&!B.callback){throw new Error("What are you doing ? give a callback or and event to forward !")}var F=B.permanent||false;var C=B.data||null;var A=B.callback||Prototype.K;var E=function(H,I){A(H,C||I);if(D){Jamendo.sendEvent(D,C||I)}if(!F){Jamendo.removeObserver(G,E)}};Jamendo.addObserver(G,E)},secondsToLabel:function(B){var A=Math.floor(B/60);var B=Math.floor(B-A*60);if(B<10){B="0"+B}return A+":"+B},addObserver:function(A,B){this.observers.push([A,B])},removeObserver:function(A,B){this.observers=this.observers.reject(function(C){return(this.eventIdEquals(A,C[0])&&B==C[1])}.bind(this))},removeObserversByEventId:function(A){this.observers=this.observers.reject(function(B){return this.eventIdEquals(A,B[0])}.bind(this))},eventIdMatches:function(C,B){for(var A=0;A<B.length;A++){if(C[A]!=B[A]){return false}}return true},eventIdEquals:function(A,B){return this.eventIdMatches(A,B)&&this.eventIdMatches(B,A)},onReady:function(A){if(this.domReady){return A()}document.observe("dom:loaded",A)},requestUri:function(A){var B=A.indexOf("jamendo.com/");if(B>=0){A=A.substr(B+11)}return A},insertScript:function(B,E){var C=document.createElement("script");C.type="text/javascript";C.charset="utf-8";C.defer=true;var D=function(){if(C.readyState&&C.readyState!="loaded"&&C.readyState!="complete"){return }C.onreadystatechange=C.onload=null;if(E){E()}$(C).remove()};C.onload=C.onreadystatechange=D;C.src=B;document.getElementsByTagName("head").item(0).appendChild(C);if(Prototype.Browser.WebKit&&E&&navigator.userAgent.match(/AppleWebKit\/([0-9]+)/)[1]<522){var A=document.createElement("iframe");A.style.width="0px";A.style.height="0px";A.setAttribute("src",B);document.getElementsByTagName("body").item(0).appendChild(A);A.onload=function(){D();try{$(A).remove()}catch(F){}}}},insertGoogleJsApi:function(A){Jamendo._googlejsapicalback=A;setTimeout(function(){Jamendo.insertScript("http://www.google.com/jsapi?key="+Jamendo.getEnv("GMAPS_KEY")+"&callback=Jamendo._googlejsapicalback")},250)},getTemplate:function(A){return new Template($(A).innerHTML,/(^|.|\r|\n)(\$([a-z0-9]+)\$)/)},isUrl:function(B){var A=/^(http\:\/\/|ftp\:\/\/|)\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#]\w+)*\/?$/i;return A.test(B)},get_url_param:function(A){A=A.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var C="[\\?&]"+A+"=([^&#]*)";var D=new RegExp(C);var B=D.exec(window.location.href);if(B==null){return""}else{return B[1]}},errorUnimplemented:function(){Jamendo.log("Error : unimplemented")},sleep:function(B){var A=new Date().getTime();while(new Date().getTime()<A+B){}},stacktrace:function(){var I=[];var C=false;try{B.dont.exist+=0}catch(F){if(F.stack){var J=F.stack.split("\n");for(var B=0,E=J.length;B<E;B++){if(J[B].match(/^\s*[A-Za-z0-9\-_\$]+\(/)){I.push(J[B])}}I.shift();C=true}else{if(window.opera&&F.message){var J=F.message.split("\n");for(var B=0,E=J.length;B<E;B++){if(J[B].match(/^\s*[A-Za-z0-9\-_\$]+\(/)){var H=J[B];if(J[B+1]){H+=" at "+J[B+1];B++}I.push(H)}}I.shift();C=true}}}if(!C){var D=arguments.callee.caller;while(D){var G=D.toString();var A=G.substring(G.indexOf("function")+8,G.indexOf(""))||"anonymous";I.push(A);D=D.caller}}return(I)}};Hash.prototype.diff=function(B){var A=[[],[]];for(key in this){if(this[key]!=B[key]){A[0].push(key)}}for(key in B){if(!(key in this)){A[1].push(key)}}return A};if(!Jamendo_ENV){var Jamendo_ENV={}}var Jamendo=new Jamendo();Jamendo.onReady(function(){Jamendo.domReady=true});Element.addMethods({"jamPosition":function(A,B){A=$(A);A.style.left=parseInt(B[0])+"px";A.style.top=parseInt(B[1])+"px";return A},"jamSize":function(A,B){A=$(A);A.style.width=parseInt(B[0])+"px";A.style.height=parseInt(B[1])+"px";return A}});Jamendo.DelayedSwitch=Class.create();Jamendo.DelayedSwitch.prototype={initialize:function(C,B,A){this._on=C;this._off=B;this.delayON=A;this.timer=false},on:function(){if(!this.delayON){if(this._on){this._on()}}else{if(!this.timer){this.timer=setTimeout(function(){this.timer=false;if(this._on){this._on()}}.bind(this),this.delayON)}}},off:function(){if(this.timer){clearTimeout(this.timer);this.timer=false}if(this._off){this._off()}},reset:function(){this.off();this.on()}};String.prototype.pad=function(A,C,B){return C||(C=" "),(A-=this.length)>0?(C=new Array(Math.ceil(A/C.length)+1).join(C)).substr(0,B=!B?A:B==1?0:Math.ceil(A/2))+this+C.substr(0,A-B):this};Jamendo.Queue=Class.create();Object.extend(Jamendo.Queue.prototype,Enumerable);Object.extend(Jamendo.Queue.prototype,{initialize:function(){this.queue=[];this.queueSpace=0;this.length=0},push:function(B,A){this.queue.push(B);return(++this.length)},shift:function(){if(this.queue.length){var A=this.queue[this.queueSpace];if(++this.queueSpace*2>=this.queue.length){for(var B=this.queueSpace;B<this.queue.length;B++){this.queue[B-this.queueSpace]=this.queue[B]}this.queue.length-=this.queueSpace;this.queueSpace=0}this.length--;return A}else{return undefined}},concat:function(A){return this.toArray().concat(A)},unshift:function(A){if(this.queueSpace>0){this.queue[--this.queueSpace]=A}else{this.queue.unshift(A)}return(++this.length)},pop:function(){this.length--;return this.queue.pop()},_each:function(C){for(var B=this.queueSpace,A=this.queue.length;B<A;B++){C(this.queue[B])}},pick:function(B){var A=this.queue[this.queueSpace+B];for(var C=(this.queueSpace+B);C>(this.queueSpace);C--){this.queue[C]=this.queue[C-1]}this.queue[this.queueSpace]=A;return this.shift()},pushArray:function(A){this.queue=this.queue.concat(A);this.length+=A.length;return this.toArray()},get:function(A){return this.queue[this.queueSpace+A]},set:function(B,A){this.queue[this.queueSpace+B]=A},toArray:function(){return this.queue.slice(this.queueSpace)},extendItem:function(A,B){Object.extend(this.queue[this.queueSpace+A],B)}});String.prototype.size=function(){return this.length};var Cookie={set:function(B,E,D){var C="";if(D!=undefined){var F=new Date();F.setTime(F.getTime()+(86400000*parseFloat(D)));C=";expires="+F.toGMTString()}var A=escape(B)+"="+escape(E||"")+C+";path=/;domain=.jamendo.com";return(document.cookie=A)},get:function(B){var A=document.cookie.match(new RegExp("(^|;)\\s*"+escape(B)+"=([^;\\s]*)"));return(A?unescape(A[2]):null)},erase:function(B){var A=Cookie.get(B)||true;Cookie.set(B,"",-1);return A},accept:function(){if(typeof (navigator.cookieEnabled)=="boolean"){return navigator.cookieEnabled}Cookie.set("_test","1");return(Cookie.erase("_test")=="1")},log:function(){document.cookie.split("; ").each(function(A,B){Jamendo.log("Cookie:"+A)})}};Jamendo.page={hasPlayedOnce:false,_fbPublish:null,players:$H({}),lastInstalledPlayer:null,defaultPlayer:false,updateFeedbacks:function(C,B){var A=$H({"ok":"ok","nok":"error","wait":"wait","warning":"warning","info":"info"});var E=$("page_content_inner");var D=".page_content_leftc";if($("splash_main")){E=$("page_content_outer");var D="#splash_columns"}if(!E){E=$("main-content");var B="#main-content";var D="div"}if(!E){E=$("page_content_outer");var D="#page_content_fit"}if(!E){E=$("main");var D=".contentsection"}var F=(!E);if(!F){if(B){B=$(B)}else{var B=E.down(".pageFeedbacks")}if(!B){B=new Element("div",{className:"pageFeedbacks"});B.addClassName("pageFeedbacks");if(!E.down(D)){E.insert({top:B})}else{E.down(D).insert({top:B})}}B.getElementsBySelector(".boxok, .boxerror, .boxwait, .boxinfo, .boxwarning").invoke("remove")}C.each(function(I){if(F){return alert(I.text)}var G="jamfeedback-"+(Math.random()*1000000);var H=new Element("div",{"class":"box"+A.get(I.type),"id":G}).update(I.text).insert({"top":new Element("a",{"href":"#","onclick":"$('"+G+"').remove(); return false;","style":"float:right;display:block;"}).update(Jamendo.getStr("SUPERBOX_CLOSE"))});H.addClassName("box"+A.get(I.type));if(I.help){var J=new Element("div",{"class":"feedback_help"});if(I.help.text){J.update(I.help.text)}else{if(I.help.link){J.update(new Element("a",I.help.link).update(I.help.link.text))}}H.insert(J)}B.insert({"top":H})})},clientSideInfos:function(){return{"TZOFFSET":(new Date()).getTimezoneOffset()}},fixClientSideInfos:function(){var A=Jamendo.page.clientSideInfos();if(Jamendo.getEnv("TZOFFSET")!==""&&Jamendo.getEnv("TZOFFSET")!=A.TZOFFSET){Jamendo.onReady(function(){Jamendo.writeApi("user_clientsideinfos",[A])})}},preloadImages:function(A){Event.observe(window,"load",function(){var C=new Image();for(var B=0;B<A.length;B++){C.src=A[B]}})},getPageSize:function(){var B=document.documentElement;var A=self.innerHeight||(B&&B.clientHeight)||document.body.clientHeight;if(document.body.offsetHeight>A){A=document.body.offsetHeight}return A},showLogin:function(C){if(C){var B=$("login_box").previous(".boxerror");if(B){B.hide()}}$("page_login").show();$("box_overlay").show();$("page_login").setStyle({opacity:1,zIndex:20005});var A=this.getPageSize();$("box_overlay").setStyle({opacity:0.5,backgroundColor:"#000",width:"100%",height:A+"px",position:"absolute",top:0,left:0,zIndex:10005});$("page_loginform_pseudo").focus();return false},logintabs:["page_loginform_pseudo","page_loginform_pass","loginbutton","resendpass","signuplink"],spLoginOnKeypress:function(B){var C=Event.element(B);if(B.keyCode==Event.KEY_RETURN){if($("page_loginform_pseudo").value!=""&&$("page_loginform_pass").value!=""){$("login_form").submit()}else{if(C.id=="page_loginform_pass"){$("loginerror").show()}}}else{if(B.keyCode==Event.KEY_ESC){$("loginerror").hide()}else{if(B.keyCode==Event.KEY_TAB){var A=Jamendo.page.logintabs.indexOf(C.id);if(Jamendo.page.logintabs[A+1]){$(Jamendo.page.logintabs[A+1]).focus()}else{$(Jamendo.page.logintabs.first()).focus()}}else{if(B.type=="click"&&C.up(".jambutton_bigaction_button")&&C.up(".jambutton_bigaction_button").id=="loginbutton"||B.type=="click"&&C.up(".jamactionbutton")){if($("page_loginform_pseudo").value!=""&&$("page_loginform_pass").value!=""){$("login_form").submit()}else{$("loginerror").show()}}else{return B}}}}return false},refresh:function(){if(typeof (window.location.reload)=="function"){window.location.reload(false)}else{window.location.href=unescape(window.location.pathname+window.location.search)}},refreshWithParams:function(D,A){if(A==null){A=false}else{if(A){A=true}else{A=false}}var B=window.location.toString().indexOf("?");if(A){var C="".toQueryParams()}else{var C=(B>0?window.location.toString().substring(B):"").toQueryParams()}C=Object.extend(C,D);window.location=(B>0?window.location.toString().substring(0,B):window.location)+"?"+$H(C).toQueryString()},popup:function(A){return window.open(A,"jamendopopup_"+Math.round(Math.random()*1000000),"menubar=yes,location=yes,toolbar=yes,directories=yes,personalbar=yes,status=yes,resizable=yes,scrollbars=yes")},download:function(C,E){if(!C||!E){Jamendo.writeApi("quicklog",["emptydownloadunitid",window.location.toString()]);return false}if(!Jamendo.getEnv("PREFS")["download"]||C!="album"){var B=Jamendo.getEnv("HTTPHOSTI18N").replace("torrents","www")+"download/"+C+"/"+E+"/";var D="width=920,height=400";if(C=="playlist"){D="width=750,height=400"}var A=function(){window.open(B+"?output=contentonly","jamdownload_"+Math.round(Math.random()*1000000),D+",menubar=no,location=no,toolbar=no,directories=no,personalbar=no,status=no,resizable=yes")};if(Jamendo.getEnv("INTERRUPTS")["download"]){Jamendo.getEnv("INTERRUPTS")["download"]=0;SuperBox.cb_remove.push(function(){SuperBox.cb_remove=[];A()});SuperBox.call("remote",Jamendo.getEnv("HTTPHOSTI18N")+"whysignup/download/?sbw=680&sbh=400&whysignup_redirect="+encodeURIComponent(B))}else{A()}}else{window.location=Jamendo.getEnv("HTTPHOSTI18N")+"get2/bittorrent/file/redirect/?type=archive&album_id="+E+"&class="+(Jamendo.getEnv("PREFS")["download"].split(/_/)[1])}return false},usePlayer:function(){return !Jamendo.getEnv("PREFS")["stream"]},parsePlayML2s:function(E,B){var A=Jamendo.getEnv("PREFS")["stream"].split(/_/);var D=Jamendo.parseStrId((B||E).replace(/^.*\|/,""));if(D["unit"]!="track"){if(D["unit"]=="album"){D["params"].set("order","numalbum_asc")}if(D["unit"]=="playlist"){D["params"].set("order","numplaylist_asc")}D["relations"].push("track9_"+D["unit"]);D["unit"]="track9"}var C=Jamendo.unparseStrId(D,{"format":A[0],"targets":["stream"],"params_merge":{"streamencoding":A[1]}});return C},play_old:function(E,A,D,C){Jamendo.page.hasPlayedOnce=true;if(C){var B=Jamendo.getEnv("HTTPHOSTI18N")+"widgets/create?url="+encodeURIComponent(E);if(C=="newwindow"){Jamendo.page.popup(B);return false}if(Prototype.Browser.Gecko&&Jamendo.getEnv("USER_AGENT").match(new RegExp(" Mac","g"))){document.location=B;return false}return SuperBox.call("remote",Jamendo.getEnv("HTTPHOSTI18N")+"get2/"+E,"",function(){SuperBox.setDim("200","300")})}else{if(!Jamendo.page.usePlayer()){if(E.substr(0,4)=="misc"){E="track"+E.substr(4)}var B=this.parsePlayML2s(Jamendo.id2ml2(E),A);window.location=Jamendo.getEnv("HTTPHOSTI18N")+"get2/"+B;return false}else{if(D){Jamendo.sendEvent(["jamplayer2","remote","control","play"],Jamendo.id2ml2(E));return false}else{return Jamendo.page.remoteplayer.command("play",E)}}}},play_retry:function(){},play:function(A,D,C){if(!C){C={}}Jamendo.page.play_retry=function(){C["wasQueued"]=true;return Jamendo.page.play(A,D,C)};if(Jamendo.page.players.size()==0){return true}var B=Jamendo.page.players.get(C.usePlayer||Jamendo.page.defaultPlayer);if(!B){B=Jamendo.page.players.get(Jamendo.page.lastInstalledPlayer)}if(B){if(!C["onlyFetch"]){B.guiWait()}return B.onReady(function(){B.stop();return B.play(A,D,C)})}else{setTimeout(Jamendo.page.play_retry,1000)}},installPlayer:function(A,B){Jamendo.page.players.set(A,B);B.playerName=A;Jamendo.page.lastInstalledPlayer=A},star:function(B,F,C,A,E){if(!B||!F){Jamendo.writeApi("quicklog",["emptystarunitid",window.location.toString()]);return false}var D=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},500,200);D.on();return Jamendo.writeApiWithFeedback("user_log",[B,"star",F,C],function(H,I,G,J){D.off();if(typeof (G.result)!="undefined"&&(G.result=="true"||G.result==true)){A.up(".jambutton").switchButton();if(H){Jamendo.writeApi("social_networks_action_enabled_networks",["star"],function(L,K,O,M,N){$A(N).each(function(R,Q,T,S,P){R.shareOnSocialNetworks(P,Q,T,"star",S,true)}.curry(L,K,O,M))}.curry(this,B,F,I),function(){D.off()})}}}.bind(this,C,E),function(){D.off()})},concertToggleUser:function(C,A,B){SuperBox.call("wait");return Jamendo.writeApiWithFeedback("concert_user",["toggle",C],function(D,E){if(typeof (D.result)!="undefined"){if(B){Jamendo.page.refresh()}else{if(parseInt(D.result)>0){$$("."+A).each(function(F){F.select("span").invoke("update",Jamendo.getStr("CONCERT_USER_dont_go"))})}else{$$("."+A).each(function(F){F.select("span").invoke("update",Jamendo.getStr("CONCERT_USER_go"))})}SuperBox.remove()}}else{SuperBox.remove()}},function(){feedbackSwitch.off()})},seenlive:function(E,B,A,D){if(!E){Jamendo.writeApi("quicklog",["emptyseenliveid",window.location.toString()]);return false}var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();return Jamendo.writeApiWithFeedback("user_log",["artist","seenlive",E,(B?1:0)],function(G,H,F,I){C.off();if(typeof (F.result)!="undefined"&&(F.result=="true"||F.result==true)){A.up(".jambutton").switchButton();if(G){Jamendo.writeApi("social_networks_action_enabled_networks",["seenlive"],function(J,M,K,L){$A(L).each(function(O,Q,P,N){O.shareOnSocialNetworks(N,"artist",Q,"seenlive",P,true)}.curry(J,M,K))}.curry(this,E,H),function(){C.off()})}}}.bind(this,B,D),function(){C.off()})},shareOnSocialNetworks:function(C,B,F,A,D,E){switch(C){case"facebook":return this.shareOnFacebook(B,F,A,D,E);case"twitter":return this.shareOnTwitter(B,F,A,D)}},shareOnFacebook:function(C,F,A,D,E){if(!this._fbPublish){this._fbPublish=new Jamendo.classes.FacebookPublishStory()}var B=function(G){G.auto=E;G.callback=this.shareCallback.bind(this,"facebook",C,F,A);this._fbPublish.publishOnMyWall(G)}.bind(this);Jamendo.writeApi("social_networks_facebook_story_formatter",[C,F,A,D],B,null,{"asynchronous":Jamendo.getEnv("FACEBOOK_CONNECTED")})},shareCallback:function(C,B,D,A){Jamendo.writeApi("social_networks_story_published",[C,B,D,A],function(){})},shareOnTwitter:function(B,D,A,C){Jamendo.writeApi("social_networks_share_on_twitter",[B,D,A,C],function(E){window.location.replace("http://twitter.com/share?text="+encodeURIComponent(E)+"&url="+(window.location))}.bind(this))},friendship:function(B,D,C,F){if(B&&D&&C>0){var A=({"asked":"user_addfriend","accepted":"user_addfriend","deleted":"user_deletefriend","refused":"user_deletefriend"})[B];var E=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);return Jamendo.writeApiWithFeedback(A,[D,C,true],function(G,H){E.off();if(typeof (F=="function")){F(G,H)}},function(){E.off()})}},usergroup:function(A,B){var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();Jamendo.writeApi("user_log",["usergroup","joined",A,B],function(D){var E=(D=="ok");C.off();alert(Jamendo.getStr((B?"FEEDBACK_usergroupjoin_ok":"FEEDBACK_usergroupleave_ok")));Jamendo.page.refresh()},function(){C.off()})},usergroupWithFeedback:function(A,B){var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();return Jamendo.writeApiWithFeedback("user_log",["usergroup","joined",A,B],function(D,E){C.off()},function(){C.off()})},deleteplaylist:function(A){if(confirm(Jamendo.getStr("PLAYLIST_DELETE_QUESTION"))){Jamendo.writeApi("playlist_set",[[["deleteplaylist",A]],true],function(B){Jamendo.page.refresh()},function(){feedbackSwitch.off()})}},agreeToReview:function(B,A,D){if(B>0){var C=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);C.on();Jamendo.writeApiWithFeedback("review_agree",[B,A],function(E,F){C.off();if(typeof (D)=="function"){D(E,F)}},function(){C.off()})}},newsAction:function(C,D,E,F,G){var B=({"hide":["viewed",1,{"ids":D}]})[C];var A=function(H,I){Jamendo.page.shiftNewsfeed(1,E);if(typeof (F=="function")){F(H,I)}};if(G){Jamendo.writeApi("news_setflag",B,F,function(){feedbackSwitch.off()})}else{Jamendo.writeApiWithFeedback("news_setflag",B,A,function(){feedbackSwitch.off()})}},newsActionWithoutFeedback:function(A,D,B,C){Jamendo.page.newsAction(A,[D],B,C,true)},shiftNewsfeed:function(B,A,C){var D=Jamendo.Newsfeed.displayedItems.sortBy(function(E){return E}).first();if(!D){return }Jamendo.writeApi("news_get",[D,B,A],function(E,F){$("newsfeed").insert(E);Jamendo.page.hideNewsFeedIfNeeded();if(typeof (C)=="function"){C(E,F)}},function(){feedbackSwitch.off()})},hideNewsFeedIfNeeded:function(){var B=$("newsfeed");var A=B.select(".itemnewsfeed").find(function(C){return C.visible()});if(typeof (A)=="undefined"){Jamendo.page.updateFeedbacks([]);B.update('<div class="noitems_message">'+Jamendo.getStr("NEWSFEEDVIEWER_NOITEMS")+"</div>")}},reviewReport:function(A){var B=prompt(Jamendo.getStr("REPORT_BAD_REVIEW_REASON")+" ?",Jamendo.getStr("REPORT_BAD_REVIEW_YOUR_REASON"));if(B){Jamendo.writeApiWithFeedback("review_report",[A,"alert",{"type":B}])}},initRemoteplayer:function(B){if(!swfobject.hasFlashPlayerVersion("8.0.0")){var A=$("player_no_flash");if(A){A.setStyle({"display":"block"})}Jamendo.page.remoteplayer=null}else{Jamendo.page.remoteplayer=new Jamendo.classes.remotePlayer(B)}},searchRedirect:function(B,C){if(typeof (C)=="undefined"){C=true}if(["!","~","*","'","(",")","/"].all(function(D){return !B.include(D)})){var A="search/all/"+encodeURIComponent(B);if(C){window.location=Jamendo.getEnv("HTTPHOSTI18N")+A;return false}else{return"/"+A}}return true},joinGroupFromNewsfeed:function(A,C,B){this.usergroupWithFeedback(C,1);if($("item_details"+A).down("ul").getElementsByTagName("li").length==1){this.newsAction("hide",[A],function(D){this.hide();Jamendo.Newsfeed.displayedItems=Jamendo.Newsfeed.displayedItems.without(A)}.bind($("itemnewsfeed"+A)),1)}else{$(B).up("li").remove()}},remoteplayer:null,flashCallback:function(B,A){Jamendo.sendEvent(["flashcallback",B],A)},showPopupInfo:function(){var B=$("popupblocker_info");if(B){B.scrollTo();return }if(Prototype.Browser.WebKit||Prototype.Browser.MobileSafari){var A=document.getElementsByTagName("body")[0];A.insert({before:'<div id="popupblocker_info">'+Jamendo.getStr("POPUPBLOCKER_INFO")+"</div>"});$("popupblocker_info").scrollTo()}},graph2:function(A,F,E,C,B){if(typeof (Jamendo.classes.Graph2)=="undefined"){Jamendo.log('It seems you hav not loaded the "Graph2" chart engine');return }if(typeof (Jamendo.page.graphobject)=="undefined"){var D=new Jamendo.classes.Graph2();Jamendo.page.graphobject=D}Jamendo.page.graphobject.insertGraph(A,F,E,C,B)},isMacOS:function(){return(Jamendo.getEnv("USER_AGENT").match(new RegExp(" Mac","g")))},toggleExpander:function(B,C,A){B.toggleClassName("expander_closed");B.toggleClassName("expander_opened");if(B.hasClassName("expander_opened")&&typeof (C)=="function"){C()}else{if(B.hasClassName("expander_closed")&&typeof (A)=="function"){A()}}},reportContent:function(C,B,A){var D=prompt(Jamendo.getStr("ALBUM_REPORT"));if(D===null||D===false){return }Jamendo.writeApiWithFeedback("album_moderation",[B,"report",D])},changeDeviceInstores:function(A){$("select_a_format").select("li a.active").invoke("removeClassName","active");$("select_a_format").select("div.display_product_zone").invoke("hide");$("li_"+A).addClassName("active");$("details_"+A).show();return true},load_artist_admin:function(B,F,D,C,A){var E=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},200);E.on();Jamendo.writeApi("artist_admin",[B,F,D,C],function(G){E.off();A(G)},function(){E.off()})},insertFacebookSdk:function(B,C,A){window.fbAsyncInit=function(){FB.init({appId:B,status:false,cookie:true,xfbml:true,oauth:true});FB.Event.subscribe("auth.sessionChange",function(D){if(!!D.session!=!!Jamendo.getEnv("FACEBOOK_CONNECTED")){Jamendo.page.updateFeedbacks([{"type":"ok","text":Jamendo.getStr("FACEBOOK_CONNECTED_RELOAD")}],"page_content_outer_withcolumn")}})};Jamendo.onReady(function(){var D=document.createElement("script");D.async=true;D.src=document.location.protocol+"//connect.facebook.net/"+C+"/all.js";$("fb-root").appendChild(D)})}};Object.extend(Jamendo.page,{pro_popup_player:null,pro_bottom_player:false,_clicktaletags:{},lastPlayOptions:{},showBottomPlayer:function(A){showPlayer()},hide_pro_bottom_player:function(){hidePlayer()},proPlay:function(D,A,C){var B=Jamendo.page.players.get("jamplayer3");if(!B){return }if(B.trackData&&B.trackData.id==D){if(B.isPlaying){hidePlayer()}B.playpause();return }D=""+D;var E=[D];if(A=="search"){A="#dynamicdata td.control"}if(A){E=jQuery(A);E=jQuery.map(E,function(F){return F.id.split("_")[1]});if(E.indexOf(D)>0){E=E.slice(E.indexOf(D))}else{E.unshift(D)}}B.play("track//?order=fromparams&id="+E.join("+"))},proRadioPlay:function(B){var A=Jamendo.page.players.get("jamplayer3");if(!A){return }if(A.trackData&&A.trackData.radioid==B){if(A.isPlaying){hidePlayer()}A.playpause();return }A.play("radio_id/track//?n=3","/radio//?id="+B)},nowPlaying:function(D){return ;var C=$("results_zone_content");if(C&&D>0){C.getElementsBySelector(".item_track").each(function(E){E.removeClassName("played");if(E.id.indexOf("_"+D)>-1){E.addClassName("played")}})}var A=$("pro_page_bottomplayer_buy_zone_a");if(this.lastPlayOptions&&this.lastPlayOptions.nobuy){A.up().hide()}else{A.up().show();A.unit_id=D;A.href=Jamendo.getEnv("HTTPHOSTI18N")+"addtocart/licensing?add="+D}var B=$("pro_page_bottomplayer_download_zone_lowfi_a");if(B){B.unit_id=D;if(Jamendo.getEnv("USERID")){B.href=Jamendo.getEnv("HTTPHOSTI18N")+"download/track/"+D+"/lowfi"}else{B.href=Jamendo.getEnv("HTTPHOSTI18N")+"loginsignup?action=download_lowfi&action_unit=track&action_id="+D}}},proTracking:function(C,D){if(C!="referer"){var E=C;if(C=="user_id"||C=="sale_id"||C=="minisite_id"||C=="trackingcode_id"||C=="promocode_id"){E=C.replace("id",D)}if(E){this.smartClickTaleTag(E)}var F={"sale_paid":{"label":"aqobCKDk7QEQ4LuF9QM ","getValue":function(G){return G["price"]}},"contactform_saved":{"label":"v1NLCIjn7QEQ4LuF9QM","getValue":function(G){return 5}},"cut_cart_add":{"label":"HkXgCIDo7QEQ4LuF9QM","getValue":function(G){return 1}},"cut_play":{"label":"6f43CPjo7QEQ4LuF9QM","getValue":function(G){return 0.1}},"clientform_saved":{"label":"U--OCPDp7QEQ4LuF9QM","getValue":function(G){return 10}},"projectform_saved":{"label":"HCI-COjq7QEQ4LuF9QM","getValue":function(G){return 2}},"sale_confirmed":{"label":"1XdDCJjl7QEQ4LuF9QM","getValue":function(G){return 0.2*G["price"]}}};if(F[C]){var A=new Image();A.height="1";A.width="1";A.style.borderStyle="none";A.src="http://www.googleadservices.com/pagead/conversion/1050762720/?value="+F[C]["getValue"](D)+"&label="+F[C]["label"]+"&guid=ON&script=0";document.getElementsByTagName("body")[0].appendChild(A)}var B={"cut_cart_add":{"category":"prosearch","action":"cart_add"},"cut_cart_remove":{"category":"prosearch","action":"cart_remove"},"cut_cart_empty":{"category":"prosearch","action":"cart_empty"},"cut_play":{"category":"prosearch","action":"play"},"cut_star":{"category":"prosearch","action":"star"}};if(B[C]){_gaq.push(["_trackEvent",B[C]["category"],B[C]["action"]])}if(/^cut_searchfielduse_/.test(C)){_gaq.push(["_trackEvent","prosearchfilter",C.substring(19),D])}}if(/^cut_searchfield/.test(C)){Jamendo.writeApi("pro_tracking",[C,D])}},smartClickTaleTag:function(A){if(this._clicktaletags[A]){return }this._clicktaletags[A]=true;Jamendo.onReady(function(){Jamendo.log("CT tag "+A);if(typeof ClickTaleTag=="function"){ClickTaleTag(A)}})},play:function(E,A,C){this.lastPlayOptions=C;if(!Jamendo.page.usePlayer()){var B=this.parsePlayML2s(Jamendo.id2ml2(E),A);window.location=Jamendo.getEnv("HTTPHOSTI18N")+"get2/"+B;return false}else{var D=E.substring(E.lastIndexOf("/")+1);this.showBottomPlayer("play");this.nowPlaying(D);Jamendo.page.proTracking("cut_play");return false}},playAfterInsert:function(A,B){if(B==null){var B=1}if(B>100){return null}if(typeof this.pro_bottom_player.isReady=="function"){if(this.pro_bottom_player.isReady()){this.pro_bottom_player.jsFlashAction("play",A)}else{setTimeout(function(){Jamendo.page.playAfterInsert(A,++B)},100)}}else{setTimeout(function(){Jamendo.page.playAfterInsert(A,++B)},100)}},setupLicensingAutocomplete:function(A,B){if(!B){B={}}return new Jamendo.classes.Autocompleter(Object.extend({"delay":150,"minChars":2,"dataSource":"remote","cacheGroup":"pro_search","selectCallback":Prototype.K,"fixMenu":Prototype.K,"formatItem":function(C){return"<div class='r'>"+C[0]+"</div>"},"autoSelect":true,"cached":false,"categs":[],"disableReturnSubmit":true,"autoSubmitOnBlur":true,"n":10,"input":A,"postFillMenu":function(D){var C="";D.choices.each(function(E,F){if(E[2]!=C){C=E[2];Insertion.Before(D.choices[F]._e,"<div align='left'><i>"+Jamendo.getStr("PRO_AUTOCOMPLETE_BYUNIT_"+C)+"</i></div>")}})}},B))},initProPopupPlayer:function(A){if((this.pro_popup_player==null)||(this.pro_popup_player&&this.pro_popup_player.closed)){this.pro_popup_player=window.open(A,"jamendo_pro_popup_player","width=770,height=850,menubar=no,location=no,toolbar=no,directories=no,personalbar=no,status=no,resizable=yes");if(!this.pro_popup_player){Jamendo.page.showPopupInfo();return false}}return false},showCallbackLogin:function(A,C){Jamendo.page.showLogin(A);var B=$("login_form");if(!B._submit){B._submit=B.submit}B.submit=function(){if(typeof (C)=="function"){C($("page_loginform_pseudo").getValue(),$("page_loginform_pass").getValue());return false}};return false},star:function(B,E,C,A){if(!B||!E){Jamendo.writeApi("quicklog",["emptystarunitid",window.location.toString()]);return false}var D=new Jamendo.DelayedSwitch(function(){SuperBox.call("wait")},function(){SuperBox.remove()},500,200);D.on();Jamendo.page.proTracking("cut_star");Jamendo.writeApiWithFeedback("pro_client_log",[B,"star",E,null,null,C],function(F,I){D.off();if(typeof (F.result)!="undefined"&&F.result!="false"&&F.result!=false){if($("search-starred")){var H=$("search-starred");var G=parseInt(F.result.gsub('"',""));Jamendo.classes.trackSearch.starredCollectionId=G;H.setAttribute("onclick","return Jamendo.classes.trackSearch.profavorites_click(1);")}}});return false},initQuickQA:function(B){$("floating_q").show();Jamendo.page.__qa_toggle=false;var A=function(){var D=new Fx.Style("floating_q","bottom",{"unit":"px","duration":100});if(Jamendo.page.__qa_toggle){D.custom(0,-250)}else{D.custom(-250,0)}Jamendo.page.__qa_toggle=!Jamendo.page.__qa_toggle};$("floating_q_top").observe("click",A);var C=function(){if($("answer-no").checked){$("answer-no-because").show();$("answernowhy").show()}else{$("answer-no-because").hide();$("answernowhy").hide()}};$("answer-yes").observe("click",C);$("answer-no").observe("click",C);if(B){A()}}});Jamendo.Pro={starred_tracks:[],loadChildSales:function(B,C,A){C=$(C);if(!C){return false}Jamendo.writeApi("pro_order",["get_children",{"parent_id":B}],function(D){ret=D.map(function(E){E["link_attrs"]=(E["paid"]==1)?" onclick=\" window.location = '/order/"+E["sale_id"]+"/certificate'; return false;\" ":' style="color:#555;" onclick="return false;" ';C.insert(A.interpolate(E))});if(TableKit){TableKit.Sortable.init(C.up("table"),{sortable:true,resizable:true,editable:false})}return ret})},_load_radios_superbox:function(A){SuperBox.call("localdiv","Jamform_"+A+"_radios_checkboxes_group-container","",function(){var B=Jamendo.forms[A].elements["Jamform_"+A+"_radios_ids"].value;if(B&&B.length>0){B.each(function(C){$("Jamform_pro_order_background_radios_checkboxes_"+C).checked="checked"})}},function(){chosen_radio=Jamendo.forms[A].elements["Jamform_"+A+"_radios_checkboxes"].getValue();if(chosen_radio.length>0){var B=$A();chosen_radio.each(function(C){B[C]=$$("#Jamform_"+A+"_radios_checkboxes_"+C+"-container label").first().innerHTML});B=B.compact();$("selected_radio_idstr").innerHTML=B;$("audiocds_details_container").style.visibility="visible";Jamendo.forms[A].elements["Jamform_"+A+"_radios_ids"].value=chosen_radio}});return false},_deviceClicked:function(C,B){var A=Jamendo.forms[C].elements["Jamform_"+C+"_devices_checkboxes"].getValue();if(B=="audiocds"&&A.indexOf("audiocds")>-1){Jamendo.Pro._load_radios_superbox(C)}else{if(B=="audiocds"){$("audiocds_details_container").style.visibility="hidden"}}},_radioClicked:function(A,B){var C=Jamendo.forms[B].elements["Jamform_"+B+"_radios_checkboxes"].getValue();if(C.length>3){$("Jamform_"+B+"_radios_checkboxes_"+A).checked=""}else{}return false},_backgroundTypeClicked:function(A,B){var C=$("Jamform_pro_order_surface_unit").getValue();if(A=="publicspace"){$("Jamform_pro_order_needs__publicspace-container").show();$("Jamform_pro_order_needs__event-container").hide();Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__publicspace",true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__publicspace_"+C,true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__event",false);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_datestart",false);Jamendo.Pro.surface_units.each(function(D){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__event_"+D,false);if(D!=C){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__publicspace_"+D,false)}});Jamendo.formElements.pro_totalbuilder_licensing.params["product_idstr"]="publicspace";Jamendo.formElements.pro_totalbuilder_licensing.params["nature_idstr"]="publicspace";Jamendo.formElements.pro_totalbuilder_licensing.params["unit"]="month";Jamendo.formElements.pro_totalbuilder_licensing.update()}else{if(A=="event"){$("Jamform_pro_order_needs__publicspace-container").hide();$("Jamform_pro_order_needs__event-container").show();Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__event",true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__event_"+C,true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_datestart",true);Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_duration__publicspace",false);Jamendo.Pro.surface_units.each(function(D){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__publicspace_"+D,false);if(D!=C){Jamendo.forms.pro_order.toggleRules("Jamform_pro_order_size__event_"+D,false)}});Jamendo.formElements.pro_totalbuilder_licensing.params["product_idstr"]="event";Jamendo.formElements.pro_totalbuilder_licensing.params["nature_idstr"]="event";Jamendo.formElements.pro_totalbuilder_licensing.params["unit"]="day";Jamendo.formElements.pro_totalbuilder_licensing.update()}else{$("Jamform_"+B+"_background_type_publicspace").checked=true;Jamendo.Pro._backgroundTypeClicked("publicspace",B)}}},_surfaceUnitChanged:function(D,C,B){var A=$("Jamform_"+C+"_size__publicspace_"+(D=="sqm"?"sqf":"sqm")).selectedIndex;Jamendo.Pro.surface_units.each(function(E){Jamendo.forms[C].toggleRules("Jamform_"+C+"_size__publicspace_"+E,false);$("Jamform_"+C+"_size__publicspace_"+E+"-container").hide();if(!B&&E==D){$("Jamform_"+C+"_size__publicspace_"+E).selectedIndex=A}});Jamendo.forms[C].toggleRules("Jamform_"+C+"_size__publicspace_"+D,true);$("Jamform_"+C+"_size__publicspace_"+D+"-container").show();$("Jamform_"+C+"_surface_unit").value=D},_countryChanged:function(F){var B=Jamendo.forms[F]._country;var G="Jamform_"+F+"_billing_location-country";var D=$("Jamform_"+F+"_toggle_billing_location");if(!$(G)||(D&&!D.checked)){G="Jamform_"+F+"_place_location-country"}var A=Jamendo.forms[F].elements[G].getValue();if(Jamendo.Pro.squared_feet_countries){var C=(Jamendo.Pro.squared_feet_countries.indexOf(B)>-1)?"sqf":"sqm";var E=(Jamendo.Pro.squared_feet_countries.indexOf(A)>-1)?"sqf":"sqm";if(C!=E){Jamendo.Pro._surfaceUnitChanged(E,F)}}Jamendo.forms[F]._country=A;Jamendo.formElements.pro_totalbuilder_licensing.update()},_showOrHideVATNumber:function(A,B){if($("Jamform_"+B+"_tva_line-container")){if(A){$("Jamform_"+B+"_tva_line-container").show()}else{$("Jamform_"+B+"_tva_line-container").hide()}}},refreshSearchStarredResults:function(){this.starred_tracks.each(function(A){var B=$("star_"+A+"_out");if(B){B.show()}var B=$("star_"+A+"_in");if(B){B.hide()}})},updateStarButton:function(){},isStarred:function(A){return this.starred_tracks.include(A)},addStarred:function(A){this.starred_tracks.push(A);if($("star_"+A+"_in")){$("star_"+A+"_in").hide()}if($("star_"+A+"_out")){$("star_"+A+"_out").show()}if($("player_star_"+A+"_in")){$("player_star_"+A+"_in").hide()}if($("player_star_"+A+"_out")){$("player_star_"+A+"_out").show()}jQuery("#search-starred").show();this.updateStarButton()},removeStarred:function(A){this.starred_tracks=this.starred_tracks.without(A);if($("star_"+A+"_in")){$("star_"+A+"_in").show()}if($("star_"+A+"_out")){$("star_"+A+"_out").hide()}if($("player_star_"+A+"_in")){$("player_star_"+A+"_in").show()}if($("player_star_"+A+"_out")){$("player_star_"+A+"_out").hide()}this.updateStarButton()}};Jamendo.classes.Cart=Class.create({itemsCount:0,tracks:[],pricePerTrack:null,currentData:{},initialize:function(){Jamendo.addObserver(["cart","add"],function(A,B){this.add(B["unit"],B["unit_id"]);window.location.search.scan(/for_replace=[\d]+/,function(C){if(this._has_replaced){return }var D=parseInt(C[0].gsub("for_replace=",""));if(D>0){this._has_replaced=true;Jamendo.ajaxRequest({"url":"/addtocart?remove="+D,"method":"post","callback":function(){Jamendo.sendEvent(["cart","remove"],{"unit":"track","unit_id":D})}})}},this)}.bind(this));Jamendo.addObserver(["cart","remove"],function(A,B){this.remove(B["unit"],B["unit_id"])}.bind(this))},add:function(B,A){Jamendo.ajaxRequest({"url":Jamendo.getEnv("HTTPHOSTI18N")+"addtocart?add="+A,"method":"post","callback":function(){Jamendo.Pro.Cart.tracks.push(A);Jamendo.Pro.Cart.reloadSidebarBlock();Jamendo.Pro.Cart.refreshSearchResults();Jamendo.Pro.Cart.reloadCartData()}})},remove:function(B,A){Jamendo.ajaxRequest({"url":Jamendo.getEnv("HTTPHOSTI18N")+"addtocart?remove="+A,"method":"post","callback":function(){Jamendo.Pro.Cart.tracks=Jamendo.Pro.Cart.tracks.without(A);Jamendo.Pro.Cart.reloadSidebarBlock();Jamendo.Pro.Cart.refreshSearchResults();Jamendo.Pro.Cart.reloadCartData()}})},reloadSidebarBlock:function(){var A=$("pro_cart");if(!A){return }Jamendo.writeApi("jamblock",["pro_cart",{}],function(B){$("pro_cart").remove();$("sidebar").insert({"top":B})})},reloadCartData:function(){Jamendo.writeApi("pro_pricing",["","current_sale_rebuild_and_get_pricing",{"currency":Jamendo.getEnv("CURRENCY")}],function(A){this.currentData=A;this.updateCartData()}.bind(this))},updateCartData:function(){if(!this.currentData.nb_tracks&&!this.currentData.nature_str){}if(this.currentData.nature){Jamendo.page.proTracking("cut_nature_"+this.currentData.nature)}if($("header_cart_price")!=null){$("header_cart_price").hide()}if($("header_cart_prices")!=null){$("header_cart_prices").hide()}if(this.currentData.nature_str){$("header_cart_nature_container").show()}else{$("header_cart_nature_container").hide()}if(this.currentData.nb_tracks){$("header_cart_tracks_count").update(this.currentData.nb_tracks);$("header_cart_tracks_counts").update(this.currentData.nb_tracks);if(this.currentData.nb_tracks>1){$("header_cart_tracks0").hide();$("header_cart_tracks1").hide();$("header_cart_tracks2").show()}else{$("header_cart_tracks0").hide();$("header_cart_tracks1").show();$("header_cart_tracks2").hide()}}else{if($("header_cart_tracks0")!=null){$("header_cart_tracks0").show()}if($("header_cart_tracks1")!=null){$("header_cart_tracks1").hide()}if($("header_cart_tracks2")!=null){$("header_cart_tracks2").hide()}}if(this.currentData.nb_tracks&&this.currentData.total_ht&&this.currentData.total_ht.raw>0){$("header_cart_nature_container").addClassName("with_price");$("header_cart_price").show().update(this.currentData.total_ht.sym.replace(".00",""));$("header_cart_prices").show().update(this.currentData.total_ht.sym.replace(".00",""))}else{$("header_cart_nature_container").removeClassName("with_price");if($("header_cart_price")!=null){$("header_cart_price").hide()}if($("header_cart_prices")!=null){$("header_cart_prices").hide()}}},reloadSidebarBlockWithParams:function(B){var A=$("pro_cart");if(!A){return }if(!B){B={}}Jamendo.writeApi("jamblock",["pro_cart",B],function(C){$("pro_cart").remove();$("sidebar").insert({"top":C})})},refreshSearchResults:function(){$("pro_page_bottomplayer_order_zone").hide();if($("results_zone")){this.tracks.each(function(A){if($("add2cart_"+A)){$("add2cart_"+A).hide();$("incart_"+A).show();$("listen_"+A).addClassName("incart")}if($("player_add2cart_"+A)){$("player_add2cart_"+A).hide();$("player_incart_"+A).show()}});if(this.pricePerTrack){Jamendo.page.proTracking("cut_haspricing");if(this.currentData.nb_tracks==0){Jamendo.page.proTracking("cut_haspricingbeforecart")}$$("#results_zone .getaprice").each(function(A){A.hide()});$$("#results_zone .hasaprice").each(function(A){if(A.down()){A.down().update(this.pricePerTrack.replace(".00",""))}A.show()}.bind(this))}}}});Jamendo.Pro.Cut={natures:{},updatePrice_nature:function(B,C,A){Jamendo.writeApi("pro_pricing",["licensing","get_minimum_pricing",{"nature":B,"currency":A}],function(D){if(D){$(C).update(D["total_ht"]["sym"])}})},_updateContactFieldsVisibility:function(A,B){if(!$("Jamform_"+A+"_client_location-container")){return }if(!$("Jamform_"+A+"__your_company-container")){return }if(B=="private"){$("Jamform_"+A+"__client_location-container").show();$A(["billing_name","legal_name","tva_number","billing_location","billing_location-address","billing_location-country","billing_location-zipcode","billing_location-city"]).each(function(C){Jamendo.forms[A].toggleRules("Jamform_"+A+"_"+C,false)});Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-address",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-country",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-zipcode",true);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-city",true);if(Jamendo.forms.pro_order_licensing){Jamendo.forms.pro_order_licensing._countryChanged($("Jamform_"+A+"_client_location-country").value)}}else{$("Jamform_"+A+"__client_location-container").hide();$("Jamform_"+A+"__your_company-container").show();$A(["billing_name","legal_name","tva_number","billing_location","billing_location-address","billing_location-country","billing_location-zipcode","billing_location-city"]).each(function(C){Jamendo.forms[A].toggleRules("Jamform_"+A+"_"+C,true)});Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-address",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-country",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-zipcode",false);Jamendo.forms[A].toggleRules("Jamform_"+A+"_client_location-city",false);if(Jamendo.forms.pro_order_licensing){Jamendo.forms.pro_order_licensing._countryChanged($("Jamform_"+A+"_billing_location-country").value)}}}};Jamendo.Pro_VIP={confirmProject:function(A){confirmProjectBox("/vip/confirm_project?id="+A)},associateTracks:function(){var B=$("warnselect");var A=[];$$("#pro_vip_tracks_table input.vip_use_cb").each(function(C){if(C.checked){A.push(parseInt(C.id.gsub("boxuse_","")))}});if(!A.length){if(B){B.show()}return }else{if(B){B.hide()}}associateTracksBox("/vip/associate?tracks="+A.join(" ").replace(/ /g,"%20"))},selectAll:function(){var A=true;$$("#pro_vip_tracks_table input.vip_use_cb").each(function(B){if(!B.checked){B.checked=true;A=false}});if(A){$$("#pro_vip_tracks_table input.vip_use_cb").each(function(B){B.checked=false})}}};var swfobject=function(){var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",FLASH_MIME_TYPE="application/x-shockwave-flash",EXPRESS_INSTALL_ID="SWFObjectExprInst",win=window,doc=document,nav=navigator,domLoadFnArr=[],regObjArr=[],timer=null,storedAltContent=null,storedAltContentId=null,isDomLoaded=false,isExpressInstallActive=false;var ua=function(){var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF&&typeof doc.appendChild!=UNDEF&&typeof doc.replaceChild!=UNDEF&&typeof doc.removeChild!=UNDEF&&typeof doc.cloneNode!=UNDEF,playerVersion=[0,0,0],d=null;if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){d=nav.plugins[SHOCKWAVE_FLASH].description;if(d){d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);playerVersion[2]=/r/.test(d)?parseInt(d.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof win.ActiveXObject!=UNDEF){var a=null,fp6Crash=false;try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".7")}catch(e){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX+".6");playerVersion=[6,0,21];a.AllowScriptAccess="always"}catch(e){if(playerVersion[0]==6){fp6Crash=true}}if(!fp6Crash){try{a=new ActiveXObject(SHOCKWAVE_FLASH_AX)}catch(e){}}}if(!fp6Crash&&a){try{d=a.GetVariable("$version");if(d){d=d.split(" ")[1].split(",");playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)]}}catch(e){}}}}var u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=false,windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u);/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/return{w3cdom:w3cdom,pv:playerVersion,webkit:webkit,ie:ie,win:windows,mac:mac}}();var onDomLoad=function(){if(!ua.w3cdom){return }addDomLoadEvent(main);if(ua.ie&&ua.win){try{doc.write("<scr"+"ipt id=__ie_ondomload defer=true src=//:></scr"+"ipt>");var s=getElementById("__ie_ondomload");if(s){s.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);callDomLoadFunctions()}}}}catch(e){}}if(ua.webkit&&typeof doc.readyState!=UNDEF){timer=setInterval(function(){if(/loaded|complete/.test(doc.readyState)){callDomLoadFunctions()}},10)}if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,null)}addLoadEvent(callDomLoadFunctions)}();function callDomLoadFunctions(){if(isDomLoaded){return }if(ua.ie&&ua.win){var s=createElement("span");try{var t=doc.getElementsByTagName("body")[0].appendChild(s);t.parentNode.removeChild(t)}catch(e){return }}isDomLoaded=true;if(timer){clearInterval(timer);timer=null}var dl=domLoadFnArr.length;for(var i=0;i<dl;i++){domLoadFnArr[i]()}}function addDomLoadEvent(fn){if(isDomLoaded){fn()}else{domLoadFnArr[domLoadFnArr.length]=fn}}function addLoadEvent(fn){if(typeof win.addEventListener!=UNDEF){win.addEventListener("load",fn,false)}else{if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("load",fn,false)}else{if(typeof win.attachEvent!=UNDEF){win.attachEvent("onload",fn)}else{if(typeof win.onload=="function"){var fnOld=win.onload;win.onload=function(){fnOld();fn()}}else{win.onload=fn}}}}}function main(){var rl=regObjArr.length;for(var i=0;i<rl;i++){var id=regObjArr[i].id;if(ua.pv[0]>0){var obj=getElementById(id);if(obj){regObjArr[i].width=obj.getAttribute("width")?obj.getAttribute("width"):"0";regObjArr[i].height=obj.getAttribute("height")?obj.getAttribute("height"):"0";if(hasPlayerVersion(regObjArr[i].swfVersion)){if(ua.webkit&&ua.webkit<312){fixParams(obj)}setVisibility(id,true)}else{if(regObjArr[i].expressInstall&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)){showExpressInstall(regObjArr[i])}else{displayAltContent(obj)}}}}else{setVisibility(id,true)}}}function fixParams(obj){var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var e=createElement("embed"),a=nestedObj.attributes;if(a){var al=a.length;for(var i=0;i<al;i++){if(a[i].nodeName.toLowerCase()=="data"){e.setAttribute("src",a[i].nodeValue)}else{e.setAttribute(a[i].nodeName,a[i].nodeValue)}}}var c=nestedObj.childNodes;if(c){var cl=c.length;for(var j=0;j<cl;j++){if(c[j].nodeType==1&&c[j].nodeName.toLowerCase()=="param"){e.setAttribute(c[j].getAttribute("name"),c[j].getAttribute("value"))}}}obj.parentNode.replaceChild(e,obj)}}function fixObjectLeaks(id){if(ua.ie&&ua.win&&hasPlayerVersion("8.0.0")){win.attachEvent("onunload",function(){var obj=getElementById(id);if(obj){for(var i in obj){if(typeof obj[i]=="function"){obj[i]=function(){}}}obj.parentNode.removeChild(obj)}})}}function showExpressInstall(regObj){isExpressInstallActive=true;var obj=getElementById(regObj.id);if(obj){if(regObj.altContentId){var ac=getElementById(regObj.altContentId);if(ac){storedAltContent=ac;storedAltContentId=regObj.altContentId}}else{storedAltContent=abstractAltContent(obj)}if(!(/%$/.test(regObj.width))&&parseInt(regObj.width,10)<310){regObj.width="310"}if(!(/%$/.test(regObj.height))&&parseInt(regObj.height,10)<137){regObj.height="137"}doc.title=doc.title.slice(0,47)+" - Flash Player Installation";var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",dt=doc.title,fv="MMredirectURL="+win.location+"&MMplayerType="+pt+"&MMdoctitle="+dt,replaceId=regObj.id;if(ua.ie&&ua.win&&obj.readyState!=4){var newObj=createElement("div");replaceId+="SWFObjectNew";newObj.setAttribute("id",replaceId);obj.parentNode.insertBefore(newObj,obj);obj.style.display="none";win.attachEvent("onload",function(){obj.parentNode.removeChild(obj)})}createSWF({data:regObj.expressInstall,id:EXPRESS_INSTALL_ID,width:regObj.width,height:regObj.height},{flashvars:fv},replaceId)}}function displayAltContent(obj){if(ua.ie&&ua.win&&obj.readyState!=4){var el=createElement("div");obj.parentNode.insertBefore(el,obj);el.parentNode.replaceChild(abstractAltContent(obj),el);obj.style.display="none";win.attachEvent("onload",function(){obj.parentNode.removeChild(obj)})}else{obj.parentNode.replaceChild(abstractAltContent(obj),obj)}}function abstractAltContent(obj){var ac=createElement("div");if(ua.win&&ua.ie){ac.innerHTML=obj.innerHTML}else{var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var c=nestedObj.childNodes;if(c){var cl=c.length;for(var i=0;i<cl;i++){if(!(c[i].nodeType==1&&c[i].nodeName.toLowerCase()=="param")&&!(c[i].nodeType==8)){ac.appendChild(c[i].cloneNode(true))}}}}}return ac}function createSWF(attObj,parObj,id){var r,el=getElementById(id);if(typeof attObj.id==UNDEF){attObj.id=id}if(ua.ie&&ua.win){var att="";for(var i in attObj){if(attObj[i]!=Object.prototype[i]){if(i=="data"){parObj.movie=attObj[i]}else{if(i.toLowerCase()=="styleclass"){att+=' class="'+attObj[i]+'"'}else{if(i!="classid"){att+=" "+i+'="'+attObj[i]+'"'}}}}}var par="";for(var j in parObj){if(parObj[j]!=Object.prototype[j]){par+='<param name="'+j+'" value="'+parObj[j]+'" />'}}el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+">"+par+"</object>";fixObjectLeaks(attObj.id);r=getElementById(attObj.id)}else{if(ua.webkit&&ua.webkit<312){var e=createElement("embed");e.setAttribute("type",FLASH_MIME_TYPE);for(var k in attObj){if(attObj[k]!=Object.prototype[k]){if(k=="data"){e.setAttribute("src",attObj[k])}else{if(k.toLowerCase()=="styleclass"){e.setAttribute("class",attObj[k])}else{if(k!="classid"){e.setAttribute(k,attObj[k])}}}}}for(var l in parObj){if(parObj[l]!=Object.prototype[l]){if(l!="movie"){e.setAttribute(l,parObj[l])}}}el.parentNode.replaceChild(e,el);r=e}else{var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);for(var m in attObj){if(attObj[m]!=Object.prototype[m]){if(m.toLowerCase()=="styleclass"){o.setAttribute("class",attObj[m])}else{if(m!="classid"){o.setAttribute(m,attObj[m])}}}}for(var n in parObj){if(parObj[n]!=Object.prototype[n]&&n!="movie"){createObjParam(o,n,parObj[n])}}el.parentNode.replaceChild(o,el);r=o}}return r}function createObjParam(el,pName,pValue){var p=createElement("param");p.setAttribute("name",pName);p.setAttribute("value",pValue);el.appendChild(p)}function getElementById(id){return doc.getElementById(id)}function createElement(el){return doc.createElement(el)}function hasPlayerVersion(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10);v[2]=parseInt(v[2],10);return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false}function createCSS(sel,decl){if(ua.ie&&ua.mac){return }var h=doc.getElementsByTagName("head")[0],s=createElement("style");s.setAttribute("type","text/css");s.setAttribute("media","screen");if(!(ua.ie&&ua.win)&&typeof doc.createTextNode!=UNDEF){s.appendChild(doc.createTextNode(sel+" {"+decl+"}"))}h.appendChild(s);if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0){var ls=doc.styleSheets[doc.styleSheets.length-1];if(typeof ls.addRule==OBJECT){ls.addRule(sel,decl)}}}function setVisibility(id,isVisible){var v=isVisible?"visible":"hidden";if(isDomLoaded){getElementById(id).style.visibility=v}else{createCSS("#"+id,"visibility:"+v)}}return{registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr){if(!ua.w3cdom||!objectIdStr||!swfVersionStr){return }var regObj={};regObj.id=objectIdStr;regObj.swfVersion=swfVersionStr;regObj.expressInstall=xiSwfUrlStr?xiSwfUrlStr:false;regObjArr[regObjArr.length]=regObj;setVisibility(objectIdStr,false)},getObjectById:function(objectIdStr){var r=null;if(ua.w3cdom&&isDomLoaded){var o=getElementById(objectIdStr);if(o){var n=o.getElementsByTagName(OBJECT)[0];if(!n||(n&&typeof o.SetVariable!=UNDEF)){r=o}else{if(typeof n.SetVariable!=UNDEF){r=n}}}}return r},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj){if(!ua.w3cdom||!swfUrlStr||!replaceElemIdStr||!widthStr||!heightStr||!swfVersionStr){return }widthStr+="";heightStr+="";if(hasPlayerVersion(swfVersionStr)){setVisibility(replaceElemIdStr,false);var att=(typeof attObj==OBJECT)?attObj:{};att.data=swfUrlStr;att.width=widthStr;att.height=heightStr;var par=(typeof parObj==OBJECT)?parObj:{};if(typeof flashvarsObj==OBJECT){for(var i in flashvarsObj){if(flashvarsObj[i]!=Object.prototype[i]){if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+i+"="+flashvarsObj[i]}else{par.flashvars=i+"="+flashvarsObj[i]}}}}addDomLoadEvent(function(){createSWF(att,par,replaceElemIdStr);if(att.id==replaceElemIdStr){setVisibility(replaceElemIdStr,true)}})}else{if(xiSwfUrlStr&&!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)){setVisibility(replaceElemIdStr,false);addDomLoadEvent(function(){var regObj={};regObj.id=regObj.altContentId=replaceElemIdStr;regObj.width=widthStr;regObj.height=heightStr;regObj.expressInstall=xiSwfUrlStr;showExpressInstall(regObj)})}}},getFlashPlayerVersion:function(){return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]}},hasFlashPlayerVersion:hasPlayerVersion,createSWF:function(attObj,parObj,replaceElemIdStr){if(ua.w3cdom&&isDomLoaded){return createSWF(attObj,parObj,replaceElemIdStr)}else{return undefined}},createCSS:function(sel,decl){if(ua.w3cdom){createCSS(sel,decl)}},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,getQueryParamValue:function(param){var q=doc.location.search||doc.location.hash;if(param==null){return q}if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(isExpressInstallActive&&storedAltContent){var obj=getElementById(EXPRESS_INSTALL_ID);if(obj){obj.parentNode.replaceChild(storedAltContent,obj);if(storedAltContentId){setVisibility(storedAltContentId,true);if(ua.ie&&ua.win){storedAltContent.style.display="block"}}storedAltContent=null;storedAltContentId=null;isExpressInstallActive=false}}}}}();Jamendo.classes.SuperBox=Class.create({closeWord:"close",loadImage:"http://img.jamendo.com/superboxloading.gif",widthParam:"sbw",heightParam:"sbh",addUrlParams:"output=superbox",cb_show:[],removable:true,cb_remove:[],defaultWidth:0,defaultHeight:0,mode:null,jamform:false,fastmode:false,initialize:function(){Jamendo.onReady(function(){if(!this.fastmode){this.cb_show.push(this.hideObjects.bind(this));this.cb_remove.push(this.showObjects.bind(this))}}.bind(this))},hideObjects:function(){var A=$A(document.getElementsByTagName("object"));A.each(function(B){B=$(B);if(!B.up("#SuperBox_ajaxContent")){B.setStyle({"visibility":"hidden"})}});if($("pro_page_bottomplayer")&&$("pro_page_bottomplayer").style.display!="none"){$("pro_page_bottomplayer")._hiddenBySuperbox=true;$("pro_page_bottomplayer").style.visibility="hidden"}},showObjects:function(){var A=$A(document.getElementsByTagName("object"));A.each(function(B){B=$(B);if(!B.up("#SuperBox_ajaxContent")){B.setStyle({"visibility":"visible"})}});if($("pro_page_bottomplayer")&&$("pro_page_bottomplayer")._hiddenBySuperbox){$("pro_page_bottomplayer")._hiddenBySuperbox=false;$("pro_page_bottomplayer").style.visibility="visible"}},reset:function(){this.w=this.defaultWidth;this.h=this.defaultHeight;this.t="";this.s=false;this.shown=false},registerNow:function(A,B){$$(A).each(function(C){SuperBox.registerElt(C,B)})},register:function(A,B){Jamendo.onReady(function(){this.registerNow(A,B)}.bind(this))},registerElt:function(B,A){B.onclick=function(){return false}.bindAsEventListener(B);Event.observe(B,"click",function(){var C=this.title||this.innerHTML||this.href;SuperBox.call("remote",A||this.href,C);this.blur()}.bindAsEventListener(B))},call:function(F,A,M,B,J,L,H){try{if(typeof ClickTaleExec=="function"){ClickTaleExec("SuperBox.call.apply(SuperBox,"+Object.toJSON($A(arguments))+");")}if(!F){F="remote"}this.jamform=(L===true);this._remove_cb=J;if(F=="remote"&&(typeof A)!="string"&&("href" in A)){this.url=A.href}else{this.url=A}this.mode=F;this.reset();this.caption=M;this.baseinsert();if(this.jamform&&Prototype.Browser.IE){this.show();$("SuperBox_window").setStyle({opacity:0})}if(Prototype.Browser.IE){$$("select").each(function(N){Element.hide(N)})}if(Prototype.Browser.Opera){$$("iframe").each(function(N){Element.hide(N)})}this.wro=this.position.bindAsEventListener(this);this.position();if(!this.fastmode){Event.observe(window,"resize",this.wro)}if(F=="remote"&&this.url.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){this.t="img";this.img=new Image();this.img.onload=this.show.bindAsEventListener(this);this.img.src=this.url}else{if(F=="wait"){}else{this.t="html";if(F=="remote"){var I=this.url.replace(/^[^\?]+\??/,"");var C=this.parseQuery(I);if(C[this.widthParam]){this.setDim(C[this.widthParam],C[this.heightParam],true)}else{this.setDim(950,500,true)}}this.htmlinsert();if(F=="remote"){var K={"callback":function(N){if(!$("SuperBox_ajaxContent")){return this.remove()}$("SuperBox_ajaxContent").update(N);$("SuperBox_ajaxUrl").update(this.urlcat(this.url,this.addUrlParams));if(typeof (B)=="function"){B()}if(this.jamform&&Prototype.Browser.IE){$("SuperBox_load").hide();$("SuperBox_window").setStyle({opacity:1})}else{this.show()}}.bind(this),"url":this.urlcat(this.url,this.addUrlParams),"timeout":4000,"retryDelay":0,"errback":function(){this.remove()}.bind(this)};if(typeof (H)!="undefined"){K=Object.extend(K,H)}Jamendo.ajaxRequest(K);$("SuperBox_ajaxContent").addClassName("superbox_remote")}else{if(F=="localdiv"){var E=$(A).innerHTML;var D=$(A).getDimensions();if(!(D.width>0)){D={width:parseInt($(A).style.width),height:parseInt($(A).style.height)}}$(A).innerHTML="";$("SuperBox_ajaxContent").innerHTML=E;this.setDim(D.width,D.height);if(typeof (B)=="function"){B()}this.show()}}}}}catch(G){Jamendo.log(G);return true}return false},urlcat:function(A,B){if(A.indexOf("?")<0){return A+"?"+B}else{return A+"&"+B}},baseinsert:function(){if(this.fastmode){return new Insertion.Bottom($("body"),"<div id='SuperBox_global'><div id='SuperBox_window' style='display:none;'></div></div>")}else{return new Insertion.Bottom($$("body")[0],"<div id='SuperBox_global'><div id='SuperBox_overlay' onclick='return SuperBox.remove();'></div><div id='SuperBox_window' style='display:none;'></div><div id='SuperBox_load' onclick='return SuperBox.remove();'><div id='SuperBox_loadContent'><img src='"+this.loadImage+"' /></div></div></div>")}},htmlinsert:function(){return new Insertion.Bottom("SuperBox_window","<div id='SuperBox_closeAjaxWindow' ><a href='#' id='SuperBox_closeWindowButton' onclick='SuperBox.remove();return false;'>"+this.closeWord+"</a></div><div id='SuperBox_ajaxContent'></div><div style='background: none repeat scroll 0% 0% black; position: absolute; opacity: 0.6; display:none;' id='SuperBox_overlay_inner'><img style='position: absolute; right: 50%; top: 50%;' src='"+this.loadImage+"' /></div><div style='display:none;' id='SuperBox_ajaxUrl'></div>")},imginsert:function(){try{$("SuperBox_Img").remove()}catch(A){}return new Insertion.Bottom("SuperBox_window","<div id='SuperBox_Img'><a href='' onclick='return SuperBox.remove();' id='SuperBox_ImageOff' title='Close'><img id='SuperBox_Image' src='"+this.url+"' style='"+this.ciw+"px;height:"+this.cih+"px' alt='"+this.caption+"'/></a><div id='SuperBox_caption'>"+this.caption+"</div><div id='SuperBox_closeWindow' onclick='SuperBox.remove(); return false;'><a href='#' id='SuperBox_closeWindowButton'>"+this.closeWord+"</a></div></div>")},show:function(){this.s=true;if(this.t=="img"){this.iw=this.img.width;this.ih=this.img.height;this.position();this.imginsert()}else{this.position()}this.shown=true;if(this.w>0||this.jamform){if(!this.fastmode&&!(this.jamform&&Prototype.Browser.IE)){$("SuperBox_load").hide()}$("SuperBox_window").show()}this.cb_show.each(function(A){A()})},remove:function(C){if(!this.removable&&(C!==true)){return false}if(typeof ClickTaleExec=="function"){ClickTaleExec("SuperBox.remove(true);")}this.shown=false;var A=$("SuperBox_global");if(!A){return }this.cb_remove.each(function(D){D()});if(this._remove_cb){this._remove_cb()}A.hide();if(!this.fastmode){Event.stopObserving(window,"resize",this.wro)}if(this.mode=="localdiv"){var B=$("SuperBox_ajaxContent").innerHTML;$("SuperBox_ajaxContent").innerHTML="";new Insertion.Bottom(this.url,B)}A.remove();if(Prototype.Browser.IE){$$("select").each(function(D){Element.show(D)})}if(Prototype.Browser.Opera){$$("iframe").each(function(D){Element.show(D)})}return false},position:function(){if(this.fastmode){if(this.t=="img"){this.imgsize();this.imginsert()}else{if(this.t=="html"){if(!$("SuperBox_ajaxContent")){return this.remove()}$("SuperBox_window").setStyle({position:"fixed",top:"30px",left:"30px"});if(this.h==0){$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px"})}else{$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px",height:(this.h-49)+"px"})}}}}else{var A=this.getPageSize();if(window.innerHeight&&window.scrollMaxY){yScroll=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){yScroll=document.body.scrollHeight}else{yScroll=document.body.offsetHeight}}var B=this.getPageScrollTop();if(this.t=="img"){this.imgsize();this.imginsert()}else{if(this.t=="html"){if(!$("SuperBox_ajaxContent")){return this.remove()}if(this.h==0){$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px"})}else{$("SuperBox_ajaxContent").setStyle({width:(this.w-30)+"px",height:(this.h-49)+"px"})}}}if(this.h==0){$("SuperBox_window").setStyle({width:this.w+"px",left:((A[0]-this.w)/2)+"px",top:(B[1]+30)+"px"});$("SuperBox_load").setStyle({top:(B[1]+40+((A[1])/2))+"px"})}else{$("SuperBox_window").setStyle({width:this.w+"px",height:this.h+"px",left:((A[0]-this.w)/2)+"px",top:(B[1]+((A[1]-this.h)/2))+"px"});$("SuperBox_load").setStyle({top:(B[1]+40+((A[1])/2))+"px"})}if(this.s&&$("SuperBox_overlay_inner")){$("SuperBox_overlay_inner").setStyle({width:this.w+"px",height:this.h+"px",left:0,top:0})}var C=0;if(typeof (window.innerHeight)=="number"){C=window.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){C=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){C=document.body.clientHeight}}}$("SuperBox_overlay").setStyle({"height":Math.max(C,yScroll)+"px"})}},setDim:function(A,B,C){this.w=A*1+30;if(!B){this.h=0}else{this.h=B*1+40}if(this.s&&!C){this.show()}},imgsize:function(){var B=this.getPageSize();var A=B[0]-100;var C=B[1]-100;this.ciw=this.iw;this.cih=this.ih;(2).times(function(){if(this.ciw>A){this.cih=this.cih*(A/this.ciw);this.ciw=A}if(this.cih>C){this.ciw=this.ciw*(C/this.cih);this.cih=C}}.bind(this));this.w=this.ciw+30;this.h=this.cih+60},getPageScrollTop:function(){var B;var A=document.documentElement;if(self.pageYOffset){B=self.pageYOffset}else{if(A&&A.scrollTop){B=A.scrollTop}else{if(document.body){B=document.body.scrollTop}}}arrayPageScroll=new Array("",B);return arrayPageScroll},getPageSize:function(){var C=document.documentElement;var A=self.innerWidth||(C&&C.clientWidth)||document.body.clientWidth;var B=self.innerHeight||(C&&C.clientHeight)||document.body.clientHeight;arrayPageSize=new Array(A,B);return arrayPageSize},parseQuery:function(D){var G=new Object();if(!D){return G}var A=D.split(/[;&]/);for(var C=0;C<A.length;C++){var E=A[C].split("=");if(!E||E.length!=2){continue}var B=unescape(E[0]);var F=unescape(E[1]);F=F.replace(/\+/g," ");G[B]=F}return G}});var SuperBox=new Jamendo.classes.SuperBox();Jamendo.classes.PlayerFlashObj=Class.create({_obj:null,initialize:function(B,D,G,A,C,K,E){if(!this._obj){var F=K[0];var J=K[1];var H="http://img.jamendo.com/orange/player/expressinstall.swf";var I={"lang":Jamendo.getEnv("LANG"),"p":B?1:0};if(location.href){I.m=G}I.refuid=Jamendo.getEnv("USERID");I.refuname=Jamendo.getEnv("USERNAME");I.sessid=Cookie.get("jamI");if(I.sessid){I.sessid=I.sessid.split("|")[0]}else{I.sessid=false}I.httphosti18n=Jamendo.getEnv("HTTPHOSTI18N");I.external=Jamendo.page.usePlayer()?0:1;I.debug="debug" in location.href.toQueryParams();if(A){$H(A).each(function(L){I[L.key]=L.value})}swfobject.isExpressInstallActive=true;if(Jamendo.getEnv("MOD")=="pro"){swfobject.embedSWF(C,D,F,J,"8.0.0",H,I,{allowScriptAccess:"always",swLiveConnect:"true"},{id:D,name:D})}else{swfobject.embedSWF(C,D,F,J,"8.0.0",H,I,{allowScriptAccess:"always",swLiveConnect:"true",wmode:"transparent"},{id:D,name:D})}swfobject.addDomLoadEvent(function(){var M=document.getElementById(D);var L=M.getElementsByTagName("object")[0];if(M){if(!L||(L&&typeof M.SetVariable!="undefined")){this._obj=M}else{if(typeof L.SetVariable!="undefined"){this._obj=L}else{return }}if(E){E(this._obj)}}}.bind(this))}},isReady:function(){if(this._obj){if(typeof this._obj.isReady=="function"){if(this._obj.isReady()==true){return true}}}return false},jsFlashAction:function(B,A){if(typeof this._obj.jsFlashAction=="function"){this._obj.jsFlashAction(B,A)}}});Jamendo.classes.Autocompleter=Class.create({initialize:function(A){this.active=false;this.shown=false;this.hasFocus=false;this.currentHover=-1;this.currentRequest=false;this.o=Object.extend({"name":"jamAC_"+Math.random(),"delay":150,"minChars":2,"breakChars":[],"dataSource":"remote","cacheGroup":"","selectCallback":Prototype.K,"fixMenu":Prototype.K,"formatItem":function(B){return B[0]},"postFillMenu":Prototype.K,"autoSelect":false,"cached":true,"categs":[],"disableReturnSubmit":true,"autoSubmitOnBlur":false,"n":10,"input":false},A);this.buildInput();this.buildMenu()},getChoices:function(B,C){if(this.o.breakChars.length>0&&B.gsub(new RegExp("["+this.o.breakChars.join("")+"]+"),"")!=B){return setTimeout(function(){C([])},10)}if(B.length<this.o.minChars){return setTimeout(function(){C([])},10)}B=B.toLowerCase();if(this.o.dataSource=="remote"){if(this.currentRequest){this.currentRequest.abort()}this.currentRequest=Jamendo.writeApi((this.o.cached?"cached ":"")+"autocomplete",[B,this.o.categs,this.o.n,this.o.cacheGroup],C)}else{var A=(B?this.o.data.findAll(function(D){if(D[0].toLowerCase().indexOf(B)>=0){return true}}):this.o.data);setTimeout(function(){C({"r":A})},10)}},buildInput:function(){if(this.o.input){this.input=$(this.o.input)}if(!this.input){return }this.input.setAttribute("autocomplete","off");Event.observe(this.input,"keydown",this.onKeyDown.bindAsEventListener(this));Event.observe(this.input,"keypress",this.onKeyPress.bindAsEventListener(this));Event.observe(this.input,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.input,"focus",this.onFocus.bindAsEventListener(this))},buildMenu:function(){this.menu=document.createElement("div");this.menu.id="jamACMenu_"+this.o.name;this.menu.className="jamACMenu";this.menu.style.display="none";this.menu.style.position="absolute";$("jamBodyInsert").appendChild(this.menu);this.menu=$(this.menu);this.menuInner=document.createElement("div");this.menuInner.id="jamACMenuInner_"+this.o.name;this.menuInner.className="jamACMenuInner";this.menu.appendChild(this.menuInner);this.menuInner=$(this.menuInner)},fillMenu:function(A,B){this.currentHover=-1;this.menuInner.innerHTML="";this.choices=A.r||[];this.choices.each(function(C,D){this.choices[D]._e=document.createElement("div");this.choices[D]._e.className="jamACMenuItem";this.choices[D]._e.innerHTML=this.o.formatItem(C);Event.observe(this.choices[D]._e,"mouseover",this.hoverItemByIndex.bind(this,D));Event.observe(this.choices[D]._e,"mouseout",this.unhoverItemByIndex.bind(this,D));Event.observe(this.choices[D]._e,"mousedown",this.selectItemByIndex.bind(this,D));this.menuInner.appendChild(this.choices[D]._e);this.choices[D]._e=$(this.choices[D]._e)}.bind(this));this.o.postFillMenu(this);if(B){if(this.choices.length==0){this.hideMenu()}else{this.showMenu()}}},selectItemByIndex:function(B){var A=this.input.value;this.input.value=this.choices[B][0];this.hideMenu();this.o.selectCallback(this.choices[B],A)},hoverItemByIndex:function(A){if(this.choices.length==0){return }if(A==-2){A=-1}if(this.currentHover>=0){this.unhoverItemByIndex(this.currentHover)}this.currentHover=(A+this.choices.length)%(this.choices.length);this.choices[this.currentHover]._e.addClassName("jamACMenuItem_hover")},unhoverItemByIndex:function(A){this.choices[A]._e.removeClassName("jamACMenuItem_hover")},showMenu:function(){if(this.input){var B=this.input.getDimensions();var A=this.menu.getDimensions();if(this.menu.getDimensions().width>B.width){this.menu.clonePosition(this.input,{"offsetTop":B.height,"setWidth":false})}else{this.menu.clonePosition(this.input,{"offsetTop":B.height});this.o.fixMenu.bind(this)(this.menu)}}if(this.currentHover==-1&&this.o.autoSelect){this.hoverItemByIndex(0)}this.menu.show();this.shown=true},hideMenu:function(A){if(A&&this.currentRequest){this.currentRequest.abort()}this.shown=false;this.currentHover=-1;this.menu.hide()},onBlur:function(){if(this.o.autoSubmitOnBlur){if(this.currentHover>=0){this.selectItemByIndex(this.currentHover);this.needsKeyPressFix=true;Event.stop(event)}}else{if(this.currentRequest){this.currentRequest.abort()}}this.hideMenu();this.active=false;this.hasFocus=false},onFocus:function(){this.hideMenu();this.active=true;this.hasFocus=true;this.getChoicesFromInput()},onKeyPress:function(A){if(this.needsKeyPressFix&&A.keyCode==Event.KEY_RETURN&&this.o.disableReturnSubmit){Event.stop(A);this.needsKeyPressFix=false}},onKeyDown:function(A){this.needsKeyPressFix=false;if(!this.hasFocus){this.onFocus()}if(this.shown){switch(A.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:if(this.currentHover>=0){this.selectItemByIndex(this.currentHover);this.needsKeyPressFix=true;Event.stop(A)}else{if(A.keyCode==Event.KEY_TAB){return }}case Event.KEY_ESC:this.hideMenu();Event.stop(A);return ;case Event.KEY_LEFT:case Event.KEY_RIGHT:return ;case 63232:case Event.KEY_UP:this.hoverItemByIndex(this.currentHover-1);if(Prototype.Browser.WebKit){Event.stop(A)}return ;case 63233:case Event.KEY_DOWN:this.hoverItemByIndex(this.currentHover+1);if(Prototype.Browser.WebKit){Event.stop(A)}return }}else{if(A.keyCode==Event.KEY_TAB||A.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&A.keyCode==0)){return }}if(this.queryTimeout){clearTimeout(this.queryTimeout)}this.queryTimeout=setTimeout(this.getChoicesFromInput.bind(this),this.o.delay)},getChoicesFromInput:function(){this.getChoices(this.input.value,function(A){this.fillMenu(A,true)}.bind(this))}});var Fx=fx={};Fx.Base=function(){};Fx.Base.prototype={setOptions:function(A){this.options=Object.extend({onStart:function(){},onComplete:function(){},transition:Fx.Transitions.sineInOut,duration:500,unit:"px",wait:true,fps:50},A||{})},step:function(){var A=new Date().getTime();if(A<this.time+this.options.duration){this.cTime=A-this.time;this.setNow()}else{setTimeout(this.options.onComplete.bind(this,this.element),10);this.clearTimer();this.now=this.to}this.increase()},setNow:function(){this.now=this.compute(this.from,this.to)},compute:function(C,B){var A=B-C;return this.options.transition(this.cTime,C,A,this.options.duration)},clearTimer:function(){clearInterval(this.timer);this.timer=null;return this},_start:function(B,A){if(!this.options.wait){this.clearTimer()}if(this.timer){return }setTimeout(this.options.onStart.bind(this,this.element),10);this.from=B;this.to=A;this.time=new Date().getTime();this.timer=setInterval(this.step.bind(this),Math.round(1000/this.options.fps));return this},custom:function(B,A){return this._start(B,A)},set:function(A){this.now=A;this.increase();return this},hide:function(){return this.set(0)},setStyle:function(C,B,A){if(B=="opacity"){if(A==0&&C.style.visibility!="hidden"){C.style.visibility="hidden"}else{if(C.style.visibility!="visible"){C.style.visibility="visible"}}if(window.ActiveXObject){C.style.filter="alpha(opacity="+A*100+")"}C.style.opacity=A}else{C.style[B]=A+this.options.unit}}};Fx.Style=Class.create();Fx.Style.prototype=Object.extend(new Fx.Base(),{initialize:function(C,A,B){this.element=$(C);this.setOptions(B);this.property=A.camelize()},increase:function(){this.setStyle(this.element,this.property,this.now)}});Fx.Styles=Class.create();Fx.Styles.prototype=Object.extend(new Fx.Base(),{initialize:function(B,A){this.element=$(B);this.setOptions(A);this.now={}},setNow:function(){for(p in this.from){this.now[p]=this.compute(this.from[p],this.to[p])}},custom:function(A){if(this.timer&&this.options.wait){return }var C={};var B={};for(p in A){C[p]=A[p][0];B[p]=A[p][1]}return this._start(C,B)},increase:function(){for(var A in this.now){this.setStyle(this.element,A,this.now[A])}}});Fx.Transitions={linear:function(B,A,D,C){return D*B/C+A},sineInOut:function(B,A,D,C){return -D/2*(Math.cos(Math.PI*B/C)-1)+A}};var TableKit=Class.create();TableKit.prototype={initialize:function(D,A){var B=$(D);if(B.tagName!=="TABLE"){return }TableKit.register(B,Object.extend(TableKit.options,A||{}));this.id=B.id;var C=TableKit.option("sortable resizable editable",this.id);if(C.sortable){TableKit.Sortable.init(B)}if(C.resizable){TableKit.Resizable.init(B)}if(C.editable){TableKit.Editable.init(B)}},sort:function(B,A){TableKit.Sortable.sort(this.id,B,A)},resizeColumn:function(B,A){TableKit.Resizable.resize(this.id,B,A)},editCell:function(B,A){TableKit.Editable.editCell(this.id,B,A)}};Object.extend(TableKit,{getBodyRows:function(A){A=$(A);var B=A.id;if(!TableKit.tables[B].dom.rows){TableKit.tables[B].dom.rows=(A.tHead&&A.tHead.rows.length>0)?$A(A.tBodies[0].rows):$A(A.rows).without(A.rows[0])}return TableKit.tables[B].dom.rows},getHeaderCells:function(B,A){if(!B){B=$(A).up("table")}var C=B.id;if(!TableKit.tables[C].dom.head){TableKit.tables[C].dom.head=$A((B.tHead&&B.tHead.rows.length>0)?B.tHead.rows[B.tHead.rows.length-1].cells:B.rows[0].cells)}return TableKit.tables[C].dom.head},getCellIndex:function(A){return $A(A.parentNode.cells).indexOf(A)},getRowIndex:function(A){return $A(A.parentNode.rows).indexOf(A)},getCellText:function(A,B){if(!A){return""}var C=TableKit.getCellData(A);if(B||C.refresh||!C.textContent){C.textContent=A.textContent?A.textContent:A.innerText;C.refresh=false}return C.textContent},getCellData:function(A){var C=null;if(!A.id){C=$(A).up("table");A.id=C.id+"-cell-"+TableKit._getc()}var B=C?C.id:A.id.match(/(.*)-cell.*/)[1];if(!TableKit.tables[B].dom.cells[A.id]){TableKit.tables[B].dom.cells[A.id]={textContent:"",htmlContent:"",active:false}}return TableKit.tables[B].dom.cells[A.id]},register:function(B,A){if(!B.id){B.id="tablekit-table-"+TableKit._getc()}var C=B.id;TableKit.tables[C]=TableKit.tables[C]?Object.extend(TableKit.tables[C],A||{}):Object.extend({dom:{head:null,rows:null,cells:{}},sortable:false,resizable:false,editable:false},A||{})},notify:function(A,C,B){if(TableKit.tables[C.id]&&TableKit.tables[C.id].observers&&TableKit.tables[C.id].observers[A]){TableKit.tables[C.id].observers[A](C,B)}TableKit.options.observers[A](C,B)()},isSortable:function(A){return TableKit.tables[A.id]?TableKit.tables[A.id].sortable:false},isResizable:function(A){return TableKit.tables[A.id]?TableKit.tables[A.id].resizable:false},isEditable:function(A){return TableKit.tables[A.id]?TableKit.tables[A.id].editable:false},setup:function(A){Object.extend(TableKit.options,A||{})},option:function(B,E,D,C){D=D||TableKit.options;C=C||(E?(TableKit.tables[E]?TableKit.tables[E]:{}):{});var A=E+B;if(!TableKit._opcache[A]){TableKit._opcache[A]=$A($w(B)).inject([],function(F,G){F.push(F[G]=C[G]||D[G]);return F})}return TableKit._opcache[A]},e:function(A){return A||window.event},tables:{},_opcache:{},options:{autoLoad:true,stripe:true,sortable:true,resizable:true,editable:true,rowEvenClass:"roweven",rowOddClass:"rowodd",sortableSelector:["table.sortable"],columnClass:"sortcol",descendingClass:"sortdesc",ascendingClass:"sortasc",defaultSortDirection:1,noSortClass:"nosort",sortFirstAscendingClass:"sortfirstasc",sortFirstDecendingClass:"sortfirstdesc",resizableSelector:["table.resizable"],minWidth:10,showHandle:true,resizeOnHandleClass:"resize-handle-active",editableSelector:["table.editable"],formClassName:"editable-cell-form",noEditClass:"noedit",editAjaxURI:"/",editAjaxOptions:{},observers:{"onSortStart":function(){},"onSort":function(){},"onSortEnd":function(){},"onResizeStart":function(){},"onResize":function(){},"onResizeEnd":function(){},"onEditStart":function(){},"onEdit":function(){},"onEditEnd":function(){}}},_c:0,_getc:function(){return TableKit._c+=1},unloadTable:function(D){D=$(D);if(!TableKit.tables[D.id]){return }var C=TableKit.getHeaderCells(D);var F=TableKit.option("sortable resizable editable noSortClass descendingClass ascendingClass columnClass sortFirstAscendingClass sortFirstDecendingClass",D.id);C.each(function(G){G=$(G);if(F.sortable){if(!G.hasClassName(F.noSortClass)){Event.stopObserving(G,"mousedown",TableKit.Sortable._sort);G.removeClassName(F.columnClass);G.removeClassName(F.sortFirstAscendingClass);G.removeClassName(F.sortFirstDecendingClass);if(G.hasClassName(F.ascendingClass)){G.removeClassName(F.ascendingClass);G.addClassName(F.sortFirstAscendingClass)}else{if(G.hasClassName(F.descendingClass)){G.removeClassName(F.descendingClass);G.addClassName(F.sortFirstDecendingClass)}}}}if(F.resizable){Event.stopObserving(G,"mouseover",TableKit.Resizable.initDetect);Event.stopObserving(G,"mouseout",TableKit.Resizable.killDetect)}});if(F.editable){Event.stopObserving(D.tBodies[0],"click",TableKit.Editable._editCell);for(var E in TableKit.tables[D.id].dom.cells){if(TableKit.tables[D.id].dom.cells[E].active){var A=$(E);var B=TableKit.Editable.getCellEditor(A);B.cancel(A)}}}TableKit.tables[D.id].dom={head:null,rows:null,cells:{}}},reloadTable:function(A){A=$(A);TableKit.unloadTable(A);var B=TableKit.option("sortable resizable editable",A.id);if(B.sortable){TableKit.Sortable.init(A)}if(B.resizable){TableKit.Resizable.init(A)}if(B.editable){TableKit.Editable.init(A)}},reload:function(){for(var A in TableKit.tables){TableKit.reloadTable(A)}},load:function(){if(TableKit.options.autoLoad){if(TableKit.options.sortable){$A(TableKit.options.sortableSelector).each(function(A){$$(A).each(function(B){TableKit.Sortable.init(B)})})}if(TableKit.options.resizable){$A(TableKit.options.resizableSelector).each(function(A){$$(A).each(function(B){TableKit.Resizable.init(B)})})}if(TableKit.options.editable){$A(TableKit.options.editableSelector).each(function(A){$$(A).each(function(B){TableKit.Editable.init(B)})})}}}});TableKit.Rows={stripe:function(A){var B=TableKit.getBodyRows(A);B.each(function(D,C){TableKit.Rows.addStripeClass(A,D,C)})},addStripeClass:function(I,A,C){I=I||A.up("table");var E=TableKit.option("rowEvenClass rowOddClass",I.id);var D=((C+1)%2===0?E[0]:E[1]);var G=A.className.split(/\s+/);var H=[];for(var F=0,B=G.length;F<B;F+=1){if(G[F]!==E[0]&&G[F]!==E[1]){H.push(G[F])}}H.push(D);A.className=H.join(" ")}};TableKit.Sortable={init:function(F,C){var D=$(F);if(D.tagName!=="TABLE"){return }TableKit.register(D,Object.extend(C||{},{sortable:true}));var B;var A=TableKit.getHeaderCells(D);var E=TableKit.option("noSortClass columnClass sortFirstAscendingClass sortFirstDecendingClass",D.id);A.each(function(G){G=$(G);if(!G.hasClassName(E.noSortClass)){Event.observe(G,"mousedown",TableKit.Sortable._sort);G.addClassName(E.columnClass);if(G.hasClassName(E.sortFirstAscendingClass)||G.hasClassName(E.sortFirstDecendingClass)){B=G}}});if(B){if(B.hasClassName(E.sortFirstAscendingClass)){TableKit.Sortable.sort(D,B,1)}else{TableKit.Sortable.sort(D,B,-1)}}else{TableKit.Rows.stripe(D)}},reload:function(B){B=$(B);var A=TableKit.getHeaderCells(B);var C=TableKit.option("noSortClass columnClass",B.id);A.each(function(D){D=$(D);if(!D.hasClassName(C.noSortClass)){Event.stopObserving(D,"mousedown",TableKit.Sortable._sort);D.removeClassName(C.columnClass)}});TableKit.Sortable.init(B)},_sort:function(B){if(TableKit.Resizable._onHandle){return }B=TableKit.e(B);Event.stop(B);var A=Event.element(B);while(!(A.tagName&&A.tagName.match(/td|th/gi))){A=A.parentNode}TableKit.Sortable.sort(null,A)},sort:function(I,F,B){var H;if(typeof F==="number"){if(!I||(I.tagName&&I.tagName!=="TABLE")){return }I=$(I);F=Math.min(I.rows[0].cells.length,F);F=Math.max(1,F);F-=1;H=(I.tHead&&I.tHead.rows.length>0)?$(I.tHead.rows[I.tHead.rows.length-1].cells[F]):$(I.rows[0].cells[F])}else{H=$(F);I=I?$(I):H.up("table");F=TableKit.getCellIndex(H)}var E=TableKit.option("noSortClass descendingClass ascendingClass defaultSortDirection",I.id);if(H.hasClassName(E.noSortClass)){return }B=B?B:E.defaultSortDirection;var K=TableKit.getBodyRows(I);if(H.hasClassName(E.ascendingClass)||H.hasClassName(E.descendingClass)){K.reverse();B=H.hasClassName(E.descendingClass)?1:-1}else{var D=TableKit.Sortable.getDataType(H,F,I);var J=TableKit.Sortable.types;K.sort(function(M,L){return B*J[D].compare(TableKit.getCellText(M.cells[F]),TableKit.getCellText(L.cells[F]))})}var C=I.tBodies[0];var A=TableKit.Rows;K.each(function(M,L){C.appendChild(M);A.addStripeClass(I,M,L)});var G=TableKit.getHeaderCells(null,H);$A(G).each(function(M,L){M=$(M);M.removeClassName(E.ascendingClass);M.removeClassName(E.descendingClass);if(F===L){if(B===1){M.addClassName(E.ascendingClass)}else{M.addClassName(E.descendingClass)}}})},types:{},detectors:[],addSortType:function(){$A(arguments).each(function(A){TableKit.Sortable.types[A.name]=A})},getDataType:function(B,D,F){B=$(B);D=(D||D===0)?D:TableKit.getCellIndex(B);var A=TableKit.Sortable._coltypecache;var C=A[F.id]?A[F.id]:(A[F.id]={});if(!C[D]){var E=false;if(B.id&&TableKit.Sortable.types[B.id]){E=B.id}if(!E){E=$w(B.className).detect(function(H){return(TableKit.Sortable.types[H])?true:false})}if(!E){var G=TableKit.getBodyRows(F);B=G[0].cells[D];E=TableKit.Sortable.detectors.detect(function(H){return TableKit.Sortable.types[H].detect(TableKit.getCellText(B))})}C[D]=E}return C[D]},_coltypecache:{}};TableKit.Sortable.detectors=$A($w("date-iso date date-eu date-au time currency datasize number casesensitivetext text"));TableKit.Sortable.Type=Class.create();TableKit.Sortable.Type.prototype={initialize:function(A,B){this.name=A;B=Object.extend({normal:function(C){return C},pattern:/.*/},B||{});this.normal=B.normal;this.pattern=B.pattern;if(B.compare){this.compare=B.compare}if(B.detect){this.detect=B.detect}},compare:function(B,A){return TableKit.Sortable.Type.compare(this.normal(B),this.normal(A))},detect:function(A){return this.pattern.test(A)}};TableKit.Sortable.Type.compare=function(B,A){return B<A?-1:B===A?0:1};TableKit.Sortable.addSortType(new TableKit.Sortable.Type("number",{pattern:/^[-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?/,normal:function(A){A=parseFloat(A.replace(/^.*?([-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?).*$/,"$1"));return isNaN(A)?0:A}}),new TableKit.Sortable.Type("text",{normal:function(A){return A?A.toLowerCase():""}}),new TableKit.Sortable.Type("casesensitivetext",{pattern:/^[A-Z]+$/}),new TableKit.Sortable.Type("datasize",{pattern:/^[-+]?[\d]*\.?[\d]+(?:[eE][-+]?[\d]+)?\s?[k|m|g|t]b$/i,normal:function(C){var D=C.match(/^([-+]?[\d]*\.?[\d]+([eE][-+]?[\d]+)?)\s?([k|m|g|t]?b)?/i);var B=D[1]?Number(D[1]).valueOf():0;var A=D[3]?D[3].substr(0,1).toLowerCase():"";var E=B;switch(A){case"k":E=B*1024;break;case"m":E=B*1024*1024;break;case"g":E=B*1024*1024*1024;break;case"t":E=B*1024*1024*1024*1024;break}return E}}),new TableKit.Sortable.Type("date-au",{pattern:/^\d{2}\/\d{2}\/\d{4}\s?(?:\d{1,2}\:\d{2}(?:\:\d{2})?\s?[a|p]?m?)?/i,normal:function(H){if(!this.pattern.test(H)){return 0}var B=H.match(/^(\d{2})\/(\d{2})\/(\d{4})\s?(?:(\d{1,2})\:(\d{2})(?:\:(\d{2}))?\s?([a|p]?m?))?/i);var I=B[3];var D=parseInt(B[2],10)-1;var C=B[1];var A=B[4]?B[4]:0;if(B[7]){var F=parseInt(B[4],10);if(B[7].toLowerCase().indexOf("p")!==-1){A=F<12?F+12:F}else{if(B[7].toLowerCase().indexOf("a")!==-1){A=F<12?F:0}}}var G=B[5]?B[5]:0;var E=B[6]?B[6]:0;return new Date(I,D,C,A,G,E,0).valueOf()}}),new TableKit.Sortable.Type("date-us",{pattern:/^\d{2}\/\d{2}\/\d{4}\s?(?:\d{1,2}\:\d{2}(?:\:\d{2})?\s?[a|p]?m?)?/i,normal:function(H){if(!this.pattern.test(H)){return 0}var B=H.match(/^(\d{2})\/(\d{2})\/(\d{4})\s?(?:(\d{1,2})\:(\d{2})(?:\:(\d{2}))?\s?([a|p]?m?))?/i);var I=B[3];var D=parseInt(B[1],10)-1;var C=B[2];var A=B[4]?B[4]:0;if(B[7]){var F=parseInt(B[4],10);if(B[7].toLowerCase().indexOf("p")!==-1){A=F<12?F+12:F}else{if(B[7].toLowerCase().indexOf("a")!==-1){A=F<12?F:0}}}var G=B[5]?B[5]:0;var E=B[6]?B[6]:0;return new Date(I,D,C,A,G,E,0).valueOf()}}),new TableKit.Sortable.Type("date-eu",{pattern:/^\d{2}-\d{2}-\d{4}/i,normal:function(A){if(!this.pattern.test(A)){return 0}var D=A.match(/^(\d{2})-(\d{2})-(\d{4})/);var E=D[3];var C=parseInt(D[2],10)-1;var B=D[1];return new Date(E,C,B).valueOf()}}),new TableKit.Sortable.Type("date-iso",{pattern:/[\d]{4}-[\d]{2}-[\d]{2}(?:T[\d]{2}\:[\d]{2}(?:\:[\d]{2}(?:\.[\d]+)?)?(Z|([-+][\d]{2}:[\d]{2})?)?)?/,normal:function(A){if(!this.pattern.test(A)){return 0}var E=A.match(/([\d]{4})(-([\d]{2})(-([\d]{2})(T([\d]{2}):([\d]{2})(:([\d]{2})(\.([\d]+))?)?(Z|(([-+])([\d]{2}):([\d]{2})))?)?)?)?/);var D=0;var B=new Date(E[1],0,1);if(E[3]){B.setMonth(E[3]-1)}if(E[5]){B.setDate(E[5])}if(E[7]){B.setHours(E[7])}if(E[8]){B.setMinutes(E[8])}if(E[10]){B.setSeconds(E[10])}if(E[12]){B.setMilliseconds(Number("0."+E[12])*1000)}if(E[14]){D=(Number(E[16])*60)+Number(E[17]);D*=((E[15]==="-")?1:-1)}D-=B.getTimezoneOffset();if(D!==0){var C=(Number(B)+(D*60*1000));B.setTime(Number(C))}return B.valueOf()}}),new TableKit.Sortable.Type("date",{pattern:/^(?:sun|mon|tue|wed|thu|fri|sat)\,\s\d{1,2}\s(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\s\d{4}(?:\s\d{2}\:\d{2}(?:\:\d{2})?(?:\sGMT(?:[+-]\d{4})?)?)?/i,compare:function(B,A){if(B&&A){return TableKit.Sortable.Type.compare(new Date(B),new Date(A))}else{return TableKit.Sortable.Type.compare(B?1:0,A?1:0)}}}),new TableKit.Sortable.Type("time",{pattern:/^\d{1,2}\:\d{2}(?:\:\d{2})?(?:\s[a|p]m)?$/i,compare:function(B,A){var D=new Date();var C=D.getMonth()+"/"+D.getDate()+"/"+D.getFullYear()+" ";return TableKit.Sortable.Type.compare(new Date(C+B),new Date(C+A))}}),new TableKit.Sortable.Type("currency",{pattern:/^[$����]/,normal:function(A){return A?parseFloat(A.replace(/[^-\d\.]/g,"")):0}}));TableKit.Resizable={init:function(D,B){var C=$(D);if(C.tagName!=="TABLE"){return }TableKit.register(C,Object.extend(B||{},{resizable:true}));var A=TableKit.getHeaderCells(C);A.each(function(E){E=$(E);Event.observe(E,"mouseover",TableKit.Resizable.initDetect);Event.observe(E,"mouseout",TableKit.Resizable.killDetect)})},resize:function(D,C,B){var A;if(typeof C==="number"){if(!D||(D.tagName&&D.tagName!=="TABLE")){return }D=$(D);C=Math.min(D.rows[0].cells.length,C);C=Math.max(1,C);C-=1;A=(D.tHead&&D.tHead.rows.length>0)?$(D.tHead.rows[D.tHead.rows.length-1].cells[C]):$(D.rows[0].cells[C])}else{A=$(C);D=D?$(D):A.up("table");C=TableKit.getCellIndex(A)}var E=parseInt(A.getStyle("paddingLeft"),10)+parseInt(A.getStyle("paddingRight"),10);B=Math.max(B-E,TableKit.option("minWidth",D.id)[0]);A.setStyle({"width":B+"px"})},initDetect:function(B){B=TableKit.e(B);var A=Event.element(B);Event.observe(A,"mousemove",TableKit.Resizable.detectHandle);Event.observe(A,"mousedown",TableKit.Resizable.startResize)},detectHandle:function(B){B=TableKit.e(B);var A=Event.element(B);if(TableKit.Resizable.pointerPos(A,Event.pointerX(B),Event.pointerY(B))){A.addClassName(TableKit.option("resizeOnHandleClass",A.up("table").id)[0]);TableKit.Resizable._onHandle=true}else{A.removeClassName(TableKit.option("resizeOnHandleClass",A.up("table").id)[0]);TableKit.Resizable._onHandle=false}},killDetect:function(B){B=TableKit.e(B);TableKit.Resizable._onHandle=false;var A=Event.element(B);Event.stopObserving(A,"mousemove",TableKit.Resizable.detectHandle);Event.stopObserving(A,"mousedown",TableKit.Resizable.startResize);A.removeClassName(TableKit.option("resizeOnHandleClass",A.up("table").id)[0])},startResize:function(C){C=TableKit.e(C);if(!TableKit.Resizable._onHandle){return }var A=Event.element(C);Event.stopObserving(A,"mousemove",TableKit.Resizable.detectHandle);Event.stopObserving(A,"mousedown",TableKit.Resizable.startResize);Event.stopObserving(A,"mouseout",TableKit.Resizable.killDetect);TableKit.Resizable._cell=A;var B=A.up("table");TableKit.Resizable._tbl=B;if(TableKit.option("showHandle",B.id)[0]){TableKit.Resizable._handle=$(document.createElement("div")).addClassName("resize-handle").setStyle({"top":A.cumulativeOffset()[1]+"px","left":Event.pointerX(C)+"px","height":B.getDimensions().height+"px"});document.body.appendChild(TableKit.Resizable._handle)}Event.observe(document,"mousemove",TableKit.Resizable.drag);Event.observe(document,"mouseup",TableKit.Resizable.endResize);Event.stop(C)},endResize:function(B){B=TableKit.e(B);var A=TableKit.Resizable._cell;TableKit.Resizable.resize(null,A,(Event.pointerX(B)-A.cumulativeOffset()[0]));Event.stopObserving(document,"mousemove",TableKit.Resizable.drag);Event.stopObserving(document,"mouseup",TableKit.Resizable.endResize);if(TableKit.option("showHandle",TableKit.Resizable._tbl.id)[0]){$$("div.resize-handle").each(function(C){document.body.removeChild(C)})}Event.observe(A,"mouseout",TableKit.Resizable.killDetect);TableKit.Resizable._tbl=TableKit.Resizable._handle=TableKit.Resizable._cell=null;Event.stop(B)},drag:function(A){A=TableKit.e(A);if(TableKit.Resizable._handle===null){try{TableKit.Resizable.resize(TableKit.Resizable._tbl,TableKit.Resizable._cell,(Event.pointerX(A)-TableKit.Resizable._cell.cumulativeOffset()[0]))}catch(A){}}else{TableKit.Resizable._handle.setStyle({"left":Event.pointerX(A)+"px"})}return false},pointerPos:function(B,A,D){var C=$(B).cumulativeOffset();return(D>=C[1]&&D<C[1]+B.offsetHeight&&A>=C[0]+B.offsetWidth-5&&A<C[0]+B.offsetWidth)},_onHandle:false,_cell:null,_tbl:null,_handle:null};TableKit.Editable={init:function(C,A){var B=$(C);if(B.tagName!=="TABLE"){return }TableKit.register(B,Object.extend(A||{},{editable:true}));Event.observe(B.tBodies[0],"click",TableKit.Editable._editCell)},_editCell:function(B){B=TableKit.e(B);var A=Event.findElement(B,"td");if(A){TableKit.Editable.editCell(null,A,null,B)}else{return false}},editCell:function(I,D,F,A){var H,J;if(typeof D==="number"){if(!I||(I.tagName&&I.tagName!=="TABLE")){return }I=$(I);D=Math.min(I.tBodies[0].rows.length,D);D=Math.max(1,D);D-=1;F=Math.min(I.rows[0].cells.length,F);F=Math.max(1,F);F-=1;J=$(I.tBodies[0].rows[D]);H=$(J.cells[F])}else{H=$(A?Event.findElement(A,"td"):D);I=(I&&I.tagName&&I.tagName!=="TABLE")?$(I):H.up("table");J=H.up("tr")}var C=TableKit.option("noEditClass",I.id);if(H.hasClassName(C.noEditClass)){return }var E=$(TableKit.getHeaderCells(I,H)[TableKit.getCellIndex(H)]);if(E.hasClassName(C.noEditClass)){return }var B=TableKit.getCellData(H);if(B.active){return }B.htmlContent=H.innerHTML;var G=TableKit.Editable.getCellEditor(null,null,E);G.edit(H,A);B.active=true},getCellEditor:function(A,D,C){var C=C?C:$(TableKit.getHeaderCells(D,A)[TableKit.getCellIndex(A)]);var B=TableKit.Editable.types["text-input"];if(C.id&&TableKit.Editable.types[C.id]){B=TableKit.Editable.types[C.id]}else{var E=$w(C.className).detect(function(F){return(TableKit.Editable.types[F])?true:false});B=E?TableKit.Editable.types[E]:B}return B},types:{},addCellEditor:function(A){if(A&&A.name){TableKit.Editable.types[A.name]=A}}};TableKit.Editable.CellEditor=Class.create();TableKit.Editable.CellEditor.prototype={initialize:function(A,B){this.name=A;this.options=Object.extend({element:"input",attributes:{name:"value",type:"text"},selectOptions:[],showSubmit:true,submitText:"OK",showCancel:true,cancelText:"Cancel",ajaxURI:null,ajaxOptions:null},B||{})},edit:function(B){B=$(B);var H=this.options;var E=B.up("table");var D=$(document.createElement("form"));D.id=B.id+"-form";D.addClassName(TableKit.option("formClassName",E.id)[0]);D.onsubmit=this._submit.bindAsEventListener(this);var G=document.createElement(H.element);$H(H.attributes).each(function(I){G[I.key]=I.value});switch(H.element){case"input":case"textarea":G.value=TableKit.getCellText(B);break;case"select":var A=TableKit.getCellText(B);$A(H.selectOptions).each(function(I){G.options[G.options.length]=new Option(I[0],I[1]);if(A===I[1]){G.options[G.options.length-1].selected="selected"}});break}D.appendChild(G);if(H.element==="textarea"){D.appendChild(document.createElement("br"))}if(H.showSubmit){var F=document.createElement("input");F.type="submit";F.value=H.submitText;F.className="editor_ok_button";D.appendChild(F)}if(H.showCancel){var C=document.createElement("a");C.href="#";C.appendChild(document.createTextNode(H.cancelText));C.onclick=this._cancel.bindAsEventListener(this);C.className="editor_cancel";D.appendChild(C)}B.innerHTML="";B.appendChild(D)},_submit:function(C){var A=Event.findElement(C,"td");var B=Event.findElement(C,"form");Event.stop(C);this.submit(A,B)},submit:function(A,E){var G=this.options;E=E?E:A.down("form");var B=$(TableKit.getHeaderCells(null,A)[TableKit.getCellIndex(A)]);var F=A.up("tr");var D=A.up("table");var C="&row="+(TableKit.getRowIndex(F)+1)+"&cell="+(TableKit.getCellIndex(A)+1)+"&id="+F.id+"&field="+B.id+"&"+Form.serialize(E);this.ajax=new Ajax.Updater(A,G.ajaxURI||TableKit.option("editAjaxURI",D.id)[0],Object.extend(G.ajaxOptions||TableKit.option("editAjaxOptions",D.id)[0],{postBody:C,onComplete:function(){var H=TableKit.getCellData(A);H.active=false;H.refresh=true}}))},_cancel:function(B){var A=Event.findElement(B,"td");Event.stop(B);this.cancel(A)},cancel:function(A){this.ajax=null;var B=TableKit.getCellData(A);A.innerHTML=B.htmlContent;B.htmlContent="";B.active=false},ajax:null};TableKit.Editable.textInput=function(B,A){TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(B,{element:"input",attributes:Object.extend({name:"value",type:"text"},A||{})}))};TableKit.Editable.textInput("text-input");TableKit.Editable.multiLineInput=function(B,A){TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(B,{element:"textarea",attributes:Object.extend({name:"value",rows:"5",cols:"20"},A||{})}))};TableKit.Editable.multiLineInput("multi-line-input");TableKit.Editable.selectInput=function(C,A,B){TableKit.Editable.addCellEditor(new TableKit.Editable.CellEditor(C,{element:"select",attributes:Object.extend({name:"value"},A||{}),"selectOptions":B}))};document.observe("dom:loaded",TableKit.load)
