var BrowserDetect={init:function(){
this.browser=this.searchString(this.dataBrowser)||"An unknown browser";
this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";
this.OS=this.searchString(this.dataOS)||"an unknown OS";
},searchString:function(_1){
for(var i=0;i<_1.length;i++){
var _3=_1[i].string;
var _4=_1[i].prop;
this.versionSearchString=_1[i].versionSearch||_1[i].identity;
if(_3){
if(_3.indexOf(_1[i].subString)!=-1){
return _1[i].identity;
}
}else{
if(_4){
return _1[i].identity;
}
}
}
},searchVersion:function(_5){
var _6=_5.indexOf(this.versionSearchString);
if(_6==-1){
return;
}
return parseFloat(_5.substring(_6+this.versionSearchString.length+1));
},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};
BrowserDetect.init();
var Prototype={Version:"1.5.0",BrowserFeatures:{XPath:!!document.evaluate},ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){
},K:function(x){
return x;
}};
var Class={create:function(){
return function(){
this.initialize.apply(this,arguments);
};
}};
var Abstract=new Object();
Object.extend=function(_8,_9){
for(var _a in _9){
_8[_a]=_9[_a];
}
return _8;
};
Object.extend(Object,{inspect:function(_b){
try{
if(_b===undefined){
return "undefined";
}
if(_b===null){
return "null";
}
return _b.inspect?_b.inspect():_b.toString();
}
catch(e){
if(e instanceof RangeError){
return "...";
}
throw e;
}
},keys:function(_c){
var _d=[];
for(var _e in _c){
_d.push(_e);
}
return _d;
},values:function(_f){
var _10=[];
for(var _11 in _f){
_10.push(_f[_11]);
}
return _10;
},clone:function(_12){
return Object.extend({},_12);
}});
Function.prototype.bind=function(){
var _13=this,_14=$A(arguments),_15=_14.shift();
return function(){
return _13.apply(_15,_14.concat($A(arguments)));
};
};
Function.prototype.bindAsEventListener=function(_16){
var _17=this,_18=$A(arguments),_16=_18.shift();
return function(_19){
return _17.apply(_16,[(_19||window.event)].concat(_18).concat($A(arguments)));
};
};
Object.extend(Number.prototype,{toColorPart:function(){
var _1a=this.toString(16);
if(this<16){
return "0"+_1a;
}
return _1a;
},succ:function(){
return this+1;
},times:function(_1b){
$R(0,this,true).each(_1b);
return this;
}});
var Try={these:function(){
var _1c;
for(var i=0,_1e=arguments.length;i<_1e;i++){
var _1f=arguments[i];
try{
_1c=_1f();
break;
}
catch(e){
}
}
return _1c;
}};
var PeriodicalExecuter=Class.create();
PeriodicalExecuter.prototype={initialize:function(_20,_21){
this.callback=_20;
this.frequency=_21;
this.currentlyExecuting=false;
this.registerCallback();
},registerCallback:function(){
this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},stop:function(){
if(!this.timer){
return;
}
clearInterval(this.timer);
this.timer=null;
},onTimerEvent:function(){
if(!this.currentlyExecuting){
try{
this.currentlyExecuting=true;
this.callback(this);
}
finally{
this.currentlyExecuting=false;
}
}
}};
String.interpret=function(_22){
return _22==null?"":String(_22);
};
Object.extend(String.prototype,{gsub:function(_23,_24){
var _25="",_26=this,_27;
_24=arguments.callee.prepareReplacement(_24);
while(_26.length>0){
if(_27=_26.match(_23)){
_25+=_26.slice(0,_27.index);
_25+=String.interpret(_24(_27));
_26=_26.slice(_27.index+_27[0].length);
}else{
_25+=_26,_26="";
}
}
return _25;
},sub:function(_28,_29,_2a){
_29=this.gsub.prepareReplacement(_29);
_2a=_2a===undefined?1:_2a;
return this.gsub(_28,function(_2b){
if(--_2a<0){
return _2b[0];
}
return _29(_2b);
});
},scan:function(_2c,_2d){
this.gsub(_2c,_2d);
return this;
},truncate:function(_2e,_2f){
_2e=_2e||30;
_2f=_2f===undefined?"...":_2f;
return this.length>_2e?this.slice(0,_2e-_2f.length)+_2f:this;
},strip:function(){
return this.replace(/^\s+/,"").replace(/\s+$/,"");
},stripTags:function(){
return this.replace(/<\/?[^>]+>/gi,"");
},stripScripts:function(){
return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
},extractScripts:function(){
var _30=new RegExp(Prototype.ScriptFragment,"img");
var _31=new RegExp(Prototype.ScriptFragment,"im");
return (this.match(_30)||[]).map(function(_32){
return (_32.match(_31)||["",""])[1];
});
},evalScripts:function(){
return this.extractScripts().map(function(_33){
return eval(_33);
});
},escapeHTML:function(){
var div=document.createElement("div");
var _35=document.createTextNode(this);
div.appendChild(_35);
return div.innerHTML;
},unescapeHTML:function(){
var div=document.createElement("div");
div.innerHTML=this.stripTags();
return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject("",function(_37,_38){
return _37+_38.nodeValue;
}):div.childNodes[0].nodeValue):"";
},toQueryParams:function(_39){
var _3a=this.strip().match(/([^?#]*)(#.*)?$/);
if(!_3a){
return {};
}
return _3a[1].split(_39||"&").inject({},function(_3b,_3c){
if((_3c=_3c.split("="))[0]){
var _3d=decodeURIComponent(_3c[0]);
var _3e=_3c[1]?decodeURIComponent(_3c[1]):undefined;
if(_3b[_3d]!==undefined){
if(_3b[_3d].constructor!=Array){
_3b[_3d]=[_3b[_3d]];
}
if(_3e){
_3b[_3d].push(_3e);
}
}else{
_3b[_3d]=_3e;
}
}
return _3b;
});
},toArray:function(){
return this.split("");
},succ:function(){
return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);
},camelize:function(){
var _3f=this.split("-"),len=_3f.length;
if(len==1){
return _3f[0];
}
var _41=this.charAt(0)=="-"?_3f[0].charAt(0).toUpperCase()+_3f[0].substring(1):_3f[0];
for(var i=1;i<len;i++){
_41+=_3f[i].charAt(0).toUpperCase()+_3f[i].substring(1);
}
return _41;
},capitalize:function(){
return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();
},underscore:function(){
return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase();
},dasherize:function(){
return this.gsub(/_/,"-");
},inspect:function(_43){
var _44=this.replace(/\\/g,"\\\\");
if(_43){
return "\""+_44.replace(/"/g,"\\\"")+"\"";
}else{
return "'"+_44.replace(/'/g,"\\'")+"'";
}
}});
String.prototype.gsub.prepareReplacement=function(_45){
if(typeof _45=="function"){
return _45;
}
var _46=new Template(_45);
return function(_47){
return _46.evaluate(_47);
};
};
String.prototype.parseQuery=String.prototype.toQueryParams;
var Template=Class.create();
Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
Template.prototype={initialize:function(_48,_49){
this.template=_48.toString();
this.pattern=_49||Template.Pattern;
},evaluate:function(_4a){
return this.template.gsub(this.pattern,function(_4b){
var _4c=_4b[1];
if(_4c=="\\"){
return _4b[2];
}
return _4c+String.interpret(_4a[_4b[3]]);
});
}};
var $break=new Object();
var $continue=new Object();
var Enumerable={each:function(_4d){
var _4e=0;
try{
this._each(function(_4f){
try{
_4d(_4f,_4e++);
}
catch(e){
if(e!=$continue){
throw e;
}
}
});
}
catch(e){
}
return this;
},eachSlice:function(_50,_51){
var _52=-_50,_53=[],_54=this.toArray();
while((_52+=_50)<_54.length){
_53.push(_54.slice(_52,_52+_50));
}
return _53.map(_51);
},all:function(_55){
var _56=true;
this.each(function(_57,_58){
_56=_56&&!!(_55||Prototype.K)(_57,_58);
if(!_56){
throw $break;
}
});
return _56;
},any:function(_59){
var _5a=false;
this.each(function(_5b,_5c){
if(_5a=!!(_59||Prototype.K)(_5b,_5c)){
throw $break;
}
});
return _5a;
},collect:function(_5d){
var _5e=[];
this.each(function(_5f,_60){
_5e.push((_5d||Prototype.K)(_5f,_60));
});
return _5e;
},detect:function(_61){
var _62;
this.each(function(_63,_64){
if(_61(_63,_64)){
_62=_63;
throw $break;
}
});
return _62;
},findAll:function(_65){
var _66=[];
this.each(function(_67,_68){
if(_65(_67,_68)){
_66.push(_67);
}
});
return _66;
},grep:function(_69,_6a){
var _6b=[];
this.each(function(_6c,_6d){
var _6e=_6c.toString();
if(_6e.match(_69)){
_6b.push((_6a||Prototype.K)(_6c,_6d));
}
});
return _6b;
},include:function(_6f){
var _70=false;
this.each(function(_71){
if(_71==_6f){
_70=true;
throw $break;
}
});
return _70;
},inGroupsOf:function(_72,_73){
_73=_73===undefined?null:_73;
return this.eachSlice(_72,function(_74){
while(_74.length<_72){
_74.push(_73);
}
return _74;
});
},inject:function(_75,_76){
this.each(function(_77,_78){
_75=_76(_75,_77,_78);
});
return _75;
},invoke:function(_79){
var _7a=$A(arguments).slice(1);
return this.map(function(_7b){
return _7b[_79].apply(_7b,_7a);
});
},max:function(_7c){
var _7d;
this.each(function(_7e,_7f){
_7e=(_7c||Prototype.K)(_7e,_7f);
if(_7d==undefined||_7e>=_7d){
_7d=_7e;
}
});
return _7d;
},min:function(_80){
var _81;
this.each(function(_82,_83){
_82=(_80||Prototype.K)(_82,_83);
if(_81==undefined||_82<_81){
_81=_82;
}
});
return _81;
},partition:function(_84){
var _85=[],_86=[];
this.each(function(_87,_88){
((_84||Prototype.K)(_87,_88)?_85:_86).push(_87);
});
return [_85,_86];
},pluck:function(_89){
var _8a=[];
this.each(function(_8b,_8c){
_8a.push(_8b[_89]);
});
return _8a;
},reject:function(_8d){
var _8e=[];
this.each(function(_8f,_90){
if(!_8d(_8f,_90)){
_8e.push(_8f);
}
});
return _8e;
},sortBy:function(_91){
return this.map(function(_92,_93){
return {value:_92,criteria:_91(_92,_93)};
}).sort(function(_94,_95){
var a=_94.criteria,b=_95.criteria;
return a<b?-1:a>b?1:0;
}).pluck("value");
},toArray:function(){
return this.map();
},zip:function(){
var _98=Prototype.K,_99=$A(arguments);
if(typeof _99.last()=="function"){
_98=_99.pop();
}
var _9a=[this].concat(_99).map($A);
return this.map(function(_9b,_9c){
return _98(_9a.pluck(_9c));
});
},size:function(){
return this.toArray().length;
},inspect:function(){
return "#<Enumerable:"+this.toArray().inspect()+">";
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});
var $A=Array.from=function(_9d){
if(!_9d){
return [];
}
if(_9d.toArray){
return _9d.toArray();
}else{
var _9e=[];
for(var i=0,_a0=_9d.length;i<_a0;i++){
_9e.push(_9d[i]);
}
return _9e;
}
};
Object.extend(Array.prototype,Enumerable);
if(!Array.prototype._reverse){
Array.prototype._reverse=Array.prototype.reverse;
}
Object.extend(Array.prototype,{_each:function(_a1){
for(var i=0,_a3=this.length;i<_a3;i++){
_a1(this[i]);
}
},clear:function(){
this.length=0;
return this;
},first:function(){
return this[0];
},last:function(){
return this[this.length-1];
},compact:function(){
return this.select(function(_a4){
return _a4!=null;
});
},flatten:function(){
return this.inject([],function(_a5,_a6){
return _a5.concat(_a6&&_a6.constructor==Array?_a6.flatten():[_a6]);
});
},without:function(){
var _a7=$A(arguments);
return this.select(function(_a8){
return !_a7.include(_a8);
});
},indexOf:function(_a9){
for(var i=0,_ab=this.length;i<_ab;i++){
if(this[i]==_a9){
return i;
}
}
return -1;
},reverse:function(_ac){
return (_ac!==false?this:this.toArray())._reverse();
},reduce:function(){
return this.length>1?this:this[0];
},uniq:function(){
return this.inject([],function(_ad,_ae){
return _ad.include(_ae)?_ad:_ad.concat([_ae]);
});
},clone:function(){
return [].concat(this);
},size:function(){
return this.length;
},inspect:function(){
return "["+this.map(Object.inspect).join(", ")+"]";
}});
Array.prototype.toArray=Array.prototype.clone;
function $w(_af){
_af=_af.strip();
return _af?_af.split(/\s+/):[];
}
if(window.opera){
Array.prototype.concat=function(){
var _b0=[];
for(var i=0,_b2=this.length;i<_b2;i++){
_b0.push(this[i]);
}
for(var i=0,_b2=arguments.length;i<_b2;i++){
if(arguments[i].constructor==Array){
for(var j=0,_b4=arguments[i].length;j<_b4;j++){
_b0.push(arguments[i][j]);
}
}else{
_b0.push(arguments[i]);
}
}
return _b0;
};
}
var Hash=function(obj){
Object.extend(this,obj||{});
};
Object.extend(Hash,{toQueryString:function(obj){
var _b7=[];
this.prototype._each.call(obj,function(_b8){
if(!_b8.key){
return;
}
if(_b8.value&&_b8.value.constructor==Array){
var _b9=_b8.value.compact();
if(_b9.length<2){
_b8.value=_b9.reduce();
}else{
key=encodeURIComponent(_b8.key);
_b9.each(function(_ba){
_ba=_ba!=undefined?encodeURIComponent(_ba):"";
_b7.push(key+"="+encodeURIComponent(_ba));
});
return;
}
}
if(_b8.value==undefined){
_b8[1]="";
}
_b7.push(_b8.map(encodeURIComponent).join("="));
});
return _b7.join("&");
}});
Object.extend(Hash.prototype,Enumerable);
Object.extend(Hash.prototype,{_each:function(_bb){
for(var key in this){
var _bd=this[key];
if(_bd&&_bd==Hash.prototype[key]){
continue;
}
var _be=[key,_bd];
_be.key=key;
_be.value=_bd;
_bb(_be);
}
},keys:function(){
return this.pluck("key");
},values:function(){
return this.pluck("value");
},merge:function(_bf){
return $H(_bf).inject(this,function(_c0,_c1){
_c0[_c1.key]=_c1.value;
return _c0;
});
},remove:function(){
var _c2;
for(var i=0,_c4=arguments.length;i<_c4;i++){
var _c5=this[arguments[i]];
if(_c5!==undefined){
if(_c2===undefined){
_c2=_c5;
}else{
if(_c2.constructor!=Array){
_c2=[_c2];
}
_c2.push(_c5);
}
}
delete this[arguments[i]];
}
return _c2;
},toQueryString:function(){
return Hash.toQueryString(this);
},inspect:function(){
return "#<Hash:{"+this.map(function(_c6){
return _c6.map(Object.inspect).join(": ");
}).join(", ")+"}>";
}});
function $H(_c7){
if(_c7&&_c7.constructor==Hash){
return _c7;
}
return new Hash(_c7);
}
ObjectRange=Class.create();
Object.extend(ObjectRange.prototype,Enumerable);
Object.extend(ObjectRange.prototype,{initialize:function(_c8,end,_ca){
this.start=_c8;
this.end=end;
this.exclusive=_ca;
},_each:function(_cb){
var _cc=this.start;
while(this.include(_cc)){
_cb(_cc);
_cc=_cc.succ();
}
},include:function(_cd){
if(_cd<this.start){
return false;
}
if(this.exclusive){
return _cd<this.end;
}
return _cd<=this.end;
}});
var $R=function(_ce,end,_d0){
return new ObjectRange(_ce,end,_d0);
};
var Ajax={getTransport:function(){
return Try.these(function(){
return new XMLHttpRequest();
},function(){
return new ActiveXObject("Msxml2.XMLHTTP");
},function(){
return new ActiveXObject("Microsoft.XMLHTTP");
})||false;
},activeRequestCount:0};
Ajax.Responders={responders:[],_each:function(_d1){
this.responders._each(_d1);
},register:function(_d2){
if(!this.include(_d2)){
this.responders.push(_d2);
}
},unregister:function(_d3){
this.responders=this.responders.without(_d3);
},dispatch:function(_d4,_d5,_d6,_d7){
this.each(function(_d8){
if(typeof _d8[_d4]=="function"){
try{
_d8[_d4].apply(_d8,[_d5,_d6,_d7]);
}
catch(e){
}
}
});
}};
Object.extend(Ajax.Responders,Enumerable);
Ajax.Responders.register({onCreate:function(){
Ajax.activeRequestCount++;
},onComplete:function(){
Ajax.activeRequestCount--;
}});
Ajax.Base=function(){
};
Ajax.Base.prototype={setOptions:function(_d9){
this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};
Object.extend(this.options,_d9||{});
this.options.method=this.options.method.toLowerCase();
if(typeof this.options.parameters=="string"){
this.options.parameters=this.options.parameters.toQueryParams();
}
}};
Ajax.Request=Class.create();
Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(url,_db){
this.transport=Ajax.getTransport();
this.setOptions(_db);
this.request(url);
if(!this.options.hideLoader){
Element.show("ajax_loader");
}
},request:function(url){
this.url=url;
this.method=this.options.method;
var _dd=this.options.parameters;
_dd["tz_offset_minutes"]=parseInt((new Date()).getTimezoneOffset());
if(!["get","post"].include(this.method)){
_dd["_method"]=this.method;
this.method="post";
}
_dd=Hash.toQueryString(_dd);
if(_dd&&/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
_dd+="&_=";
}
if(this.method=="get"&&_dd){
this.url+=(this.url.indexOf("?")>-1?"&":"?")+_dd;
}
try{
Ajax.Responders.dispatch("onCreate",this,this.transport);
this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);
if(this.options.asynchronous){
setTimeout(function(){
this.respondToReadyState(1);
}.bind(this),10);
}
this.transport.onreadystatechange=this.onStateChange.bind(this);
this.setRequestHeaders();
var _de=this.method=="post"?(this.options.postBody||_dd):null;
this.transport.send(_de);
if(!this.options.asynchronous&&this.transport.overrideMimeType){
this.onStateChange();
}
}
catch(e){
this.dispatchException(e);
}
},onStateChange:function(){
var _df=this.transport.readyState;
if(_df>1&&!((_df==4)&&this._complete)){
this.respondToReadyState(this.transport.readyState);
}
},setRequestHeaders:function(){
var _e0={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,"Accept":"text/javascript, text/html, application/xml, text/xml, */*"};
if(this.method=="post"){
_e0["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");
if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){
_e0["Connection"]="close";
}
}
if(typeof this.options.requestHeaders=="object"){
var _e1=this.options.requestHeaders;
if(typeof _e1.push=="function"){
for(var i=0,_e3=_e1.length;i<_e3;i+=2){
_e0[_e1[i]]=_e1[i+1];
}
}else{
$H(_e1).each(function(_e4){
_e0[_e4.key]=_e4.value;
});
}
}
for(var _e5 in _e0){
this.transport.setRequestHeader(_e5,_e0[_e5]);
}
},success:function(){
return !this.transport.status||(this.transport.status>=200&&this.transport.status<300);
},respondToReadyState:function(_e6){
var _e7=Ajax.Request.Events[_e6];
var _e8=this.transport,_e9=this.evalJSON();
if(_e7=="Complete"){
try{
this._complete=true;
(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(_e8,_e9);
}
catch(e){
this.dispatchException(e);
}
if((this.getHeader("Content-type")||"text/javascript").strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){
this.evalResponse();
}
}
try{
(this.options["on"+_e7]||Prototype.emptyFunction)(_e8,_e9);
Ajax.Responders.dispatch("on"+_e7,this,_e8,_e9);
}
catch(e){
this.dispatchException(e);
}
if(_e7=="Complete"){
this.transport.onreadystatechange=Prototype.emptyFunction;
}
},getHeader:function(_ea){
try{
return this.transport.getResponseHeader(_ea);
}
catch(e){
return null;
}
},evalJSON:function(){
try{
var _eb=this.getHeader("X-JSON");
return _eb?eval("("+_eb+")"):null;
}
catch(e){
return null;
}
},evalResponse:function(){
try{
return eval(this.transport.responseText);
}
catch(e){
this.dispatchException(e);
}
},dispatchException:function(_ec){
(this.options.onException||Prototype.emptyFunction)(this,_ec);
Ajax.Responders.dispatch("onException",this,_ec);
}});
Ajax.Updater=Class.create();
Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(_ed,url,_ef){
this.container={success:(_ed.success||_ed),failure:(_ed.failure||(_ed.success?null:_ed))};
this.transport=Ajax.getTransport();
this.setOptions(_ef);
var _f0=this.options.onComplete||Prototype.emptyFunction;
this.options.onComplete=(function(_f1,_f2){
this.updateContent();
_f0(_f1,_f2);
}).bind(this);
this.request(url);
},updateContent:function(){
var _f3=this.container[this.success()?"success":"failure"];
var _f4=this.transport.responseText;
if(!this.options.evalScripts){
_f4=_f4.stripScripts();
}
if(_f3=$(_f3)){
if(this.options.insertion){
new this.options.insertion(_f3,_f4);
}else{
_f3.update(_f4);
}
}
if(this.success()){
if(this.onComplete){
setTimeout(this.onComplete.bind(this),10);
}
}
}});
Ajax.PeriodicalUpdater=Class.create();
Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(_f5,url,_f7){
this.setOptions(_f7);
this.onComplete=this.options.onComplete;
this.frequency=(this.options.frequency||2);
this.decay=(this.options.decay||1);
this.updater={};
this.container=_f5;
this.url=url;
this.start();
},start:function(){
this.options.onComplete=this.updateComplete.bind(this);
this.onTimerEvent();
},stop:function(){
this.updater.options.onComplete=undefined;
clearTimeout(this.timer);
(this.onComplete||Prototype.emptyFunction).apply(this,arguments);
},updateComplete:function(_f8){
if(this.options.decay){
this.decay=(_f8.responseText==this.lastText?this.decay*this.options.decay:1);
this.lastText=_f8.responseText;
}
this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);
},onTimerEvent:function(){
this.updater=new Ajax.Updater(this.container,this.url,this.options);
}});
function $(_f9){
if(arguments.length>1){
for(var i=0,_fb=[],_fc=arguments.length;i<_fc;i++){
_fb.push($(arguments[i]));
}
return _fb;
}
if(typeof _f9=="string"){
_f9=document.getElementById(_f9);
}
return Element.extend(_f9);
}
if(Prototype.BrowserFeatures.XPath){
document._getElementsByXPath=function(_fd,_fe){
var _ff=[];
var _100=document.evaluate(_fd,$(_fe)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
for(var i=0,_102=_100.snapshotLength;i<_102;i++){
_ff.push(_100.snapshotItem(i));
}
return _ff;
};
}
document.getElementsByClassName=function(_103,_104){
if(Prototype.BrowserFeatures.XPath){
var q=".//*[contains(concat(' ', @class, ' '), ' "+_103+" ')]";
return document._getElementsByXPath(q,_104);
}else{
var _106=($(_104)||document.body).getElementsByTagName("*");
var _107=[],_108;
for(var i=0,_10a=_106.length;i<_10a;i++){
_108=_106[i];
if(Element.hasClassName(_108,_103)){
_107.push(Element.extend(_108));
}
}
return _107;
}
};
if(!window.Element){
var Element=new Object();
}
Element.extend=function(_10b){
if(!_10b||_nativeExtensions||_10b.nodeType==3){
return _10b;
}
if(!_10b._extended&&_10b.tagName&&_10b!=window){
var _10c=Object.clone(Element.Methods),_10d=Element.extend.cache;
if(_10b.tagName=="FORM"){
Object.extend(_10c,Form.Methods);
}
if(["INPUT","TEXTAREA","SELECT"].include(_10b.tagName)){
Object.extend(_10c,Form.Element.Methods);
}
Object.extend(_10c,Element.Methods.Simulated);
for(var _10e in _10c){
var _10f=_10c[_10e];
if(typeof _10f=="function"&&!(_10e in _10b)){
_10b[_10e]=_10d.findOrStore(_10f);
}
}
}
_10b._extended=true;
return _10b;
};
Element.extend.cache={findOrStore:function(_110){
return this[_110]=this[_110]||function(){
return _110.apply(null,[this].concat($A(arguments)));
};
}};
Element.Methods={visible:function(_111){
return $(_111).style.display!="none";
},toggle:function(_112){
_112=$(_112);
Element[Element.visible(_112)?"hide":"show"](_112);
return _112;
},hide:function(_113){
$(_113).style.display="none";
return _113;
},show:function(_114){
$(_114).style.display="";
return _114;
},remove:function(_115){
_115=$(_115);
_115.parentNode.removeChild(_115);
return _115;
},update:function(_116,html){
html=typeof html=="undefined"?"":html.toString();
$(_116).innerHTML=html.stripScripts();
setTimeout(function(){
html.evalScripts();
},10);
return _116;
},replace:function(_118,html){
_118=$(_118);
html=typeof html=="undefined"?"":html.toString();
if(_118.outerHTML){
_118.outerHTML=html.stripScripts();
}else{
var _11a=_118.ownerDocument.createRange();
_11a.selectNodeContents(_118);
_118.parentNode.replaceChild(_11a.createContextualFragment(html.stripScripts()),_118);
}
setTimeout(function(){
html.evalScripts();
},10);
return _118;
},inspect:function(_11b){
_11b=$(_11b);
var _11c="<"+_11b.tagName.toLowerCase();
$H({"id":"id","className":"class"}).each(function(pair){
var _11e=pair.first(),_11f=pair.last();
var _120=(_11b[_11e]||"").toString();
if(_120){
_11c+=" "+_11f+"="+_120.inspect(true);
}
});
return _11c+">";
},recursivelyCollect:function(_121,_122){
_121=$(_121);
var _123=[];
while(_121=_121[_122]){
if(_121.nodeType==1){
_123.push(Element.extend(_121));
}
}
return _123;
},ancestors:function(_124){
return $(_124).recursivelyCollect("parentNode");
},descendants:function(_125){
return $A($(_125).getElementsByTagName("*"));
},immediateDescendants:function(_126){
if(!(_126=$(_126).firstChild)){
return [];
}
while(_126&&_126.nodeType!=1){
_126=_126.nextSibling;
}
if(_126){
return [_126].concat($(_126).nextSiblings());
}
return [];
},previousSiblings:function(_127){
return $(_127).recursivelyCollect("previousSibling");
},nextSiblings:function(_128){
return $(_128).recursivelyCollect("nextSibling");
},siblings:function(_129){
_129=$(_129);
return _129.previousSiblings().reverse().concat(_129.nextSiblings());
},match:function(_12a,_12b){
if(typeof _12b=="string"){
_12b=new Selector(_12b);
}
return _12b.match($(_12a));
},up:function(_12c,_12d,_12e){
return Selector.findElement($(_12c).ancestors(),_12d,_12e);
},down:function(_12f,_130,_131){
return Selector.findElement($(_12f).descendants(),_130,_131);
},previous:function(_132,_133,_134){
return Selector.findElement($(_132).previousSiblings(),_133,_134);
},next:function(_135,_136,_137){
return Selector.findElement($(_135).nextSiblings(),_136,_137);
},getElementsBySelector:function(){
var args=$A(arguments),_139=$(args.shift());
return Selector.findChildElements(_139,args);
},getElementsByClassName:function(_13a,_13b){
return document.getElementsByClassName(_13b,_13a);
},readAttribute:function(_13c,name){
_13c=$(_13c);
if(document.all&&!window.opera){
var t=Element._attributeTranslations;
if(t.values[name]){
return t.values[name](_13c,name);
}
if(t.names[name]){
name=t.names[name];
}
var _13f=_13c.attributes[name];
if(_13f){
return _13f.nodeValue;
}
}
return _13c.getAttribute(name);
},getHeight:function(_140){
return $(_140).getDimensions().height;
},getWidth:function(_141){
return $(_141).getDimensions().width;
},classNames:function(_142){
return new Element.ClassNames(_142);
},hasClassName:function(_143,_144){
if(!(_143=$(_143))){
return;
}
var _145=_143.className;
if(_145.length==0){
return false;
}
if(_145==_144||_145.match(new RegExp("(^|\\s)"+_144+"(\\s|$)"))){
return true;
}
return false;
},addClassName:function(_146,_147){
if(!(_146=$(_146))){
return;
}
Element.classNames(_146).add(_147);
return _146;
},removeClassName:function(_148,_149){
if(!(_148=$(_148))){
return;
}
Element.classNames(_148).remove(_149);
return _148;
},toggleClassName:function(_14a,_14b){
if(!(_14a=$(_14a))){
return;
}
Element.classNames(_14a)[_14a.hasClassName(_14b)?"remove":"add"](_14b);
return _14a;
},observe:function(){
Event.observe.apply(Event,arguments);
return $A(arguments).first();
},stopObserving:function(){
Event.stopObserving.apply(Event,arguments);
return $A(arguments).first();
},cleanWhitespace:function(_14c){
_14c=$(_14c);
var node=_14c.firstChild;
while(node){
var _14e=node.nextSibling;
if(node.nodeType==3&&!/\S/.test(node.nodeValue)){
_14c.removeChild(node);
}
node=_14e;
}
return _14c;
},empty:function(_14f){
return $(_14f).innerHTML.match(/^\s*$/);
},descendantOf:function(_150,_151){
_150=$(_150),_151=$(_151);
while(_150=_150.parentNode){
if(_150==_151){
return true;
}
}
return false;
},scrollTo:function(_152){
_152=$(_152);
var pos=Position.cumulativeOffset(_152);
window.scrollTo(pos[0],pos[1]);
return _152;
},getStyle:function(_154,_155){
_154=$(_154);
if(["float","cssFloat"].include(_155)){
_155=(typeof _154.style.styleFloat!="undefined"?"styleFloat":"cssFloat");
}
_155=_155.camelize();
var _156=_154.style[_155];
if(!_156){
if(document.defaultView&&document.defaultView.getComputedStyle){
var css=document.defaultView.getComputedStyle(_154,null);
_156=css?css[_155]:null;
}else{
if(_154.currentStyle){
_156=_154.currentStyle[_155];
}
}
}
if((_156=="auto")&&["width","height"].include(_155)&&(_154.getStyle("display")!="none")){
_156=_154["offset"+_155.capitalize()]+"px";
}
if(window.opera&&["left","top","right","bottom"].include(_155)){
if(Element.getStyle(_154,"position")=="static"){
_156="auto";
}
}
if(_155=="opacity"){
if(_156){
return parseFloat(_156);
}
if(_156=(_154.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){
if(_156[1]){
return parseFloat(_156[1])/100;
}
}
return 1;
}
return _156=="auto"?null:_156;
},setStyle:function(_158,_159){
_158=$(_158);
for(var name in _159){
var _15b=_159[name];
if(name=="opacity"){
if(_15b==1){
_15b=(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:1;
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
_158.style.filter=_158.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"");
}
}else{
if(_15b==""){
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
_158.style.filter=_158.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"");
}
}else{
if(_15b<0.00001){
_15b=0;
}
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
_158.style.filter=_158.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_15b*100+")";
}
}
}
}else{
if(["float","cssFloat"].include(name)){
name=(typeof _158.style.styleFloat!="undefined")?"styleFloat":"cssFloat";
}
}
_158.style[name.camelize()]=_15b;
}
return _158;
},getDimensions:function(_15c){
_15c=$(_15c);
var _15d=$(_15c).getStyle("display");
if(_15d!="none"&&_15d!=null){
return {width:_15c.offsetWidth,height:_15c.offsetHeight};
}
var els=_15c.style;
var _15f=els.visibility;
var _160=els.position;
var _161=els.display;
els.visibility="hidden";
els.position="absolute";
els.display="block";
var _162=_15c.clientWidth;
var _163=_15c.clientHeight;
els.display=_161;
els.position=_160;
els.visibility=_15f;
return {width:_162,height:_163};
},makePositioned:function(_164){
_164=$(_164);
var pos=Element.getStyle(_164,"position");
if(pos=="static"||!pos){
_164._madePositioned=true;
_164.style.position="relative";
if(window.opera){
_164.style.top=0;
_164.style.left=0;
}
}
return _164;
},undoPositioned:function(_166){
_166=$(_166);
if(_166._madePositioned){
_166._madePositioned=undefined;
_166.style.position=_166.style.top=_166.style.left=_166.style.bottom=_166.style.right="";
}
return _166;
},makeClipping:function(_167){
_167=$(_167);
if(_167._overflow){
return _167;
}
_167._overflow=_167.style.overflow||"auto";
if((Element.getStyle(_167,"overflow")||"visible")!="hidden"){
_167.style.overflow="hidden";
}
return _167;
},undoClipping:function(_168){
_168=$(_168);
if(!_168._overflow){
return _168;
}
_168.style.overflow=_168._overflow=="auto"?"":_168._overflow;
_168._overflow=null;
return _168;
}};
Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf});
Element._attributeTranslations={};
Element._attributeTranslations.names={colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"};
Element._attributeTranslations.values={_getAttr:function(_169,_16a){
return _169.getAttribute(_16a,2);
},_flag:function(_16b,_16c){
return $(_16b).hasAttribute(_16c)?_16c:null;
},style:function(_16d){
return _16d.style.cssText.toLowerCase();
},title:function(_16e){
var node=_16e.getAttributeNode("title");
return node.specified?node.nodeValue:null;
}};
Object.extend(Element._attributeTranslations.values,{href:Element._attributeTranslations.values._getAttr,src:Element._attributeTranslations.values._getAttr,disabled:Element._attributeTranslations.values._flag,checked:Element._attributeTranslations.values._flag,readonly:Element._attributeTranslations.values._flag,multiple:Element._attributeTranslations.values._flag});
Element.Methods.Simulated={hasAttribute:function(_170,_171){
var t=Element._attributeTranslations;
_171=t.names[_171]||_171;
return $(_170).getAttributeNode(_171).specified;
}};
if(document.all&&!window.opera){
Element.Methods.update=function(_173,html){
_173=$(_173);
html=typeof html=="undefined"?"":html.toString();
var _175=_173.tagName.toUpperCase();
if(["THEAD","TBODY","TR","TD"].include(_175)){
var div=document.createElement("div");
switch(_175){
case "THEAD":
case "TBODY":
div.innerHTML="<table><tbody>"+html.stripScripts()+"</tbody></table>";
depth=2;
break;
case "TR":
div.innerHTML="<table><tbody><tr>"+html.stripScripts()+"</tr></tbody></table>";
depth=3;
break;
case "TD":
div.innerHTML="<table><tbody><tr><td>"+html.stripScripts()+"</td></tr></tbody></table>";
depth=4;
}
$A(_173.childNodes).each(function(node){
_173.removeChild(node);
});
depth.times(function(){
div=div.firstChild;
});
$A(div.childNodes).each(function(node){
_173.appendChild(node);
});
}else{
_173.innerHTML=html.stripScripts();
}
setTimeout(function(){
html.evalScripts();
},10);
return _173;
};
}
Object.extend(Element,Element.Methods);
var _nativeExtensions=false;
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
["","Form","Input","TextArea","Select"].each(function(tag){
var _17a="HTML"+tag+"Element";
if(window[_17a]){
return;
}
var _17b=window[_17a]={};
_17b.prototype=document.createElement(tag?tag.toLowerCase():"div").__proto__;
});
}
Element.addMethods=function(_17c){
Object.extend(Element.Methods,_17c||{});
function copy(_17d,_17e,_17f){
_17f=_17f||false;
var _180=Element.extend.cache;
for(var _181 in _17d){
var _182=_17d[_181];
if(!_17f||!(_181 in _17e)){
_17e[_181]=_180.findOrStore(_182);
}
}
}
if(typeof HTMLElement!="undefined"){
copy(Element.Methods,HTMLElement.prototype);
copy(Element.Methods.Simulated,HTMLElement.prototype,true);
copy(Form.Methods,HTMLFormElement.prototype);
[HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement].each(function(_183){
copy(Form.Element.Methods,_183.prototype);
});
_nativeExtensions=true;
}
};
var Toggle=new Object();
Toggle.display=Element.toggle;
Abstract.Insertion=function(_184){
this.adjacency=_184;
};
Abstract.Insertion.prototype={initialize:function(_185,_186){
this.element=$(_185);
this.content=_186.stripScripts();
if(this.adjacency&&this.element.insertAdjacentHTML){
try{
this.element.insertAdjacentHTML(this.adjacency,this.content);
}
catch(e){
var _187=this.element.tagName.toUpperCase();
if(["TBODY","TR"].include(_187)){
this.insertContent(this.contentFromAnonymousTable());
}else{
throw e;
}
}
}else{
this.range=this.element.ownerDocument.createRange();
if(this.initializeRange){
this.initializeRange();
}
this.insertContent([this.range.createContextualFragment(this.content)]);
}
setTimeout(function(){
_186.evalScripts();
},10);
},contentFromAnonymousTable:function(){
var div=document.createElement("div");
div.innerHTML="<table><tbody>"+this.content+"</tbody></table>";
return $A(div.childNodes[0].childNodes[0].childNodes);
}};
var Insertion=new Object();
Insertion.Before=Class.create();
Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){
this.range.setStartBefore(this.element);
},insertContent:function(_189){
_189.each((function(_18a){
this.element.parentNode.insertBefore(_18a,this.element);
}).bind(this));
}});
Insertion.Top=Class.create();
Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){
this.range.selectNodeContents(this.element);
this.range.collapse(true);
},insertContent:function(_18b){
_18b.reverse(false).each((function(_18c){
this.element.insertBefore(_18c,this.element.firstChild);
}).bind(this));
}});
Insertion.Bottom=Class.create();
Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){
this.range.selectNodeContents(this.element);
this.range.collapse(this.element);
},insertContent:function(_18d){
_18d.each((function(_18e){
this.element.appendChild(_18e);
}).bind(this));
}});
Insertion.After=Class.create();
Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){
this.range.setStartAfter(this.element);
},insertContent:function(_18f){
_18f.each((function(_190){
this.element.parentNode.insertBefore(_190,this.element.nextSibling);
}).bind(this));
}});
Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(_191){
this.element=$(_191);
},_each:function(_192){
this.element.className.split(/\s+/).select(function(name){
return name.length>0;
})._each(_192);
},set:function(_194){
this.element.className=_194;
},add:function(_195){
if(this.include(_195)){
return;
}
this.set($A(this).concat(_195).join(" "));
},remove:function(_196){
if(!this.include(_196)){
return;
}
this.set($A(this).without(_196).join(" "));
},toString:function(){
return $A(this).join(" ");
}};
Object.extend(Element.ClassNames.prototype,Enumerable);
var Selector=Class.create();
Selector.prototype={initialize:function(_197){
this.params={classNames:[]};
this.expression=_197.toString().strip();
this.parseExpression();
this.compileMatcher();
},parseExpression:function(){
function abort(_198){
throw "Parse error in selector: "+_198;
}
if(this.expression==""){
abort("empty expression");
}
var _199=this.params,expr=this.expression,_19b,_19c,_19d,rest;
while(_19b=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){
_199.attributes=_199.attributes||[];
_199.attributes.push({name:_19b[2],operator:_19b[3],value:_19b[4]||_19b[5]||""});
expr=_19b[1];
}
if(expr=="*"){
return this.params.wildcard=true;
}
while(_19b=expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)){
_19c=_19b[1],_19d=_19b[2],rest=_19b[3];
switch(_19c){
case "#":
_199.id=_19d;
break;
case ".":
_199.classNames.push(_19d);
break;
case "":
case undefined:
_199.tagName=_19d.toUpperCase();
break;
default:
abort(expr.inspect());
}
expr=rest;
}
if(expr.length>0){
abort(expr.inspect());
}
},buildMatchExpression:function(){
var _19f=this.params,_1a0=[],_1a1;
if(_19f.wildcard){
_1a0.push("true");
}
if(_1a1=_19f.id){
_1a0.push("element.readAttribute(\"id\") == "+_1a1.inspect());
}
if(_1a1=_19f.tagName){
_1a0.push("element.tagName.toUpperCase() == "+_1a1.inspect());
}
if((_1a1=_19f.classNames).length>0){
for(var i=0,_1a3=_1a1.length;i<_1a3;i++){
_1a0.push("element.hasClassName("+_1a1[i].inspect()+")");
}
}
if(_1a1=_19f.attributes){
_1a1.each(function(_1a4){
var _1a5="element.readAttribute("+_1a4.name.inspect()+")";
var _1a6=function(_1a7){
return _1a5+" && "+_1a5+".split("+_1a7.inspect()+")";
};
switch(_1a4.operator){
case "=":
_1a0.push(_1a5+" == "+_1a4.value.inspect());
break;
case "~=":
_1a0.push(_1a6(" ")+".include("+_1a4.value.inspect()+")");
break;
case "|=":
_1a0.push(_1a6("-")+".first().toUpperCase() == "+_1a4.value.toUpperCase().inspect());
break;
case "!=":
_1a0.push(_1a5+" != "+_1a4.value.inspect());
break;
case "":
case undefined:
_1a0.push("element.hasAttribute("+_1a4.name.inspect()+")");
break;
default:
throw "Unknown operator "+_1a4.operator+" in selector";
}
});
}
return _1a0.join(" && ");
},compileMatcher:function(){
this.match=new Function("element","if (!element.tagName) return false;       element = $(element);       return "+this.buildMatchExpression());
},findElements:function(_1a8){
var _1a9;
if(_1a9=$(this.params.id)){
if(this.match(_1a9)){
if(!_1a8||Element.childOf(_1a9,_1a8)){
return [_1a9];
}
}
}
_1a8=(_1a8||document).getElementsByTagName(this.params.tagName||"*");
var _1aa=[];
for(var i=0,_1ac=_1a8.length;i<_1ac;i++){
if(this.match(_1a9=_1a8[i])){
_1aa.push(Element.extend(_1a9));
}
}
return _1aa;
},toString:function(){
return this.expression;
}};
Object.extend(Selector,{matchElements:function(_1ad,_1ae){
var _1af=new Selector(_1ae);
return _1ad.select(_1af.match.bind(_1af)).map(Element.extend);
},findElement:function(_1b0,_1b1,_1b2){
if(typeof _1b1=="number"){
_1b2=_1b1,_1b1=false;
}
return Selector.matchElements(_1b0,_1b1||"*")[_1b2||0];
},findChildElements:function(_1b3,_1b4){
return _1b4.map(function(_1b5){
return _1b5.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null],function(_1b6,expr){
var _1b8=new Selector(expr);
return _1b6.inject([],function(_1b9,_1ba){
return _1b9.concat(_1b8.findElements(_1ba||_1b3));
});
});
}).flatten();
}});
function $$(){
return Selector.findChildElements(document,$A(arguments));
}
var Form={reset:function(form){
$(form).reset();
return form;
},serializeElements:function(_1bc,_1bd){
var data=_1bc.inject({},function(_1bf,_1c0){
if(!_1c0.disabled&&_1c0.name){
var key=_1c0.name,_1c2=$(_1c0).getValue();
if(_1c2!=undefined){
if(_1bf[key]){
if(_1bf[key].constructor!=Array){
_1bf[key]=[_1bf[key]];
}
_1bf[key].push(_1c2);
}else{
_1bf[key]=_1c2;
}
}
}
return _1bf;
});
return _1bd?data:Hash.toQueryString(data);
}};
Form.Methods={serialize:function(form,_1c4){
return Form.serializeElements(Form.getElements(form),_1c4);
},getElements:function(form){
return $A($(form).getElementsByTagName("*")).inject([],function(_1c6,_1c7){
if(Form.Element.Serializers[_1c7.tagName.toLowerCase()]){
_1c6.push(Element.extend(_1c7));
}
return _1c6;
});
},getInputs:function(form,_1c9,name){
form=$(form);
var _1cb=form.getElementsByTagName("input");
if(!_1c9&&!name){
return $A(_1cb).map(Element.extend);
}
for(var i=0,_1cd=[],_1ce=_1cb.length;i<_1ce;i++){
var _1cf=_1cb[i];
if((_1c9&&_1cf.type!=_1c9)||(name&&_1cf.name!=name)){
continue;
}
_1cd.push(Element.extend(_1cf));
}
return _1cd;
},disable:function(form){
form=$(form);
form.getElements().each(function(_1d1){
_1d1.blur();
_1d1.disabled="true";
});
return form;
},enable:function(form){
form=$(form);
form.getElements().each(function(_1d3){
_1d3.disabled="";
});
return form;
},findFirstElement:function(form){
return $(form).getElements().find(function(_1d5){
return _1d5.type!="hidden"&&!_1d5.disabled&&["input","select","textarea"].include(_1d5.tagName.toLowerCase());
});
},focusFirstElement:function(form){
form=$(form);
form.findFirstElement().activate();
return form;
}};
Object.extend(Form,Form.Methods);
Form.Element={focus:function(_1d7){
$(_1d7).focus();
return _1d7;
},select:function(_1d8){
$(_1d8).select();
return _1d8;
}};
Form.Element.Methods={serialize:function(_1d9){
_1d9=$(_1d9);
if(!_1d9.disabled&&_1d9.name){
var _1da=_1d9.getValue();
if(_1da!=undefined){
var pair={};
pair[_1d9.name]=_1da;
return Hash.toQueryString(pair);
}
}
return "";
},getValue:function(_1dc){
_1dc=$(_1dc);
var _1dd=_1dc.tagName.toLowerCase();
return Form.Element.Serializers[_1dd](_1dc);
},clear:function(_1de){
$(_1de).value="";
return _1de;
},present:function(_1df){
return $(_1df).value!="";
},activate:function(_1e0){
_1e0=$(_1e0);
_1e0.focus();
if(_1e0.select&&(_1e0.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(_1e0.type))){
_1e0.select();
}
return _1e0;
},disable:function(_1e1){
_1e1=$(_1e1);
_1e1.disabled=true;
return _1e1;
},enable:function(_1e2){
_1e2=$(_1e2);
_1e2.blur();
_1e2.disabled=false;
return _1e2;
}};
Object.extend(Form.Element,Form.Element.Methods);
var Field=Form.Element;
var $F=Form.Element.getValue;
Form.Element.Serializers={input:function(_1e3){
switch(_1e3.type.toLowerCase()){
case "checkbox":
case "radio":
return Form.Element.Serializers.inputSelector(_1e3);
default:
return Form.Element.Serializers.textarea(_1e3);
}
},inputSelector:function(_1e4){
return _1e4.checked?_1e4.value:null;
},textarea:function(_1e5){
return _1e5.value;
},select:function(_1e6){
return this[_1e6.type=="select-one"?"selectOne":"selectMany"](_1e6);
},selectOne:function(_1e7){
var _1e8=_1e7.selectedIndex;
return _1e8>=0?this.optionValue(_1e7.options[_1e8]):null;
},selectMany:function(_1e9){
var _1ea,_1eb=_1e9.length;
if(!_1eb){
return null;
}
for(var i=0,_1ea=[];i<_1eb;i++){
var opt=_1e9.options[i];
if(opt.selected){
_1ea.push(this.optionValue(opt));
}
}
return _1ea;
},optionValue:function(opt){
return Element.extend(opt).hasAttribute("value")?opt.value:opt.text;
}};
Abstract.TimedObserver=function(){
};
Abstract.TimedObserver.prototype={initialize:function(_1ef,_1f0,_1f1){
this.frequency=_1f0;
this.element=$(_1ef);
this.callback=_1f1;
this.lastValue=this.getValue();
this.registerCallback();
},registerCallback:function(){
setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},onTimerEvent:function(){
var _1f2=this.getValue();
var _1f3=("string"==typeof this.lastValue&&"string"==typeof _1f2?this.lastValue!=_1f2:String(this.lastValue)!=String(_1f2));
if(_1f3){
this.callback(this.element,_1f2);
this.lastValue=_1f2;
}
}};
Form.Element.Observer=Class.create();
Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){
return Form.Element.getValue(this.element);
}});
Form.Observer=Class.create();
Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){
return Form.serialize(this.element);
}});
Abstract.EventObserver=function(){
};
Abstract.EventObserver.prototype={initialize:function(_1f4,_1f5){
this.element=$(_1f4);
this.callback=_1f5;
this.lastValue=this.getValue();
if(this.element.tagName.toLowerCase()=="form"){
this.registerFormCallbacks();
}else{
this.registerCallback(this.element);
}
},onElementEvent:function(){
var _1f6=this.getValue();
if(this.lastValue!=_1f6){
this.callback(this.element,_1f6);
this.lastValue=_1f6;
}
},registerFormCallbacks:function(){
Form.getElements(this.element).each(this.registerCallback.bind(this));
},registerCallback:function(_1f7){
if(_1f7.type){
switch(_1f7.type.toLowerCase()){
case "checkbox":
case "radio":
Event.observe(_1f7,"click",this.onElementEvent.bind(this));
break;
default:
Event.observe(_1f7,"change",this.onElementEvent.bind(this));
break;
}
}
}};
Form.Element.EventObserver=Class.create();
Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){
return Form.Element.getValue(this.element);
}});
Form.EventObserver=Class.create();
Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){
return Form.serialize(this.element);
}});
if(!window.Event){
var Event=new Object();
}
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(_1f8){
return _1f8.target||_1f8.srcElement;
},isLeftClick:function(_1f9){
return (((_1f9.which)&&(_1f9.which==1))||((_1f9.button)&&(_1f9.button==1)));
},pointerX:function(_1fa){
return _1fa.pageX||(_1fa.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));
},pointerY:function(_1fb){
return _1fb.pageY||(_1fb.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
},stop:function(_1fc){
if(_1fc.preventDefault){
_1fc.preventDefault();
_1fc.stopPropagation();
}else{
_1fc.returnValue=false;
_1fc.cancelBubble=true;
}
},findElement:function(_1fd,_1fe){
var _1ff=Event.element(_1fd);
while(_1ff.parentNode&&(!_1ff.tagName||(_1ff.tagName.toUpperCase()!=_1fe.toUpperCase()))){
_1ff=_1ff.parentNode;
}
return _1ff;
},observers:false,_observeAndCache:function(_200,name,_202,_203){
if(!this.observers){
this.observers=[];
}
if(_200.addEventListener){
this.observers.push([_200,name,_202,_203]);
_200.addEventListener(name,_202,_203);
}else{
if(_200.attachEvent){
this.observers.push([_200,name,_202,_203]);
_200.attachEvent("on"+name,_202);
}
}
},unloadCache:function(){
if(!Event.observers){
return;
}
for(var i=0,_205=Event.observers.length;i<_205;i++){
Event.stopObserving.apply(this,Event.observers[i]);
Event.observers[i][0]=null;
}
Event.observers=false;
},observe:function(_206,name,_208,_209){
_206=$(_206);
_209=_209||false;
if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_206.attachEvent)){
name="keydown";
}
Event._observeAndCache(_206,name,_208,_209);
},stopObserving:function(_20a,name,_20c,_20d){
_20a=$(_20a);
_20d=_20d||false;
if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_20a.detachEvent)){
name="keydown";
}
if(_20a.removeEventListener){
_20a.removeEventListener(name,_20c,_20d);
}else{
if(_20a.detachEvent){
try{
_20a.detachEvent("on"+name,_20c);
}
catch(e){
}
}
}
}});
if(navigator.appVersion.match(/\bMSIE\b/)){
Event.observe(window,"unload",Event.unloadCache,false);
}
var Position={includeScrollOffsets:false,prepare:function(){
this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;
},realOffset:function(_20e){
var _20f=0,_210=0;
do{
_20f+=_20e.scrollTop||0;
_210+=_20e.scrollLeft||0;
_20e=_20e.parentNode;
}while(_20e);
return [_210,_20f];
},cumulativeOffset:function(_211){
var _212=0,_213=0;
do{
_212+=_211.offsetTop||0;
_213+=_211.offsetLeft||0;
_211=_211.offsetParent;
}while(_211);
return [_213,_212];
},positionedOffset:function(_214){
var _215=0,_216=0;
do{
_215+=_214.offsetTop||0;
_216+=_214.offsetLeft||0;
_214=_214.offsetParent;
if(_214){
if(_214.tagName=="BODY"){
break;
}
var p=Element.getStyle(_214,"position");
if(p=="relative"||p=="absolute"){
break;
}
}
}while(_214);
return [_216,_215];
},offsetParent:function(_218){
if(_218.offsetParent){
return _218.offsetParent;
}
if(_218==document.body){
return _218;
}
while((_218=_218.parentNode)&&_218!=document.body){
if(Element.getStyle(_218,"position")!="static"){
return _218;
}
}
return document.body;
},within:function(_219,x,y){
if(this.includeScrollOffsets){
return this.withinIncludingScrolloffsets(_219,x,y);
}
this.xcomp=x;
this.ycomp=y;
this.offset=this.cumulativeOffset(_219);
return (y>=this.offset[1]&&y<this.offset[1]+_219.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+_219.offsetWidth);
},withinIncludingScrolloffsets:function(_21c,x,y){
var _21f=this.realOffset(_21c);
this.xcomp=x+_21f[0]-this.deltaX;
this.ycomp=y+_21f[1]-this.deltaY;
this.offset=this.cumulativeOffset(_21c);
return (this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+_21c.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+_21c.offsetWidth);
},overlap:function(mode,_221){
if(!mode){
return 0;
}
if(mode=="vertical"){
return ((this.offset[1]+_221.offsetHeight)-this.ycomp)/_221.offsetHeight;
}
if(mode=="horizontal"){
return ((this.offset[0]+_221.offsetWidth)-this.xcomp)/_221.offsetWidth;
}
},page:function(_222){
var _223=0,_224=0;
var _225=_222;
do{
_223+=_225.offsetTop||0;
_224+=_225.offsetLeft||0;
if(_225.offsetParent==document.body){
if(Element.getStyle(_225,"position")=="absolute"){
break;
}
}
}while(_225=_225.offsetParent);
_225=_222;
do{
if(!window.opera||_225.tagName=="BODY"){
_223-=_225.scrollTop||0;
_224-=_225.scrollLeft||0;
}
}while(_225=_225.parentNode);
return [_224,_223];
},clone:function(_226,_227){
var _228=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
_226=$(_226);
var p=Position.page(_226);
_227=$(_227);
var _22a=[0,0];
var _22b=null;
if(Element.getStyle(_227,"position")=="absolute"){
_22b=Position.offsetParent(_227);
_22a=Position.page(_22b);
}
if(_22b==document.body){
_22a[0]-=document.body.offsetLeft;
_22a[1]-=document.body.offsetTop;
}
if(_228.setLeft){
_227.style.left=(p[0]-_22a[0]+_228.offsetLeft)+"px";
}
if(_228.setTop){
_227.style.top=(p[1]-_22a[1]+_228.offsetTop)+"px";
}
if(_228.setWidth){
_227.style.width=_226.offsetWidth+"px";
}
if(_228.setHeight){
_227.style.height=_226.offsetHeight+"px";
}
},absolutize:function(_22c){
_22c=$(_22c);
if(_22c.style.position=="absolute"){
return;
}
Position.prepare();
var _22d=Position.positionedOffset(_22c);
var top=_22d[1];
var left=_22d[0];
var _230=_22c.clientWidth;
var _231=_22c.clientHeight;
_22c._originalLeft=left-parseFloat(_22c.style.left||0);
_22c._originalTop=top-parseFloat(_22c.style.top||0);
_22c._originalWidth=_22c.style.width;
_22c._originalHeight=_22c.style.height;
_22c.style.position="absolute";
_22c.style.top=top+"px";
_22c.style.left=left+"px";
_22c.style.width=_230+"px";
_22c.style.height=_231+"px";
},relativize:function(_232){
_232=$(_232);
if(_232.style.position=="relative"){
return;
}
Position.prepare();
_232.style.position="relative";
var top=parseFloat(_232.style.top||0)-(_232._originalTop||0);
var left=parseFloat(_232.style.left||0)-(_232._originalLeft||0);
_232.style.top=top+"px";
_232.style.left=left+"px";
_232.style.height=_232._originalHeight;
_232.style.width=_232._originalWidth;
}};
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
Position.cumulativeOffset=function(_235){
var _236=0,_237=0;
do{
_236+=_235.offsetTop||0;
_237+=_235.offsetLeft||0;
if(_235.offsetParent==document.body){
if(Element.getStyle(_235,"position")=="absolute"){
break;
}
}
_235=_235.offsetParent;
}while(_235);
return [_237,_236];
};
}
Element.addMethods();
var Scriptaculous={Version:"1.7.0",require:function(_238){
document.write("<script type=\"text/javascript\" src=\""+_238+"\"></script>");
},load:function(){
if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1])<1.5){
throw ("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
}
$A(document.getElementsByTagName("script")).findAll(function(s){
return (s.src&&s.src.match(/scriptaculous\.js(\?.*)?$/));
}).each(function(s){
var path=s.src.replace(/scriptaculous\.js(\?.*)?$/,"");
var _23c=s.src.match(/\?.*load=([a-z,]*)/);
(_23c?_23c[1]:"builder,effects,dragdrop,controls,slider").split(",").each(function(_23d){
Scriptaculous.require(path+_23d+".js");
});
});
}};
Scriptaculous.load();
String.prototype.parseColor=function(){
var _23e="#";
if(this.slice(0,4)=="rgb("){
var cols=this.slice(4,this.length-1).split(",");
var i=0;
do{
_23e+=parseInt(cols[i]).toColorPart();
}while(++i<3);
}else{
if(this.slice(0,1)=="#"){
if(this.length==4){
for(var i=1;i<4;i++){
_23e+=(this.charAt(i)+this.charAt(i)).toLowerCase();
}
}
if(this.length==7){
_23e=this.toLowerCase();
}
}
}
return (_23e.length==7?_23e:(arguments[0]||this));
};
Element.collectTextNodes=function(_241){
return $A($(_241).childNodes).collect(function(node){
return (node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):""));
}).flatten().join("");
};
Element.collectTextNodesIgnoreClass=function(_243,_244){
return $A($(_243).childNodes).collect(function(node){
return (node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,_244))?Element.collectTextNodesIgnoreClass(node,_244):""));
}).flatten().join("");
};
Element.setContentZoom=function(_246,_247){
_246=$(_246);
_246.setStyle({fontSize:(_247/100)+"em"});
if(navigator.appVersion.indexOf("AppleWebKit")>0){
window.scrollBy(0,0);
}
return _246;
};
Element.getOpacity=function(_248){
return $(_248).getStyle("opacity");
};
Element.setOpacity=function(_249,_24a){
return $(_249).setStyle({opacity:_24a});
};
Element.getInlineOpacity=function(_24b){
return $(_24b).style.opacity||"";
};
Element.forceRerendering=function(_24c){
try{
_24c=$(_24c);
var n=document.createTextNode(" ");
_24c.appendChild(n);
_24c.removeChild(n);
}
catch(e){
}
};
Array.prototype.call=function(){
var args=arguments;
this.each(function(f){
f.apply(this,args);
});
};
var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},tagifyText:function(_250){
if(typeof Builder=="undefined"){
throw ("Effect.tagifyText requires including script.aculo.us' builder.js library");
}
var _251="position:relative";
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
_251+=";zoom:1";
}
_250=$(_250);
$A(_250.childNodes).each(function(_252){
if(_252.nodeType==3){
_252.nodeValue.toArray().each(function(_253){
_250.insertBefore(Builder.node("span",{style:_251},_253==" "?String.fromCharCode(160):_253),_252);
});
Element.remove(_252);
}
});
},multiple:function(_254,_255){
var _256;
if(((typeof _254=="object")||(typeof _254=="function"))&&(_254.length)){
_256=_254;
}else{
_256=$(_254).childNodes;
}
var _257=Object.extend({speed:0.1,delay:0},arguments[2]||{});
var _258=_257.delay;
$A(_256).each(function(_259,_25a){
new _255(_259,Object.extend(_257,{delay:_25a*_257.speed+_258}));
});
},PAIRS:{"slide":["SlideDown","SlideUp"],"blind":["BlindDown","BlindUp"],"appear":["Appear","Fade"]},toggle:function(_25b,_25c){
_25b=$(_25b);
_25c=(_25c||"appear").toLowerCase();
var _25d=Object.extend({queue:{position:"end",scope:(_25b.id||"global"),limit:1}},arguments[2]||{});
Effect[_25b.visible()?Effect.PAIRS[_25c][1]:Effect.PAIRS[_25c][0]](_25b,_25d);
}};
var Effect2=Effect;
Effect.Transitions={linear:Prototype.K,sinoidal:function(pos){
return (-Math.cos(pos*Math.PI)/2)+0.5;
},reverse:function(pos){
return 1-pos;
},flicker:function(pos){
return ((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;
},wobble:function(pos){
return (-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;
},pulse:function(pos,_263){
_263=_263||5;
return (Math.round((pos%(1/_263))*_263)==0?((pos*_263*2)-Math.floor(pos*_263*2)):1-((pos*_263*2)-Math.floor(pos*_263*2)));
},none:function(pos){
return 0;
},full:function(pos){
return 1;
}};
Effect.ScopedQueue=Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize:function(){
this.effects=[];
this.interval=null;
},_each:function(_266){
this.effects._each(_266);
},add:function(_267){
var _268=new Date().getTime();
var _269=(typeof _267.options.queue=="string")?_267.options.queue:_267.options.queue.position;
switch(_269){
case "front":
this.effects.findAll(function(e){
return e.state=="idle";
}).each(function(e){
e.startOn+=_267.finishOn;
e.finishOn+=_267.finishOn;
});
break;
case "with-last":
_268=this.effects.pluck("startOn").max()||_268;
break;
case "end":
_268=this.effects.pluck("finishOn").max()||_268;
break;
}
_267.startOn+=_268;
_267.finishOn+=_268;
if(!_267.options.queue.limit||(this.effects.length<_267.options.queue.limit)){
this.effects.push(_267);
}
if(!this.interval){
this.interval=setInterval(this.loop.bind(this),15);
}
},remove:function(_26c){
this.effects=this.effects.reject(function(e){
return e==_26c;
});
if(this.effects.length==0){
clearInterval(this.interval);
this.interval=null;
}
},loop:function(){
var _26e=new Date().getTime();
for(var i=0,len=this.effects.length;i<len;i++){
if(this.effects[i]){
this.effects[i].loop(_26e);
}
}
}});
Effect.Queues={instances:$H(),get:function(_271){
if(typeof _271!="string"){
return _271;
}
if(!this.instances[_271]){
this.instances[_271]=new Effect.ScopedQueue();
}
return this.instances[_271];
}};
Effect.Queue=Effect.Queues.get("global");
Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1,fps:60,sync:false,from:0,to:1,delay:0,queue:"parallel"};
Effect.Base=function(){
};
Effect.Base.prototype={position:null,start:function(_272){
this.options=Object.extend(Object.extend({},Effect.DefaultOptions),_272||{});
this.currentFrame=0;
this.state="idle";
this.startOn=this.options.delay*1000;
this.finishOn=this.startOn+(this.options.duration*1000);
this.event("beforeStart");
if(!this.options.sync){
Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).add(this);
}
},loop:function(_273){
if(_273>=this.startOn){
if(_273>=this.finishOn){
this.render(1);
this.cancel();
this.event("beforeFinish");
if(this.finish){
this.finish();
}
this.event("afterFinish");
return;
}
var pos=(_273-this.startOn)/(this.finishOn-this.startOn);
var _275=Math.round(pos*this.options.fps*this.options.duration);
if(_275>this.currentFrame){
this.render(pos);
this.currentFrame=_275;
}
}
},render:function(pos){
if(this.state=="idle"){
this.state="running";
this.event("beforeSetup");
if(this.setup){
this.setup();
}
this.event("afterSetup");
}
if(this.state=="running"){
if(this.options.transition){
pos=this.options.transition(pos);
}
pos*=(this.options.to-this.options.from);
pos+=this.options.from;
this.position=pos;
this.event("beforeUpdate");
if(this.update){
this.update(pos);
}
this.event("afterUpdate");
}
},cancel:function(){
if(!this.options.sync){
Effect.Queues.get(typeof this.options.queue=="string"?"global":this.options.queue.scope).remove(this);
}
this.state="finished";
},event:function(_277){
if(this.options[_277+"Internal"]){
this.options[_277+"Internal"](this);
}
if(this.options[_277]){
this.options[_277](this);
}
},inspect:function(){
var data=$H();
for(property in this){
if(typeof this[property]!="function"){
data[property]=this[property];
}
}
return "#<Effect:"+data.inspect()+",options:"+$H(this.options).inspect()+">";
}};
Effect.Parallel=Class.create();
Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize:function(_279){
this.effects=_279||[];
this.start(arguments[1]);
},update:function(_27a){
this.effects.invoke("render",_27a);
},finish:function(_27b){
this.effects.each(function(_27c){
_27c.render(1);
_27c.cancel();
_27c.event("beforeFinish");
if(_27c.finish){
_27c.finish(_27b);
}
_27c.event("afterFinish");
});
}});
Effect.Event=Class.create();
Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize:function(){
var _27d=Object.extend({duration:0},arguments[0]||{});
this.start(_27d);
},update:Prototype.emptyFunction});
Effect.Opacity=Class.create();
Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(_27e){
this.element=$(_27e);
if(!this.element){
throw (Effect._elementDoesNotExistError);
}
if(/MSIE/.test(navigator.userAgent)&&!window.opera&&(!this.element.currentStyle.hasLayout)){
this.element.setStyle({zoom:1});
}
var _27f=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});
this.start(_27f);
},update:function(_280){
this.element.setOpacity(_280);
}});
Effect.Move=Class.create();
Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize:function(_281){
this.element=$(_281);
if(!this.element){
throw (Effect._elementDoesNotExistError);
}
var _282=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});
this.start(_282);
},setup:function(){
this.element.makePositioned();
this.originalLeft=parseFloat(this.element.getStyle("left")||"0");
this.originalTop=parseFloat(this.element.getStyle("top")||"0");
if(this.options.mode=="absolute"){
this.options.x=this.options.x-this.originalLeft;
this.options.y=this.options.y-this.originalTop;
}
},update:function(_283){
this.element.setStyle({left:Math.round(this.options.x*_283+this.originalLeft)+"px",top:Math.round(this.options.y*_283+this.originalTop)+"px"});
}});
Effect.MoveBy=function(_284,_285,_286){
return new Effect.Move(_284,Object.extend({x:_286,y:_285},arguments[3]||{}));
};
Effect.Scale=Class.create();
Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(_287,_288){
this.element=$(_287);
if(!this.element){
throw (Effect._elementDoesNotExistError);
}
var _289=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_288},arguments[2]||{});
this.start(_289);
},setup:function(){
this.restoreAfterFinish=this.options.restoreAfterFinish||false;
this.elementPositioning=this.element.getStyle("position");
this.originalStyle={};
["top","left","width","height","fontSize"].each(function(k){
this.originalStyle[k]=this.element.style[k];
}.bind(this));
this.originalTop=this.element.offsetTop;
this.originalLeft=this.element.offsetLeft;
var _28b=this.element.getStyle("font-size")||"100%";
["em","px","%","pt"].each(function(_28c){
if(_28b.indexOf(_28c)>0){
this.fontSize=parseFloat(_28b);
this.fontSizeType=_28c;
}
}.bind(this));
this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;
this.dims=null;
if(this.options.scaleMode=="box"){
this.dims=[this.element.offsetHeight,this.element.offsetWidth];
}
if(/^content/.test(this.options.scaleMode)){
this.dims=[this.element.scrollHeight,this.element.scrollWidth];
}
if(!this.dims){
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];
}
},update:function(_28d){
var _28e=(this.options.scaleFrom/100)+(this.factor*_28d);
if(this.options.scaleContent&&this.fontSize){
this.element.setStyle({fontSize:this.fontSize*_28e+this.fontSizeType});
}
this.setDimensions(this.dims[0]*_28e,this.dims[1]*_28e);
},finish:function(_28f){
if(this.restoreAfterFinish){
this.element.setStyle(this.originalStyle);
}
},setDimensions:function(_290,_291){
var d={};
if(this.options.scaleX){
d.width=Math.round(_291)+"px";
}
if(this.options.scaleY){
d.height=Math.round(_290)+"px";
}
if(this.options.scaleFromCenter){
var topd=(_290-this.dims[0])/2;
var _294=(_291-this.dims[1])/2;
if(this.elementPositioning=="absolute"){
if(this.options.scaleY){
d.top=this.originalTop-topd+"px";
}
if(this.options.scaleX){
d.left=this.originalLeft-_294+"px";
}
}else{
if(this.options.scaleY){
d.top=-topd+"px";
}
if(this.options.scaleX){
d.left=-_294+"px";
}
}
}
this.element.setStyle(d);
}});
Effect.Highlight=Class.create();
Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(_295){
this.element=$(_295);
if(!this.element){
throw (Effect._elementDoesNotExistError);
}
var _296=Object.extend({startcolor:"#ffff99"},arguments[1]||{});
this.start(_296);
},setup:function(){
if(this.element.getStyle("display")=="none"){
this.cancel();
return;
}
this.oldStyle={};
if(!this.options.keepBackgroundImage){
this.oldStyle.backgroundImage=this.element.getStyle("background-image");
this.element.setStyle({backgroundImage:"none"});
}
if(!this.options.endcolor){
this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff");
}
if(!this.options.restorecolor){
this.options.restorecolor=this.element.getStyle("background-color");
}
this._base=$R(0,2).map(function(i){
return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16);
}.bind(this));
this._delta=$R(0,2).map(function(i){
return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i];
}.bind(this));
},update:function(_299){
this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(m,v,i){
return m+(Math.round(this._base[i]+(this._delta[i]*_299)).toColorPart());
}.bind(this))});
},finish:function(){
this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));
}});
Effect.ScrollTo=Class.create();
Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(_29d){
this.element=$(_29d);
this.start(arguments[1]||{});
},setup:function(){
Position.prepare();
var _29e=Position.cumulativeOffset(this.element);
if(this.options.offset){
_29e[1]+=this.options.offset;
}
var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);
this.scrollStart=Position.deltaY;
this.delta=(_29e[1]>max?max:_29e[1])-this.scrollStart;
},update:function(_2a0){
Position.prepare();
window.scrollTo(Position.deltaX,this.scrollStart+(_2a0*this.delta));
}});
Effect.Fade=function(_2a1){
_2a1=$(_2a1);
var _2a2=_2a1.getInlineOpacity();
var _2a3=Object.extend({from:_2a1.getOpacity()||1,to:0,afterFinishInternal:function(_2a4){
if(_2a4.options.to!=0){
return;
}
_2a4.element.hide().setStyle({opacity:_2a2});
}},arguments[1]||{});
return new Effect.Opacity(_2a1,_2a3);
};
Effect.Appear=function(_2a5){
_2a5=$(_2a5);
var _2a6=Object.extend({from:(_2a5.getStyle("display")=="none"?0:_2a5.getOpacity()||0),to:1,afterFinishInternal:function(_2a7){
_2a7.element.forceRerendering();
},beforeSetup:function(_2a8){
_2a8.element.setOpacity(_2a8.options.from).show();
}},arguments[1]||{});
return new Effect.Opacity(_2a5,_2a6);
};
Effect.Puff=function(_2a9){
_2a9=$(_2a9);
var _2aa={opacity:_2a9.getInlineOpacity(),position:_2a9.getStyle("position"),top:_2a9.style.top,left:_2a9.style.left,width:_2a9.style.width,height:_2a9.style.height};
return new Effect.Parallel([new Effect.Scale(_2a9,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(_2a9,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(_2ab){
Position.absolutize(_2ab.effects[0].element);
},afterFinishInternal:function(_2ac){
_2ac.effects[0].element.hide().setStyle(_2aa);
}},arguments[1]||{}));
};
Effect.BlindUp=function(_2ad){
_2ad=$(_2ad);
_2ad.makeClipping();
return new Effect.Scale(_2ad,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_2ae){
_2ae.element.hide().undoClipping();
}},arguments[1]||{}));
};
Effect.BlindDown=function(_2af){
_2af=$(_2af);
var _2b0=_2af.getDimensions();
return new Effect.Scale(_2af,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_2b0.height,originalWidth:_2b0.width},restoreAfterFinish:true,afterSetup:function(_2b1){
_2b1.element.makeClipping().setStyle({height:"0px"}).show();
},afterFinishInternal:function(_2b2){
_2b2.element.undoClipping();
}},arguments[1]||{}));
};
Effect.SwitchOff=function(_2b3){
_2b3=$(_2b3);
var _2b4=_2b3.getInlineOpacity();
return new Effect.Appear(_2b3,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(_2b5){
new Effect.Scale(_2b5.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(_2b6){
_2b6.element.makePositioned().makeClipping();
},afterFinishInternal:function(_2b7){
_2b7.element.hide().undoClipping().undoPositioned().setStyle({opacity:_2b4});
}});
}},arguments[1]||{}));
};
Effect.DropOut=function(_2b8){
_2b8=$(_2b8);
var _2b9={top:_2b8.getStyle("top"),left:_2b8.getStyle("left"),opacity:_2b8.getInlineOpacity()};
return new Effect.Parallel([new Effect.Move(_2b8,{x:0,y:100,sync:true}),new Effect.Opacity(_2b8,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(_2ba){
_2ba.effects[0].element.makePositioned();
},afterFinishInternal:function(_2bb){
_2bb.effects[0].element.hide().undoPositioned().setStyle(_2b9);
}},arguments[1]||{}));
};
Effect.Shake=function(_2bc){
_2bc=$(_2bc);
var _2bd={top:_2bc.getStyle("top"),left:_2bc.getStyle("left")};
return new Effect.Move(_2bc,{x:20,y:0,duration:0.05,afterFinishInternal:function(_2be){
new Effect.Move(_2be.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_2bf){
new Effect.Move(_2bf.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_2c0){
new Effect.Move(_2c0.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_2c1){
new Effect.Move(_2c1.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_2c2){
new Effect.Move(_2c2.element,{x:-20,y:0,duration:0.05,afterFinishInternal:function(_2c3){
_2c3.element.undoPositioned().setStyle(_2bd);
}});
}});
}});
}});
}});
}});
};
Effect.SlideDown=function(_2c4){
_2c4=$(_2c4).cleanWhitespace();
var _2c5=_2c4.down().getStyle("bottom");
var _2c6=_2c4.getDimensions();
return new Effect.Scale(_2c4,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:_2c6.height,originalWidth:_2c6.width},restoreAfterFinish:true,afterSetup:function(_2c7){
_2c7.element.makePositioned();
_2c7.element.down().makePositioned();
if(window.opera){
_2c7.element.setStyle({top:""});
}
_2c7.element.makeClipping().setStyle({height:"0px"}).show();
},afterUpdateInternal:function(_2c8){
_2c8.element.down().setStyle({bottom:(_2c8.dims[0]-_2c8.element.clientHeight)+"px"});
},afterFinishInternal:function(_2c9){
_2c9.element.undoClipping().undoPositioned();
_2c9.element.down().undoPositioned().setStyle({bottom:_2c5});
}},arguments[1]||{}));
};
Effect.SlideUp=function(_2ca){
_2ca=$(_2ca).cleanWhitespace();
var _2cb=_2ca.down().getStyle("bottom");
return new Effect.Scale(_2ca,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_2cc){
_2cc.element.makePositioned();
_2cc.element.down().makePositioned();
if(window.opera){
_2cc.element.setStyle({top:""});
}
_2cc.element.makeClipping().show();
},afterUpdateInternal:function(_2cd){
_2cd.element.down().setStyle({bottom:(_2cd.dims[0]-_2cd.element.clientHeight)+"px"});
},afterFinishInternal:function(_2ce){
_2ce.element.hide().undoClipping().undoPositioned().setStyle({bottom:_2cb});
_2ce.element.down().undoPositioned();
}},arguments[1]||{}));
};
Effect.Squish=function(_2cf){
return new Effect.Scale(_2cf,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(_2d0){
_2d0.element.makeClipping();
},afterFinishInternal:function(_2d1){
_2d1.element.hide().undoClipping();
}});
};
Effect.Grow=function(_2d2){
_2d2=$(_2d2);
var _2d3=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});
var _2d4={top:_2d2.style.top,left:_2d2.style.left,height:_2d2.style.height,width:_2d2.style.width,opacity:_2d2.getInlineOpacity()};
var dims=_2d2.getDimensions();
var _2d6,_2d7;
var _2d8,_2d9;
switch(_2d3.direction){
case "top-left":
_2d6=_2d7=_2d8=_2d9=0;
break;
case "top-right":
_2d6=dims.width;
_2d7=_2d9=0;
_2d8=-dims.width;
break;
case "bottom-left":
_2d6=_2d8=0;
_2d7=dims.height;
_2d9=-dims.height;
break;
case "bottom-right":
_2d6=dims.width;
_2d7=dims.height;
_2d8=-dims.width;
_2d9=-dims.height;
break;
case "center":
_2d6=dims.width/2;
_2d7=dims.height/2;
_2d8=-dims.width/2;
_2d9=-dims.height/2;
break;
}
return new Effect.Move(_2d2,{x:_2d6,y:_2d7,duration:0.01,beforeSetup:function(_2da){
_2da.element.hide().makeClipping().makePositioned();
},afterFinishInternal:function(_2db){
new Effect.Parallel([new Effect.Opacity(_2db.element,{sync:true,to:1,from:0,transition:_2d3.opacityTransition}),new Effect.Move(_2db.element,{x:_2d8,y:_2d9,sync:true,transition:_2d3.moveTransition}),new Effect.Scale(_2db.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:_2d3.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(_2dc){
_2dc.effects[0].element.setStyle({height:"0px"}).show();
},afterFinishInternal:function(_2dd){
_2dd.effects[0].element.undoClipping().undoPositioned().setStyle(_2d4);
}},_2d3));
}});
};
Effect.Shrink=function(_2de){
_2de=$(_2de);
var _2df=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});
var _2e0={top:_2de.style.top,left:_2de.style.left,height:_2de.style.height,width:_2de.style.width,opacity:_2de.getInlineOpacity()};
var dims=_2de.getDimensions();
var _2e2,_2e3;
switch(_2df.direction){
case "top-left":
_2e2=_2e3=0;
break;
case "top-right":
_2e2=dims.width;
_2e3=0;
break;
case "bottom-left":
_2e2=0;
_2e3=dims.height;
break;
case "bottom-right":
_2e2=dims.width;
_2e3=dims.height;
break;
case "center":
_2e2=dims.width/2;
_2e3=dims.height/2;
break;
}
return new Effect.Parallel([new Effect.Opacity(_2de,{sync:true,to:0,from:1,transition:_2df.opacityTransition}),new Effect.Scale(_2de,window.opera?1:0,{sync:true,transition:_2df.scaleTransition,restoreAfterFinish:true}),new Effect.Move(_2de,{x:_2e2,y:_2e3,sync:true,transition:_2df.moveTransition})],Object.extend({beforeStartInternal:function(_2e4){
_2e4.effects[0].element.makePositioned().makeClipping();
},afterFinishInternal:function(_2e5){
_2e5.effects[0].element.hide().undoClipping().undoPositioned().setStyle(_2e0);
}},_2df));
};
Effect.Pulsate=function(_2e6){
_2e6=$(_2e6);
var _2e7=arguments[1]||{};
var _2e8=_2e6.getInlineOpacity();
var _2e9=_2e7.transition||Effect.Transitions.sinoidal;
var _2ea=function(pos){
return _2e9(1-Effect.Transitions.pulse(pos,_2e7.pulses));
};
_2ea.bind(_2e9);
return new Effect.Opacity(_2e6,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(_2ec){
_2ec.element.setStyle({opacity:_2e8});
}},_2e7),{transition:_2ea}));
};
Effect.Fold=function(_2ed){
_2ed=$(_2ed);
var _2ee={top:_2ed.style.top,left:_2ed.style.left,width:_2ed.style.width,height:_2ed.style.height};
_2ed.makeClipping();
return new Effect.Scale(_2ed,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(_2ef){
new Effect.Scale(_2ed,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_2f0){
_2f0.element.hide().undoClipping().setStyle(_2ee);
}});
}},arguments[1]||{}));
};
Effect.Morph=Class.create();
Object.extend(Object.extend(Effect.Morph.prototype,Effect.Base.prototype),{initialize:function(_2f1){
this.element=$(_2f1);
if(!this.element){
throw (Effect._elementDoesNotExistError);
}
var _2f2=Object.extend({style:{}},arguments[1]||{});
if(typeof _2f2.style=="string"){
if(_2f2.style.indexOf(":")==-1){
var _2f3="",_2f4="."+_2f2.style;
$A(document.styleSheets).reverse().each(function(_2f5){
if(_2f5.cssRules){
cssRules=_2f5.cssRules;
}else{
if(_2f5.rules){
cssRules=_2f5.rules;
}
}
$A(cssRules).reverse().each(function(rule){
if(_2f4==rule.selectorText){
_2f3=rule.style.cssText;
throw $break;
}
});
if(_2f3){
throw $break;
}
});
this.style=_2f3.parseStyle();
_2f2.afterFinishInternal=function(_2f7){
_2f7.element.addClassName(_2f7.options.style);
_2f7.transforms.each(function(_2f8){
if(_2f8.style!="opacity"){
_2f7.element.style[_2f8.style.camelize()]="";
}
});
};
}else{
this.style=_2f2.style.parseStyle();
}
}else{
this.style=$H(_2f2.style);
}
this.start(_2f2);
},setup:function(){
function parseColor(_2f9){
if(!_2f9||["rgba(0, 0, 0, 0)","transparent"].include(_2f9)){
_2f9="#ffffff";
}
_2f9=_2f9.parseColor();
return $R(0,2).map(function(i){
return parseInt(_2f9.slice(i*2+1,i*2+3),16);
});
}
this.transforms=this.style.map(function(pair){
var _2fc=pair[0].underscore().dasherize(),_2fd=pair[1],unit=null;
if(_2fd.parseColor("#zzzzzz")!="#zzzzzz"){
_2fd=_2fd.parseColor();
unit="color";
}else{
if(_2fc=="opacity"){
_2fd=parseFloat(_2fd);
if(/MSIE/.test(navigator.userAgent)&&!window.opera&&(!this.element.currentStyle.hasLayout)){
this.element.setStyle({zoom:1});
}
}else{
if(Element.CSS_LENGTH.test(_2fd)){
var _2ff=_2fd.match(/^([\+\-]?[0-9\.]+)(.*)$/),_2fd=parseFloat(_2ff[1]),unit=(_2ff.length==3)?_2ff[2]:null;
}
}
}
var _300=this.element.getStyle(_2fc);
return $H({style:_2fc,originalValue:unit=="color"?parseColor(_300):parseFloat(_300||0),targetValue:unit=="color"?parseColor(_2fd):_2fd,unit:unit});
}.bind(this)).reject(function(_301){
return ((_301.originalValue==_301.targetValue)||(_301.unit!="color"&&(isNaN(_301.originalValue)||isNaN(_301.targetValue))));
});
},update:function(_302){
var _303=$H(),_304=null;
this.transforms.each(function(_305){
_304=_305.unit=="color"?$R(0,2).inject("#",function(m,v,i){
return m+(Math.round(_305.originalValue[i]+(_305.targetValue[i]-_305.originalValue[i])*_302)).toColorPart();
}):_305.originalValue+Math.round(((_305.targetValue-_305.originalValue)*_302)*1000)/1000+_305.unit;
_303[_305.style]=_304;
});
this.element.setStyle(_303);
}});
Effect.Transform=Class.create();
Object.extend(Effect.Transform.prototype,{initialize:function(_309){
this.tracks=[];
this.options=arguments[1]||{};
this.addTracks(_309);
},addTracks:function(_30a){
_30a.each(function(_30b){
var data=$H(_30b).values().first();
this.tracks.push($H({ids:$H(_30b).keys().first(),effect:Effect.Morph,options:{style:data}}));
}.bind(this));
return this;
},play:function(){
return new Effect.Parallel(this.tracks.map(function(_30d){
var _30e=[$(_30d.ids)||$$(_30d.ids)].flatten();
return _30e.map(function(e){
return new _30d.effect(e,Object.extend({sync:true},_30d.options));
});
}).flatten(),this.options);
}});
Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle "+"borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth "+"borderRightColor borderRightStyle borderRightWidth borderSpacing "+"borderTopColor borderTopStyle borderTopWidth bottom clip color "+"fontSize fontWeight height left letterSpacing lineHeight "+"marginBottom marginLeft marginRight marginTop markerOffset maxHeight "+"maxWidth minHeight minWidth opacity outlineColor outlineOffset "+"outlineWidth paddingBottom paddingLeft paddingRight paddingTop "+"right textIndent top width wordSpacing zIndex");
Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
String.prototype.parseStyle=function(){
var _310=Element.extend(document.createElement("div"));
_310.innerHTML="<div style=\""+this+"\"></div>";
var _311=_310.down().style,_312=$H();
Element.CSS_PROPERTIES.each(function(_313){
if(_311[_313]){
_312[_313]=_311[_313];
}
});
if(/MSIE/.test(navigator.userAgent)&&!window.opera&&this.indexOf("opacity")>-1){
_312.opacity=this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
}
return _312;
};
Element.morph=function(_314,_315){
new Effect.Morph(_314,Object.extend({style:_315},arguments[2]||{}));
return _314;
};
["setOpacity","getOpacity","getInlineOpacity","forceRerendering","setContentZoom","collectTextNodes","collectTextNodesIgnoreClass","morph"].each(function(f){
Element.Methods[f]=Element[f];
});
Element.Methods.visualEffect=function(_317,_318,_319){
s=_318.gsub(/_/,"-").camelize();
effect_class=s.charAt(0).toUpperCase()+s.substring(1);
new Effect[effect_class](_317,_319);
return $(_317);
};
Effect.SlideRightIntoView=function(_31a){
$(_31a).style.width="0px";
$(_31a).style.overflow="hidden";
Element.show(_31a);
new Effect.Scale(_31a,100,Object.extend(arguments[1]||{},{scaleContent:false,scaleY:false,scaleMode:"contents",scaleFrom:0,afterUpdate:function(_31b){
}}));
};
Effect.SlideRightOutOfView=function(_31c){
$(_31c).style.overflow="hidden";
Element.show(_31c);
new Effect.Scale(_31c,0,Object.extend(arguments[1]||{},{scaleContent:false,scaleY:false,afterUpdate:function(_31d){
},afterFinish:function(_31e){
Element.hide(_31e.element);
}}));
};
Effect.SlideLeftAndRight=function(_31f){
_31f=$(_31f);
if(Element.visible(_31f)){
new Effect.SlideRightOutOfView(_31f);
}else{
new Effect.SlideRightIntoView(_31f);
}
};
Element.addMethods();
if(typeof Effect=="undefined"){
throw ("dragdrop.js requires including script.aculo.us' effects.js library");
}
var Droppables={drops:[],remove:function(_320){
this.drops=this.drops.reject(function(d){
return d.element==$(_320);
});
},add:function(_322){
_322=$(_322);
var _323=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});
if(_323.containment){
_323._containers=[];
var _324=_323.containment;
if((typeof _324=="object")&&(_324.constructor==Array)){
_324.each(function(c){
_323._containers.push($(c));
});
}else{
_323._containers.push($(_324));
}
}
if(_323.accept){
_323.accept=[_323.accept].flatten();
}
Element.makePositioned(_322);
_323.element=_322;
this.drops.push(_323);
},findDeepestChild:function(_326){
deepest=_326[0];
for(i=1;i<_326.length;++i){
if(Element.isParent(_326[i].element,deepest.element)){
deepest=_326[i];
}
}
return deepest;
},isContained:function(_327,drop){
var _329;
if(drop.tree){
_329=_327.treeNode;
}else{
_329=_327.parentNode;
}
return drop._containers.detect(function(c){
return _329==c;
});
},isAffected:function(_32b,_32c,drop){
return ((drop.element!=_32c)&&((!drop._containers)||this.isContained(_32c,drop))&&((!drop.accept)||(Element.classNames(_32c).detect(function(v){
return drop.accept.include(v);
})))&&Position.within(drop.element,_32b[0],_32b[1]));
},deactivate:function(drop){
if(drop.hoverclass){
Element.removeClassName(drop.element,drop.hoverclass);
}
this.last_active=null;
},activate:function(drop){
if(drop.hoverclass){
Element.addClassName(drop.element,drop.hoverclass);
}
this.last_active=drop;
},show:function(_331,_332){
if(!this.drops.length){
return;
}
var _333=[];
if(this.last_active){
this.deactivate(this.last_active);
}
this.drops.each(function(drop){
if(Droppables.isAffected(_331,_332,drop)){
_333.push(drop);
}
});
if(_333.length>0){
drop=Droppables.findDeepestChild(_333);
Position.within(drop.element,_331[0],_331[1]);
if(drop.onHover){
drop.onHover(_332,drop.element,Position.overlap(drop.overlap,drop.element));
}
Droppables.activate(drop);
}
},fire:function(_335,_336){
if(!this.last_active){
return;
}
Position.prepare();
if(this.isAffected([Event.pointerX(_335),Event.pointerY(_335)],_336,this.last_active)){
if(this.last_active.onDrop){
this.last_active.onDrop(_336,this.last_active.element,_335);
}
}
},reset:function(){
if(this.last_active){
this.deactivate(this.last_active);
}
}};
var Draggables={drags:[],observers:[],register:function(_337){
if(this.drags.length==0){
this.eventMouseUp=this.endDrag.bindAsEventListener(this);
this.eventMouseMove=this.updateDrag.bindAsEventListener(this);
this.eventKeypress=this.keyPress.bindAsEventListener(this);
Event.observe(document,"mouseup",this.eventMouseUp);
Event.observe(document,"mousemove",this.eventMouseMove);
Event.observe(document,"keypress",this.eventKeypress);
}
this.drags.push(_337);
},unregister:function(_338){
this.drags=this.drags.reject(function(d){
return d==_338;
});
if(this.drags.length==0){
Event.stopObserving(document,"mouseup",this.eventMouseUp);
Event.stopObserving(document,"mousemove",this.eventMouseMove);
Event.stopObserving(document,"keypress",this.eventKeypress);
}
},activate:function(_33a){
if(_33a.options.delay){
this._timeout=setTimeout(function(){
Draggables._timeout=null;
window.focus();
Draggables.activeDraggable=_33a;
}.bind(this),_33a.options.delay);
}else{
window.focus();
this.activeDraggable=_33a;
}
},deactivate:function(){
this.activeDraggable=null;
},updateDrag:function(_33b){
if(!this.activeDraggable){
return;
}
var _33c=[Event.pointerX(_33b),Event.pointerY(_33b)];
if(this._lastPointer&&(this._lastPointer.inspect()==_33c.inspect())){
return;
}
this._lastPointer=_33c;
this.activeDraggable.updateDrag(_33b,_33c);
},endDrag:function(_33d){
if(this._timeout){
clearTimeout(this._timeout);
this._timeout=null;
}
if(!this.activeDraggable){
return;
}
this._lastPointer=null;
this.activeDraggable.endDrag(_33d);
this.activeDraggable=null;
},keyPress:function(_33e){
if(this.activeDraggable){
this.activeDraggable.keyPress(_33e);
}
},addObserver:function(_33f){
this.observers.push(_33f);
this._cacheObserverCallbacks();
},removeObserver:function(_340){
this.observers=this.observers.reject(function(o){
return o.element==_340;
});
this._cacheObserverCallbacks();
},notify:function(_342,_343,_344){
if(this[_342+"Count"]>0){
this.observers.each(function(o){
if(o[_342]){
o[_342](_342,_343,_344);
}
});
}
if(_343.options[_342]){
_343.options[_342](_343,_344);
}
},_cacheObserverCallbacks:function(){
["onStart","onEnd","onDrag"].each(function(_346){
Draggables[_346+"Count"]=Draggables.observers.select(function(o){
return o[_346];
}).length;
});
}};
var Draggable=Class.create();
Draggable._dragging={};
Draggable.prototype={initialize:function(_348){
var _349={handle:false,reverteffect:function(_34a,_34b,_34c){
var dur=Math.sqrt(Math.abs(_34b^2)+Math.abs(_34c^2))*0.02;
new Effect.Move(_34a,{x:-_34c,y:-_34b,duration:dur,queue:{scope:"_draggable",position:"end"}});
},endeffect:function(_34e){
var _34f=typeof _34e._opacity=="number"?_34e._opacity:1;
new Effect.Opacity(_34e,{duration:0.2,from:0.7,to:_34f,queue:{scope:"_draggable",position:"end"},afterFinish:function(){
Draggable._dragging[_34e]=false;
}});
},zindex:1000,revert:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};
if(!arguments[1]||typeof arguments[1].endeffect=="undefined"){
Object.extend(_349,{starteffect:function(_350){
_350._opacity=Element.getOpacity(_350);
Draggable._dragging[_350]=true;
new Effect.Opacity(_350,{duration:0.2,from:_350._opacity,to:0.7});
}});
}
var _351=Object.extend(_349,arguments[1]||{});
this.element=$(_348);
if(_351.handle&&(typeof _351.handle=="string")){
this.handle=this.element.down("."+_351.handle,0);
}
if(!this.handle){
this.handle=$(_351.handle);
}
if(!this.handle){
this.handle=this.element;
}
if(_351.scroll&&!_351.scroll.scrollTo&&!_351.scroll.outerHTML){
_351.scroll=$(_351.scroll);
this._isScrollChild=Element.childOf(this.element,_351.scroll);
}
Element.makePositioned(this.element);
this.delta=this.currentDelta();
this.options=_351;
this.dragging=false;
this.eventMouseDown=this.initDrag.bindAsEventListener(this);
Event.observe(this.handle,"mousedown",this.eventMouseDown);
Draggables.register(this);
},destroy:function(){
Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);
Draggables.unregister(this);
},currentDelta:function(){
return ([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")]);
},initDrag:function(_352){
if(typeof Draggable._dragging[this.element]!="undefined"&&Draggable._dragging[this.element]){
return;
}
if(Event.isLeftClick(_352)){
var src=Event.element(_352);
if((tag_name=src.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){
return;
}
var _354=[Event.pointerX(_352),Event.pointerY(_352)];
var pos=Position.cumulativeOffset(this.element);
this.offset=[0,1].map(function(i){
return (_354[i]-pos[i]);
});
Draggables.activate(this);
Event.stop(_352);
}
},startDrag:function(_357){
this.dragging=true;
if(this.options.zindex){
this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);
this.element.style.zIndex=this.options.zindex;
}
if(this.options.ghosting){
this._clone=this.element.cloneNode(true);
Position.absolutize(this.element);
this.element.parentNode.insertBefore(this._clone,this.element);
}
if(this.options.scroll){
if(this.options.scroll==window){
var _358=this._getWindowScroll(this.options.scroll);
this.originalScrollLeft=_358.left;
this.originalScrollTop=_358.top;
}else{
this.originalScrollLeft=this.options.scroll.scrollLeft;
this.originalScrollTop=this.options.scroll.scrollTop;
}
}
Draggables.notify("onStart",this,_357);
if(this.options.starteffect){
this.options.starteffect(this.element);
}
},updateDrag:function(_359,_35a){
if(!this.dragging){
this.startDrag(_359);
}
Position.prepare();
Droppables.show(_35a,this.element);
Draggables.notify("onDrag",this,_359);
this.draw(_35a);
if(this.options.change){
this.options.change(this);
}
if(this.options.scroll){
this.stopScrolling();
var p;
if(this.options.scroll==window){
with(this._getWindowScroll(this.options.scroll)){
p=[left,top,left+width,top+height];
}
}else{
p=Position.page(this.options.scroll);
p[0]+=this.options.scroll.scrollLeft+Position.deltaX;
p[1]+=this.options.scroll.scrollTop+Position.deltaY;
p.push(p[0]+this.options.scroll.offsetWidth);
p.push(p[1]+this.options.scroll.offsetHeight);
}
var _35c=[0,0];
if(_35a[0]<(p[0]+this.options.scrollSensitivity)){
_35c[0]=_35a[0]-(p[0]+this.options.scrollSensitivity);
}
if(_35a[1]<(p[1]+this.options.scrollSensitivity)){
_35c[1]=_35a[1]-(p[1]+this.options.scrollSensitivity);
}
if(_35a[0]>(p[2]-this.options.scrollSensitivity)){
_35c[0]=_35a[0]-(p[2]-this.options.scrollSensitivity);
}
if(_35a[1]>(p[3]-this.options.scrollSensitivity)){
_35c[1]=_35a[1]-(p[3]-this.options.scrollSensitivity);
}
this.startScrolling(_35c);
}
if(navigator.appVersion.indexOf("AppleWebKit")>0){
window.scrollBy(0,0);
}
Event.stop(_359);
},finishDrag:function(_35d,_35e){
this.dragging=false;
if(this.options.ghosting){
Position.relativize(this.element);
Element.remove(this._clone);
this._clone=null;
}
if(_35e){
Droppables.fire(_35d,this.element);
}
Draggables.notify("onEnd",this,_35d);
var _35f=this.options.revert;
if(_35f&&typeof _35f=="function"){
_35f=_35f(this.element);
}
var d=this.currentDelta();
if(_35f&&this.options.reverteffect){
this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);
}else{
this.delta=d;
}
if(this.options.zindex){
this.element.style.zIndex=this.originalZ;
}
if(this.options.endeffect){
this.options.endeffect(this.element);
}
Draggables.deactivate(this);
Droppables.reset();
},keyPress:function(_361){
if(_361.keyCode!=Event.KEY_ESC){
return;
}
this.finishDrag(_361,false);
Event.stop(_361);
},endDrag:function(_362){
if(!this.dragging){
return;
}
this.stopScrolling();
this.finishDrag(_362,true);
Event.stop(_362);
},draw:function(_363){
var pos=Position.cumulativeOffset(this.element);
if(this.options.ghosting){
var r=Position.realOffset(this.element);
pos[0]+=r[0]-Position.deltaX;
pos[1]+=r[1]-Position.deltaY;
}
var d=this.currentDelta();
pos[0]-=d[0];
pos[1]-=d[1];
if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){
pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;
pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;
}
var p=[0,1].map(function(i){
return (_363[i]-pos[i]-this.offset[i]);
}.bind(this));
if(this.options.snap){
if(typeof this.options.snap=="function"){
p=this.options.snap(p[0],p[1],this);
}else{
if(this.options.snap instanceof Array){
p=p.map(function(v,i){
return Math.round(v/this.options.snap[i])*this.options.snap[i];
}.bind(this));
}else{
p=p.map(function(v){
return Math.round(v/this.options.snap)*this.options.snap;
}.bind(this));
}
}
}
var _36c=this.element.style;
if((!this.options.constraint)||(this.options.constraint=="horizontal")){
_36c.left=p[0]+"px";
}
if((!this.options.constraint)||(this.options.constraint=="vertical")){
_36c.top=p[1]+"px";
}
if(_36c.visibility=="hidden"){
_36c.visibility="";
}
},stopScrolling:function(){
if(this.scrollInterval){
clearInterval(this.scrollInterval);
this.scrollInterval=null;
Draggables._lastScrollPointer=null;
}
},startScrolling:function(_36d){
if(!(_36d[0]||_36d[1])){
return;
}
this.scrollSpeed=[_36d[0]*this.options.scrollSpeed,_36d[1]*this.options.scrollSpeed];
this.lastScrolled=new Date();
this.scrollInterval=setInterval(this.scroll.bind(this),10);
},scroll:function(){
var _36e=new Date();
var _36f=_36e-this.lastScrolled;
this.lastScrolled=_36e;
if(this.options.scroll==window){
with(this._getWindowScroll(this.options.scroll)){
if(this.scrollSpeed[0]||this.scrollSpeed[1]){
var d=_36f/1000;
this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);
}
}
}else{
this.options.scroll.scrollLeft+=this.scrollSpeed[0]*_36f/1000;
this.options.scroll.scrollTop+=this.scrollSpeed[1]*_36f/1000;
}
Position.prepare();
Droppables.show(Draggables._lastPointer,this.element);
Draggables.notify("onDrag",this);
if(this._isScrollChild){
Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);
Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*_36f/1000;
Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*_36f/1000;
if(Draggables._lastScrollPointer[0]<0){
Draggables._lastScrollPointer[0]=0;
}
if(Draggables._lastScrollPointer[1]<0){
Draggables._lastScrollPointer[1]=0;
}
this.draw(Draggables._lastScrollPointer);
}
if(this.options.change){
this.options.change(this);
}
},_getWindowScroll:function(w){
var T,L,W,H;
with(w.document){
if(w.document.documentElement&&documentElement.scrollTop){
T=documentElement.scrollTop;
L=documentElement.scrollLeft;
}else{
if(w.document.body){
T=body.scrollTop;
L=body.scrollLeft;
}
}
if(w.innerWidth){
W=w.innerWidth;
H=w.innerHeight;
}else{
if(w.document.documentElement&&documentElement.clientWidth){
W=documentElement.clientWidth;
H=documentElement.clientHeight;
}else{
W=body.offsetWidth;
H=body.offsetHeight;
}
}
}
return {top:T,left:L,width:W,height:H};
}};
var SortableObserver=Class.create();
SortableObserver.prototype={initialize:function(_376,_377){
this.element=$(_376);
this.observer=_377;
this.lastValue=Sortable.serialize(this.element);
},onStart:function(){
this.lastValue=Sortable.serialize(this.element);
},onEnd:function(){
Sortable.unmark();
if(this.lastValue!=Sortable.serialize(this.element)){
this.observer(this.element);
}
}};
var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(_378){
while(_378.tagName.toUpperCase()!="BODY"){
if(_378.id&&Sortable.sortables[_378.id]){
return _378;
}
_378=_378.parentNode;
}
},options:function(_379){
_379=Sortable._findRootElement($(_379));
if(!_379){
return;
}
return Sortable.sortables[_379.id];
},destroy:function(_37a){
var s=Sortable.options(_37a);
if(s){
Draggables.removeObserver(s.element);
s.droppables.each(function(d){
Droppables.remove(d);
});
s.draggables.invoke("destroy");
delete Sortable.sortables[s.element.id];
}
},create:function(_37d){
_37d=$(_37d);
var _37e=Object.extend({element:_37d,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:_37d,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});
this.destroy(_37d);
var _37f={revert:true,scroll:_37e.scroll,scrollSpeed:_37e.scrollSpeed,scrollSensitivity:_37e.scrollSensitivity,delay:_37e.delay,ghosting:_37e.ghosting,constraint:_37e.constraint,handle:_37e.handle};
if(_37e.starteffect){
_37f.starteffect=_37e.starteffect;
}
if(_37e.reverteffect){
_37f.reverteffect=_37e.reverteffect;
}else{
if(_37e.ghosting){
_37f.reverteffect=function(_380){
_380.style.top=0;
_380.style.left=0;
};
}
}
if(_37e.endeffect){
_37f.endeffect=_37e.endeffect;
}
if(_37e.zindex){
_37f.zindex=_37e.zindex;
}
var _381={overlap:_37e.overlap,containment:_37e.containment,tree:_37e.tree,hoverclass:_37e.hoverclass,onHover:Sortable.onHover};
var _382={onHover:Sortable.onEmptyHover,overlap:_37e.overlap,containment:_37e.containment,hoverclass:_37e.hoverclass};
Element.cleanWhitespace(_37d);
_37e.draggables=[];
_37e.droppables=[];
if(_37e.dropOnEmpty||_37e.tree){
Droppables.add(_37d,_382);
_37e.droppables.push(_37d);
}
(this.findElements(_37d,_37e)||[]).each(function(e){
var _384=_37e.handle?$(e).down("."+_37e.handle,0):e;
_37e.draggables.push(new Draggable(e,Object.extend(_37f,{handle:_384})));
Droppables.add(e,_381);
if(_37e.tree){
e.treeNode=_37d;
}
_37e.droppables.push(e);
});
if(_37e.tree){
(Sortable.findTreeElements(_37d,_37e)||[]).each(function(e){
Droppables.add(e,_382);
e.treeNode=_37d;
_37e.droppables.push(e);
});
}
this.sortables[_37d.id]=_37e;
Draggables.addObserver(new SortableObserver(_37d,_37e.onUpdate));
},findElements:function(_386,_387){
return Element.findChildren(_386,_387.only,_387.tree?true:false,_387.tag);
},findTreeElements:function(_388,_389){
return Element.findChildren(_388,_389.only,_389.tree?true:false,_389.treeTag);
},onHover:function(_38a,_38b,_38c){
if(Element.isParent(_38b,_38a)){
return;
}
if(_38c>0.33&&_38c<0.66&&Sortable.options(_38b).tree){
return;
}else{
if(_38c>0.5){
Sortable.mark(_38b,"before");
if(_38b.previousSibling!=_38a){
var _38d=_38a.parentNode;
_38a.style.visibility="hidden";
_38b.parentNode.insertBefore(_38a,_38b);
if(_38b.parentNode!=_38d){
Sortable.options(_38d).onChange(_38a);
}
Sortable.options(_38b.parentNode).onChange(_38a);
}
}else{
Sortable.mark(_38b,"after");
var _38e=_38b.nextSibling||null;
if(_38e!=_38a){
var _38d=_38a.parentNode;
_38a.style.visibility="hidden";
_38b.parentNode.insertBefore(_38a,_38e);
if(_38b.parentNode!=_38d){
Sortable.options(_38d).onChange(_38a);
}
Sortable.options(_38b.parentNode).onChange(_38a);
}
}
}
},onEmptyHover:function(_38f,_390,_391){
var _392=_38f.parentNode;
var _393=Sortable.options(_390);
if(!Element.isParent(_390,_38f)){
var _394;
var _395=Sortable.findElements(_390,{tag:_393.tag,only:_393.only});
var _396=null;
if(_395){
var _397=Element.offsetSize(_390,_393.overlap)*(1-_391);
for(_394=0;_394<_395.length;_394+=1){
if(_397-Element.offsetSize(_395[_394],_393.overlap)>=0){
_397-=Element.offsetSize(_395[_394],_393.overlap);
}else{
if(_397-(Element.offsetSize(_395[_394],_393.overlap)/2)>=0){
_396=_394+1<_395.length?_395[_394+1]:null;
break;
}else{
_396=_395[_394];
break;
}
}
}
}
_390.insertBefore(_38f,_396);
Sortable.options(_392).onChange(_38f);
_393.onChange(_38f);
}
},unmark:function(){
if(Sortable._marker){
Sortable._marker.hide();
}
},mark:function(_398,_399){
var _39a=Sortable.options(_398.parentNode);
if(_39a&&!_39a.ghosting){
return;
}
if(!Sortable._marker){
Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
}
var _39b=Position.cumulativeOffset(_398);
Sortable._marker.setStyle({left:_39b[0]+"px",top:_39b[1]+"px"});
if(_399=="after"){
if(_39a.overlap=="horizontal"){
Sortable._marker.setStyle({left:(_39b[0]+_398.clientWidth)+"px"});
}else{
Sortable._marker.setStyle({top:(_39b[1]+_398.clientHeight)+"px"});
}
}
Sortable._marker.show();
},_tree:function(_39c,_39d,_39e){
var _39f=Sortable.findElements(_39c,_39d)||[];
for(var i=0;i<_39f.length;++i){
var _3a1=_39f[i].id.match(_39d.format);
if(!_3a1){
continue;
}
var _3a2={id:encodeURIComponent(_3a1?_3a1[1]:null),element:_39c,parent:_39e,children:[],position:_39e.children.length,container:$(_39f[i]).down(_39d.treeTag)};
if(_3a2.container){
this._tree(_3a2.container,_39d,_3a2);
}
_39e.children.push(_3a2);
}
return _39e;
},tree:function(_3a3){
_3a3=$(_3a3);
var _3a4=this.options(_3a3);
var _3a5=Object.extend({tag:_3a4.tag,treeTag:_3a4.treeTag,only:_3a4.only,name:_3a3.id,format:_3a4.format},arguments[1]||{});
var root={id:null,parent:null,children:[],container:_3a3,position:0};
return Sortable._tree(_3a3,_3a5,root);
},_constructIndex:function(node){
var _3a8="";
do{
if(node.id){
_3a8="["+node.position+"]"+_3a8;
}
}while((node=node.parent)!=null);
return _3a8;
},sequence:function(_3a9){
_3a9=$(_3a9);
var _3aa=Object.extend(this.options(_3a9),arguments[1]||{});
return $(this.findElements(_3a9,_3aa)||[]).map(function(item){
return item.id.match(_3aa.format)?item.id.match(_3aa.format)[1]:"";
});
},setSequence:function(_3ac,_3ad){
_3ac=$(_3ac);
var _3ae=Object.extend(this.options(_3ac),arguments[2]||{});
var _3af={};
this.findElements(_3ac,_3ae).each(function(n){
if(n.id.match(_3ae.format)){
_3af[n.id.match(_3ae.format)[1]]=[n,n.parentNode];
}
n.parentNode.removeChild(n);
});
_3ad.each(function(_3b1){
var n=_3af[_3b1];
if(n){
n[1].appendChild(n[0]);
delete _3af[_3b1];
}
});
},serialize:function(_3b3){
_3b3=$(_3b3);
var _3b4=Object.extend(Sortable.options(_3b3),arguments[1]||{});
var name=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:_3b3.id);
if(_3b4.tree){
return Sortable.tree(_3b3,arguments[1]).children.map(function(item){
return [name+Sortable._constructIndex(item)+"[id]="+encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
}).flatten().join("&");
}else{
return Sortable.sequence(_3b3,arguments[1]).map(function(item){
return name+"[]="+encodeURIComponent(item);
}).join("&");
}
}};
Element.isParent=function(_3b8,_3b9){
if(!_3b8.parentNode||_3b8==_3b9){
return false;
}
if(_3b8.parentNode==_3b9){
return true;
}
return Element.isParent(_3b8.parentNode,_3b9);
};
Element.findChildren=function(_3ba,only,_3bc,_3bd){
if(!_3ba.hasChildNodes()){
return null;
}
_3bd=_3bd.toUpperCase();
if(only){
only=[only].flatten();
}
var _3be=[];
$A(_3ba.childNodes).each(function(e){
if(e.tagName&&e.tagName.toUpperCase()==_3bd&&(!only||(Element.classNames(e).detect(function(v){
return only.include(v);
})))){
_3be.push(e);
}
if(_3bc){
var _3c1=Element.findChildren(e,only,_3bc,_3bd);
if(_3c1){
_3be.push(_3c1);
}
}
});
return (_3be.length>0?_3be.flatten():[]);
};
Element.offsetSize=function(_3c2,type){
return _3c2["offset"+((type=="vertical"||type=="height")?"Height":"Width")];
};
var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(_3c4){
_3c4=_3c4.toUpperCase();
var _3c5=this.NODEMAP[_3c4]||"div";
var _3c6=document.createElement(_3c5);
try{
_3c6.innerHTML="<"+_3c4+"></"+_3c4+">";
}
catch(e){
}
var _3c7=_3c6.firstChild||null;
if(_3c7&&(_3c7.tagName.toUpperCase()!=_3c4)){
_3c7=_3c7.getElementsByTagName(_3c4)[0];
}
if(!_3c7){
_3c7=document.createElement(_3c4);
}
if(!_3c7){
return;
}
if(arguments[1]){
if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)){
this._children(_3c7,arguments[1]);
}else{
var _3c8=this._attributes(arguments[1]);
if(_3c8.length){
try{
_3c6.innerHTML="<"+_3c4+" "+_3c8+"></"+_3c4+">";
}
catch(e){
}
_3c7=_3c6.firstChild||null;
if(!_3c7){
_3c7=document.createElement(_3c4);
for(attr in arguments[1]){
_3c7[attr=="class"?"className":attr]=arguments[1][attr];
}
}
if(_3c7.tagName.toUpperCase()!=_3c4){
_3c7=_3c6.getElementsByTagName(_3c4)[0];
}
}
}
}
if(arguments[2]){
this._children(_3c7,arguments[2]);
}
return _3c7;
},_text:function(text){
return document.createTextNode(text);
},ATTR_MAP:{"className":"class","htmlFor":"for"},_attributes:function(_3ca){
var _3cb=[];
for(attribute in _3ca){
_3cb.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+"=\""+_3ca[attribute].toString().escapeHTML()+"\"");
}
return _3cb.join(" ");
},_children:function(_3cc,_3cd){
if(typeof _3cd=="object"){
_3cd.flatten().each(function(e){
if(typeof e=="object"){
_3cc.appendChild(e);
}else{
if(Builder._isStringOrNumber(e)){
_3cc.appendChild(Builder._text(e));
}
}
});
}else{
if(Builder._isStringOrNumber(_3cd)){
_3cc.appendChild(Builder._text(_3cd));
}
}
},_isStringOrNumber:function(_3cf){
return (typeof _3cf=="string"||typeof _3cf=="number");
},build:function(html){
var _3d1=this.node("div");
$(_3d1).update(html.strip());
return _3d1.down();
},dump:function(_3d2){
if(typeof _3d2!="object"&&typeof _3d2!="function"){
_3d2=window;
}
var tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
tags.each(function(tag){
_3d2[tag]=function(){
return Builder.node.apply(Builder,[tag].concat($A(arguments)));
};
});
}};
if(typeof Effect=="undefined"){
throw ("controls.js requires including script.aculo.us' effects.js library");
}
var Autocompleter={};
Autocompleter.Base=function(){
};
Autocompleter.Base.prototype={baseInitialize:function(_3d5,_3d6,_3d7){
this.element=$(_3d5);
this.update=$(_3d6);
this.hasFocus=false;
this.changed=false;
this.active=false;
this.index=0;
this.entryCount=0;
if(this.setOptions){
this.setOptions(_3d7);
}else{
this.options=_3d7||{};
}
this.options.paramName=this.options.paramName||this.element.name;
this.options.tokens=this.options.tokens||[];
this.options.frequency=this.options.frequency||0.4;
if(this.options.minChars==null){
this.options.minChars=1;
}
this.options.onShow=this.options.onShow||function(_3d8,_3d9){
if(!_3d9.style.position||_3d9.style.position=="absolute"){
_3d9.style.position="absolute";
Position.clone(_3d8,_3d9,{setHeight:false,offsetTop:_3d8.offsetHeight});
}
Effect.Appear(_3d9,{duration:0.15});
};
this.options.onHide=this.options.onHide||function(_3da,_3db){
new Effect.Fade(_3db,{duration:0.15});
};
if(typeof (this.options.tokens)=="string"){
this.options.tokens=new Array(this.options.tokens);
}
this.observer=null;
this.element.setAttribute("autocomplete","off");
Element.hide(this.update);
Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));
Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this));
},show:function(){
if(Element.getStyle(this.update,"display")=="none"){
this.options.onShow(this.element,this.update);
}
if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(Element.getStyle(this.update,"position")=="absolute")){
new Insertion.After(this.update,"<iframe id=\""+this.update.id+"_iefix\" "+"style=\"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" "+"src=\"javascript:false;\" frameborder=\"0\" scrolling=\"no\"></iframe>");
this.iefix=$(this.update.id+"_iefix");
}
if(this.iefix){
setTimeout(this.fixIEOverlapping.bind(this),50);
}
},fixIEOverlapping:function(){
Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});
this.iefix.style.zIndex=1;
this.update.style.zIndex=2;
Element.show(this.iefix);
},hide:function(){
this.stopIndicator();
if(Element.getStyle(this.update,"display")!="none"){
this.options.onHide(this.element,this.update);
}
if(this.iefix){
Element.hide(this.iefix);
}
},startIndicator:function(){
if(this.options.indicator){
Element.show(this.options.indicator);
}
},stopIndicator:function(){
if(this.options.indicator){
Element.hide(this.options.indicator);
}
},onKeyPress:function(_3dc){
if(this.active){
switch(_3dc.keyCode){
case Event.KEY_TAB:
case Event.KEY_RETURN:
this.selectEntry();
Event.stop(_3dc);
this.active=false;
this.hide();
return;
case Event.KEY_ESC:
this._escaped=true;
this.hide();
this.active=false;
Event.stop(_3dc);
return;
case Event.KEY_LEFT:
case Event.KEY_RIGHT:
return;
case Event.KEY_UP:
this.markPrevious();
this.render();
if(navigator.appVersion.indexOf("AppleWebKit")>0){
Event.stop(_3dc);
}
return;
case Event.KEY_DOWN:
this.markNext();
this.render();
if(navigator.appVersion.indexOf("AppleWebKit")>0){
Event.stop(_3dc);
}
return;
}
}else{
if(_3dc.keyCode==Event.KEY_TAB||_3dc.keyCode==Event.KEY_RETURN||(navigator.appVersion.indexOf("AppleWebKit")>0&&_3dc.keyCode==0)){
return;
}
}
this.changed=true;
this.hasFocus=true;
if(this.observer){
clearTimeout(this.observer);
}
this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);
},activate:function(){
this.changed=false;
this.hasFocus=true;
this.getUpdatedChoices();
},onHover:function(_3dd){
var _3de=Event.findElement(_3dd,"LI");
if(this.index!=_3de.autocompleteIndex){
this.index=_3de.autocompleteIndex;
this.render();
}
Event.stop(_3dd);
},onClick:function(_3df){
var _3e0=Event.findElement(_3df,"LI");
this.index=_3e0.autocompleteIndex;
this.selectEntry();
this.hide();
},onBlur:function(_3e1){
setTimeout(this.hide.bind(this),250);
this.hasFocus=false;
this.active=false;
},render:function(){
if(this.entryCount>0){
for(var i=0;i<this.entryCount;i++){
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");
}
if(this.hasFocus){
this.show();
this.active=true;
}
}else{
this.active=false;
this.hide();
}
},markPrevious:function(){
if(this.index>0){
this.index--;
}else{
this.index=this.entryCount-1;
}
this.getEntry(this.index).scrollIntoView(true);
},markNext:function(){
if(this.index<this.entryCount-1){
this.index++;
}else{
this.index=0;
}
this.getEntry(this.index).scrollIntoView(false);
},getEntry:function(_3e3){
return this.update.firstChild.childNodes[_3e3];
},getCurrentEntry:function(){
return this.getEntry(this.index);
},selectEntry:function(){
this.active=false;
this.updateElement(this.getCurrentEntry());
},updateElement:function(_3e4){
if(this.options.updateElement){
this.options.updateElement(_3e4);
return;
}
var _3e5="";
if(this.options.select){
var _3e6=document.getElementsByClassName(this.options.select,_3e4)||[];
if(_3e6.length>0){
_3e5=Element.collectTextNodes(_3e6[0],this.options.select);
}
}else{
_3e5=Element.collectTextNodesIgnoreClass(_3e4,"informal");
}
if(this.options.appendMode){
var _3e7=this.element.value.split(",");
_3e7.pop();
var _3e8=_3e7.join(",");
if(_3e8!=""){
_3e8+=",";
}
_3e5=_3e8+_3e5;
}
var _3e9=this.findLastToken();
if(_3e9!=-1){
var _3ea=this.element.value.substr(0,_3e9+1);
var _3eb=this.element.value.substr(_3e9+1).match(/^\s+/);
if(_3eb){
_3ea+=_3eb[0];
}
this.element.value=_3ea+_3e5;
}else{
this.element.value=_3e5;
}
this.element.focus();
if(this.options.afterUpdateElement){
this.options.afterUpdateElement(this.element,_3e4);
}
},updateChoices:function(_3ec){
if(!this.changed&&this.hasFocus){
this.update.innerHTML=_3ec;
Element.cleanWhitespace(this.update);
Element.cleanWhitespace(this.update.down());
if(this.update.firstChild&&this.update.down().childNodes){
this.entryCount=this.update.down().childNodes.length;
for(var i=0;i<this.entryCount;i++){
var _3ee=this.getEntry(i);
_3ee.autocompleteIndex=i;
this.addObservers(_3ee);
}
}else{
this.entryCount=0;
}
this.stopIndicator();
this.index=0;
if(this.entryCount==1&&this.options.autoSelect){
this.selectEntry();
this.hide();
}else{
this.render();
}
}
},addObservers:function(_3ef){
Event.observe(_3ef,"mouseover",this.onHover.bindAsEventListener(this));
Event.observe(_3ef,"click",this.onClick.bindAsEventListener(this));
},onObserverEvent:function(){
this.changed=false;
if(!this._escaped&&(this.getToken().length>=this.options.minChars)){
this.startIndicator();
this.getUpdatedChoices();
}else{
this.active=false;
this.hide();
}
},getToken:function(){
var _3f0=this.findLastToken();
if(_3f0!=-1){
var ret=this.element.value.substr(_3f0+1).replace(/^\s+/,"").replace(/\s+$/,"");
}else{
var ret=this.element.value;
}
return /\n/.test(ret)?"":ret;
},findLastToken:function(){
var _3f2=-1;
for(var i=0;i<this.options.tokens.length;i++){
var _3f4=this.element.value.lastIndexOf(this.options.tokens[i]);
if(_3f4>_3f2){
_3f2=_3f4;
}
}
return _3f2;
}};
Ajax.Autocompleter=Class.create();
Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(_3f5,_3f6,url,_3f8){
this.baseInitialize(_3f5,_3f6,_3f8);
this.options.asynchronous=true;
this.options.onComplete=this.onComplete.bind(this);
this.options.defaultParams=this.options.parameters||null;
this.url=url;
},getUpdatedChoices:function(){
entry=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());
this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;
if(this.options.defaultParams){
this.options.parameters+="&"+this.options.defaultParams;
}
new Ajax.Request(this.url,this.options);
},onComplete:function(_3f9){
this.updateChoices(_3f9.responseText);
}});
Autocompleter.Local=Class.create();
Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(_3fa,_3fb,_3fc,_3fd){
this.baseInitialize(_3fa,_3fb,_3fd);
this.options.array=_3fc;
},getUpdatedChoices:function(){
this.updateChoices(this.options.selector(this));
},setOptions:function(_3fe){
this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(_3ff){
var ret=[];
var _401=[];
var _402=_3ff.getToken();
var _403=0;
if(_3ff.options.appendMode){
_402=_402.split(",").last();
_402=_402.replace(/^\s+/,"");
}
for(var i=0;i<_3ff.options.array.length&&ret.length<_3ff.options.choices;i++){
var elem=_3ff.options.array[i];
var _406=_3ff.options.ignoreCase?elem.toLowerCase().indexOf(_402.toLowerCase()):elem.indexOf(_402);
var _407="";
if(_3ff.options.counts){
_407=" ("+_3ff.options.counts[i]+")";
}
while(_406!=-1){
if(_406==0){
ret.push("<li><strong>"+elem.substr(0,_402.length)+"</strong>"+elem.substr(_402.length)+_407+"</li>");
break;
}else{
if(_402.length>=_3ff.options.partialChars&&_3ff.options.partialSearch&&_406!=-1){
if(_3ff.options.fullSearch||/\s/.test(elem.substr(_406-1,1))){
_401.push("<li>"+elem.substr(0,_406)+"<strong>"+elem.substr(_406,_402.length)+"</strong>"+elem.substr(_406+_402.length)+_407+"</li>");
break;
}
}
}
_406=_3ff.options.ignoreCase?elem.toLowerCase().indexOf(_402.toLowerCase(),_406+1):elem.indexOf(_402,_406+1);
}
}
if(_401.length){
ret=ret.concat(_401.slice(0,_3ff.options.choices-ret.length));
}
return "<ul>"+ret.join("")+"</ul>";
}},_3fe||{});
}});
Field.scrollFreeActivate=function(_408){
setTimeout(function(){
Field.activate(_408);
},1);
};
Ajax.InPlaceEditor=Class.create();
Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";
Ajax.InPlaceEditor.prototype={initialize:function(_409,url,_40b){
this.url=url;
this.element=$(_409);
this.options=Object.extend({paramName:"value",okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(_40c,_40d){
new Effect.Highlight(_40d,{startcolor:this.options.highlightcolor});
},onFailure:function(_40e){
alert("Error communicating with the server: "+_40e.responseText.stripTags());
},callback:function(form){
return Form.serialize(form);
},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},_40b||{});
if(!this.options.formId&&this.element.id){
this.options.formId=this.element.id+"-inplaceeditor";
if($(this.options.formId)){
this.options.formId=null;
}
}
if(this.options.externalControl){
this.options.externalControl=$(this.options.externalControl);
}
this.originalBackground=Element.getStyle(this.element,"background-color");
if(!this.originalBackground){
this.originalBackground="transparent";
}
this.element.title=this.options.clickToEditText;
this.onclickListener=this.enterEditMode.bindAsEventListener(this);
this.mouseoverListener=this.enterHover.bindAsEventListener(this);
this.mouseoutListener=this.leaveHover.bindAsEventListener(this);
Event.observe(this.element,"click",this.onclickListener);
Event.observe(this.element,"mouseover",this.mouseoverListener);
Event.observe(this.element,"mouseout",this.mouseoutListener);
if(this.options.externalControl){
Event.observe(this.options.externalControl,"click",this.onclickListener);
Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener);
Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener);
}
},enterEditMode:function(evt){
if(this.saving){
return;
}
if(this.editing){
return;
}
this.editing=true;
this.onEnterEditMode();
if(this.options.externalControl){
Element.hide(this.options.externalControl);
}
Element.hide(this.element);
this.createForm();
this.element.parentNode.insertBefore(this.form,this.element);
if(!this.options.loadTextURL){
Field.scrollFreeActivate(this.editField);
}
if(evt){
Event.stop(evt);
}
return false;
},createForm:function(){
this.form=document.createElement("form");
this.form.id=this.options.formId;
Element.addClassName(this.form,this.options.formClassName);
this.form.onsubmit=this.onSubmit.bind(this);
this.createEditField();
if(this.options.textarea){
var br=document.createElement("br");
this.form.appendChild(br);
}
if(this.options.okButton){
okButton=document.createElement("input");
okButton.type="submit";
okButton.value=this.options.okText;
okButton.className="editor_ok_button";
this.form.appendChild(okButton);
}
if(this.options.cancelLink){
cancelLink=document.createElement("a");
cancelLink.href="#";
cancelLink.appendChild(document.createTextNode(this.options.cancelText));
cancelLink.onclick=this.onclickCancel.bind(this);
cancelLink.className="editor_cancel";
this.form.appendChild(cancelLink);
}
},hasHTMLLineBreaks:function(_412){
if(!this.options.handleLineBreaks){
return false;
}
return _412.match(/<br/i)||_412.match(/<p>/i);
},convertHTMLLineBreaks:function(_413){
return _413.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"");
},createEditField:function(){
var text;
if(this.options.loadTextURL){
text=this.options.loadingText;
}else{
text=this.getText();
}
var obj=this;
if(this.options.rows==1&&!this.hasHTMLLineBreaks(text)){
this.options.textarea=false;
var _416=document.createElement("input");
_416.obj=this;
_416.type="text";
_416.name=this.options.paramName;
_416.value=text;
_416.style.backgroundColor=this.options.highlightcolor;
_416.className="editor_field";
var size=this.options.size||this.options.cols||0;
if(size!=0){
_416.size=size;
}
if(this.options.submitOnBlur){
_416.onblur=this.onSubmit.bind(this);
}
this.editField=_416;
}else{
this.options.textarea=true;
var _418=document.createElement("textarea");
_418.obj=this;
_418.name=this.options.paramName;
_418.value=this.convertHTMLLineBreaks(text);
_418.rows=this.options.rows;
_418.cols=this.options.cols||40;
_418.className="editor_field";
if(this.options.submitOnBlur){
_418.onblur=this.onSubmit.bind(this);
}
this.editField=_418;
}
if(this.options.loadTextURL){
this.loadExternalText();
}
this.form.appendChild(this.editField);
},getText:function(){
return this.element.innerHTML;
},loadExternalText:function(){
Element.addClassName(this.form,this.options.loadingClassName);
this.editField.disabled=true;
new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions));
},onLoadedExternalText:function(_419){
Element.removeClassName(this.form,this.options.loadingClassName);
this.editField.disabled=false;
this.editField.value=_419.responseText.stripTags();
Field.scrollFreeActivate(this.editField);
},onclickCancel:function(){
this.onComplete();
this.leaveEditMode();
return false;
},onFailure:function(_41a){
this.options.onFailure(_41a);
if(this.oldInnerHTML){
this.element.innerHTML=this.oldInnerHTML;
this.oldInnerHTML=null;
}
return false;
},onSubmit:function(){
var form=this.form;
var _41c=this.editField.value;
this.onLoading();
if(this.options.evalScripts){
new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(form,_41c),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions));
}else{
new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(form,_41c),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions));
}
if(arguments.length>1){
Event.stop(arguments[0]);
}
return false;
},onLoading:function(){
this.saving=true;
this.removeForm();
this.leaveHover();
this.showSaving();
},showSaving:function(){
this.oldInnerHTML=this.element.innerHTML;
this.element.innerHTML=this.options.savingText;
Element.addClassName(this.element,this.options.savingClassName);
this.element.style.backgroundColor=this.originalBackground;
Element.show(this.element);
},removeForm:function(){
if(this.form){
if(this.form.parentNode){
Element.remove(this.form);
}
this.form=null;
}
},enterHover:function(){
if(this.saving){
return;
}
this.element.style.backgroundColor=this.options.highlightcolor;
if(this.effect){
this.effect.cancel();
}
Element.addClassName(this.element,this.options.hoverClassName);
},leaveHover:function(){
if(this.options.backgroundColor){
this.element.style.backgroundColor=this.oldBackground;
}
Element.removeClassName(this.element,this.options.hoverClassName);
if(this.saving){
return;
}
this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground});
},leaveEditMode:function(){
Element.removeClassName(this.element,this.options.savingClassName);
this.removeForm();
this.leaveHover();
this.element.style.backgroundColor=this.originalBackground;
Element.show(this.element);
if(this.options.externalControl){
Element.show(this.options.externalControl);
}
this.editing=false;
this.saving=false;
this.oldInnerHTML=null;
this.onLeaveEditMode();
},onComplete:function(_41d){
this.leaveEditMode();
this.options.onComplete.bind(this)(_41d,this.element);
},onEnterEditMode:function(){
},onLeaveEditMode:function(){
},dispose:function(){
if(this.oldInnerHTML){
this.element.innerHTML=this.oldInnerHTML;
}
this.leaveEditMode();
Event.stopObserving(this.element,"click",this.onclickListener);
Event.stopObserving(this.element,"mouseover",this.mouseoverListener);
Event.stopObserving(this.element,"mouseout",this.mouseoutListener);
if(this.options.externalControl){
Event.stopObserving(this.options.externalControl,"click",this.onclickListener);
Event.stopObserving(this.options.externalControl,"mouseover",this.mouseoverListener);
Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListener);
}
}};
Ajax.InPlaceCollectionEditor=Class.create();
Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);
Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){
if(!this.cached_selectTag){
var _41e=document.createElement("select");
var _41f=this.options.collection||[];
var _420;
_41f.each(function(e,i){
_420=document.createElement("option");
_420.value=(e instanceof Array)?e[0]:e;
if((typeof this.options.value=="undefined")&&((e instanceof Array)?this.element.innerHTML==e[1]:e==_420.value)){
_420.selected=true;
}
if(this.options.value==_420.value){
_420.selected=true;
}
_420.appendChild(document.createTextNode((e instanceof Array)?e[1]:e));
_41e.appendChild(_420);
}.bind(this));
this.cached_selectTag=_41e;
}
this.editField=this.cached_selectTag;
if(this.options.loadTextURL){
this.loadExternalText();
}
this.form.appendChild(this.editField);
this.options.callback=function(form,_424){
return "value="+encodeURIComponent(_424);
};
}});
Form.Element.DelayedObserver=Class.create();
Form.Element.DelayedObserver.prototype={initialize:function(_425,_426,_427){
this.delay=_426||0.5;
this.element=$(_425);
this.callback=_427;
this.timer=null;
this.lastValue=$F(this.element);
Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this));
},delayedListener:function(_428){
if(this.lastValue==$F(this.element)){
return;
}
if(this.timer){
clearTimeout(this.timer);
}
this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);
this.lastValue=$F(this.element);
},onTimerEvent:function(){
this.timer=null;
this.callback(this.element,$F(this.element));
}};
if(!Control){
var Control={};
}
Control.Slider=Class.create();
Control.Slider.prototype={initialize:function(_429,_42a,_42b){
var _42c=this;
if(_429 instanceof Array){
this.handles=_429.collect(function(e){
return $(e);
});
}else{
this.handles=[$(_429)];
}
this.track=$(_42a);
this.options=_42b||{};
this.axis=this.options.axis||"horizontal";
this.increment=this.options.increment||1;
this.step=parseInt(this.options.step||"1");
this.range=this.options.range||$R(0,1);
this.value=0;
this.values=this.handles.map(function(){
return 0;
});
this.spans=this.options.spans?this.options.spans.map(function(s){
return $(s);
}):false;
this.options.startSpan=$(this.options.startSpan||null);
this.options.endSpan=$(this.options.endSpan||null);
this.restricted=this.options.restricted||false;
this.maximum=this.options.maximum||this.range.end;
this.minimum=this.options.minimum||this.range.start;
this.alignX=parseInt(this.options.alignX||"0");
this.alignY=parseInt(this.options.alignY||"0");
this.trackLength=this.maximumOffset()-this.minimumOffset();
this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));
this.active=false;
this.dragging=false;
this.disabled=false;
if(this.options.disabled){
this.setDisabled();
}
this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;
if(this.allowedValues){
this.minimum=this.allowedValues.min();
this.maximum=this.allowedValues.max();
}
this.eventMouseDown=this.startDrag.bindAsEventListener(this);
this.eventMouseUp=this.endDrag.bindAsEventListener(this);
this.eventMouseMove=this.update.bindAsEventListener(this);
this.handles.each(function(h,i){
i=_42c.handles.length-1-i;
_42c.setValue(parseFloat((_42c.options.sliderValue instanceof Array?_42c.options.sliderValue[i]:_42c.options.sliderValue)||_42c.range.start),i);
Element.makePositioned(h);
Event.observe(h,"mousedown",_42c.eventMouseDown);
});
Event.observe(this.track,"mousedown",this.eventMouseDown);
Event.observe(document,"mouseup",this.eventMouseUp);
Event.observe(document,"mousemove",this.eventMouseMove);
this.initialized=true;
},dispose:function(){
var _431=this;
Event.stopObserving(this.track,"mousedown",this.eventMouseDown);
Event.stopObserving(document,"mouseup",this.eventMouseUp);
Event.stopObserving(document,"mousemove",this.eventMouseMove);
this.handles.each(function(h){
Event.stopObserving(h,"mousedown",_431.eventMouseDown);
});
},setDisabled:function(){
this.disabled=true;
},setEnabled:function(){
this.disabled=false;
},getNearestValue:function(_433){
if(this.allowedValues){
if(_433>=this.allowedValues.max()){
return (this.allowedValues.max());
}
if(_433<=this.allowedValues.min()){
return (this.allowedValues.min());
}
var _434=Math.abs(this.allowedValues[0]-_433);
var _435=this.allowedValues[0];
this.allowedValues.each(function(v){
var _437=Math.abs(v-_433);
if(_437<=_434){
_435=v;
_434=_437;
}
});
return _435;
}
if(_433>this.range.end){
return this.range.end;
}
if(_433<this.range.start){
return this.range.start;
}
return _433;
},setValue:function(_438,_439,_43a){
if(!this.active){
this.activeHandleIdx=_439||0;
this.activeHandle=this.handles[this.activeHandleIdx];
this.updateStyles();
}
_439=_439||this.activeHandleIdx||0;
if(this.initialized&&this.restricted){
if((_439>0)&&(_438<this.values[_439-1])){
_438=this.values[_439-1];
}
if((_439<(this.handles.length-1))&&(_438>this.values[_439+1])){
_438=this.values[_439+1];
}
}
_438=this.getNearestValue(_438);
this.values[_439]=_438;
this.value=this.values[0];
this.handles[_439].style[this.isVertical()?"top":"left"]=this.translateToPx(_438);
this.drawSpans();
if(_43a&&(!this.dragging||!this.event)){
this.updateFinished();
}
},setValueBy:function(_43b,_43c){
this.setValue(this.values[_43c||this.activeHandleIdx||0]+_43b,_43c||this.activeHandleIdx||0,true);
},translateToPx:function(_43d){
return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(_43d-this.range.start))+"px";
},translateToValue:function(_43e){
return ((_43e/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start);
},getRange:function(_43f){
var v=this.values.sortBy(Prototype.K);
_43f=_43f||0;
return $R(v[_43f],v[_43f+1]);
},minimumOffset:function(){
return (this.isVertical()?this.alignY:this.alignX);
},maximumOffset:function(){
return (this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignY);
},isVertical:function(){
return (this.axis=="vertical");
},drawSpans:function(){
var _441=this;
if(this.spans){
$R(0,this.spans.length-1).each(function(r){
_441.setSpan(_441.spans[r],_441.getRange(r));
});
}
if(this.options.startSpan){
this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value));
}
if(this.options.endSpan){
this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum));
}
},setSpan:function(span,_444){
if(this.isVertical()){
span.style.top=this.translateToPx(_444.start);
span.style.height=this.translateToPx(_444.end-_444.start+this.range.start);
}else{
span.style.left=this.translateToPx(_444.start);
span.style.width=this.translateToPx(_444.end-_444.start+this.range.start);
}
},updateStyles:function(){
this.handles.each(function(h){
Element.removeClassName(h,"selected");
});
Element.addClassName(this.activeHandle,"selected");
},startDrag:function(_446){
if(Event.isLeftClick(_446)){
if(!this.disabled){
this.active=true;
var _447=Event.element(_446);
var _448=[Event.pointerX(_446),Event.pointerY(_446)];
var _449=_447;
if(_449==this.track){
var _44a=Position.cumulativeOffset(this.track);
this.event=_446;
this.setValue(this.translateToValue((this.isVertical()?_448[1]-_44a[1]:_448[0]-_44a[0])-(this.handleLength/2)),null,true);
var _44a=Position.cumulativeOffset(this.activeHandle);
this.offsetX=(_448[0]-_44a[0]);
this.offsetY=(_448[1]-_44a[1]);
}else{
while((this.handles.indexOf(_447)==-1)&&_447.parentNode){
_447=_447.parentNode;
}
if(this.handles.indexOf(_447)!=-1){
this.activeHandle=_447;
this.activeHandleIdx=this.handles.indexOf(this.activeHandle);
this.updateStyles();
var _44a=Position.cumulativeOffset(this.activeHandle);
this.offsetX=(_448[0]-_44a[0]);
this.offsetY=(_448[1]-_44a[1]);
}
}
}
Event.stop(_446);
}
},update:function(_44b){
if(this.active){
if(!this.dragging){
this.dragging=true;
}
this.draw(_44b);
if(navigator.appVersion.indexOf("AppleWebKit")>0){
window.scrollBy(0,0);
}
Event.stop(_44b);
}
},draw:function(_44c){
var _44d=[Event.pointerX(_44c),Event.pointerY(_44c)];
var _44e=Position.cumulativeOffset(this.track);
_44d[0]-=this.offsetX+_44e[0];
_44d[1]-=this.offsetY+_44e[1];
this.event=_44c;
this.setValue(this.translateToValue(this.isVertical()?_44d[1]:_44d[0]));
if(this.initialized&&this.options.onSlide){
this.options.onSlide(this.values.length>1?this.values:this.value,this);
}
},endDrag:function(_44f){
if(this.active&&this.dragging){
this.finishDrag(_44f,true);
Event.stop(_44f);
}
this.active=false;
this.dragging=false;
},finishDrag:function(_450,_451){
this.active=false;
this.dragging=false;
this.updateFinished();
},updateFinished:function(){
if(this.initialized&&this.options.onChange){
this.options.onChange(this.values.length>1?this.values:this.value,this);
}
this.event=null;
}};
if(typeof deconcept=="undefined"){
var deconcept=new Object();
}
if(typeof deconcept.util=="undefined"){
deconcept.util=new Object();
}
if(typeof deconcept.SWFObjectUtil=="undefined"){
deconcept.SWFObjectUtil=new Object();
}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){
if(!document.getElementById){
return;
}
this.DETECT_KEY=_a?_a:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){
this.setAttribute("swf",_1);
}
if(id){
this.setAttribute("id",id);
}
if(w){
this.setAttribute("width",w);
}
if(h){
this.setAttribute("height",h);
}
if(_5){
this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));
}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(!window.opera&&document.all&&this.installedVer.major>7){
deconcept.SWFObject.doPrepUnload=true;
}
if(c){
this.addParam("bgcolor",c);
}
var q=_7?_7:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",false);
this.setAttribute("doExpressInstall",false);
var _c=(_8)?_8:window.location;
this.setAttribute("xiRedirectUrl",_c);
this.setAttribute("redirectUrl","");
if(_9){
this.setAttribute("redirectUrl",_9);
}
};
deconcept.SWFObject.prototype={useExpressInstall:function(_d){
this.xiSWFPath=!_d?"expressinstall.swf":_d;
this.setAttribute("useExpressInstall",true);
},setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){
_16[_16.length]=key+"="+_18[key];
}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
this.setAttribute("swf",this.xiSWFPath);
}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){
_19+=[key]+"=\""+_1a[key]+"\" ";
}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){
_19+="flashvars=\""+_1c+"\"";
}
_19+="/>";
}else{
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","ActiveX");
this.setAttribute("swf",this.xiSWFPath);
}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){
_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";
}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){
_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";
}
_19+="</object>";
}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);
}
}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){
document.location.replace(this.getAttribute("redirectUrl"));
}
}
return false;
}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){
_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
}
}else{
if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){
var axo=1;
var _26=3;
while(axo){
try{
_26++;
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);
_23=new deconcept.PlayerVersion([_26,0,0]);
}
catch(e){
axo=null;
}
}
}else{
try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
}
catch(e){
try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);
axo.AllowScriptAccess="always";
}
catch(e){
if(_23.major==6){
return _23;
}
}
try{
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
}
catch(e){
}
}
if(axo!=null){
_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}
}
}
return _23;
};
deconcept.PlayerVersion=function(_29){
this.major=_29[0]!=null?parseInt(_29[0]):0;
this.minor=_29[1]!=null?parseInt(_29[1]):0;
this.rev=_29[2]!=null?parseInt(_29[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){
return false;
}
if(this.major>fv.major){
return true;
}
if(this.minor<fv.minor){
return false;
}
if(this.minor>fv.minor){
return true;
}
if(this.rev<fv.rev){
return false;
}
return true;
};
deconcept.util={getRequestParameter:function(_2b){
var q=document.location.search||document.location.hash;
if(_2b==null){
return q;
}
if(q){
var _2d=q.substring(1).split("&");
for(var i=0;i<_2d.length;i++){
if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){
return _2d[i].substring((_2d[i].indexOf("=")+1));
}
}
}
return "";
}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
var _2f=document.getElementsByTagName("OBJECT");
for(var i=_2f.length-1;i>=0;i--){
_2f[i].style.display="none";
for(var x in _2f[i]){
if(typeof _2f[i][x]=="function"){
_2f[i][x]=function(){
};
}
}
}
};
if(deconcept.SWFObject.doPrepUnload){
if(!deconcept.unloadSet){
deconcept.SWFObjectUtil.prepUnload=function(){
__flash_unloadHandler=function(){
};
__flash_savedUnloadHandler=function(){
};
window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);
};
window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);
deconcept.unloadSet=true;
}
}
if(!document.getElementById&&document.all){
document.getElementById=function(id){
return document.all[id];
};
}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
if(!this["t61"]){
var t61={};
}
t61.global_scope=this;
t61.song={destroy:function(_481){
var msg="Deleting a song will cause listeners to lose the points they gained from bumping the removed track. If you want to re-upload a song you can do so through the 'edit' link on the player. Do you still want to delete this song?";
if(confirm(msg)){
new Ajax.Request("/song/destroy/"+_481+"/");
}
},download:function(_483){
if(t61.is_logged_in){
new Ajax.Request("/song/download_popup/"+_483+"/");
}else{
t61.show_login_notice();
}
},_autorepeat_on:false,toggle_autorepeat:function(){
t61.song._autorepeat_on=!t61.song._autorepeat_on;
var word="off";
if(t61.song._autorepeat_on){
word="on";
}
t61.notice.create("Auto-repeat is "+word+".");
},handle_song_complete:function(){
if(t61.song._autorepeat_on){
t61.flashplayer.reset_song();
t61.current_song.play();
return;
}
t61.current_song.playing=false;
if(!t61.current_song.rack_item_id){
t61.playlist.play_next_song();
}else{
t61.current_song.complete_rack_item();
}
},set_not_playing:function(){
t61.current_song.reset();
document.title=t61.page_title;
if(t61._playback_interval){
clearInterval(t61._playback_interval);
t61._playback_interval=null;
}
}};
t61.quests={log_opened:false,update_count:function(_485){
$("current_quest_count").update(_485);
},open_log:function(){
new Ajax.Request("/quest/list/");
t61.quests.log_opened=true;
$("current_quest_count").setOpacity(1);
},pulsate_quest_count:function(){
if((!t61.quests.log_opened)&&($("current_quest_count"))){
Effect.Fade("current_quest_count",{from:1,to:0.4,queue:{position:"end",scope:"quest_count"},duration:0.75});
Effect.Appear("current_quest_count",{from:0.4,to:1,queue:{position:"end",scope:"quest_count"},duration:0.75});
setTimeout(t61.quests.pulsate_quest_count,1500);
}
if(BrowserDetect.browser!="Firefox"){
$("quest_log_link").style.position="absolute";
}
}};
t61.flashfileio={_initialized:false,_in_progress:false,init:function(){
if(!t61.flashfileio._initialized){
var fo=new SWFObject(t61.media_url+"/site_media/swf/file_io.v"+t61.revision+".swf","flash_file_io","80","40","9","#666666",true);
fo.addParam("allowScriptAccess","always");
fo.write("flash_file_io_content");
t61.flashfileio._initialized=true;
}
},download_purchased_album:function(_487,_488,_489){
if(t61.flashfileio._in_progress){
t61.notice.create("You can only download one file at a time.");
t61.popup.hide();
return;
}
t61.flashfileio.init();
t61.flashfileio.onload(function(){
$("flash_file_io").set_django_env(t61.environment);
$("flash_file_io").load_url_for_purchased_album(_487,_489);
$("flash_file_io").set_filename(_488+".zip");
});
},download_purchased_song:function(_48a){
if(t61.flashfileio._in_progress){
t61.notice.create("You can only download one file at a time.");
t61.popup.hide();
return;
}
t61.flashfileio.init();
var song=t61.song.get_by_id(_48a);
t61.flashfileio.onload(function(){
$("flash_file_io").set_django_env(t61.environment);
$("flash_file_io").load_url_for_purchased_song(song.id);
$("flash_file_io").set_filename(song.get_filename());
});
},download:function(_48c){
if(t61.flashfileio._in_progress){
t61.notice.create("You can only download one file at a time.");
t61.popup.hide();
return;
}
t61.flashfileio.init();
var song=t61.song.get_by_id(_48c);
t61.flashfileio.onload(function(){
$("flash_file_io").set_django_env(t61.environment);
$("flash_file_io").set_download_url(song.key,song.audio_server,song.id);
$("flash_file_io").set_filename(song.get_filename());
});
},onload:function(func){
if($("flash_file_io")&&$("flash_file_io").set_django_env){
func();
}else{
setTimeout(function(){
t61.flashfileio.onload(func);
},100);
}
},complete_handler:function(){
t61.flashfileio._in_progress=false;
$("progress_label").update("completed");
setTimeout(t61.flashfileio.hide_progress,2000);
t61.flashfileio.progress_handler(1,1);
t61.popup.hide();
if(t61.flashfileio._buy_album_id){
new Ajax.Request("/purchases/show_completion/"+t61.flashfileio._buy_album_id+"/");
t61.flashfileio._buy_album_id=null;
}else{
if(t61.flashfileio._buy_song_id){
new Ajax.Request("/purchases/show_completion/song/"+t61.flashfileio._buy_song_id+"/");
t61.flashfileio._buy_song_id=null;
}
}
},progress_handler:function(_48f,_490){
if(t61.flashfileio._animation_in_progress){
setTimeout(function(){
t61.flashfileio.progress_handler;
},50);
}
var _491=parseInt(_48f/_490*198);
_491=_491-(_491%14);
new Effect.Morph("progress_bar",{style:{width:_491+"px"},duration:0.05});
t61.flashfileio._animation_in_progress=true;
setTimeout(function(){
t61.flashfileio._animation_in_progress=false;
},50);
},select_handler:function(){
t61.flashfileio._in_progress=true;
t61.flashfileio.show_progress();
t61.popup.hide();
$("progress_label").update("downloading");
$("progress_bar").style.width="0px";
},error_handler:function(text){
t61.popup.hide();
t61.notice.create("error: "+text);
t61.flashfileio._in_progress=false;
t61.flashfileio.hide_progress();
},show_progress:function(){
new Effect.Morph("progress_floater",{style:{marginTop:"-38px"},duration:0.5});
},hide_progress:function(){
new Effect.Morph("progress_floater",{style:{marginTop:"0px"},duration:0.5});
}};
t61.update_num_listeners=function(){
if(!t61.current_song){
return;
}
try{
if($("num_listeners")){
var _493=parseInt($("num_listeners").firstChild.data);
_493+=1;
if((!t61._first_played_count)||(t61._first_played_count==_493)){
$("num_listeners").update(_493);
}
if(!t61._first_played_count){
t61._first_played_count=_493;
}
}
}
catch(e){
}
};
t61.user={check_for_login_award:function(){
if(t61.just_logged_in){
new Ajax.Request("/user/post_login/",{evalScripts:true});
}
},start_login:function(_494,_495){
new Ajax.Request("/user/get_salt/"+_494+"/",{onSuccess:function(t){
if(t.responseText!=""){
var _497=t.responseText.split(",");
var salt=_497[0];
var key=_497[1];
t61.user.do_encrypted_login(salt,key,_494,_495);
}else{
t61.notice.error("The e-mail or username was not found, please try again.");
Element.hide("ajax_loader");
}
}});
},do_encrypted_login:function(salt,key,_49c,_49d){
var _49e=hex_sha1(key+hex_sha1(salt+_49d));
if(t61.flashplayer&&t61.flashplayer.encrypted_login){
t61.flashplayer.encrypted_login(_49c,_49e);
}else{
new Ajax.Request("/user/login/",{parameters:{"email":_49c,"hashed_password":_49e}});
}
},keep_alive:function(){
var now=new Date();
var _4a0=30*60*1000;
if((t61.user._last_keep_alive==null)||((now-t61.user._last_keep_alive)>_4a0)){
new Ajax.Request("/user/subscribe_to_radio_playlist/",{method:"post",parameters:{url:"/hot/all"},hideLoader:true});
t61.user._last_keep_alive=now;
}
},logout:function(){
new Ajax.Request("/user/logout/");
},_last_keep_alive:null};
t61._bump_in_progress=false;
t61._num_times_bumped={};
t61.current_song=null;
t61.default_volume=0.5;
t61.song._songs={};
t61.Song=Class.create();
t61._completed_rack_items={};
t61._playback_interval=null;
t61.song.buy=function(_4a1){
if(t61.flashfileio._in_progress){
t61.notice.create("Please wait until the download completes.");
return;
}
new Ajax.Request("/purchases/buy_song_popup/"+_4a1+"/");
};
t61.Song.prototype={initialize:function(_4a2,_4a3){
if(!_4a3){
_4a3={};
}
this.load_data(_4a2);
this.load_elements();
this.bind_ui();
},load_data:function(data){
for(var prop in data){
this[prop]=data[prop];
}
},bind_clickable:function(){
this.clickable._onclick=function(_4a6){
t61.song.toggle(this.id);
}.bind(this);
this.clickable._onmouseover=function(_4a7){
if(this.buttons.length>0){
Element.show(this.buttons[0]);
}
}.bind(this);
this.clickable._onmouseout=function(_4a8){
if(this.buttons.length>0){
Element.hide(this.buttons[0]);
}
}.bind(this);
Event.observe(this.clickable,"mouseover",this.clickable._onmouseover);
Event.observe(this.clickable,"mouseout",this.clickable._onmouseout);
Event.observe(this.clickable,"click",this.clickable._onclick);
},unbind_clickable:function(){
Event.stopObserving(this.clickable,"mouseover",this.clickable._onmouseover);
Event.stopObserving(this.clickable,"mouseout",this.clickable._onmouseout);
Event.stopObserving(this.clickable,"click",this.clickable._onclick);
this.clickable._onmouseover=null;
this.clickable._onmouseout=null;
this.clickable._onclick=null;
},load_clickable:function(){
if(!this.player){
return;
}
if(this.player.hasClassName("clickable")){
this.clickable=this.player;
}else{
var _4a9=this.player.getElementsByClassName("clickable");
if(_4a9.length>0){
this.clickable=_4a9[0];
}
}
},unbind_button:function(_4aa){
Event.stopObserving(_4aa,"click",_4aa._onclick);
_4aa._onclick=null;
Event.stopObserving(_4aa,"mouseover",_4aa._onmouseover);
_4aa._onmouseover=null;
Event.stopObserving(_4aa,"mouseout",_4aa._onmouseout);
_4aa._onmouseout=null;
},add_button:function(_4ab){
this.buttons.push(_4ab);
_4ab._onclick=this.toggle.bind(this);
_4ab._onmouseover=t61.song.hover_button.bind(_4ab);
_4ab._onmouseout=t61.song.unhover_button.bind(_4ab);
Event.observe(_4ab,"click",_4ab._onclick);
Event.observe(_4ab,"mouseover",_4ab._onmouseover);
Event.observe(_4ab,"mouseout",_4ab._onmouseout);
},complete_rack_item:function(){
new Ajax.Request("/therack/complete/"+this.rack_item_id+"/");
},toggle:function(_4ac){
t61.util.stop_event(_4ac);
if(this.buttons&&this.buttons[0].hasClassName("play_button")){
this.play();
}else{
this.pause();
}
},toggle_buttons:function(_4ad){
if(!_4ad){
_4ad={};
}
if(this.buttons){
for(var i=0;i<this.buttons.length;i++){
t61.song.toggle_button(this.buttons[i],_4ad);
}
}
},pause:function(_4af){
if(!_4af){
_4af={};
}
if(!t61.flashplayer){
var song=this;
setTimeout(function(){
song.pause(_4af);
},500);
return;
}
this.toggle_buttons();
t61.flashplayer.pause_song();
t61.song.set_not_playing();
t61.miniplayer.handle_pause();
},play:function(_4b1){
if(!t61.flashplayer){
var song=this;
setTimeout(function(){
song.play(_4b1);
},500);
return;
}
if(!_4b1){
_4b1={};
}
if(!_4b1.in_playlist){
if(_4b1.in_favorited){
t61.playlist.load(t61.miniplayer._favorited_song_data,_4b1);
}else{
t61.playlist.load(t61.song.data,_4b1);
}
t61.user.keep_alive();
}
t61.update_num_listeners();
t61.song.set_current(this,_4b1);
if(this.disabled){
t61.notice.create("Sorry, this song has been deleted.");
setTimeout(t61.song.handle_song_complete,5000);
return;
}
this.playing=true;
this.toggle_buttons({play:true});
if(!_4b1.skip_flash_play){
t61.flashplayer.play_song(this.key,parseInt(this.id),this.rack_item_id,this.play_time,this.audio_server);
if(t61._playback_interval){
clearInterval(t61._playback_interval);
}
t61._playback_interval=setInterval(function(){
t61.flashplayer.send_playback_state();
},100);
}
var _4b3=$("song_name_"+this.id);
if(_4b3){
_4b3.update(this.name.truncate(20));
}
var _4b4=t61.get_volume();
if(this.volume_slider){
this.volume_slider.setValue(_4b4,null,false);
t61.util.pngfix($("volume_track_"+this.id));
}
t61.miniplayer.set_volume(_4b4);
t61.set_flash_volume(_4b4);
if(this.rack_item_id){
new Ajax.Request("/therack/popup/"+this.id+"/",{evalScripts:true});
}
t61.tutorial.do_first_play_tip();
t61.miniplayer.handle_play();
var song=this;
if(!this._snippet_shown&&($("song_snippet"))){
setTimeout(function(){
if(t61.current_song.id==song.id){
song.show_snippet();
}
},10000);
}
},show_snippet:function(_4b5){
if(!_4b5){
_4b5={};
}
this._snippet_shown=true;
new Ajax.Request("/song/snippet/"+this.id+"/");
},refresh:function(){
this.unbind_ui();
this.load_elements();
this.bind_ui();
},get_rank_metric:function(){
var _4b6=this.score;
if(t61.context.subnav=="hot"){
_4b6=this.hotness;
}
return _4b6;
},update_position:function(){
if(t61.context.subnav=="hot"){
if(this.position>0){
var i=1;
var _4b8=t61.song.get_by_position(this.position-i);
var _4b9=-1;
while(((this.position-i)>=0)&&this.get_rank_metric()>_4b8.get_rank_metric()){
i++;
_4b9=_4b8;
_4b8=t61.song.get_by_position(this.position-i);
}
if(_4b9!=-1){
this.swap(_4b9);
}
}
}
},swap:function(_4ba){
var top=this.player.parentNode;
var _4bc=_4ba.player;
if(_4bc){
Effect.Fade(this.player.id,{"duration":1,"to":0.1});
Effect.Fade(_4ba.player.id,{"duration":1,"to":0.1});
setTimeout((function(){
var _4bd=t61.song.get_by_position(this.position-1);
var tmp=_4ba.position;
_4ba.position=this.position;
this.position=tmp;
t61.song.data.id_by_position[_4ba.position]=_4ba.id;
t61.song.data.id_by_position[this.position]=this.id;
top.removeChild(this.player);
top.insertBefore(this.player,_4bc);
if(_4bd!=_4ba){
top.removeChild(_4bc);
var _4bf=_4bd.player.next(0);
top.insertBefore(_4bc,_4bf);
}
Effect.Appear(this.player.id,{"duration":1});
Effect.Appear(_4ba.player.id,{"duration":1});
}).bind(this),1000);
}
},hide_status:function(){
if(this.status){
Effect.Fade(this.status,{queue:"end",duration:0.5});
}
if(this.song_info){
Effect.Appear(this.song_info,{queue:"end",duration:0.5});
}
t61.miniplayer.hide_status();
},show_status:function(msg){
if(this.rack_item_id){
t61.popup.show();
t61.popup.set_status(msg);
this.status=$("popup_status");
}else{
if(this.status){
this.status.innerHTML=msg;
}
}
if(this.song_info){
Element.hide(this.song_info);
}
if(this.status){
this.status.style.display="";
}
},load_elements:function(){
if(this.buttons){
for(var i=0;i<this.buttons.length;i++){
this.unbind_button(this.buttons[i]);
}
}
this.buttons=[];
var _4c2=$("song_button_"+this.id);
var _4c3=$("song_rack_item_button_"+this.id);
if(_4c2){
this.add_button(_4c2);
}
if(_4c3){
this.add_button(_4c3);
}
this.player=$("song_player_"+this.id);
this.song_metadata=$("song_metadata_"+this.id);
this.score_box=$("song_score_"+this.id);
this.song_info=$("song_info_"+this.id);
this.clock=$("song_clock_"+this.id);
this.load_status();
this.load_clickable();
if((this.buttons.length>0)||this.player||this.score_box){
this.visible=true;
}else{
this.visible=false;
}
this.process_links_for_player();
},process_links_for_player:function(_4c4){
if(!_4c4){
_4c4=this.player;
}
if(!_4c4){
return;
}
var _4c5=_4c4.getElementsByTagName("a");
for(var i=0;i<_4c5.length;i++){
var link=_4c5[i];
}
},load_status:function(){
if(this.rack_item_id){
this.status=$("popup_status");
}else{
this.status=$("song_status_"+this.id);
}
},toggle_drawer:function(mode,_4c9){
if(!_4c9){
_4c9={};
}
if(!_4c9.duration){
_4c9.duration=0.35;
}
if(!this.drawer_mode){
this.drawer_mode==mode;
}
if(this.drawer_displayed){
if(mode!=this.drawer_mode){
this.drawer_mode=mode;
return;
}
this.drawer_displayed=false;
if(BrowserDetect.browser=="Opera"){
this.drawer_content.style.height="0px";
}else{
new Effect.Morph(this.drawer_content,{style:{height:"0px"},queue:{position:"end",scope:"drawer"},duration:_4c9.duration});
var _4ca=this.drawer_close;
setTimeout(function(){
Element.hide(_4ca);
},_4c9.duration*1000);
}
var _4cb=$("drawer_page_links_"+this.id);
if(_4cb){
Element.hide(_4cb);
}
var _4cc=this.drawer_content.getElementsByClassName("multiplier_overlay");
var _4cd=this.drawer_content.getElementsByClassName("multiplier_text");
for(var i=0;i<_4cc.length;i++){
Element.hide(_4cc[i]);
}
for(var i=0;i<_4cd.length;i++){
Element.hide(_4cd[i]);
}
if(BrowserDetect.browser!="Opera"){
setTimeout(function(){
this.drawer_content.update("");
}.bind(this),1000);
}
}else{
for(var id in t61.song._songs){
var song=t61.song._songs[id];
if(song.drawer_displayed){
song.toggle_drawer(song.drawer_mode);
}
}
this.drawer_displayed=true;
this.drawer_content.innerHTML="<div style='text-align: center;'>Loading...</div>";
if(BrowserDetect.browser=="Opera"){
this.drawer_content.style.height="420px";
}else{
new Effect.Morph(this.drawer_content,{style:{height:"420px"},queue:{position:"end",scope:"drawer"},duration:_4c9.duration});
var _4ca=this.drawer_close;
setTimeout(function(){
Element.show(_4ca);
},_4c9.duration*1000);
}
}
this.drawer_mode=mode;
},reset:function(){
if(this.visible){
if(this.buttons){
for(var i=0;i<this.buttons.length;i++){
this.buttons[i].addClassName("play_button");
this.buttons[i].removeClassName("pause_button");
t61.song.unhover_button.bind(this.buttons[i])();
}
}
}
this.playing=false;
if(this.player){
this.player.style.cssText="";
this.player._loader_initialized=false;
}
var _4d2=$("progress_time_"+this.id);
if(_4d2){
_4d2.update("");
}
var _4d3=$("song_name_"+this.id);
if(_4d3){
_4d3.update(this.name.truncate(25));
}
},get_bump_cost:function(){
var bcs=t61.bump_cost_structure;
var c=this.bumpers_count;
var p=bcs.bumps_needed_for_publishing;
var _4d7=bcs.publish_cost_offset;
if(this.score=="?"){
return "?";
}
var _4d8=0;
var cost;
if(c==0){
cost=bcs.discovery_cost;
}else{
if(c<p){
cost=parseInt(bcs.discovery_cost-1*c/p*(bcs.discovery_cost-bcs.bump_cost-_4d7)-_4d7);
}else{
cost=bcs.bump_cost;
}
}
cost*=1+_4d8;
return parseInt(cost);
},has_played_enough:function(){
var _4da=parseInt(this.id);
var _4db=t61.played_time_by_song_id[_4da];
var _4dc=Math.min(60,this.play_time-10);
return (_4db>=_4dc);
},bump:function(_4dd){
if(!_4dd){
_4dd={};
}
var _4de=parseInt(this.id);
var _4df=this.has_played_enough();
if(t61.bump_attempted_by_song_id[_4de]&&!_4df){
var _4e0=t61.played_time_by_song_id[_4de];
if(_4e0!=null){
t61.notice.create(parseInt(60-_4e0)+" seconds left before you can heart.");
}else{
t61.notice.create("Give it a listen first!");
}
t61._bump_in_progress=false;
return;
}
if(t61.beta_flag&&(t61.bumps.cur_available<=0)){
t61.notice.create("Sorry you ran out of hearts.");
t61.tutorial.do_rack_tip(4000);
return;
}
if(t61._bump_in_progress){
t61.notice.error("Please wait before hearting again.");
if(!t61._bump_timeout_set){
setTimeout(function(){
t61._bump_in_progress=false;
t61._bump_timeout_set=false;
},5000);
t61._bump_timeout_set=true;
}
return;
}
t61._bump_in_progress=true;
var _4e1="?played_enough="+_4df;
if(_4dd.complete_bump_tutorial){
_4e1+="&complete_bump_tutorial";
}
if(_4dd.skip_tutorial){
_4e1+="&skip_tutorial";
}
if(this.rack_item_id){
_4e1+="&for_therack";
}
if(_4dd.agreed_to_pay){
_4e1+="&agreed_to_pay";
}
new Ajax.Request("/bump/create/"+this.id+"/"+_4e1);
},on_bump_button_mouseover:function(_4e2){
t61.mousehover_panel.show(_4e2);
if(!this.bump_cost){
this.bump_cost=this.get_bump_cost();
}
t61.mousehover_panel._song_id=this.id;
if(t61.is_artist){
t61.mousehover_panel.update("cost: "+this.bump_cost+" points");
}else{
if(!t61.is_logged_in){
if(this.score){
t61.mousehover_panel.update("Humans have "+t61.get_bump_word()+"ed this "+this.score+" times.<br/> You can too by joining or logging in.");
}else{
t61.mousehover_panel.update("You can heart this song by joining or logging in");
}
return;
}
}
var _4e3=t61._num_times_bumped[parseInt(this.id)];
if(_4e3==undefined){
_4e3=0;
}
if(t61.beta_flag){
t61.mousehover_panel.update(t61.get_bump_word()+"ed: "+_4e3+" times");
t61.mousehover_panel.append("<br/>hearts left today: "+t61.bumps.cur_available);
}else{
t61.mousehover_panel.update("cost: "+this.bump_cost+" points");
t61.mousehover_panel.append("<br/>"+t61.get_bump_word()+"ed: "+_4e3+" times");
t61.mousehover_panel.append("<br/>my points: "+t61.points.cur_points);
}
},bind_bump_button:function(){
this.bump_button=$("bump_button_wrapper_"+this.id)||$("rack_item_bump_button_"+this.id);
if(this.bump_button){
this._on_bump_button_mouseover=this.on_bump_button_mouseover.bind(this);
Event.observe(this.bump_button,"mouseover",this._on_bump_button_mouseover);
Event.observe(this.bump_button,"mouseout",t61.mousehover_panel.hide);
if(t61._num_times_bumped[parseInt(this.id)]){
t61.bumps.fill_button(this.id);
}
}
},unbind_bump_button:function(){
if(this.bump_button){
Event.stopObserving(this.bump_button,"mouseover",this._on_bump_button_mouseover);
Event.stopObserving(this.bump_button,"mouseout",t61.mousehover_panel.hide);
delete (this._on_bump_button_mouseover);
}
},bind_clock:function(){
this.clock=$("song_clock_"+this.id);
if(this.clock){
this._on_clock_mouseover=this.on_clock_mouseover.bind(this);
Event.observe(this.clock,"mouseover",this._on_clock_mouseover);
Event.observe(this.clock,"mouseout",t61.mousehover_panel.hide);
}
},unbind_clock:function(){
if(this.clock){
Event.stopObserving(this.clock,"mouseover",this._on_clock_mouseover);
Event.stopObserving(this.clock,"mouseout",t61.mousehover_panel.hide);
delete (this._on_clock_mouseover);
}
},on_clock_mouseover:function(_4e4){
t61.mousehover_panel.show(_4e4);
t61.mousehover_panel.update("This number will be revealed within 24 hours.");
},on_download_link_mouseover:function(_4e5){
t61.mousehover_panel.show(_4e5);
var _4e6;
if(this.license_type){
_4e6={"cc_nc_nd":"Creative Commons: Attribution Non-commercial No Derivatives","cc_nc_sa":"Creative Commons: Attribution Non-commercial Share Alike","cc_nc":"Creative Commons: Attribution Non-commercial","cc_nd":"Creative Commons: Attribution No Derivatives","cc_sa":"Creative Commons: Attribution"}[this.license_type];
}
if(!_4e6){
_4e6="All rights reserved";
}
t61.mousehover_panel.update("license: "+_4e6);
},bind_download_link:function(){
this.download_link=$("song_download_link_"+this.id)||$("song_buy_link_"+this.id);
if(this.download_link){
this._on_download_link_mouseover=this.on_download_link_mouseover.bind(this);
Event.observe(this.download_link,"mouseover",this._on_download_link_mouseover);
Event.observe(this.download_link,"mouseout",t61.mousehover_panel.hide);
}
},unbind_download_link:function(){
if(this.download_link){
Event.stopObserving(this.download_link,"mouseover",this._on_download_link_mouseover);
Event.stopObserving(this.download_link,"mouseout",t61.mousehover_panel.hide);
delete (this._on_download_link_mouseover);
}
},register_mousehover_item:function(el,name){
if(!this.mousehover_panel_items){
this.mousehover_panel_items=[];
}
this.mousehover_panel_items.append({"element":el,"name":name});
},bind_ui:function(){
this.bind_bump_button();
this.bind_download_link();
if(!this.player){
return;
}
this.drawer=$("song_drawer_"+this.id);
this.drawer_close=$("song_drawer_close_"+this.id);
this.drawer_content=$("song_drawer_content_"+this.id);
this.drawer_displayed=false;
if(this.clickable){
this.bind_clickable();
}
if(this.clock){
this.bind_clock();
}
},unbind_ui:function(){
this.unbind_bump_button();
this.unbind_download_link();
if(this.clock){
this.bind_clock();
}
if(this.clickable){
this.unbind_clickable();
}
},destroy:function(){
this.unbind_ui();
delete (this.player);
if(this.buttons){
for(var i=0;i<this.buttons.length;i++){
this.unbind_button(this.buttons[i]);
delete (this.buttons[i]);
}
}
delete (this.bump_cost);
delete (this.buttons);
delete (this.vote_button);
delete (this.score_box);
delete (this.status);
delete (this.drawer);
delete (this.drawer_displayed);
delete (this.clickable);
delete (this._snippet_shown);
delete (this.bump_button);
delete (this.download_link);
delete (this.clock);
if(!t61.song.is_current(this)){
delete (this.rack_item_id);
}
delete (this.position);
this.drawer_mode="closed";
},get_filename:function(){
var _4ea=this.artist+" - "+this.name+".mp3";
_4ea=_4ea.replace(/\/|\?|\:/g,"");
return _4ea;
}};
t61.show_login_notice=function(){
new Ajax.Request("/user/show_login_popup/",{evalScripts:true});
};
t61.song.add=function(id,_4ec){
if(!_4ec){
_4ec={};
}
var song=t61.song.get_by_id(id);
if(t61.is_logged_in){
song.load_status();
var url="/profile/favorites/favorite/"+id+"/";
if(_4ec.from_miniplayer){
t61.miniplayer.show_status("Saving song...");
url+="?from_miniplayer=true";
}else{
song.show_status("Saving song...");
}
if(song.rack_item_id!=null){
url+="?quest";
}
new Ajax.Request(url,{evalScripts:true});
}else{
t61.show_login_notice();
}
};
t61.song.toggle=function(id,_4f0){
if(!_4f0){
_4f0={};
}
if(t61._loading_page){
return;
}
var song=t61.song.get_by_id(id);
if(song){
if(t61.current_song&&(t61.current_song.id==id)&&t61.current_song.playing){
song.pause();
}else{
song.play(_4f0);
}
}
t61.mousehover_panel.hide();
};
t61.song.bump=function(id){
var song=t61.song.get_by_id(id);
if(song){
song.bump();
}
};
t61.persist_flash_volume=function(v){
t61.set_flash_volume(v);
t61.user_volume=v;
new Ajax.Request("/user/set_volume/"+v+"/",{evalScripts:true});
};
t61.set_flash_volume=function(v){
t61.flashplayer.set_volume(v);
};
t61.song.get_by_id=function(id){
return t61.song._songs[id];
};
t61.song.store=function(song){
t61.song._songs[song.id]=song;
};
t61.song.get_by_position=function(_4f8){
if(!t61.song.data){
t61.song.data={"by_id":{},"id_by_position":[]};
}
return t61.song.get_by_id(t61.song.data.id_by_position[_4f8]);
};
t61.song.toggle_button=function(_4f9,_4fa){
if(!_4fa){
_4fa={};
}
if(_4fa.play){
_4f9.removeClassName("play_button");
_4f9.addClassName("pause_button");
}else{
_4f9.toggleClassName("pause_button");
_4f9.toggleClassName("play_button");
}
t61.song.unhover_button.bind(_4f9)();
t61.song.hover_button.bind(_4f9)();
};
t61.song.reset_all=function(){
var _4fb=t61.song.buttons;
for(var i=0;i<_4fb.length;i++){
t61.song.unhover_button.bind(_4fb[i])();
if(_4fb[i].hasClassName("pause_button")){
var song=t61.song.get_by_id(_4fb[i].getAttribute("song_id"));
}
_4fb[i].addClassName("play_button");
_4fb[i].removeClassName("pause_button");
}
};
t61.song.receive_playback_state=function(_4fe,_4ff,_500,_501,_502){
var _503=t61.current_song.play_time*1000;
t61.miniplayer.set_volume(_502);
t61.current_song.loaded_duration=_501;
t61.song.update_loader(_501,_503);
t61.song.update_volume(_502);
t61.song.update_progress(_500,_503);
t61.current_song.progress=_500;
var _504=parseInt(t61.current_song.id);
if(t61.played_time_by_song_id[_504]){
t61.played_time_by_song_id[_504]+=0.1;
}else{
t61.played_time_by_song_id[_504]=0.1;
}
if(t61.bump_attempted_by_song_id[_504]&&(t61.played_time_by_song_id[_504]>60)){
t61.bump_attempted_by_song_id[_504]=false;
var _505=t61.current_song.name.match(/\?+/)!=null;
var _506=_505?t61.media_url+"/site_media/images/notice_icons/simple_question_mark.png":t61.current_song.photo_base_url+"_tiny";
t61.notice.create("You may heart \""+t61.current_song.name+"\" now.",_506);
}
};
t61.song.update_volume=function(vol){
t61.miniplayer.set_volume(vol);
};
t61.song.update_loader=function(_508,_509){
if(!t61.current_song){
return;
}
var _50a=null;
var _50b=null;
if(t61.current_song.player&&t61.current_song.player.hasClassName("main_song_player")){
_50a=450;
_50b="player_loader.gif";
}else{
if(t61.current_song.player&&t61.current_song.player.hasClassName("song_result")){
_50a=620;
_50b="song_result_loader.gif";
}
}
if(_50a){
t61.current_song.player.style.backgroundPosition=parseInt(_50a*Math.min(-1+_508/_509,0))+"px 0px";
}
if(t61.current_song.player&&!t61.current_song.player._loader_initialized){
t61.current_song.player.style.background="url(/site_media/images/"+_50b+") 0px 0px";
t61.current_song.player._loader_initialized=true;
}
t61.miniplayer.update_loader(_508,_509);
};
t61.song.update_progress=function(_50c,_50d){
var _50e=t61.current_song.play_time*1000-_50c;
var _50f=parseInt(_50e/1000)%60;
var _510=parseInt(_50e/60000);
if(_50f<10){
_50f="0"+_50f;
}
var _511=_510+":"+_50f;
var _512=$("progress_time_"+t61.current_song.id);
if(_512){
_512.innerHTML=_511;
}
t61.miniplayer.update_progress_time(_511);
if(t61.current_song.progress_slider&&!t61.current_song.progress_slider.active){
t61.current_song.progress_slider.setValue(_50c/_50d,null,false);
}
if(!t61.miniplayer.progress_slider.active){
t61.miniplayer.update_progress(_50c/_50d);
t61.miniplayer.progress_slider.setValue(_50c/_50d,null,false);
}
};
t61.therack={open:function(){
new Ajax.Request("/therack/");
}};
t61.song.get_song_link=function(song,_514){
if(!_514){
_514={};
}
if(!_514.css_class){
_514.css_class="dark";
}
var _515,_516;
var _517=t61.current_song.name.truncate(30);
var _518=_514.base_url?_514.base_url:t61.playlist.current.base_url;
var page=_514.page?_514.page:t61.playlist.current.page;
var _51a=t61.util.get_safe_name(song.name);
if(song.rack_item_id){
_516="<a href='#' onclick='new Ajax.Request(\"/therack/popup/"+song.id+"/\", {evalScripts: true}); return false;' class='"+_514.css_class+"' >"+_517+"</a>";
_515="/"+song.artist_username+"/song/"+_51a+"/"+song.id+"/";
}else{
var _51b=t61.context;
var _51c=(t61.playlist.current.shuffled);
if(_518&&(!_51c)){
_51b.refresh_rightbar=true;
if(_518.match("/radio")||_518.match("play_on_demand")||_518.match("recommendations")){
_515="/"+song.artist_username+"/song/"+_51a+"/"+song.id+"/";
}else{
if((t61.playlist.current.page!=null)&&page&&(parseInt(page)>1)){
_515=_518+"/"+page+"/?goto_song_id="+song.id;
}else{
_515=_518+"/?goto_song_id="+song.id;
}
}
}else{
_515="/"+song.artist_username+"/song/"+_51a+"/"+song.id+"/";
}
if(_515.indexOf("?")!=-1){
_515+="&full_refresh";
}else{
_515+="?full_refresh";
}
_516=t61.util.link_to_remote(_517,_515,_514.css_class,_51a);
}
return {"html":_516,"url":_515};
};
t61.song.set_current=function(song,_51e){
if(!_51e){
_51e={};
}
if(t61.current_song&&!t61.song.is_current(song)){
if(t61.current_song.visible){
t61.current_song.reset();
}
if(t61.current_song.rack_item_id){
if(!song.rack_item_id){
t61.popup.hide();
}
}
}
if(song){
t61.current_song=song;
var _51f=t61.current_song.artist+" - "+t61.current_song.name;
document.title=_51f;
t61.miniplayer.set_current_song(t61.current_song,_51e);
}
};
t61.song.hover_button=function(){
if(this.hasClassName("play_button")){
this.addClassName("play_button_hover");
}else{
if(this.hasClassName("pause_button")){
this.addClassName("pause_button_hover");
}else{
if(this.hasClassName("next_button")){
this.addClassName("next_button_hover");
}else{
if(this.hasClassName("prev_button")){
this.addClassName("prev_button_hover");
}
}
}
}
};
t61.song.unhover_button=function(){
this.removeClassName("play_button_hover");
this.removeClassName("pause_button_hover");
this.removeClassName("next_button_hover");
this.removeClassName("prev_button_hover");
};
t61.song.is_current=function(song){
return (t61.current_song&&t61.current_song.id==song.id);
};
t61.song.teardown=function(_521){
if(!_521){
_521={};
}
var _522=t61.song._songs;
if(_521.preserve_current_song&&t61.current_song&&t61.current_song.playing){
delete (_522[t61.current_song.id]);
}
for(var id in _522){
_522[id].visible=false;
}
if(t61.song.data){
for(var id in t61.song.data.by_id){
var song=t61.song.get_by_id(id);
if(song){
song.destroy();
}
}
}
if(_521.preserve_current_song&&t61.current_song&&t61.current_song.playing){
_522[t61.current_song.id]=t61.current_song;
}
};
t61.song.init=function(_525){
if(!_525){
_525={};
}
var _526=t61.song._songs;
if(!t61.song.data){
t61.song.data={"by_id":{},"id_by_position":[]};
}
if(t61.current_song&&t61.current_song.rack_item_id&&t61.song.data.by_id[t61.current_song.id]){
var _527=t61.song.data.by_id[t61.current_song.id];
_527.rack_item_id=t61.current_song.rack_item_id;
}
var _528=[];
for(var id in t61.song.data.by_id){
var song=t61.song.get_by_id(id);
var _52b=t61.song.data.by_id[id];
if(!song){
song=new t61.Song(_52b);
t61.song.store(song);
}else{
song.refresh();
song.load_data(_52b);
}
var _52c=parseInt(id);
if(t61.is_logged_in&&(!t61.is_artist)&&(!t61.is_label)&&(!t61.bumps._completely_loaded)&&(t61._num_times_bumped[_52c]==null)){
_528.push(_52c);
t61._num_times_bumped[_52c]=0;
}
}
if(_528.length>0){
new Ajax.Request("/bump/load_num_times_bumped/",{parameters:"song_ids="+_528});
}
for(var id in _526){
var song=_526[id];
if(!song.visible&&!t61.playlist.is_song_id_active(id)&&!t61.miniplayer.is_song_id_active(id)&&!t61.song.is_current(song)&&!song.rack_item_id){
song.destroy();
delete (_526[id]);
}
}
var _52d=[];
for(var id in t61.song.data.by_id){
var song=t61.song.data.by_id[id];
if(song.rack_item_id){
var _52e=$("song_rack_item_button_"+id);
}else{
var _52e=$("song_button_"+id);
}
if(_52e){
_52d.push(_52e);
}
}
t61.song.buttons=_52d;
if(t61.current_song&&t61.song.data.by_id[t61.current_song.id]&&t61.current_song.playing){
if(t61.current_song.buttons){
t61.current_song.toggle_buttons({play:true});
}
}
t61._bump_in_progress=false;
if(t61.context.nav=="home"&&t61.context.goto_song_id){
var song=t61.song.get_by_id(t61.context.goto_song_id);
if(song){
t61.util.smooth_scroll(Math.max(0,-150+75*song.position));
}
}
if(t61.context.play_first_song=="on"){
var _52f=t61.song.get_by_position(0);
if(_52f){
_52f.play();
}
t61.context.play_first_song=="off";
}
};
t61.set_selected_genre=function(_530){
var type="genre";
if(_530=="subgenre"){
type="subgenre";
}
var _532=(t61.context[type+"_name"]=="")?"all":t61.context[type+"_name"];
var top=$(type+"_buttons");
if(!top){
return;
}
var _534=top.getElementsByClassName("selected");
for(var i=0;i<_534.length;i++){
_534[i].removeClassName("selected");
}
var _536=$(type+"_label_"+_532);
if(_536){
_536.addClassName("selected");
}
};
t61.process_url=function(url){
return url.replace(/\s/g,"%20").replace(t61.site_url,"");
};
t61.get_current_url=function(){
var url=t61.get_url_from_anchor();
if(!url){
url=t61.get_url_without_anchor();
}
return url;
};
t61.get_url_from_anchor=function(){
var _539=document.location.href;
var _53a=_539.indexOf("#");
if(_53a!=-1){
return t61.process_url(_539.substr(_53a+1));
}else{
return null;
}
};
t61.get_url_without_anchor=function(){
var _53b=document.location.href;
var _53c=_53b.indexOf("#");
if(_53c!=-1){
return t61.process_url(_53b.substr(0,_53c));
}else{
return t61.process_url(_53b);
}
};
t61.back_button_check=function(){
var _53d=t61.get_url_from_anchor();
var _53e=t61.get_url_without_anchor();
var _53f=null;
var _540=200;
if(t61.current_ajax_url!=null){
if((_53d!=null)&&(_53d!=t61.current_ajax_url)){
_53f=_53d;
}else{
if((_53d==null)&&(t61.current_ajax_url!=_53e)){
_53f=_53e;
}
}
}
var _541=$("ajax_loader").style.display=="none";
if(_53f&&_541){
t61.load_url(_53f,{force_ajax:true});
if(t61.get_protocol(_53f)!=location.protocol){
return;
}
}
setTimeout(t61.back_button_check,_540);
};
t61.refresh_page_ajax=function(){
var _542=t61.get_url_from_anchor();
var _543=t61.get_url_without_anchor();
var _544=null;
if(_542!=null){
_544=_542;
}else{
_544=_543;
}
if(_544!=null){
var url=_544;
t61.load_url(url,{force_ajax:true,emulate_nonajax:true});
}
};
t61.check_for_autoplay=function(){
var _546=t61.get_current_url().toQueryParams();
if(!t61.current_song||!t61.current_song.playing){
if(_546["cur_song_id"]){
t61.ensure_init(function(){
new Ajax.Request("/song/play_on_demand/"+_546["cur_song_id"]+"/",{parameters:{"progress":_546["cur_song_progress"]}});
});
return;
}else{
if(_546["base_url"]){
t61.ensure_init(function(){
var url=_546["base_url"];
var page=_546["page"];
if(page&&(parseInt(page)>1)){
url+="/"+page;
}
delete (_546["base_url"]);
delete (_546["page"]);
t61.ensure_init(function(){
new Ajax.Request(url+"/?playlist_js&"+Hash.toQueryString(_546));
});
});
}
}
}
if(t61.song.data&&t61.autoplay_first_song_enabled){
if(!t61.current_song||!t61.current_song.playing){
var _549=t61.util.get_viewport();
if(t61._active&&(t61.context.nav!="home")&&((_549.height<57)||(_549.width<115))){
t61.ensure_init(function(){
t61.flashplayer.play_song("yimwppcuhhimacwmmwxonreuquowqphy",34708,300,null,"audio1");
});
}else{
var _54a=(t61.autoplay_position||0);
var song=t61.song.get_by_position(_54a);
if(song){
t61.ensure_init(function(){
song.play();
});
}
}
}
t61.autoplay_first_song_enabled=false;
}
};
t61.init=function(){
if(!t61._followed_ajax_link){
var _54c=t61.get_url_from_anchor();
var _54d=t61.get_url_without_anchor();
var _54e=_54d.split("thesixtyone.com")[1];
if(_54c!=null&&_54e!=_54c){
t61.load_url(_54c);
t61.autoplay_first_song_enabled=false;
return;
}
if(t61.url_history.data.length==0){
t61.url_history.add(t61.get_current_url());
}
}
t61.process_links();
if(!t61._back_button_checker_started){
t61.back_button_check();
t61._back_button_checker_started=true;
}
if(!t61.context){
return;
}
t61.mousehover_panel.hide();
var _54f={"home":t61.init_home,"leaders":t61.init_leaders,"search":t61.init_search,"browse":t61.init_browse,"album":t61.init_album};
var _550={"profile:favorites":t61.init_favorites,"profile:footprint":t61.init_footprint,"profile:stats":t61.init_stats,"social:group":t61.init_group};
var _551=_54f[t61.context["nav"]];
if(!_551){
_551=_550[t61.context.nav+":"+t61.context["subnav"]];
}
if(!_551){
_551=t61.init_common;
}
_551();
Event.observe(window,"blur",function(){
t61._focused=false;
});
Event.observe(window,"mousemove",function(){
if(t61._active_check_interval){
clearInterval(t61._active_check_interval);
}
t61._active_check_interval=setInterval(t61.set_inactive,3600000);
t61._active=true;
t61._focused=true;
});
t61._focused=true;
t61._active=true;
t61._initialized=true;
var _552=t61.get_volume();
t61.miniplayer.set_volume(_552);
t61.set_selected_subnav();
if(!t61._followed_ajax_link){
setTimeout(function(){
FB.init(t61.facebook_api_key,"/site_media/fbconnect/xd_receiver.htm");
},1);
}
t61.check_for_autoplay();
t61.ensure_init(t61.ads.init);
};
t61.ensure_init=function(func,_554){
if(!_554){
_554={};
}
setTimeout(function(){
if(t61._initialized&&t61.flashplayer&&t61.flashfileio&&t61.flashplayer.play_song){
if(_554.require_fb){
FB.ensureInit(func);
}else{
func();
}
}else{
t61.ensure_init(func,_554);
}
},100);
};
t61.ads={init:function(){
var _555=Math.random();
if(t61.ads.adblock_enabled){
if($("vertical_ad_panel_content")){
$("vertical_ad_panel_content").update("<table style=\"height:600px;width:168px;\"><tr><td> Disable AdBlock for thesixtyone.com to see what all the cool kids are seeing. =)</td></tr></table>");
}
if($("horizontal_blah_content")){
$("horizontal_blah_content").update("<iframe name=\"horizontal_blah\" id=\"horizontal_blah\" width=\"728\" height=\"90\" scrolling=\"no\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" src=\"/site_media/blahcode/thesixtyone_728x90.html?v="+_555+"\" />");
}
}else{
if($("vertical_ad_panel_content")){
$("vertical_ad_panel_content").update("<iframe name=\"ad_160x600\" id=\"ad_160x600\" width=\"160\" height=\"635\" scrolling=\"no\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" src=\"/site_media/adcode/indieclick_160x600.html?v="+_555+"\" />");
}
if($("horizontal_blah_content")){
$("horizontal_blah_content").update("<iframe name=\"horizontal_blah\" id=\"horizontal_blah\" width=\"728\" height=\"90\" scrolling=\"no\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" src=\"/site_media/adcode/indieclick_728x90.html?v="+_555+"\" />");
}
}
},adblock_enabled:true};
t61.is_active=function(){
return t61._active;
};
t61.set_inactive=function(){
t61._active=false;
};
t61.is_focused=function(){
return t61._focused;
};
t61.cleanup_links=function(_556){
if(!_556){
_556=document;
}else{
_556=$(_556);
}
var _557=_556.getElementsByTagName("a");
for(var i=0;i<_557.length;i++){
_557[i].onclick=null;
}
};
t61.process_links=function(_559){
if(!_559){
_559=document;
}else{
_559=$(_559);
}
var _55a=_559.getElementsByTagName("a");
for(var i=0;i<_55a.length;i++){
var link=_55a[i];
var href=link.getAttribute("href");
if(link.getAttribute("graceful")&&href[0]!="#"&&!link.onclick){
if(t61.get_protocol(href)==location.protocol){
href=href.replace(/http(s*)\:\/\/\w+\.thesixtyone\.com/,"");
}
link.setAttribute("href","#"+href);
link.onclick=t61.get_link_onclick(href,link.getAttribute("force_ajax"));
}
}
};
t61.get_link_onclick=function(url,_55f){
return function(_560){
t61.util.stop_event(_560);
t61.load_url(url,{force_ajax:_55f});
return (t61.get_protocol(url)==location.protocol);
};
};
t61.init_flash=function(_561){
if(!_561){
_561={tries:0};
}
var _562=5;
if(!t61.flashplayer){
t61.flashplayer=$("flash_song_player");
}
if(t61.flashplayer){
if(t61.flashplayer.init){
t61.flashplayer.init();
}else{
setTimeout(function(){
t61.init_flash();
},500);
}
}else{
if(_561.tries>=_562){
t61.show_flash_notice();
}else{
setTimeout(function(){
t61.init_flash({tries:_561.tries+1});
},500);
}
}
};
t61.show_flash_notice=function(){
setTimeout(function(){
if(!t61.flashplayer||!t61.flashplayer.play_song){
$("page_notice_inner").innerHTML="Error initializing Flash. You may need to upgrade to the latest version <a style='text-decoration:underline;' class='light' href='http://www.adobe.com/products/flashplayer/'>here</a>.";
$("page_notice_type").addClassName("error");
Element.show("page_notice");
}
},500);
};
t61.init_common=function(){
t61.init_flash();
if(!t61.user._login_checked){
t61.user.check_for_login_award();
t61.user._login_checked=true;
}
t61.tutorial.init();
t61.global_pngfix();
t61.miniplayer.init();
t61.top_menu.init();
t61.url_history.init();
};
t61.top_menu={init_browse:function(){
if(t61.top_menu.is_browse_disabled()){
$("top_menu_and_button_for_browse").addClassName("disabled");
Event.observe("top_menu_and_button_for_browse","mouseover",t61.top_menu.show_browse_disabled_tooltip);
Event.observe("top_menu_and_button_for_browse","mouseout",t61.mousehover_panel.hide);
}
},is_browse_disabled:function(){
return (!t61.plays.cur_plays)||(t61.plays.cur_plays<50);
},show_browse_disabled_tooltip:function(_563){
if(t61.top_menu.is_browse_disabled()){
t61.mousehover_panel.update(50-t61.plays.cur_plays+" plays left before<br/>browse is unlocked.");
t61.mousehover_panel.show(_563);
}
},_names:["popular","profile","browse","social"],fix_onscroll:function(){
},get_nav_link:function(name){
var menu=$("top_menu_and_button_for_"+name);
var _566=menu.getElementsByClassName("nav_button")[0];
var link=_566.getElementsByTagName("a")[0];
return link;
},get_mouseover_handler:function(name){
return function(_569){
if($("top_menu_for_"+name).style.display=="none"){
Element.show("top_menu_for_"+name);
var link=t61.top_menu.get_nav_link(name);
link.addClassName("highlighted");
}
if(name=="profile"){
$("top_user_profile").style.height="";
}
};
},get_mouseout_handler:function(name){
return function(_56c){
if((name=="profile")&&t61.notice.has_pending_animations()){
return;
}
Element.hide("top_menu_for_"+name);
var link=t61.top_menu.get_nav_link(name);
link.removeClassName("highlighted");
};
},init:function(){
for(var i=0;i<t61.top_menu._names.length;i++){
var name=t61.top_menu._names[i];
if((name=="profile")&&(!t61.is_logged_in)){
continue;
}
if(!t61.top_menu._mouseover_handlers[name]){
t61.top_menu._mouseover_handlers[name]=t61.top_menu.get_mouseover_handler(name);
}
if(!t61.top_menu._mouseout_handlers[name]){
t61.top_menu._mouseout_handlers[name]=t61.top_menu.get_mouseout_handler(name);
}
var _570=$("top_menu_and_button_for_"+name);
Event.stopObserving(_570,"mouseover",t61.top_menu._mouseover_handlers[name]);
Event.stopObserving(_570,"mouseout",t61.top_menu._mouseout_handlers[name]);
if((name!="browse")||(!t61.top_menu.is_browse_disabled())){
Event.observe(_570,"mouseover",t61.top_menu._mouseover_handlers[name]);
Event.observe(_570,"mouseout",t61.top_menu._mouseout_handlers[name]);
}
if(BrowserDetect.browser!="Firefox"){
$("top_menu_for_"+name).style.position="absolute";
}
}
t61.top_menu.fix_onscroll();
t61.top_menu.init_browse();
},_mouseover_handlers:{},_mouseout_handlers:{}};
t61.global_pngfix=function(){
if((BrowserDetect.browser=="Explorer")&&(BrowserDetect.version<=7)){
var _571=t61.util.pngfix;
_571($("global_search"));
}
};
t61.home={set_song_tag_radio_station:function(name){
var _573=$("song_tag_radio_links");
if(_573){
var _574=_573.getElementsByClassName("song_tag_radio_link_selected");
for(var i=0;i<_574.length;i++){
_574[i].removeClassName("song_tag_radio_link_selected");
}
}
var a=$("song_tag_radio_link_"+name);
if(a){
a.addClassName("song_tag_radio_link_selected");
}
t61.home._current_song_tag_radio_station=name;
}};
t61.init_home=function(){
t61.init_common();
t61.set_selected_genre();
t61.set_selected_genre("subgenre");
t61.update_num_listeners();
if($("genre_buttons")){
var _577=$("genre_buttons").getElementsByClassName("genre_label");
for(var i in _577){
var _579=_577[i];
if(_579.getAttribute){
var _57a=_579.getAttribute("genre");
var url="/"+t61.context.subnav+"/";
if(t61.context.tab){
url+=t61.context.tab+"/";
}
url+=_57a.replace(" ","+")+"/";
_579.setAttribute("href","#"+url);
_579.onclick=t61.get_link_onclick(url,false);
}
}
}
if(t61.home._current_song_tag_radio_station){
t61.home.set_song_tag_radio_station(t61.home._current_song_tag_radio_station);
}
t61.song.init();
};
t61.init_leaders=function(){
t61.init_common();
t61.set_selected_genre();
if(t61.current_song){
t61.current_song.visible=false;
}
};
t61.init_favorites=function(){
t61.init_common();
t61.song.init();
};
t61.init_footprint=function(){
t61.init_common();
t61.album_collectibles.init();
t61.song.init();
};
t61.init_group=function(){
t61.init_common();
t61.song.init();
};
t61.init_search=function(){
t61.init_common();
if(t61.context.search_type=="song"){
t61.song.init();
}
};
t61.init_album=function(){
t61.init_common();
};
t61.init_browse=function(){
t61.init_common();
t61.update_num_listeners();
t61.set_selected_genre();
t61.song.init();
};
t61.init_stats=function(){
t61.init_common();
t61.song.init();
};
t61.song.toggle_comment_overflow=function(_57c,_57d){
var _57e=$("song_comment_text_"+_57c).style.height;
if(_57e!="auto"){
$("song_comment_text_"+_57c).style.height="auto";
$("song_comment_overflow_toggle_"+_57c).innerHTML="(less)";
$("song_drawer_content_"+_57d).style.height="auto";
}else{
$("song_comment_text_"+_57c).style.height="";
$("song_comment_overflow_toggle_"+_57c).innerHTML="(more)";
$("song_drawer_content_"+_57d).style.height="";
}
};
t61.song.toggle_drawer=function(_57f,_580,url){
var song=t61.song.get_by_id(_57f);
if(song){
if(!_580){
_580=song.drawer_mode;
}
song.toggle_drawer(_580);
if(song.drawer_displayed){
new Ajax.Request(url);
}
}
};
t61.get_property=function(name){
return t61[name];
};
t61.get_audio_url=function(){
var k=Math.random();
var j=0;
for(var url in t61.audio_urls){
var w=t61.audio_urls[url];
j+=w;
if(k<=j){
return url;
}
}
};
t61.bumps={_completely_loaded:false,update:function(_588){
t61.bumps.cur_available=_588;
var span=$("user_bumps_available");
if(span){
span.update(_588);
}
},glow:function(){
var span=$("user_bumps_available");
if(span){
span.addClassName("glow");
}
},unglow:function(){
var span=$("user_bumps_available");
if(span){
span.removeClassName("glow");
}
},show_animation:function(_58c){
var _58d=t61.bumps.cur_available;
t61.bumps.update(_58c.previous_bumps_available);
if(!_58c){
_58c={};
}
if(!_58c.previous_bumps_available){
_58c.previous_bumps_available=0;
}
$("top_user_profile").style.height="52px";
Effect.Appear("top_menu_for_profile",{duration:0.5});
t61.bumps.glow();
var rate=3500/(_58d-t61.bumps.cur_available);
var _58f=function(){
if(t61.bumps.cur_available>=_58d){
setTimeout(function(){
if(!t61.notice.has_pending_animations()){
Effect.Fade("top_menu_for_profile",{duration:0.5});
t61.bumps.unglow();
}
},4000);
return;
}else{
t61.bumps.update(t61.bumps.cur_available+1);
setTimeout(_58f,rate);
}
};
setTimeout(_58f,rate);
},add:function(_590,_591,_592,_593,_594){
if(!_594){
_594={};
}
if(!_592){
_592=t61.media_url+"/site_media/images/notice_icons/heart.gif";
}
if(!_593){
_594.onshow=function(){
var _595=t61.bumps.cur_available;
t61.bumps.update(t61.bumps.cur_available+_590);
t61.bumps.show_animation({previous_bumps_available:_595});
};
}else{
var _596=t61.bumps.cur_available-_590;
if(_594.show_animation){
_594.onshow=function(){
t61.bumps.show_animation({previous_bumps_available:_596});
};
}
}
var _597="";
var s=_590==1?"":"s";
if(_594.newline){
_597="<br/>";
}
_594.expire_delay=6000;
var _599="+";
if(_594.hide_delta_sign){
_599="";
}
t61.notice.create(_591+": "+_597+_599+_590+" Heart"+s,_592,null,_594);
},fill_button:function(_59a){
var _59b=t61.get_bump_word()+"_button_filled";
var _59c=$("bump_button_wrapper_"+_59a)||$("rack_item_bump_button_"+_59a);
if(_59c){
_59c.addClassName(_59b);
}
if($("edit_tags_link_"+_59a)){
Element.show("edit_tags_link_"+_59a);
}
}};
t61.plays={increment:function(){
if(t61.plays.cur_plays){
t61.plays.update(t61.plays.cur_plays+1);
}
},update:function(_59d){
var _59e=false;
if(t61.plays.cur_plays&&t61.top_menu.is_browse_disabled()&&(_59d>=50)){
$("top_menu_and_button_for_browse").removeClassName("disabled");
var _59f=t61.media_url+"/site_media/images/notice_icons/key.gif";
t61.notice.create("Browsing unposted songs unlocked!",_59f,null,{"sound_effect":"unlock"});
_59e=true;
}
t61.plays.cur_plays=_59d;
if($("user_plays")){
$("user_plays").update(_59d);
}
if(_59e){
t61.top_menu.init();
}
}};
t61.points={glow:function(){
var span=$("user_points");
if(span){
span.addClassName("glow");
}
},unglow:function(){
var span=$("user_points");
if(span){
span.removeClassName("glow");
}
},add:function(_5a2,_5a3,_5a4,_5a5,_5a6){
if(!_5a6){
_5a6={};
}
if(!_5a4){
_5a4=t61.media_url+"/site_media/images/notice_icons/thumbs_up.gif";
}
if(!_5a5){
_5a6.onshow=function(){
t61.points.update(t61.points.cur_points+_5a2);
if(_5a6.show_animation){
t61.points.show_animation(_5a2);
}
};
}else{
if(_5a6.show_animation){
_5a6.onshow=function(){
t61.points.show_animation(_5a2);
};
}
}
var s=_5a2==1?"":"s";
var _5a8="";
if(_5a6.newline){
_5a8="<br/>";
}
if(!_5a6.queue){
_5a6.queue="back";
}
var _5a9=t61.beta_flag?"Rep":("Point"+s);
if(_5a2>0){
t61.notice.create(_5a3+": "+_5a8+"+"+_5a2+" "+_5a9,_5a4,null,_5a6);
}
},show_animation:function(_5aa){
var _5ab=t61.points.cur_points;
var _5ac=_5ab-_5aa;
var _5ad=Math.max(1,parseInt(_5aa/25));
var rate=Math.min(250,4000/_5ad);
$("top_user_profile").style.height="52px";
Effect.Appear("top_menu_for_profile",{duration:0.5});
t61.points.glow();
t61.points.update(_5ac);
var _5af=function(){
if((t61.points.cur_points+_5ad)>=_5ab){
t61.points.update(_5ab);
if(!t61.notice.has_pending_animations()){
setTimeout(function(){
Effect.Fade("top_menu_for_profile",{duration:0.5});
t61.points.unglow();
},4000);
}
return;
}else{
t61.points.update(t61.points.cur_points+_5ad);
setTimeout(_5af,rate);
}
};
setTimeout(_5af,rate);
},update:function(_5b0){
var _5b1=t61.level.cur_level;
t61.points.cur_points=_5b0;
var _5b2=t61.level.cur_level;
t61.level.update_progress(_5b0,_5b2);
var span=$("user_points");
if(span){
span.update(_5b0);
}
}};
t61.level={get_progress:function(_5b4,_5b5){
if(_5b5<(t61.level.xp_requirements.length-1)){
var _5b6=t61.level.xp_requirements[_5b5+1];
var _5b7=t61.level.xp_requirements[_5b5];
var _5b8;
if(_5b4<_5b7){
_5b8=0;
}else{
_5b8=1*(_5b4-_5b7)/(_5b6-_5b7);
}
return _5b8;
}else{
return 1;
}
},get_from_xp:function(_5b9){
for(var _5ba=1;_5ba<t61.level.xp_requirements.length;_5ba++){
var _5bb=t61.level.xp_requirements[_5ba];
if(_5b9<_5bb){
return (_5ba-1);
}
}
return _5ba;
},update_progress:function(_5bc,_5bd){
var _5be=t61.level.get_progress(_5bc,_5bd);
var _5bf=100;
var xpos=parseInt((_5be-1)*_5bf);
if($("top_profile_levelbar")){
$("top_profile_levelbar").style.backgroundPosition=xpos+"px 0px";
}
},update_level:function(_5c1,_5c2){
$("top_profile_cur_level").innerHTML=_5c2;
$("top_profile_next_level").innerHTML=_5c2+1;
t61.level.update_progress(_5c1,_5c2);
if(t61.level.notices_given[_5c2]==null){
t61.level.cur_level=_5c2;
var _5c3=t61.media_url+"/site_media/images/notice_icons/thumbs_up.gif";
t61.notice.create("You reached level "+_5c2+"!",_5c3,null,{sound_effect:"unlock",delay:20000});
t61.level.check_for_unlocked_features(_5c2);
t61.level.notices_given[_5c2]=true;
}
},check_for_unlocked_features:function(_5c4){
var _5c5=t61.media_url+"/site_media/images/notice_icons/key.gif";
var _5c6=24000;
var gap=4000;
if(!t61.is_artist){
if(t61.beta_flag){
t61.notice.create("Feature Unlock: <br/>Earn an additional heart everyday you log in.",_5c5,null,{sound_effect:"unlock",delay:_5c6});
_5c6+=gap;
}
if(_5c4>=5){
var _5c8=t61.get_bump_word()+" any song up to "+parseInt(_5c4*t61.bump_cost_structure.multi_bumps_allowed_per_level)+" times.";
t61.notice.create("Feature Unlock: <br/>"+_5c8,_5c5,null,{sound_effect:"unlock",delay:_5c6});
_5c6+=gap;
}
if(_5c4==10){
t61.notice.create("Feature Unlock: <br/>Can revive a song.",_5c5,null,{sound_effect:"unlock",delay:_5c6});
}
_5c6+=gap;
}
},notices_given:{}};
t61.get_bump_word=function(){
return t61.beta_flag?"heart":"bump";
};
t61.set_flash_song_position=function(v){
if(!t61.current_song.playing){
return;
}
var _5ca=v*t61.current_song.play_time*1000;
if(_5ca>t61.current_song.loaded_duration){
_5ca=t61.current_song.loaded_duration;
}
t61.flashplayer.set_song_position(_5ca);
};
t61.popup={id:0,on_hide:function(){
},set_status:function(msg){
$("popup_status").innerHTML="<div>"+msg+"</div>";
},load_elements:function(){
var p=t61.popup;
var o=$("popup_overlay");
p._m=o.getElementsByClassName("m")[0];
p._l_list=o.getElementsByClassName("l");
p._close_button=$("popup_wrapper").getElementsByClassName("close")[0];
},set_dimensions:function(w,h){
t61.popup.load_elements();
var p=t61.popup;
p._m.style.width=w+"px";
p._m.style.height=h+"px";
for(var i=0;i<p._l_list.length;i++){
p._l_list[i].style.width=w+"px";
}
$("popup").style.width=w+"px";
$("popup").style.height=h+"px";
$("popup").style.marginTop=-0.5*h+"px";
$("popup").style.marginLeft=-0.5*w+"px";
$("popup_overlay").style.width=(w+20)+"px";
$("popup_overlay").style.height=(h+20)+"px";
$("popup_overlay").style.marginTop=-0.5*(h+20)+"px";
$("popup_overlay").style.marginLeft=-0.5*(w+20)+"px";
$("popup_status").style.width=w+"px";
$("popup_status").style.marginTop=(0.5*h-3)+"px";
$("popup_status").style.marginLeft=-0.5*w+"px";
p._close_button.style.marginTop=(-0.5*h-6)+"px";
p._close_button.style.marginLeft=(0.5*w-7)+"px";
},setup:function(){
$("flash_file_io_content").style.marginTop="-10000px";
if(BrowserDetect.browser=="Opera"){
Element.hide("flash_file_io_content");
t61.flashfileio._initialized=false;
}
t61.popup.on_hide=function(){
};
},expire:function(_5d2){
var _5d3=t61.popup.id;
setTimeout(function(){
if(_5d3==t61.popup.id){
t61.popup.hide({from_user:true});
}
},_5d2*1000);
},show_download_button:function(){
$("flash_file_io_content").style.marginTop="90px";
$("flash_file_io_content").style.marginLeft="20px";
if(BrowserDetect.browser=="Opera"){
Element.show("flash_file_io_content");
}
},elements:["popup","popup_overlay","popup_close","popup_status"],show:function(_5d4){
if(!_5d4){
_5d4={};
}
var _5d5=_5d4.width||380;
var _5d6=_5d4.height||220;
t61.popup.set_dimensions(_5d5,_5d6);
t61.popup.set_status("");
for(var i=0;i<t61.popup.elements.length;i++){
Element.show(t61.popup.elements[i]);
}
t61.popup.setup();
t61.popup.id+=1;
},hide:function(_5d8){
if(!_5d8){
_5d8={};
}
if(BrowserDetect.browser=="Opera"){
if(t61.flashfileio._in_progress){
if(_5d8.from_user){
t61.notice.create("Please wait until the download finishes.");
}
return;
}
}
for(var i=0;i<t61.popup.elements.length;i++){
if(_5d8.fade_out){
Effect.Fade($(t61.popup.elements[i]));
}else{
Element.hide(t61.popup.elements[i]);
}
}
if(_5d8.from_user){
t61.popup.on_hide();
}
t61.popup.setup();
}};
t61.notice={_notices:[],_notice_requests:[],_busy:false,get_html:function(_5da,_5db){
return "<div class='floating_notice'><div class='top' style='background-image: url("+t61.media_url+"/site_media/images/floating_notice_top.png);'></div><div class='mid'></div><div class='bottom' style='background-image: url("+t61.media_url+"/site_media/images/floating_notice_bottom.png);'></div><table cellspacing=0 cellpadding=0 class='floating_notice_content'><tr><td valign=top><img src='"+_5da+"' /></td><td><div class='notice_text'>"+_5db+"</div></td></tr></table></div>";
},new_element:function(_5dc,_5dd){
var tmp=document.createElement("DIV");
tmp.innerHTML=t61.notice.get_html(_5dc,_5dd);
t61.process_links(tmp);
return tmp.childNodes[0];
},error:function(_5df,_5e0,_5e1){
var _5e2=t61.media_url+"/site_media/images/notice_icons/error_bush.gif";
var a=Math.random();
var head="Oops! ";
if(a<0.33){
head="Doh! ";
}else{
if(a<0.66){
head="Darn! ";
}
}
if(_5df.length<40){
_5df=head+_5df;
}
t61.notice.create(_5df,_5e2,_5e0,_5e1);
},create:function(_5e5,_5e6,_5e7,_5e8){
if(!_5e8){
_5e8={};
}
if(!_5e8.delay){
_5e8.delay=0;
}
if(!_5e8.expire_delay){
_5e8.expire_delay=20000;
}
if(!_5e8.sound_effect){
_5e8.sound_effect="notification";
}
if(!_5e6){
_5e6=t61.media_url+"/site_media/images/notice_icons/route61.gif";
}
var _5e9={"notice_text":_5e5,"img_url":_5e6,"height":_5e7,"options":_5e8};
if((!t61.notice._busy)&&(t61.notice._notice_requests.length==0)){
t61.notice.show(_5e5,_5e6,_5e7,_5e8);
}else{
if(_5e8.queue=="back"){
t61.notice.push(_5e9);
}else{
var _5ea;
_5ea=setInterval(function(){
if(!t61.notice._busy){
t61.notice.unshift(_5e9);
t61.notice.dequeue();
clearInterval(_5ea);
}
},100);
}
}
},push:function(_5eb){
t61.notice._notice_requests.push(_5eb);
},unshift:function(_5ec){
t61.notice._notice_requests.unshift(_5ec);
},dequeue:function(){
var _5ed=t61.notice._notice_requests.shift();
if(_5ed){
t61.notice.show(_5ed["notice_text"],_5ed["img_url"],_5ed["height"],_5ed["options"]);
}
},has_pending_animations:function(){
var r=t61.notice._notice_requests;
if(r.length==0){
return false;
}
for(var i=0;i<r.length;i++){
var _5f0=r[i].options;
if(_5f0&&_5f0.show_animation){
return true;
}
}
return false;
},show:function(_5f1,_5f2,_5f3,_5f4){
if(!_5f4){
_5f4={};
}
if((_5f4.delay==0)||(_5f4.delay==null)){
t61.notice._busy=true;
}
setTimeout(function(){
var _5f5=t61.notice.new_element(_5f2,_5f1);
var mid=_5f5.childNodes[1];
if(_5f3){
_5f5.style.height=_5f3+"px";
mid.style.height=(_5f3-35)+"px";
}
$("floating_notices").appendChild(_5f5);
t61.util.pngfix(_5f5.childNodes[0]);
t61.util.pngfix(_5f5.childNodes[2]);
t61.notice._notices.push(_5f5);
_5f5.offset=0;
for(var i=0;i<t61.notice._notices.length;i++){
t61.notice.float_up(i,0,50,(_5f3?_5f3+5:65));
}
if(t61.flashplayer&&!_5f4.silent){
t61.flashplayer.play_sound_effect(_5f4.sound_effect);
}
if(_5f4.onshow){
_5f4.onshow();
}
setTimeout(t61.notice.expire_oldest,_5f4.expire_delay);
},_5f4.delay);
},expire_oldest:function(){
var _5f8=t61.notice._notices[0];
if(_5f8){
Effect.Fade(_5f8);
setTimeout(function(){
t61.notice.cleanup_oldest();
},1000);
}
},cleanup_oldest:function(){
var _5f9=t61.notice._notices[0];
if(_5f9&&_5f9.parentNode){
_5f9.parentNode.removeChild(_5f9);
}
t61.notice._notices.splice(0,1);
},float_up:function(i,_5fb,dt,_5fd){
var _5fe=t61.notice._notices[i];
var _5ff=0.25;
if(!_5fd){
_5fd=47;
}
if(_5fe){
_5fe.style.marginTop=_5fe.offset+_5fb*-1*_5fd+"px";
}
if(_5fb<0.99){
t61.notice._busy=true;
setTimeout(function(){
t61.notice.float_up(i,_5fb+(1-_5fb)*_5ff,_5ff,_5fd);
},dt);
}else{
if(_5fe){
_5fe.offset=_5fe.offset+-1*_5fd;
}
t61.notice._busy=false;
}
}};
setInterval(function(){
if(!t61.notice._busy){
t61.notice.dequeue();
}
},3000);
t61.achievement={show_unlock:function(name,_601,_602){
var _603=t61.media_url+"/site_media/images/achievement_icons/35x35/"+name+".gif";
t61.notice.create("Achievement Unlocked<br/>"+_601+" (level "+_602+")",_603,null,{"sound_effect":"unlock",queue:"back"});
}};
t61.toggle_register_form=function(type){
if(type=="artist"){
Element.show("register_form_artist_field");
}else{
Element.show("register_form_label_field");
}
Element.hide("register_form_signup_type_field");
Element.show("register_form_artist_warning");
Element.hide("register_popup_form");
Element.hide("listener_username_label");
Element.show("artist_username_label");
t61._register_form_toggled=true;
};
t61.set_ajax_url=function(url){
t61._followed_ajax_link=true;
t61.current_ajax_url=t61.process_url(url);
};
t61.get_protocol=function(url){
var a=url.substr(0,5);
if(a=="http:"){
return "http:";
}
if(a=="https"){
return "https:";
}
return location.protocol;
};
t61.song.get_continuation_params=function(){
var _608;
if(t61.current_song.rack_item_id||!t61.playlist.current.base_url||t61.playlist.current.shuffled){
_608={"cur_song_id":parseInt(t61.current_song.id),"cur_song_progress":t61.current_song.progress};
}else{
_608={"base_url":t61.playlist.current.base_url,"per_page":t61.playlist.current.per_page,"page":t61.playlist.current.page,"song_position":t61.playlist.get_song_position(t61.current_song.id),"cur_song_progress":t61.current_song.progress};
if(t61.playlist.current.shuffled){
_608["shuffled"]=true;
}
}
return _608;
};
t61.url_history={data:[],cur_position:-1,show_buttons:function(){
if(t61.url_history.cur_position>0){
$("back_button").addClassName("back_button_shown");
$("back_button").removeClassName("back_button_disabled");
}else{
$("back_button").removeClassName("back_button_shown");
$("back_button").addClassName("back_button_disabled");
}
if(t61.url_history.data.length>(t61.url_history.cur_position+1)){
$("forward_button").addClassName("forward_button_shown");
$("forward_button").removeClassName("forward_button_disabled");
}else{
$("forward_button").removeClassName("forward_button_shown");
$("forward_button").addClassName("forward_button_disabled");
}
},add:function(url){
t61.url_history.cur_position+=1;
t61.url_history.data[t61.url_history.cur_position]=url;
},previous:function(){
if(t61.url_history.cur_position>0){
t61.url_history.cur_position-=1;
var _60a=t61.url_history.data[t61.url_history.cur_position];
t61.load_url(_60a,{emulate_nonajax:true,skip_history:true});
}
t61.url_history.show_buttons();
},forward:function(){
if(t61.url_history.data.length>(t61.url_history.cur_position+1)){
t61.url_history.cur_position+=1;
var _60b=t61.url_history.data[t61.url_history.cur_position];
t61.load_url(_60b,{emulate_nonajax:true,skip_history:true});
}
t61.url_history.show_buttons();
},hide_buttons:function(){
$("back_button").removeClassName("back_button_shown");
$("forward_button").removeClassName("forward_button_shown");
$("back_button").removeClassName("back_button_disabled");
$("forward_button").removeClassName("forward_button_disabled");
},init:function(){
Event.observe("back_button_container","mouseover",t61.url_history.show_buttons);
Event.observe("back_button_container","mouseout",t61.url_history.hide_buttons);
Event.observe("back_button","click",t61.url_history.previous);
Event.observe("forward_button","click",t61.url_history.forward);
}};
t61.load_url=function(url,_60d){
if(!_60d){
_60d={};
}
var _60e="?";
if(url&&url.indexOf("?")!=-1){
_60e="&";
}
if(t61.get_protocol(url)!=location.protocol){
_60d.force_refresh=true;
}
if(_60d.force_refresh){
if(t61.current_song&&t61.current_song.playing){
var _60f=t61.song.get_continuation_params();
url+=_60e+Hash.toQueryString(_60f);
}
location.href=url;
return;
}else{
if(!_60d.emulate_nonajax){
t61.set_ajax_url(url);
}
var _610={prev_nav:t61.context.nav,prev_subnav:t61.context.subnav,prev_username:t61.context?t61.context.viewed_username:""};
new Ajax.Request(url,{evalScripts:true,method:"post",parameters:_610});
t61._loading_page=true;
if(!_60d.skip_history){
t61.url_history.add(url);
}
}
};
t61.get_volume=function(){
return (t61["user_volume"]==null)?t61.default_volume:t61.user_volume;
};
t61.feedback={open:function(){
Element.show("feedback_form_wrapper");
},close:function(){
Element.hide("feedback_form_wrapper");
},submit:function(){
var url=t61.get_current_url();
if(!url){
url=t61.get_url_without_anchor();
}
var _612=Form.serialize("feedback_form");
_612+=("&url="+escape(url));
_612+=("&browser_info="+BrowserDetect.browser+BrowserDetect.version+"/"+BrowserDetect.OS);
new Ajax.Request("/prelaunch/send_feedback/",{parameters:_612});
}};
t61.video={embed:function(_613,_614){
var so=new SWFObject("http://www.youtube.com/v/"+_613+"&autoplay=1",_614,"400","334","7");
so.addParam("wmode","transparent");
so.write(_614);
$(_614).style.display="";
if(t61.current_song&&t61.current_song.playing){
t61.current_song.pause();
}
},reset_drawer_video:function(_616){
$("song_drawer_video_wrapper_"+_616).innerHTML="<div class=\"main_video\" id=\"song_drawer_video_"+_616+"\"></div>";
}};
t61.recommendations={select:function(_617){
if(t61.recommendations._previously_selected){
t61.recommendations._previously_selected.removeClassName("selected");
}
var _618=$("song_rec_entry_"+_617);
if(_618){
_618.addClassName("selected");
}
t61.recommendations._previously_selected=_618;
},viewed_song_id:null};
t61.playlist={load:function(data,_61a){
if(!_61a){
_61a={};
}
var _61b=t61.playlist.current;
var _61c=_61a.base_url||t61.context.base_url;
var page=_61a.page||t61.context.page;
var _61e=_61a.per_page||t61.context.per_page;
var _61f=_61a.shuffled||t61.context.shuffled;
t61.playlist.current={id_by_position:data.id_by_position,by_id:data.by_id,base_url:_61c,page:page,per_page:_61e,shuffled:_61f};
if(!t61._play_tallied){
var el=$("num_currently_listening");
if(el){
var num=parseInt(el.innerHTML);
el.update(num+1);
t61._play_tallied=true;
}
}
},unload:function(){
t61.playlist.current={};
},current:{},history:{},is_song_id_active:function(id){
if(t61.playlist.is_active()){
return (t61.playlist.current.by_id[id]!=null);
}else{
return false;
}
},play_song_by_position:function(pos){
var _624=t61.playlist.current;
var _625=_624.id_by_position[pos];
var song=t61.song.get_by_id(_625);
if(!song&&(_625!=null)){
var _627=_624.by_id[_625];
song=new t61.Song(_627);
t61.song.store(song);
}
if(song){
if(t61.current_song&&!t61.current_song.visible){
t61.current_song.destroy();
}
song.play({in_playlist:true});
if(t61.playlist.current.base_url.match("recommendations")){
t61.recommendations.select(pos+1);
}
}else{
if(t61.current_song.playing){
t61.current_song.pause();
}
if(t61.current_song.player&&t61.current_song.score){
t61.song.toggle_drawer(t61.current_song.id,"recs","/recommendations/show/"+t61.current_song.id+"/");
}
}
},get_song_position:function(_628){
return t61.playlist.current.id_by_position.indexOf(_628);
},play_next_song:function(){
if(t61.current_song){
if(t61.current_song.rack_item_id){
t61.current_song.playing=false;
t61.song.handle_song_complete();
return;
}
if((t61.recommendations.viewed_song_id==t61.current_song.id)&&($("song_rec_entry_1"))){
new Ajax.Request("/recommendations/play/"+t61.current_song.id+"/");
}
if(!t61.is_active()){
t61.song.set_not_playing();
return;
}
var _629=t61.playlist.current;
var _62a=t61.playlist.get_song_position(t61.current_song.id);
if(_629.per_page&&(_62a>=(_629.per_page-1))){
var _62b=parseInt(_629.page)+1;
new Ajax.Request(_629.base_url+"/"+_62b+"/?playlist_js");
if((_629.base_url==t61.context.base_url)&&(!t61.context.disable_auto_paging)){
new Ajax.Request(_629.base_url+"/"+_62b+"/",{evalScripts:true});
}
}else{
t61.playlist.play_song_by_position(_62a+1);
}
}
},play_previous_song:function(){
if(t61.current_song){
if(t61.current_song.rack_item_id){
t61.notice.create("Sorry you can't backtrack on The Rack.");
return;
}
var _62c=t61.playlist.current;
var _62d=_62c.id_by_position.indexOf(t61.current_song.id);
if((_62c.page>1)&&(_62d<=0)){
var _62e=parseInt(_62c.page)-1;
var _62f=(parseInt(_62c.per_page)-1);
new Ajax.Request(_62c.base_url+"/"+_62e+"/?playlist_js&song_position="+_62f);
if((_62c.base_url==t61.context.base_url)&&(!t61.context.disable_auto_paging)){
new Ajax.Request(_62c.base_url+"/"+_62e+"/?xhr",{evalScripts:true});
}
}else{
t61.playlist.play_song_by_position(_62d-1);
}
}
},is_active:function(){
var _630=t61.playlist.current;
return ((_630.by_id!=null)&&((t61.context.base_url!=_630.base_url)||(t61.context.page!=_630.page)));
}};
t61.teardown=function(){
if(t61.album){
t61.album.teardown();
}
t61.album_collectibles.teardown();
t61.song.teardown();
Event.unloadCache();
t61.popup.hide();
};
t61.replace_html=function(_631,_632){
if($(_631)){
t61.cleanup_links(_631);
$(_631).update(_632);
t61.process_links(_631);
}
};
t61.mousehover_panel={update:function(text){
$("mousehover_panel").innerHTML=text;
},append:function(text){
$("mousehover_panel").innerHTML+=text;
},show:function(_635,_636){
if(!_636){
_636={};
}
if(!_636.left_offset){
_636.left_offset=-50;
}
if(!_636.top_offset){
_636.top_offset=20;
}
var _637=(document.documentElement.scrollTop||document.body.scrollTop);
var _638=Event.pointerX(_635),_639=Event.pointerY(_635);
Element.show("mousehover_panel");
if(!_636.left){
_636.left=(_638+_636.left_offset);
}
if(!_636.top){
_636.top=(_639+_636.top_offset);
}
_636.top-=_637;
$("mousehover_panel").style.left=_636.left+"px";
$("mousehover_panel").style.top=_636.top+"px";
},hide:function(_63a){
Element.hide("mousehover_panel");
},suppress:function(_63b){
t61.mousehover_panel.hide(_63b);
t61.util.stop_event(_63b);
}};
t61.set_selected_subnav=function(){
if($("subnavigation")==null){
return;
}
var _63c=$("subnavigation").getElementsByClassName("selected");
for(var i=0;i<_63c.length;i++){
var _63e=_63c[i];
_63e.removeClassName("selected");
}
var _63e=$("subnav_button_"+t61.context.subnav);
if(_63e){
_63e.addClassName("selected");
}
};
t61.table={toggle:function(_63f,_640){
_63f=$(_63f);
var _641=_63f.hasClassName("collapser");
if(_641){
t61.table.collapse(_63f,_640);
}else{
t61.table.expand(_63f,_640);
}
},collapse:function(_642,_643){
var _644=$(_643);
if(!_644){
return;
}
var rows=_644.getElementsByTagName("tr");
for(var i=1;i<rows.length;i++){
row=$(rows[i]);
row.hide();
}
_642.addClassName("expander");
_642.removeClassName("collapser");
},expand:function(_647,_648){
var _649;
_649=$(_648);
if(!_649){
return;
}
var rows=_649.getElementsByTagName("tr");
var row;
for(var i=1;i<rows.length;i++){
row=$(rows[i]);
row.show();
}
_647.addClassName("collapser");
_647.removeClassName("expander");
},select_row:function(name,_64e){
t61.table.unselect_rows(_64e);
row=$(_64e+"_"+name);
if(row){
row.addClassName("selected");
}
},unselect_rows:function(_64f){
var _650=$(_64f);
if(!_650){
return;
}
var rows=_650.getElementsByTagName("tr");
var row;
for(var i=1;i<rows.length;i++){
row=$(rows[i]);
if(row){
row.removeClassName("selected");
}
}
}};
t61.billing={buy_in_progress:false,add_credit_card:function(){
var _654=Form.serialize("add_credit_card_form");
var p=_654.match(/.*buy_song_id\=(\d+).*/);
if(p){
t61.flashplayer.add_credit_card(_654);
}else{
new Ajax.Request("/billing/add_credit_card/",{parameters:_654});
}
},credits_to_amount:function(_656){
var a=_656*1.25/100;
return "$"+a.toFixed(2);
},add_credits:function(_658,_659){
if(!_659){
_659=t61.media_url+"/site_media/images/notice_icons/thumbs_up.gif";
}
t61.notice.create("+"+_658+" credits",_659);
t61.billing.buy_in_progress=false;
},buy_credits:function(_65a,_65b){
if(t61.billing.buy_in_progress){
t61.notice.create("Please wait for the previous buy request to finish.",null,null,{expire_delay:4000});
return;
}
var msg="Purchase "+_65a+" credits for "+t61.billing.credits_to_amount(_65a)+"?";
var _65d="num_credits="+_65a;
if(_65b){
_65d+="&buy_song_id="+_65b;
}
if(confirm(msg)){
t61.billing.buy_in_progress=true;
t61.notice.create("This can take a few seconds...");
new Ajax.Request("/billing/buy_credits/authorize/",{parameters:_65d});
}
}};
t61.played_time_by_song_id={};
t61.bump_attempted_by_song_id={};
t61.analytics={track_pageview:function(){
var url=t61.site_url+t61.current_ajax_url;
var ref=t61.site_url+t61.url_history.data[t61.url_history.cur_position-1];
if(t61.global_scope["_qpixelsent"]&&t61.global_scope["quantserve"]){
_qpixelsent=null;
t61.analytics.quantserve(url,ref);
}
if(t61.global_scope["pageTracker"]){
pageTracker._trackPageview(url);
}
},quantserve:function(url,ref){
url=_qceuc(url);
ref=_qceuc(ref);
var r=_qcrnd();
var sr="",qo="",qm="",je="u",ns="1",_668="webpage",_669="load";
if(typeof _qoptions!="undefined"&&_qoptions!=null){
for(var k in _qoptions){
if(typeof (_qoptions[k])!="string"){
continue;
}
if(k=="qacct"){
_qacct=_qoptions[k];
}else{
qo+=";"+k+"="+_qceuc(_qoptions[k]);
}
if(k=="media"){
_668=_qoptions[k];
}
if(k=="event"){
_669=_qoptions[k];
}
}
_qoptions=null;
}
if((typeof _qacct=="undefined")||(_qacct.length==0)){
return;
}
if(_668=="webpage"&&_669=="load"){
if((typeof _qpixelsent!="undefined")&&(_qpixelsent==_qacct)){
return;
}
_qpixelsent=_qacct;
}
var ce=(navigator.cookieEnabled)?"1":"0";
if(typeof navigator.javaEnabled!="undefined"){
je=(navigator.javaEnabled())?"1":"0";
}
if(typeof _qmeta!="undefined"&&_qmeta!=null){
qm=";m="+_qceuc(_qmeta);
_qmeta=null;
}
if(self.screen){
sr=screen.width+"x"+screen.height+"x"+screen.colorDepth;
}
var d=new Date();
var dst=_qcdst();
var dc="1196292207-45087610-65760369";
var qs="http://pixel.quantserve.com";
var fp=_qcsc(dc);
if(self==top){
ns="0";
}
var img=new Image(1,1);
img.alt="";
img.src=qs+"/pixel"+";r="+r+fp+";ns="+ns+";url="+url+";ref="+ref+";ce="+ce+";je="+je+";sr="+sr+";dc="+dc+";dst="+dst+";et="+d.getTime()+";tzo="+d.getTimezoneOffset()+";a="+_qacct+qo+qm;
img.onload=function(){
_qvoid();
};
}};
if(!this["t61"]){
var t61={};
}
String.prototype.truncate=function(len){
if(this.length>len){
return this.substr(0,len-3)+"...";
}else{
return this;
}
};
t61.util={stop_event_all:function(_673){
if(!_673){
_673=window.event;
}
if(_673.stopPropagation){
_673.stopPropagation();
}
if(_673.preventDefault){
_673.preventDefault();
}
_673.cancelBubble=true;
_673.cancel=true;
_673.returnValue=false;
return false;
},stop_event:function(_674){
if(!_674){
_674=window.event;
}
_674.cancelBubble=true;
if(_674.stopPropagation){
_674.stopPropagation();
}
},serialize_list:function(name,obj){
var _677=[];
for(var i=0;i<obj.length;i++){
var val="";
if(obj[i]){
val=obj[i];
}
_677.push(name+"[]="+val);
}
return _677.join("&");
},link_to_remote:function(_67a,url,_67c,_67d){
if(!_67d){
_67d="";
}
return "<a href=\"#"+url+"\" onclick=\"t61.load_url('"+url+"');\" class=\""+_67c+"\" title=\""+_67d+"\">"+_67a+"</a>";
},get_viewport:function(){
var x,y;
if(self.innerHeight){
x=self.innerWidth;
y=self.innerHeight;
}else{
if(document.documentElement&&document.documentElement.clientHeight){
x=document.documentElement.clientWidth;
y=document.documentElement.clientHeight;
}else{
if(document.body){
x=document.body.clientWidth;
y=document.body.clientHeight;
}
}
}
return {width:x,height:y};
},pngfix:function(el){
if((BrowserDetect.browser!="Explorer")||(BrowserDetect.version==7)){
return;
}
var _681=el.style;
var _682=el.tagName;
var src=el.src;
var _684=_681.backgroundImage||_681.backgroundImage;
var _685=t61.media_url+"/site_media/images/blank.gif";
var _686=el.childNodes;
var filt=t61.util.filter;
if(_682=="IMG"){
if((/\.png$/i).test(src)){
if(_681.width=="auto"&&_681.height=="auto"){
_681.width=_681.offsetWidth+"px";
}
filt(el,src,"scale");
el.src=_685;
}else{
if(src.indexOf(_685)<0){
filt(el);
}
}
}else{
if(_684&&_684!="none"){
if(_684.match(/^url[(\"\']+(.*\.png)[)\"\']+$/i)){
var s=RegExp.$1;
if(_681.width=="auto"&&_681.height=="auto"){
_681.width=_681.offsetWidth+"px";
}
_681.backgroundImage="none";
filt(el,s,"crop");
for(var n=0;n<_686.length;n++){
if(_686[n].style){
_686[n].style.position="relative";
}
}
}else{
filt(el);
}
}
}
},filter:function(el,s,m){
var f="DXImageTransform.Microsoft.AlphaImageLoader";
if(el.style.filters&&el.style.filters[f]){
el.style.filters[f].enabled=s?true:false;
if(s){
with(el.style.filters[f]){
src=s;
sizingMethod=m;
}
}
}else{
if(s){
el.style.filter="progid:"+f+"(src=\""+s+"\",sizingMethod=\""+m+"\")";
}
}
},pngfix_therack_popup:function(){
if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6){
var _68e=$("popup_content").getElementsByClassName("medium_button");
for(var i=0;i<_68e.length;i++){
_68e[i].style.backgroundImage="url("+t61.media_url+"/site_media/images/black_button.png)";
t61.util.pngfix(_68e[i]);
}
_68e=$("popup_content").getElementsByClassName("large_button");
_68e[0].style.backgroundImage="url("+t61.media_url+"/site_media/images/large_black_button.png)";
t61.util.pngfix(_68e[0]);
}
},get_scroll_top:function(){
return (document.documentElement.scrollTop||document.body.scrollTop);
},get_scroll_height:function(){
return (document.documentElement.scrollHeight||document.body.scrollHeight);
},get_max_scroll_top:function(){
var _690=t61.util.get_viewport()["height"];
var _691=t61.util.get_scroll_height();
return _691-_690;
},smooth_scroll:function(y,_693){
if(!_693){
_693={};
}
var _694=_693.duration?_693.duration:1;
curScrollTop=t61.util.get_scroll_top();
var _695=t61.util.get_max_scroll_top();
var _696=Math.min(_695*0.2,100);
do_rubberband=false;
if(y>(_695-_696)){
y=(_695-_696);
do_rubberband=true;
}
t61.util.smooth_scroll_helper(0,y,0,_694,0,do_rubberband);
},smooth_scroll_helper:function(ycur,_698,_699,_69a,_69b,_69c){
scroll(0,ycur);
var _69d=0.01;
_699+=_69d;
var _69e;
var _69f=0;
if((_69b==0)&&_69c){
_69f=Math.min(_698*0.25,100);
}
_69e=ycur+(_698+_69f-ycur)*0.2;
if(_69e<=0){
return;
}
if(Math.abs(_698+_69f-ycur)<=1){
if((_69b==0)&&_69c){
t61.util.smooth_scroll_helper(ycur,_698,0,_69a,_69b+1,_69c);
}
}else{
setTimeout(function(){
t61.util.smooth_scroll_helper(_69e,_698,_699,_69a,_69b,_69c);
},_69d*1000);
}
},get_safe_name:function(name){
return name.replace(/\(|\)|\?|\/|\'|\"/g,"");
}};
t61.debug={write:function(text){
if($("horizontal_blah_content")){
$("horizontal_blah_content").update(text);
}
},append:function(text){
if($("horizontal_blah_content")){
$("horizontal_blah_content").innerHTML+=text;
}
}};
if(!this["t61"]){
var t61={};
}
t61.footprint={};
if(!this["t61"]){
var t61={};
}
t61.current_tutorial={};
t61.tutorial={get_icon_url:function(){
return t61.media_url+"/site_media/images/notice_icons/question_mark.gif";
},get_html:function(set,id,_6a5,_6a6){
var _6a7=t61.media_url+"/site_media/images/floating_tutorial_top.png";
var _6a8=t61.media_url+"/site_media/images/floating_tutorial_mid.png";
var _6a9=t61.media_url+"/site_media/images/floating_tutorial_bottom.png";
if(_6a6=="left"){
return "<div class='floating_tutorial'><div class='top' style='background-image:url("+_6a7+");'></div><div class='mid' style='background-image:url("+_6a8+");'></div><div class='bottom' style='background-image:url("+_6a9+");'></div><table cellspacing=0 cellpadding=0 class='floating_tutorial_content'><tr><td valign=top><div class='tutorial_close' style='margin-left: 6px;' id='tutorial_close_"+id+"' onclick='t61.tutorial.close(\""+set+"\");'></div></td><td><div class='tutorial_text'>"+_6a5+"</div></td></tr></table></div>";
}else{
return "<div class='floating_tutorial'><div class='top' style='background-image:url("+_6a7+");'></div><div class='mid' style='background-iamge:url("+_6a8+");'></div><div class='bottom' style='background-image:url("+_6a9+");'></div><table cellspacing=0 cellpadding=0 class='floating_tutorial_content'><tr><td valign=top><div class='tutorial_text' style='margin-left: 11px;'>"+_6a5+"</div></td><td><div class='tutorial_close' style='margin-right:3px;' id='tutorial_close_"+id+"' onclick='t61.tutorial.close(\""+set+"\");'></div></td></tr></table></div>";
}
},new_element:function(set,id,_6ac,_6ad){
var tmp=document.createElement("DIV");
tmp.innerHTML=t61.tutorial.get_html(set,id,_6ac,_6ad);
return {element:tmp.childNodes[0],id:id};
},create:function(set,id,_6b1,_6b2,_6b3,_6b4){
var _6b5=t61.tutorial.new_element(set,id,_6b1,_6b2);
var _6b6=_6b5.element;
var top=_6b6.childNodes[0];
var mid=_6b6.childNodes[1];
var _6b9=_6b6.childNodes[2];
t61.util.pngfix(top);
t61.util.pngfix(mid);
t61.util.pngfix(_6b9);
if(_6b4){
var _6ba=(_6b4==1)?0:(_6b4-1)*15;
_6b6.style.height=(35+_6ba)+"px";
if(_6ba==0){
mid.parentNode.removeChild(mid);
}else{
mid.style.height=_6ba+"px";
}
}
_6b6.style.top=_6b3+"px";
var _6bb=0;
if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version<7){
_6bb=-10;
}
if(_6b2=="left"){
if(t61.viewport.width<1300){
_6b6.style.left="0%";
}else{
_6b6.style.left="50%";
_6b6.style.marginLeft=(-655+_6bb)+"px";
}
}else{
if(t61.viewport.width<1300){
_6b6.style.left="100%";
_6b6.style.marginLeft=(-250+_6bb)+"px";
}else{
_6b6.style.left="50%";
_6b6.style.marginLeft=(410+_6bb)+"px";
}
}
$("floating_tutorials").appendChild(_6b6);
t61.current_tutorial[set]=_6b5;
_6b6.style.display="none";
Effect.Appear(_6b6);
},close:function(set){
if(t61.current_tutorial[set]&&t61.current_tutorial[set].element){
var _6bd=t61.current_tutorial[set];
}else{
return;
}
delete (_6bd["close"]);
$("floating_tutorials").removeChild(_6bd.element);
delete (_6bd["element"]);
delete (t61.current_tutorial[set]);
new Ajax.Request("/user/update_tutorial_progress/"+set+"/5/?no_reward",{asynchronous:true,evalScripts:true});
},init:function(){
t61.viewport=t61.util.get_viewport();
var _6be=[];
if(t61.current_tutorial){
for(var set in t61.current_tutorial){
_6be.push(set);
}
}
if(t61.tutorial.data){
for(var set in t61.tutorial.data){
var i=_6be.indexOf(set);
if(i==-1){
t61.tutorial.init_set(set);
}else{
_6be.splice(i,1);
}
}
}
for(var i=0;i<_6be.length;i++){
var set=_6be[i];
t61.tutorial.close(set);
}
},init_set:function(set){
var _6c2;
var _6c3=t61.current_tutorial[set];
_6c2=t61.tutorial.data[set][t61.tutorial.progress[set]];
if(_6c2){
_6c2=[set].concat(_6c2);
}
if(_6c3&&_6c3.element&&_6c2&&(_6c3.id==_6c2[1])){
return;
}
if(_6c2){
t61.tutorial.create.apply(null,_6c2);
}
},completes:function(set,id){
if(t61.current_tutorial[set]&&t61.current_tutorial[set].id==id){
t61.tutorial.progress[set]+=1;
t61.tutorial.close(set);
t61.tutorial.init_set(set);
new Ajax.Request("/user/update_tutorial_progress/"+set+"/"+t61.tutorial.progress[set]+"/",{asynchronous:true,evalScripts:true});
}
},remind_profile_photo:function(){
if(t61.tutorial._profile_photo_reminder_sent){
return;
}
t61.tutorial._profile_photo_reminder_sent=true;
var url="/profile/photo/profile/upload/";
t61.notice.create("Be sure to <a href='#"+url+"' class='light' style=\"text-decoration:underline;\" onclick=\"t61.load_url('"+url+"');\">upload your profile photo</a>.",null,null,{delay:60000});
},remind_email_verify:function(){
if(t61.tutorial._profile_photo_reminder_sent){
return;
}
t61.tutorial._profile_photo_reminder_sent=true;
var url="/user/account/";
t61.notice.create("Be sure to verify your email in the <a href='#"+url+"' class='light' style=\"text-decoration:underline;\" onclick=\"t61.load_url('"+url+"');\">account page</a>.",null,null,{delay:45000});
},do_rack_tip:function(_6c8){
if(t61.tutorial._rack_tip_displayed){
return;
}
t61.tutorial._rack_tip_displayed=true;
var _6c9=t61.tutorial.get_icon_url();
t61.notice.create("Tip: You can earn extra hearts by listening to <a href='#' onclick='new Ajax.Request(\"/therack/\"); return false;' class='light' style='text-decoration:underline;'>The Rack.</a>",_6c9,null,{delay:_6c8});
},do_about_invites:function(_6ca){
var _6cb=t61.tutorial.get_icon_url();
t61.notice.create("Earn 100 rep and a percentage of your friend's total rep when they sign up.",_6cb,90,{delay:_6ca});
if(t61.is_artist){
t61.notice.create("Note: you don't get bonus points if you refer from an artist account.",_6cb,70,{delay:_6ca+2000});
}
},do_add_song_tip:function(){
if(t61.tutorial._playlist_tip_displayed){
return;
}
t61.tutorial._playlist_tip_displayed=true;
t61.notice.create("Tip: Click '+favorite' to add a song to your own playlist.",null,null,{delay:30000});
},do_first_play_tip:function(){
if(t61.is_logged_in||t61.tutorial._first_play_tip_displayed){
return;
}
t61.tutorial._first_play_tip_displayed=true;
var _6cc=t61.media_url+"/site_media/images/notice_icons/equalizer.gif";
var _6cd=t61.media_url+"/site_media/images/notice_icons/genius.gif";
t61.notice.create("Click any link on this site and the music will keep playing. Try it!",_6cc,null,{delay:15000});
t61.notice.create("Tip: click 'similar' to find songs similar to this one.",_6cd,null,{delay:75000});
},do_upload_music_as_artist_tip:function(){
if(t61.tutorial._upload_music_as_artist_tip_displayed){
return;
}
t61.notice.create("Note: If you want to upload your tracks, register as an artist instead.",null,68);
t61.tutorial._upload_music_as_artist_tip_displayed=true;
},do_ie_version_collection_tip:function(){
if(t61.tutorial._ie_version_collection_tip_displayed){
return;
}
t61.notice.create("Warning: Your version of IE is too old. You will not be able to remove songs from your playlist. Please upgrade to IE7 or download Firefox",null,110);
t61.tutorial._ie_version_collection_tip_displayed=true;
},do_mystery_song_tip:function(){
var _6ce=t61.media_url+"/site_media/images/notice_icons/simple_question_mark.png";
t61.notice.create("This song will be revealed an hour after it has been uploaded.",_6ce);
},do_start_play_song_tip:function(_6cf){
if(t61.current_song&&t61.current_song.playing){
return;
}
if($("mousehover_panel").style.display!="none"){
return;
}
t61.mousehover_panel.update("Click to start playing.");
t61.mousehover_panel.show(_6cf);
},do_quest_log_tip:function(){
if(t61.quests.log_opened){
return;
}
var _6d0=t61.media_url+"/site_media/images/notice_icons/quest_log_sample.gif";
t61.notice.create("Get started by opening the <a href='#' onclick='t61.quests.open_log(); return false;'>quest log</a> next to your username.",_6d0,null,{delay:15000});
},do_bazaar_tip:function(){
var _6d1=null;
if(t61.tutorial._bazaar_tip_displayed){
return;
}
t61.tutorial._bazaar_tip_displayed=true;
t61.notice.create("Did you know you can sell your music on thesixtyone? Read more <a href='/purchases/bazaar/' graceful='true'>here</a>.",_6d1,null,{delay:20000});
}};
if(!t61){
t61={};
}
t61.crypto={};
t61.crypto.encrypt=function(text){
var _6d3="";
var temp=[];
var _6d5=[];
var rnd=null;
for(i=0;i<text.length;i++){
rnd=Math.round(Math.random()*122)+68;
temp[i]=text.charCodeAt(i)+rnd;
_6d5[i]=rnd;
}
for(i=0;i<text.length;i++){
_6d3+=String.fromCharCode(temp[i],_6d5[i]);
}
return _6d3;
};
t61.crypto.unencrypt=function(text){
var _6d8="";
var temp=[];
var _6da=[];
for(i=0;i<text.length;i++){
temp[i]=text.charCodeAt(i);
_6da[i]=text.charCodeAt(i+1);
}
for(i=0;i<text.length;i=i+2){
_6d8+=String.fromCharCode(temp[i]-_6da[i]);
}
return _6d8;
};
var hexcase=0;
var b64pad="";
var chrsz=8;
function hex_sha1(s){
return binb2hex(core_sha1(str2binb(s),s.length*chrsz));
}
function core_sha1(x,len){
x[len>>5]|=128<<(24-len%32);
x[((len+64>>9)<<4)+15]=len;
var w=Array(80);
var a=1732584193;
var b=-271733879;
var c=-1732584194;
var d=271733878;
var e=-1009589776;
for(var i=0;i<x.length;i+=16){
var olda=a;
var oldb=b;
var oldc=c;
var oldd=d;
var olde=e;
for(var j=0;j<80;j++){
if(j<16){
w[j]=x[i+j];
}else{
w[j]=rol(w[j-3]^w[j-8]^w[j-14]^w[j-16],1);
}
var t=safe_add(safe_add(rol(a,5),sha1_ft(j,b,c,d)),safe_add(safe_add(e,w[j]),sha1_kt(j)));
e=d;
d=c;
c=rol(b,30);
b=a;
a=t;
}
a=safe_add(a,olda);
b=safe_add(b,oldb);
c=safe_add(c,oldc);
d=safe_add(d,oldd);
e=safe_add(e,olde);
}
return Array(a,b,c,d,e);
}
function sha1_ft(t,b,c,d){
if(t<20){
return (b&c)|((~b)&d);
}
if(t<40){
return b^c^d;
}
if(t<60){
return (b&c)|(b&d)|(c&d);
}
return b^c^d;
}
function sha1_kt(t){
return (t<20)?1518500249:(t<40)?1859775393:(t<60)?-1894007588:-899497514;
}
function safe_add(x,y){
var lsw=(x&65535)+(y&65535);
var msw=(x>>16)+(y>>16)+(lsw>>16);
return (msw<<16)|(lsw&65535);
}
function rol(num,cnt){
return (num<<cnt)|(num>>>(32-cnt));
}
function str2binb(str){
var bin=Array();
var mask=(1<<chrsz)-1;
for(var i=0;i<str.length*chrsz;i+=chrsz){
bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(32-chrsz-i%32);
}
return bin;
}
function binb2hex(_6fb){
var _6fc=hexcase?"0123456789ABCDEF":"0123456789abcdef";
var str="";
for(var i=0;i<_6fb.length*4;i++){
str+=_6fc.charAt((_6fb[i>>2]>>((3-i%4)*8+4))&15)+_6fc.charAt((_6fb[i>>2]>>((3-i%4)*8))&15);
}
return str;
}
if(!t61){
var t61={};
}
t61.miniplayer={toggle_menu:function(){
if($("miniplayer_menu").style.display=="none"){
t61.miniplayer.show_menu();
}else{
t61.miniplayer.hide_menu();
}
},hide_menu:function(){
Element.hide("miniplayer_menu");
},show_menu:function(){
if($("miniplayer_menu").style.display=="none"){
Element.show("miniplayer_menu");
}
if(t61.is_logged_in&&(t61.miniplayer._play_history_song_ids.length<10)&&(!t61.miniplayer._play_history_load_requested)){
var size=10-t61.miniplayer._play_history_song_ids.length;
new Ajax.Request("/song/load_play_history/"+size+"/");
t61.miniplayer._play_history_load_requested=true;
}
},show_status:function(text){
Element.hide("miniplayer_titles");
Element.show("miniplayer_status");
$("miniplayer_status").update(text);
},hide_status:function(){
Element.show("miniplayer_titles");
Element.hide("miniplayer_status");
},bind_button:function(name){
var _702=$("miniplayer_"+name+"_button");
_702.onclick=t61.miniplayer[name];
_702.onmouseover=t61.song.hover_button.bind(_702);
_702.onmouseout=t61.song.unhover_button.bind(_702);
},on_volume_slide:function(v){
t61.set_flash_volume(v);
t61.miniplayer.update_volume_track_background(v);
t61.miniplayer.adjust_volume_handle(v);
},adjust_volume_handle:function(v){
var _705=t61.miniplayer.volume_slider.handles[0];
if(v==1){
_705.style.width="11px";
_705.style.marginLeft="1px";
}else{
if(v==0){
_705.style.backgroundPosition="-1px 0px";
_705.style.width="11px";
}else{
if((t61.miniplayer._previous_volume==1)||(t61.miniplayer._previous_volume==0)){
_705.style.width="12px";
_705.style.marginLeft="0px";
_705.style.backgroundPosition="0px 0px";
}
}
}
t61.miniplayer._previous_volume=v;
},set_volume:function(v){
t61.miniplayer.volume_slider.setValue(v,null,false);
t61.miniplayer.update_volume_track_background(v);
t61.miniplayer.adjust_volume_handle(v);
},update_volume_track_background:function(v){
t61.miniplayer.volume_slider.track.style.backgroundPosition=parseInt(36*(-1+v))+"px 0px";
},update_progress:function(v){
t61.miniplayer.progress_slider.track.style.backgroundPosition=parseInt(195*(-1+v))+"px 0px";
},update_loader:function(_709,_70a){
$("miniplayer_loader").update(parseInt(_709/_70a*100)+"%");
},init:function(){
if(t61.miniplayer.volume_slider){
t61.miniplayer.volume_slider.dispose();
}
t61.miniplayer.volume_slider=new Control.Slider("miniplayer_volume_handle","miniplayer_volume_track",{onSlide:t61.miniplayer.on_volume_slide,onChange:t61.persist_flash_volume});
t61.miniplayer.progress_slider=new Control.Slider("miniplayer_progress_handle","miniplayer_progress_track",{onSlide:t61.miniplayer.update_progress,onChange:t61.set_flash_song_position});
t61.miniplayer.bind_button("next");
t61.miniplayer.bind_button("prev");
t61.miniplayer.bind_button("play");
t61.miniplayer.bind_button("pause");
if(BrowserDetect.browser!="Firefox"){
$("miniplayer_menu").style.position="absolute";
}
Event.stopObserving("miniplayer_menu_and_player","mouseout",t61.miniplayer.hide_menu);
Event.stopObserving("miniplayer_menu_and_player","mouseover",t61.miniplayer.show_menu);
Event.stopObserving("miniplayer_filler","mouseover",Event.stop);
Event.stopObserving("miniplayer_bump_link","mouseout",t61.miniplayer.hide_score);
Event.observe("miniplayer_menu_and_player","mouseout",t61.miniplayer.hide_menu);
Event.observe("miniplayer_menu_and_player","mouseover",t61.miniplayer.show_menu);
Event.observe("miniplayer_filler","mouseover",Event.stop);
Event.observe("miniplayer_bump_link","mouseout",t61.miniplayer.hide_score);
setTimeout(function(){
if(!t61.current_song){
var song=t61.song.get_by_position(0);
if(song){
t61.current_song=song;
t61.miniplayer.set_current_song(song,{skip_play_history:true});
t61.song.update_progress(0,1);
}else{
$("miniplayer_song_title").innerHTML="Ready";
}
}
},1);
},hide_score:function(_70c){
t61.mousehover_panel.hide();
Element.hide("miniplayer_score");
},do_photo_tip:function(_70d){
t61.mousehover_panel.update("click to jump back to the song");
t61.mousehover_panel.show(_70d);
},update_progress_time:function(_70e){
$("miniplayer_progress").innerHTML=_70e;
},handle_play:function(){
var song=t61.current_song;
Element.hide("miniplayer_play_button");
Element.show("miniplayer_pause_button");
},handle_pause:function(){
var song=t61.current_song;
Element.show("miniplayer_play_button");
Element.hide("miniplayer_pause_button");
},set_current_song:function(song,_712){
if(!_712){
_712={};
}
var _713=t61.song.get_song_link(t61.current_song,{css_class:"light",base_url:_712.base_url,page:_712.page});
var _714=_713["url"];
$("miniplayer_song_title").innerHTML=_713["html"];
var _715="/"+song.artist_username+"/";
var _716=t61.util.link_to_remote(song.artist.truncate(30),_715,"dark");
$("miniplayer_artist_name").innerHTML=_716;
$("miniplayer_photo_link").setAttribute("href","#"+_714);
$("miniplayer_photo_link").onclick=function(){
t61.load_url(_714,{"force_ajax":true});
};
$("miniplayer_photo").setAttribute("src",song.photo_base_url+"_tiny");
$("miniplayer_bump_link").onmouseover=function(_717){
if(_717){
song.on_bump_button_mouseover(_717);
}
Element.show("miniplayer_score");
};
if(song.score!=null){
$("miniplayer_score").update(song.score);
}else{
$("miniplayer_score").update("");
}
if(!_712.skip_play_history){
t61.miniplayer.update_play_history(_712);
}
t61.miniplayer.sync_favorited_selection();
},play_first_song:function(){
var _718=t61.song.get_by_position(0);
if(_718){
_718.play();
}
},next:function(){
t61.playlist.play_next_song();
},pause:function(){
if(t61.current_song){
t61.current_song.pause();
}
},play:function(){
if(t61.current_song){
t61.current_song.play();
}else{
t61.miniplayer.play_first_song();
}
},prev:function(){
t61.playlist.play_previous_song();
},_play_history_song_ids:[],update_play_history:function(_719){
var id=parseInt(t61.current_song.id);
var _71b=t61.miniplayer._play_history_song_ids[0];
var _71c=t61.miniplayer._play_history_song_ids.indexOf(id);
if(_71c!=-1){
var _71d=$("miniplayer_menu_play_history");
t61.miniplayer.select_song_on_menu(_71d.childNodes[_71c],"play_history");
return;
}
t61.miniplayer.add_to_play_history(t61.current_song,_719);
},add_to_play_history:function(song,_71f,_720){
if(!_71f){
_71f={};
}
if(!_720){
_720={};
}
if(!_71f.base_url){
if(t61.playlist.current){
_71f.base_url=t61.playlist.current.base_url;
_71f.page=t61.playlist.current.page;
}
}
var _721=t61.miniplayer._play_history_song_ids.indexOf(parseInt(song.id));
if((_721>-1)&&(_721<10)){
return;
}
t61.miniplayer.add_song_to_menu(song,"play_history",_71f,_720);
while(t61.miniplayer._play_history_song_ids.length>=10){
t61.miniplayer._play_history_song_ids.pop();
}
if(_720.append){
t61.miniplayer._play_history_song_ids.push(parseInt(song.id));
}else{
t61.miniplayer._play_history_song_ids.unshift(parseInt(song.id));
}
},add_song_to_menu:function(song,_723,_724,_725){
if(!_725){
_725={};
}
var _726=$("miniplayer_menu_"+_723);
var _727=_726.lastChild;
if(_727){
if(_726.childNodes.length>=10){
try{
delete (_727.onclick);
}
catch(e){
_727.onclick=null;
}
_726.removeChild(_727);
}
}
var _728=document.createElement("DIV");
if(_728.addClassName){
_728.addClassName("item");
}else{
_728.className="item";
}
if(!_724){
_724={};
}
if(_723=="favorited"){
_724.in_favorited=true;
_724.base_url=t61.miniplayer._favorites_base_url;
_724.per_page=t61.miniplayer_favorites_per_page;
_724.page=1;
}
_728.onclick=function(){
t61.song.toggle(song.id,_724);
t61.miniplayer.select_song_on_menu(_728,_723);
};
_728.innerHTML=(song.artist+" -- "+song.name).truncate(45);
if(_725.append){
_726.insertBefore(_728,_726.lastChild);
}else{
_726.insertBefore(_728,_726.firstChild);
}
t61.miniplayer.select_song_on_menu(_728,_723);
},select_song_on_menu:function(_729,_72a){
var _72b=$("miniplayer_menu_"+_72a);
var _72c=_72b.getElementsByClassName("item_selected");
if(_72c.length>0){
if(_72c[0].removeClassName){
_72c[0].removeClassName("item_selected");
}else{
_72c[0].className="item";
}
}
if(_729.addClassName){
_729.addClassName("item_selected");
}else{
_729.className="item item_selected";
}
},select_menu_tab:function(_72d){
var _72e="play_history";
if(_72d=="play_history"){
_72e="favorited";
}
var _72f=$("miniplayer_menu_"+_72d);
var _730=$("miniplayer_menu_"+_72e);
var _731=$("miniplayer_menu_tab_button_"+_72d);
var _732=$("miniplayer_menu_tab_button_"+_72e);
_731.addClassName("mini_tab_button_selected");
_731.removeClassName("mini_tab_button");
_732.removeClassName("mini_tab_button_selected");
_732.addClassName("mini_tab_button");
Element.show(_72f);
Element.hide(_730);
if(_72d=="favorited"){
t61.miniplayer.load_favorited();
}
},load_favorited:function(){
var _733=$("miniplayer_menu_favorited");
if(!t61.is_logged_in){
_733.update("<div class='item'>Please log in to view your favorites.</div>");
}else{
if(t61.miniplayer._favorited_song_data==null){
t61.replace_html(_733,"<div class='item'>Loading...</div>");
new Ajax.Request("/profile/favorites/miniplayer/");
}
}
},add_to_favorited:function(song,_735){
if(!_735){
_735={};
}
if(t61.miniplayer._favorited_song_data==null){
return;
}
t61.miniplayer.add_song_to_menu(song,"favorited");
if(!_735.loading){
t61.miniplayer._favorited_song_data.id_by_position.unshift(song.id);
if(t61.miniplayer._favorited_song_data.id_by_position.length){
t61.miniplayer._favorited_song_data.id_by_position.pop();
}
t61.miniplayer._favorited_song_data.by_id[song.id]=song;
}
},update_score:function(_736){
if($("miniplayer_score").style.display=="none"){
$("miniplayer_score").update(_736);
return;
}
if(t61.current_song&&(t61.current_song.score==_736)){
Effect.Fade("miniplayer_score",{from:1,to:0.01});
setTimeout(function(){
$("miniplayer_score").update(_736);
Effect.Appear("miniplayer_score");
},1000);
}
},handle_play_history_load_response:function(_737){
for(var i=0;i<_737.id_by_position.length;i++){
var id=_737.id_by_position[i];
var _73a=_737.by_id[id];
var song=t61.song.get_by_id(id);
if(!song){
song=new t61.Song(_73a);
t61.song.store(song);
}
t61.miniplayer.add_to_play_history(song,{},{append:true});
}
},handle_favorited_load_response:function(_73c){
t61.miniplayer._favorited_song_data=_73c;
t61.replace_html("miniplayer_menu_favorited","<div><a class='light' href='/profile/favorites/' graceful='true' style='margin-left:5px;font-size:0.85em;font-weight:bold;'>view all</a></div>");
for(var i=_73c.id_by_position.length-1;i>=0;i--){
var id=_73c.id_by_position[i];
var _73f=_73c.by_id[id];
var song=t61.song.get_by_id(id);
if(!song){
song=new t61.Song(_73f);
t61.song.store(song);
}
t61.miniplayer.add_to_favorited(song,{loading:true});
}
},sync_favorited_selection:function(){
if(t61.miniplayer._favorited_song_data==null){
return;
}
if(!t61.current_song){
return;
}
var id=t61.current_song.id;
var _742=t61.miniplayer._favorited_song_data.id_by_position.indexOf(id);
if(_742!=-1){
var _743=$("miniplayer_menu_favorited");
t61.miniplayer.select_song_on_menu(_743.childNodes[_742],"favorited");
}
},is_song_id_active:function(id){
var id=parseInt(id);
return ((t61.miniplayer._play_history_song_ids.indexOf(id)!=-1)||(t61.miniplayer._favorited_song_data&&(t61.miniplayer._favorited_song_data.id_by_position.indexOf(id)!=-1)));
}};
if(!this["t61"]){
var t61={};
}
t61.album_collectibles={duration:0.25,init:function(){
var el=document.getElementById("album_collectibles");
if(!el){
return;
}
if(el.addEventListener){
el.addEventListener("DOMMouseScroll",t61.album_collectibles.handle_mousewheel,false);
el.addEventListener("mousewheel",t61.album_collectibles.handle_mousewheel,false);
}else{
el.onmousewheel=t61.album_collectibles.handle_mousewheel;
}
Event.observe("album_collectibles_up","mousedown",function(){
t61.album_collectibles.start_scrolling(-1);
});
Event.observe("album_collectibles_up","mouseup",t61.album_collectibles.stop_scrolling);
Event.observe("album_collectibles_down","mousedown",function(){
t61.album_collectibles.start_scrolling(1);
});
Event.observe("album_collectibles_down","mouseup",t61.album_collectibles.stop_scrolling);
t61.album_collectibles._in_progress=false;
t61.album_collectibles.load_caption();
},load_caption:function(){
var _746=t61.album_collectibles.offset;
var _747=_746+t61.album_collectibles.width;
var data=t61.album_collectibles.data[_747];
Element.show("album_collectibles_caption");
if(data&&(data.album_name||data.artist_name)){
if(data.album_name){
$("album_collectibles_caption").update(data.album_name);
}else{
$("album_collectibles_caption").update(data.artist_name);
}
}else{
$("album_collectibles_caption").update("purchased music");
}
},teardown:function(){
if(t61.context&&(t61.context.nav!="profile")){
t61.album_collectibles.offset=0;
t61.album_collectibles.offset_destination=0;
}
},width:3,handle_mousewheel:function(_749){
var _74a=0;
if(!_749){
_749=window.event;
}
if(_749.wheelDelta){
_74a=_749.wheelDelta/120;
}else{
if(_749.detail){
_74a=-_749.detail/3;
}
}
if(_74a){
if(_74a>1){
_74a=1;
}else{
if(_74a<-1){
_74a=-1;
}
}
_74a*=-1;
t61.album_collectibles.scroll(_74a);
}
return t61.util.stop_event_all(_749);
},stop_scrolling:function(_74b){
if(t61.album_collectibles._scroll_interval){
clearInterval(t61.album_collectibles._scroll_interval);
}
},start_scrolling:function(_74c){
t61.album_collectibles.scroll(_74c);
t61.album_collectibles._scroll_interval=setInterval(function(){
t61.album_collectibles.scroll(_74c);
},300);
},scroll:function(_74d){
var _74e=t61.album_collectibles.width;
var _74f=-1*_74e;
var _750=t61.album_collectibles.data.length-1*(_74e+1);
var _751=parseInt(t61.album_collectibles.offset_destination);
var _752=t61.album_collectibles.offset_destination+_74d;
if(_752<_74f){
_752=_74f;
}
if(_752>_750){
_752=_750;
}
t61.album_collectibles.offset_destination=_752;
if(!t61.album_collectibles._in_progress){
t61.album_collectibles.goto_destination();
}
},goto_destination:function(){
$("album_collectibles_up").removeClassName("disabled");
$("album_collectibles_down").removeClassName("disabled");
if(parseInt(t61.album_collectibles.offset)==parseInt(t61.album_collectibles.offset_destination)){
var _753=t61.album_collectibles.width;
var _754=-1*_753;
var _755=t61.album_collectibles.data.length-1*(_753+1);
if(_754==t61.album_collectibles.offset){
$("album_collectibles_up").addClassName("disabled");
t61.album_collectibles.stop_scrolling();
}else{
if(_755==t61.album_collectibles.offset){
$("album_collectibles_down").addClassName("disabled");
t61.album_collectibles.stop_scrolling();
}
}
t61.album_collectibles._in_progress=false;
return;
}
var _756;
if(parseInt(t61.album_collectibles.offset)<parseInt(t61.album_collectibles.offset_destination)){
_756=1;
}else{
_756=-1;
}
if(!t61.album_collectibles._in_progress){
t61.album_collectibles.animate(_756);
t61.album_collectibles._in_progress=true;
}
},offset:0,offset_destination:0,get_scale:function(_757){
return [1,0.75,0.5,0.25,0][_757];
},get_config:function(_758){
var _759=t61.album_collectibles.get_scale;
var _75a=4;
var _75b=Math.abs(_758-_75a);
var _75c=_759(_75b);
var _75d=160;
var _75e=25;
var _75f=parseInt(_75d*_75c);
var _760=parseInt(_75d*_75c);
var _761=parseInt(_75e*_75c);
var _762=parseInt(_75e*_75c);
var _763=_75f-_761+parseInt(8*_75c);
var _764=_760-_762+parseInt(8*_75c);
var _765=1*_75c;
var _766=parseInt(-10*_75c);
var _767=1+_75a-_75b;
var top=0;
for(var i=1;i<_758;i++){
var _76a=Math.abs(i-_75a);
var _76b=_759(_76a);
var _76c=_759(_76a+1);
var _76d=parseInt(_75d*_76b);
var _76e;
if(i>3){
_76e=-45+35*_76c;
}else{
_76e=-45+35*_76b;
}
top+=parseInt(_76d+_76e);
}
var left=parseInt(17+(_75d-_75f)*0.5);
return {"outer_width":(_75f+parseInt(15*_75c))+"px","outer_height":(_760+2)+"px","width":_75f+"px","height":_760+"px","zIndex":_767,"marginTop":top+"px","marginLeft":left+"px","songs_count_width":_761+"px","songs_count_height":_762+"px","songs_count_marginLeft":_763+"px","songs_count_marginTop":_764+"px","fontSize":_765+"em","jewelcase_offset":_766+"px"};
},get_item:function(_770){
var _771=parseInt(t61.album_collectibles.offset)+_770;
var _772=[$("album_collectible_"+_771),$("album_collectible_image_"+_771),$("album_collectible_jewelcase_"+_771),$("songs_count_"+_771)];
if((!_772[0])&&(_771>=1)&&(_771<=t61.album_collectibles.data.length)){
var _773=document.createElement("div");
Element.extend(_773);
_773.addClassName("album_collectible");
_773.id="album_collectible_"+_771;
var _774=t61.album_collectibles.get_config(_770);
var data=t61.album_collectibles.data[_771-1];
if(!data){
return _772;
}
var _776=data.photo_url;
var _777="";
var _778="";
if(data.special_edition_flag||data.album_completed_flag){
_777="<img id='album_collectible_jewelcase_"+_771+"' src='"+t61.media_url+"/site_media/images/jewelcase.png' style='display:none;'/>";
}else{
_778="<div class='songs_count' id='songs_count_"+_771+"'><img class='songs_count_bg' src='"+t61.media_url+"/site_media/images/orange_circle.png' width='100%' height='100%' /><div class='songs_count_label' style='z-index:1;'>"+data.individual_songs_count+"</div></div>";
}
var _779;
if(data.album_id){
_779="<a href='#/"+data.artist_username+"/album/"+t61.util.get_safe_name(data.album_name)+"/"+data.album_id+"/'>";
}else{
_779="<a href='#/"+data.artist_username+"/'>";
}
_773.innerHTML=_779+"<img id='album_collectible_image_"+_771+"' src='"+_776+"' style='display:none;' /> "+_777+_778+" </a>";
_773.setStyle({width:_774.outer_width,height:_774.outer_height,marginTop:_774.marginTop,marginLeft:_774.marginLeft});
$("album_collectibles").appendChild(_773);
$("album_collectible_image_"+_771).setStyle({width:_774.width,height:_774.height,display:""});
if(_777!=""){
$("album_collectible_jewelcase_"+_771).setStyle({width:_774.outer_width,height:_774.outer_height,marginLeft:_774.jewelcase_offset,display:""});
}
if(_778!=""){
$("songs_count_"+_771).setStyle({width:_774.songs_count_width,height:_774.songs_count_height,marginLeft:_774.songs_count_marginLeft,marginTop:_774.songs_count_marginTop,fontSize:_774.fontSize});
}
var _772=t61.album_collectibles.get_item(_770);
return _772;
}
return _772;
},get_size:function(){
return t61.album_collectibles.data.length;
},animate:function(_77a){
var _77b=t61.album_collectibles.get_item;
var _77c,_77d,_77e,_77f,item,_781,_782;
var _783=t61.album_collectibles.duration;
var _784,_785;
_77f=_77b(0);
if(_77f&&_77f[0]){
Element.hide(_77f[0]);
}
_77f=_77b(8);
if(_77f&&_77f[0]){
Element.hide(_77f[0]);
}
_77f=_77b(1);
if(_77f&&_77f[0]){
Element.show(_77f[0]);
}
_77f=_77b(7);
if(_77f&&_77f[0]){
Element.show(_77f[0]);
}
if(_77a==-1){
_784=1;
_785=6;
}else{
if(_77a==1){
_784=2;
_785=7;
}
}
t61.album_collectibles._animation_start_time=new Date().getTime();
t61.album_collectibles.morph_elements(_784,_785,_77a,0);
},attr_list:["outer_width","outer_height","marginLeft","marginTop","width","height","zIndex","songs_count_width","songs_count_height","songs_count_marginLeft","songs_count_marginTop","jewelcase_offset"],morph_elements:function(_786,_787,_788,_789){
var _78a=t61.album_collectibles.duration*1000;
var _78b=t61.album_collectibles.get_item;
var _78c=20;
var _78d=(new Date().getTime())-t61.album_collectibles._animation_start_time;
var _78e=Math.min(1,_78d/_78a*1);
var _78f,_790,_791,attr,_793;
var _794=t61.album_collectibles.attr_list;
var _795,item,_797,_798,_799;
var _79a,_79b,_79c,_79d;
for(var i=_786;i<=_787;i++){
_795=_78b(i);
item=_795[0];
_797=_795[1];
_798=_795[2];
_799=_795[3];
if(item&&_797){
_78f=t61.album_collectibles.get_config(i);
_790=t61.album_collectibles.get_config(i-_788);
_791={};
for(var j=0;j<_794.length;j++){
attr=_794[j];
_791[attr]=parseInt(_78e*(parseInt(_790[attr])-parseInt(_78f[attr])))+parseInt(_78f[attr]);
if(attr!="zIndex"){
_791[attr]+="px";
}
}
_791["fontSize"]=(_78e*(parseFloat(_790["fontSize"])-parseFloat(_78f["fontSize"]))+parseFloat(_78f["fontSize"]))+"em";
_79a={width:_791.outer_width,height:_791.outer_height,marginLeft:_791.marginLeft,marginTop:_791.marginTop};
_79b={width:_791.width,height:_791.height};
_79c={width:_791.outer_width,height:_791.outer_height,marginLeft:_791.jewelcase_offset};
_79d={marginTop:_791.songs_count_marginTop,marginLeft:_791.songs_count_marginLeft,width:_791.songs_count_width,height:_791.songs_count_height,fontSize:_791.fontSize};
item.setStyle(_79a);
_797.setStyle(_79b);
if(_798){
_798.setStyle(_79c);
}else{
if(_799){
_799.setStyle(_79d);
}
}
if(_78e>0.5){
item.style.zIndex=_790.zIndex;
if(_798){
_798.style.zIndex=_790.zIndex;
}
if(_799){
_799.style.zIndex=_790.zIndex;
}
}
}
}
if(_78e<1){
setTimeout(function(){
t61.album_collectibles.morph_elements(_786,_787,_788,_78e);
},_78c);
}else{
t61.album_collectibles.offset+=_788;
t61.album_collectibles.load_caption();
t61.album_collectibles._in_progress=false;
t61.album_collectibles.goto_destination();
}
}};
if(!this["t61"]){
var t61={};
}
t61.fbconnect={post_song:function(_7a0){
_7a0=parseInt(_7a0);
setTimeout(function(){
FB.Connect.requireSession(function(){
new Ajax.Request("/fbconnect/show_feed_dialog/"+_7a0+"/");
});
},1);
},on_login:function(_7a1){
if(!_7a1){
_7a1={};
}
var _7a2={};
if(_7a1.secure){
_7a2.secure=true;
}
new Ajax.Request("/user/login/?via_fbconnect=true",{parameters:_7a2,method:"post"});
},on_link_account:function(){
new Ajax.Request("/fbconnect/link_account/");
}};
if(!window.FB){
FB={};
}
if(!FB.Bootstrap){
FB.Bootstrap={requireFeatures:function(_7a3,_7a4){
if(FB.Bootstrap.isXdChannel){
return;
}
FB.Bootstrap.enqueueFeatureRequest({"features":_7a3,"callback":_7a4,"loadedCount":0});
if(FB.Bootstrap.FeatureMap){
if(FB.FeatureLoader){
FB.FeatureLoader.singleton.checkRequestQueue();
}else{
FB.Bootstrap.addScript(FB.Bootstrap.FeatureMap["Base"].src);
}
}
},ensureInit:function(_7a5){
if(!_7a5){
throw ("FB.ensureInit called without a valid callback");
}
if(FB.Facebook&&FB.Facebook.get_initialized&&FB.Facebook.get_initialized().get_isReady()&&FB.Facebook.get_initialized().result){
return _7a5();
}
FB.Bootstrap.requireFeatures(FB.Bootstrap.features,function(){
FB.Facebook.get_initialized().waitForValue(true,_7a5);
});
},init:function(_7a6,_7a7,_7a8){
FB.Bootstrap.requireFeatures(FB.Bootstrap.features,function(){
if(FB.Facebook){
FB.Facebook.init(_7a6,_7a7,_7a8);
}
});
},addScript:function(src){
var _7aa;
var _7ab=document.getElementsByTagName("script");
if(_7ab){
var c=_7ab.length;
for(var i=0;i<c;i++){
_7aa=_7ab[i];
if(_7aa.src==src){
return;
}
}
}
_7aa=document.createElement("script");
_7aa.type="text/javascript";
_7aa.src=src;
var _7ae=document.getElementsByTagName("HEAD")[0]||document.body;
_7ae.appendChild(_7aa);
},initializeXdChannel:function(){
FB.Bootstrap.isXdChannel=window.location.search.indexOf(FB.Bootstrap.fbc_channel_token)>=0;
if(!FB.Bootstrap.isXdChannel){
FB.Bootstrap.createHiddenDiv();
FB.Bootstrap.detectDOMContentReady();
}
},detectDOMContentReady:function(){
if(window.navigator.userAgent.toLowerCase().indexOf("msie")>=0){
window.attachEvent("onload",function(){
FB.Bootstrap.IsDomContentReady=true;
});
}else{
window.addEventListener("DOMContentLoaded",function(){
FB.Bootstrap.IsDomContentReady=true;
},false);
}
},createHiddenDiv:function(){
if(document.getElementById("FB_HiddenContainer")==null){
document.write("<div id=\"FB_HiddenContainer\" "+"style=\"position:absolute; top:-10000px; left:-10000px; width:0px; height:0px;\" >"+"</div>");
}
},loadServerMaps:function(_7af,_7b0,_7b1){
if(!this.FeatureMap.length){
this.FeatureMap=_7af;
this.StaticResourceVersions=_7b0;
if(FB.FeatureLoader){
FB.FeatureLoader.singleton.checkRequestQueue();
}
}
if(!this.siteVars.length){
this.siteVars=_7b1;
}
},enqueueFeatureRequest:function(_7b2){
this.FeatureRequestQueue[this.FeatureRequestQueue.length]=_7b2;
},detectDocumentNamespaces:function(){
if(document.namespaces&&!document.namespaces.item["fb"]){
document.namespaces.add("fb");
}
},createDefaultXdChannelUrl:function(){
var _7b3=location.protocol+"//"+location.hostname+location.pathname+location.search;
if(location.search||location.search.length>0){
_7b3+="&";
}else{
_7b3+="?";
}
_7b3+="fbc_channel=1";
return _7b3;
},features:["XFBML","CanvasUtil"],IsDomContentReady:false,FeatureRequestQueue:[],FeatureMap:[],StaticResourceVersions:[],CustomFeatureMap:[],siteVars:{},fbc_channel_token:"fbc_channel=1"};
window.FB_RequireFeatures=FB.Bootstrap.requireFeatures;
window.FB.init=FB.Bootstrap.init;
window.FB.ensureInit=FB.Bootstrap.ensureInit;
}
FB.Bootstrap.initializeXdChannel();
FB.Bootstrap.detectDocumentNamespaces();
FB.Bootstrap.loadServerMaps({"Base":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9IFE/lpkg/3wswak2f/nu_ll/141/168438/js/connect.js.pkg.php","dependencies":null},"Common":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9IFE/lpkg/3wswak2f/nu_ll/141/168438/js/connect.js.pkg.php","dependencies":["Base"]},"XdComm":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9IFE/lpkg/3wswak2f/nu_ll/141/168438/js/connect.js.pkg.php","dependencies":["Common"]},"CacheData":{"src":"http://static.ak.fbcdn.net/rsrc.php/zEECA/l/94y4e2fx/nu_ll/146710/js/api_lib/v0.4/CacheData.js","dependencies":["Common","XdComm"]},"Api":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9IFE/lpkg/3wswak2f/nu_ll/141/168438/js/connect.js.pkg.php","dependencies":["XdComm"]},"CanvasUtil":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9IFE/lpkg/3wswak2f/nu_ll/141/168438/js/connect.js.pkg.php","dependencies":["Common","XdComm"]},"Connect":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9IFE/lpkg/3wswak2f/nu_ll/141/168438/js/connect.js.pkg.php","dependencies":["CanvasUtil","Api"],"styleSheets":["http://static.ak.fbcdn.net/rsrc.php/z3PG4/l/dqx9ty2a/en_US/164323/css/connect/fb_connect.css"]},"XFBML":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9IFE/lpkg/3wswak2f/nu_ll/141/168438/js/connect.js.pkg.php","dependencies":["CanvasUtil","Api","Connect"]},"Integration":{"src":"http://static.ak.fbcdn.net/rsrc.php/z38PM/l/5fgk415d/nu_ll/146710/js/api_lib/v0.4/Integration.js","dependencies":["Connect"]},"Comments":{"src":"http://static.ak.fbcdn.net/rsrc.php/z9SGM/l/7bodfyxw/nu_ll/147339/js/api_lib/v0.4/Comments.js","dependencies":["XdComm","XFBML"]},"Payments":{"src":"http://static.ak.fbcdn.net/rsrc.php/z24XY/l/9qoy5526/nu_ll/165135/js/api_lib/v0.4/fbpayments.js","dependencies":["XdComm","Connect"]}},{"base_url_format":"http://{0}.connect.facebook.com/","api_channel":163033,"api_server":163033,"www_channel":163033,"xd_comm_swf_url":"http://static.ak.connect.facebook.com/swf/XdComm.swf","login_img_dark_small_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_dark_small_short.gif?8:121638","login_img_dark_medium_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_dark_medium_short.gif?8:121638","login_img_dark_medium_long":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_dark_medium_long.gif?8:121638","login_img_dark_large_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_dark_large_short.gif?8:121776","login_img_dark_large_long":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_dark_large_long.gif?8:121638","login_img_light_small_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_small_short.gif?8:121638","login_img_light_medium_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_medium_short.gif?8:121776","login_img_light_medium_long":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_medium_long.gif?8:121776","login_img_light_large_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_large_short.gif?8:121776","login_img_light_large_long":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_large_long.gif?8:121638","login_img_white_small_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_white_small_short.gif?8:121638","login_img_white_medium_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_white_medium_short.gif?8:121638","login_img_white_medium_long":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_white_medium_long.gif?8:121638","login_img_white_large_short":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_white_large_short.gif?8:121638","login_img_white_large_long":"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_white_large_long.gif?8:121638","logout_img_small":"http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_small.gif?8:132011","logout_img_medium":"http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_medium.gif?8:132011","logout_img_large":"http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_large.gif?8:132011"},{"canvas_client_compute_content_size_method":1,"use_postMessage":1,"enable_custom_href":0});
if(!window.FBIntern){
FBIntern={};
}
if(!FBIntern.XdReceiver){
FBIntern.XdReceiver={delay:100,timerId:-1,dispatchMessage:function(){
var _7b4=document.URL;
var _7b5=_7b4.indexOf("#");
var hash;
if(_7b5>0){
hash=_7b4.substring(_7b5+1);
}else{
_7b5=_7b4.indexOf("fb_login&");
if(_7b5>0){
hash=_7b4.substring(_7b5+9);
}else{
return;
}
}
var _7b7="debug=1&";
if(hash.indexOf(_7b7)==0){
hash=hash.substring(_7b7.length);
}
var _7b8;
var func=null;
try{
var _7ba=window.parent;
if(hash.indexOf("fname=")==0){
var _7bb=hash.indexOf("&");
var _7bc=hash.substr(6,_7bb-6);
if(_7bc=="_opener"){
_7ba=_7ba.opener;
}else{
if(_7bc=="_oparen"){
_7ba=_7ba.opener.parent;
}else{
if(_7bc!="_parent"){
_7ba=_7ba.frames[_7bc];
}
}
}
_7b8=hash.substr(_7bb+1);
}else{
_7ba=_7ba.parent;
_7b8=hash;
}
func=_7ba.FB.XdComm.Server.singleton.onReceiverLoaded;
}
catch(e){
if(e.number==-2146828218){
return;
}
}
if(func){
_7ba.FB.XdComm.Server.singleton.onReceiverLoaded(_7b8);
if(FBIntern.XdReceiver.timerId!=-1){
window.clearInterval(FBIntern.XdReceiver.timerId);
FBIntern.XdReceiver.timerId=-1;
}
}else{
if(FBIntern.XdReceiver.timerId==-1){
try{
FBIntern.XdReceiver.timerId=window.setInterval(FBIntern.XdReceiver.dispatchMessage,FBIntern.XdReceiver.delay);
}
catch(e){
}
}
}
}};
if(!(window.FB&&FB.Bootstrap&&!FB.Bootstrap.isXdChannel)){
try{
FBIntern.XdReceiver.dispatchMessage();
}
catch(e){
}
}
}

