var agt=navigator.userAgent.toLowerCase();

var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));


function bad_credit_cash_loans_validation()
{
	
var bad_credit_cash_loans_errorlist=new Array();
var bad_credit_cash_loans_errorfields=new Array();

var i=0;
var bad_credit_cash_loans_message;

bad_credit_cash_loans_message="_______________________\n\n";

bad_credit_cash_loans_message=bad_credit_cash_loans_message +"Incomplete form!\n";

bad_credit_cash_loans_message=bad_credit_cash_loans_message +"Please fill the following field(s)!\n";

bad_credit_cash_loans_message=bad_credit_cash_loans_message +"_______________________\n\n";


var bad_credit_cash_loans_focusfield=false;




if(document.getElementById("bad_credit_cash_loans_loanpurpose").value == "")
{

if(bad_credit_cash_loans_focusfield==false)
{
	document.getElementById("bad_credit_cash_loans_loanpurpose").focus();
	bad_credit_cash_loans_focusfield=true;
}

		bad_credit_cash_loans_errorlist[i]="Loan Purpose";
		bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_loanpurpose";
		i=i+1;
}
else
{
document.getElementById("bad_credit_cash_loans_loanpurpose").style.background="white";
if(document.getElementById("bad_credit_cash_loans_loanpurpose").value == "Other")
{
	if(document.getElementById("bad_credit_cash_loans_otherpurpose").value == "")
	{
	if(bad_credit_cash_loans_focusfield==false)
	{
		document.getElementById("bad_credit_cash_loans_otherpurpose").focus();
		bad_credit_cash_loans_focusfield=true;
	}
	
			bad_credit_cash_loans_errorlist[i]="Other Purpose";
			bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_otherpurpose";
			i=i+1;
	}
	else
	{
	document.getElementById("bad_credit_cash_loans_otherpurpose").style.background="white";
	}
}
}
if(document.getElementById("bad_credit_cash_loans_loanamount").value == "")
{

if(bad_credit_cash_loans_focusfield==false)
{
	document.getElementById("bad_credit_cash_loans_loanamount").focus();
	bad_credit_cash_loans_focusfield=true;
}

		bad_credit_cash_loans_errorlist[i]="Loan Amount";
		bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_loanamount";
		i=i+1;
}
else
{
document.getElementById("bad_credit_cash_loans_loanamount").style.background="white";
}


if(document.getElementById("bad_credit_cash_loans_firstname").value == "")
{

if(bad_credit_cash_loans_focusfield==false)
{
	document.getElementById("bad_credit_cash_loans_firstname").focus();
	bad_credit_cash_loans_focusfield=true;
}

	bad_credit_cash_loans_errorlist[i]="First Name";
	bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_firstname";
	i=i+1;
}
else
{
document.getElementById("bad_credit_cash_loans_firstname").style.background="white";
}


if(document.getElementById("bad_credit_cash_loans_surname").value == "")
{

if(bad_credit_cash_loans_focusfield==false)
{
	document.getElementById("bad_credit_cash_loans_surname").focus();
	bad_credit_cash_loans_focusfield=true;
}

	bad_credit_cash_loans_errorlist[i]="Last Name";
	bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_surname";
	i=i+1;
}
else
{
document.getElementById("bad_credit_cash_loans_surname").style.background="white";
}

var temp=new Date();
 var yeartest=temp.getYear()-70;
 if (yeartest<1900)
 {
   yeartest=yeartest+1900;
 }
if(document.getElementsByName("bad_credit_cash_loans_date")[0].value == "01" && document.getElementsByName("bad_credit_cash_loans_month")[0].value == "January" && document.getElementsByName("bad_credit_cash_loans_year")[0].value == yeartest)
{
		bad_credit_cash_loans_errorlist[i]="Date Of Birth";
		bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_date";
		i=i+1;
}

if(document.getElementById("bad_credit_cash_loans_telephone").value == "")
{

if(bad_credit_cash_loans_focusfield==false)
{
	document.getElementById("bad_credit_cash_loans_telephone").focus();
	bad_credit_cash_loans_focusfield=true;
}


		bad_credit_cash_loans_errorlist[i]="Telephone";
		bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_telephone";
		i=i+1;
}
else
{
document.getElementById("bad_credit_cash_loans_telephone").style.background="white";
}

if(document.getElementById("bad_credit_cash_loans_address").value == "")
{

if(bad_credit_cash_loans_focusfield==false)
{
	document.getElementById("bad_credit_cash_loans_address").focus();
	bad_credit_cash_loans_focusfield=true;
}


		bad_credit_cash_loans_errorlist[i]="Full Address";
		bad_credit_cash_loans_errorfields[i]="bad_credit_cash_loans_address";
		i=i+1;
}
else
{
document.getElementById("bad_credit_cash_loans_address").style.background="white";
}


for(i=0;i<bad_credit_cash_loans_errorlist.length;i++)
{
bad_credit_cash_loans_message=bad_credit_cash_loans_message +"   * "+bad_credit_cash_loans_errorlist[i]+"\n";


}


if(bad_credit_cash_loans_errorlist.length==0)
{
return true;
}
else
{
alert(bad_credit_cash_loans_message);

for(i=0;i<bad_credit_cash_loans_errorfields.length;i++)
{
	if (bad_credit_cash_loans_errorfields[i]=="bad_credit_cash_loans_date")
	{
		i++;
	}
	else
	{
//	document.getElementById(bad_credit_cash_loans_errorfields[i]).style.background="#e18d09";
	}
}

return false;
}

}

function displayOther()
{
		if(is_ie)
		{
	
			if (document.getElementById("bad_credit_cash_loans_loanpurpose").value=="Other")
			{
			document.getElementById("otherpurpose").style.display="inline";
			}
			else
			{
			document.getElementById("otherpurpose").style.display="none";
			}
		}
		else
		{
			if (document.getElementById("bad_credit_cash_loans_loanpurpose").value=="Other")
			{
				var purpose=prompt("Please Enter Other Loan Purpose!");
				if (purpose==null || purpose=="")
				{
					purpose="Other";
				}
				document.getElementById("bad_credit_cash_loans_otherpurpose").value=purpose;
				
			}						
		}
		
	
}
function displayLevelPayment()
{
	
}
function displayValue()
{
	
}
function navigateToUS()
{
	if (document.getElementById("bad_credit_cash_loans_country").value=="US")
		{
			document.location.href="bad_credit_cash_loans_for_USA_residents.html";
		}
}