
function submitForm(theForm) {
	
	formRequired(theForm.firstname,'You need to enter your first name.');
	formIsAlphaNumeric(theForm.firstname,'First name can only be letters and numbers');
	
	formRequired(theForm.lastname,'You need to enter your last name.');
	formIsAlphaNumeric(theForm.lastname,'Last name can only be letters and numbers');
	
	formIsEmail(theForm.email,'Please enter a valid email address as your user name.');
	formRequired(theForm.pword,'Please enter a valid password.');
	formIsAlphaNumeric(theForm.pword,'Passwords can only be letters and numbers');
	formRequired(theForm.confirmpw,'Please enter a valid conformation password.');
	formIsAlphaNumeric(theForm.confirmpw,'Passwords can only be letters and numbers');
	formIsSame(theForm.pword,theForm.confirmpw,'The \"Password\" and \"Confirm Password\" values do not match')
	formLength(theForm.pword,'Passwords must be between 6 and 10 charactors long')
	if(formSubmit) {
		return true;
	} else {
		formAlert();
		return false;
	}
	
}


function saveListing(listingid,booknumber,location){
	var action="Save";
	if (getConfirm(booknumber,action) == true){
		emxGetElementById(location).src="resources/cfm/saveListing.cfm?listing="+listingid;
	}
	// if (getConfirm(booknumber) == false){}
}


function deleteListing(listingid,booknumber,location){
	var action="Delete";
	if (getConfirm(booknumber,action) == true){
		emxGetElementById(location).src="resources/cfm/deleteListing.cfm?listing="+listingid;
	}
	// if (getConfirm(booknumber) == false){}
}

function getConfirm(thid,action){
	var agree=confirm(action+" House Number "+thid+"?");
	if (agree)return true ;
	else return false ;
}

function emxGetElementById(e){
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}