var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(el,onFired,options){this.element=$(el)||$$(el);this.addEvent('onFired',onFired);this.setOptions(options);this.bound=this.changed.bind(this);this.resume();},changed:function(){var value=this.element.get('value');if($equals(this.value,value))return;this.clear();this.value=value;this.timeout=this.onFired.delay(this.options.delay,this);},setValue:function(value){this.value=value;this.element.set('value',value);return this.clear();},onFired:function(){this.fireEvent('onFired',[this.value,this.element]);},clear:function(){$clear(this.timeout||null);return this;},pause:function(){if(this.timer)$clear(this.timer);else this.element.removeEvent('keyup',this.bound);return this.clear();},resume:function(){this.value=this.element.get('value');if(this.options.periodical)this.timer=this.changed.periodical(this.options.periodical,this);else this.element.addEvent('keyup',this.bound);return this;}});var $equals=function(obj1,obj2){return(obj1==obj2||JSON.encode(obj1)==JSON.encode(obj2));};;var Autocompleter=new Class({Implements:[Options,Events],options:{minLength:1,markQuery:true,width:'inherit',maxChoices:10,injectChoice:null,customChoices:null,emptyChoices:null,visibleChoices:true,className:'autocompleter-choices',zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSubset:false,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:', ',separatorSplit:/\s*[,;]\s*/,autoTrim:false,allowDupes:false,cache:true,relative:false},initialize:function(element,options){this.element=$(element);this.setOptions(options);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),$merge({'delay':this.options.delay},this.options.observerOptions));this.queryValue=null;if(this.options.filter)this.filter=this.options.filter.bind(this);var mode=this.options.selectMode;this.typeAhead=(mode=='type-ahead');this.selectMode=(mode===true)?'selection':mode;this.cached=[];},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices;}else{this.choices=new Element('ul',{'class':this.options.className,'styles':{'zIndex':this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,'after');this.relative=this.element.getOffsetParent();}
this.fix=new OverlayFix(this.choices);}
if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator;}
this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,$merge({'property':'opacity','link':'cancel','duration':200},this.options.fxOptions)).addEvent('onStart',Chain.prototype.clearChain).set(0);this.element.setProperty('autocomplete','off').addEvent((Browser.Engine.trident||Browser.Engine.webkit)?'keydown':'keypress',this.onCommand.bind(this)).addEvent('click',this.onCommand.bind(this,[false])).addEvent('focus',this.toggleFocus.create({bind:this,arguments:true,delay:100})).addEvent('blur',this.toggleFocus.create({bind:this,arguments:false,delay:100}));},destroy:function(){if(this.fix)this.fix.destroy();this.choices=this.selected=this.choices.destroy();},toggleFocus:function(state){this.focussed=state;if(!state)this.hideChoices(true);this.fireEvent((state)?'onFocus':'onBlur',[this.element]);},onCommand:function(e){if(!e&&this.focussed)return this.prefetch();if(e&&e.key&&!e.shift){switch(e.key){case'enter':if(this.element.value!=this.opted)return true;if(this.selected&&this.visible){this.choiceSelect(this.selected);return!!(this.options.autoSubmit);}
break;case'up':case'down':if(!this.prefetch()&&this.queryValue!==null){var up=(e.key=='up');this.choiceOver((this.selected||this.choices)[(this.selected)?((up)?'getPrevious':'getNext'):((up)?'getLast':'getFirst')](this.options.choicesMatch),true);}
return false;case'esc':case'tab':this.hideChoices(true);break;}}
return true;},setSelection:function(finish){var input=this.selected.inputValue,value=input;var start=this.queryValue.length,end=input.length;if(input.substr(0,start).toLowerCase()!=this.queryValue.toLowerCase())start=0;if(this.options.multiple){var split=this.options.separatorSplit;value=this.element.value;start+=this.queryIndex;end+=this.queryIndex;var old=value.substr(this.queryIndex).split(split,1)[0];value=value.substr(0,this.queryIndex)+input+value.substr(this.queryIndex+old.length);if(finish){var tokens=value.split(this.options.separatorSplit).filter(function(entry){return this.test(entry);},/[^\s,]+/);if(!this.options.allowDupes)tokens=[].combine(tokens);var sep=this.options.separator;value=tokens.join(sep)+sep;end=value.length;}}
this.observer.setValue(value);this.opted=value;if(finish||this.selectMode=='pick')start=end;this.element.selectRange(start,end);this.fireEvent('onSelection',[this.element,this.selected,value,input]);},showChoices:function(){var match=this.options.choicesMatch,first=this.choices.getFirst(match);this.selected=this.selectedValue=null;if(this.fix){var pos=this.element.getCoordinates(this.relative),width=this.options.width||'auto';this.choices.setStyles({'left':pos.left,'top':pos.bottom,'width':(width===true||width=='inherit')?pos.width:width});}
if(!first)return;if(!this.visible){this.visible=true;this.choices.setStyle('display','');if(this.fx)this.fx.start(1);this.fireEvent('onShow',[this.element,this.choices]);}
if(this.options.selectFirst||this.typeAhead||first.inputValue==this.queryValue)this.choiceOver(first,this.typeAhead);var items=this.choices.getChildren(match),max=this.options.maxChoices;var styles={'overflowY':'hidden','height':''};this.overflown=false;if(items.length>max){var item=items[max-1];styles.overflowY='scroll';styles.height=item.getCoordinates(this.choices).bottom;this.overflown=true;};this.choices.setStyles(styles);this.fix.show();if(this.options.visibleChoices){var scroll=document.getScroll(),size=document.getSize(),coords=this.choices.getCoordinates();if(coords.right>scroll.x+size.x)scroll.x=coords.right-size.x;if(coords.bottom>scroll.y+size.y)scroll.y=coords.bottom-size.y;window.scrollTo(Math.min(scroll.x,coords.left),Math.min(scroll.y,coords.top));}},hideChoices:function(clear){if(clear){var value=this.element.value;if(this.options.forceSelect)value=this.opted;if(this.options.autoTrim){value=value.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator);}
this.observer.setValue(value);}
if(!this.visible)return;this.visible=false;if(this.selected)this.selected.removeClass('autocompleter-selected');this.observer.clear();var hide=function(){this.choices.setStyle('display','none');this.fix.hide();}.bind(this);if(this.fx)this.fx.start(0).chain(hide);else hide();this.fireEvent('onHide',[this.element,this.choices]);},prefetch:function(){var value=this.element.value,query=value;if(this.options.multiple){var split=this.options.separatorSplit;var values=value.split(split);var index=this.element.getSelectedRange().start;var toIndex=value.substr(0,index).split(split);var last=toIndex.length-1;index-=toIndex[last].length;query=values[last];}
if(query.length<this.options.minLength){this.hideChoices();}else{if(query===this.queryValue||(this.visible&&query==this.selectedValue)){if(this.visible)return false;this.showChoices();}else{this.queryValue=query;this.queryIndex=index;if(!this.fetchCached())this.query();}}
return true;},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue)return false;this.update(this.filter(this.cached));return true;},update:function(tokens){this.choices.empty();this.cached=tokens;var type=tokens&&$type(tokens);if(!type||(type=='array'&&!tokens.length)||(type=='hash'&&!tokens.getLength())){(this.options.emptyChoices||this.hideChoices).call(this);}else{if(this.options.maxChoices<tokens.length&&!this.options.overflow)tokens.length=this.options.maxChoices;tokens.each(this.options.injectChoice||function(token){var choice=new Element('li',{'html':this.markQueryValue(token)});choice.inputValue=token;this.addChoiceEvents(choice).inject(this.choices);},this);this.showChoices();}},choiceOver:function(choice,selection){if(!choice||choice==this.selected)return;if(this.selected)this.selected.removeClass('autocompleter-selected');this.selected=choice.addClass('autocompleter-selected');this.fireEvent('onSelect',[this.element,this.selected,selection]);if(!this.selectMode)this.opted=this.element.value;if(!selection)return;this.selectedValue=this.selected.inputValue;if(this.overflown){var coords=this.selected.getCoordinates(this.choices),margin=this.options.overflowMargin,top=this.choices.scrollTop,height=this.choices.offsetHeight,bottom=top+height;if(coords.top-margin<top&&top)this.choices.scrollTop=Math.max(coords.top-margin,0);else if(coords.bottom+margin>bottom)this.choices.scrollTop=Math.min(coords.bottom-height+margin,bottom);}
if(this.selectMode)this.setSelection();},choiceSelect:function(choice){if(choice)this.choiceOver(choice);this.setSelection(true);this.queryValue=false;this.hideChoices();},filter:function(tokens){return(tokens||this.tokens).filter(function(token){return this.test(token);},new RegExp(((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp(),(this.options.filterCase)?'':'i'));},markQueryValue:function(str){return(!this.options.markQuery||!this.queryValue)?str:str.replace(new RegExp('('+((this.options.filterSubset)?'':'^')+this.queryValue.escapeRegExp()+')',(this.options.filterCase)?'':'i'),'<span class="autocompleter-queried">$1</span>');},addChoiceEvents:function(el){return el.addEvents({'mouseover':this.choiceOver.bind(this,[el]),'click':this.choiceSelect.bind(this,[el])});}});var OverlayFix=new Class({initialize:function(el){if(Browser.Engine.trident){this.element=$(el);this.relative=this.element.getOffsetParent();this.fix=new Element('iframe',{'frameborder':'0','scrolling':'no','src':'javascript:false;','styles':{'position':'absolute','border':'none','display':'none','filter':'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'}}).inject(this.element,'after');}},show:function(){if(this.fix){var coords=this.element.getCoordinates(this.relative);delete coords.right;delete coords.bottom;this.fix.setStyles($extend(coords,{'display':'','zIndex':(this.element.getStyle('zIndex')||1)-1}));}
return this;},hide:function(){if(this.fix)this.fix.setStyle('display','none');return this;},destroy:function(){if(this.fix)this.fix=this.fix.destroy();}});Element.implement({getSelectedRange:function(){if(!Browser.Engine.trident)return{start:this.selectionStart,end:this.selectionEnd};var pos={start:0,end:0};var range=this.getDocument().selection.createRange();if(!range||range.parentElement()!=this)return pos;var dup=range.duplicate();if(this.type=='text'){pos.start=0-dup.moveStart('character',-100000);pos.end=pos.start+range.text.length;}else{var value=this.value;var offset=value.length-value.match(/[\n\r]*$/)[0].length;dup.moveToElementText(this);dup.setEndPoint('StartToEnd',range);pos.end=offset-dup.text.length;dup.setEndPoint('StartToStart',range);pos.start=offset-dup.text.length;}
return pos;},selectRange:function(start,end){if(Browser.Engine.trident){var diff=this.value.substr(start,end-start).replace(/\r/g,'').length;start=this.value.substr(0,start).replace(/\r/g,'').length;var range=this.createTextRange();range.collapse(true);range.moveEnd('character',start+diff);range.moveStart('character',start);range.select();}else{this.focus();this.setSelectionRange(start,end);}
return this;}});Autocompleter.Base=Autocompleter;;Autocompleter.Local=new Class({Extends:Autocompleter,options:{minLength:0,delay:200},initialize:function(element,tokens,options){this.parent(element,options);this.tokens=tokens;},query:function(){this.update(this.filter());}});;Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:'value'},query:function(){var data=$unlink(this.options.postData)||{};data[this.options.postVar]=this.queryValue;var indicator=$(this.options.indicator);if(indicator)indicator.setStyle('display','');var cls=this.options.indicatorClass;if(cls)this.element.addClass(cls);this.fireEvent('onRequest',[this.element,this.request,data,this.queryValue]);this.request.send({'data':data});},queryResponse:function(){var indicator=$(this.options.indicator);if(indicator)indicator.setStyle('display','none');var cls=this.options.indicatorClass;if(cls)this.element.removeClass(cls);return this.fireEvent('onComplete',[this.element,this.request]);}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);this.request=new Request.JSON($merge({'url':url,'link':'cancel'},this.options.ajaxOptions)).addEvent('onComplete',this.queryResponse.bind(this));},queryResponse:function(response){this.parent();this.update(response);}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);this.request=new Request.HTML($merge({'url':url,'link':'cancel','update':this.choices},this.options.ajaxOptions)).addEvent('onComplete',this.queryResponse.bind(this));},queryResponse:function(tree,elements){this.parent();if(!elements||!elements.length){this.hideChoices();}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(choice){var value=choice.innerHTML;choice.inputValue=value;this.addChoiceEvents(choice.set('html',this.markQueryValue(value)));},this);this.showChoices();}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};;(function(){var data={language:'en-US',languages:{'en-US':{}},cascades:['en-US']};var cascaded;MooTools.lang=new Events();$extend(MooTools.lang,{setLanguage:function(lang){if(!data.languages[lang])return this;data.language=lang;this.load();this.fireEvent('langChange',lang);return this;},load:function(){var langs=this.cascade(this.getCurrentLanguage());cascaded={};$each(langs,function(set,setName){cascaded[setName]=this.lambda(set);},this);},getCurrentLanguage:function(){return data.language;},addLanguage:function(lang){data.languages[lang]=data.languages[lang]||{};return this;},cascade:function(lang){var cascades=(data.languages[lang]||{}).cascades||[];cascades.combine(data.cascades);cascades.erase(lang).push(lang);var langs=cascades.map(function(lng){return data.languages[lng];},this);return $merge.apply(this,langs);},lambda:function(set){(set||{}).get=function(key,args){return $lambda(set[key]).apply(this,$splat(args));};return set;},get:function(set,key,args){if(cascaded&&cascaded[set])return(key?cascaded[set].get(key,args):cascaded[set]);},set:function(lang,set,members){this.addLanguage(lang);langData=data.languages[lang];if(!langData[set])langData[set]={};$extend(langData[set],members);if(lang==this.getCurrentLanguage()){this.load();this.fireEvent('langChange',lang);}
return this;},list:function(){return Hash.getKeys(data.languages);}});})();;var page_url=location.href;var google_account="UA-1125794-2";var index_amf_max=10;var index_amf_total=0;var xmlhttp_handle=ajax_connect();_uacct=google_account;function fetchElementById(id)
{if(document.getElementById){var return_var=document.getElementById(id);}else if(document.all){var return_var=document.all[id];}else if(document.layers){var return_var=document.layers[id];}else{alert("Failed to fetch element ID '"+id+"'");}
return return_var;}
function ajax_connect()
{if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){alert("Your browser does not support AJAX!");}}}
return xmlhttp;}
function get_cookie(cookie_name)
{if(document.cookie.length>0){cookie_start=document.cookie.indexOf(cookie_name+"=");if(cookie_start!=-1){cookie_start=((cookie_start+cookie_name.length)+1);cookie_end=document.cookie.indexOf(";",cookie_start);if(cookie_end==-1){cookie_end=document.cookie.length;}
return unescape(document.cookie.substring(cookie_start,cookie_end));}}
return false;}
function set_cookie(cookie_name,value,expire)
{var expire_date=new Date();expire_date.setDate(expire_date.getDate()+expire);document.cookie=(cookie_name+"="+escape(value)+((expire==null)?"":";expires="+expire_date.toGMTString()));return true;}
function gallery_action(act,id,value)
{if(act=="move"||act=="delete"){var checked_files=new Array();var block_id=document.forms['user_gallery'];for(i=0;i<block_id.elements.length;i++){if(block_id.elements[i].name=="userfile[]"){if(block_id.elements[i].checked==1){checked_files[i]=block_id.elements[i].value;}}}}
switch(act){case"select":var block_id=document.forms['user_gallery'];for(i=0;i<block_id.elements.length;i++){if(block_id.elements[i].name=="userfile[]"){if(block_id.elements[i].checked==1){block_id.elements[i].checked=0;}else{block_id.elements[i].checked=1;}}}
break;case"rename":var block_id=fetchElementById(id);block_id.setAttribute("onclick",null);block_id.innerHTML="<input type=\"text\" id=\""+id+"_rename\" maxlength=\"25\" style=\"width: 165px;\" class=\"input_field\" value=\""+block_id.innerHTML+"\" />";fetchElementById(id+"_rename").setAttribute("onblur","javascript:gallery_action('rename-d', '"+id+"', this.value);");fetchElementById(id+"_rename").setAttribute("onkeypress","javascript:void(0);");highlight(fetchElementById(id+"_rename"));break;case"rename-d":var block_id=fetchElementById(id);var new_title=((value=="")?"Untitled":value);xmlhttp_handle.open("GET",("users.php?act=rename_file_title&file="+id+"&title="+encodeURI(new_title)),false);xmlhttp_handle.send(null);block_id.innerHTML=xmlhttp_handle.responseText;block_id.setAttribute("onclick","javascript:gallery_action('rename', this.id);");break;case"move":var files_to_move="";for(i=0;i<checked_files.length;i++){if(checked_files[i]!=undefined){files_to_move+=(checked_files[i]+",");}}
if(files_to_move!=""){files_to_move=files_to_move.substr(0,(files_to_move.length-1));toggle_lightbox(("users.php?act=move_files&files="+encodeURI(files_to_move)+"&return="+encodeURIComponent(page_url)),"move_files_lightbox");}
break;case"delete":var files_to_delete="";for(i=0;i<checked_files.length;i++){if(checked_files[i]!=undefined){files_to_delete+=(checked_files[i]+",");}}
if(files_to_delete!=""){files_to_delete=files_to_delete.substr(0,(files_to_delete.length-1));toggle_lightbox(("users.php?act=delete_files&files="+encodeURI(files_to_delete)+"&return="+encodeURIComponent(page_url)),"move_files_lightbox");}
break;}
return true;}
function toggle_lightbox(url,div)
{var block_id=fetchElementById("page_body");var request_url=(url+(((url.match(/\?/))?"&":"?")+"lb_div="+div));if(url!="no_url"){var lightbox_id=document.createElement("div");scroll(0,0);lightbox_id.setAttribute("id",div);xmlhttp_handle.open("GET",request_url,false);xmlhttp_handle.send(null);lightbox_id.innerHTML="<div class=\"lightbox_main\">"+xmlhttp_handle.responseText+"</div>";lightbox_id.innerHTML+="<div class=\"lightbox_background\">&nbsp;</div>";block_id.appendChild(lightbox_id);}else{var lightbox_id=fetchElementById(div);block_id.removeChild(lightbox_id);}
return;}
function highlight(field)
{field.focus();field.select();return true;}
function toggle(id){var block_id=fetchElementById(id);if(block_id.style==false){block_id.setAttribute("style","");}
block_id.style.display=((block_id.style.display=="none")?"block":"none");return true;}
function new_file_input(upload_type)
{var block_id=fetchElementById("more_file_inputs");if(index_amf_total<index_amf_max){var file_id=("file-"+index_amf_total);var file_div=document.createElement("div");file_div.setAttribute("id",file_id);if(upload_type=="url"){file_div.innerHTML+="<input name=\"userfile[]\" type=\"text\" class=\"url_upload\" size=\"50\" /> ";}else{file_div.innerHTML+="<input name=\"userfile[]\" type=\"file\" size=\"50\" /> ";}
file_div.innerHTML+="<input type=\"button\" class=\"button1\" onclick=\"javascript:remove_file_input('"+file_id+"');\" style=\"height: 19px;\" value=\"Remove File\" /> <br />";index_amf_total++;block_id.appendChild(file_div);}else{alert("You can only add a max of "+index_amf_max+" files to each upload.");}
return true;}
function remove_file_input(div)
{var block_id=fetchElementById("more_file_inputs");var file_div=fetchElementById(div);block_id.removeChild(file_div);index_amf_total--;return true;}
function position_pulldown(menu_obj,menu_id)
{var block_id=fetchElementById(menu_id);var block_obj=menu_obj;var left_position=top_position=0;if(block_obj.offsetParent){while(block_obj.offsetParent){left_position+=block_obj.offsetLeft;top_position+=block_obj.offsetTop;block_obj=block_obj.offsetParent}}
block_id.setAttribute("style","");block_id.style.position="absolute";block_id.style.top=((top_position+17)+"px");block_id.style.left=(left_position+"px");return true;};var UvumiDropdown=new Class({Implements:Options,options:{duration:250,transition:Fx.Transitions.linear},initialize:function(a,b){this.menu=a;this.setOptions(b);window.addEvent('domready',this.domReady.bind(this))},domReady:function(){this.menu=$(this.menu);if(!$defined(this.menu)){return false}if(this.menu.get('tag')!='ul'){this.menu=this.menu.getFirst('ul');if(!$defined(this.menu)){return false}}this.menu.setStyles({overflow:'hidden',height:0,marginLeft:(Browser.Engine.trident?1:-1)});this.createSubmenu(this.menu);this.menu.getChildren('li').setStyles({'float':'left',display:'block',top:0});var a=new Element('li',{html:"&nbsp;",styles:{clear:'both',display:(Browser.Engine.trident?'inline':'block'),position:'relative',top:0,height:0,width:0,fontSize:0,lineHeight:0,margin:0,padding:0}}).inject(this.menu);this.menu.setStyles({height:'auto',overflow:'visible',visibility:'visible'});this.menu.getElements('a').setStyle('display',(Browser.Engine.trident?'inline-block':'block'))},createSubmenu:function(c){var d=c.getChildren('li');var e=0;d.each(function(a){a.setStyles({position:'relative',display:'block',top:-e,zIndex:1});e+=a.getSize().y;var b=a.getFirst('ul');if($defined(b)){b.setStyle('display','none');if(c==this.menu){var x=0;var y=a.getSize().y;this.options.link='cancel';a.store('animation',new Fx.Elements($$(b,b.getChildren('li')).setStyle('opacity',0),this.options))}else{var x=a.getSize().x-a.getStyle('border-left-width').toInt();var y=-a.getStyle('border-bottom-width').toInt();this.options.link='chain';a.store('animation',new Fx.Elements($$(b,b.getChildren('li')).setStyle('opacity',0),this.options));e=a.getSize().y+a.getPosition(this.menu).y}b.setStyles({position:'absolute',display:'block',top:y,left:x,marginLeft:-x,opacity:0});this.createSubmenu(b);a.addEvents({mouseenter:this.showChildList.bind(this,a),mouseleave:this.hideChildList.bind(this,a)}).addClass('submenu')}},this)},showChildList:function(b){var c=b.getFirst('ul');var d=$$(c.getChildren('li'));var e=b.retrieve('animation');if(b.getParent('ul')!=this.menu){e.cancel();e.start({0:{opacity:1,marginLeft:0},1:{opacity:1}});var f={}}else{var f={0:{opacity:1}}}d.each(function(a,i){f[i+1]={top:0,opacity:1}});b.setStyle('z-index',99);e.start(f)},hideChildList:function(b){var c=b.retrieve('animation');var d=b.getFirst('ul');var e=$$(d.getChildren('li'));var f=0;var g={};e.each(function(a,i){g[i+1]={top:-f,opacity:0};f+=a.getSize().y});b.setStyle('z-index',1);if(b.getParent('ul')!=this.menu){g[1]=null;c.cancel();c.start(g);c.start({0:{opacity:0,marginLeft:-d.getSize().x},1:{opacity:0}})}else{g[0]={opacity:0};c.start(g)}}});;Swiff.Uploader=new Class({Extends:Swiff,Implements:Events,options:{path:'/source/includes/swf/Swiff.Uploader.swf',target:null,zIndex:9999,height:30,width:100,callBacks:null,params:{wMode:'opaque',menu:'false',allowScriptAccess:'always'},typeFilter:null,multiple:true,queued:true,verbose:false,url:null,method:null,data:null,mergeData:true,fieldName:null,fileSizeMin:1,fileSizeMax:null,allowDuplicates:false,timeLimit:(Browser.Platform.linux)?0:60,buttonImage:null,policyFile:null,fileListMax:0,fileListSizeMax:0,instantStart:false,appendCookieData:false,fileClass:null},initialize:function(options){this.addEvent('load',this.initializeSwiff,true).addEvent('select',this.processFiles,true).addEvent('complete',this.update,true).addEvent('fileRemove',function(file){this.fileList.erase(file);}.bind(this),true);this.setOptions(options);if(this.options.callBacks){Hash.each(this.options.callBacks,function(fn,name){this.addEvent(name,fn);},this);}
this.options.callBacks={fireCallback:this.fireCallback.bind(this)};var path=this.options.path;if(!path.contains('?'))path+='?noCache='+$time();this.options.container=this.box=new Element('span',{'class':'swiff-uploader-box'}).inject($(this.options.container)||document.body);this.target=$(this.options.target);if(this.target){var scroll=window.getScroll();this.box.setStyles({position:'absolute',visibility:'visible',zIndex:this.options.zIndex,overflow:'hidden',height:1,width:1,top:scroll.y,left:scroll.x});this.parent(path,{params:{wMode:'transparent'},height:'100%',width:'100%'});this.target.addEvent('mouseenter',this.reposition.bind(this,[]));this.addEvents({buttonEnter:this.targetRelay.bind(this,['mouseenter']),buttonLeave:this.targetRelay.bind(this,['mouseleave']),buttonDown:this.targetRelay.bind(this,['mousedown']),buttonDisable:this.targetRelay.bind(this,['disable'])});this.reposition();window.addEvent('resize',this.reposition.bind(this,[]));}else{this.parent(path);}
this.inject(this.box);this.fileList=[];this.size=this.uploading=this.bytesLoaded=this.percentLoaded=0;if(Browser.Plugins.Flash.version<9){this.fireEvent('fail',['flash']);}else{this.verifyLoad.delay(1000,this);}},verifyLoad:function(){if(this.loaded)return;if(!this.object.parentNode){this.fireEvent('fail',['disabled']);}else if(this.object.style.display=='none'){this.fireEvent('fail',['hidden']);}else if(!this.object.offsetWidth){this.fireEvent('fail',['empty']);}},fireCallback:function(name,args){if(name.substr(0,4)=='file'){if(args.length>1)this.update(args[1]);var data=args[0];var file=this.findFile(data.id);this.fireEvent(name,file||data,5);if(file){var fire=name.replace(/^file([A-Z])/,function($0,$1){return $1.toLowerCase();});file.update(data).fireEvent(fire,[data],10);}}else{this.fireEvent(name,args,5);}},update:function(data){$extend(this,data);this.fireEvent('queue',[this],10);return this;},findFile:function(id){for(var i=0;i<this.fileList.length;i++){if(this.fileList[i].id==id)return this.fileList[i];}
return null;},initializeSwiff:function(){this.remote('initialize',{width:this.options.width,height:this.options.height,typeFilter:this.options.typeFilter,multiple:this.options.multiple,queued:this.options.queued,url:this.options.url,method:this.options.method,data:this.options.data,mergeData:this.options.mergeData,fieldName:this.options.fieldName,verbose:this.options.verbose,fileSizeMin:this.options.fileSizeMin,fileSizeMax:this.options.fileSizeMax,allowDuplicates:this.options.allowDuplicates,timeLimit:this.options.timeLimit,buttonImage:this.options.buttonImage,policyFile:this.options.policyFile});this.loaded=true;this.appendCookieData();},targetRelay:function(name){if(this.target)this.target.fireEvent(name);},reposition:function(coords){coords=coords||(this.target&&this.target.offsetHeight)?this.target.getCoordinates(this.box.getOffsetParent()):{top:window.getScrollTop(),left:0,width:40,height:40}
this.box.setStyles(coords);this.fireEvent('reposition',[coords,this.box,this.target]);},setOptions:function(options){if(options){if(options.url)options.url=Swiff.Uploader.qualifyPath(options.url);if(options.buttonImage)options.buttonImage=Swiff.Uploader.qualifyPath(options.buttonImage);this.parent(options);if(this.loaded)this.remote('setOptions',options);}
return this;},setEnabled:function(status){this.remote('setEnabled',status);},start:function(){this.fireEvent('beforeStart');this.remote('start');},stop:function(){this.fireEvent('beforeStop');this.remote('stop');},remove:function(){this.fireEvent('beforeRemove');this.remote('remove');},fileStart:function(file){this.remote('fileStart',file.id);},fileStop:function(file){this.remote('fileStop',file.id);},fileRemove:function(file){this.remote('fileRemove',file.id);},fileRequeue:function(file){this.remote('fileRequeue',file.id);},appendCookieData:function(){var append=this.options.appendCookieData;if(!append)return;var hash={};document.cookie.split(/;\s*/).each(function(cookie){cookie=cookie.split('=');if(cookie.length==2){hash[decodeURIComponent(cookie[0])]=decodeURIComponent(cookie[1]);}});var data=this.options.data||{};if($type(append)=='string')data[append]=hash;else $extend(data,hash);this.setOptions({data:data});},processFiles:function(successraw,failraw,queue){var cls=this.options.fileClass||Swiff.Uploader.File;var fail=[],success=[];if(successraw){successraw.each(function(data){var ret=new cls(this,data);if(!ret.validate()){ret.remove.delay(10,ret);fail.push(ret);}else{this.size+=data.size;this.fileList.push(ret);success.push(ret);ret.render();}},this);this.fireEvent('selectSuccess',[success],10);}
if(failraw||fail.length){fail.extend((failraw)?failraw.map(function(data){return new cls(this,data);},this):[]).each(function(file){file.invalidate().render();});this.fireEvent('selectFail',[fail],10);}
this.update(queue);if(this.options.instantStart&&success.length)this.start();}});$extend(Swiff.Uploader,{STATUS_QUEUED:0,STATUS_RUNNING:1,STATUS_ERROR:2,STATUS_COMPLETE:3,STATUS_STOPPED:4,log:function(){if(window.console&&console.info)console.info.apply(console,arguments);},unitLabels:{b:[{min:1,unit:'B'},{min:1024,unit:'kB'},{min:1048576,unit:'MB'},{min:1073741824,unit:'GB'}],s:[{min:1,unit:'s'},{min:60,unit:'m'},{min:3600,unit:'h'},{min:86400,unit:'d'}]},formatUnit:function(base,type,join){var labels=Swiff.Uploader.unitLabels[(type=='bps')?'b':type];var append=(type=='bps')?'/s':'';var i,l=labels.length,value;if(base<1)return'0 '+labels[0].unit+append;if(type=='s'){var units=[];for(i=l-1;i>=0;i--){value=Math.floor(base/labels[i].min);if(value){units.push(value+' '+labels[i].unit);base-=value*labels[i].min;if(!base)break;}}
return(join===false)?units:units.join(join||', ');}
for(i=l-1;i>=0;i--){value=labels[i].min;if(base>=value)break;}
return(base/value).toFixed(1)+' '+labels[i].unit+append;}});Swiff.Uploader.qualifyPath=(function(){var anchor;return function(path){(anchor||(anchor=new Element('a'))).href=path;return anchor.href;};})();Swiff.Uploader.File=new Class({Implements:Events,initialize:function(base,data){this.base=base;this.update(data);},update:function(data){return $extend(this,data);},validate:function(){var options=this.base.options;if(options.fileListMax&&this.base.fileList.length>=options.fileListMax){this.validationError='fileListMax';return false;}
if(options.fileListSizeMax&&(this.base.size+this.size)>options.fileListSizeMax){this.validationError='fileListSizeMax';return false;}
return true;},invalidate:function(){this.invalid=true;this.base.fireEvent('fileInvalid',this,10);return this.fireEvent('invalid',this,10);},render:function(){return this;},setOptions:function(options){if(options){if(options.url)options.url=Swiff.Uploader.qualifyPath(options.url);this.base.remote('fileSetOptions',this.id,options);this.options=$merge(this.options,options);}
return this;},start:function(){this.base.fileStart(this);return this;},stop:function(){this.base.fileStop(this);return this;},remove:function(){this.base.fileRemove(this);return this;},requeue:function(){this.base.fileRequeue(this);}});;Fx.ProgressBar=new Class({Extends:Fx,options:{text:null,url:null,transition:Fx.Transitions.Circ.easeOut,fit:true,link:'cancel'},initialize:function(element,options){this.element=$(element);this.parent(options);var url=this.options.url;if(url){this.element.setStyles({'background-image':'url('+url+')','background-repeat':'no-repeat'});}
if(this.options.fit){url=url||this.element.getStyle('background-image').replace(/^url\(["']?|["']?\)$/g,'');if(url){var fill=new Image();fill.onload=function(){this.fill=fill.width;fill=fill.onload=null;this.set(this.now||0);}.bind(this);fill.src=url;if(!this.fill&&fill.width)fill.onload();}}else{this.set(0);}},start:function(to,total){return this.parent(this.now,(arguments.length==1)?to.limit(0,100):to/total*100);},set:function(to){this.now=to;var css=(this.fill)?(((this.fill/-2)+(to/100)*(this.element.width||1)||0).round()+'px'):((100-to)+'%');this.element.setStyle('backgroundPosition',css+' 0px').title=Math.round(to)+'%';var text=$(this.options.text);if(text)text.set('text',Math.round(to)+'%');return this;}});;var FancyUpload2=new Class({Extends:Swiff.Uploader,options:{queued:1,instantStart:1,limitSize:0,limitFiles:0,validateFile:$lambda(true)},initialize:function(status,list,options){this.status=$(status);this.list=$(list);options.fileClass=options.fileClass||FancyUpload2.File;options.fileSizeMax=options.limitSize||options.fileSizeMax;options.fileListMax=options.limitFiles||options.fileListMax;this.parent(options);this.addEvents({'load':this.render,'select':this.onSelect,'cancel':this.onCancel,'start':this.onStart,'queue':this.onQueue,'complete':this.onComplete});},render:function(){this.overallTitle=this.status.getElement('.overall-title');this.currentTitle=this.status.getElement('.current-title');this.currentText=this.status.getElement('.current-text');var progress=this.status.getElement('.overall-progress');this.overallProgress=new Fx.ProgressBar(progress,{text:new Element('span',{'class':'progress-text'}).inject(progress,'after')});progress=this.status.getElement('.current-progress')
this.currentProgress=new Fx.ProgressBar(progress,{text:new Element('span',{'class':'progress-text'}).inject(progress,'after')});this.updateOverall();},onSelect:function(){this.status.removeClass('status-browsing');},onCancel:function(){this.status.removeClass('file-browsing');},onStart:function(){this.status.addClass('file-uploading');this.overallProgress.set(0);},onQueue:function(){this.updateOverall();},onComplete:function(){this.status.removeClass('file-uploading');if(this.size){this.overallProgress.start(100);}else{this.overallProgress.set(0);this.currentProgress.set(0);}},updateOverall:function(){this.overallTitle.set('html',MooTools.lang.get('FancyUpload','progressOverall').substitute({total:Swiff.Uploader.formatUnit(this.size,'b')}));if(!this.size){this.currentTitle.set('html',MooTools.lang.get('FancyUpload','currentTitle'));this.currentText.set('html','');}},upload:function(){this.start();},removeFile:function(){return this.remove();}});FancyUpload2.File=new Class({Extends:Swiff.Uploader.File,render:function(){if(this.invalid){if(this.validationError){var msg=MooTools.lang.get('FancyUpload','validationErrors')[this.validationError]||this.validationError;this.validationErrorMessage=msg.substitute({name:this.name,size:Swiff.Uploader.formatUnit(this.size,'b'),fileSizeMin:Swiff.Uploader.formatUnit(this.base.options.fileSizeMin||0,'b'),fileSizeMax:Swiff.Uploader.formatUnit(this.base.options.fileSizeMax||0,'b'),fileListMax:this.base.options.fileListMax||0,fileListSizeMax:Swiff.Uploader.formatUnit(this.base.options.fileListSizeMax||0,'b')});}
this.remove();return;}
this.addEvents({'start':this.onStart,'progress':this.onProgress,'complete':this.onComplete,'error':this.onError,'remove':this.onRemove});this.info=new Element('span',{'class':'file-info'});this.element=new Element('li',{'class':'file'}).adopt(new Element('span',{'class':'file-size','html':Swiff.Uploader.formatUnit(this.size,'b')}),new Element('a',{'class':'file-remove',href:'#',html:MooTools.lang.get('FancyUpload','remove'),title:MooTools.lang.get('FancyUpload','removeTitle'),events:{click:function(){this.remove();return false;}.bind(this)}}),new Element('span',{'class':'file-name','html':MooTools.lang.get('FancyUpload','fileName').substitute(this)}),this.info).inject(this.base.list);},validate:function(){return(this.parent()&&this.base.options.validateFile(this));},onStart:function(){this.element.addClass('file-uploading');this.base.currentProgress.cancel().set(0);this.base.currentTitle.set('html',MooTools.lang.get('FancyUpload','currentFile').substitute(this));$('savemixtapebutton').disabled=1;},onProgress:function(){this.base.overallProgress.start(this.base.percentLoaded);this.base.currentText.set('html',MooTools.lang.get('FancyUpload','currentProgress').substitute({rate:(this.progress.rate)?Swiff.Uploader.formatUnit(this.progress.rate,'bps'):'- B',bytesLoaded:Swiff.Uploader.formatUnit(this.progress.bytesLoaded,'b'),timeRemaining:(this.progress.timeRemaining)?Swiff.Uploader.formatUnit(this.progress.timeRemaining,'s'):'-'}));this.base.currentProgress.start(this.progress.percentLoaded);},onComplete:function(){this.element.removeClass('file-uploading');this.base.currentText.set('html','Upload completed');this.base.currentProgress.start(100);if(this.response.error){var msg=MooTools.lang.get('FancyUpload','errors')[this.response.error]||'{error} #{code}';this.errorMessage=msg.substitute($extend({name:this.name,size:Swiff.Uploader.formatUnit(this.size,'b')},this.response));var args=[this,this.errorMessage,this.response];this.fireEvent('error',args).base.fireEvent('fileError',args);}else{this.base.fireEvent('fileSuccess',[this,this.response.text||'']);}
$('savemixtapebutton').disabled=0;},onError:function(){this.element.addClass('file-failed');var error=MooTools.lang.get('FancyUpload','fileError').substitute(this);this.info.set('html','<strong>'+error+':</strong> '+this.errorMessage);},onRemove:function(){this.element.getElements('a').setStyle('visibility','hidden');this.element.fade('out').retrieve('tween').chain(Element.destroy.bind(Element,this.element));}});(function(){var phrases={'progressOverall':'Overall Progress ({total})','currentTitle':'File Progress','currentFile':'Uploading "{name}"','currentProgress':'Upload: {bytesLoaded} with {rate}, {timeRemaining} remaining.','fileName':'{name}','remove':'Remove','removeTitle':'Click to remove this entry.','fileError':'Upload failed','validationErrors':{'duplicate':'File <em>{name}</em> is already added, duplicates are not allowed.','sizeLimitMin':'File <em>{name}</em> (<em>{size}</em>) is too small, the minimal file size is {fileSizeMin}.','sizeLimitMax':'File <em>{name}</em> (<em>{size}</em>) is too big, the maximal file size is <em>{fileSizeMax}</em>.','fileListMax':'File <em>{name}</em> could not be added, amount of <em>{fileListMax} files</em> exceeded.','fileListSizeMax':'File <em>{name}</em> (<em>{size}</em>) is too big, overall filesize of <em>{fileListSizeMax}</em> exceeded.'},'errors':{'httpStatus':'Server returned HTTP-Status <code>#{code}</code>','securityError':'Security error occured ({text})','ioError':'Error caused a send or load operation to fail ({text})'}};if(MooTools.lang){MooTools.lang.set('en-US','FancyUpload',phrases);}else{MooTools.lang={get:function(from,key){return phrases[key];}};}})();;window.addEvent('domready',function(){var savemixtapeform=document.getElementById('savemixtapeform');if(savemixtapeform){$('savemixtapeform').addEvent('submit',function(e){var songs=$('demo-list').getElements("li.file");if(!songs.length){alert("Please upload at least one song for your mixtape.");return false;}
if($('title').get('value').trim()==''){alert('Please enter a title for your mixtape.');$('title').focus();return false;}
if($('category').getElements(':selected').get('value')==0){alert('Please select a category for your mixtape.');$('category').focus();return false;}
$('form-demo').getElements('input').each(function(el){new Element('input',{'type':'hidden','name':$(el).get('name'),'value':$(el).get('value')}).injectInside($('hiddenelements'));});var saveIt=new Request.HTML({url:'/upload.php?act=savemixtape',update:$('results'),onSuccess:function(rtree,rels,rhtml,rjs){$$('#results').adopt(rhtml);var result=$$('#success').get('text');if(result=="1"){var albumid=$$("#albumid").get('text');$$("#leftcontent").set("html","<b>Your album has been successfully uploaded.</b><br/><br/>You may view it <a href='/viewtape.php?id="+albumid+"'>here</a>.");window.location="http://www.mixconnect.com/upload.php?act=upgrademixtape&id="+albumid;}else{var error=$$("#error").get('text');alert(error);}},onFailure:function(){alert('Failed upload.');}});saveIt.post($('savemixtapeform'));return false;});}});window.addEvent('domready',function(){var updatemixtapeform=document.getElementById('updatemixtapeform');if(updatemixtapeform){$('updatemixtapeform').addEvent('submit',function(e){var songs=$('demo-list').getElements("li.file");if(!songs.length){alert("Please upload at least one song for your mixtape.");return false;}
if($('title').get('value').trim()==''){alert('Please enter a title for your mixtape.');$('title').focus();return false;}
if($('category').getElements(':selected').get('value')==0){alert('Please select a category for your mixtape.');$('category').focus();return false;}
$('form-demo').getElements('input').each(function(el){new Element('input',{'type':'hidden','name':$(el).get('name'),'value':$(el).get('value')}).injectInside($('hiddenelements'));});var saveIt=new Request.HTML({url:'/upload.php?act=updatetape',update:$('results'),onSuccess:function(rtree,rels,rhtml,rjs){$$('#results').adopt(rhtml);var result=$$('#success').get('text');if(result=="1"){var albumid=$$("#albumid").get('text');$$("#leftcontent").set("html","<b>Your album has been successfully uploaded.</b><br/><br/>You may view it <a href='/viewtape.php?id="+albumid+"'>here</a>.");window.location="http://www.mixconnect.com/upload.php?act=upgrademixtape&id="+albumid;}else{var error=$$("#error").get('text');alert(error);}},onFailure:function(){alert('Failed upload.');}});saveIt.post($('updatemixtapeform'));return false;});}});window.addEvent('domready',function(){document.getElementById('query').focus();});window.addEvent('domready',function(){var comment=document.getElementById('comment');var submitButton=document.getElementById('postcomment');var subscribeLink=document.getElementById('subbutton');});function removeTrack(id){var deleteId=document.getElementById('delete_track_'+id);var markText=document.getElementById('mark_'+id);if(deleteId.value=="n"){deleteId.value="y";markText.innerHTML="Unmark for removal";}
else{deleteId.value="n";markText.innerHTML="Mark for removal";}}
function addComment(id){var comment=document.getElementById('comment');var commentBox=comment.value;var submitButton=document.getElementById('postcomment');if(commentBox==""){alert('You need to write a comment');}
else{var myRequest=new Request({method:'post',url:'viewer.php',onSuccess:function(responseText,responseXML){comment.disabled="disabled";submitButton.disabled="disabled";submitButton.value="Comment Posted.";},});myRequest.send('act=newcomment&comment='+commentBox+'&id='+id);}}
function showForm(){formDiv=document.getElementById('newcommentform');formLink=document.getElementById('showFormLink');if(formDiv.style.display=='none'){formDiv.style.display='block';formLink.innerHTML='Hide form';}
else{formDiv.style.display='none';formLink.innerHTML='Add a new comment';}}
function favorite(id){var favoriteButton=document.getElementById('favoriteButton');var myRequest=new Request({method:'post',url:'user.php?act=favorite',onSuccess:function(responseText,responseXML){},});myRequest.send('id='+id);}
function subscribe(id,type){var subscribeLink=document.getElementById('subbutton');var myRequest=new Request({method:'post',url:'user.php?act=subscribe',onSuccess:function(responseText,responseXML){if(type=='s'){subscribeLink.value="Subscribed!";subscribeLink.disabled=true;}
else if(type=="u"){subscribeLink.value="Unsubscribed!";subscribeLink.disabled=true;}},});myRequest.send('user_id='+id);}
window.addEvent('domready',function(){new Autocompleter.Request.JSON('query','complete.php',{'postVar':'query',minLength:3,maxChoices:10,cache:true,delay:300,width:400,autoSubmit:true,});});function PopupPic(sPicURL){window.open("http://www.mixconnect.com/popup.htm?"+sPicURL,"","resizable=1,HEIGHT=200,WIDTH=200");}
jQuery(document).ready(function(){jQuery('#spyContainer').spy({'limit':5,'fadeLast':3,'ajax':'/spy.php','fadeInSpeed':'slow','timeout':10000})});jQuery(document).ready(function(){jQuery(".playButton").click(function(){var playID=jQuery(this).attr("href").substr(1);if(jQuery("#"+playID).is(":visible")==true){jQuery(".collapse").empty().hide();}else{jQuery(".collapse").empty().hide();jQuery("#"+playID).html('<object width="570" height="210" title="sample"><param name="movie" value="/source/includes/swf/siteplayer.swf?mid='+playID+'"></param><embed src="/source/includes/swf/siteplayer_new.swf?mid='+playID+'" wmode="transparent" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="570" height="210"></embed></object>').show();}
return false;});jQuery(".favoriteButton").click(function(){var favID=jQuery(this).attr("href").substring(1);var favElm=jQuery(this);jQuery.post("user.php?act=favorite",{id:favID},function(data){if(favElm.hasClass("isfav")){favElm.html('<img src="css/images/addbw.png">');favElm.toggleClass("isfav");}else{favElm.html('<img src="css/images/add.png">');favElm.toggleClass("isfav");}});return false;});jQuery(".downloadButton").click(function(){var downloadID=jQuery(this).attr("href").substr(1);var thisElem=jQuery(this);thisElem.html('<img src="css/images/ajax-loader.gif">');thisElem.removeClass('downloadButton');jQuery.getJSON("downloadcheck.php?id="+downloadID,function(data){if(!data){thisElem.html('<img src="css/images/download.png"/>');thisElem.addClass('downloadButton');return false;}
if(data.download==='y'&&data.dlhash!=null){jQuery.post("createdownload.php?id="+downloadID,{dlhash:data.dlhash},function(data){thisElem.html('<img src="css/images/download.png"/>');thisElem.addClass('downloadButton');window.location='http://mixconnect.com/'+data;});}else{thisElem.html('<img src="css/images/download.png"/>');thisElem.addClass('downloadButton');var answer=confirm("*****************************************************\n\Sorry! \n\n\ Please wait "+data.timeLeft+" minutes to get this mixtape. \n\n\ ** OR ** \n\n\Upgrade to Premium\n\ get INSTANT ACCESS to unlimited downloads.\n\n*****************************************************")
if(answer){window.location="premium.php?act=premium";}}});return false;});function limitChars(textid,limit,infodiv)
{var text=jQuery('#'+textid).val();var textlength=text.length;if(textlength>limit)
{jQuery('#'+infodiv).val('0');jQuery('#'+textid).val(text.substr(0,limit));return false;}
else
{jQuery('#'+infodiv).val((limit-textlength));return true;}}
if(jQuery("#description").length!=0)
{jQuery('#description').keyup(function(){limitChars('description',175,'remLen');})}});;window.addEvent('domready',function(){var formdemo=document.getElementById('form-demo');if(formdemo){var up=new FancyUpload2($('demo-status'),$('demo-list'),{verbose:true,url:$('form-demo').action,path:'/source/includes/swf/Swiff.Uploader.swf',typeFilter:{'Audio (*.mp3)':'*.mp3'},target:'demo-browse',onLoad:function(){$('demo-status').removeClass('hide');$('demo-fallback').destroy();this.target.addEvents({click:function(){return false;},mouseenter:function(){this.addClass('hover');},mouseleave:function(){this.removeClass('hover');this.blur();},mousedown:function(){this.focus();}});$('demo-clear').addEvent('click',function(){up.remove();return false;});},onSelectFail:function(files){files.each(function(file){new Element('li',{'class':'validation-error',html:file.validationErrorMessage||file.validationError,title:MooTools.lang.get('FancyUpload','removeTitle'),events:{click:function(){this.destroy();}}}).inject(this.list,'top');},this);},onFileSuccess:function(file,response){var json=new Hash(JSON.decode(response,true)||{});if(json.get('status')=='1'){var artist=(json.get('artist')==null)?'':json.get('artist');var song=(json.get('song')==null)?'':json.get('song');var album=(json.get('album')==null)?'':json.get('album');var year=(json.get('year')==null)?'':json.get('year');var albumid=(json.get('albumid')==null)?'':json.get('albumid');var html="<table><tr>";html+="<tr><td>Song</td><td><input type='text' name='song[]' value=\""+song+"\" /></td>";html+="<td>Artist</td><td><input type='text' name='artist[]' value=\""+artist+"\" /></td>";html+="</tr></table>";html+="<input type='hidden' name='tmp_name[]' value=\""+json.get("tmp_name")+"\" />";html+="<input type='hidden' name='name[]' value=\""+json.get("name")+"\" />";if(albumid!=''){html+="<input type='hidden' name='albumid[]' value=\""+albumid+"\" />";}
file.info.set('html',html);}else{file.element.addClass('file-failed');file.info.set('html','<strong>An error occured:</strong> '+(json.get('error')?(json.get('error')+' #'+json.get('code')):response));}},onFail:function(error){switch(error){case'hidden':alert('To enable the embedded uploader, unblock it in your browser and refresh (see Adblock).');break;case'blocked':alert('To enable the embedded uploader, enable the blocked Flash movie (see Flashblock).');break;case'empty':alert('A required file was not found, please be patient and we fix this.');break;case'flash':alert('To enable the embedded uploader, install the latest Adobe Flash plugin.')}}});}});;window.addEvent('domready',function(){var select=document.getElementById('select-0');if(select){var link=$('select-0');var linkIdle=link.get('html');function linkUpdate(){if(!swf.uploading)return;var size=Swiff.Uploader.formatUnit(swf.size,'b');link.set('html','<span class="small">'+swf.percentLoaded+'% of '+size+'</span>');}
var swf=new Swiff.Uploader({path:'/source/includes/swf/Swiff.Uploader.swf',url:$('form-cover').action,verbose:true,queued:false,multiple:false,target:link,instantStart:true,typeFilter:{'Images (*.jpg, *.jpeg, *.gif, *.png)':'*.jpg; *.jpeg; *.gif; *.png'},fileSizeMax:10*1024*1024,onSelectSuccess:function(files){if(Browser.Platform.linux)window.alert('Warning: Due to a misbehaviour of Adobe Flash Player on Linux,\nthe browser will probably freeze during the upload process.\nSince you are prepared now, the upload will start right away ...');this.setEnabled(false);},onSelectFail:function(files){alert(files[0].name+' was not added!\nPlease select an image smaller than 2 Mb. (Error: #'+files[0].validationError+')');},appendCookieData:true,onQueue:linkUpdate,onFileComplete:function(file){if(file.response.error){link.set('html','Got no response..'+file.response.error);}else{var json=new Hash(JSON.decode(file.response.text,true));if(json.get('status')=='1'){link.set('html',json.get('name'));var img=$('show-cover');img.set("html",'<img class="album_cover" src="image.php/image.jpg?width=120&amp;height=120&amp;cropratio=1:1&amp;image=/data/tmp/'+json.get('name')+'"/>');$('coverfilename').set('value',json.get('tmp'));$('covername').set('value',json.get('name'));}else{link.set('html','ERROR: '+json.get('statis'));}}
this.setEnabled(true);},onComplete:function(){}});link.addEvents({click:function(){return false;},mouseenter:function(){this.addClass('hover');swf.reposition();},mouseleave:function(){this.removeClass('hover');this.blur();},mousedown:function(){this.focus();}});}});;var spyRunning=1;jQuery.fn.spy=function(settings){var spy=this;spy.epoch=new Date(1970,0,1);spy.last='';spy.parsing=0;spy.waitTimer=0;spy.json=null;if(!settings.ajax){alert("An AJAX/AJAH URL must be set for the spy to work.");return;}
spy.attachHolder=function(){if(o.method=='html')
jQuery('body').append('<div style="display: none!important;" id="_spyTmp"></div>');}
spy.isDupe=function(latest,last){if((last.constructor==Object)&&(o.method=='html'))
return(latest.html()==last.html());else if(last.constructor==String)
return(latest==last);else
return 0;}
spy.timestamp=function(){var now=new Date();return Math.floor((now-spy.epoch)/1000);}
spy.parse=function(e,r){spy.parsing=1;if(o.method=='html'){jQuery('div#_spyTmp').html(r);}else if(o.method=='json'){eval('spy.json = '+r);}
if((o.method=='json'&&spy.json.constructor==Array)||o.method=='html'){if(spy.parseItem(e)){spy.waitTimer=window.setInterval(function(){if(spyRunning){if(!spy.parseItem(e)){spy.parsing=0;clearInterval(spy.waitTimer);}}},o.pushTimeout);}else{spy.parsing=0;}}else if(o.method=='json'){eval('spy.json = '+r)
spy.addItem(e,spy.json);spy.parsing=0;}}
spy.parseItem=function(e){if(o.method=='html'){var i=jQuery('div#_spyTmp').find('div:first').remove();if(i.size()>0){i.hide();spy.addItem(e,i);}
return(jQuery('div#_spyTmp').find('div').size()!=0);}else{if(spy.json.length){var i=spy.json.shift();spy.addItem(e,i);}
return(spy.json.length!=0);}}
spy.addItem=function(e,i){if(!o.isDupe.call(this,i,spy.last)){spy.last=i;jQuery('#'+e.id+' > div:gt('+(o.limit-2)+')').remove();jQuery('#'+e.id+' > div:gt('+(o.limit-o.fadeLast-2)+')').fadeEachDown();o.push.call(e,i);jQuery('#'+e.id+' > div:first').fadeIn(o.fadeInSpeed);}}
spy.push=function(r){jQuery('#'+this.id).prepend(r);}
var o={limit:(settings.limit||10),fadeLast:(settings.fadeLast||5),ajax:settings.ajax,timeout:(settings.timeout||3000),pushTimeout:(settings.pushTimeout||settings.timeout||3000),method:(settings.method||'html').toLowerCase(),push:(settings.push||spy.push),fadeInSpeed:(settings.fadeInSpeed||'slow'),timestamp:(settings.timestamp||spy.timestamp),isDupe:(settings.isDupe||spy.isDupe)};spy.attachHolder();return this.each(function(){var e=this;var timestamp=o.timestamp.call();var lr='';spy.ajaxTimer=window.setInterval(function(){if(spyRunning&&(!spy.parsing)){jQuery.post(o.ajax,{'timestamp':timestamp},function(r){spy.parse(e,r);});timestamp=o.timestamp.call();}},o.timeout);});};jQuery.fn.fadeEachDown=function(){var s=this.size();return this.each(function(i){var o=1-(s==1?0.5:0.85/s*(i+1));var e=this.style;if(window.ActiveXObject)
e.filter="alpha(opacity="+o*100+")";e.opacity=o;});};function pauseSpy(){spyRunning=0;return false;}
function playSpy(){spyRunning=1;return false;}