
//_____________________________________________________________________________________________
//________________________  ValidSubscribe      ________________________________________________________

function ValidSubscribe(){
	var oForm = document.forms.myform;
	if (oForm.email.value.replace( / /g, "") == "")
	{
		alert("Please enter Your Email Address!");
		oForm.email.focus();
		return false;
	}
		if (isEmail(oForm.email.value)==false)
		{
			alert("Please enter a valid Email address, like: name@companyname.com ");
			oForm.email.focus();
			return  false;
		}
	//oForm.submit();	
	return true;
}

//_____________________________________________________________________________________________
//________________________  ValidSubscribes      ________________________________________________________

function ValidSubscribes(){
	var oForm = document.forms.myform;

	if (oForm.EmailInterestedIn[0].checked)
	{
			
 			if (isInt(document.myform.EmailInterestedIn.length)==true) {
				for (counter = 1; counter < document.myform.EmailInterestedIn.length; counter++)
					document.myform.EmailInterestedIn[counter].checked = false;
			} 
	
	}
	else
	{
		var x1 = false
		if (isInt(document.myform.EmailInterestedIn.length)==true) {
				for (counter = 1; counter < document.myform.EmailInterestedIn.length; counter++)
					if (document.myform.EmailInterestedIn[counter].checked) x1 = true;
		} 
		
		if (!x1)
		{
			if (!window.confirm("There is no selected Music Preference. \n Do you want to be unsubscribed?"))
			{	
				oForm.EmailInterestedIn[0].focus();
				return  false;
			}
		}	
	}
	
	if (oForm.email.value.replace( / /g, "") == "")
	{
		alert("Please enter Your Email Address!");
		oForm.email.focus();
		return false;
	}
		if (isEmail(oForm.email.value)==false)
		{
			alert("Please enter a valid Email address, like: name@companyname.com ");
			oForm.email.focus();
			return  false;
		}
		
	oForm.submit();	
	return true;
}


function isInt(chr)           
{
	if (isNaN(chr))
	{return false; }
	else
	  {
		if (chr>0)
		{ return true;	}
		else
		  { return false; }	  
	   }
}



//____________________________________________________________________________________
//_____________     EnableMusic      _________________________________________________________

function EnableMusic()
{

	var oForm = document.forms.myform;

	if (oForm.EmailInterestedIn[0].checked)
	{
			var x1=0;
 			if (isInt(document.myform.EmailInterestedIn.length)==true)
 			 {
				for (counter = 1; counter < document.myform.EmailInterestedIn.length; counter++)
				{
						document.myform.EmailInterestedIn[counter].checked=false;
						document.myform.EmailInterestedIn[counter].disabled=true;
				}		
			} 
	}
	else
	{
		var x1=0;
 			if (isInt(document.myform.EmailInterestedIn.length)==true)
 			 {
				for (counter = 1; counter < document.myform.EmailInterestedIn.length; counter++)
				{
						document.myform.EmailInterestedIn[counter].disabled=false;
				}		
			} 
	}
}

function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}

function Open3(page,width,height)
{
	var leftPos = (screen.availWidth - width) / 2;
	var topPos = (screen.availHeight - height) / 2;
	OpenWin3 = this.open(page, "w3", "toolbar=no,menubar=no,location=no,status=no,titlebar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+leftPos+",top="+topPos);
	OpenWin3.focus();
	return true;
}

function Open4(page,width,height)
{
	var leftPos = (screen.availWidth - width) / 2;
	var topPos = (screen.availHeight - height) / 2;
	OpenWin4 = this.open(page, "w4", "toolbar=no,menubar=no,location=no,status=no,titlebar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+leftPos+",top="+topPos);
	OpenWin4.focus();
	return true;
}
function Open5(page,width,height)
{
	var leftPos = (screen.availWidth - width) / 2;
	var topPos = (screen.availHeight - height) / 2;
	OpenWin5 = this.open(page, "w5", "toolbar=no,menubar=no,location=no,status=no,titlebar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+leftPos+",top="+topPos);
	OpenWin5.focus();
	return true;
}


				
