function emailIsValid(str){
	if( str.indexOf("@") < 1 || str.indexOf(".") < 1 )
		return false;
	return true;
}

function parsePhone(str){
	var newStr = "";
	for( x=0; x<str.length; x++ ){
		theNum = str.charAt(x);
		if( theNum <= "9" && theNum >= "0" )
		newStr = newStr +  theNum;
	}

	return newStr;
}

function trim(str){
	while( str.charAt(0) == " " ){
		str = str.substr(1,str.length)
	}
	return str;
}

function verifyNonBlank(fArray,dArray,theForm){
	var message = "";
	for( i=0; i<fArray.length; i++ ){
		field = eval("theForm." + fArray[i]);
		field.value = trim(field.value);
		if( field.value == "" )
			message = message + "\n " + dArray[i] + " cannot be blank";
	}
	return message;
}

function isInteger(str){
	newStr = parseInt(str);

	if( newStr != str )
		return false;

	return true;
}

function isFloat(str){
	newStr = parseFloat(str);

	if( str != newStr )
		return false;

	return true;
}

function isDate(str){
	var dateObj = new Date(str);

	if (isNaN(dateObj.valueOf()))
		return false;

	return true;
}
