/* author: ivanterz */
/* Creation date: 19.5.2006 ã. */

/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
		
var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox


function choise_action(form_action)
{
	form_target="";
	form_action1="";
	//window.alert(document.calculator.send_btn.value);
	/*if(document.calculator.send_btn.value==3)
	{
		form_action1="calculators/"+form_action+"_text.php";
		window.alert(form_action);
		form_target="_blank";
	}*/
	document.calculator.target=form_target;
	if(form_action1!="") document.calculator.action=form_action1;
	
	
}
function NewWin(objpath,w,h)

{
h=150;
window.open(objpath,"",'scrollbars=1, resizable=1, width=' +w+ ',height=' +h+ ',left=500,top=400');
}	
function div_overflow()
{
	if(document.getElementById('div_content_table'))document.getElementById('div_content_table').style.overflow = 'auto';
}
function send_first_form(location)
	{
		
		if(document.first_form.property_state.value==0)
		{
			window.alert("Please select the Property State");
			return false;
		}else
		{
			switch (document.first_form.leads_type.value)
			{
				case '1':
					document.first_form.action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.first_form.action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.first_form.action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.first_form.action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
				default :
				window.alert("Please select the Loan Type");
				return false;
			}
		}
	}
function hide_field()
{
	if(document.getElementById("disclimer").style.display=='')document.getElementById("disclimer").style.display='none';
	else document.getElementById("disclimer").style.display='';
}
//tova e izpolzva pri refinanse za skrivane i pokazvane na dopalnitelnite poleta
function hide_field_1(v)
{
	//window.alert(v);
	if(document.getElementById(v).checked)
	{
		document.getElementById("hide_7").style.display='';
		document.getElementById("hide_8").style.display='';
		document.getElementById("have_sec_mortgage").value='on';
	}else
	{
		document.getElementById("hide_7").style.display='none';
		document.getElementById("hide_8").style.display='none';
		document.getElementById("have_sec_mortgage").value='false';
	}
	//window.alert(document.getElementById("have_sec_mortgage").value);
}
function hide_field_12()
{
	 //window.alert("test"+document.forms[0].have_sec_mortgage.checked);
	if(document.forms[0].have_sec_mortgage.checked)
	{
		document.getElementById("hide_7").style.display='';
		document.getElementById("hide_8").style.display='';
	}
}
//kraj na tazi 4ast

//tova e za skrivane pri home purchase

function hide_field_2(v)
{
	if(v.value==1)
	{
		document.getElementById("hide_5").style.display='';
		v.value=1;
	}else
	{
		document.getElementById("hide_5").style.display='none';
		v.value=0;
	}
	//window.alert(document.getElementById("have_sec_mortgage").value);
}
function hide_field_22()
{
	
	if(document.forms[0].agent_found.value==1)
	{
		document.getElementById("hide_5").style.display='';
		//document.getElementById("hide_8").style.display='';
	}else document.getElementById("hide_5").style.display='none';
}

function hide_field_3(v)
{
	if(v.value==1)
	{
		document.getElementById("hide_3").style.display='';
		v.value=1;
	}else
	{
		document.getElementById("hide_3").style.display='none';
		v.value=0;
	}
	//window.alert(document.getElementById("have_sec_mortgage").value);
}
function hide_field_33()
{
	
	if(document.forms[0].agent_found.value==1)
	{
		document.getElementById("hide_3").style.display='';
		//document.getElementById("hide_8").style.display='';
	}else document.getElementById("hide_3").style.display='none';
}
//end na scrivaneto

//proverki za telephone
function isValidPhoneNPA(strNPA) {
	if (strNPA.length < 3) { return false; }
	if (/[^0-9]/.test(strNPA)) { return false; }
	if (/^[01]/.test(strNPA)) { return false; }
	if ("200,222,300,333,400,444,500,555,600,666,700,777,900,999".indexOf(strNPA) != -1) { return false; }
	return true;
}
function isValidPhoneNXX(strNXX) {
	if (strNXX.length < 3) { return false; }
	if (/[^0-9]/.test(strNXX)) { return false; }
	if (/^[01]/.test(strNXX)) { return false; }
	return true;
}
function isValidPhoneNXXX(strNXX) {
	if (strNXX.length < 4) { return false; }
	if (/[^0-9]/.test(strNXX)) { return false; }
	return true;
}
//za 4islo
function js_check_value_numeric(val,val_min,val_max){
	var objRegExp  =/(^-?\d\d*$)/;
	if(val>=val_min && val<=val_max)return objRegExp.test(val);
	else return false;
}

