var SERVER='https://mortgagerates.icanbuy.com';if(typeof(WSettings)=="undefined"){WSettings={};} var jQueryVersion='1.6.2';var boolDebug=true;var strJSErrorMessage="JavaScript error";var strReferer='';var WidgetZipCode='';var WidgetAddress='';var WidgetHomeValue=0;var WidgetPropertyType=0;var boolShowJSError=true;function openRates(varWType,strSiteCode,strExternal){jQuery.getJSON(SERVER+'/ajax/widget-click?callback=?',{id:strSiteCode,external:strExternal,w:varWType,zip:WidgetZipCode,home_value:WidgetHomeValue,property_type:WidgetPropertyType},function(objResponse){params='width='+screen.width;params+=', height='+screen.height;params+=', top=0, left=0';params+=', scrollbars=yes';params+=', toolbar=yes';params+=', menubar=yes';params+=', status=yes';params+=', resizable=yes';params+=', location=yes';params+=', directories=yes';params+=', fullscreen=yes';newwin=window.open(objResponse.url,'rates',params);if(window.focus){newwin.focus()}});} function extendedOpenURL(varWType,strSiteCode,strExternal){var h_click={id:strSiteCode,external:strExternal,w:varWType,zip:WidgetZipCode,home_value:WidgetHomeValue,property_type:WidgetPropertyType,address:WidgetAddress};var set=getSettings(varWType);if(set==null)h_click.trick='mct';else h_click.trick=set.trick;jQuery.getJSON(SERVER+'/ajax/widget-click?callback=?',h_click,function(objResponse){eval(objResponse.eval);});} function openHouseWorse(address,zip,strSiteCode,strExternal,varWType){jQuery.getJSON(SERVER+'/ajax/widget-click?callback=?',{id:strSiteCode,external:strExternal,w:varWType,zip:zip,address:address,search:'houseworse'},function(objResponse){params='width='+screen.width;params+=', height='+screen.height;params+=', top=0, left=0';params+=', scrollbars=yes';params+=', toolbar=yes';params+=', menubar=yes';params+=', status=yes';params+=', resizable=yes';params+=', location=yes';params+=', directories=yes';params+=', fullscreen=yes';newwin=window.open(objResponse.url,'rates',params);if(window.focus){newwin.focus();}});} function _load(url,callback){var script=document.createElement("script");script.type="text/javascript";script.src=url;if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;if(callback)callback();}};}else{script.onload=function(){if(callback)callback();};} document.getElementsByTagName("head")[0].appendChild(script);} function _loadcss(url,callback){var script=document.createElement("link");script.type="text/css";script.rel="stylesheet";script.href=SERVER+'/css/'+url+'.css';document.getElementsByTagName("head")[0].appendChild(script);} function _loadjs(url,callback){var script=document.createElement("script");script.type="text/javascript";script.src=SERVER+'/js/'+url+'.js';document.getElementsByTagName("head")[0].appendChild(script);} function checkJQueryLoaded(fFunction){if(typeof(jQuery)=='undefined'||jQuery().jquery.indexOf(jQueryVersion)==-1){_load(SERVER+"/js/jquery.js",fFunction);return false;} return true;} function getSettings(strWidgetType){var wset=null;eval("wset = typeof(WSettings.w"+strWidgetType+");");if(wset=="undefined")return null;eval("wset = WSettings.w"+strWidgetType+";");return wset;} function setSettings(strWidgetType,objSettings){eval("WSettings.w"+strWidgetType+" = objSettings;");} function addSetting(strWidgetType,strSettingName,strSettingValue){eval("WSettings.w"+strWidgetType+"."+strSettingName+" = strSettingValue;");} function showWidget(){var wType="";if(arguments.length>2){_IcanbuyAccessCode=(arguments.length>0)?arguments[0]:false;if(!_IcanbuyAccessCode){alert("Access code not defined. Loading stopped.");return;} _IcanbuyWidgetID=(arguments.length>1)?arguments[1]:'IcanbuyWidget';_WidgetStartType=(arguments.length>2)?arguments[2]:'2';_strSlideSide=(arguments.length>3)?arguments[3]:'';wset=getSettings(_WidgetStartType);if(!wset){wset={};wset.IcanbuyAccessCode=_IcanbuyAccessCode;wset.IcanbuyWidgetID=_IcanbuyWidgetID;wset.WidgetStartType=_WidgetStartType;wset.strSlideSide=_strSlideSide;setSettings(_WidgetStartType,wset);} wType=_WidgetStartType;} else{wType=(arguments.length>0)?arguments[0]:false;if(!wType){alert('![Empty]!');return;}} try{if(checkJQueryLoaded(function(){showWidget(wType);})){jQuery.fn.digits=function(){return this.keyup(function(){var val=jQuery(this).val().replace(/,/g,"") jQuery(this).val(val.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"));});} loadWidget(wType);}}catch(objError){var strError="";for(key in objError){strError+=key+":\t"+objError[key]+"\r\n\r\n";} alert(strError);return;}} function loadWidget(wst){if(typeof(GO_ICANBUY_PROCESSING)=="undefined")GO_ICANBUY_PROCESSING=0;var wset=getSettings(wst);var params={id:wset.IcanbuyAccessCode,external:wset.strSlideSide,referer:strReferer};jQuery.getJSON(SERVER+"/widgets/widget?wst="+wst+"&callback=?",params,receiveWidgetResponse);} function receiveWidgetResponse(objResponse){var wset=getSettings(objResponse.wType);if(typeof(objResponse.js)!="undefined")wset.receivedJS=objResponse.js;else wset.receivedJS='';if(typeof(objResponse.html)!="undefined")wset.receivedHTML=objResponse.html;else wset.receivedHTML='';if(typeof(objResponse.css)!="undefined"&&objResponse.css.length>0){for(key in objResponse.css){_loadcss(objResponse.css[key]);}} setSettings(objResponse.wType,wset);processWidgetResponse(objResponse.wType);} function processWidgetResponse(wType){wset=getSettings(wType);IcanbuyWidget=jQuery('#'+wset.IcanbuyWidgetID);var i=wset.receivedHTML.indexOf("openW2(");if(i!=-1){wset.receivedHTML=wset.receivedHTML.replace("openW2(","openRates('"+wType+"',");} if(typeof(wset.showrates)!="undefined"){var i=wset.receivedHTML.indexOf("openW2");if(i!=-1){wset.receivedHTML=wset.receivedHTML.replace("openW2(","openRates('"+wType+"',");}} IcanbuyWidget.html(wset.receivedHTML);jQuery('#'+wset.IcanbuyWidgetID+'_static',IcanbuyWidget).remove();if(jQuery.type(wset.receivedJS)=="array"&&wset.receivedJS.length>0){for(key in wset.receivedJS){_loadjs(wset.receivedJS[key]);}} else if(jQuery.trim(wset.receivedJS)!=""){try{eval(wset.receivedJS);} catch(objError){if(boolDebug){var strError="";for(key in objError){strError+=key+":\t"+objError[key]+"\r\n\r\n";} alert(strError);return;} else{if(boolShowJSError){alert(strJSErrorMessage);return;}}}}}showWidget('bd354c4a7a2c981b','icanbuy_widget','2h2','undefined');addSetting('2h2','trick','mct');