var elapsed=0;var remain=0;var state=0;var timesw=0;var sb="";var oktosearch=1;var stype="0";var searched="000000000";var nr_search=0;function sendEvent(B,C,A){thisMovie(B).sendEvent(C,A)}function loadFile(A,B){thisMovie(A).loadFile(B)}function getLength(B){var A=thisMovie(B).getLength();alert("the length of the playlist is: "+A)}function addItem(B,C,A){thisMovie(B).addItem(C,A)}function removeItemp(B,A){thisMovie(B).removeItem(A)}function itemData(B,A){var C=thisMovie(B).itemData(A);return C}function thisMovie(A){if(navigator.appName.indexOf("Microsoft")!=-1){return window[A]}else{return document[A]}}function getUpdate(D,C,A,B){if(D=="time"){currentElapsed=C;currentRemaining=A}if(D=="state"){state=C}if(D=="time"){elapsed=C;remain=A}aall=elapsed+","+remain+","+state;return aall}function playpause(){sendEvent("mpl","playpause")}sections=["group1","group2","group3"];function createLineItemSortables(){for(var A=0;A<sections.length;A++){Sortable.create(sections[A],{tag:"div",dropOnEmpty:true,containment:sections,only:"lineitem",constraint:false})}}function destroyLineItemSortables(){for(var A=0;A<sections.length;A++){Sortable.destroy(sections[A])}}function img_sugg(A){new Ajax.Request("maggierss/all.php",{parameters:{id:A,ip:ip},onSuccess:function(C){var B=C.responseText||"no response text";allids=B.split("***");allhtml='<div style="display:none;padding:0px;margin:0px;" id="inside_imgg"><img src="http://i.ytimg.com/vi/'+allids[1]+'/default.jpg" height="84" width="112" onmouseout="UnTip();this.style.borderColor=\'rgb(51, 51, 51)\';"  onmouseover="Tip(\''+allids[0]+"',WIDTH, 150);this.style.borderColor='orange';\" style = 'border: 1px solid rgb(51, 51, 51)' onclick = \"loadplay('"+allids[1]+"','"+allids[0]+'\')"><br><br><img src="http://i.ytimg.com/vi/'+allids[3]+'/default.jpg" height="84" width="112" onmouseover="Tip(\''+allids[2]+"',WIDTH, 150);this.style.borderColor='orange';\" onmouseout=\"UnTip();this.style.borderColor='rgb(51, 51, 51)';\" style = 'border: 1px solid rgb(51, 51, 51)' onclick = \"loadplay('"+allids[3]+"','"+allids[2]+'\')"><br><br><img src="http://i.ytimg.com/vi/'+allids[5]+'/default.jpg" height="84" width="112" onmouseover="Tip(\''+allids[4]+"',WIDTH, 150);this.style.borderColor='orange';\" onmouseout=\"UnTip();this.style.borderColor='rgb(51, 51, 51)';\" style = 'border: 1px solid rgb(51, 51, 51)' onclick = \"loadplay('"+allids[5]+"','"+allids[4]+"')\"></div>";$("img_sugg").innerHTML=allhtml;Effect.Appear("inside_imgg",{duration:0.5,queue:"end"})},onFailure:function(){alert("Te rog incearca din nou!")}})}function img_ret(A){return'<img src="http://i.ytimg.com/vi/'+A+'/default.jpg" height="90" width="120">'}function createNewItem(F,A){if((A==""&&F=="group1")||(A==searched&&nr_search>1)){new Effect.Highlight("txt1");return null}if(A==searched){nr_search++}else{nr_search=0}if($("others").style.display!="none"){new Effect.SlideUp("others")}searched=A;$("cauta").src="imgs/asteptati.png";oktosearch=0;var C=document.getElementsByClassName("lineitem");var B=-1;for(var E=0;E<C.length;E++){var D=document.getElementById(C[E].id).id.valueOf();var G=D.split("_");if(parseInt(G[1])>B){B=parseInt(G[1])}}new Ajax.Request("last.php",{parameters:{what:A,nr:stype,ip:ip},onSuccess:function(J){var K=J.responseText||"no response text";out_array0=K.split("xxxx");out_array=out_array0[1].split("||");removeItem(F);removeItem("group2");var Q=document.getElementsByClassName("insec3");var I=Q.length;for(var L=0;L<out_array.length-1;L++){out2=out_array[L].split("**");var P=0;for(j=0;j<I;j++){if(document.getElementById(Q[j].id).id.valueOf()==out2[1]&&I>=1){P=1}}if(P==0){B++;par=B%2;var O="item_"+B;titlu=out2[0].unescapeHTML();titlu=titlu.unescapeHTML();idu2=out2[1]+"r";idu3=out2[1]+"r2";idu4=out2[1]+"r3";removew="removei('"+O+"')";jusst="justplay(this.id.valueOf());myEffect('"+out2[1]+"')";moveme="moveme2('"+O+"')";displayme="Tip(img_ret('"+out2[1]+"'))";var M=Builder.node("div",{id:O,className:"lineitem",style:"display:none;"},[Builder.node("div",{className:"insec3t",onmouseover:displayme,onmouseout:"UnTip()",onclick:"UnTip()",id:idu4},titlu),Builder.node("div",{className:"playes"},[Builder.node("img",{src:"imgs/play.gif",width:"20",height:"24",onclick:jusst,id:out2[1]},[]),Builder.node("img",{src:"imgs/close.gif",vspace:"0",width:"14",style:"cursor: pointer;cursor:hand;position:relative;top:-12px;right:-10px;",height:"10",onclick:removew,id:idu2},[]),Builder.node("img",{src:"imgs/plus2.gif",width:"9",height:"9",style:"cursor: pointer;cursor:hand;position:relative;bottom:-1px;right:1px;",onclick:moveme,id:idu3},[]),]),]);var N=$(F);var H=$("group2");if(titlu.length>2){if(par=="0"){N.appendChild(M)}else{H.appendChild(M)}}$(out2[1]).addClassName("insec3");if(timesw==0){aaaa=setTimeout("createsortable()",2100);timesw=1}Effect.Appear(M.id,{duration:0.1,queue:"end"})}}$("cauta").src="imgs/cauta.png";oktosearch=1},onFailure:function(){alert("Te rog incearca din nou!");$("cauta").src="imgs/cauta.png";oktosearch=1}})}function createsortable(){destroyLineItemSortables();createLineItemSortables();timesw=0}function creator(B,A){if(oktosearch==1){createNewItem("group1",$F("txt1"))}}function removeItem(A){$(A).innerHTML=""}function myEffect(C){if(C==null){return null}ids=$(C).ancestors();var A=document.getElementsByClassName("lineitem");for(var B=0;B<A.length;B++){document.getElementById(A[B].id).style.backgroundColor="#333333";document.getElementById(A[B].id).title=""}new Effect.Highlight(ids[1],{duration:0.3,queue:"end"});$(ids[1]).style.backgroundColor="#387329";$(ids[1]).title="Now"}function justplay(B){var A=$("group3").getElementsByClassName("insec3");ok=0;for(var C=0;C<A.length;C++){if(B==document.getElementById(A[C].id).id.valueOf()){ok=1}}if(ok==0){okk2=0;info=readCookie("info");if(info==null){nr=readCookie("nr");if(nr!=null){if(parseInt(nr)<60000){nr2=parseInt(nr)+1;eraseCookie("nr");createCookie("nr",nr2,1)}else{alert("Ai ascultat 10 melodii! \n Trebuie sa te inregistrezi gratuit pentru a asculta un numar nelimitat de melodii sau sa te loghezi daca te-ai inregistrat deja!");okk2=1}}else{createCookie("nr","1",1)}}if(okk2==0){youtube="http://www.youtube.com/watch?v="+B;pune_t=1;loadFile("mpl",{file:youtube});playpause();img_sugg(B)}}if(ok==1){player(B)}}function player(B){var D=new Array();var A=$("group3").getElementsByClassName("insec3");var E=A.length;for(var C=0;C<A.length;C++){ances=document.getElementById(A[C].id).ancestors();D[C]=C+"."+document.getElementById(A[C].id).id.valueOf();if(B==document.getElementById(A[C].id).id.valueOf()&&(ances[2].readAttribute("id")!="group1"&&ances[2].readAttribute("id")!="group2")){start=C+1}}youtube="http://www.youtube.com/watch?v=";for(C=0;C<E;C++){allmel=D[C].split(".");if(C+1==start){youtube=youtube+allmel[1];pune_t=1;loadFile("mpl",{file:youtube});playpause();img_sugg(allmel[1])}}}function removei(A){$(A).remove()}function moveme2(A){if($(A).ancestors()[0].readAttribute("id")!="group3"){$("group3").insert($(A))}}function nexter(){updates=getUpdate().split(",");isPlaying=updates[2];if(isPlaying=="2"||isPlaying=="1"){itemdata=itemData("mpl",0)}if((isPlaying=="2"||isPlaying=="1")&&parseInt(updates[0])==1&&itemdata.file!="2.flv"){idm=itemdata.file.split("?v=");idl=idm[1];r_id=idl.split("&");idl=r_id[0];$("sendym").value="http://fermademuzica.ro/index.php?play="+idl;$("adrym").href="ymsgr:im?+&msg=Ce%20melodie%20super%20%3AD%20http://fermademuzica.ro/index.php?play="+idl+"%20%20";trb=window.location.search.split("=");if(trb[1]!=idl&&pune_t==1){title=$(idl).ancestors()[1].firstDescendant().innerHTML;document.title=title}}itemdata=itemData("mpl",0);if((parseInt(updates[0])==30||parseInt(updates[0])==60||parseInt(updates[0])==90)&&itemdata.file!="2.flv"){okk2=0;info=readCookie("info");if(info==null){nr=readCookie("nr");if(nr!=null){if(parseInt(nr)>60000){alert("Ai ascultat 10 melodii! \n Trebui sa te inregistrezi gratuit pentru a asculta un numar nelimitat de melodii sau sa te loghezi daca te-ai inregistrat deja! \n");okk2=1;sendEvent("mpl","stop")}}}}if(updates[1]=="1"){okk2=0;info=readCookie("info");if(info==null){nr=readCookie("nr");if(nr!=null){if(parseInt(nr)<60000){nr2=parseInt(nr)+1;eraseCookie("nr");createCookie("nr",nr2,1)}else{alert("Ai ascultat 10 melodii! \n Trebui sa te inregistrezi gratuit pentru a asculta un numar nelimitat de melodii sau sa te loghezi daca te-ai inregistrat deja!");okk2=1}}else{createCookie("nr","1",1)}}if(okk2==0){var B=new Array();itemdata=itemData("mpl",0);idm=itemdata.file.split("?v=");id=idm[1];r_id=id.split("&");id=r_id[0];if(itemdata.file!="2.flv"){var A=$(id).ancestors()[2].getElementsByClassName("insec3")}else{return null}var C=A.length;start=-2;for(i=0;i<C;i++){B[i]=document.getElementById(A[i].id).id.valueOf();if(id==document.getElementById(A[i].id).id.valueOf()){start=i}}if(start+1==C){start=-1}miuu=B[start+1];youtuube="http://www.youtube.com/watch?v="+miuu;pune_t=1;loadFile("mpl",{file:youtuube});playpause();myEffect(miuu);img_sugg(miuu)}}}function startLoading(){loaded=false;showLoadingImage()}function showLoadingImage(){if(!loaded){new Effect.Appear("ajaxim",{duration:0.2})}}function stopLoading(){new Effect.Fade("ajaxim",{duration:0.2});loaded=true}function createCookie(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+escape(D)+A+"; path=/"}function readCookie(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return unescape(E.substring(D.length,E.length))}}return null}function eraseCookie(A){createCookie(A,"",-1)}function savepl(){new Effect.Highlight("savebt",{duration:0.4,queue:{position:"front",scope:"save",limit:2}});var D=$("group3").getElementsByClassName("insec3");var A=$("group3").getElementsByClassName("insec3t");var C=D.length;if(C!=0){infp=readCookie("info");p2=readCookie("p2");both="";for(var B=0;B<C;B++){both=both+A[B].innerHTML+"**"+D[B].readAttribute("id")+"yyy"}if(infp!=null&&p2!=null){p2=readCookie("p2").unescapeHTML();new Ajax.Request("playlist.php",{parameters:{pls:both,w:"1",infp:infp,p2:p2},onSuccess:function(F){var E=F.responseText||"no response text";if(E!="ok"){alert("Nu s-a salvat playlist-ul tau!")}},onFailure:function(){alert("Te rog incearca din nou!")}})}else{createCookie("default",both,300)}}}function loadpl(){var D="";var B=readCookie("info");var C=readCookie("p2");var A=0;if(B!=null&&C!=null){C=readCookie("p2").unescapeHTML();new Ajax.Request("playlist.php",{parameters:{w:"0",infp:B,p2:C},onSuccess:function(G){var E=G.responseText||"no response text";var F=E.split("|||");if(F[0]=="ok"){D=F[1];A=1;lloader(D)}else{D=readCookie("default");lloader(D)}},onFailure:function(){alert("Te rog incearca din nou!")}})}else{if(A!=1){D=readCookie("default");lloader(D)}}}function lloader(D){if(D!=null){new Effect.Highlight("loadbt",{duration:0.2,queue:"front"});var B=D.split("yyy");var H=document.getElementsByClassName("lineitem");var L=-1;for(var C=0;C<H.length;C++){var F=document.getElementById(H[C].id).id.valueOf();var M=F.split("_");if(parseInt(M[1])>L){L=parseInt(M[1])}}removeItem("group3");for(var C=0;C<B.length-1;C++){out2=B[C].split("**");var K=document.getElementsByClassName("insec3");var A=K.length;var J=0;for(j=0;j<A;j++){if(document.getElementById(K[j].id).id.valueOf()==out2[1]&&A>=1){J=1;curr=document.getElementById(K[j].id).ancestors();$(curr[1]).remove()}}L++;if(C==0){primu=out2[1]}var I="item_"+L;titlu=out2[0].unescapeHTML();titlu=titlu.unescapeHTML();idu2=out2[1]+"r";idu3=out2[1]+"rr";idu4=out2[1]+"rrr";removew="removei('"+I+"')";jusst="justplay(this.id.valueOf());myEffect('"+out2[1]+"')";moveme="moveme2('"+I+"')";displayme="Tip(img_ret('"+out2[1]+"'))";var E=Builder.node("div",{id:I,className:"lineitem",style:"display:none;"},[Builder.node("div",{className:"insec3t",onmouseover:displayme,onmouseout:"UnTip()",onclick:"UnTip()",id:idu4},titlu),Builder.node("div",{className:"playes"},[Builder.node("img",{src:"imgs/play.gif",width:"20",height:"24",onclick:jusst,id:out2[1]},[]),Builder.node("img",{src:"imgs/close.gif",vspace:"0",width:"14",style:"cursor: pointer;cursor:hand;position:relative;top:-12px;right:-10px;",height:"10",onclick:removew,id:idu2},[]),Builder.node("img",{src:"imgs/plus2.gif",width:"9",height:"9",style:"cursor: pointer;cursor:hand;position:relative;bottom:-1px;right:1px;",onclick:moveme,id:idu3},[]),]),]);var G=$("group3");G.appendChild(E);$(out2[1]).addClassName("insec3");Effect.Appear(E.id,{duration:0.1,queue:"end"})}destroyLineItemSortables();createLineItemSortables()}}function cleanup(){removeItem("group3");new Effect.Highlight("erasebt")}function mm(A){new Effect.BlindDown("others");return false}function ghid(){var A=document.getElementsByClassName("lineitem");for(var B=0;B<A.length;B++){document.getElementById(A[B].id).style.backgroundColor="#333333";document.getElementById(A[B].id).title=""}loadFile("mpl",{file:"2.flv"});playpause()}function loadplay(A,B){pune_t=0;document.title=B;playpause();youtuube="http://www.youtube.com/watch?v="+A;loadFile("mpl",{file:youtuube});playpause()}function sender(){if($("username").value==""){$("username").focus();$("username").style.backgroundColor="#ff6666";return null}if($("pass").value==""){$("pass").focus();$("pass").style.backgroundColor="#ff6666";return null}remember1=0;if($("remember").checked==true){remember1=1}new Ajax.Request("login.php",{parameters:{user:$("username").value,parola:$("pass").value,send_im:"send_im"},onSuccess:function(D){var B=D.responseText;allhtml=B.split("**");if(allhtml[0]=="1"){if(remember1==1){createCookie("info",allhtml[1],300);createCookie("p2",allhtml[2],40)}else{createCookie("info",allhtml[1],1);createCookie("p2",allhtml[2],1)}$("loged").innerHTML="Salut "+allhtml[1]+" |";$("logger").innerHTML="<a title='Iesi din contul tau.' href='#' onClick='logout()' style='cursor: pointer;'>LogOut</a>";$("wrong").style.color="#48b320";$("wrong").innerHTML="Te-ai logat cu succes!";new Effect.BlindDown("wrong",{duration:0.4,queue:"front"});var A=setTimeout("cooleffect()",1000);var C=setTimeout("loadpl()",1300)}else{$("wrong").style.color="#FF6666";$("wrong").innerHTML="ID sau parola  incorecte!";new Effect.BlindDown("wrong",{duration:0.4,queue:"end"})}},onFailure:function(){alert("Te rog incearca din nou!")}})}function cooleffect(){Effect.multiple(["logdiv","wrong"],Effect.BlindUp,{delay:0.4,duration:0.4})}function logout(){eraseCookie("info");eraseCookie("p2");eraseCookie("nr");$("loged").innerHTML="Nu esti logat! | ";$("logger").innerHTML="<a style='cursor: pointer;' title='Intra in contul tau.' onClick=\"$('username').focus()\";>Login</a>";new Effect.BlindDown("logdiv",{delay:0.6,duration:0.4,queue:"end"})}function loglogin(){$("loged").innerHTML="Salut "+readCookie("info")+" |";$("logger").innerHTML="<a title='Iesi din contul tau.' href='#' onClick='logout()' style='cursor: pointer;'>LogOut</a>";cooleffect()}function Ctip(A){stype=A;what2="sel"+A;$(what2).addClassName("minitab-s");$(what2).siblings().each(function(B){$(B).removeClassName("minitab-s");$(B).addClassName("minitab")})}Ajax.Responders.register({onCreate:function(){startLoading()},onComplete:function(){stopLoading()}});function rtype(B,A){A=A+"&t="+stype;return A}function pef(A){justplay(A);myEffect(A)};