// JavaScript Document

MBOT_GLOBAL_BEST_RATE_PATH = "http://publicservices.mortgagewebcenter.com";
MBOT_GLOBAL_BEST_RATE_SERVICE = "/BestRates/Service.aspx"
MBOT_GLOBAL_EXTERNAL_PATH = "http://mortgagemarvel.com"

var headTag = document.getElementsByTagName("head")[0];  
var scriptTag = document.createElement('script');
inc(MBOT_GLOBAL_BEST_RATE_PATH+"/BestRates/WebWidget/includes/results.js");

var hpanel;
var footer;
var MarvelRates;
var RateResults;
var rateService;
var footerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0" id="MortgageMarvel_Footer"><tr><td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="55">&nbsp;</td><td align="center" nowrap><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center"><table border="0" cellspacing="0" cellpadding="0"><tr><td colspan="2" align="center" width="100%"><table border="0" width="90px" cellpadding="1" cellspacing="0" bgcolor="#597788"><tr><td><table border="0" width="100%" cellspacing="0" cellpadding="0" id="MortgageMarvel_Apply"><tr><td align="center"><a href="#" onClick="ViewOptions(); return false;" id="ChangOptions" style="color:#000000">Refine Search</a></td></tr></table></td></tr></table></td><td rowspan="3" align="right"><div style="height:49px;width: 79px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src=\"' + MBOT_GLOBAL_BEST_RATE_PATH + '/BestRates/WebWidget/images/MMFooterLogo.png\',sizingMethod=\'scale\');"><img src=\"' + MBOT_GLOBAL_BEST_RATE_PATH + '/BestRates/WebWidget/images/MMFooterLogo.png" style=\'filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\'></div></td></tr><tr><td align="center"><a href="#" id="ImportantNotices" onClick="ImportantNotices(); return false;">Important Notices</a></td><td id="TermsofUse"></td></tr></table></td></tr></table></td><td height="55">&nbsp;</td></tr></table>';

var homeFooter ='<table width="285" border="0" cellspacing="0" cellpadding="0" id="MortgageMarvel_FooterHome"><tr><td align="center"><a href="#" id="ImportantNotices" onClick="ImportantNotices(); return false;">Important Notices</a></td><td><a href="#" onClick="ViewOptions(); return false;" id="ChangOptions">Change Options</a> </td><td rowspan="2" align="right" id=""><br><br></td><td align="center" id="TermsofUse"></td></tr></table>';
var optionsHTML = '<table width="260" border="0" cellpadding="4" cellspacing="0"><tr><td id="MortgageMarvel_Product" colspan="2" align="center" style="font-size:12px;">You&#39re seconds away from instant,<br> accurate mortgage rate quotes<br> from trusted local lenders.</td></tr><tr><td nowrap id="MortgageMarvel_Label">Loan Purpose</td><td><select name="LoanPurpose" style="width:165px" id="LoanPurpose" onchange="ItemClick(this);"></select></td></tr><tr><td id="MortgageMarvel_Label">Loan Amount</td><td><input name="LoanAmount" style="width:165px" type="text" id="LoanAmount" value="150000" /></td></tr><tr><td id="MortgageMarvel_Label">Loan Type</td><td><select name="LoanType" style="width:165px" id="LoanType" onchange="ItemClick(this);"></select></td></tr><tr><td nowrap id="MortgageMarvel_Label">Property Value</td><td><input name="PropertyValue" style="width:165px" type="text" id="PropertyValue" value="160000" /></td></tr><tr><td id="MortgageMarvel_Label">Zip Code</td><td><input name="ZipCode" style="width:165px" type="text" id="ZipCode" value="53074" /></td></tr><tr><td id="MortgageMarvel_Label">Property Use</td><td><select name="PropertyUse" style="width:165px" id="PropertyUse" onchange="ItemClick(this);"></select></td></tr><tr><td id="MortgageMarvel_Label">Property Type</td><td><select name="PropertyType" style="width:165px" id="PropertyType" onchange="ItemClick(this);"></select></td></tr> <tr><td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="2" align="right"><div style="height:55px;width: 86px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src=\'' + MBOT_GLOBAL_BEST_RATE_PATH + '/BestRates/WebWidget/images/MMOptionsLogo.png\',sizingMethod=\'scale\');"><img src="' + MBOT_GLOBAL_BEST_RATE_PATH + '/BestRates/WebWidget/images/MMOptionsLogo.png" style=\'filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\'></div></td><td align="right"><table border="0" cellpadding="0" cellspacing="0" bgcolor="#45677b"><tr><td><table border="0" cellspacing="1" cellpadding="0"><tr><td align="center" valign="middle" id="MortgageMarvel_BtnBlue" onclick="ViewRates(); return false;"><a href="#" onclick="ViewRates(); return false;" style="font-family:Georgia; color:#27487f; text-decoration:none; height:10px; padding-top:3px; vertical-align:text-bottom; font-size:11px">Get Rates</a></td></tr></table></td></tr></table></td></tr><tr><td align="right">&nbsp;</td></tr></table></td></tr></table>';


