<!-- 
function validEmail(formField, required, hidealert){
	if (required || formField.value.length > 0) {
		var testresults
		var str=formField.value
		var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(str))
		testresults=true
		else{
			if (!hidealert)
				alert("Please input your valid email address!")
				formField.focus();
		testresults=false
		}
		return (testresults)
	}
	else return true;
}

//
// generic window pop up
function popUp(url, name, features) {
	popupWin = window.open(url, name, features);
	popupWin.focus();
	return false;
}

// enter numbers into dial pad
function updatePhone(value) {
	var phoneField = document.frmPhone.txtphone;
	if (!phoneField.value.length || phoneField.value.length < 13) {
		phoneField.value += value;
		getIt(phoneField);
	}
}	

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages(imgtag, img) {
	if (document.images) {
		document[imgtag].src = eval(img+'.src');
	}
}

// Changes a div's text, (and optionally changes image)
function showDiv(thisDiv, thistext, imgtag, img) {
	document.getElementById(thisDiv).innerHTML = eval(thistext);
	if (img && imgtag)
		changeImages(imgtag, img);
	return false;
}

function showItem(thisItem) {
	document.getElementById(thisItem).style.display="inline";
}
function hideItem(thisItem) {
	document.getElementById(thisItem).style.display="none";
}

// show/ hide item depending on whether it's already visible
function toggleItem(thisItem) {
	var itemTag = document.getElementById(thisItem)
	if (itemTag.style.display == "inline")
		itemTag.style.display = "none";
	else
		itemTag.style.display = 'inline';
}

// show/hide ALL divs given the prefix of the div
function toggleAll(toggleBox, divGroup, items) {
	if (toggleBox.checked)
		displayValue = 'inline';
	else
		displayValue = 'none';
	for (var cnt=1; cnt<=items; cnt++) {
		divItem = divGroup + cnt;
		document.getElementById(divItem).style.display = displayValue;
	}
}

// preview model
function previewModel(text, img) {
	// Change Heading to say Make Model
	document.getElementById("makemodelsummary").innerHTML = text;
	// Change image
	if (!img)
		img = '../spacer.gif';
	changeImagesDirect('modelpic','images/modelpics/'+img);
}

// changes image, without preloading
function changeImagesDirect(imgtag, img) {
	if (document.images) {
		document[imgtag].src = img;
	}
}

// go button rollover (homepage)
if (document.images) {

go1 = new Image();
go1.src = "/images/go1.gif";
go1on = new Image();
go1on.src = "/images/go1-over.gif";
}

// add to order rollover (price.cfm)
if (document.images) {
add = new Image();
add.src = "/images/addOrder.gif";
addon = new Image();
addon.src = "/images/addOrder-over.gif";
}
// in the news rollover (news.cfm)
if (document.images) {
news = new Image();
news.src = "/images/newsClick.gif";
newson = new Image();
newson.src = "/images/newsClick-over.gif";
}

// 
function over(outer,id,image) {
    if (document.layers) {
        document.layers[id].background.src = image;
    }
    else if (document.all) {
        window.document.all[id].style.background = 'url(' + image + ')';
		window.document.all[id].style.backgroundRepeat = 'no-repeat';
    }
}

function out(outer,id,image) {
    if (document.layers)
        document.layers[id].background.src = image;
    else if (document.all)
        window.document.all[id].style.background = 'url(' + image + ')';
		window.document.all[id].style.backgroundRepeat = 'no-repeat';
}

// FORMAT PHONE NUMBER
//<!-- This script and many more are available free online at -->
//<!-- The JavaScript Source!! http://javascript.internet.com -->
//<!-- Original:  Roman Feldblum (web.developer@programmer.net) -->

var n;
var p;
var p1;
function ValidatePhone(){
p=p1.value
if(p.length==3){
	//d10=p.indexOf('(')
	pp=p;
	d4=p.indexOf('(')
	d5=p.indexOf(')')
	if(d4==-1){
		pp="("+pp;
	}
	if(d5==-1){
		pp=pp+")";
	}
	//pp="("+pp+")";
	document.frmPhone.txtphone.value="";
	document.frmPhone.txtphone.value=pp;
}
if(p.length>3){
	d1=p.indexOf('(')
	d2=p.indexOf(')')
	if (d2==-1){
		l30=p.length;
		p30=p.substring(0,4);
		//alert(p30);
		p30=p30+")"
		p31=p.substring(4,l30);
		pp=p30+p31;
		//alert(p31);
		document.frmPhone.txtphone.value="";
		document.frmPhone.txtphone.value=pp;
	}
	}
if(p.length>5){
	p11=p.substring(d1+1,d2);
	if(p11.length>3){
	p12=p11;
	l12=p12.length;
	l15=p.length
	//l12=l12-3
	p13=p11.substring(0,3);
	p14=p11.substring(3,l12);
	p15=p.substring(d2+1,l15);
	document.frmPhone.txtphone.value="";
	pp="("+p13+")"+p14+p15;
	document.frmPhone.txtphone.value=pp;
	//obj1.value="";
	//obj1.value=pp;
	}
	l16=p.length;
	p16=p.substring(d2+1,l16);
	l17=p16.length;
	if(l17>3&&p16.indexOf('-')==-1){
		p17=p.substring(d2+1,d2+4);
		p18=p.substring(d2+4,l16);
		p19=p.substring(0,d2+1);
		//alert(p19);
	pp=p19+p17+"-"+p18;
	document.frmPhone.txtphone.value="";
	document.frmPhone.txtphone.value=pp;
	//obj1.value="";
	//obj1.value=pp;
	}
}
//}
setTimeout(ValidatePhone,100)
}
function getIt(m){
n=m.name;
//p1=document.forms[0].elements[n]
p1=m
ValidatePhone()
}
function testphone(obj1){
p=obj1.value
//alert(p)
p=p.replace("(","")
p=p.replace(")","")
p=p.replace("-","")
p=p.replace("-","")
//alert(isNaN(p))
if (isNaN(p)==true){
alert("Check phone");
return false;
}
}
//  End Format Phone Number-->

