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 checktel(tel,valname)
{
	val1=tel.value;
	if (val1!="")
	{
		for (var i=0;i<val1.length;i++)
		{
			var val = val1.charAt(i);
			if ((val1.length<12 ) || (i!=7 && i!=3 && (val<"0" || val>"9") ) || ( (i==3 || i==7) && val!="-" ))
			{
				alert("Please enter "+ valname + " in the format 999-999-9999");
				tel.focus();
				tel.select();
				return false;
			}
		}
	}
	return true;
}
function isTel(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")
			alert("Please enter "+ valName + " in the format 999-999-9999");
			val1.focus();
			val1.select();
			return false;
		}
	}
	return true;
}
function isEmpty_1(val,valName)
{
	if (!deleteBlanks_1(val.value))
	{
		alert(valName + " is required");
		val.focus();
		return false;	
	}
	return true;
}

function isEmail_1(val)
{
	tmp = val.value;
	if (isEmpty_1(val,"Email Address"))
	{
		if (tmp.indexOf("@")<1 || tmp.indexOf(".")<1 || tmp.indexOf(".")>eval(tmp.length)-3 || tmp.length<6)
		{
			alert("Email Address is invalid")
			val.focus();
			val.select();
			return false;	
		}
	}
	else
		return false;
	return true;
}

function redirect() {
	
	if(!isEmpty_1(document.left_contact.name,"Name"))
		return false;
		
	if(document.left_contact.name.value == "Name"){
		alert("Please Enter 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 Number is required");
		document.left_contact.telephone1.focus();
		return false;	
	}

	if(!isTel(document.left_contact.telephone1,document.left_contact.telephone2,document.left_contact.telephone3,"Phone")) 
		return false;	

	/*if(!checktel(document.left_contact.Phone,"Phone"))
		return false;			*/
	
	if(!isEmail_1(document.left_contact.email))
		return false;
		/*
	if(!isEmpty_1(document.left_contact.needs,"Describe your case"))
		return false;*/
		
	//document.left_contact.submit();
	
	return true;
}



