
function setfocus_company() {
	document.step1.company.focus();
}

function setfocus_mop() {
	document.step2.cardtype.focus();
}


function setfocus() {
	document.FORM.company.focus();
}

function setfocus_sender() {
	document.FORM.sender.focus();
}


function setfocus_sender_exadd() {
	document.submit_ex_1.sender.focus();
}


function setfocus_fname() {
	document.FORM.fname.focus();
}


var newwindow;
function popwindow_400_300(url)
{
	newwindow=window.open(url,'name','height=400,width=300');
	if (window.focus) {newwindow.focus()}
}

var newwindow;
function popwindow(url)
{
	newwindow=window.open(url,'name','height=520,width=500');
	if (window.focus) {newwindow.focus()}
}



var newwindow;
function popwindow_520_500(url)
{
	newwindow=window.open(url,'name','height=520,width=500');
	if (window.focus) {newwindow.focus()}
}


var newwindow;
function popwindow_540_600(url)
{
	newwindow=window.open(url,'name','height=540,width=600');
	if (window.focus) {newwindow.focus()}
}


function check_form_mop(checkform)
{

	if (checkform.cardtype.value == 'VISA')
	{
		if (checkform.cardno.value.length != 16)
		{
		alert("Visa Card Number was entered incorrectly. Please re-enter.");
		return false;
		}

		if (checkform.cvv2.value.length != 3)
		{
		alert("Visa Card - Verification Number  was entered incorrectly. Please re-enter.");
		return false;
		}


	}
	else if (checkform.cardtype.value == 'MASTER CARD')
	{
		if (checkform.cardno.value.length != 16)
		{
		alert("Master Card Number was entered incorrectly. Please re-enter.");
		return false;
		}

		if (checkform.cvv2.value.length != 3)
		{
		alert("Master Card - Verification Number  was entered incorrectly. Please re-enter.");
		return false;
		}


	}

	else if (checkform.cardtype.value == 'AMERICAN EXPRESS')
	{
		if (checkform.cardno.value.length != 15)
		{
		alert("American Express Card Number was entered incorrectly. Please re-enter.");
		return false;
		}

		if (checkform.cvv2.value.length != 4)
		{
		alert("American Express Card - Verification Number  was entered incorrectly. Please re-enter.");
		return false;
		}


	}


	if (checkform.cardname.value.length < 1)
	{
	alert("Name on Card  was entered incorrectly. Please re-enter.");
	return false;	
	}



}

function check_form_js_flacctdt(checkform)
{
	// Form validation

	// the official form element names
	// var forced = new Array(checkform.company,checkform.fname,checkform.lname,checkform.address,checkform.city,checkform.country,checkform.tel,checkform.sender,checkform.descript,checkform.type);
	var forced = new Array("fname","lname","address","city","country","tel","sender","descript","type");

	// text descriptions of the form elements
	var forced2 = new Array("First Name","Last Name","Address","City","Country","Telephone","Email Address","Company Profile or Description","Company or Organization Type");

	// include the same descriptions from forced2 those elements which are of type "select" to show proper grammar in alert boxes (not required)
	var select_forced = "Country, Company or Organization Type"; // for proper sentences in error box

	// Check for blank fields
	for (i = 0; i < forced.length; i++)
	{
		check_forced = eval("checkform." + forced[i]); // create the object we want to look at

		// if (forced[i].value.length < 1)
		if ((check_forced) && (check_forced.value.length < 1))
		{	
			if (select_forced.indexOf(forced2[i]) >=0)
			{
				alert("Please choose your " + forced2[i] + ".");
			}
			else
			{
				alert("Your contact information is incomplete.  Please enter your " + forced2[i] + ".");
			}

			// forced[i].focus();
			check_forced.focus();
			return false;
		}
	}




	// Check email (should improve check for tld)
	if ((checkform.sender.value.indexOf("@") < 0) || (checkform.sender.value.indexOf(".") < 0))
	{
		alert("A correct email address must be entered.");
		checkform.sender.focus();
		return false;
	}
}



