// JavaScript Document
function  validate(){
if(document.contact.given_name.value==""){
alert("Given Name is required ");
return false;
}
if(document.contact.family_name.value==""){
alert("Family Name is required ");
return false;
}
if(document.contact.contact_number.value==""){
alert("Contact Number is required ");
return false;
}
if(!IsNumeric(document.contact.contact_number.value)){
		alert("Invalid Contact Number!");
		document.contact.contact_number.value='';
		document.contact.contact_number.focus();
		return false;
        }
if(document.contact.email.value==""){
alert("Email Address is required ");
return false;
}
if(!IsNumeric(document.contact.postcode.value)){
		alert("Invalid Postcode Number must be numeric!");
		document.contact.postcode.value='';
		document.contact.postcode.focus();
		return false;
        }
return true;
}
function IsNumeric(sText)

	{
 	 	var ValidChars = "0123456789-.";
   		var IsNumber=true;
  	 	var Char;

 		count = 0;
  	 for (i = 0; i < sText.length && IsNumber == true; i++) 
     	 { 

     	 Char = sText.charAt(i); 
     	 if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
	if(Char.indexOf('.') != -1)
	{
		count++;
		
	}	
      }

if(count > 1)
IsNumber = false;

   return IsNumber;
   }
   

// Step Two function

function  steptwo(){
if(document.contact.best_describes_you.value=="Choose One"){
alert("Best describe to you is required ");
return false;
}
if(document.contact.where_are_you_at.value=="Choose One"){
alert("Where are  you at is required ");
return false;
}
if(!IsNumeric(document.contact.what_youd_like_borrow.value)){
		alert("Invalid Data must be numeric!");
		document.contact.what_youd_like_borrow.value='';
		document.contact.what_youd_like_borrow.focus();
		return false;
        }
if(!IsNumeric(document.contact.deposit_you_have.value)){
		alert("Invalid Data must be numeric!");
		document.contact.deposit_you_have.value='';
		document.contact.deposit_you_have.focus();
		return false;
        }
}


// Step Three function


function  stepthree(){
if(document.contact.annual_income.value==""){
alert("Annual income is required ");
return false;
}
if(!IsNumeric(document.contact.annual_income.value)){
		alert("Invalid Data must be numeric!");
		document.contact.annual_income.value='';
		document.contact.annual_income.focus();
		return false;
        }
if(document.contact.regular_payments.value==""){
alert("Regular payments is required ");
return false;
}
if(!IsNumeric(document.contact.regular_payments.value)){
		alert("Invalid Data must be numeric!");
		document.contact.regular_payments.value='';
		document.contact.regular_payments.focus();
		return false;
        }
if(document.contact.credit_cards_limit.value==""){
alert("Credit card limit is required ");
return false;
}
if(!IsNumeric(document.contact.credit_cards_limit.value)){
		alert("Invalid Data must be numeric!");
		document.contact.credit_cards_limit.value='';
		document.contact.credit_cards_limit.focus();
		return false;
        }
}