/**
Function: checkData
Purpose:  To validate data for Suburban Ostomy Resume builder form 
**/

//Strip any spaces from beginning of string or return and prompt for input if string is only spaces
function trim(frmObj) {

var data = "";
var space_counter = 0;
for(var i = 0 ; frmObj.charAt(i)==' ' ; i++)
{
	space_counter++;
}
data = frmObj.substring(space_counter,frmObj.length);
return data;
}

function checkcontact() {

//check for name field being empty
document.forms[0].Name.value = trim(document.forms[0].Name.value);
if (document.forms[0].Name.value.length == 0) {
	alert("Please enter your name");
  	document.forms[0].Name.focus();
	return false;
}

//check for company field being empty
document.forms[0].Company.value = trim(document.forms[0].Company.value);
if (document.forms[0].Company.value.length == 0) {
	alert("Please enter a company")
  	document.forms[0].Company.focus();
	return false;
}


//Make sure Email field is not empty
document.forms[0].Email.value = trim(document.forms[0].Email.value);
if (document.forms[0].Email.value.length == 0) {
   alert("Please enter an Email address");
  	document.forms[0].Email.focus();
   return false;
}


//check for address field being empty
document.forms[0].Address.value = trim(document.forms[0].Address.value);
if (document.forms[0].Address.value.length == 0) {
	alert("Please enter a address");
  	document.forms[0].Address.focus();
	return false;
}

//check for city field being empty
document.forms[0].City.value = trim(document.forms[0].City.value);
if (document.forms[0].City.value.length == 0) {
	alert("Please enter a city name");
  	document.forms[0].City.focus();
	return false;
}

//Make sure State field is not empty 
document.forms[0].State.value = trim(document.forms[0].State.value);
if (document.forms[0].State.value.length == 0) {
	alert("Please enter a state name");
  	document.forms[0].State.focus();
	return false;
}

//Make sure zip field is not empty
document.forms[0].Zip.value = trim(document.forms[0].Zip.value);
if (document.forms[0].Zip.value.length == 0) {
   alert("Please enter a zip address");
  	document.forms[0].Zip.focus();
   return false;
}

//Make sure country field is not empty
document.forms[0].Country.value = trim(document.forms[0].Country.value);
if (document.forms[0].Country.value.length == 0) {
   alert("Please enter a country name");
  	document.forms[0].Country.focus();
   return false;
}

//Make sure Phone field is not empty
//if (document.forms[0].area_code_phone.value.length == 0) {
 //       alert("Please enter a phone number");
  //      return false;
//}


}