function check_form_js_laccts(checkform)
{
	// Form validation

	// the official form element names
	// var forced = new Array(checkform.company,checkform.fname,checkform.lname,checkform.address,checkform.city,checkform.country,checkform.tel,checkform.sender,checkform.descript,checkform.type);
	var forced = new Array("lname","address","city","country","tel","sender");

	// text descriptions of the form elements
	var forced2 = new Array("Last Name","Address","City","Country","Telephone","Email Address");

	// include the same descriptions from forced2 those elements which are of type "select" to show proper grammar in alert boxes (not required)
	var select_forced = "Country, Company or Organization Type"; // for proper sentences in error box

	// Check for blank fields
	for (i = 0; i < forced.length; i++)
	{
		check_forced = eval("checkform." + forced[i]); // create the object we want to look at

		// if (forced[i].value.length < 1)
		if ((check_forced) && (check_forced.value.length < 1))
		{	
			if (select_forced.indexOf(forced2[i]) >=0)
			{
				alert("Please choose your " + forced2[i] + ".");
			}
			else
			{
				alert("Your contact information is incomplete.  Please enter your " + forced2[i] + ".");
			}

			// forced[i].focus();
			check_forced.focus();
			return false;
		}
	}




	// Check email (should improve check for tld)
	if ((checkform.sender.value.indexOf("@") < 0) || (checkform.sender.value.indexOf(".") < 0))
	{
		alert("A correct email address must be entered.");
		checkform.sender.focus();
		return false;
	}
}

function check_form_js_replymsg(checkform)
{
	// Form validation

	// the official form element names
	// var forced = new Array(checkform.company,checkform.fname,checkform.lname,checkform.address,checkform.city,checkform.country,checkform.tel,checkform.sender,checkform.descript,checkform.type);
	var forced = new Array("fname","lname","address","city","country","tel","sender","message");

	// text descriptions of the form elements
	var forced2 = new Array("First Name","Last Name","Address","City","Country","Telephone","Email Address","Your Message");

	// include the same descriptions from forced2 those elements which are of type "select" to show proper grammar in alert boxes (not required)
	var select_forced = "Country, Company or Organization Type"; // for proper sentences in error box

	// Check for blank fields
	for (i = 0; i < forced.length; i++)
	{
		check_forced = eval("checkform." + forced[i]); // create the object we want to look at

		// if (forced[i].value.length < 1)
		if ((check_forced) && (check_forced.value.length < 1))
		{	
			if (select_forced.indexOf(forced2[i]) >=0)
			{
				alert("Please choose your " + forced2[i] + ".");
			}
			else
			{
				alert("Your contact information is incomplete.  Please enter your " + forced2[i] + ".");
			}

			// forced[i].focus();
			check_forced.focus();
			return false;
		}
	}




	// Check email (should improve check for tld)
	if ((checkform.sender.value.indexOf("@") < 0) || (checkform.sender.value.indexOf(".") < 0))
	{
		alert("A correct email address must be entered.");
		checkform.sender.focus();
		return false;
	}
}


function check_form_js_feedback(checkform)
{
	// Form validation

	// the official form element names
	// var forced = new Array(checkform.company,checkform.fname,checkform.lname,checkform.address,checkform.city,checkform.country,checkform.tel,checkform.sender,checkform.descript,checkform.type);
	var forced = new Array("lname","address","city","country","tel","sender");

	// text descriptions of the form elements
	var forced2 = new Array("Last Name","Address","City","Country","Telephone","Email Address");

	// include the same descriptions from forced2 those elements which are of type "select" to show proper grammar in alert boxes (not required)
	var select_forced = "Country, Company or Organization Type"; // for proper sentences in error box

	// Check for blank fields
	for (i = 0; i < forced.length; i++)
	{
		check_forced = eval("checkform." + forced[i]); // create the object we want to look at

		// if (forced[i].value.length < 1)
		if ((check_forced) && (check_forced.value.length < 1))
		{	
			if (select_forced.indexOf(forced2[i]) >=0)
			{
				alert("Please choose your " + forced2[i] + ".");
			}
			else
			{
				alert("Your contact information is incomplete.  Please enter your " + forced2[i] + ".");
			}

			// forced[i].focus();
			check_forced.focus();
			return false;
		}
	}




	// Check email (should improve check for tld)
	if ((checkform.sender.value.indexOf("@") < 0) || (checkform.sender.value.indexOf(".") < 0))
	{
		alert("A correct email address must be entered.");
		checkform.sender.focus();
		return false;
	}
	
	
		// Check comemnts likes or dislikes)
	if ((checkform.lcomments.value.length < 1) && (checkform.dcomments.value.length < 1))
	{
		alert("Please include your comments or a short message.");
		checkform.lcomments.focus();
		return false;
	}
	
}



