/* 
//Validation Rules that need convertin into javascript
static private Regex AllNumericRex = new Regex("^[0-9]+$");
static private Regex AllAlpha_n_WhiteRex = new Regex("^[a-zA-Z ]+$");						//single space included
static private Regex AlphaNumericRex = new Regex("^[0-9a-zA-Z]+$");	//single space included
	*/	
		
function Regex(FieldName, InputString, RegularExpression) 
{
	//alert("FieldName : " + FieldName + ", InputString : " + InputString + ", RegularExpression : " +RegularExpression);
	if(RegularExpression.test(InputString))
	{
		//alert(FieldName + ' Failed!');
		return false;
	}
	return true;	
}

function SQLCharFilter(Input)
{
	Input = Input.replace('\'','\'\'');
	Input = Input.replace('>','');
	Input = Input.replace('<','');
	return Input;
}

function IsNumeric(Input)
{
	strValidChars = "0123456789";
    if (strValidChars.indexOf(Input) == -1)
    {
		return false;
    }
    return true;
}

//Remove Errors once user has made a change
function RemoveErrorText(UserInputInQuestion)
{
	CheckIfElementExists = document.getElementById(UserInputInQuestion);
	if (CheckIfElementExists)
		CheckIfElementExists.innerHTML = '&nbsp;';
}

//js Regular Expressions
var NameRegex = /[^a-zA-Z0-9&\-\'/. ]/;						// single space included
var TitleRegex = /[^a-zA-Z0-9&\-\'/. ]/;						// single space included
var CompanyNameRegex = /[^a-zA-Z0-9&\-\'/. ]/;						// single space included
var PhoneRegex = /[^0-9extEXT)(\-=+ .]/;						// single space included
var ShippingCommentsRex = /[^a-zA-Z0-9\n\r&\-\'/. ,#\?!]/;		// single space included
var CountryRex = /[^a-zA-Z .]/;									// single space included
var PONumber =	 /[^a-zA-Z0-9&\-\'/. ,]/;						// single space included
var AddressRex = /[^0-9a-zA-Z+-/\\'\\.\\(\\),; :#&]/;			// single space included 
var AddressLine2Rex =  /[^0-9a-zA-Z+-/\\'\\.\\(\\),; :#&]/;		// single space included
var EmailRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
var PassWordRegex = /^[0-9a-zA-Z-\'`~\$\*\+\[\|\]\^\(\)\{\}\?!@#%&_=:\",]+$/;
var ZipCodeRex = /[^a-zA-Z0-9\-]/;
var CityRex = /[^a-zA-Z- ]/;	
var StateRex = /[^a-zA-Z ]/;	
var AllNumericRex = /[^0-9]/;

//js Validation Messages 
var GL_EmailMsg =				'&nbsp;&nbsp;The Email field is required and may only contain alphanumeric characters and the following: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> @ _ - .</font>';
var GL_EmailInUseMsg =			'&nbsp;&nbsp;email you entered is already in use, please choose another one.';
var GL_NameMsg =				'&nbsp;&nbsp;The Name field is required and may only contain alphanumeric characters, spaces and the following characters: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> . \' - & /</font>';
var GL_TitleMsg =				'&nbsp;&nbsp;The Title field is required and may only contain alphanumeric characters, spaces and the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> . \' - & /</font>';
var GL_CompanyNameMsg =			'&nbsp;&nbsp;The Company Name field is required and may only contain alphanumeric characters, spaces and the following characters: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> . \' - & /</font>';
var GL_ShipAttentionToMsg =		'&nbsp;&nbsp;The Ship Attention To field is not required but may only contain alphanumeric characters, spaces and the following characters: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> . \' - & /</font>';
var GL_ShippingCommentsMsg =	'&nbsp;&nbsp;The Shipping Comments field may only contain alphanumeric characters, spaces and the following characters: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> # . \' - & ? , !</font>';
var GL_ContactNameMsg =			'&nbsp;&nbsp;The Contact Name field is required and may only contain alphanumeric characters, spaces and the following characters: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> . \' - & /</font>';
var GL_ContactPhoneNumber =		'&nbsp;&nbsp;The Contact Phone Number field is required and may only contain numeric characters, the letter \'x\' or \'ext.\' for extensions or the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> ) ( - = + .</font>';
var GL_AddressMsg =				'&nbsp;&nbsp;The Address field is required and may only contain alphanumeric characters, spaces and the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> . \' - , ; : # & + ) (</font>';
var GL_SecondAddrMsg =			'&nbsp;&nbsp;The Second Address field is not required but may only contain alphanumeric characters, spaces and the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> . \' - , ; : # & + ) (</font>';
var GL_PassWordMsg =			'&nbsp;&nbsp;The Password field is required and may only contain alphanumeric characters and the following: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> ` ~ ! @ # $ % ^ & * ( ) _ + - = { } | [ ] : \' ? , /</font>';
var GL_NotSamePassWordsMsg =	'&nbsp;&nbsp;The new passwords you entered do not match, please re-enter them.';
var GL_PasswordInvalidMsg =		'&nbsp;&nbsp;The Password you entered does not match your current password please re-enter your password.';
var GL_ShippinPhoneMsg =		'&nbsp;&nbsp;The Shipping Phone Number field is not required but may only contain numeric characters, the letter \'x\' or \'ext.\' for extensions or the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> ) ( - = + .</font>';
var GL_BillinPhoneMsg =			'&nbsp;&nbsp;The Billing Phone Number field is required and may only contain numeric characters, the letter \'x\' or \'ext.\' for extensions or the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> ) ( - = + .</font>';
var GL_NonManBillinPhoneMsg =	'&nbsp;&nbsp;The Billing Phone Number field is not required but may only contain numeric characters, the letter \'x\' or \'ext.\' for extensions or the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> ) ( - = + .</font>';
var GL_FaxMsg =					'&nbsp;&nbsp;The Fax Number field is not required but may only contain numeric characters, the letter \'x\' or \'ext.\' for extensions or the following characters: <font size \'2\' font color=\'#000000\' font-bold=\'true\'> ) ( -</font>';
var GL_ZipMsg =					'&nbsp;&nbsp;The Zip Code field may only contain alphanumeric characters and hyphens, no spaces.';
var GL_CountryMsg =				'&nbsp;&nbsp;The Country field is required and may only contain alpha characters, periods, and spaces.';
var GL_StateMsg =				'&nbsp;&nbsp;The State field is required and may only contain alpha characters and spaces.';
var GL_CityMsg =				'&nbsp;&nbsp;The City field is required and may only contain alpha characters, spaces and hyphens.';
var GL_BadLoginMsg =			'&nbsp;&nbsp;You entered either an invalid email address or invalid password.  Please re-enter.';
var GL_PONumber =				'&nbsp;&nbsp;The Purchase Order Number field is required and may only contain alphanumeric characters, spaces and the following characters: <font size=\'2\' font color=\'#000000\' font-bold=\'true\'> . , \' - & /</font>';