/* 
	Function is used to check if a password is valid
	letters, numbers, min 6
*/
function IsCalendarPassword(thevalue)
{
	var password = /^[A-Za-z0-9]{6,}$/;
		
	return password.exec(thevalue);
}
		
/*
	Function is used to check if the value is in
	a decimal format
	xx.x|xx.xx|x.xxx etc
*/
function IsDecimal(thevalue)
{
	var decimal = /^\d+\.\d+$/;

	return decimal.exec(thevalue);
}

/* 
	Function is used to check a comments or description 
	field
	minimum 4 letters or characters (following by a line return and more characters) zero or more iterations
*/
function IsDescription(thevalue)
{
	var description = /^.{4,}([\u000A\u000D]*.+)*$/;
	
	return description.exec(thevalue);
}

/* 
	Function is used to check a email address
	simple validation
*/
function IsEmail(thevalue)
{
	var email = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
		
	return email.exec(thevalue);
}


/* 
	Function is used to check if the extension of an file is
	.doc, .txt, .pdf, .ppt, .xls, .zip
*/
function IsFileExtension(thevalue)
{
	var file_ext = /^\.doc$|^\.txt$|^\.pdf$|^\.ppt$|^\.xls$|^\.zip$/;
		
	return file_ext.exec(thevalue);
}


/* 
	Function is used to check if the extension of an file is
	a .pdf
*/
function IsFileExtensionPDF(thevalue)
{
	var file_ext = /^\.pdf$/;
		
	return file_ext.exec(thevalue);
}

/* 
	Function is used to check if the extension of an image file is
	.jpg
	or
	.gif
*/
function IsImageExtension(thevalue)
{
	var image = /^\.jpg$|^\.gif$/;
		
	return image.exec(thevalue);
}

/*
	Function is used to check if the value is in number format
	xxxx (numbers only)
*/
function IsNumber(thevalue)
{
	var number = /^\d+$/;
		
	return number.exec(thevalue);
}

/* 
	Function is used to check if a password is valid
	letters, numbers, min 5
*/
function IsPassword(thevalue)
{
	var password = /^[A-Za-z0-9]{5,}$/;
		
	return password.exec(thevalue);
}
		
		
/* 
	Function is used to check a phone number
	can be 10 digit phone number separated by dashes, 
	spaces or no separator 
*/
function IsPhone(thevalue)
{
	var number = /^\d{3}\s\d{3}\s\d{4}$|^\d{3}-\d{3}-\d{4}$|^\d{10}$|^\d{3}\s\d{3}\s\d{4}\sext\s\d{1,4}$|^\d{3}-\d{3}-\d{4}\sext\s\d{1,4}$|^\d{10}\sext\s\d{1,4}$/;
		
	return number.exec(thevalue);
}

/*
	Function is used to check if the value is in
	a postal code format
	@#@ #@# 
	 D, F, I, O, Q and U not used
	 H0H 0H0 is special for santa
*/
function IsPostalCode(thevalue)
{
	var postal = /^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\d[ABCEGHJKLMNPRSTVXYZabceghjklmnprstvxyz]\s\d[ABCEGHJKLMNPRSTVXYZabceghjklmnprstvxyz]\d$|^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\d[ABCEGHJKLMNPRSTVXYZabceghjklmnprstvxyz]\d[ABCEGHJKLMNPRSTVXYZabceghjklmnprstvxyz]\d$/;
	
	if ((thevalue == "H0H 0H0") || (thevalue == "HOH OHO"))
		return false;
		
	return postal.exec(thevalue);
}

/*
	Function is used to check if the value is in
	a price format
	x(+)|xx.x|xx.xx
*/
function IsPrice(thevalue)
{
	var number = /^\d+$|^\d+\.\d{1,2}$/;
	
	return number.exec(thevalue);
}
		

/* 
	Function is used to check a toll free phone number
	can be 11 digit phone number separated by dashes, 
	spaces or no separator 
*/
function IsTollFree(thevalue)
{
	var number = /^\d{1}\s\d{3}\s\d{3}\s\d{4}$|^\d{1}-d{3}-\d{3}-\d{4}$|^\d{11}$/;
		
	return number.exec(thevalue);
}

		
/* 
	Function is used to check if a username is valid
	letters, numbers, min 5
*/
function IsUsername(thevalue)
{
	var username = /^[A-Za-z0-9]{5,}$/;
		
	return username.exec(thevalue);
}


/* 
	Function is used to check if a url is valid
	NEED TO FINISH
*/
function IsURL(thevalue)
{
	var url = /^[\w-\.]+([\w-]+\.)+[\w-]{2,4}$/;
		
	//return username.exec(thevalue);
	return true;
	
}

/*
	Function is used to check if a value is 
	a word (consists only of letters, upper or lower case)
*/
function IsWord(thevalue)
{
	var word = /^[A-Za-z\.\']+$/;
		
	return word.exec(thevalue);
}

/* 
	Function is used to check if a string is valid
	minimum 1 or more letters or numbers
*/
function IsWordNumber(thevalue)
{
	var wordnumber = /^[A-Za-z0-9\s\.\']+$/;
		
	return wordnumber.exec(thevalue);
}

/*
	Function is used to check if a value is 
	a word (consists only of letters, upper or lower case or spaces)
*/
function IsWordSpace(thevalue)
{
	var word = /^[A-Za-z\s\.\']+$/;
		
	return word.exec(thevalue);
}

/*
	Function is used to check if a value is 
	a word with special charcters (consists only of letters, upper or lower case or spaces, -, &, /,,!,? )
*/
function IsWordSpecial(thevalue)
{
	var word = /^[A-Za-z\s\.\<\>\!\&\?\,\*\:\;\-\_\&\(\)\'\/]+$/;
		
	return word.exec(thevalue);
}

/*
	Function is used to check if a value is 
	a word/number with special charcters (consists only of letters, digits, upper or lower case or spaces, -, &, /,,!,? )
*/
function IsWordNumberSpecial(thevalue)
{
	var word = /^[A-Za-z0-9\s\.\<\>\!\&\?\$\,\*\:\;\-\_\&\(\)\'\/]+$/;
		
	return word.exec(thevalue);
}




