function vali_data() {

	var error= "";
	
	error += isEmpty(document.ramregform.primary_fname, "Missing Primary Contact First Name\n");
	error += isEmpty(document.ramregform.primary_lname, "Missing Primary Contact Last Name\n");
	error += isEmpty(document.ramregform.address1, "Missing Address\n");
	error += isEmpty(document.ramregform.city, "Missing City\n");	
	error += isEmpty(document.ramregform.email, "Missing E-mail\n");
	/*error += isEmpty(document.ramregform.exhibitorone_fname, "Missing Vendor/Enhibitor First Name\n");
	error += isEmpty(document.ramregform.exhibitorone_lname, "Missing Vendor/Enhibitor Lirst Name\n");*/
	error += validateEmail(document.ramregform.email, "Invalid E-mail Address\n");
	error += isToolong(document.ramregform.other_info, 1000, "Other Information is too long. Please limit to 1000 characters, including spaces\n");
	error += isEmpty(document.ramregform.exhibit_name, "Missing Exhibitor Vendor Name\n");
	error += isEmpty(document.ramregform.state, "Missing state\n");
	
	/*validate Description*/
	error += validateDescription(document.ramregform.description, 1000, "Missing Description\n", "Description is too long. Please limit to 1000 characters, including spaces\n");	
	
	/*Validate Zip Code*/
	error += validateNUMS(document.ramregform.zip, 5, "Missing Zip Code\n", "Invalid characters in Zip Code\n", "Zip code is too short\n");
	
	/*Validate Phone Number */
	error += validateNUMS(document.ramregform.ph_areacode, 3, "Missing phone number area code\n", "Invalid characters in phone number area code\n", "Phone number area code is too short\n"); 
	error += validateNUMS(document.ramregform.ph_exchange, 3, "Missing phone number exchange\n", "Invalid characters in phone number exchange\n", "Phone number exchange is too short\n");
	error += validateNUMS(document.ramregform.ph_suffix, 3, "Missing phone number suffix\n", "Invalid characters in phone number suffix\n", "Phone number suffix is too short\n");
	
	
	
	/*If the able_exhibit box is checked, we do not need to collect vendor-specific information*/
if (document.ramregform.able_exhibit.checked){
		
	var message = "";
	
	/*Check if Exhibitor 1 has been entered */
	if ((stringTrim(document.ramregform.exhibitorone_fname.value) != "") || (stringTrim(document.ramregform.exhibitorone_lname.value) != "")){			
			message += " * Exhibitor 1\n";
			document.ramregform.exhibitorone_fname.style.background = "Yellow";
			document.ramregform.exhibitorone_lname.style.background = "Yellow";
		}
	else{
			document.ramregform.exhibitorone_fname.style.background = "White";
			document.ramregform.exhibitorone_lname.style.background = "White";
	}
	
	/*Check if Exhibitor 2 has been entered */
	if ((stringTrim(document.ramregform.exhibitortwo_fname.value) != "") || (stringTrim(document.ramregform.exhibitortwo_lname.value) != "")){			
			message += " * Exhibitor 2\n";
			document.ramregform.exhibitortwo_fname.style.background = "Yellow";
			document.ramregform.exhibitortwo_lname.style.background = "Yellow";
		}
	else{
			document.ramregform.exhibitortwo_fname.style.background = "White";
			document.ramregform.exhibitortwo_lname.style.background = "White";
	}
	
	/*Check if outlets have been entered */
	if (stringTrim(document.ramregform.outlets.value) != ""){
			message += " * Number of Outlets\n";
			document.ramregform.outlets.style.background = "Yellow";
		}
	else{
		document.ramregform.outlets.style.background = "White";
	}
		
	if (message != ""){
			error += "\nIf you do not plan to exhibit, the following fields are unnecessary. Please delete them:\n" + message;
		}
}
	
	
	
	
	
	
	
else{
	/*Validate Exhibitor/Vendor #1 */
		error += isEmpty(document.ramregform.exhibitorone_fname, "Missing Vendor/Enhibitor First Name\n");
		error += isEmpty(document.ramregform.exhibitorone_lname, "Missing Vendor/Enhibitor Lirst Name\n");

	/*Validate electricity anad outlets*/
		if(document.ramregform.electricity_yn.value == ""){
			error += "Missing Electricity Needs\n";
			document.ramregform.electricity_yn.style.background = "Yellow";
		}
		if(document.ramregform.electricity_yn.value == "Yes"){
			document.ramregform.electricity_yn.style.background = "White";
			var numOutlets = stringTrim(document.ramregform.outlets.value);
			if ((numOutlets == "")|| (numOutlets.charAt(0) == 0)){
				error += "Please enter the number of outlets you will require\n";
				document.ramregform.outlets.style.background = "Yellow";
			}
			else if (isNumber2(numOutlets)==true){		
				error += "Incorrect characters in Outlets\n";
				document.ramregform.outlets.style.background = "Yellow";
			}
			else{
				document.ramregform.outlets.style.background = "White";
			}	
		}
		else if (document.ramregform.electricity_yn.value == "No"){
			document.ramregform.electricity_yn.style.background = "White";
			var numOutlets = stringTrim(document.ramregform.outlets.value);
			if ((numOutlets != "") && (numOutlets.charAt(0) != 0)){
				error += "If you do not need electricity, please enter 0 for the number of outlets\n";
			document.ramregform.outlets.style.background = "Yellow";
			}
			else{
				document.ramregform.outlets.style.background = "White";
			}
		}
	
	/*Validate Exhibitor #2. Exhibitor 2 is not required, but if somebody enters a partial name, we want to make sure they enter a full name*/
		var firstName = document.ramregform.exhibitortwo_fname;
		var lastName = document.ramregform.exhibitortwo_lname;
	
		if ((firstName.value != "" && lastName.value == "")||(firstName.value == "" && lastName.value != "")){
			error += "Please enter a full name for the second exhibitor\n";
			document.ramregform.exhibitortwo_fname.style.background = "Yellow";
			document.ramregform.exhibitortwo_lname.style.background = "Yellow";
		}
		else{
			document.ramregform.exhibitortwo_fname.style.background = "White";
			document.ramregform.exhibitortwo_lname.style.background = "White";
		}	
			
}	
	/*Either submit or throw errors */
	if (error != ""){
		alert ("Your registration has errors:\n" + error); 
		return false;
	}
	else{
		document.ramregform.action = "exhibit_submit.cfm";
		document.ramregform.submit();			
		return true;
	}
}

