
function checkpass(pass1,pass2)
{
	if(pass1 != pass2)
		return false;
	else
		return true;
}

//FUNCTION FOR TRIM THE VALUE
//FUNCTION FOR TRIM THE VALUE
//FUNCTION FOR TRIM THE VALUE

function Trim(TRIM_VALUE)
{
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function


function checknumber(number)
{
	if(!isNaN(number) & Trim(number)!="")
	{
		return true;
	}
	else 
	{
		return false;
	}
}




function postcheck(ps)
{ 
	test = ps;
	size = test.length
	test = test.toUpperCase(); 

	while (test.slice(0,1) == " ") 
	{
		test = test.substr(1,size-1);size = test.length
	}
	while(test.slice(size-1,size)== " ") 
	{
		test = test.substr(0,size-1);size = test.length
	}
	
	if (size < 6 || size > 8)
	{ 
		//alert(test + " is not a valid postcode - wrong length");
		//document.details.pcode.focus();
		return false;
	}

	
	if (!(isNaN(test.charAt(0))))
	{ 
		//alert(test + " is not a valid postcode - cannot start with a number");
		//document.details.pcode.focus();
		return false;
	}

	if (isNaN(test.charAt(size-3)))
	{ 
		//alert(test + " is not a valid postcode - alpha character in wrong position");
		//document.details.pcode.focus();
		return false;
	}

	if (!(isNaN(test.charAt(size-2))))
	{ 
		//alert(test + " is not a valid postcode - number in wrong position");
		//document.details.pcode.focus();
		return false;
	}

	if (!(isNaN(test.charAt(size-1))))
	{ 
		//alert(test + " is not a valid postcode - number in wrong position");
		//document.details.pcode.focus();
		return false;
	}
	
	if (!(test.charAt(size-4) == " "))
	{
		//alert(test + " is not a valid postcode - no space or space in wrong position");
		//document.details.pcode.focus();
		return false;
	}
	
	count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
	
	if (count1 != count2)
	{
		//alert(test + " is not a valid postcode - only one space allowed");
		//document.details.pcode.focus();
		return false;
	}
	//alert("Postcode Format OK");
	return true;
	
}


function CheckPhoneNumber(fi)
{

    var TheNumber = fi;
	//document.createnew.Phone.value
	var valid = true
	var GoodChars = "0123456789()-+. "
	var i = 0
	if (TheNumber=="") {
		// Return false if number is empty
		valid = false
	}
	for (i =0; i <= TheNumber.length -1; i++) {
		if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
// Note: Remove the comments from the following line to see this
// for loop in action.
// alert(TheNumber.charAt(i) + " is no good.")
			valid = false
		} // End if statement
	} // End for loop
	return  valid
}

function checkemail(em)   //Email validation 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(em))
 	return true
 	else
 	return false
}