function validateInteger( strValue ) {
/************************************************
DESCRIPTION: Validates that a string contains only
    valid integer number.

PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid, otherwise false.
******************************************************************************/
  var objRegExp  = /(^-?\d\d*$)/;

  //check for integer characters
  return objRegExp.test(strValue);
}
function js_check_value_char(val,val_min,val_max){
	if(val.length>=val_min && val.length<=val_max)return true;
	else return false;
}
function js_check_value_mail(val,val_min,val_max){
	var objRegExp  =/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
	return objRegExp.test(val);
}
function validateEmail( strValue) {
var objRegExp  =/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;

  //check for valid email
  return objRegExp.test(strValue);
}
function send_pl_step2()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else return true;
		}else return true;
}
function send_pl_step3()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else return true;
		}else return true;
}
function send_p2_step2()
{
	//window.alert("test"+document.getElementById("estimated_value_of_property").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				
				if(document.getElementById("have_sec_mortgage").value != 'false')
				{
					//window.alert("test"+document.getElementById("have_sec_mortgage").value);
					check_box_err="";
					if(js_check_value_numeric(document.getElementById("second_mortgage_balance").value,1,5000000)==false)
					{
						check_box_err+="The information in the 'Second Mortgage Balance' field is incorrect. Please correct!\r\n";
					}
					if(js_check_value_numeric(document.getElementById("second_mortgage_rate").value,1,100)==false)
					{
						check_box_err+="The information in the 'Second Mortgage Interest Rate' field is incorrect. Please correct!\r\n";
					}
					
					if(check_box_err!='')
					{
						window.alert(check_box_err);
						return false;
						check_box_err='';
					}else 
					{
						
					}
				}else{
					document.getElementById("second_mortgage_balance").value=0;
					document.getElementById("second_mortgage_rate").value=0;
				}
				all_ball=parseInt(document.getElementById("second_mortgage_balance").value)+parseInt(document.getElementById("first_mortgage_balance").value);
					if (all_ball>=document.getElementById("estimated_value_of_property").value){
					alert("The sum of the first and second mortgage should not exceed the value of the property. Please correct!");
					return false;
					}else return true;
			}
			//return true;
		}else return true;
}
function send_p2_step3()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else return true;
		}else return true;
}
function send_p3_step2()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				
				if(document.getElementById("have_sec_mortgage").value != 'false')
				{
					//window.alert("test"+document.getElementById("have_sec_mortgage").value);
					check_box_err="";
					if(js_check_value_numeric(document.getElementById("second_mortgage_balance").value,1,5000000)==false)
					{
						check_box_err+="The information in the 'Second Mortgage Balance' field is incorrect. Please correct!\r\n";
					}
					if(js_check_value_numeric(document.getElementById("second_mortgage_rate").value,1,100)==false)
					{
						check_box_err+="The information in the 'Second Mortgage Interest Rate' field is incorrect. Please correct!\r\n";
					}
					if(check_box_err!='')
					{
						window.alert(check_box_err);
						return false;
						check_box_err='';
					}else 
					{
						
					}
				}else{
					document.getElementById("second_mortgage_balance").value=0;
					document.getElementById("second_mortgage_rate").value=0;
				}
				all_ball=parseInt(document.getElementById("second_mortgage_balance").value)+parseInt(document.getElementById("first_mortgage_balance").value);
					if (all_ball>=document.getElementById("estimated_value_of_property").value){
					alert("The sum of the first and second mortgage should not exceed the value of the property. Please correct!");
					return false;
					}else return true;
			}
			//return true;
		}else return true;
}
function send_p3_step3()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else return true;
		}else return true;
}
function send_p4_step2()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				
				if(document.getElementById("have_sec_mortgage").value != 'false')
				{
					//window.alert("test"+document.getElementById("have_sec_mortgage").value);
					check_box_err="";
					if(js_check_value_numeric(document.getElementById("second_mortgage_balance").value,1,5000000)==false)
					{
						check_box_err+="The information in the 'Second Mortgage Balance' field is incorrect. Please correct!\r\n";
					}
					if(js_check_value_numeric(document.getElementById("second_mortgage_rate").value,1,100)==false)
					{
						check_box_err+="The information in the 'Second Mortgage Interest Rate' field is incorrect. Please correct!\r\n";
					}
					if(check_box_err!='')
					{
						window.alert(check_box_err);
						return false;
						check_box_err='';
					}else 
					{
						
					}
				}else{
					document.getElementById("second_mortgage_balance").value=0;
					document.getElementById("second_mortgage_rate").value=0;
				}
				all_ball=parseInt(document.getElementById("add_cash").value)+parseInt(document.getElementById("second_mortgage_balance").value)+parseInt(document.getElementById("first_mortgage_balance").value);
					if (all_ball>=document.getElementById("estimated_value_of_property").value){
					alert("The sum of the First and Second Mortgage and Additional Cash should not exceed the value of the property. Please correct!");
					return false;
					}else return true;
			}
			//return true;
		}else return true;
}
function send_p4_step3()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else return true;
		}else return true;
}
function send_pl_step1()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}
		}else {
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}

}//end function