function inc(filename){
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	headTag.appendChild(script);
}
function Page(e){
 window.open(MBOT_GLOBAL_EXTERNAL_PATH);	
}
function InitPage(){
	
	document.getElementById("MortgageMarvelFooter").innerHTML = homeFooter;
	
	document.getElementById("TermsofUse").innerHTML = '<a href='+ '\''+ MBOT_GLOBAL_EXTERNAL_PATH  +'/Pages/FooterPages/TermsOfUse.aspx\' target=\'_blank\'>Terms of Use</a>';
	//document.getElementById("MarvelLogo").innerHTML = '<img src='+ '\''+  MBOT_GLOBAL_BEST_RATE_PATH  +'/BestRates/WebWidget/images/MortgageMarvel.jpg\'>' ;
	
	rateService = new MbotBestRateService();
	MarvelRates = new MbotBestRateCriteria();
	ViewOptions();
	
}


function BindControls(){
	
	var ddlLoanPurpose = document.getElementById("LoanPurpose");
	for(var i = 0; i<ddlLoanPurpose.options.length;i++){
		if(ddlLoanPurpose.options[i].type ==  MarvelRates.LoanPurpose){
			
			ddlLoanPurpose.selectedIndex = i;
		}
	}
	 
	document.getElementById("LoanAmount").value = MarvelRates.LoanAmount;
	
    document.getElementById("PropertyValue").value = MarvelRates.PropertyValue;
	
	var ddlLoanType = document.getElementById("LoanType");
    for(var i = 0; i<ddlLoanType.options.length;i++){
		if(ddlLoanType.options[i].type ==  MarvelRates.LoanType && ddlLoanType.options[i].term ==  MarvelRates.LoanTerm){
			ddlLoanType.selectedIndex = i;
		}
	}
	
    document.getElementById("ZipCode").value = MarvelRates.PropertyZipCode;
	
	var ddlPropertyUse = document.getElementById("PropertyUse");
     for(var i = 0; i<ddlPropertyUse.options.length;i++){
		if(ddlPropertyUse.options[i].type ==  MarvelRates.PropertyUse){
			ddlPropertyUse.selectedIndex = i;
		}
	}
	
	var ddlPropertyType = document.getElementById("PropertyType");
     for(var i = 0; i<ddlPropertyType.options.length;i++){
		if(ddlPropertyType.options[i].type ==  MarvelRates.PropertyType){
			ddlPropertyType.selectedIndex = i;
		}
	}
	 
}
function FillMbotBestRateCriteria(){
	
	var ddlLoanPurpose = document.getElementById("LoanPurpose");
	MarvelRates.LoanPurpose = ddlLoanPurpose.options[ddlLoanPurpose.selectedIndex].type;
	
    MarvelRates.LoanAmount = document.getElementById("LoanAmount").value;
	
    MarvelRates.PropertyValue = document.getElementById("PropertyValue").value;
	
	var ddlLoanType = document.getElementById("LoanType");
    MarvelRates.LoanType = ddlLoanType.options[ddlLoanType.selectedIndex].type;
    MarvelRates.LoanTerm = ddlLoanType.options[ddlLoanType.selectedIndex].term;
    MarvelRates.BalloonLoanTerm = ddlLoanType.options[ddlLoanType.selectedIndex].term;
    MarvelRates.InitialARMFixedPeriod = ddlLoanType.options[ddlLoanType.selectedIndex].term;
	
    MarvelRates.PropertyZipCode = document.getElementById("ZipCode").value;
	var ddlPropertyUse = document.getElementById("PropertyUse");
    MarvelRates.PropertyUse =ddlPropertyUse.options[ddlPropertyUse.selectedIndex].type;
	
	var ddlPropertyType = document.getElementById("PropertyType");
    MarvelRates.PropertyType =ddlPropertyType.options[ddlPropertyType.selectedIndex].type;
	
    MarvelRates.PaymentType ='PrincipalAndInterest';
    MarvelRates.Points ='Zero';
    MarvelRates.FinanceType ='Conventional';
    MarvelRates.DocumentationLevel ='FullDocumentation';
    MarvelRates.LocationRadius = 0;
    MarvelRates.InstitutionType = 'All';
    MarvelRates.Limit = 5;
    MarvelRates.__ValidationMessage = '';
}
function ViewOptions(){
	document.getElementById("MortgageMarvelFooter").innerHTML = homeFooter;
	document.getElementById("TermsofUse").innerHTML = '<a href='+ '\''+ MBOT_GLOBAL_EXTERNAL_PATH  +'/Pages/FooterPages/TermsOfUse.aspx\' target=\'_blank\'>Terms of Use</a>';
	document.getElementById("DateTime").innerHTML = "Free. Personalized. Anonymous.";
	document.getElementById("MortgageMarvelContainer").innerHTML = optionsHTML;
	BindOptions();
	document.getElementById("ChangOptions").innerHTML = "";
}
function ViewRates(){
	
	document.getElementById("MortgageMarvelFooter").innerHTML = footerHTML;
	document.getElementById("TermsofUse").innerHTML = '<a href='+ '\''+ MBOT_GLOBAL_EXTERNAL_PATH  +'/Pages/FooterPages/TermsOfUse.aspx\' target=\'_blank\'>Terms of Use</a>';
	FillMbotBestRateCriteria();
	
	if(!MarvelRates.Validate()){
		alert(MarvelRates.GetValidationMessage());
	}else{
		
		document.getElementById("DateTime").innerHTML = "";
		//document.getElementById("MarvelAdText").innerHTML = "";
		document.getElementById("MortgageMarvelContainer").innerHTML = resultsHTML;
		document.getElementById("MarvelLoaderLogo").innerHTML += '<br><img src='+ '\''+  MBOT_GLOBAL_BEST_RATE_PATH  +'/BestRates/WebWidget/images/loading.gif\'>' ;
		document.getElementById("MortgageMarvel_Loading").innerHTML += '<br><img src='+ '\''+  MBOT_GLOBAL_BEST_RATE_PATH  +'/BestRates/WebWidget/images/spacer.gif\' width=\'1px\' height=\'110px\'>' ;
		rateService.RequestBestRates(MarvelRates,"onLoadedCallBack");
		document.getElementById("ChangOptions").innerHTML = "Refine Search";
	}
}

