/* this script contains validation routines for signing up */


//*************************************************************************
//	Function	:	validateInfo
//	Description	:  validates the information for signup
//	Pre			:	Nothing
//	Returns		:	True or False according to the input
//************************************************************************
var stuff="";
function doShow()
{
	if (stuff=="")
	{
	stuff = divCompany.innerHTML;
	}
	divCompany.innerHTML =stuff;
	if (window.onresize)
	{
	window.onresize();
	}
}
function doHide()
{
	if (stuff=="")
	{
	stuff = divCompany.innerHTML;
	}
	divCompany.innerHTML ="";
	if (window.onresize)
	{
	window.onresize();
	}
}

function validateInfo()
{
var fields
var fields2, status
    fields = "";
    fields2 = "";
    status = false;

/*
$txtCity = "";
$txtZipCode = "";
$txtPostalCode = "";
$txtStateRegion = "";
$txtCountry = "";
$txtTelephone1 = "";
$txtTelephone2 = "";
$txtEmail = "";
$txtVAT = "";
$txtFax = "";
$txtDesignation = "";
$txtCompanyName="";
$optCompanySelected ="";
$optIndividualSelected ="";
$txtDelAddressLine1 = "";
$txtDelAddressLine2 = "";
$txtDelAddressLine3 = "";
$txtDelCity = "";
$txtDelZipCode = "";
$txtDelPostalCode = "";
$txtDelStateRegion = "";
$txtDelCountry = "";
$txtDelTelephone1 = "";
$optCFSSelected  = "";
$optCFASelected  = "";
$optCFCSelected  = "";
$optDTDSelected  = "";
$txtInstructions = "";
$onloadJscript ="";
$txtCountryCombo ="";
$txtDelCountryCombo = ""; */
var focusObject = null;
	if (document.frmContact.txtName.value=="" ) {
		fields = fields + "User Name " + '\n';
		focusObject = (focusObject == null)	? document.frmContact.txtName : focusObject;
	}

	if (document.frmContact.txtEmail.value=="" ) {
		fields = fields + "Email " + '\n';
		focusObject = (focusObject == null)	? document.frmContact.txtEmail : focusObject;
	}

	if (document.frmContact.txtTelephone.value !="") {
		if (! IsTelephone(document.frmContact.txtTelephone.value) ) {
			fields2 = fields2 + "Telephone 1 (format xxx-xx-xxxxxxx) " + '\n';
			focusObject = (focusObject == null)	? document.frmContact.txtTelephone : focusObject;
		}
	}
		
	if (document.frmContact.txtEmail.value !="") {
		if (! IsEmail(document.frmContact.txtEmail.value) ) {
			fields2 = fields2 + "Email " + '\n';
			focusObject = (focusObject == null)	? document.frmContact.txtEmail : focusObject;
		}
	}
	
	
	if ( fields != "" ) {
		alert("Please fill in the" + '\n' + fields);
	} else {
		if ( fields2 != "" ) {
			alert("These fields has Invalid inputs" + '\n' + fields2);
			status = false;
		} else {
		
			status = true;
		}		
	}
	
    if (focusObject!=null)
	{
		focusObject.focus();
		if(focusObject.select) {
		focusObject.select();
		}
	}
	return status;
}
