<!--
// ****************************************************
// * Validation of email addresses
// *
// * Called in :
// * ContactUs.asp, ContactUsResponse.asp, HotItemBuy.asp
// ****************************************************
function validEmail(email)
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/; var check=/@[\w\-]+\./;
	var checkend=/\.[a-zA-Z]{2,3}$/;

	// Are there any invalid characters in the address?
	if((email.search(exclude) != -1) || (email.search(checkend) == -1))
		return false;

	atPos = email.indexOf("@",0);
	pPos1 = email.indexOf(".",0);
	periodPos = email.indexOf(".",atPos);

	// Are there consecutive periods?
	pos1 = pPos1;
	pos2 = 0;
	while (pos2 > -1) {
		pos2 = email.indexOf(".",pos1+1);
		if (pos2 == pos1+1)
			return false;
		else
			pos1 = pos2;
	}

	// Is there an @ symbol in the address?
	if (atPos == -1)
		return false;

	// Is the @ symbol in the first position?
	if (atPos == 0)
		return false;

	// Is there a period in the first position?
	if (pPos1 == 0)
		return false;

	// Is there more than one @ symbol in the address?
	if(email.indexOf("@",atPos+1) > -1)
		return false;

	// Is there a period after the @ symbol?
	if (periodPos == -1)
		return false;

	// Is the period imediately after the @ symbol?
	if (atPos+1 == periodPos)
		return false;

	// Are there at least 2 characters after the period?
	if (periodPos+3 > email.length)
		return false;

	return true;
}
//******************************************************
// * END validEmail 
// ****************************************************


//******************************************************
// * Validation Function For Contact Us Pages - eMail 
// ****************************************************


function checkEmail()
{ 
	if (document.eMailForm.From.value == "") {
		alert("Please enter your Email Address.");
		document.eMailForm.From.focus();
		return false;
	}
	else if (validEmail(document.eMailForm.From.value) == false) {
		alert("Please enter a vaild Email address.");
		document.eMailForm.From.focus();
		return false;
	}
}


// ****************************************************
// * Validates the correct syntax of a phone number.
// *
// * Called by:
// * checkFieldsHot
// * (BAL/CM)
// ****************************************************

function validPhoneNum(phoneNum)
{
	var validChars = /[\-\ ]*/g;

	phoneNumDEx = /(^\d{7}\d*$)/;				// valid format for USA phone numbers minus Area Code

	phoneNum = phoneNum.replace(validChars, "");	// strip valid characters (spaces and hyphens) out of the phone number

	// Test phone numbers for 8 or more connsecutive digits that must start with 2 or greater
	if (!phoneNumDEx.test(phoneNum)) {
		alert('The phone number entered is invalid. Phone numbers MUST contain valid characters.Valid characters are hyphens, spaces, and the digits 0 through 9.');
		return false;
	}

	return true;
}
// END validPhoneNum **********************************
// ****************************************************





// ****************************************************
// * Validation of fields for Hot Items Order Form
// *
// * Used in :
// * HotItemsOrder.asp
// ****************************************************

function checkFieldsHot()
{

	if (document.MailOrder.ContactFirst.value == "") {
		alert("Please enter your First Name.");
		document.MailOrder.ContactFirst.focus();
		return false;
	}


	else if (document.MailOrder.ContactLast.value == "") {
		alert("Please enter your Last name.");
		document.MailOrder.ContactLast.focus();
		return false;
	}

	else if (document.MailOrder.ContactAddress.value == "") {
		alert("Please enter your Address.");
		document.MailOrder.ContactAddress.focus();
		return false;
	}
	
	else if (document.MailOrder.ContactCity.value == "") {
		alert("Please enter your City.");
		document.MailOrder.ContactCity.focus();
		return false;
	}
	
    else if (document.MailOrder.ContactZipCode.value == "") {
		alert("Please enter a valid zip code.");
		document.MailOrder.ContactZipCode.focus();
		return false;
	}
	
	else if (document.MailOrder.ContactAreaCode1.value == "") {
		alert("Please enter your Area Code.");
		document.MailOrder.ContactAreaCode1.focus();
		return false;
	}
	
	else if (document.MailOrder.ContactPhone1.value == "") {
		alert("Please enter a valid phone number where we may contact you.");
		document.MailOrder.ContactPhone1.focus();
		return false;
	}
	else if (!validPhoneNum(document.MailOrder.ContactPhone1.value)) {
		document.MailOrder.ContactPhone1.focus();
		return false;
	}

	//return true;
}
// END checkFieldsHot ***********************************
// ****************************************************


// ****************************************************
// * Validation of fields for Century 21 Order Form
// *
// * Used in :
// * OrderForm02-C21.asp
// ****************************************************

function checkFieldsC21()
{

	if (document.orderform.CardInfoFirst.value == "") {
		alert("Please enter your First Name.");
		document.orderform.CardInfoFirst.focus();
		return false;
	}


	else if (document.orderform.CardInfoLast.value == "") {
		alert("Please enter your Last name.");
		document.orderform.CardInfoLast.focus();
		return false;
	}
	else if (document.orderform.CardInfoPosition.value == "") {
		alert("Please enter your Position or Title.");
		document.orderform.CardInfoPosition.focus();
		return false;
	}
	else if (document.orderform.CardInfoAddress.value == "") {
		alert("Please enter your Address.");
		document.orderform.CardInfoAddress.focus();
		return false;
	}
	
	else if (document.orderform.CardInfoCity.value == "") {
		alert("Please enter your City.");
		document.orderform.CardInfoCity.focus();
		return false;
	}
	
    else if (document.orderform.CardInfoZipCode.value == "") {
		alert("Please enter a valid zip code.");
		document.orderform.CardInfoZipCode.focus();
		return false;
	}
	
	else if (document.orderform.CardInfoAreaCode1.value == "") {
		alert("Please enter your Area Code.");
		document.orderform.CardInfoAreaCode1.focus();
		return false;
	}
	
	else if (document.orderform.CardInfoPhone1.value == "") {
		alert("Please enter a valid phone number.");
		document.orderform.CardInfoPhone1.focus();
		return false;
	}
	else if (document.orderform.CardInfoHighlights.value == "") {
		alert("Please enter Career Highlight Information.");
		document.orderform.CardInfoHighlights.focus();
		return false;
	}
	else if (document.orderform.FILE1.value == "") {
		alert("Please attach an image file.");
		document.orderform.FILE1.focus();
		return false;
	}	
		

	//return true;
}
// END checkFieldsC21 ***********************************
// ****************************************************











//******************************************************
//* PreLoad Function - MD
//******************************************************

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//******************************************************
//* Roll Over Functions - MD
//******************************************************

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//******************************************************
//* End Roll Over Functions - MD
//******************************************************


//******************************************************
//* Pop-Up Window Function - MD
//******************************************************


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//******************************************************
//* End Pop-Up Window Functions - MD
//******************************************************


//******************************************************
//* Print Window Functions - MD
//******************************************************


function printPage() {
if (window.print) {
agree = confirm('Please make sure your printer is on and connected properly. \n\nOK to print now?');
if (agree) window.print(); 
   }
}

//******************************************************
//* End Print Window Functions - MD
//******************************************************
//-->
