function menucolor(atype){var defaultClass="tdborder";var defaultClasa="boxtitles";var fontClassOn='srchFontOn';var arrType=new Array();arrType["aaname"]=new Object();arrType["aaname"].linkId="artistLink";arrType["aaname"].fontId="artistFont";arrType["aaname"].onClass="srchArtistOn";arrType["aaname"].backgroundColor="#FDE8D3";arrType["atname"]=new Object();arrType["atname"].linkId="albumLink";arrType["atname"].fontId="albumFont";arrType["atname"].onClass="srchAlbumOn";arrType["atname"].backgroundColor="#EDFCD1";arrType["asname"]=new Object();arrType["asname"].linkId="songLink";arrType["asname"].fontId="songFont";arrType["asname"].onClass="srchsongOn";arrType["asname"].backgroundColor="#E1D9EE";arrType["anamev"]=new Object();arrType["anamev"].linkId="videoLink";arrType["anamev"].fontId="videoFont";arrType["anamev"].onClass="srchVideoOn";arrType["anamev"].backgroundColor="#FCEAB8";document.getElementById(arrType["asname"].linkId).className=defaultClass;document.getElementById(arrType["atname"].linkId).className=defaultClass;document.getElementById(arrType["anamev"].linkId).className=defaultClass;document.getElementById(arrType["aaname"].linkId).className=defaultClass;document.getElementById(arrType["asname"].fontId).className=defaultClasa;document.getElementById(arrType["atname"].fontId).className=defaultClasa;document.getElementById(arrType["anamev"].fontId).className=defaultClasa;document.getElementById(arrType["aaname"].fontId).className=defaultClasa;document.getElementById(arrType[atype].linkId).className=arrType[atype].onClass;document.getElementById(arrType[atype].fontId).className=fontClassOn;document.getElementById('srchRowBg').style.backgroundColor=arrType[atype].backgroundColor;document.getElementById('search-results').style.backgroundColor=arrType[atype].backgroundColor;document.getElementById('srchType').value=atype;gsc_emptyresults(document.getElementById('search-results'));__gsctimer.start();document.getElementById('fq').focus();}var topMenuSpacer=5;var activateSubOnClick=true;var leftAlignSubItems=false;var activeMenuItem=false;var activeTabIndex=-1;function showHide(){if(activeMenuItem){activeMenuItem.className='inactiveMenuItem';var theId=activeMenuItem.id.replace(/[^\d]/g,'');document.getElementById('submenu_'+theId).style.display='none';}activeMenuItem=this;this.className='activeMenuItem';var theId=this.id.replace(/[^\d]/g,'');document.getElementById('submenu_'+theId).style.display='block';}function initMenu(){var mainMenuObj=document.getElementById('mainMenu');var subMenuObj=document.getElementById('submenu');mainMenuObj.style.visibility=subMenuObj.style.visibility="visible";var menuItems=mainMenuObj.getElementsByTagName('A');if(document.all){mainMenuObj.style.visibility='hidden';document.getElementById('submenu').style.visibility='hidden';}var currentLeftPos=30;for(var no=0;no<menuItems.length;no++){menuItems[no].onclick=showHide;currentLeftPos=currentLeftPos+menuItems[no].offsetWidth+topMenuSpacer;if(no==activeTabIndex){menuItems[no].className='activeMenuItem';activeMenuItem=menuItems[no];}else menuItems[no].className='inactiveMenuItem';if(!document.all)menuItems[no].style.bottom='-1px';}var mainMenuLinks=mainMenuObj.getElementsByTagName('A');var subCounter=1;var parentWidth=mainMenuObj.offsetWidth;while(document.getElementById('submenu_'+subCounter)){var subItem=document.getElementById('submenu_'+subCounter);if(!leftAlignSubItems){var leftPos=mainMenuLinks[subCounter-1].offsetLeft;document.getElementById('submenu_'+subCounter).style.paddingLeft=leftPos+'px';subItem.style.position='relative';leftPos+=30;subItem.style.paddingLeft=leftPos+'px';subItem.style.position='static';}if(subCounter==(activeTabIndex+1)){subItem.style.display='block';}else{subItem.style.display='none';}subCounter++;}if(document.all){mainMenuObj.style.visibility='visible';document.getElementById('submenu').style.visibility='visible';}document.getElementById('submenu').style.display='block';mainMenuObj.dir='rtl';}var popupWin=null;function openPopup(extra){var url="player/player_ar.php?"+extra;if(!popupWin||popupWin.closed){if(ie){popupWin=window.open(url,'AlBawabaNetCast','width=340,height=700');}else{popupWin=window.open(url,'AlBawabaNetCast','width=340,height=555');}}else{popupWin.focus();}}function playSongFromSite(sid,type){if(!popupWin||popupWin.closed){openPopup('action=playSongFromSite&sid='+sid+'&type='+type);}else{popupWin.playSongFromParent(sid,type);}}function getPlaylists(sid,type){if(popup_table){popup_table='';}document.getElementById("note").innerHTML='<div id="loading"></div>';var xmlhttp=createRequestObject();xmlhttp.open("GET","../services/popup/getplaylist.php",true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status!=404){var local=new Object();local=new Function("return "+xmlhttp.responseText)();if(local!=0){if(local['code']!='100'){var i=0;while(i<local.length){printOut(local[i]['playlist_name'],local[i]['playlist_id'],sid,i+1,type);i++;}}else{printLogout();}}else{document.getElementById("note").innerHTML='<span class= \"userinfo \" >لم تقم بأضافة اي قوائم أغاني, لاضافة قائمة جديدة <a href="playlist_manager.php" > اضغط هنا</a> </span>';}}else{alert("Error, please try again");}}};xmlhttp.send(null);}function addToPlaylist(pl,sid,type){var xmlhttp=createRequestObject();language='ar';var path="../services/popup/addToPlaylist.php?pl="+pl+"&sid="+sid+"&type="+type+"&language="+language;xmlhttp.open("GET",path,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status!=404){var local=new Object();returnMsg=new Function("return "+xmlhttp.responseText)();document.getElementById("note").innerHTML='<span class="userinfo">'+returnMsg['message']+'</span>';InitializeTimer();}else{alert("Error,please try again");}}};xmlhttp.send(null);}function createRequestObject(){var req;if(window.XMLHttpRequest){req=new XMLHttpRequest();}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");}else{alert('Problem creating the XMLHttpRequest object, You need to update your browser');}return req;}var popup_table='';function printOut(name,id,sid,i,type){var oDiv=document.getElementById("note");name=(name.length>6)?name.substr(0,6)+'...':name;var open_table='<table id="pl_table" width="100%" height="100%" border="0" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="e4e4e4"><tr>';var close_table='</tr></table>';var content="<a title=\"Add song to this playlist\" href=\"javascript:void(0);\" onClick=\"addToPlaylist("+id+","+sid+",'"+type+"');refreshPlayer("+id+");\" class=\"playlistname\">&nbsp;"+name+"</a>"+"</span>";counter=i;i++;if(!(i%2)){popup_table+="<td width=\"50%\" onMouseOver=\"rowcolor(this, '#CCCCCC')\" onMouseOut=\"rowcolor(this, '')\" style=\"color:#000000; font-size:11px;font-weight:bold\">"+counter+". "+content+"</td>";}else{popup_table+="<td width=\"50%\" onMouseOver=\"rowcolor(this, '#CCCCCC')\" onMouseOut=\"rowcolor(this, '')\" style=\"color:#000000; font-size:11px;font-weight:bold\">"+counter+". "+content+"</td></tr><tr>";}oDiv.innerHTML=open_table+popup_table+close_table;}function printLogout(){var oDiv=document.getElementById("note");loginUrl="/ar/signin.php?return_url="+encodeURIComponent(location.href);oDiv.innerHTML="<span class=\"userinfo\">عذراً، يجب ان تدخل الى حسابك كي تستخدم هذه الخدمة.اذا كنت مستخدم جديد <a href=\"register.php\" >.اضغط هنا</a> للتسجيل <a href=\""+loginUrl+"\" >.اضغط هنا</a> للدخول</span>";}var ie=false;var lastNote='';if(document.all){ie=true;}function showNote(name,sid,event,type){var object=document.getElementById(name);object.style.display='';if(0!=object.style.opacity){changeOpac(0,name);}getPlaylists(sid,type);setPosition(event);opacity(name,0,100,500);}function hideNote(name){var object=document.getElementById(name).style;opacity(name,100,0,500);object.display='none';}function setPosition(event){x=event.clientX+document.body.scrollLeft;y=event.clientY+document.body.scrollTop;notAllowedXPosition=(event.clientX+250);notAllowedYPosition=window.screen.height-(event.clientY+370);if(notAllowedXPosition<=790){document.getElementById('add_song_playlist').style.left=x+'px';}else{document.getElementById('add_song_playlist').style.left=x-205+'px';}if(notAllowedYPosition>0){document.getElementById('add_song_playlist').style.top=y+'px';}else{document.getElementById('add_song_playlist').style.top=y-110+'px';}}function opacity(id,opacStart,opacEnd,millisec){var speed=Math.round(millisec/100);var timer=0;if(opacStart>opacEnd){for(i=opacStart;i>=opacEnd;i--){setTimeout("changeOpac("+i+",'"+id+"')",(timer*speed));timer++;}}else if(opacStart<opacEnd){for(i=opacStart;i<=opacEnd;i++){setTimeout("changeOpac("+i+",'"+id+"')",(timer*speed));timer++;}}}function rowcolor(obj,rowcolor){obj.style.backgroundColor=rowcolor;}function changeOpac(opacity,id){var object=document.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";}function shiftOpacity(id,millisec){if(document.getElementById(id).style.opacity==0){opacity(id,0,100,millisec);}else{opacity(id,100,0,millisec);}}var secs;var timerID=null;var timerRunning=false;var delay=1000;function InitializeTimer(){secs=1;StopTheClock();StartTheTimer();}function StopTheClock(){if(timerRunning){clearTimeout(timerID)}timerRunning=false;}function StartTheTimer(){if(secs==0){StopTheClock();if(document.getElementById('add_song_playlist').style.opacity!=0){hideNote('add_song_playlist');}}else{secs=secs-1;timerRunning=true;timerID=self.setTimeout("StartTheTimer()",delay);}}function escCheck(e){var KeyID=(window.event)?event.keyCode:e.keyCode;if(KeyID==27){if(document.getElementById('add_song_playlist').style.opacity!=0){hideNote('add_song_playlist');}window.setTimeout('document.getElementById(\'add_song_playlist\').style.top = \'-200px\';document.getElementById(\'add_song_playlist\').style.left = \'-200px\';',550);}}function as_hide_escKey(e){var KeyID=(window.event)?event.keyCode:e.keyCode;if(KeyID==27){if(document.getElementById('search-results').style.display=='block')document.getElementById('search-results').style.display='none';}}function as_hide_onmousedown(e){var KeyID=(window.event)?event.keyCode:e.keyCode;if(document.getElementById('search-results').style.display=='block')document.getElementById('search-results').style.display='none';}function addPlaylistDiv(){var ni=document.getElementById('body_tag');var content='<div style="border-width:2px; border-color:#999999;border-style:solid;width:auto;"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td height="35" align="center" class="myplaylists"><img src="../images/pl.gif"  hspace="4" align="absmiddle" />قوائمي</td></tr><tr><td><div id="note" style="padding:2px;" ></div></td></tr><tr bgcolor="#BABABA"><td height="10" align="right"><img src="../images/close-1.gif"  border="0" align="middle" onClick="hideNote(\'add_song_playlist\');" onMouseOver="javascript: this.src=\'../images/close-2.gif\';" onMouseOut="javascript: this.src=\'../images/close-1.gif\';"></td></tr></table></div>';var newdiv=document.createElement('div');newdiv.setAttribute("id","add_song_playlist");var browserName=navigator.appName;if("Netscape"==browserName){newdiv.setAttribute("class","notebody");}else{if(browserName=="Microsoft Internet Explorer")newdiv.setAttribute("className","notebody");}newdiv.innerHTML=content;ni.appendChild(newdiv);document.onkeyup=escCheck;}function refreshPlayer(plsid){if(popupWin&&!popupWin.closed){popupWin.addSong(plsid);}}function changeItemStyle(me,bgColor,fgColor,level){if(bgColor)me.style.backgroundColor=bgColor;if(fgColor)me.style.color=fgColor;}function openWin(url,name,param){newWin=window.open(url,name,param);}function MM_openBrWindow(theURL,winName,features){window.open(theURL,winName,features);}
