<!--
/* DO NOT ALLOW SITE TO BE VIEWED IN FRAMES */
function killFrames(){
if (parent.frames.length > 0) { parent.location.href = location.href; }
}

/* MOUSEOVERS */
function hilite(imgDocID,imgObjName){ document.images[imgDocID].src = imgObjName; }

/* EMAIL VALIDATION */
function isEmail(form)
{
var testing = true;
var formField = form.email.value;
var strLength = formField.length;
var ii = 1;
	if (formField.length <= '5') { testing = false; }
	else {	
	for (i = 0; i < formField.length; i++)
		{
        if (formField.indexOf(" ") != -1) { testing = false; }
		}
    while ((ii < strLength) && (formField.charAt(ii) != "@")) { ii++; }
    if ((ii >= strLength) || (formField.charAt(ii) != "@")) { testing = false; }
    else { ii += 2; }
    while ((ii < strLength) && (formField.charAt(ii) != ".")) { ii++; }
    if ((ii >= strLength - 2) || (formField.charAt(ii) != ".")) { testing = false; }
}
	if (testing == true) { return true; }
	else {
		if(testing == false) {
		alert("Please enter a valid email address.");
		return false;
		}
	}
}

/* CHECK IF FORM FIELD IS VALID DATE */
function isDate(field)
{
/* GET PIECES OF THE DATE */
for (var i=0; i< field.length; i++)
{
if(i <= 2 && field.charAt(i) == "/")
	{
	var mm = field.substring(0,i);
	var last = i;
	}
if(i > 2 && field.charAt(i) == "/")
	{
	var dd = field.substring((last +1),i);
	
	var yy = field.substring((i+1),field.length);
	}
}
/* CHECK FOR CORRECTLY PLACES SLASHES */
if(!yy)
	{
	alert("Please enter a valid purchase date. (e.g. 02/26/2002)");
	return false;
	}
/* CHECK FOR VALID MONTHS RANGE */
if((mm <= 0) || (mm >= 13))
	{
	alert("Please enter a valid month in your date.");
	return false;
	}
/* CHECK FOR VALID DAYS RANGE */
if((dd <= 0) || (dd >= 32))
	{
	alert("Please enter a valid day in your date.");
	return false;
	}
return true;
}

/* CHECK IF IS NUMERIC */
function isNumeric(field,msg) {
var Chars = "0123456789";
var check = true;
for (var i = 0; i < field.value.length; i++) {
	if (Chars.indexOf(field.value.charAt(i)) == -1) { check=false }
}
if(check==false) {
	alert(msg);
	return false;
} else { return true; }
}

/* CHECK FOR STRING OF SPECIFIED LENGTH */
function isLength(length,field,msg) {
if(field.value.length!=length) {
	alert(msg);
	return false;
} else { return true; }
}

/* VALIDATE THAT STATE OR ZIP IS ENTERED */
function stateZip(msg) {
var check = false;
if(document.dealerFRM.state.value!="" || document.dealerFRM.zip.value!="" || document.dealerFRM.model_no.value!="" || document.dealerFRM.model_name!="") { check = true; }
if(check==false) {
	alert(msg);
	return false;
} else { return true; }
}

/* ALLOW ONLY CERTAIN CHARACTERS */
function limChars(string) {
var accept = '0123456789/-';
for (var i=0, output='', valid=accept; i<string.length; i++)
	if (valid.indexOf(string.charAt(i)) != -1)
	output += string.charAt(i)
return output;
}

/* PAD NUMBER WITH ZEROS */
function padIt(num,padLen) {
var str=limChars(num);
if(str!=""){
while (str.length<padLen){ str="0"+str; }
}
return str;
}


/* CHECK IF FORM FIELD IS BLANK */
function isBlank(field,msg) {
if(field.value=="") {
	alert(msg);
	return false;
} else { return true; }
}
	


//-->