/*Validates Description */
function validateDescription(field, length, missing, long){
	var message = "";
	
	message += isEmpty (field, missing);
	message += isToolong (field, length, long);

	if (message != ""){
		field.style.background = "Yellow";
		return message;
	}
	else{
		field.style.background = "White";
		return "";
	}
}

/*Validates Zip Code and Phone Numbers */
function validateNUMS(field, length, missing, invalid, short){
	var message = "";
	
	message += isEmpty(field, missing);
	message += isNumber(field, invalid);
	message += validateTooshort(field, length, short);

	if (message != ""){
		field.style.background = "Yellow";
		return message;
	}
	else{
		field.style.background = "White";
		return "";
	}
}

function isEmpty(field, alert){
	
	var str_test=stringTrim(field.value)
	if (str_test == null || str_test == ""){
		
		field.style.background = "Yellow";
		return alert;
			
	}
	else{
		field.style.background = "White";
		return "";
	}
}

function validateEmail(field, alert){
	apos=field.value.indexOf("@");
	dotpos=field.value.lastIndexOf(".");
	if (apos<1||dotpos-apos<2){
		field.style.background = "Yellow";
		return alert; 
	}
	else{
		field.style.background = "White";
		return "";
	}
}

function isNumber(field, alert){
	var ValidChars = "0123456789.";
	var Char;
	 
    for (i = 0; i < field.value.length; i++) 
      { 
      Char = field.value.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) {
	  	field.style.background = 'Yellow';
		return alert;
	  }
	}
	field.style.background = "White";
	return "";
	
}

function isNumber2(number){
	var ValidChars = "0123456789.";
	var Char;
		
	for (i = 0; i < number.length; i++){ 
	  Char = number.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) {		
		return true;
	  }
	}	
	return "false"; 	
}

function isToolong(field, limit, alert){
	if (field.value.length > limit){
		field.style.background = 'Yellow';
		return alert;
	}
	else{
		field.style.background = "White";
		return "";
	}
}

function validateTooshort(field, limit, alert){
	if (field.value.length < limit){
		field.style.background = 'Yellow';
		return alert;
	}
	else{
		field.style.background = "White";
		return "";
	}
}

/*function validateOutlets(){
	if(document.ramgensubmit.electricity_yn == "Yes"){
		return validateNUMS(document.ramregform.outlets, 1, "Missing number of outlets\n", "Invalid characters in outlets\n", "Outlets is too short\n");}
		else return "";
}*/

function stringTrim(strToTrim) {
	return(strToTrim.replace(/^\s+|\s+$/g, ''));
}

function submit_stuff(){
	document.ramgensubmit.action = "inputdata.cfm";
	document.ramgensubmit.submit();
	return true;
}

function edit_stuff(){
	document.ramgensubmit.action = "exporeg.cfm";
	document.ramgensubmit.submit();
	return true;
}

