function Validate()
{

var field,sCame;
sCame=false;
field=document.myform['list[]'];
if(document.myform.hdtxtCheckcount.value == 1)
{
   if(field.checked == false)
    {
			sCame=false;
	}
	else
	{
			sCame=true;
	}
}
else
{
for (i = 0; i < field.length; i++)
	{  
		if( field[i].checked == true )
		{
			sCame=true;
			break;
		}
	 }	
}	 	 
	 if(sCame == false)
	 {
	 	alert("Please Select Atleast One Song To Play");
		return false;
	 }
	 else
	 {
		window.open('jukepl.asp','Sanchika','scrollbars=no,toolbar=no,location=no,status=no,resizable=no,width=468,height=450,left=372,top=284');	 
	 }

}

function songcheckAll(field)
{

	if(document.myform.hdtxtCheckcount.value == 1)
	{
	field.checked=true;
	}
	else
	{
	for (i = 0; i < field.length; i++)
		field[i].checked = true ;
	}	
}

function songuncheckAll(field)
{

if(document.myform.hdtxtCheckcount.value == 1)
{
field.checked=false;
}
else
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}	
}


function mailopen(value)
{
var l=300;
var t=170;
window.open("mailsong.asp?cid="+value,"postsong","left="+l+",top="+t+",toolbar=no,width=500,height=550, resizable=yes,scrollbars=No")
}


function lyricsopen(value)
{
var l=300;
var t=170;
window.open("songlyrics.asp?cid="+value,"postsong","left="+l+",top="+t+",toolbar=no,width=540,height=550, resizable=yes,scrollbars=yes")
}


function Rateopen(value)
{
var l=300;
var t=170;
window.open("rating.asp?cid="+value,"rating","left="+l+",top="+t+",toolbar=no,width=485,height=450, resizable=yes,scrollbars=No")
}

function Listopen(value)
{
var l=300;
var t=170;
window.open("userplaylist.asp?cid="+value,"playlist","left="+l+",top="+t+",toolbar=no,width=485,height=400, resizable=yes,scrollbars=No")
}


function Postsongvalidate()
{
 var sYourName=document.frmsong.txtYourName.value;
 var sYourEmail=document.frmsong.txtYourEmail.value;
 var sRecpName=document.frmsong.txtRecpName.value;
 var sRecpEmail=document.frmsong.txtRecpEmail.value;  
 var regex = /^[a-zA-Z0-9_.]+@([a-zA-Z0-9_.]+\.)+[a-zA-Z0-9.-]{2,3}$/;	 	
  match1 = regex.test(sYourEmail);
  match2 = regex.test(sRecpEmail);
  if(sYourName == "")
  {
    alert("Please Provide Your Name");
	document.frmsong.txtYourName.focus();
	return false;
  }
 
 if(sYourEmail == "")
  {
    alert("Please Provide Your Email id");
	document.frmsong.txtYourEmail.focus();
	return false;
  }
      if(! match1)
	   {
		 alert("Invalid email, please provide your valid email");
		 document.frmsong.txtYourEmail.focus();
		 return false;   
	   }
   
   if(sRecpName == "")
  {
    alert("Please Provide Recepent Name");
	document.frmsong.txtRecpName.focus();
	return false;
  }
  if(sRecpEmail == "")
  {
    alert("Please Provide Recepent Email id");	
	document.frmsong.txtRecpEmail.focus();
	return false;
  }
       if(! match2)
	   {
		 alert("Invalid email, please provide recepent valid email");
		 document.frmsong.txtRecpEmail.focus();
		 return false;   
	   }
   
return true;
}

function songscheckAll(field)
{
if(document.frmAddplaylist.hdtxtCheckcount.value == 1)
{
field.checked=true;
}
else
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}	
}

function songsuncheckAll(field)
{
if(document.frmAddplaylist.hdtxtCheckcount.value == 1)
{
field.checked=false;
}
else
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}	
}

function songsAddtolist()
{

var field,sCame;
sCame=false;
field=document.myform['list[]'];
if(document.myform.hdtxtCheckcount.value == 1)
{
   if(field.checked == false)
    {
			sCame=false;
	}
	else
	{
			sCame=true;
	}
}
else
{
for (i = 0; i < field.length; i++)
	{  
		if( field[i].checked == true )
		{
			sCame=true;
			break;
		}
	 }	
}	 	 
	 if(sCame == false)
	 {
	 	alert("Please Select Atleast One Song To Play");
		return false;
	 }
	 return true;
}






function homecheckAll(field)
{
for(i = 0; i < field.length; i++)
	field[i].checked = true ;

}
function homeuncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
function songsplayValidate()
{
var field,sCame;
sCame=false;
field=document.myform1['list[]'];

//alert(field.length);
for (i = 0; i < field.length; i++)
	{  
		if( field[i].checked == true )
		{
			sCame=true;
			break;
		}
	 }	
	 	 
	 if(sCame == false)
	 {
	 	alert("Please Select Atleast One Song To Play");
		return false;
	 }
	 else
	 {
		window.open('jukeplnew.asp','Sanchika','scrollbars=no,toolbar=no,location=no,status=no,resizable=no,width=468,height=470,left=372,top=284');	 
	 }
}