function send_p2_step1()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}
		}else {
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}

}//end function
function send_p3_step1()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}
		}else {
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}

}//end function
function send_p4_step1()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}
		}else {
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}
			return true;
			}

}//end function

function loadXMLContentPost(url) {
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest;
		req.open("POST", "https://www.leadpointdelivery.com/4659/direct.ilp", true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.onreadystatechange = processSendData;
		req.send(url);
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
			req.open("POST","https://www.leadpointdelivery.com/4659/direct.ilp" , true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
            req.onreadystatechange = processSendData;
            req.send(url);
			
        }
    }
}

function processSendData() {
alert ("test: " + req.readyState);
	 if (req.readyState == 4) {
        if (req.status == 200) {
			alert(req.responseText);
			}
		}
}
function validate_zip(zip_id,id_state_elem)
{
var zip=""+document.getElementById(zip_id).value;
if (zip.length < 5) { return false; }
else 
{
	if (/[^0-9]/.test(zip)){ return false; }
	else return true
}
/*var arr_zip=new Array();
arr_zip['AL']="35004-36925";
arr_zip['AK']="99501-99950";
arr_zip['AZ']="85001-86556";
arr_zip['AR']="71601-72959,75502-75502";
arr_zip["CA"]="90001-96162";
arr_zip["CO"]="80001-81658";
arr_zip["CT"]="06001-06389,06401-06928";
arr_zip["DE"]="19701-19980";
arr_zip["DC"]="20001-20039;20042-20599;20799-20799";
arr_zip["FL"]="32501-32509;33124-33190;32801-32837";
arr_zip["GA"]="30301-31999,39901-39901";
arr_zip["HI"]="96701-96898";
arr_zip["ID"]="83201-83876";
arr_zip["IL"]="60001-62999";
arr_zip["IN"]="46001-47997";
arr_zip["IA"]="50001-52809;68119-68120";
arr_zip["KS"]="66002-67954";
arr_zip["KY"]="40003-42788";
arr_zip["LA"]="70001-71232;71234-71497";
arr_zip["ME"]="03901-04992";
arr_zip["MD"]="20331-20331;20335-20797";
arr_zip["MA"]="02101-02137";
arr_zip["MI"]="49036-49036;49734-49735;20812-21930";
arr_zip["MN"]="55001-56763";
arr_zip["MS"]="38601-39776;71233-71233";
arr_zip["MO"]="63001-65899";
arr_zip["MT"]="59001-59937";
arr_zip["NE"]="68001-68118;68122-69367";
arr_zip["NV"]="88901-89883";
arr_zip["NH"]="03031-03897";
arr_zip["NJ"]="07001-08989";
arr_zip["NM"]="87001-88441";
arr_zip["NY"]="06390-06390;10001-14975";
arr_zip["NC"]="27006-28909";
arr_zip["ND"]="58001-58856";
arr_zip["OH"]="43001-45999";
arr_zip["OK"]="73001-73199;73401-74966";
arr_zip["OR"]="97001-97920";
arr_zip["PA"]="15001-19640";
arr_zip["RI"]="02801-02940";
arr_zip["SC"]="29001-29948";
arr_zip["SD"]="57001-57799";
arr_zip["TN"]="37010-38589";
arr_zip["TX"]="73301-73301;75001-75501;75503-79999;88510-88589";
arr_zip["UT"]="84001-84784";
arr_zip["VT"]="05001-05495;05601-05907";
arr_zip["VA"]="20040-20167;22001-24658";
arr_zip["WA"]="98001-99403";
arr_zip["WV"]="24701-26886";
arr_zip["WI"]="53001-54990";
arr_zip["WY"]="82001-83128";
st=document.getElementById(id_state_elem).value;
if(st==0) {return false;}
else{
	var f=false;
	zip_str=arr_zip[st];
	s=zip_str.split(";");
	for(i=0;i<s.length;i++)
	{
		tstr=s[i];
		arr_z=tstr.split("-");
		if(parseInt(zip)>=parseInt(arr_z[0]) && parseInt(zip) <= parseInt(arr_z[1])) f=true
		
		
	}
}
if(f) return true;
else return false;*/
}

