//checking when send button pressed
function formCheck(form) {

if (form.area_code.value=="")
	{alert("Please enter a 3 digit value for you telephone area code.");
	form.area_code.focus();
	return false;}
if (form.zip.value=="")
	{alert("Please enter your Zip Code.\nThis enables us to find the cheapest\n cellular deal for you.");
	form.zip.focus();
	return false;}


// If country is USA check Zip is valid

// Parse the ZipCode into TestZipCode so we can check it out
TestDelZip = form.zip.value;

// check zip contents to see if its 5 digits long
var stringlength= TestDelZip.length;


// Set values check zip contents are only numbers and count the hyphens
var valid = "0123456789-";
var hyphencount = 0;
var temp = "";

// Check that we have either 5 or 10 characters in the zip code
	if (stringlength!=5 && stringlength!=10) {
	alert("Invalid Zip Code entered!\nPlease enter your 5 digit or 5 digit+4 zip code.");
	form.zip.focus();
	return false;
	}

//Check for improper characters and the number and position of the hyphen
	for (var i=0; i < TestDelZip.length; i++) {
	temp = "" + TestDelZip.substring(i, i+1);
		if (temp == "-") {hyphencount++;}
		if (valid.indexOf(temp) == "-1") {
		alert("Invalid characters in your zip code.  Please try again.");
		form.DelZip.focus();
		return false;
		}

		if ((hyphencount > 1) || ((TestDelZip.length==10) && ""+TestDelZip.charAt(5)!="-")) {
		alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
		form.zip.focus();
		return false;
		}
	}
return true;
}