// JavaScript Document

function form_validation()
{
	var emailValidation = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	
	if(document.getElementById("attorney_name").value=="")
	{
		alert("Please enter Attorney Name");
		document.getElementById("attorney_name").focus();	
		return false;
	}
	
	if(document.getElementById("attorney_phone").value=="")
	{
		alert("Please enter Attorney Phone No.");
		document.getElementById("attorney_phone").focus();	
		return false;
	}
	
	/*if(isNaN(document.getElementById("attorney_phone").value))
	{
		alert("Please enter Numeric Value in Attorney Phone No.");
		document.getElementById("attorney_phone").focus();	
		return false;
	}
	
	if(document.getElementById("attorney_email").value=="")
	{
		alert("Please enter Attorney Email");
		document.getElementById("attorney_email").focus();	
		return false;
	}
	
	if(document.getElementById("attorney_email").value!="")
	{
		if(!(document.getElementById("attorney_email").value.match(emailValidation)))
		{
		alert("Please enter Valid Attorney Email Id.");
		document.getElementById("attorney_email").focus();
		return false;
		}
	}*/
	
	
	if(document.getElementById("borrower_name").value=="")
	{
		alert("Please enter Borrower Name");
		document.getElementById("borrower_name").focus();	
		return false;
	}
	
	
	if(document.getElementById("borrower_phone").value=="")
	{
		alert("Please enter Home Phone No.");
		document.getElementById("borrower_phone").focus();	
		return false;
	}
	
	/*if(isNaN(document.getElementById("borrower_phone").value))
	{
		alert("Please enter Numeric Value in Home phone");
		document.getElementById("borrower_phone").focus();	
		return false;
	}*/
	
	if(document.getElementById("borrower_dob").value=="")
	{
		alert("Please enter Date of Birth");
		document.getElementById("borrower_dob").focus();	
		return false;
	}
	
	if(document.getElementById("borrower_dob").value!="")
	{
		//var re= /^(0[1-9]|[12][0-9]|3[01])\-(0[1-9]|1[012])\-[0-9]{4}/;  dd-mm-yyyy format
		//var re= /^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/;  yyyy-mm-dd format
		var re= /^(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])\-[0-9]{4}/;   //mm-dd-yyyy format
		var el= document.getElementById('borrower_dob');
		var M= el.value.match(re);
		
		if(!M)
		{
			alert("Date of Birth format is wrong");
			document.getElementById("borrower_dob").focus();
			return false;
		}
	}
	
	if(document.getElementById("borrower_cell").value=="")
	{
		alert("Please enter Cell Phone No.");
		document.getElementById("borrower_cell").focus();	
		return false;
	}
	
	/*if(isNaN(document.getElementById("borrower_cell").value))
	{
		alert("Please enter Numeric Value in Cell phone No.");
		document.getElementById("borrower_cell").focus();	
		return false;
	}*/
	
	if(document.getElementById("borrower_address").value=="")
	{
		alert("Please enter Address");
		document.getElementById("borrower_address").focus();	
		return false;
	}
	
	
	/*if(document.getElementById("borrower_incident").value=="")
	{
		alert("Please enter Date of Incident");
		document.getElementById("borrower_incident").focus();	
		return false;
	}
	
	if(document.getElementById("borrower_incident").value!="")
	{
		//var re= /^(0[1-9]|[12][0-9]|3[01])\-(0[1-9]|1[012])\-[0-9]{4}/;
		var re= /^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/;
		var el= document.getElementById('borrower_incident');
		var M= el.value.match(re);
		
		if(!M)
		{
			alert("Date of Incident format is wrong");
			document.getElementById("borrower_incident").focus();
			return false;
		}
	}*/
	
} // end function form_validation