function onLoadedCallBack(e){
	RateResults = e.BestRateResults;
	document.getElementById("DateTime").innerHTML =  "<SPAN  style='color:#000000; font-size:10px; font-weight:normal; font-family:Arial, Helvetica, sans-serif;'>Rates valid as of " + RateResults.TimeStamp + " CST</SPAN>";
	RenderResults(RateResults);
}

function RenderResults(BestRates){
	//TODO: Check for null
	if(BestRates.RateCount !=0){
		document.getElementById("rate").innerHTML = "";
		for(var i=0;i<BestRates.Rate.length;i++){
			document.getElementById("rate").innerHTML += GenerateRow(BestRates.Rate[i]);
		}
	}else{
		document.getElementById("MortgageMarvel_Loading").innerHTML = "No rates found matching the selected criteria"
	}
	
}

function ItemClick(e){
	e.options[e.selectedIndex].selected = true;
}
function DisplayNotice(notice){
alert(notice);
}

function DisplayPaymentStream(productName, paymentStream) 
{ 
  rateService.RequestPaymentStream(paymentStream, "LoadPaymentStreamData(\"" + productName + "\","); 
}

function LoadPaymentStreamData(productName, data) 
{
  var data = data.LivePaymentStream.PaymentStreamUrl;
  
  alert("\t\t\t\t" + productName + "\r\n\r\n" + data);
}

