if ( top != self )
{
	top.location = self.document.location;
}

function CheckAll()
{
	if ( document.sangeet.choice_box.value == "true" )
	{
		eval = false;
		document.sangeet.choice_box.value = "false";
	}
	else
	{
		eval = true;
		document.sangeet.choice_box.value = "true";
	}

	for ( var j = 0; j < document.sangeet.elements.length; j++ )
	{
		if ( document.sangeet.elements[j].name = 'music_list' )
		{
			document.sangeet.elements[j].checked = eval;
		}
	}
}

function play_song()
{
	var totalSongs = document.sangeet.music_list.length;

	var output = "";
	var totalChecked = 0;
	var parameters = "";

	for ( var i = 0; i < document.sangeet.elements.length; i++ )
	{
		if ( ( document.sangeet.elements[i].name = 'music_list' ) && ( document.sangeet.elements[i].checked ) )
		{
			if ( document.sangeet.elements[i].value != 'Play selected songs' && document.sangeet.elements[i].value != 'Reset' )
			{
				if ( document.sangeet.elements[i].value != 'true' )
				{
					totalChecked++;
					parameters += document.sangeet.elements[i].value + ",";
				}
			}		
		}
	}	

	var lastPos = parameters.lastIndexOf(",");
	var newParameters = parameters.substring( 0, lastPos );
	
	var hostName = window.location.host;
	var pathName = window.location.pathname;

	var playSongUrl = "http://www.sangeet-bhuvan.com/zActionCommands/ervoirmvosirvaklbvurm.php?music_list=" + newParameters;

	output += totalChecked + " Songs have been selected.\r\n\r\nParameter = " + newParameters + "\r\n\r\nNew URL : \r\n\r\n" + playSongUrl;

	if ( totalChecked == 0 )
	{
		alert("You didn't select any song.\r\n\r\nPlease select one or more songs\r\n\r\nbefore clicking the Play button.\r\n\r\n\t\t\t( SANGEET BHUVAN Webmaster )");
		return false;
	}
	else if ( totalChecked > 0 )
	{
		//alert(output);		
		//alert( "You have selected the following songs\r\n\r\n" + output  + "\r\n\r\nNo. of Songs selected " + totalChecked );

		popUpWindow = window.open(playSongUrl,'sangeet_bhuvan','directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=yes,left=0,top=0,width=800,height=320');
		popUpWindow.focus();

		return false;
	}
}



function openPlaySongWindow(url,wname)
{
	winWidth = 800;
	winHeight = 320;

	var win = window.open(url,wname,'directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=yes,width=' + winWidth + ',height='+ winHeight + ',left=0,top=0');		

	win.focus();	
}


function openMailSongWindow(url,wname )
{
	winWidth = screen.width * 0.8;
	availWidth = screen.availWidth;
	availHeight = screen.availHeight;

	winHeight = availHeight - ( availHeight * 0.088 );

	var win = window.open(url,wname,'directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=yes,width=' + winWidth + ',height='+ winHeight + ',left=0,top=0');		

	win.focus();	
}  

function openWin(url,wname )
{
	winWidth = screen.width;
	availWidth = screen.availWidth;
	availHeight = screen.availHeight;

	winHeight = availHeight - ( availHeight * 0.088 );

	var win = window.open(url,wname,'directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=yes,width=' + winWidth + ',height='+ winHeight + ',left=0,top=0');		

	win.focus();	
} 


function openGuestbookWin(url,wname )
{
	winWidth = screen.width;
	availWidth = screen.availWidth;
	availHeight = screen.availHeight;

	winHeight = availHeight - ( availHeight * 0.088 );

	var win = window.open(url,wname,'directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=yes,width=' + winWidth + ',height='+ winHeight + ',left=0,top=0');		

	win.focus();	
}