//CVV2 help popup
function getHelp() 
{
	if (top.helpwin) 
	{
		top.helpwin.focus();
		top.helpwin.infotopic.location='/cvv2.html';
	}
	else
	{
		window.open("cvv2.html", 'infowin_cvv2', 'scrollbars=1,resizable=1,width=300,height=325,dependent=1');
	}
}
// check all form fields
function  checkMyForm(chkthis) {
// contact name check
	if (chkthis.contact.value == "")
		{
		alert("Please enter a contact name.");
		chkthis.contact.focus();
		return (false);
		}
// companyname2 name check
	if (chkthis.companyname2.value == "")
		{
		alert("Please enter a company name.");
		chkthis.companyname2.focus();
		return (false);
		}
// Address check
	if (chkthis.Address.value == "")
		{
		alert("Please enter a street address.");
		chkthis.Address.focus();
		return (false);
		}
// city check
	if (chkthis.city.value == "")
		{
		alert("Please enter a city name.");
		chkthis.city.focus();
		return (false);
		}
// state check
	if (chkthis.state.selectedIndex <= 0)
	{
	alert("Please select a state.");
	chkthis.state.focus();
	return (false);
	}
// zip check
	if (chkthis.Zip.value == "")
		{
		alert("Please enter a zip/postal code.");
		chkthis.Zip.focus();
		return (false);
		}
// phone check
	if (chkthis.phone.value == "")
		{
		alert("Please enter your phone #.");
		chkthis.phone.focus();
		return (false);
		}

// email check
if (chkthis.EMail.value == "")
		{
		alert("Please enter a value for the \"Email\" field.");
		chkthis.EMail.focus();
		return (false);
		}
	// test if valid email syntax, must have @ and .
	var checkEmail = "@.";
	var checkStr = chkthis.EMail.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
			for (j = 0;  j < checkEmail.length;  j++)
			{
	if (ch == checkEmail.charAt(j) && ch == "@")
		EmailAt = true;
	if (ch == checkEmail.charAt(j) && ch == ".")
		EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
			}
	// if both the @ and . were in the string
		if (EmailAt && EmailPeriod)
			{
			EmailValid = true
			break;
			}
		}
	if (!EmailValid)
	{
	alert("Please enter a valid email address");
	chkthis.EMail.focus();
	return (false);
	}
		return true;
}