function ImportantNotices(){
	var ImportantNotices;
	ImportantNotices = "Rates are subject to change without notice. We've assumed that you have good credit with a FICO score of 740 or higher. We've also assumed that you are looking for a mortgage with standard monthly principal and interest payments and would like to pay zero discount points. If these assumptions aren't accurate, it could affect the rate and fees quoted.\r\rThe results presented are sorted from lowest to highest based on rate. The closing cost amounts shown have been rounded up to the nearest dollar and include discount points, if any.\r\rThe monthly payment amount shown has been rounded up to the nearest dollar and includes principal, interest and mortgage insurance, if required. Your actual monthly payment will be higher if the lender requires or you choose to make monthly installment payments for real estate taxes or homeowners insurance.\r\rYour APR will vary based on your final loan amount and finance charges." 
	alert(ImportantNotices );
}
function GenerateRow(rate){

	var tblRow = '<table id="Item_Table" border="0" width="100%" cellspacing="0" cellpadding="0">';
	tblRow += '<tr>';
	tblRow +=  '<td align="left" id="MortgageMarvel_Institution">&nbsp;<a href="'+ rate.SearchPageUrl  + '" target="_blank">' +rate.InstitutionName +'</a></td> '    ;            
	tblRow +=  '</tr>';
	tblRow += ' <tr>';    
	tblRow +='<td><table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tblRow += '<tr>';         
	tblRow += '<td><table width="100%" border="0" cellspacing="0" cellpadding="0">';                     
	tblRow += '<tr>';         
	tblRow +='<td align="left" colspan="6" id="MortgageMarvel_Product">&nbsp;'+  rate.ProductName +'</td>'  ;              
	tblRow +='</tr>';              
	tblRow +='<tr>';           
	tblRow += '<td align="center" id="MortgageMarvel_MasterResultsLabel">Rate</td>';       
	tblRow +='<td align="center" id="MortgageMarvel_MasterResultsLabel">Points</td>';  
	tblRow += '<td align="center" id="MortgageMarvel_MasterResultsLabel">APR</td>';        
	tblRow +=' <td align="center" id="MortgageMarvel_MasterResultsLabel">Fees</td>';
	tblRow +='<td align="center" id="MortgageMarvel_MasterResultsLabel">Payment</td>';
	tblRow +='<td rowspan="2"><table cellpadding="1" cellspacing="0" bgcolor="#000000">';
	tblRow +='<tr>';
	tblRow += ' <td valign="top"><table cellpadding="0" cellspacing="0" width="40" id="MortgageMarvel_Apply">';
	tblRow += ' <tr>';
	tblRow +=   '<td align="center"><a href="'+ rate.ApplyNowUrl + '" target="_blank">Apply</a> </td>';
	tblRow += ' </tr> </table></td></tr></table>';
	tblRow +='</tr>';
	tblRow +='<tr>';
	//tblRow += '<td align="center" id="MortgageMarvel_MasterResultsAPR" valign="top"><a href="#" onclick="OpenNewWindow(' + '\'' + rate.PaymentStream + '\'' + '); return false;">' + rate.InterestRate.toPrecision(4) + '%</a></td>';
	tblRow += '<td align="center" id="MortgageMarvel_MasterResultsAPR" valign="top"><a href="#" onclick="DisplayPaymentStream(' + '\'' + rate.ProductName + '\',' + '\'' + rate.PaymentStreamUrl + '\'' + '); return false;">' + rate.InterestRate.toPrecision(4) + '%</a></td>';
	
	tblRow += '<td align="center" id="MortgageMarvel_MasterResults" valign="top">'+rate.Points.toPrecision(4) + '%</td>';
	// add apr link
	tblRow += '<td align="center" id="MortgageMarvel_MasterResultsAPR" valign="top"><a href="#" onclick="DisplayPaymentStream(' + '\'' + rate.ProductName + '\',' + '\'' + rate.PaymentStreamUrl + '\'' + '); return false;">' + rate.APR.toPrecision(4) + '%</a></td>';
	//tblRow += '<td align="center" id="MortgageMarvel_MasterResultsAPR" valign="top"><a href="#" onclick="OpenNewWindow(' + '\'' + rate.PaymentStream + '\'' + '); return false;">' + rate.APR.toPrecision(4) + '%</a></td>';
	tblRow += '<td align="center" id="MortgageMarvel_MasterResults" valign="top">$' + Math.round(rate.TotalClosingFees) + '</td>';
	//tblRow += '<td align="center" id="MortgageMarvel_MasterResultsAPR" valign="top"><a href="#" target="_blank" onclick="OpenNewWindow(' + '\'' + rate.PaymentStream + '\'' + '); return false;">$' + Math.round(rate.TotalPaymentWithoutEscrow) + '</a></td>';
	tblRow += '<td align="center" id="MortgageMarvel_MasterResultsAPR" valign="top"><a href="#" onclick="DisplayPaymentStream(' + '\'' + rate.ProductName + '\',' + '\'' + rate.PaymentStreamUrl + '\'' + '); return false;">$' + Math.round(rate.TotalPaymentWithoutEscrow) + '</a></td>';
	
	//tblRow +='<td align="center"><table cellpadding="1" cellspacing="0" bgcolor="#000000">';
	//tblRow +='<tr>';
	//tblRow += ' <td valign="top"><table cellpadding="0" cellspacing="0" width="40" id="MortgageMarvel_Apply">';
	//tblRow += ' <tr>';
	//tblRow +=   '<td align="center"><a href="'+ rate.ApplyNowUrl + '" target="_blank">Apply</a> </td>'  ;
	//tblRow += ' </tr> </table></td></tr></table></td></tr></table></td></tr></table></td></tr></table>' ;
	tblRow += '</td></tr></table></td></tr></table></td></tr>'
	tblRow += '<tr>';
	tblRow +=  '<td bgcolor="#695537"><img src="' + MBOT_GLOBAL_EXTERNAL_PATH + '"/images/spacer.gif" width="1" height="1"></td>';            
	tblRow +=  '</tr>';
	tblRow +=  '</table>' ;
	return tblRow;

}

