

function showHide(id) {
	if(id != '' && id != null) {
		id = id.split(',');
		for(var j = 0; j < id.length; j++) {
			var cells = document.getElementsByName(id[j]);
			for(var i = 0; i < cells.length; i++) {
				var mode = cells[i].style.display == 'none' ? '' : 'none';
				var vis = cells[i].style.visibility == 'visible' ? 'hidden' : 'visible';
				cells[i].style.display = mode;
				//cells[i].style.visibility = vis;
			}
		}
	}
}

function show(id) {
	if(id != '' && id != null) {
		id = id.split(',');
		
		for(var j = 0; j < id.length; j++) {
			var cells = document.getElementsByName(id[j]);
			for(var i = 0; i < cells.length; i++) {
				cells[i].style.display = '';
				cells[i].style.visibility = 'visible';
				
			}
		}
	}
}

function hide(id) {
	if(id != '' && id != null) {
		id = id.split(',');
		for(var j = 0; j < id.length; j++) {
			var cells = document.getElementsByName(id[j]);
			for(var i = 0; i < cells.length; i++) {
				cells[i].style.display = 'none';
				cells[i].style.visibility = 'hidden';
			}
		}
	}
}

function showHideGetDocuments(emailTextBox, getDocumentsBtn) {
	if (emailTextBox.value == "" || emailTextBox.value.indexOf('@') < 0 || emailTextBox.value.indexOf('.') < 0)
	{
		alert('Please enter a valid email address');
		emailTextBox.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function RadioHide(radioElements, radioObj)
{
	var radioBtnValue = getCheckedValue(radioElements)
	
	if (radioBtnValue==0)
	{
		document.all[radioObj].style.visibility = 'hidden';
	}
	else
	{
		document.all[radioObj].style.visibility = 'visible';
	}
}

function PASLoanInfoHide(radioElements, radioObj)
{
	var radioBtnValue = getCheckedValue(radioElements)
	
	if (radioBtnValue==0)
	{
		document.all[radioObj].style.display = 'none';
	}
	else
	{
		document.all[radioObj].style.display = 'block';
	}
}

function PASYourInfoCreateNewAccount(radioObj) 
{
    var radioBtnValue;
	if (document.getElementById('ctl00_uxMainContentCPH_uxNewAccountRbl_0').checked)
	{
	    radioBtnValue = 0;
	}

	if (document.getElementById('ctl00_uxMainContentCPH_uxNewAccountRbl_1').checked)
	{
	    radioBtnValue = 1;
	}	
	
	if (radioBtnValue==1)
	{
		document.all[radioObj].style.display = 'none';
	}
	else
	{
		document.all[radioObj].style.display = 'block';
	}
}

function PASAgentInfoSeller(radioObj) 
{
    var radioBtnValue;
    
	if (document.getElementById('ctl00_uxMainContentCPH_uxSellerAgentRbl_0').checked)
	{
	    radioBtnValue = 0;
	}

	if (document.getElementById('ctl00_uxMainContentCPH_uxSellerAgentRbl_1').checked)
	{
	    radioBtnValue = 1;
	}	
	
	if (radioBtnValue==1)
	{
		document.all[radioObj].style.display = 'none';
	}
	else
	{
		document.all[radioObj].style.display = 'block';
	}
}

function PASAgentInfoBuyer(radioObj) 
{
    var radioBtnValue;
    
	if (document.getElementById('ctl00_uxMainContentCPH_uxBuyerAgentRbl_0').checked)
	{
	    radioBtnValue = 0;
	}

	if (document.getElementById('ctl00_uxMainContentCPH_uxBuyerAgentRbl_1').checked)
	{
	    radioBtnValue = 1;
	}	
	
	if (radioBtnValue==1)
	{
		document.all[radioObj].style.display = 'none';
	}
	else
	{
		document.all[radioObj].style.display = 'block';
	}
}

function PASLoanInfo(radioObj) 
{
    var radioBtnValue;
    
	if (document.getElementById('ctl00_uxMainContentCPH_uxBuyerFinanceRbl_0').checked)
	{
	    radioBtnValue = 0;
	}

	if (document.getElementById('ctl00_uxMainContentCPH_uxBuyerFinanceRbl_1').checked)
	{
	    radioBtnValue = 1;
	}	
	
	if (radioBtnValue==1)
	{
		document.all[radioObj].style.display = 'none';
	}
	else
	{
		document.all[radioObj].style.display = 'block';
	}
}

function PASOwnersTitlePolicyHide()
{
    var radioBtnValue;
	
	if (document.getElementById('ctl00_uxMainContentCPH_uxStandardCb').checked)
	{
	    radioBtnValue = 1;
	}	
	
	if (radioBtnValue==1)
	{
		document.all['uxEndorsementHECEDiv'].style.display = 'block';
	}
	else
	{
		document.all['uxEndorsementHECEDiv'].style.display = 'none';
	}
}

function PASFirstLenderPolicyHide() 
{
	if (document.getElementById('ctl00_uxMainContentCPH_uxEndExtendedRb').checked)
	{
	    radioBtnValue = "uxEndExtendedRb";
	}
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndStandardRb').checked)
	{
	    radioBtnValue = "uxEndStandardRb";
	}
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndSmartRb').checked)
	{
	    radioBtnValue = "uxEndSmartRb";
	}	
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndNotSureRb').checked)
	{
	    radioBtnValue = "uxEndNotSureRb";
	}		
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndNoneRb').checked)
	{
	    radioBtnValue = "uxEndNoneRb";
	}		
	
	if (radioBtnValue=="uxEndExtendedRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'block';
		document.all['uxEndorsement8_1Div'].style.display = 'block';
		document.all['uxEndorsementALTA4Div'].style.display = 'block';
		document.all['uxEndorsementALTA5Div'].style.display = 'block';
		document.all['uxEndorsementALTA6Div'].style.display = 'block';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'block';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'block';
		document.all['uxEndorsementALTA7Div'].style.display = 'block';
		document.all['uxEndorsement102_4Div'].style.display = 'block';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'none';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndStandardRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'block';
		document.all['uxEndorsementSpecial7Div'].style.display = 'block';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndSmartRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'block';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'block';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndNotSureRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'none';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndNoneRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'none';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}	
}

function PASSecondLenderPolicyHide() 
{
	if (document.getElementById('ctl00_uxMainContentCPH_uxEndExtendedRb').checked)
	{
	    radioBtnValue = "uxEndExtendedRb";
	}
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndStandardRb').checked)
	{
	    radioBtnValue = "uxEndStandardRb";
	}
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndSmartRb').checked)
	{
	    radioBtnValue = "uxEndSmartRb";
	}	
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndNotSureRb').checked)
	{
	    radioBtnValue = "uxEndNotSureRb";
	}		
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndNoneRb').checked)
	{
	    radioBtnValue = "uxEndNoneRb";
	}	
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndResidentialJrLoanPolicyRb').checked)
	{
	    radioBtnValue = "uxEndResidentialJrLoanPolicyRb";
	}
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndLotBookGuaranteeRb').checked)
	{
	    radioBtnValue = "uxEndLotBookGuaranteeRb";
	}	
	else if (document.getElementById('ctl00_uxMainContentCPH_uxEndDandEReportRb').checked)
	{
	    radioBtnValue = "uxEndDandEReportRb";
	}
		
	if (radioBtnValue=="uxEndExtendedRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'block';
		document.all['uxEndorsement8_1Div'].style.display = 'block';
		document.all['uxEndorsementALTA4Div'].style.display = 'block';
		document.all['uxEndorsementALTA5Div'].style.display = 'block';
		document.all['uxEndorsementALTA6Div'].style.display = 'block';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'block';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'block';
		document.all['uxEndorsementALTA7Div'].style.display = 'block';
		document.all['uxEndorsement102_4Div'].style.display = 'block';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'none';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndStandardRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'block';
		document.all['uxEndorsementSpecial7Div'].style.display = 'block';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndSmartRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'block';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'block';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndNotSureRb" || radioBtnValue=="uxEndNoneRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'none';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
	else if (radioBtnValue=="uxEndResidentialJrLoanPolicyRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'none';
		document.all['uxEndorsementJR1Div'].style.display = 'block';
		document.all['uxEndorsementJR2Div'].style.display = 'block';
	}
	else if (radioBtnValue=="uxEndLotBookGuaranteeRb" || radioBtnValue=="uxEndDandEReportRb" || radioBtnValue=="uxEndNotSureRb")
	{
		document.all['uxEndorsement100Div'].style.display = 'none';
		document.all['uxEndorsement8_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA4Div'].style.display = 'none';
		document.all['uxEndorsementALTA5Div'].style.display = 'none';
		document.all['uxEndorsementALTA6Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_1Div'].style.display = 'none';
		document.all['uxEndorsementALTA6_2Div'].style.display = 'none';
		document.all['uxEndorsementALTA7Div'].style.display = 'none';
		document.all['uxEndorsement102_4Div'].style.display = 'none';
		document.all['uxEndorsement110_4Div'].style.display = 'none';
		document.all['uxEndorsementSpecial7Div'].style.display = 'none';
		document.all['uxEndorsementJR1Div'].style.display = 'none';
		document.all['uxEndorsementJR2Div'].style.display = 'none';
	}
}

function getCheckedValue(radioObj)
{
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function ForgotPasswordEmailEntryCheck(emailAddressTxt)
{
	if (emailAddressTxt.value == "")
	{
		alert("Please enter an email address so that we can retrieve your account information.");
		emailAddressTxt.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function MarketShareToggleCountyRegion(actionControl) {
    if (actionControl == "county") {
        if (eval(document.getElementById('ctl00_uxMainCPH_uxCountyDdl').value) > 0) {
            document.getElementById('ctl00_uxMainCPH_uxRegionDdl').value = 0;
        }
    }
    else if (actionControl == "region") {
        if (eval(document.getElementById('ctl00_uxMainCPH_uxRegionDdl').value) > 0) {
            document.getElementById('ctl00_uxMainCPH_uxCountyDdl').value = 0;
        }
    }
}

function ForeclosureUpdateTotal() {
    var count = 0;
    var allCountySelected = false;
    
    for (el = 0; el < document.forms[0].elements.length; el++) {
        var pageObjName = document.forms[0].elements[el].id;
        
        var indexPosition = pageObjName.indexOf('uxCountyCb');
        var allCountyIndexPosition = pageObjName.indexOf('uxAllCountyCb');

        // Checks if All is checked
        if (allCountyIndexPosition >= 0) {
            allCountyObj = document.forms[0].elements[el];
            
            if (document.forms[0].elements[el].checked == true) {
                allCountySelected = true;
            }
        }

        // Checks if individual county is checked
        if (indexPosition >= 0) {
            if (allCountySelected == true) {
                document.forms[0].elements[el].checked = false;
            }
            else {
                if (document.forms[0].elements[el].checked == true) {
                    count += 1;
                }
            }
        }
    }

    if (allCountySelected == false) {
        document.getElementById('ctl00_uxMainContentCPH_uxCountyRep_ctl28_uxTotalLbl').innerHTML = '$' + (count * 25) + '.00';
    } 
    else {
        document.getElementById('ctl00_uxMainContentCPH_uxCountyRep_ctl28_uxTotalLbl').innerHTML = '$100.00';
    }
}

function SubmitResumeHearAboutUs(ddlObj, ddlName) {
    var e = document.getElementById("ctl00_uxMainContentCPH_uxHearAboutUsDdl");
    var ddlValue = e.options[e.selectedIndex].value;

    // Hides all Divs
    document.getElementById("uxInternetSourceDiv").style.display = 'none';
    document.getElementById("uxInternetSourceOtherDiv").style.display = 'none';
    document.getElementById("uxATECReferralDiv").style.display = 'none';

    // Clears Other DDL
    otherDDL = document.getElementById("ctl00_uxMainContentCPH_uxInternetSourceDdl");
    otherDDL.selectedIndex = 0;

    // Clears Other Txt
    otherInternetSourceTxt = document.getElementById("ctl00_uxMainContentCPH_uxInternetSourceOtherTxt");
    otherInternetSourceTxt.value = '';

    if (ddlValue == 3) {
        // Internet
        document.getElementById("uxInternetSourceDiv").style.display = 'block';
    }
    else if (ddlValue == 5) {
        // Employee
    document.getElementById("uxATECReferralDiv").style.display = 'block';
    }
}

function SubmitResumeInternetOther(ddlObj, ddlName) {
    var e = document.getElementById("ctl00_uxMainContentCPH_uxInternetSourceDdl");
    var ddlValue = e.options[e.selectedIndex].value;

    document.getElementById("uxInternetSourceOtherDiv").style.display = 'none';

    // Clears Other Txt
    otherInternetSourceTxt = document.getElementById("ctl00_uxMainContentCPH_uxInternetSourceOtherTxt");
    otherInternetSourceTxt.value = '';

    if (ddlValue == 7) {
        // Other
        document.getElementById("uxInternetSourceOtherDiv").style.display = 'block';
    }
}