// JavaScript Document\

if (window != window.top){
  top.location.href = location.href;
}

	var popupURL = "";
	var cnt = 0;		//	change this counter after showing tracks
	var ch = 0;
	var elval = false;
	function reviewSelection() {
		ch = 0;
		for (var i=0;i<document.selectionForm.elements.length;i++)
			if (document.selectionForm.elements[i].checked) ch++;
		if (cnt==ch) {
			document.selectionForm.Selection.value = "true";
			document.selectionForm.selectbutton.value = "De-Select All";
		} else {
			document.selectionForm.Selection.value = "false";
			document.selectionForm.selectbutton.value = "Select All";
		}
	}
	function changeAll() {
		if (document.selectionForm.Selection.value == 'true') {
			elval = false;
			document.selectionForm.Selection.value = "false";
			document.selectionForm.selectbutton.value = "Select All";
		} else {
			elval = true;
			document.selectionForm.Selection.value = "true";
			document.selectionForm.selectbutton.value = "De-Select All";
		}
		for (var i=0;i<document.selectionForm.elements.length;i++)
			if (document.selectionForm.elements[i].name == 'song_id')
				document.selectionForm.elements[i].checked = elval;
	}
	function buildList() {
		var playList = "";
		for (var i=0;i<document.selectionForm.elements.length;i++)
			if (document.selectionForm.elements[i].name == 'song_id')
				if (document.selectionForm.elements[i].checked)
					playList += document.selectionForm.elements[i].value + ",";
					
		if (playList!="")
			loadPlayer(playList);
	
	}
	function loadPlayer(playList){
		popupURL="/real/shero_emt.php?song="+playList;
		ahang=window.open(popupURL,'afgPlayer','directories=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,copyhistory=no,status=no,width=580,height=450');
		ahang.resizeTo(600, 460); 
		ahang.moveTo(50, 50); 
	}


	function DostimBeshnaw(beshnawID) {
		popupURL = "/new/suggest.php?badost="+beshnawID;
		window.open(popupURL, 'ratesong','directories=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,copyhistory=no,status=yes,width=430,height=580');
	}
	function KhandanDaraja(darajaID) {
		popupURL = "/new/rate_page.php?daraja="+darajaID;
		window.open(popupURL, 'ratesong','directories=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,copyhistory=no,status=yes,width=520,height=280');
	}