function OpenNewWindow(url) {
  window.open(url, null, "height=350,width=350,directories=0,status=0,titlebar=0,toolbar=0,menubar=0,location=0,resizable=0");
}
function BindOptions(){
	PurposeCB();
	LoanTypeCB();
	PropertyUseCB();
	PropertyTypeCB();
	BindControls();
}
function PurposeCB(){
	var ddlLoanPurpose = document.getElementById("LoanPurpose");
	ddlLoanPurpose.options[0] = new Option("Purchase");
	ddlLoanPurpose.options[0].title = "Purchase";
	ddlLoanPurpose.options[0].data = 0;
	ddlLoanPurpose.options[0].type = "Purchase";
	ddlLoanPurpose.options[0].selected = false;
	
	
	ddlLoanPurpose.options[1] = new Option("Refi Existing Balance");
	ddlLoanPurpose.options[1].title = "Refi Existing Balance";
	ddlLoanPurpose.options[1].data = 1;
	ddlLoanPurpose.options[1].type = "RefinanceExistingBalance";
	ddlLoanPurpose.options[1].selected = false;
	
	ddlLoanPurpose.options[2] = new Option("Refi with Cash Out");
	ddlLoanPurpose.options[2].title = "Refi with Cash Out";
	ddlLoanPurpose.options[2].data = 2;
	ddlLoanPurpose.options[2].type = "RefinanceWithCashOut";
	ddlLoanPurpose.options[2].selected = false;
}
function LoanTypeCB(){
	
	var ddlLoanType = document.getElementById("LoanType");
	ddlLoanType.options[0] = new Option("40 Year Fixed Rate");
	ddlLoanType.options[0].title = "40 Year Fixed Rate";
	ddlLoanType.options[0].data = 1;
	ddlLoanType.options[0].term = 480;
	ddlLoanType.options[0].type = "Fixed";
	ddlLoanType.options[0].selected = false;
	
	ddlLoanType.options[1] = new Option("30 Year Fixed Rate");
	ddlLoanType.options[1].title = "30 Year Fixed Rate";
	ddlLoanType.options[1].term = 360;
	ddlLoanType.options[1].type = "Fixed";
	ddlLoanType.options[1].selected = false;
	
	ddlLoanType.options[2] = new Option("20 Year Fixed Rate");
	ddlLoanType.options[2].title = "20 Year Fixed Rate";
	ddlLoanType.options[2].term = 240;
	ddlLoanType.options[2].type = "Fixed";
	ddlLoanType.options[2].selected = false;

	ddlLoanType.options[3] = new Option("15 Year Fixed Rate");
	ddlLoanType.options[3].title = "15 Year Fixed Rate";
	ddlLoanType.options[3].term = 180;
	ddlLoanType.options[3].type = "Fixed";
	ddlLoanType.options[3].selected = false;

	ddlLoanType.options[4] = new Option("10 Year Fixed Rate");
	ddlLoanType.options[4].title = "10 Year Fixed Rate";
	ddlLoanType.options[4].term = 120;
	ddlLoanType.options[4].type = "Fixed";
	ddlLoanType.options[4].selected = false;

	ddlLoanType.options[5] = new Option("10/1 Adjustable Rate");
	ddlLoanType.options[5].title = "10/1 Adjustable Rate";
	ddlLoanType.options[5].term = 120;
	ddlLoanType.options[5].type = "AdjustableRate";
	ddlLoanType.options[5].selected = false;

	ddlLoanType.options[6] = new Option("7/1 Adjustable Rate");
	ddlLoanType.options[6].title = "7/1 Adjustable Rate";
	ddlLoanType.options[6].term = 84;
	ddlLoanType.options[6].type = "AdjustableRate";
	ddlLoanType.options[6].selected = false;

	ddlLoanType.options[7] = new Option("5/1 5/5 Adjustable Rate");
	ddlLoanType.options[7].title = "5/1 5/5 Adjustable Rate";
	ddlLoanType.options[7].term = 60;
	ddlLoanType.options[7].type = "AdjustableRate";
	ddlLoanType.options[7].selected = false;

	ddlLoanType.options[8] = new Option("3/1 3/3 Adjustable Rate");
	ddlLoanType.options[8].title = "3/1 3/3 Adjustable Rate";
	ddlLoanType.options[8].term = 36;
	ddlLoanType.options[8].type = "AdjustableRate";
	ddlLoanType.options[8].selected = false;

	ddlLoanType.options[9] = new Option("1 Adjustable Rate");
	ddlLoanType.options[9].title = "1 Adjustable Rate";
	ddlLoanType.options[9].term = 12;
	ddlLoanType.options[9].type = "AdjustableRate";
	ddlLoanType.options[9].selected = false;

	ddlLoanType.options[10] = new Option("7 Year Balloon");
	ddlLoanType.options[10].title = "7 Year Balloon";
	ddlLoanType.options[10].term = 84;
	ddlLoanType.options[10].type = "Balloon";
	ddlLoanType.options[10].selected = false;

	ddlLoanType.options[11] = new Option("5 Year Balloon");
	ddlLoanType.options[11].title = "5 Year Balloon";
	ddlLoanType.options[11].term = 60;
	ddlLoanType.options[11].type = "Balloon";
	ddlLoanType.options[11].selected = false;
	
}
function PropertyUseCB(){
	
	var ddlPropertyUse = document.getElementById("PropertyUse");
	ddlPropertyUse.options[0] = new Option("Primary Residence");
	ddlPropertyUse.options[0].title = "Primary Residence";
	ddlPropertyUse.options[0].data = 1;
	ddlPropertyUse.options[0].type = "PrimaryResidence";
	ddlPropertyUse.options[0].selected = false;
	
	ddlPropertyUse.options[1] = new Option("Vacation Home");
	ddlPropertyUse.options[1].title = "Vacation Home";
	ddlPropertyUse.options[1].type = "SecondHome";
	ddlPropertyUse.options[1].selected = false;
	
	ddlPropertyUse.options[2] = new Option("Investment");
	ddlPropertyUse.options[2].title = "Investment";
	ddlPropertyUse.options[2].type = "Investment";
	ddlPropertyUse.options[2].selected = false;

}
function PropertyTypeCB(){
	
	var ddlPropertyType = document.getElementById("PropertyType");
	ddlPropertyType.options[0] = new Option("Single Family");
	ddlPropertyType.options[0].title = "Single Family";
	ddlPropertyType.options[0].data = 1;
	ddlPropertyType.options[0].type = "SingleFamily";
	ddlPropertyType.options[0].selected = false;
	
	ddlPropertyType.options[1] = new Option("2 Unit");
	ddlPropertyType.options[1].title = "2 Unit";
	ddlPropertyType.options[1].type = "TwoUnit";
	ddlPropertyType.options[1].selected = false;
	
	ddlPropertyType.options[2] = new Option("3 Unit");
	ddlPropertyType.options[2].title = "3 Unit";
	ddlPropertyType.options[2].type = "ThreeUnit";
	ddlPropertyType.options[2].selected = false;
	
	ddlPropertyType.options[3] = new Option("4 Unit");
	ddlPropertyType.options[3].title = "4 Unit";
	ddlPropertyType.options[3].type = "FourUnit";
	ddlPropertyType.options[3].selected = false;
	
	ddlPropertyType.options[4] = new Option("Condo 1-4 Stories");
	ddlPropertyType.options[4].title = "Condo 1-4 Stories";
	ddlPropertyType.options[4].type = "Condominium";
	ddlPropertyType.options[4].selected = false;
	
	ddlPropertyType.options[5] = new Option("Condo 5+ Stories");
	ddlPropertyType.options[5].title = "Condo 5+ Stories";
	ddlPropertyType.options[5].type = "HighRiseCondominium";
	ddlPropertyType.options[5].selected = false;
	
	ddlPropertyType.options[6] = new Option("Manufactured Home");
	ddlPropertyType.options[6].title = "Manufactured Home";
	ddlPropertyType.options[6].type = "ManufacturedHome";
	ddlPropertyType.options[6].selected = false;
	
	ddlPropertyType.options[7] = new Option("Co-op");
	ddlPropertyType.options[7].title = "Co-op";
	ddlPropertyType.options[7].type = "Cooperative";
	ddlPropertyType.options[7].selected = false;
	
}
window.onload = InitPage
