function deleteBlanks_1(entry)
{
	var len = entry.length ;
	var foundBlank = 1;
	while(foundBlank == 1 && len > 0) 
	{
		var indx = entry.indexOf(" ");
		if(indx == -1) 
			foundBlank = 0 ;
		else
			entry = entry.substring(0,indx) + entry.substring(indx+1,len);
		len = entry.length;
	}
	return entry;
}
function isValidText(frmElement, fieldName) {
	myRegExp = new RegExp("[^a-z,0-9,\\s,\\']", "i"); 
	if(myRegExp.test(frmElement.value)) {
		alert("Special characters not allowed in " + fieldName);
		frmElement.focus();
		frmElement.select();
		retVal = false;
	}
	else {
		retVal = true;
		}
	return retVal;
}
function isEmpty_1(val,valName)
{
	if (!deleteBlanks_1(val.value))
	{
		alert(valName + " is required");
		val.focus();
		return false;	
	}
	return true;
}

function isTel_1(val1,val2,val3,valName)
{
	inv=0;
	v=val1.value+val2.value+val3.value;
	if (v!="")
	{
		if (v.length<10)
			inv=1;
		for (var i=0;i<v.length && inv==0;i++)
		{
			if ( v.charAt(i)<"0" || v.charAt(i)>"9")
				inv=1;
		}
		if (inv==1)
		{
			alert (valName + " is invalid")
			val1.focus();
			val1.select();
			return false;
		}
	}
	return true;
}

function isEmail_1(val) {
	retVal = true; 
	tmp = val.value;
	if (isEmpty_1(val,"Email Address")) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(tmp)){
			retVal = true;	
		}
		else{
			alert("Email Address is invalid")
			val.focus();
			val.select();
			retVal = false;	
		}
	}
	else {
		retVal = false;
	}	
	return retVal;
}


function redirect() {
	
	if(!isEmpty_1(document.left_contact.name1,"Name"))
		return false;
	if(!isValidText(document.left_contact.name1,"Name")) 
			return false;
	if ( (!deleteBlanks_1(document.left_contact.telephone1.value)) && (!deleteBlanks_1(document.left_contact.telephone2.value)) && (!deleteBlanks_1(document.left_contact.telephone3.value)) )
	{
		alert("Phone is required");
		document.left_contact.telephone1.focus();
		return false;	
	}

	if(!isTel_1(document.left_contact.telephone1,document.left_contact.telephone2,document.left_contact.telephone3,"Phone"))
		return false;
	
	if(!isEmail_1(document.left_contact.email))
		return false;
	
	//document.left_contact.submit();
	return true;
}