/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->


function selection(selescted_id){
	//document.write(selescted_id);
	if(document.shop_coverage_plan_step1.selescted_id.checked==true)
	//document.shop_coverage_plan_step1.selescted_id.checked==false;
	document.shop_coverage_plan_step1.getElementById(selescted_id).checked=false;
	
}

function checkempty()
{
	
	if(document.getElementById("first_name").value=="")
	{
	alert("Please enter first name.");
	document.getElementById("first_name").focus();
	return false;
	}
	
	if(document.getElementById("last_name").value=="")
	{
	alert("Please enter last name.");
	document.getElementById("last_name").focus();
	return false;
	}

	if(document.getElementById("birth_date").value=="")
	{
	alert("Please enter birth date.");
	document.getElementById("birth_date").focus();
	return false;
	}
	
	if(document.getElementById("address").value=="")
	{
	alert("Please enter your address.");
	document.getElementById("address").focus();
	return false;
	}
	
	if(document.getElementById("zip_code").value=="")
	{
	alert("Please enter zip code.");
	document.getElementById("zip_code").focus();
	return false;
	}
	
	if(document.getElementById("city").value=="")
	{
	alert("Please enter city.");
	document.getElementById("city").focus();
	return false;
	}
	
	if(document.getElementById("phone").value=="")
	{
	alert("Please enter phone.");
	document.getElementById("phone").focus();
	return false;
	}

	if(document.getElementById("state").value=="")
	{
	alert("Please enter state.");
	document.getElementById("state").focus();
	return false;
	}


	if(document.getElementById("email").value=="" ||
	(document.getElementById("email").value.indexOf('@') == -1) ||
	(document.getElementById("email").value.indexOf('.') == -1))
	{
	alert("Please enter E-mail in correct format");
	document.getElementById("email").focus();
	return false;
	}


	return true;

}


function checkempty3()
{
	
	if(document.getElementById("card_name").value=="")
	{
	alert("Please enter card name.");
	document.getElementById("card_name").focus();
	return false;
	}
	
			
	myOption = -1;
	for (i=document.shop_coverage_plan_step3.card_type.length-1; i > -1; i--) {
	if (document.shop_coverage_plan_step3.card_type[i].checked) {
	myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
		alert("You must select 'card type' radio button");
		return false;
			
	}
	
	if(document.getElementById("card_number").value=="")
	{
	alert("Please enter card number.");
	document.getElementById("card_number").focus();
	return false;
	}

	if(document.getElementById("card_expiry_month").value=="")
	{
	alert("Please select card expiry month.");
	document.getElementById("card_expiry_month").focus();
	return false;
	}
	
	if(document.getElementById("card_expiry_year").value=="")
	{
	alert("Please select card expiry year.");
	document.getElementById("card_expiry_year").focus();
	return false;
	}

	return true;

}