function ValidName(strName) {
	if (/[^A-Za-z -]/.test(strName)) { return false; }
	return true;
}

function ValidStreetAddress(strAddress) {
	if (strAddress.length < 3) { return false; }
	if (strAddress.replace(/[^0-9]/g, "").length < 1) { return false; }
	if (strAddress.replace(/[^A-Za-z]/g, "").length < 1) { return false; }
	return true;
}

function ValidCity(strCity) {
	if (strCity.length < 2) { return false; }
	if (/[^A-Za-z -]/.test(strCity)) { return false; }
	return true;
}

function send_p6_step1()
{
	//window.alert("test"+document.getElementById("nav").value);
		if(document.getElementById("nav").value==1)
		{
			if(js_check_form_field_value()==true)return false;
			else 
			{
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				default: return true
			}
				/*case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}*/
			return true;
			}
		}else {
				switch (document.getElementById("leads_type").value)
			{
				case 0:
					window.alert("Please select the loan type");
					return false;
				break;
				default: return true
			}
				/*case '1':
					document.forms[0].action="https://www.ritequote.com/mortgage/index.php";
					return true
				break;
				case '2':
					document.forms[0].action='https://www.ritequote.com/refinance/index.php';
					return true
				break;
				case '3':
					document.forms[0].action='https://www.ritequote.com/home-equity/index.php';
					return true
				break;
				case '4':
					document.forms[0].action='https://www.ritequote.com/debt-consolidation/index.php';
					return true
				break;
			}*/
			return true;
			}

}//end function


function XmlGetRefferer(url) {
	 if (window.XMLHttpRequest) {
        req = new XMLHttpRequest;
		req.open("GET",url , false);
		req.onreadystatechange = processSendRef;
		req.send(url);
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
			req.open("GET",url , true);
			  req.onreadystatechange = processSendRef;
            req.send(url);
			
        }
    }
}

function processSendRef() {
//alert ("test: " + req.readyState);
	 if (req.readyState == 4) {
        if (req.status == 200) {
			//alert(req.responseText);
			}
		}
}
//propertyStateCode,typeOfLoan,propertyDesc
function check_form_qh(f){

	var err='';
	var check_state=js_check_value_char(f.credit_card_debt.value,1,50);
	if(!check_state) err="Please Select Select How much Credit Card debt do you have! \n";
	if(f.cc_debt.checked==false && f.tax_debt.checked==false && f.sl_debt.checked==false && f.oth_debt.checked==false){
	err+="Please Select Select What types of debt do you have! \n";
	}

	if(err.length>0){
		alert(err);
		return false;
	}
	else return true;
}
function rollover(atag) {
	var node;
	if (!atag.nodeName) {
		return true;
	} 
	
	// Buttons
	if (atag.nodeName == 'INPUT') {
		if (atag.className == 'button') { atag.className = 'button-hover'; } 
		else if (atag.className == 'button-hover') {atag.className = 'button'; } 
	}
	
	// image rollovers
	for (i = 0; i < atag.childNodes.length; i++) {
    node = atag.childNodes[i];
    if (node.nodeName == 'IMG') {
      if (node.src.indexOf('Off') != -1) { node.src = node.src.replace('Off.', 'On.');}	
	  else { node.src = node.src.replace('On.','Off.');}
    }
  }
}

function hide_form(g,cl){
	if(document.getElementById(cl).className=='solution_contract'){
	document.getElementById(cl).className='solution_expand';
	document.getElementById(g).innerHTML="Find Solution";}
	else{
	document.getElementById(cl).className='solution_contract';
	document.getElementById(g).innerHTML="Minimize Form";
	}
}

function hide_shoo_pm(elem_parent,elem_id)
	{
		var elem=document.getElementById(elem_id);
		if(elem.style.display=='none') {
			elem.style.display='';
			elem_parent.style.background="#CEE7FF";
		}
		else {
			elem.style.display='none';
			elem_parent.style.background="#E2E2E2";
		}
	}

function change_bckgr(elem,bckgr){
		elem.style.background=bckgr;
}

function check_step()
{
	step_form++;
	//if(step_form>3 && ip_user!=""){
	//alert("https://www.quoteshound.com/tracker/check_ip.php?ip_user="+ip_user);
		XmlGetTanks("https://www.debtreliefexplorer.com/tracker/check_ip.php?ip_user="+ip_user); 
	
}
function top_submit(f){
		if(check_form_qh(f)){
			document.t_form.action=url_main_site+"/apply.php";
			document.h_form_0.action=url_main_site+"/apply.php";
		document.h_form_1.action=url_main_site+"/apply.php";
			}
			else return false;
		}