<!--
/*
	This is called from the orderform page
	It copies the billing information to the shipping information
	7.17.01
*/
var shipfirstname = "";
var shiplastname = "";
var shipaddress = "";
var shipaddress2 = "";
var shipcity = "";
var shipstate = "";
// var ShipStateIndex = 0;
var shipzip = "";
var shipphone = "";
function InitSaveVariables(form) {
	shipfirstname = form.shipfirstname.value;
	shiplastname = form.shiplastname.value;
	shipaddress = form.shipaddress.value;
	shipaddress2 = form.shipaddress2.value;
	shipcity = form.shipcity.value;
	shipstate = form.shipstate.value;
	shipzip = form.shipzip.value;
	shipphone = form.shipphone.value;
	}
function ShipToBillPerson(form) {
		InitSaveVariables(form);
		form.shipfirstname.value = form.requiredbillfirstname.value;
		form.shiplastname.value = form.requiredbilllastname.value;
		form.shipaddress.value = form.requiredbilladdress.value;
		form.shipaddress2.value = form.billaddress2.value;
		form.shipcity.value = form.requiredbillcity.value;
		form.shipstate.value = form.requiredbillstate.value;
		form.shipzip.value = form.requiredbillzip.value;
		form.country.value = form.billcountry.value;
		form.shipphone.value = form.requiredbillphone.value;
	}
// End of the copy billing to shipping function
// Function to validate order form
// Called from orderform.cfm
// 7.18.01
	function checkrequired(which) {
	var pass=true;
	if (document.images) {
	for (i=0;i<which.length;i++) {
	var tempobj=which.elements[i];
	if (tempobj.name.substring(0,8)=="required") {
	if (((tempobj.type=="text"||tempobj.type=="textarea")&&
	tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
	tempobj.selectedIndex==0)) {
	pass=false;
	break;
	         }
	      }
	   }
	}
	if (!pass) {
	shortFieldName=tempobj.name.substring(8,30).toUpperCase();
	alert("Please make sure the "+shortFieldName+" field was properly completed.");
	return false;
	}
	else
	return true;
	}
// End of order form validation

// A function to validate zip code
// Called from cart.cfm
function validateZip(formname) {
	if ((formname.zip.value == " Enter Zip" || formname.zip.value == "") && formname.country.value=="US") {
		window.alert("Please enter your zip code.");
		formname.zip.focus();
		return false;
	}
	else if (formname.country.value == "") {
		window.alert("Please enter your zip code or country.");
		return false;
	}
	/* else if (isNaN(zipform.zip.value) == true) {
           window.alert("Your zip code must be a number.");
		return false;
		} */
	return true;
}

// form validation (can't find part)
function checkrequired(which) {
	var pass=true;
	if (document.images) {
	for (i=0;i<which.length;i++) {
	var tempobj=which.elements[i];
	if (tempobj.name.substring(0,8)=="required") {
	if (((tempobj.type=="text"||tempobj.type=="textarea")&&
	tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
	tempobj.selectedIndex==0)) {
	pass=false;
	break;
	         }
	      }
	   }
	}
	if (!pass) {
	shortFieldName=tempobj.name.substring(8,30).toUpperCase();
	alert("Please make sure the "+shortFieldName+" field was properly completed.");
	return false;
	}
	else
	return true;
	}
	
// A generic popup window function.
// It's necessary to pass all of the available attributes; url, name of new window, window features
// 10.30.01
function newWindow(url, name, features)
	{
		popupWin = window.open(url, name, features);
		popupWin.focus();
		
		return false;
	}

// validates install form for either phone or email
function simpleValidate(formname) {
		if (formname.phone.value == "" && formname.email.value=="") {
			window.alert("Please enter either your phone or email.");
			return false;
		}
}

function emptyZip(formname) {
	if (formname.code.value == "") {
		window.alert("Please enter your zip code");
		return false;		
	}
}

// to use a rollover as a submit button
function Submit(theform) {
	document[theform].submit();
}

function subit(formname){
document.formname.submit();
}

-->