

function openWin(URLsrc)
{ 
    window.open(URLsrc,'help', 'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=350')
}

function SelectAll()
{
   docelements=document.playform.elements;
   for(i=0;i<docelements.length;i++)
   {
	if(docelements[i].name=="id")
	{
	  docelements[i].checked=true;
	}
   }
}

function PlaySelected(vIdx)
{
   var selected=false;
   docelements=document.playform.elements;
   for(i=0;i<docelements.length;i++)
   {
	if(docelements[i].name=="id")
	{
	   if(docelements[i].checked)
	   	selected=true;
	}
    }
    if(!selected)
    {
    	alert("    Please select at least one track to play    ");
    }
    else
    	PlayAll(vIdx);
}


function getSelectedSongs()
{

  if(document.fav.AddAlbum!=null && document.fav.AddAlbum[0].checked)
	  return true;

  http_path="";
  selected=false;
  docelements=document.playform.elements;
   for(i=0;i<docelements.length;i++)
   {
	if(docelements[i].name=="id")
	{
	   if(docelements[i].checked)
	   {
	   	http_path+=docelements[i].value+",";
		selected=true;
	   }
	}
    }
	if(!selected)
	{
		alert("No song/track selected.  \n\nAction cancelled.");
		return false;
	}
	document.fav.elements.id.value=http_path;
	if(selected)
		selected = confirm("Please confirm your action by clicking on the Yes/OK button.");
	return selected;
}



function PlayAll(vIdx)
{
  http_path = "player.php?vIdx="+vIdx+"&";
  docelements=document.playform.elements;
   for(i=0;i<docelements.length;i++)
   {
	if(docelements[i].name=="id")
	{
	   if(docelements[i].checked)
	   {
	   	http_path+="songid"+ i + "="+docelements[i].value+"&";
	   }
	}
    }
  window_width=600;
  widnow_height=320;
  var frmPlayer=null;
  window_Left=(screen.width)?(screen.width-window_width)/2:100;
  window_Top=(screen.height)?(screen.height-widnow_height)/2:100;
  //window_features='width='+window_width+',height='+widnow_height+',top='+window_Top+',left='+window_Left+',scrollbars=no,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
  window_features='width=500,height='+widnow_height+',top='+window_Top+',left='+window_Left+',scrollbars=no,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
  frmPlayer = window.open(http_path,"iAdvaita",window_features);
  frmPlayer.focus();
}

function playthissong(songid)
{
  http_path = "player.php?vIdx=1&";
 http_path+="songid0="+ songid;

 window_width=600;
  widnow_height=320;
  var frmPlayer=null;
  window_Left=(screen.width)?(screen.width-window_width)/2:100;
  window_Top=(screen.height)?(screen.height-widnow_height)/2:100;
  //window_features='width='+window_width+',height='+widnow_height+',top='+window_Top+',left='+window_Left+',scrollbars=no,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
  window_features='width=500,height='+widnow_height+',top='+window_Top+',left='+window_Left+',scrollbars=no,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
  frmPlayer = window.open(http_path,"iAdvaita",window_features);
  frmPlayer.focus();
}

function disableRightClick(btnClick)
{
	if (navigator.appName == "Netscape" && btnClick.which == 3) // check for netscape and right click
	{ 
		return false;
	}
	else if (navigator.appName =="Microsoft Internet Explorer" && event.button == 2) // for IE and Right Click
	{
	 	alert("Welcome to iAdvaita!");
		return false;
	}
}

function selectSong(id)
{
   docelements=document.playform.elements;
   for(i=0;i<docelements.length;i++)
   {
	if(docelements[i].value==id)
	{
	  docelements[i].checked=true;
	}
	else
	  docelements[i].checked=false;
   }
   PlayAll();
   return false;
}

