function inForm(objToTest) {
	//note: there's currently a problem with this script with IE Mac
	if (objToTest == null || objToTest == undefined) {
		return false;
	}
	return true;
}
function removeCommas(str) {
	//taken from http://www.irt.org/feedback/205.htm
	// Strip any commas that may be in string.
	// Must be recognized as a type string or indexOf function won't work
	str = String(str);
	while (str.indexOf(',') >= 0) {
	var temp = '';
	
	// if the comma is the first character, create a substring of everything after
	if (str.indexOf(',') == 0 && str.length > 1) {
	temp = str.substring(1, str.length);
	// if teh comma is not first or last character, join all before and all after comma
	} else if (str.indexOf(',') > 0 && str.indexOf(',') < str.length-1) {
	temp = str.substring(0, str.indexOf(',')) + str.substring(str.indexOf(',')+1, str.length);
	// if the comma is the last character, create a substring of everything before
	} else if (str.indexOf(',') > 0 && str.indexOf(',') == str.length-1) {
	temp = str.substring(0, str.length - 1);
	}
	// save changes
	str = temp;
	}
	return str;
}
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
	  retValue = retValue.substring(1, retValue.length);
	  ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
	  retValue = retValue.substring(0, retValue.length-1);
	  ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
	  retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

function check_screening_form(form){
	
	if(inForm(form.username) && (trim(form.username.value) == "" || trim(form.username.value)=="username")){
	alert('please enter a username.'); return false;}
	if(inForm(form.password) && (form.password.value.length<4 ||(trim(form.password.value)=="password" && trim(form.newuser.value)!=""))){
		alert('the password must be at least 4 characters long.'); 
		return false;
		}
	if(inForm(form.first_name) && (trim(form.first_name.value) == "" || trim(form.first_name.value) == "First Name")){
		alert('please enter your first name.'); return false;}
	if(inForm(form.last_name) && (trim(form.last_name.value) == "" || trim(form.last_name.value) == "Last Name")){
	alert('please enter your last name.'); return false;}
	if(inForm(form.email) && !(/[A-Za-z0-9_\.\-]+@+[A-Za-z0-9_\-]+\.[A-Za-z]+/.test(form.email.value))){
		alert('please enter a valid email address');
		return false;}
		
	/*
	required items:
	
	day
	time
	location_description
	city
	*/
	if(day_entered==false){
		alert('Please enter a day for your screening.'); 
		return false;
	}
	if(inForm(form.time) && (trim(form.time.value) == "")){
		alert('Please enter a time for your screening.'); 
		return false;
	}
	if(inForm(form.location_description) && (trim(form.location_description.value) == "")){
		alert('Please enter a location description or street address for your screening.'); 
		return false;
	}
	if(inForm(form.city) && (trim(form.city.value) == "")){
		alert('Please enter a city for your screening.'); 
		return false;
	}
	return true;
}

function doublecheck_delete(){
	var answer = confirm ("Are you sure you want to delete this?")
	if (answer){
		
	}else{
		return false;
	}

}