function makePopWindow(url) 
{
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=450,height=470');
	self.name = "mainWin"; 
}
function Login()
{
	if (IsLoginEmail(document.signin.txtShopperEmail.value) == false)
	{
		alert("\n- An email address is required to login.");
		document.signin.txtShopperEmail.focus();
		return (false);
	}
	
	if (document.signin.pwdShopperPassword.value.length == 0)
	{
		alert("\n- Please enter your password.");
		document.signin.pwdShopperPassword.focus();
		return (false);
	}
	
	return (true);
}

function Recover()
{
	if (IsLoginEmail(document.recover.txtShopperEmail.value) == false)
	{
		alert("\n- An email address is required to recover a password.");
		document.recover.txtShopperEmail.focus();
		return (false);
	}
	else
	{
		return (true);
	}
}

/* Email address Validation */
function IsLoginEmail(emailad)
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var check=/@[\w\-]+\./;
	var checkend=/\.[a-zA-Z]{2,3}$/;

	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
		return (false);
	}
	else 
	{
		return (true);
	}
}

/* Copy Bill To To Ship To */
function getBillTo()
{
	with  (document.checkout)
	{
		//Populate the billing info with the shipping info
		checkout.bill_firstname.value = checkout.ship_firstname.value;
		checkout.bill_lastname.value = checkout.ship_lastname.value;
		checkout.bill_address.value = checkout.ship_address.value;
		checkout.bill_suite.value = checkout.ship_suite.value;
		checkout.bill_city.value = checkout.ship_city.value;
		checkout.bill_state.selectedIndex = checkout.ship_state.selectedIndex;
		checkout.bill_zip.value = checkout.ship_zip.value;		
	}
}

/* Copy Bill To To Ship To V2 (created to avoid breaking changes during upgrade) */
function getBillToV2()
{
	with  (document.checkout)
	{
		//Populate the billing info with the shipping info
		checkout.bill_firstname.value = checkout.ship_firstname.value;
		checkout.bill_lastname.value = checkout.ship_lastname.value;
		checkout.bill_address.value = checkout.ship_address.value;
		checkout.bill_suite.value = checkout.ship_suite.value;
		checkout.bill_city.value = checkout.ship_city.value;
		checkout.bill_state.selectedIndex = checkout.ship_state.selectedIndex;
		checkout.bill_countries.selectedIndex = checkout.ship_countries.selectedIndex;
		checkout.bill_zip.value = checkout.ship_zip.value;		
		checkout.bill_province.value = checkout.ship_province.value;		
	}
}

	
/* Radio Button Validation */
function valbutton(thisform) 
{
	myOption = -1;
	
	for (i=0; i < thisform.bill_cc_type.length; i++) 
	{
		if (thisform.bill_cc_type[i].checked) 
		{
			myOption = i;
		}
	}
	if (myOption == -1) 
	{
		return false;
	}
	else
	{
		return true;
	}
}

/* Email address Validation */
function IsEmail(emailad)
{

	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var check=/@[\w\-]+\./;
	var checkend=/\.[a-zA-Z]{2,3}$/;

	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
		return (false);
	}
	else {
		return (true);
	}
}

/* SSL Certificate Window Opener */
function OpenCertDetails()
{
	thewindow = window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=USJEWEX3', 'anew', config='height=400,width=495,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
}