/*
	Used for form field validation 
*/
function reqField ( chkField, additionalCheckResult ) 
{						
	if(additionalCheckResult == null) { 
		additionalCheckResult = true;
	}
	
	// Check field valid
	if( chkField.val() == "" || !additionalCheckResult )
	{
		chkField.addClass("error");
		chkField.next().addClass("on");
		validationPass = false;
	}
	else
	{
		chkField.removeClass("error");
		chkField.next().removeClass("on");
	}				
}

function isNumber(chkField) {
  return !isNaN(parseFloat(chkField.val())) && isFinite(chkField.val());
}


//returns true or false based on whether the email address is valid.
//critia: [alphaNumeric,-,~] + [@] + [alphaNumeric,-,~] + [.] + [alphaNumeric,-,~]
function validEmail(theEmail)
{
	//if the email address matches our criteria
	if( theEmail.match(/^[\w'']+([\.-]?[\w'']+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/) )
	{
		//return true
		return true
	}
	else//else if the email address is invalid
	{
		//return false
		return false
	}
}

//this function returns true or false depending on whether a url is valid.
//The criteria required is http://*.*.*
function validURL(theURL)
{
	//if the url matches our criteria
	var regExPattern = "^(ftp|https?)://.+";
	var regex = new RegExp ( regExPattern, "i" );
	if ( theURL.match ( regex ) ) 
	{
		return true
	}
	else//else if the url is invalid
	{
		return false
	}
}