function check_form_js(checkform)
{
	// Form validation

	// the official form element names
	// var forced = new Array(checkform.company,checkform.fname,checkform.lname,checkform.address,checkform.city,checkform.country,checkform.tel,checkform.sender,checkform.descript,checkform.type);
	var forced = new Array("company","fname","lname","address","city","country","tel","sender","descript","type");

	// text descriptions of the form elements
	var forced2 = new Array("Company Name","First Name","Last Name","Address","City","Country","Telephone","Email Address","Company Profile or Description","Company or Organization Type");

	// include the same descriptions from forced2 those elements which are of type "select" to show proper grammar in alert boxes (not required)
	var select_forced = "Country, Company or Organization Type"; // for proper sentences in error box

	// Check for blank fields
	for (i = 0; i < forced.length; i++)
	{
		check_forced = eval("checkform." + forced[i]); // create the object we want to look at

		// if (forced[i].value.length < 1)
		if ((check_forced) && (check_forced.value.length < 1))
		{	
			if (select_forced.indexOf(forced2[i]) >=0)
			{
				alert("Please choose your " + forced2[i] + ".");
			}
			else
			{
				alert("Your contact information is incomplete.  Please enter your " + forced2[i] + ".");
			}

			// forced[i].focus();
			check_forced.focus();
			return false;
		}
	}




	// Check email (should improve check for tld)
	if ((checkform.sender.value.indexOf("@") < 0) || (checkform.sender.value.indexOf(".") < 0))
	{
		alert("A correct email address must be entered.");
		checkform.sender.focus();
		return false;
	}
}


function check_form_js_pw(checkform)
{
	// Password choice validation

	pword_error = false;
	if (checkform.pword.value.length < 6)
	{
		alert("Password too short. Please re-enter.");
		pword_error = true;
	}
		if (checkform.pword.value.length > 75)
	{
		alert("Password too long. Please re-enter.");
		pword_error = true;
	}
/*
	else if (checkform.pword2.value.length < 1)
	{
		alert("Please confirm your password.");
		checkform.pword2.focus();
		return false;
	}
	else if (checkform.pword.value != checkform.pword2.value)
	{
		alert("Passwords did not match (possible typo?). Please re-enter.");
		pword_error = true;
	}
*/
	// (add check for character type)

	if (pword_error == true)
	{
		checkform.pword.value = "";
		// checkform.pword2.value = "";
		checkform.pword.focus();
		return false;
	}
}


function check_form_js_pw_change(checkform)
{
	// Password validation when changing it - confirm re-entry or new password, and original password

	pword_error = false;

	if (checkform.pword_old.value.length < 1)
	{
		alert("Please enter your current password.");
		checkform.pword_old.focus();
		return false;
	}
	else if (checkform.pword.value.length < 6)
	{
		alert("New password too short. Please re-enter.");
		pword_error = true;
	}
	else if (checkform.pword2.value.length < 1)
	{
		alert("Please confirm your new password.");
		checkform.pword2.focus();
		return false;
	}
	else if (checkform.pword.value != checkform.pword2.value)
	{
		alert("New passwords did not match (possible typo?). Please re-enter.");
		pword_error = true;
	}

	// (add check for character type)

	if (pword_error == true)
	{
		checkform.pword.value = "";
		checkform.pword2.value = "";
		checkform.pword.focus();
		return false;
	}
}


function check_form_js_both(checkform)
{
	form_return = check_form_js(checkform); // run the standard check

	if (form_return == false)
	{
		return false;
	}

	pw_return = check_form_js_pw(checkform); // run the password check

	if (pw_return == false)
	{
		return false;
	}
}
