var LocalInfoWidget={loadInline:false,mappedItems:0,map:null,mapElementId:'localMap',widget:{view:'',serviceUrl:'http://www.homefinder.com/_widgets/localInfo/'},streetView:{loaded:false,data:null,container:'#localInfo_streetView',controls:'#streetViewControl',message:'.localInfo_alert'},pagination:{},lazy:{},catsLoading:0,catsSetupRemaining:0,defaults:{map:{controls:{},coordinate:{latitude:41.87712,longitude:-87.62473},zoom:15,baseMapIcon:{}},useMapZoom:true,coordinate:{latitude:41.87712,longitude:-87.62473},zoom:15,zipcode:60604,eAreaDisplay:jQuery('.widgetLocation'),displayPrintLink:true,integrateDrivingDirections:false,timeoutInterval:500,lazyInterval:1000,baseMapIcon:{},cookieOptions:{expires:30,path:'/',domain:Homescape.securityDomain},google:{resultSize:'large'},categoryOptions:{google:{childDayCare:{name:'Child Day Care',queryText:'Child Day Care',displayListResults:false,displayMapPlots:false,cssClassName:'childDayCare',cssHeaderClassName:'childDayCareHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_daycare_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_daycare_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_daycare.gif'},resultsPerPage:4,fn:{}},publicTransit:{name:'Public Transportation',queryText:'Transit Stations',displayListResults:false,displayMapPlots:false,cssClassName:'publicTransit',cssHeaderClassName:'publicTransitHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_pubtrans_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_pubtrans_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_pubtrans.gif'},resultsPerPage:4,fn:{}},groceryStores:{name:'Grocery Stores',queryText:'Grocery Stores',displayListResults:false,displayMapPlots:false,cssClassName:'groceryStores',cssHeaderClassName:'groceryStoresHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_grocery_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_grocery_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_grocery.gif'},resultsPerPage:4,fn:{}},movieTheaters:{name:'Movie Theaters',queryText:'Movie Theaters',displayListResults:false,displayMapPlots:false,cssClassName:'movieTheaters',cssHeaderClassName:'movieTheatersHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_movies_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_movies_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_movies.gif'},resultsPerPage:4,fn:{}},restaurants:{name:'Restaurants',queryText:'Restaurants',displayListResults:false,displayMapPlots:false,cssClassName:'restaurants',cssHeaderClassName:'restaurantsHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_restaurant_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_restaurant_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_restaurant.gif'},resultsPerPage:4,fn:{}}},schools:{elementary:{name:'Elementary Schools',displayListResults:true,displayMapPlots:true,cssClassName:'elementary',cssHeaderClassName:'elementaryHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_elem_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_elem_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_schools_elem.gif'},resultsPerPage:5,fn:{}},middle:{name:'Middle Schools',displayListResults:true,displayMapPlots:true,cssClassName:'middle',cssHeaderClassName:'middleHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_mid_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_mid_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_schools_mid.gif'},resultsPerPage:5,fn:{}},high:{name:'High Schools',displayListResults:true,displayMapPlots:true,cssClassName:'high',cssHeaderClassName:'highHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_high_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_high_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_schools_high.gif'},resultsPerPage:5,fn:{}},adultOther:{name:'Additional Schools',displayListResults:false,displayMapPlots:false,cssClassName:'additional',cssHeaderClassName:'additionalHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_schools.gif'},resultsPerPage:5,fn:{}},preschool:{name:'Pre-Schools',displayListResults:false,displayMapPlots:false,cssClassName:'preschool',cssHeaderClassName:'preschoolHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_pre_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_schools_pre_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_schools_pre.gif'},resultsPerPage:5,fn:{}}},recentSales:{name:'Recent Sales',displayListResults:false,displayMapPlots:false,cssClassName:'recentSales',cssHeaderClassName:'recentSalesHeader',markers:[],iconImg:{map:{inactive:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_recent_$1.png',active:Homescape.cdnBaseUrl+'localInfoWidget/icons/a/icon_recent_$1_act.png'},list:Homescape.cdnBaseUrl+'localInfoWidget/icons/1/icon_recent.gif'},resultsPerPage:5,fn:{}}}},preferences:{user:{categoryOptions:{google:{childDayCare:{displayListResults:false,displayMapPlots:false},publicTransit:{displayListResults:false,displayMapPlots:false},groceryStores:{displayListResults:false,displayMapPlots:false},movieTheaters:{displayListResults:false,displayMapPlots:false},restaurants:{displayListResults:false,displayMapPlots:false}},schools:{elementary:{displayListResults:true,displayMapPlots:true},middle:{displayListResults:true,displayMapPlots:true},high:{displayListResults:true,displayMapPlots:true},adultOther:{displayListResults:false,displayMapPlots:false},preschool:{displayListResults:false,displayMapPlots:false}},recentSales:{displayListResults:false,displayMapPlots:false}}},client:{}},directions:{},fn:{resizeWidget:function(){try{Homescape.fn.expandDomainSecurity();if(parent.window.LocalInfoWidget!==undefined){var h=0;var heightElements=['#_localInfoWidgetWrap','#localInfoWidget'];if(jQuery.browser.msie){if(jQuery.browser.version=='7.0'){heightElements.push('body');}}else{heightElements.push('html');heightElements.push('body');}
jQuery.each(heightElements,function(i,n){if(jQuery(n).height()>h){h=jQuery(n).height()+5;}});parent.window.LocalInfoWidget.widget.eIframe.attr('height',h);parent.window.LocalInfoWidget.widget.eIframe.css('height',h);}}catch(e){jQuery.log(e);}},localSearch:{searchCompleteHandler:null},formatPropertyBrief:function(address){jQuery.log("Formatting Property brief");var f='<p>';if(address.line1!==undefined&&address.line1!==''){f+=address.line1;if(address.line2!==undefined&&address.line2!==''){f+='<br/>'+address.line2;}}
if(address.city!==undefined&&address.city!==''){f+='<br/>'+address.city;}
if(address.state!==undefined&&address.state!==''){f+=(f===''?'':', ')+address.state;}
if(address.zipcode!==undefined&&address.zipcode!==''){f+=(f===''?'':' ')+address.zipcode;}
f+='</p>';return f;},formatPropertyBriefText:function(address,showLine2){jQuery.log("Formatting Property brief (text-only)");var f='';showLine2=(showLine2===undefined||showLine2.constructor!==Boolean)?true:showLine2;try{if(address.line1!==undefined&&address.line1!==''){f+=address.line1;if(showLine2&&address.line2!==undefined&&address.line2!==''){f+=', '+address.line2;}}
if(address.city!==undefined&&address.city!==''){f+=(f===''?'':', ')+address.city;}
if(address.state!==undefined&&address.state!==''){f+=(f===''?'':', ')+address.state;}
if(address.zipcode!==undefined&&address.zipcode!==''){f+=(f===''?'':' ')+address.zipcode;}}catch(e){jQuery.log(e);}
return f;},formatRecentSaleDetails:function(recentSale){var f='<div id="htmlHolder"><div class="localSchoolHed"> <p class="secthed"> Transaction Information</p> </div> <div class="localSchoolDetails">';f+='<table class="nonStriped"> <tbody>';f+='<tr> <td class="subHed">';f+=(recentSale.houseNumber!==undefined)?recentSale.houseNumber+' ':'';f+=(recentSale.streetDirPrefix!==undefined)?recentSale.streetDirPrefix+' ':'';f+=(recentSale.streetName!==undefined)?recentSale.streetName+' ':'';f+=(recentSale.streetDirSuffix!==undefined)?recentSale.streetDirSuffix+' ':'';f+=(recentSale.streetSuffix!==undefined)?recentSale.streetSuffix+' ':'';f+=(recentSale.unit!==undefined)?recentSale.unit+' ':'';f+='</td></tr>';f+='<tr> <td class="subHed">'+recentSale.city+', '+recentSale.state+' '+recentSale.zip+'</td></tr>';f+='<tr> <td class="subHed">'+'Distance '+recentSale.distance+'</td></tr>';f+='</tbody></table>';f+='<table class="striped"><tbody>';if(recentSale.transactionType!==undefined&&recentSale.transactionType!==''){switch(recentSale.salesCode){case'0':salesCode='Unknown';break;case'A':salesCode='Actual sale price';break;case'C':salesCode='Confirmed';break;case'E':salesCode='Estimated';break;case'F':salesCode='Actual sale price (full)';break;case'L':salesCode='Less liens and encumberances';break;case'N':salesCode='Non-disclosed sale price - from stamps on back of deed';break;case'P':salesCode='Actual sale price (partial)';break;case'R':salesCode='Lease';break;case'S':salesCode='County Source';break;case'U':salesCode='Unknown';break;case'V':salesCode='Confirmed';break;}}
if(recentSale.saledate!==undefined&&recentSale.saledate!==''&&recentSale.saleprice!==undefined&&recentSale.saleprice!==''){f+='<tr><td colspan="2"class="subHed"><span class="dateClosed" style="float:right;">Closed ';f+=recentSale.saledate+'</span> <p class="description">Sold for '+recentSale.saleprice+' ('+salesCode+')</p> </td> </tr>';}
if(recentSale.propType!==undefined&&recentSale.propType!==''){f+='<tr><td class="cell1"> <p class="description">';if(recentSale.transactionType!==undefined&&recentSale.transactionType!==''){switch(recentSale.transactionType){case'1':recentSale.transactionType='Resale - ';break;case'2':recentSale.transactionType='Stand Alone Finance  - ';break;case'3':recentSale.transactionType='New Construction - ';break;case'4':recentSale.transactionType='Timeshare - ';break;case'6':recentSale.transactionType='Construction Loan/Financing - ';break;case'7':recentSale.transactionType='Seller Carryback - ';break;case'9':recentSale.transactionType='Nominal - Non/Arms Length Sale - ';break;case'D':recentSale.transactionType='Release of Mortgage/Deed of Trust - ';break;case'P':recentSale.transactionType='Pre-foreclosure - ';break;case'S':recentSale.transactionType='Assignment - ';break;}
f+=recentSale.transactionType;}
f+=recentSale.propType;f+='</p> </td> <td class="cell2">';f+='<p class="description"></p></td></tr>';}
if(recentSale.bedrooms!==undefined&&recentSale.bedrooms!==''){f+='<tr><td class="cell1"> <p class="description"> Beds: '+recentSale.bedrooms+'</p> </td> <td class="cell2">';f+='<p class="description"></p></td></tr>';}
if(recentSale.baths!==undefined&&recentSale.baths!==''){f+='<tr><td class="cell1"> <p class="description"> Baths: '+recentSale.baths+'</p> </td> <td class="cell2">';f+='<p class="description"></p></td></tr>';}
if(recentSale.lotarea!==undefined&&recentSale.lotarea!==''){f+='<tr><td class="cell1"> <p class="description"> Lot size: '+recentSale.lotarea+'</p> </td> <td class="cell2">';f+='<p class="description"></p></td></tr>';}
if(recentSale.builtyear!==undefined&&recentSale.builtyear!==''){f+='<tr><td class="cell1"> <p class="description"> Built in '+recentSale.builtyear+'</p> </td> <td class="cell2">';f+='<p class="description"></p></td></tr>';}
f+='</tbody> </table> </div> </div>';var htmlObject=jQuery(f);jQuery('.striped > tbody > tr:even',htmlObject).addClass('even');jQuery('.striped > tbody > tr:odd',htmlObject).addClass('odd');return htmlObject.html();},formatRecentSaleBrief:function(recentSale){jQuery.log("Formatting Recent Sale brief");var f='<p>';if(recentSale.saleprice!==undefined&&recentSale.saleprice!==''){f+='<strong class="listTitle">'+recentSale.saleprice+' - ';}
f+=(recentSale.houseNumber!==undefined)?recentSale.houseNumber+' ':'';f+=(recentSale.streetDirPrefix!==undefined)?recentSale.streetDirPrefix+' ':'';f+=(recentSale.streetName!==undefined)?recentSale.streetName+' ':'';f+=(recentSale.streetDirSuffix!==undefined)?recentSale.streetDirSuffix+' ':'';f+=(recentSale.streetSuffix!==undefined)?recentSale.streetSuffix+' ':'';f+=(recentSale.unit!==undefined)?recentSale.unit+' ':'';f+='</strong>';f+='<span class="moreInfo"></span><br/>';if(recentSale.bedrooms!==undefined&&recentSale.bedrooms!==''){f+='Beds: '+recentSale.bedrooms+' ';}else{f+='Beds: NA ';}
if(recentSale.baths!==undefined&&recentSale.baths!==''){f+='Baths: '+recentSale.baths;}else{f+='Baths: NA';}
f+='</p>';return f;},formatRecentSaleBriefText:function(recentSale){jQuery.log("Formatting Recent Sale brief (text-only)");recentSale.line1=recentSale.streetAddress;recentSale.zipcode=recentSale.zip;return((recentSale.saleprice!==undefined)?recentSale.saleprice:'Priceless')+' | '+LocalInfoWidget.fn.formatPropertyBriefText(recentSale);},formatGoogleLocalBrief:function(n){jQuery.log("Formatting Google Local brief");n.line1=n.streetAddress;n.state=n.region;return'<p><strong class="listTitle">'+n.titleNoFormatting+'</strong><br/>'+LocalInfoWidget.fn.formatPropertyBriefText(n)+'</p>';},formatGoogleLocalBriefText:function(n){jQuery.log("Formatting Google Local brief (text-only)");return(n.titleNoFormatting!==undefined)?n.titleNoFormatting:'Unknown';},formatSchoolBrief:function(school){jQuery.log("Formatting School brief");var f='<p>';if(school.institutionName!==undefined&&school.institutionName!==''){f+='<strong class="listTitle">'+school.institutionName+'</strong>';}
f+='<span class="bar"> | </span><span class="moreInfo"></span><br/>';if(school.addressLine1!==undefined&&school.addressLine1!==''){f+=school.addressLine1;}
f+='</p>';return f;},formatSchoolBriefText:function(school){jQuery.log("Formatting School brief (text-only)");return(school.institutionName!==undefined)?school.institutionName:'School';},formatErrorMessageNoDataFound:function(categoryName){return'<p>Sorry, we could not find any '+categoryName+' in the area you searched, '+LocalInfoWidget.defaults.eAreaDisplay.text()+'.</p><p>If you believe that we should have found '+categoryName+', please <a href="http://www.homescape.com/company/feedback" target="_blank">send an email</a> to support.</p>';},setLatLong:function(){}},coordinateBounds:{swLat:null,swLong:null,neLat:null,neLong:null},property:[]};LocalInfoWidget.fn.saveUserPreferences=function(){jQuery.each(LocalInfoWidget.defaults.categoryOptions,function(categoryName,categoryObject){try{var userCategoryObject=LocalInfoWidget.preferences.user.categoryOptions[categoryName];if(userCategoryObject===undefined||userCategoryObject.constructor!==Object){LocalInfoWidget.preferences.user.categoryOptions[categoryName]={displayListResults:categoryObject.displayListResults,displayMapPlots:categoryObject.displayMapPlots};}else{if(categoryName=='recentSales'){if(userCategoryObject!==undefined&&userCategoryObject.constructor===Object){userCategoryObject.displayListResults=categoryObject.displayListResults;userCategoryObject.displayMapPlots=categoryObject.displayMapPlots;}else{userCategoryObject={displayListResults:categoryObject.displayListResults,displayMapPlots:categoryObject.displayMapPlots};}}else{jQuery.each(categoryObject,function(objectIndex,objectValue){if(objectValue!==undefined&&objectValue.constructor===Object){if(userCategoryObject[objectIndex]!==undefined){userCategoryObject[objectIndex].displayListResults=objectValue.displayListResults;userCategoryObject[objectIndex].displayMapPlots=objectValue.displayMapPlots;}else{userCategoryObject[objectIndex]={displayListResults:objectValue.displayListResults,displayMapPlots:objectValue.displayMapPlots};}}});}}}catch(e){LocalInfoWidget.preferences.user={categoryOptions:{}};jQuery.log(e);}});try{var userPrefJSONString=jQuery.toJSONString(LocalInfoWidget.preferences.user.categoryOptions);jQuery.cookie('localInfoWidget_userPrefs',userPrefJSONString,LocalInfoWidget.defaults.cookieOptions);}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.mouseOverLocalPoiOption=function(){jQuery(this).addClass('localPoiOptionHover');if(jQuery.browser.msie){jQuery(this).css('cursor','hand');}else{jQuery(this).css('cursor','pointer');}};LocalInfoWidget.fn.mouseOutLocalPoiOption=function(){jQuery(this).removeClass('localPoiOptionHover');jQuery(this).css('cursor','default');};LocalInfoWidget.fn.mouseOverLocalListResult=function(){jQuery(this).addClass('listResultHover');if(jQuery.browser.msie){jQuery(this).css('cursor','hand');}else{jQuery(this).css('cursor','pointer');}};LocalInfoWidget.fn.mouseOutLocalListResult=function(){jQuery(this).removeClass('listResultHover');jQuery(this).css('cursor','default');};LocalInfoWidget.fn.mouseOverPagination=function(){jQuery(this).addClass('paginationHover');if(jQuery.browser.msie){jQuery(this).css('cursor','hand');}else{jQuery(this).css('cursor','pointer');}};LocalInfoWidget.fn.mouseOutPagination=function(){jQuery(this).removeClass('paginationHover');jQuery(this).css('cursor','default');};LocalInfoWidget.fn.displayLoadingOverlay=function(){try{LocalInfoWidget.eLoadingOverlayBg=jQuery('#overlayBackground_localInfoWidget').expandToCoverBody();LocalInfoWidget.eLoadingOverlay=jQuery('#overlayHolder_localInfoWidget').expandToCoverBody();LocalInfoWidget.lazy.hideLoadingOverlay=setTimeout(LocalInfoWidget.fn.lazyHideLoadingOverlay,LocalInfoWidget.defaults.lazyInterval*2);}catch(e){alert(e);}};LocalInfoWidget.fn.hideLoadingOverlay=function(){try{LocalInfoWidget.eLoadingOverlayBg.hide();LocalInfoWidget.eLoadingOverlay.hide();}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.lazyHideLoadingOverlay=function(){if(LocalInfoWidget.lazy.hideLoadingOverlay!==undefined){clearTimeout(LocalInfoWidget.lazy.hideLoadingOverlay);}
if(LocalInfoWidget.catsLoading>0||LocalInfoWidget.catsSetupRemaining>0){LocalInfoWidget.lazy.hideLoadingOverlay=setTimeout(LocalInfoWidget.fn.lazyHideLoadingOverlay,LocalInfoWidget.defaults.lazyInterval*2);}else{LocalInfoWidget.lazy.hideLoadingOverlay=setTimeout(LocalInfoWidget.fn.hideLoadingOverlay,LocalInfoWidget.defaults.timeoutInterval);}};jQuery.fn.localInfoWidget=function(settings){settings=jQuery.extend({key:'',serviceHost:'www.homefinder.com',latitude:'',longitude:'',zipcode:'',radius_miles:5,mapKey:'ABQIAAAAG3HhhYpeE9Vix3d4gMoTUhQbPO2TtUlTRyBQErOc90Skx2m9rxQxWT6FohWWTFOcManVgBK3uu1h-A',display_dmgp:false,display_dmgp_morelink:false,display_realestate:false,display_school:true,display_recentsales:true,max_num_zip_dmgp:1,max_num_school:6,min_num_school:3,max_num_rcntsales:20,view:'default',version:'',property_info:{},category_options:{},printflyer_url:'',driving_directions_destination_url:'',details_destination_url:'',neighborhood_info_url:'',display_feedbacklink:true,display_drivingdirections:false,display_printlink:true,display_errors:true,displayInline:true},settings);settings.mapKey="ABQIAAAAG3HhhYpeE9Vix3d4gMoTUhQbPO2TtUlTRyBQErOc90Skx2m9rxQxWT6FohWWTFOcManVgBK3uu1h-A";LocalInfoWidget.widget={};LocalInfoWidget.widget.settings=settings;LocalInfoWidget.widget.view=LocalInfoWidget.widget.settings.view;LocalInfoWidget.defaults.displayPrintLink=LocalInfoWidget.widget.settings.display_printlink;LocalInfoWidget.property=LocalInfoWidget.widget.settings.property_info;var validPropertyExists=false;try{if(settings.property_info!==undefined){if(settings.property_info.constructor===Object&&settings.property_info.latitude!==undefined&&settings.property_info.longitude!==undefined){LocalInfoWidget.defaults.coordinate.latitude=parseFloat(settings.property_info.latitude);LocalInfoWidget.defaults.coordinate.longitude=parseFloat(settings.property_info.longitude);jQuery.log('A valid property exists');validPropertyExists=true;}else if(settings.property_info.constructor===Array&&settings.property_info.length>0&&settings.property_info[0].latitude!==undefined&&settings.property_info[0].longitude!==undefined){LocalInfoWidget.defaults.coordinate.latitude=parseFloat(settings.property_info[0].latitude);LocalInfoWidget.defaults.coordinate.longitude=parseFloat(settings.property_info[0].longitude);jQuery.log('A valid property exists');validPropertyExists=true;}}}catch(e){jQuery.log(e);validPropertyExists=false;}
if(!validPropertyExists){jQuery.log('A valid property does NOT exist');LocalInfoWidget.defaults.coordinate.latitude=parseFloat(settings.latitude);LocalInfoWidget.defaults.coordinate.longitude=parseFloat(settings.longitude);}
try{if(isNaN(LocalInfoWidget.defaults.coordinate.latitude)||isNaN(LocalInfoWidget.defaults.coordinate.longitude)&&settings.display_errors){jQuery(this).append('<div id="localInfoWidget" class="localInfoWidgetMapListener"><div id="invalidRequest" class="error"><p>We are unable to display local information for the requested area.</p><p>If you believe this is an error please <a href="http://www.homescape.com/company/feedback" target="_blank">send us an email</a>.</p></div></div>');}else{try{if(settings.display_drivingdirections&&validPropertyExists){jQuery.log('Driving directions integration will display');LocalInfoWidget.defaults.integrateDrivingDirections=true;}else{jQuery.log('Driving directions integration will NOT display');LocalInfoWidget.defaults.integrateDrivingDirections=false;}}catch(e){jQuery.log(e);}
try{LocalInfoWidget.widget.eTarget=jQuery(this);LocalInfoWidget.widget.dHolderId='__lWidgetHolder';LocalInfoWidget.widget.eHolder=jQuery('#'+LocalInfoWidget.widget.dHolderId);}catch(e){jQuery.log(e);}
try{if(LocalInfoWidget.widget.eHolder.length===0){LocalInfoWidget.widget.eHolder=jQuery('<div id="'+LocalInfoWidget.widget.dHolderId+'"></div>');jQuery('body').append(LocalInfoWidget.widget.eHolder);}}catch(e){jQuery.log(e);}
try{settings.serviceHost=(settings.serviceHost===undefined||settings.serviceHost==='')?"www.homefinder.com":settings.serviceHost;}catch(e){jQuery.log(e);}
Homescape.fn.expandDomainSecurity();try{LocalInfoWidget.widget.serviceUrl='http://www.homefinder.com/_widgets/localInfo/';if(settings.version===undefined||settings.version===''||Number(settings.version)<2){settings.version='1.0';LocalInfoWidget.widget.serviceUrl+='aggregate.php';}
LocalInfoWidget.widget.appHost=document.location.host;LocalInfoWidget.widget.css={};}catch(e){jQuery.log(e);}
try{if(settings.displayInline){try{jQuery.ajax({dataType:'jsonp',url:LocalInfoWidget.widget.serviceUrl,data:{key:settings.key,latitude:settings.latitude,longitude:settings.longitude,zipcode:settings.zipcode,radius_miles:settings.radius_miles,display_dmgp:settings.display_dmgp,display_dmgp_morelink:settings.display_dmgp_morelink,display_realestate:settings.display_realestate,display_school:settings.display_school,display_recentsales:settings.display_recentsales,max_num_zip_dmgp:settings.max_num_zip_dmgp,max_num_school:settings.max_num_school,min_num_school:settings.min_num_school,max_num_rcntsales:settings.max_num_rcntsales,view:settings.view,version:settings.version,display_feedbacklink:settings.display_feedbacklink,display_drivingdirections:settings.display_drivingdirections,display_printlink:settings.display_printlink,display_errors:settings.display_errors},success:function(json){LocalInfoWidget.widget.eTarget.append(json);LocalInfoWidget.fn.setupWidget();}});}catch(e){jQuery.log(e);}}else{jQuery.each(settings,function(i,n){if(!(i=='printflyer_url'||i=='driving_directions_destination_url'||i=='details_destination_url'||i=='neighborhood_info_url')){jQuery.log('Adding the "'+i+'" parameter to the serviceHost url');LocalInfoWidget.widget.serviceUrl=jQuery.urlAddParm(LocalInfoWidget.widget.serviceUrl,i,n);}});if(DEBUG){LocalInfoWidget.widget.serviceUrl=jQuery.urlAddParm(LocalInfoWidget.widget.serviceUrl,'_debug',true);}
jQuery.log('LocalInfoWidget.widget.serviceUrl = '+LocalInfoWidget.widget.serviceUrl);LocalInfoWidget.widget.eIframe=jQuery('<iframe src="'+LocalInfoWidget.widget.serviceUrl+'" id="__lWidget" name="__lWidget" frameborder="0"></iframe>');LocalInfoWidget.widget.iheight=(settings.view=='minimap')?25:400;try{if(LocalInfoWidget.widget.eTarget.height()===undefined||LocalInfoWidget.widget.eTarget.height()<100){LocalInfoWidget.widget.iheight=(settings.view=='minimap')?25:400;}else{LocalInfoWidget.widget.iheight=LocalInfoWidget.widget.eTarget.height();}}catch(e){jQuery.log(e);}
LocalInfoWidget.widget.iwidth=400;try{if(LocalInfoWidget.widget.eTarget.width()===undefined||LocalInfoWidget.widget.eTarget.width()<100){LocalInfoWidget.widget.iwidth=400;}else{LocalInfoWidget.widget.iwidth=LocalInfoWidget.widget.eTarget.width();}}catch(e){jQuery.log(e);}
LocalInfoWidget.widget.oflow='hidden';try{if(LocalInfoWidget.widget.oflow===undefined||LocalInfoWidget.widget.oflow===''){LocalInfoWidget.widget.oflow='hidden';}}catch(e){jQuery.log(e);}
try{if(LocalInfoWidget.widget.oflow=='hidden'){LocalInfoWidget.widget.eIframe.attr('scrolling','no');}}catch(e){jQuery.log(e);}
try{LocalInfoWidget.widget.eIframe.attr('height',LocalInfoWidget.widget.iheight).attr('width',LocalInfoWidget.widget.iwidth);LocalInfoWidget.widget.css={width:LocalInfoWidget.widget.iwidth,height:LocalInfoWidget.widget.iheight,border:'0',padding:'0',overflow:LocalInfoWidget.widget.oflow};LocalInfoWidget.widget.eIframe.css(LocalInfoWidget.widget.css);}catch(e){jQuery.log(e);}
LocalInfoWidget.widget.eTarget.append(LocalInfoWidget.widget.eIframe);}}catch(_e){jQuery.log(_e);}}}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.genericCategoryToggleListResults=function(thisCategory){if(!thisCategory.displayListResults){thisCategory.eHeader.addClass('PoiChecked');thisCategory.eLegend.addClass('PoiChecked');if(thisCategory.pagination.resultCount>thisCategory.resultsPerPage){thisCategory.ePagination.show();jQuery('li',thisCategory.eResults).hide();jQuery('li',thisCategory.eResults).slice(thisCategory.pagination.startIndex,thisCategory.pagination.endIndex).show();}
jQuery('.nonResult',thisCategory.eContainer).show();thisCategory.eResults.show();thisCategory.eHeaderIcon.show();thisCategory.displayListResults=true;}else{thisCategory.eHeader.removeClass('PoiChecked');thisCategory.eLegend.removeClass('PoiChecked');jQuery('.nonResult',thisCategory.eContainer).hide();thisCategory.eResults.hide();jQuery('li',thisCategory.eResults).removeClass('PoiChecked');thisCategory.eHeaderIcon.hide();thisCategory.displayListResults=false;thisCategory.ePagination.hide();thisCategory.pagination.startIndex=0;thisCategory.pagination.endIndex=thisCategory.resultsPerPage;jQuery('.next',thisCategory.ePagination).show();jQuery('.previous',thisCategory.ePagination).hide();thisCategory.eResults.attr('start',thisCategory.pagination.startIndex+1);}};LocalInfoWidget.fn.genericCategoryHeaderSetup=function(thisCategory){try{jQuery.reportClickEvent(window.Homescape.Reporting,{name:'LocalInfoWidget: Category Header Bar ('+thisCategory.name+')'});}catch(e){jQuery.log(e);}
jQuery.log(thisCategory.name+' category clicked');if(!(thisCategory.eHeader.hasClass('PoiLoading'))){if(!thisCategory.dataLoaded){if(thisCategory.fn.loadData!==undefined&&thisCategory.fn.loadData.constructor===Function){jQuery.log('headerSetup - - calling data load function for: '+thisCategory.name);toggleOptions={toggleMapResults:false,toggleListResults:true};thisCategory.fn.loadData(toggleOptions);}}else{LocalInfoWidget.fn.genericCategoryToggleListResults(thisCategory);if(!thisCategory.displayListResults&&thisCategory.displayMapPlots){LocalInfoWidget.fn.genericCategoryToggleMapResults(thisCategory);}else if(thisCategory.displayListResults&&!thisCategory.displayMapPlots){LocalInfoWidget.fn.genericCategoryToggleMapResults(thisCategory);}}}};LocalInfoWidget.fn.genericCategoryLegendSetup=function(thisCategory){try{jQuery.reportClickEvent(window.Homescape.Reporting,{name:'LocalInfoWidget: Category Legend ('+thisCategory.name+')'});}catch(e){jQuery.log(e);}
jQuery.log('Legend clicked: '+thisCategory.eLegend.text());if(!thisCategory.dataLoaded&&!(thisCategory.eHeader.hasClass('PoiLoading'))){if(thisCategory.fn.loadData!==undefined&&thisCategory.fn.loadData.constructor===Function){thisCategory.fn.loadData({toggleMapResults:true,toggleListResults:false});}}else{LocalInfoWidget.fn.genericCategoryToggleMapResults(thisCategory);}};LocalInfoWidget.fn.genericCategoryToggleMapResults=function(thisCategory){if(!thisCategory.displayMapPlots){LocalInfoWidget.fn.addMapMarkers(thisCategory.markers.slice(thisCategory.pagination.startIndex,thisCategory.pagination.endIndex));thisCategory.displayMapPlots=true;thisCategory.eLegend.addClass('PoiChecked');if(!thisCategory.displayListResults){thisCategory.eHeader.animate({opacity:0.5},LocalInfoWidget.defaults.timeoutInterval).animate({opacity:1},LocalInfoWidget.defaults.timeoutInterval);}}else{thisCategory.displayMapPlots=false;LocalInfoWidget.fn.removeMapMarkers(thisCategory.markers);thisCategory.eLegend.removeClass('PoiChecked');jQuery('li',thisCategory.eResults).removeClass('PoiChecked');}};LocalInfoWidget.fn.genericDataLoadComplete=function(thisCategory,results,toggleOptions){try{if(thisCategory!==undefined&&results!==undefined&&results.constructor===Array){try{jQuery.reportClickEvent(window.Homescape.Reporting,{name:'LocalInfoWidget: Category Loaded ('+thisCategory.name+')'});}catch(e){jQuery.log(e);}
thisCategory.dataLoaded=true;thisCategory.results=results;jQuery.log(thisCategory.name+' loaded.');thisCategory.pagination={startIndex:0,endIndex:thisCategory.resultsPerPage,resultCount:(thisCategory.results===undefined||thisCategory.results.constructor!==Array||thisCategory.results.length===undefined||thisCategory.results.length===null)?0:thisCategory.results.length};if(thisCategory.pagination.resultCount>0){thisCategory.ePagination.insertAfter(thisCategory.eHeader).append(thisCategory.ePrevious).append('<span class="bar">|</span>').append(thisCategory.eNext);jQuery.each(thisCategory.results,function(i,n){if(n.lon>0){n.lon=Number('-'+n.lon);}
var thisResultIdName=thisCategory.cssClassName+'_'+i;if(n.lng!==undefined){n.lon=n.lng;}
var m=new GMarker(new GLatLng(n.lat,n.lon),{icon:new GIcon(LocalInfoWidget.defaults.baseMapIcon,thisCategory.iconImg.map.inactive.replace('$1',i+1)),dragCrossMove:false,title:thisCategory.fn.formatBriefText(n),clickable:true,draggable:false});thisCategory.markers[i]=m;var eResultFormatted=jQuery(thisCategory.fn.formatBrief(n));if(thisCategory.fn.formatDetail!==undefined&&thisCategory.fn.formatDetail.constructor===Function){var eResultDetailsLink=jQuery('.moreInfo',eResultFormatted).append('more info').click(function(){thisCategory.fn.formatDetail(n);return false;});eResultDetailsLink.show();}
var eListResult=jQuery('<li id="'+thisResultIdName+'"></li>').append(eResultFormatted).hover(LocalInfoWidget.fn.mouseOverLocalListResult,LocalInfoWidget.fn.mouseOutLocalListResult);GEvent.addListener(m,"click",function(){try{jQuery.reportClickEvent(window.Homescape.Reporting,{name:'LocalInfoWidget: Map Plot ('+thisCategory.name+')'});}catch(e){jQuery.log(e);}
if(n.openMapInfoWindow){m.openInfoWindowHtml(thisCategory.fn.formatBrief(n));}
m.setImage(eListResult.hasClass('PoiChecked')?thisCategory.iconImg.map.inactive.replace('$1',i+1):thisCategory.iconImg.map.active.replace('$1',i+1));if(!thisCategory.displayListResults){thisCategory.eHeader.animate({opacity:0.5},LocalInfoWidget.defaults.timeoutInterval).animate({opacity:1},LocalInfoWidget.defaults.timeoutInterval);}
eListResult.toggleClass('PoiChecked');});thisCategory.eResults.append(eListResult);eListResult.click(function(){try{jQuery.reportClickEvent(window.Homescape.Reporting,{name:'LocalInfoWidget: List Result ('+thisCategory.name+')'});}catch(e){jQuery.log(e);}
try{m.setImage(eListResult.hasClass('PoiChecked')?thisCategory.iconImg.map.inactive.replace('$1',i+1):thisCategory.iconImg.map.active.replace('$1',i+1));}catch(e){jQuery.log(e);}
eListResult.toggleClass('PoiChecked');});});if(toggleOptions.toggleListResults){LocalInfoWidget.fn.genericCategoryToggleListResults(thisCategory);LocalInfoWidget.fn.genericCategoryToggleMapResults(thisCategory);}
if(toggleOptions.toggleMapResults){LocalInfoWidget.fn.genericCategoryToggleMapResults(thisCategory);}
thisCategory.results=[];}else{thisCategory.eHeader.addClass('PoiUnavailable');thisCategory.eResults.show().append('<li class="noResults error">'+LocalInfoWidget.fn.formatErrorMessageNoDataFound(thisCategory.name)+'</li>');jQuery('.nonResult',thisCategory.eContainer).hide();thisCategory.displayListResults=true;thisCategory.displayMapPlots=false;}}}catch(e_nodata){jQuery.log(e_nodata);}
LocalInfoWidget.catsLoading--;LocalInfoWidget.fn.lazyUpdateMapBounds();};LocalInfoWidget.fn.genericCategorySetup=function(thisCategory){try{thisCategory.eResults=jQuery('.'+thisCategory.cssClassName);thisCategory.eHeader=jQuery('.'+thisCategory.cssHeaderClassName);thisCategory.eLegend=jQuery('.'+thisCategory.cssClassName+'Legend').prepend('<img src="'+thisCategory.iconImg.list+'" alt=""/>');thisCategory.eHeaderIcon=jQuery('.'+thisCategory.cssClassName+'Icon');thisCategory.eContainer=thisCategory.eHeader.parent();thisCategory.ePagination=jQuery('<p class="pagination" style="display: none;"></p>');thisCategory.ePrevious=jQuery('<span class="previous hoverable" style="display: none;">Previous</span>').click(function(){jQuery.log('previous clicked');if(thisCategory.pagination.startIndex>0){thisCategory.eNext.show();thisCategory.pagination.endIndex=thisCategory.pagination.startIndex;thisCategory.pagination.startIndex-=thisCategory.resultsPerPage;jQuery('li',thisCategory.eResults).removeClass('PoiChecked').hide();thisCategory.eResults.attr('start',thisCategory.pagination.startIndex+1);jQuery('li',thisCategory.eResults).slice(thisCategory.pagination.startIndex,thisCategory.pagination.endIndex).show();if(thisCategory.pagination.startIndex===0){thisCategory.ePrevious.hide();}
if(thisCategory.displayMapPlots){LocalInfoWidget.fn.removeMapMarkers(thisCategory.markers);LocalInfoWidget.fn.addMapMarkers(thisCategory.markers.slice(thisCategory.pagination.startIndex,thisCategory.pagination.endIndex));}
LocalInfoWidget.fn.lazyUpdateMapBounds();}}).hover(LocalInfoWidget.fn.mouseOverPagination,LocalInfoWidget.fn.mouseOutPagination);thisCategory.eNext=jQuery('<span class="next hoverable">Next</span>').click(function(){jQuery.log('next clicked');if(thisCategory.pagination.startIndex<thisCategory.pagination.resultCount){thisCategory.ePrevious.show();thisCategory.pagination.startIndex+=thisCategory.resultsPerPage;thisCategory.pagination.endIndex=thisCategory.pagination.startIndex+thisCategory.resultsPerPage;jQuery('li',thisCategory.eResults).removeClass('PoiChecked').hide();thisCategory.eResults.attr('start',thisCategory.pagination.startIndex+1);jQuery('li',thisCategory.eResults).slice(thisCategory.pagination.startIndex,thisCategory.pagination.endIndex).show();if(thisCategory.pagination.endIndex>=thisCategory.pagination.resultCount){thisCategory.eNext.hide();}
if(thisCategory.displayMapPlots){LocalInfoWidget.fn.removeMapMarkers(thisCategory.markers);LocalInfoWidget.fn.addMapMarkers(thisCategory.markers.slice(thisCategory.pagination.startIndex,thisCategory.pagination.endIndex));}
LocalInfoWidget.fn.lazyUpdateMapBounds();}}).hover(LocalInfoWidget.fn.mouseOverPagination,LocalInfoWidget.fn.mouseOutPagination);thisCategory.eHeader.click(function(){LocalInfoWidget.fn.genericCategoryHeaderSetup(thisCategory);});thisCategory.eLegend.click(function(){LocalInfoWidget.fn.genericCategoryLegendSetup(thisCategory);});if(thisCategory.displayMapPlots||thisCategory.displayListResults){thisCategory.displayMapPlots=false;thisCategory.displayListResults=false;setTimeout(thisCategory.fn.loadData({toggleMapResults:false,toggleListResults:true}),LocalInfoWidget.defaults.lazyInterval*(LocalInfoWidget.catsLoading+1));}}catch(e_categoryNotSetup){jQuery.log(e_categoryNotSetup);}};LocalInfoWidget.fn.atLeastOneSchoolCategoryWithDataLoaded=function(){var categoriesWithDataLoaded=0;try{if(LocalInfoWidget.defaults.categoryOptions.schools.dataLoaded){jQuery.each(LocalInfoWidget.defaults.categoryOptions.schools,function(a,b){if(b.constructor===Object){jQuery.log('school sub category '+a+'.pagination.resultCount = '+b.pagination.resultCount);if(b.pagination.resultCount>0){categoriesWithDataLoaded++;}}});}}catch(e){jQuery.log(e);}
jQuery.log('Currently, there are '+categoriesWithDataLoaded+' school sub-categories with data loaded');return categoriesWithDataLoaded>0?true:false;};LocalInfoWidget.fn.atLeastOneSchoolCategoryPlotted=function(){var categoriesDisplayed=0;jQuery.each(LocalInfoWidget.defaults.categoryOptions.schools,function(a,b){if(b.constructor===Object){jQuery.log('school sub category '+a+'.displayMapPlots = '+b.displayMapPlots);if(b.displayMapPlots!==undefined&&b.displayMapPlots){categoriesDisplayed++;}}});jQuery.log('Currently, there are '+categoriesDisplayed+' school sub-categories plotted');return categoriesDisplayed>0?true:false;};LocalInfoWidget.fn.atLeastOneSchoolCategoryDisplayed=function(){var categoriesDisplayed=0;jQuery.each(LocalInfoWidget.defaults.categoryOptions.schools,function(a,b){if(b.constructor===Object){jQuery.log('school sub category '+a+'.displayListResults = '+b.displayListResults);if((b.displayListResults!==undefined&&b.displayListResults)||b.eHeader.hasClass('PoiChecked')){categoriesDisplayed++;}}});jQuery.log('Currently, there are '+categoriesDisplayed+' school sub-categories displayed');return categoriesDisplayed>0?true:false;};LocalInfoWidget.fn.schoolDetailsOverlay=function(school){jQuery.log('Getting the school details for schoolId = '+school.id);jQuery.ajax({dataType:'jsonp',url:LocalInfoWidget.widget.serviceUrl+'schoolDetail.php',data:{id:school.id},success:function(html){jQuery('#detailsOverlay').parent().parent().remove();var eMoreInfo=jQuery('<div id="detailsOverlay">'+html+'</div>');eMoreInfo.overlay({name:'schools',clickAnywhereToClose:false,showPrintLink:LocalInfoWidget.defaults.displayPrintLink},'#'+LocalInfoWidget.mapElementId);var path='';try{loc=parent.window.location.pathname;}catch(e){path=window.location.pathname;jQuery.log(e);}
try{jQuery.reportPageView(Homescape.Reporting,{name:'LocalInfoWidget: Detailed School Information (Overlay)',type:'Overlay',path:path+'/school/'+schoolId});}catch(e){jQuery.log(e);}}});};LocalInfoWidget.fn.setupSchools=function(){jQuery.each(LocalInfoWidget.defaults.categoryOptions.schools,function(i,n){jQuery.log('LocalInfoWidget.defaults.categoryOptions.schools.'+i+'.'+n);var thisCategory=n;thisCategory.queryText=i;if(jQuery('.'+thisCategory.cssClassName).length>0&&!thisCategory.dataLoaded){thisCategory.fn.formatBrief=LocalInfoWidget.fn.formatSchoolBrief;thisCategory.fn.formatBriefText=LocalInfoWidget.fn.formatSchoolBriefText;thisCategory.fn.formatDetail=LocalInfoWidget.fn.schoolDetailsOverlay;thisCategory.fn.loadData=function(toggleOptions){thisCategory.eHeader.addClass('PoiLoading');LocalInfoWidget.catsLoading++;jQuery.ajax({dataType:'jsonp',url:LocalInfoWidget.widget.serviceUrl+'_schools_ajax.php',data:{latitude:LocalInfoWidget.defaults.coordinate.latitude,longitude:LocalInfoWidget.defaults.coordinate.longitude,schoolType:thisCategory.queryText},success:function(json){LocalInfoWidget.fn.genericDataLoadComplete(thisCategory,json[thisCategory.queryText],toggleOptions);thisCategory.eHeader.removeClass('PoiLoading');}});};LocalInfoWidget.fn.genericCategorySetup(thisCategory);}});LocalInfoWidget.catsSetupRemaining--;};LocalInfoWidget.fn.recentSalesOverlay=function(recentSale){jQuery.log('Creating the recent sale overlay');jQuery('#detailsOverlay').parent().parent().remove();var eMoreInfo=jQuery('<div id="detailsOverlay">'+LocalInfoWidget.fn.formatRecentSaleDetails(recentSale)+'</div>');jQuery('.moreInfo',eMoreInfo).hide();jQuery('.bar',eMoreInfo).hide();eMoreInfo.overlay({name:'recentSales',clickAnywhereToClose:false,showPrintLink:LocalInfoWidget.defaults.displayPrintLink},'#'+LocalInfoWidget.mapElementId);var path='';try{loc=parent.window.location.pathname;}catch(e){path=window.location.pathname;jQuery.log(e);}
try{jQuery.reportPageView(Homescape.Reporting,{name:'LocalInfoWidget: Detailed Recent Sales Information (Overlay)',type:'Overlay',path:path+'/recentSale/'+recentSale});}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.setupRecentSales=function(){if(jQuery('.'+LocalInfoWidget.defaults.categoryOptions.recentSales.cssClassName).length>0&&!LocalInfoWidget.defaults.categoryOptions.recentSales.dataLoaded){var thisCategory=LocalInfoWidget.defaults.categoryOptions.recentSales;thisCategory.fn.formatBrief=LocalInfoWidget.fn.formatRecentSaleBrief;thisCategory.fn.formatBriefText=LocalInfoWidget.fn.formatRecentSaleBriefText;thisCategory.fn.formatDetail=LocalInfoWidget.fn.recentSalesOverlay;thisCategory.fn.loadData=function(toggleOptions){thisCategory.eHeader.addClass('PoiLoading');LocalInfoWidget.catsLoading++;jQuery.ajax({dataType:'jsonp',url:LocalInfoWidget.widget.serviceUrl+'_recentSales_ajax.php',data:{latitude:LocalInfoWidget.defaults.coordinate.latitude,longitude:LocalInfoWidget.defaults.coordinate.longitude},success:function(json){LocalInfoWidget.fn.genericDataLoadComplete(LocalInfoWidget.defaults.categoryOptions.recentSales,json.nearby,toggleOptions);thisCategory.eHeader.removeClass('PoiLoading');}});};LocalInfoWidget.fn.genericCategorySetup(thisCategory);}
LocalInfoWidget.catsSetupRemaining--;};LocalInfoWidget.fn.setupGoogleCategories=function(){jQuery.each(LocalInfoWidget.defaults.categoryOptions.google,function(i,n){jQuery.log('LocalInfoWidget.defaults.categoryOptions.google.'+i+'.'+n);var thisCategory=n;thisCategory.fn.formatBrief=LocalInfoWidget.fn.formatGoogleLocalBrief;thisCategory.fn.formatBriefText=LocalInfoWidget.fn.formatGoogleLocalBriefText;thisCategory.fn.loadData=function(toggleOptions){thisCategory.eHeader.addClass('PoiLoading');LocalInfoWidget.catsLoading++;try{thisCategory.localSearch=new GlocalSearch(null);thisCategory.localSearch.setNoHtmlGeneration();if(LocalInfoWidget.defaults.google.resultSize=='large'){thisCategory.localSearch.setResultSetSize(GSearch.LARGE_RESULTSET);}
thisCategory.localSearch.setCenterPoint(new GLatLng(LocalInfoWidget.defaults.coordinate.latitude,LocalInfoWidget.defaults.coordinate.longitude));thisCategory.localSearch.setAddressLookupMode(GlocalSearch.ADDRESS_LOOKUP_DISABLED);thisCategory.localSearch.setSearchCompleteCallback(LocalInfoWidget.fn,function(){LocalInfoWidget.fn.genericDataLoadComplete(thisCategory,thisCategory.localSearch.results,toggleOptions);thisCategory.localSearch=null;thisCategory.eHeader.removeClass('PoiLoading');});thisCategory.localSearch.execute(n.queryText);}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.genericCategorySetup(thisCategory);});LocalInfoWidget.catsSetupRemaining--;};LocalInfoWidget.fn.loadStreetview=function(){if(LocalInfoWidget.streetView.loaded){jQuery(LocalInfoWidget.streetView.container).show();}else{var glatlng=new GLatLng(LocalInfoWidget.defaults.coordinate.latitude,LocalInfoWidget.defaults.coordinate.longitude,false);LocalInfoWidget.fn.streetViewPOV(glatlng);LocalInfoWidget.streetView.loaded=true;jQuery(LocalInfoWidget.streetView.container).show();}};LocalInfoWidget.fn.streetViewPOV=function(glatlng){LocalInfoWidget.streetView.data.getNearestPanoramaLatLng(glatlng,function(googleLatLng){positivelng=(-1)*LocalInfoWidget.defaults.coordinate.longitude;positiveGlng=(-1)*googleLatLng.lng();diffX=positivelng-positiveGlng;diffY=LocalInfoWidget.defaults.coordinate.latitude-googleLatLng.lat();if(diffX<0){diffX=diffX*-1;}
if(diffY<0){diffY=diffY*-1;}
angle=0;if(positiveGlng>positivelng&&googleLatLng.lat()<LocalInfoWidget.defaults.coordinate.latitude){angle=(Math.atan(diffX/diffY)/Math.PI*180);}else if(positiveGlng<positivelng&&googleLatLng.lat()<LocalInfoWidget.defaults.coordinate.latitude){angle=360-(Math.atan(diffX/diffY)/Math.PI*180);}else if(positiveGlng<positivelng&&googleLatLng.lat()>LocalInfoWidget.defaults.coordinate.latitude){angle=180+(Math.atan(diffX/diffY)/Math.PI*180);}else if(positiveGlng>positivelng&&googleLatLng.lat()>LocalInfoWidget.defaults.coordinate.latitude){angle=180-(Math.atan(diffX/diffY)/Math.PI*180);}
var holder=new GStreetviewPanorama(jQuery(LocalInfoWidget.streetView.container)[0],{latlng:glatlng,pov:{yaw:angle,pitch:0,zoom:0}});});};LocalInfoWidget.fn.calculateCoordinateBounds=function(lat,longitude){if(LocalInfoWidget.coordinateBounds.swLat===null||LocalInfoWidget.coordinateBounds.swLat>Number(lat)){LocalInfoWidget.coordinateBounds.swLat=Number(lat);}
if(LocalInfoWidget.coordinateBounds.neLat===null||LocalInfoWidget.coordinateBounds.neLat<Number(lat)){LocalInfoWidget.coordinateBounds.neLat=Number(lat);}
if(LocalInfoWidget.coordinateBounds.swLong===null||LocalInfoWidget.coordinateBounds.swLong>Number(longitude)){LocalInfoWidget.coordinateBounds.swLong=Number(longitude);}
if(LocalInfoWidget.coordinateBounds.neLong===null||LocalInfoWidget.coordinateBounds.neLong<Number(longitude)){LocalInfoWidget.coordinateBounds.neLong=Number(longitude);}};LocalInfoWidget.fn.updateMapBounds=function(){jQuery.log('optimizing the map zoom to fit the bounds (current zoom level = '+LocalInfoWidget.defaults.zoom+')');if(LocalInfoWidget.coordinateBounds.swLat!==null&&LocalInfoWidget.coordinateBounds.swLong!==null&&LocalInfoWidget.coordinateBounds.neLat!==null&&LocalInfoWidget.coordinateBounds.neLong!==null){var bounds=new GLatLngBounds(new GLatLng(LocalInfoWidget.coordinateBounds.swLat,LocalInfoWidget.coordinateBounds.swLong),new GLatLng(LocalInfoWidget.coordinateBounds.neLat,LocalInfoWidget.coordinateBounds.neLong));var newZoom=LocalInfoWidget.map.getBoundsZoomLevel(bounds);if(newZoom!=LocalInfoWidget.defaults.zoom){LocalInfoWidget.defaults.zoom=newZoom;LocalInfoWidget.map.setCenter(bounds.getCenter(),LocalInfoWidget.defaults.zoom);}}
jQuery.log('optimized zoom level = '+LocalInfoWidget.defaults.zoom);};LocalInfoWidget.fn.lazyUpdateMapBounds=function(){if(LocalInfoWidget.lazy.updateMapBounds!==undefined){clearTimeout(LocalInfoWidget.lazy.updateMapBounds);}
LocalInfoWidget.lazy.updateMapBounds=setTimeout(LocalInfoWidget.fn.updateMapBounds,LocalInfoWidget.defaults.lazyInterval*2);};LocalInfoWidget.fn.setupDrivingDirections=function(){jQuery('beginning setup of the driving directions');LocalInfoWidget.streetView.data=new GStreetviewClient();var latlng=new GLatLng(LocalInfoWidget.defaults.coordinate.latitude,LocalInfoWidget.defaults.coordinate.longitude,false);LocalInfoWidget.streetView.data.getNearestPanoramaLatLng(latlng,function(panorama){if(panorama!=null){if(LocalInfoWidget.widget.view=='minimap'){jQuery(LocalInfoWidget.streetView.message).show();}
if(LocalInfoWidget.widget.view=='drivingdirections'){jQuery(LocalInfoWidget.streetView.controls).show();}}});if(LocalInfoWidget.widget.view=='drivingdirections'){jQuery('#mapControl').addClass('selected');}
LocalInfoWidget.directions.eForm=jQuery('#drivingDirectionsForm');LocalInfoWidget.directions.eStartingAddress_line1=jQuery('#drivingDirections_streetAddress');LocalInfoWidget.directions.eStartingAddress_city=jQuery('#drivingDirections_city');LocalInfoWidget.directions.eStartingAddress_state=jQuery('#drivingDirections_state');LocalInfoWidget.directions.eStartingAddress_zip=jQuery('#drivingDirections_zip');LocalInfoWidget.directions.eDirectionsOverview_origin=jQuery('.address_origin');LocalInfoWidget.directions.eDirectionsOverview_destination=jQuery('.address_destination');LocalInfoWidget.directions.eDirectionsOverview_distance=jQuery('.distance');LocalInfoWidget.directions.eDirectionsOverview_time=jQuery('.time');LocalInfoWidget.directions.eDirectionsOverview_turnByTurn=jQuery('.turnByTurn');LocalInfoWidget.directions.eDirectionsOverview_showReverse=jQuery('#reverseDirections');LocalInfoWidget.directions.eDirectionsOverview_printFlyer=jQuery('#printFlyer');LocalInfoWidget.directions.eDirectionsOverview_emailDirections=jQuery('#emailDirections');LocalInfoWidget.directions.eDirectionsResults=jQuery('#drivingDirections_results');LocalInfoWidget.directions.eErrorMessages=jQuery('<div id="googleErrors"></div>');LocalInfoWidget.directions.eLocalNavigatorDirections=jQuery('.drivingDirectionsHeader');LocalInfoWidget.directions.eDirectionsOverview_emailDirections.click(function(){var toEmailAddress=prompt("Enter your email address:","");var fromEmailAddress="support@homescape.com";var startingAddress=LocalInfoWidget.directions.eStartingAddress_line1.val();startingAddress=startingAddress+'+'+LocalInfoWidget.directions.eStartingAddress_city.val();startingAddress=startingAddress+'+'+LocalInfoWidget.directions.eStartingAddress_state.val();startingAddress=startingAddress+'+'+LocalInfoWidget.directions.eStartingAddress_zip.val();startingAddress=startingAddress.replace(/ /g,"+");var destinationAddress=LocalInfoWidget.fn.formatPropertyBriefText(LocalInfoWidget.directions.wayPoints[(LocalInfoWidget.directions.wayPoints.length-1)]).replace(/ /g,"+");jQuery.post('_SendDirectionsEmail.php',{to:toEmailAddress,from:fromEmailAddress,startAddress:startingAddress,endAddress:destinationAddress},function(data){});});jQuery('#mapControl').click(function(){jQuery('#localInfo_mapControls li').each(function(){jQuery(this).removeClass('selected');});LocalInfoWidget.map.setMapType(G_NORMAL_MAP);jQuery(this).addClass('selected');jQuery(LocalInfoWidget.streetView.container).hide();jQuery('#'+LocalInfoWidget.mapElementId).show();});jQuery('#satelliteControl').click(function(){jQuery('#localInfo_mapControls li').each(function(){jQuery(this).removeClass('selected');});LocalInfoWidget.map.setMapType(G_SATELLITE_MAP);jQuery(this).addClass('selected');jQuery(LocalInfoWidget.streetView.container).hide();jQuery('#'+LocalInfoWidget.mapElementId).show();});jQuery('#hybridControl').click(function(){jQuery('#localInfo_mapControls li').each(function(){jQuery(this).removeClass('selected');});LocalInfoWidget.map.setMapType(G_HYBRID_MAP);jQuery(this).addClass('selected');jQuery(LocalInfoWidget.streetView.container).hide();jQuery('#'+LocalInfoWidget.mapElementId).show();});jQuery('#streetViewControl').click(function(){jQuery('#localInfo_mapControls li').each(function(){jQuery(this).removeClass('selected');});jQuery(this).addClass('selected');jQuery('#'+LocalInfoWidget.mapElementId).hide();LocalInfoWidget.fn.loadStreetview();});LocalInfoWidget.directions.eLocalNavigatorDirections.click(function(){jQuery.cookie('localInfoWidget_fromPage',LocalInfoWidget.widget.fromPage,LocalInfoWidget.defaults.cookieOptions);LocalInfoWidget.directions.eLocalNavigatorDirections.toggleClass('PoiChecked');LocalInfoWidget.directions.eForm.toggle();LocalInfoWidget.fn.resizeWidget();});LocalInfoWidget.directions.eNavToPoi=jQuery('#navToPoi').click(function(){jQuery.cookie('localInfoWidget_fromPage',LocalInfoWidget.widget.fromPage,LocalInfoWidget.defaults.cookieOptions);jQuery.log('navigating to poi view');var poiUrl='http://'+window.location.hostname+window.location.pathname;poiUrl=jQuery.urlAddParm(poiUrl,'view','default');poiUrl=jQuery.urlAddParm(poiUrl,'zipcode',LocalInfoWidget.defaults.zipcode);poiUrl=jQuery.urlAddParm(poiUrl,'latitude',LocalInfoWidget.defaults.coordinate.latitude);poiUrl=jQuery.urlAddParm(poiUrl,'longitude',LocalInfoWidget.defaults.coordinate.longitude);poiUrl=jQuery.urlAddParm(poiUrl,'property_info',LocalInfoWidget.property[0]);poiUrl=jQuery.urlAddParm(poiUrl,'display_drivingdirections',true);Homescape.fn.expandDomainSecurity();try{if(parent.window.LocalInfoWidget.widget.settings.neighborhood_info_url!==undefined){parent.document.location=parent.window.LocalInfoWidget.widget.settings.neighborhood_info_url;}else{parent.document.location=parent.window.LocalInfoWidget.directions.navToPoiDestinationUrl;}}catch(e){window.location=LocalInfoWidget.directions.navToPoiDestinationUrl;}});LocalInfoWidget.directions.eNavToLargerMap=jQuery('#navToLargerMap').click(function(){jQuery.cookie('localInfoWidget_fromPage',LocalInfoWidget.widget.fromPage,LocalInfoWidget.defaults.cookieOptions);jQuery.cookie('localInfoWidget_action','viewLargerMap',LocalInfoWidget.defaults.cookieOptions);jQuery.log('navigating to larger map view');Homescape.fn.expandDomainSecurity();try{if(parent.window.LocalInfoWidget.widget.settings.driving_directions_destination_url!==undefined){parent.document.location=parent.window.LocalInfoWidget.widget.settings.driving_directions_destination_url;}else{parent.document.location=parent.LocalInfoWidget.directions.miniFormDestinationUrl;}}catch(e){window.location=LocalInfoWidget.directions.miniFormDestinationUrl;}});LocalInfoWidget.directions.eNavShowDirectionsForm=jQuery('#navShowDirectionsForm').click(function(){jQuery.log('toggling the driving directions form');LocalInfoWidget.directions.eForm.toggle();LocalInfoWidget.fn.resizeWidget();});LocalInfoWidget.directions.eNavShowDirectionsForm=jQuery('#navGetDirectionsToggle').click(function(){jQuery.log('toggling the driving directions form');LocalInfoWidget.directions.eForm.toggle();LocalInfoWidget.fn.resizeWidget();});try{Homescape.fn.expandDomainSecurity();if((parent.window.LocalInfoWidget.widget.settings.printflyer_url!==undefined&&LocalInfoWidget.directions.printFlyerUrl!=='')||(parent.window.LocalInfoWidget.widget.settings.printflyer_url!==undefined)){var text=jQuery('#printFlyer').html();LocalInfoWidget.directions.ePrintFlyer=jQuery('#printFlyer').html("<a href=\'"+parent.window.LocalInfoWidget.widget.settings.printflyer_url+"' target='_blank'>"+text+"</a>").show();}}catch(e){}
LocalInfoWidget.fn.recallStartingAddress();LocalInfoWidget.directions.eForm.prepend(LocalInfoWidget.directions.eErrorMessages);LocalInfoWidget.directions.eForm.submit(function(){jQuery.log('beginning of driving directions form submission');jQuery('#localInfo_streetView').hide();jQuery('#'+LocalInfoWidget.mapElementId).show();jQuery('#localInfo_mapControls li').each(function(){jQuery(this).removeClass('selected');});if(LocalInfoWidget.map!==null){switch(LocalInfoWidget.map.getCurrentMapType().getName()){case'Map':jQuery('#mapControl').addClass('selected');break;case'Satellite':jQuery('#satelliteControl').addClass('selected');break;case'Hybrid':jQuery('#hybridControl').addClass('selected');break;default:jQuery('#mapControl').addClass('selected');break;}}
LocalInfoWidget.directions.eErrorMessages.empty();LocalInfoWidget.fn.resizeWidget();try{jQuery.reportClickEvent(window.Homescape.Reporting,{name:'LocalInfoWidget: Driving Directions Form Submitted ('+LocalInfoWidget.widget.view+')'});}catch(e){jQuery.log(e);}
try{LocalInfoWidget.fn.rememberStartingAddress();if(LocalInfoWidget.directions.eStartingAddress_line1.val()===''){LocalInfoWidget.directions.eErrorMessages.append('<p class="error">Please enter a valid <strong>Street Address</strong>');LocalInfoWidget.directions.eStartingAddress_line1.focus();LocalInfoWidget.fn.resizeWidget();return false;}else if(LocalInfoWidget.directions.eStartingAddress_city.val()===''){LocalInfoWidget.directions.eErrorMessages.append('<p class="error">Please enter a valid <strong>City</strong>');LocalInfoWidget.directions.eStartingAddress_city.focus();LocalInfoWidget.fn.resizeWidget();return false;}else if(LocalInfoWidget.directions.eStartingAddress_state.val()===''){LocalInfoWidget.directions.eErrorMessages.append('<p class="error">Please enter a valid <strong>State</strong>');LocalInfoWidget.directions.eStartingAddress_state.focus();LocalInfoWidget.fn.resizeWidget();return false;}
Homescape.fn.expandDomainSecurity();if(LocalInfoWidget.widget.view!='drivingdirections'){jQuery.cookie('localInfoWidget_action','getDirections',LocalInfoWidget.defaults.cookieOptions);try{if(parent.window.LocalInfoWidget.widget.settings.driving_directions_destination_url!==undefined){parent.document.location=parent.window.LocalInfoWidget.widget.settings.driving_directions_destination_url;}else{parent.document.location=parent.LocalInfoWidget.directions.miniFormDestinationUrl;}}catch(e){LocalInfoWidget.directions.miniFormDestinationUrl=jQuery.urlAddParm(LocalInfoWidget.directions.miniFormDestinationUrl,'localInfoWidget_action','getDirections');window.location=LocalInfoWidget.directions.miniFormDestinationUrl;}}else{if(jQuery.cookie('localInfoWidget_action')!='getDirections'){jQuery.cookie('localInfoWidget_fromPage','',LocalInfoWidget.defaults.cookieOptions);}
try{Homescape.fn.expandDomainSecurity();parent.window.cv.global.activityMapAndDirections('driving_directions',jQuery.cookie('localInfoWidget_fromPage'));jQuery.log('activity logged in SCS; "driving_directions"; '+jQuery.cookie('localInfoWidget_fromPage'));}catch(e){jQuery.log(e);}
LocalInfoWidget.directions.eDirectionsOverview_origin.empty().append('<span class="legend">Starting Address: </span>');LocalInfoWidget.directions.eDirectionsOverview_destination.empty().append('<span class="legend">Final Destination: </span>');LocalInfoWidget.directions.eDirectionsOverview_distance.empty().append('<span class="legend">Distance: </span>');LocalInfoWidget.directions.eDirectionsOverview_time.empty().append('<span class="legend">Time: </span>');LocalInfoWidget.directions.eDirectionsOverview_turnByTurn.empty();LocalInfoWidget.directions.eErrorMessages.empty().hide();var start={};start.line1=(LocalInfoWidget.directions.eStartingAddress_line1.val()!=='')?(LocalInfoWidget.directions.eStartingAddress_line1.val()):'';start.city=(LocalInfoWidget.directions.eStartingAddress_city.val()!=='')?(LocalInfoWidget.directions.eStartingAddress_city.val()):'';start.state=(LocalInfoWidget.directions.eStartingAddress_state.val()!=='')?(LocalInfoWidget.directions.eStartingAddress_state.val()):'';start.zip=(LocalInfoWidget.directions.eStartingAddress_zip.val()!=='')?(LocalInfoWidget.directions.eStartingAddress_zip.val()):'';var wayPoints=[start];jQuery.log('starting point in wayPoints = "'+LocalInfoWidget.fn.formatPropertyBriefText(wayPoints[0])+'"');jQuery.each(LocalInfoWidget.property,function(i,n){var newObj={};if(n!==undefined&&n.constructor===Object){jQuery.log('Adding '+LocalInfoWidget.fn.formatPropertyBriefText(n)+' to the driving directions "waypoints"; i = '+i);wayPoints.push(n);}});LocalInfoWidget.directions.wayPoints=wayPoints;setTimeout(LocalInfoWidget.fn.lookupDrivingDirections,LocalInfoWidget.defaults.timeoutInterval);LocalInfoWidget.widget.action='';jQuery.cookie('localInfoWidget_action','',LocalInfoWidget.defaults.cookieOptions);}}catch(e){LocalInfoWidget.directions.eErrorMessages.append('<p class="error">We\'re sorry, but an unexpected error occurred while determining your driving directions route.</p>').show();jQuery.log(e);}
jQuery.log('end of driving directions form submission');return false;});LocalInfoWidget.directions.eDirectionsOverview_showReverse.click(function(){LocalInfoWidget.fn.lookupDrivingDirections(true);});if(jQuery.cookie('localInfoWidget_action')=='getDirections'||(LocalInfoWidget.defaults.integrateDrivingDirections&&LocalInfoWidget.widget.view=='drivingdirections')){LocalInfoWidget.directions.eForm.show();}
if(jQuery.fn.showLabelInsideInput!==undefined){jQuery('.showInsideInput').showLabelInsideInput();}
jQuery('.drivingDirections').show();if(LocalInfoWidget.widget.view!='default'){LocalInfoWidget.fn.resizeWidget();if(LocalInfoWidget.widget.view=='drivingdirections'){if(jQuery.cookie('localInfoWidget_action')=='getDirections'){LocalInfoWidget.directions.eForm.submit();}else{try{Homescape.fn.expandDomainSecurity();parent.window.cv.global.activityMapAndDirections('map',jQuery.cookie('localInfoWidget_fromPage'));jQuery.log('activity logged in SCS; "map"; '+jQuery.cookie('localInfoWidget_fromPage'));}catch(e){jQuery.log(e);}}}}
jQuery.log('end of the driving directions setup');};LocalInfoWidget.fn.displayDrivingDirections=function(directions){jQuery.log('Google directions status code = "'+directions.getStatus().code+'"');if(directions.getStatus()===undefined){setTimeout(function(){LocalInfoWidget.fn.displayDrivingDirections(LocalInfoWidget.directions.googleReturn);},LocalInfoWidget.defaults.timeoutInterval);}else{if(directions.getStatus().code==G_GEO_SUCCESS||jQuery('.googledir').length>0){LocalInfoWidget.fn.removeMapMarkers(LocalInfoWidget.propertyMarkers);try{if(LocalInfoWidget.directions.wayPoints[0].latitude===undefined){LocalInfoWidget.directions.wayPoints[0].latitude=LocalInfoWidget.directions.googleReturn.getRoute(0).getStep(0).getLatLng().lat();LocalInfoWidget.directions.wayPoints[0].longitude=LocalInfoWidget.directions.googleReturn.getRoute(0).getStep(0).getLatLng().lng();}}catch(e){}
try{LocalInfoWidget.map.removeControl(LocalInfoWidget.defaults.map.controls.overview);}catch(e){}
try{LocalInfoWidget.directions.eDirectionsOverview_distance.empty().append('<span class="legend">Distance: </span>'+directions.getDistance().html);LocalInfoWidget.directions.eDirectionsOverview_time.empty().append('<span class="legend">Time: </span>'+directions.getDuration().html);LocalInfoWidget.directions.eDirectionsOverview_origin.empty().append('<span class="legend">Starting Address: </span>'+LocalInfoWidget.fn.formatPropertyBrief(LocalInfoWidget.directions.wayPoints[0]));LocalInfoWidget.directions.eDirectionsOverview_destination.empty().append('<span class="legend">Final Destination: </span>'+LocalInfoWidget.fn.formatPropertyBrief(LocalInfoWidget.directions.wayPoints[(LocalInfoWidget.directions.wayPoints.length-1)]));}catch(e){LocalInfoWidget.directions.eDirectionsOverview_distance.hide();LocalInfoWidget.directions.eDirectionsOverview_time.hide();LocalInfoWidget.directions.eDirectionsOverview_origin.hide();LocalInfoWidget.directions.eDirectionsOverview_destination.hide();}
if(LocalInfoWidget.directions.useCustomDisplay){var eRouteTurnByTurn=jQuery('<ol style="list-style: decimal;"></ol>');for(var i=0;i<directions.getNumRoutes();i++){var route=directions.getRoute(i);for(var k=0;k<route.getNumSteps();k++){var step=route.getStep(k);eRouteTurnByTurn.append('<li class="step">'+step.getDescriptionHtml()+'<span class="distance">'+route.getDistance().html+'</span><span class="bar">|</span><span class="time">'+route.getDuration().html+'</span></li>');}
LocalInfoWidget.directions.eDirectionsOverview_turnByTurn.append(eRouteTurnByTurn);eRouteTurnByTurn.empty();LocalInfoWidget.directions.eDirectionsOverview_turnByTurn.append('<div class="routeSummary">'+route.getSummaryHtml()+'</div>');}}else{}
LocalInfoWidget.directions.eDirectionsResults.show();if(LocalInfoWidget.widget.view!='default'){LocalInfoWidget.fn.resizeWidget();}}else{var errorMessage='';switch(directions.getStatus().code){case G_GEO_BAD_REQUEST:case G_GEO_SERVER_ERROR:errorMessage='There was an error retrieving directions. Please try again.';break;case G_GEO_MISSING_ADDRESS:errorMessage='Please enter a starting address.';break;case G_GEO_UNKNOWN_ADDRESS:errorMessage='The address you entered appears to be unknown. Please enter a valid address.';break;case G_GEO_UNAVAILABLE_ADDRESS:errorMessage='The address you entered appears to be unavailable. Please enter a valid address.';break;case G_GEO_UNKNOWN_DIRECTIONS:errorMessage='Driving directions cannot be found for this combination of addresses';break;case G_GEO_TOO_MANY_QUERIES:errorMessage='Driving directions could not be found at this time. Please try again.';break;}
try{jQuery.reportPageView(Homescape.Reporting,{name:'LocalInfoWidget: Driving Directions Error ('+directions.getStatus().code+')',type:'GoogleError',path:path+'/drivingDirections/googleError/'+directions.getStatus().code});}catch(e){jQuery.log(e);}
LocalInfoWidget.directions.eErrorMessages.append('<p class="error" title="'+errorMessage+' (error '+directions.getStatus().code+')">'+errorMessage+'</p>').show();LocalInfoWidget.directions.eDirectionsResults.hide();LocalInfoWidget.fn.resizeWidget();}}};LocalInfoWidget.fn.lookupDrivingDirections=function(reverseDirections){LocalInfoWidget.directions.eDirectionsOverview_turnByTurn.empty();var waypoints=[];if(reverseDirections!==undefined&&reverseDirections===true){LocalInfoWidget.directions.wayPoints.reverse();}
var showAddressLine2=false;jQuery.each(LocalInfoWidget.directions.wayPoints,function(i,n){if(n.latitude===undefined||n.longitude===undefined){jQuery.log('Adding optimized "waypoint" to pass to google; string = "'+LocalInfoWidget.fn.formatPropertyBriefText(n,showAddressLine2)+'"');waypoints.push(LocalInfoWidget.fn.formatPropertyBriefText(n,showAddressLine2));}else{jQuery.log('Adding optimized "waypoint" to pass to google; latitude = "'+n.latitude+'"; longitude = "'+n.longitude+'"');waypoints.push([n.latitude,n.longitude]);}});if(LocalInfoWidget.directions.googleReturn!==undefined){LocalInfoWidget.directions.googleReturn.clear();}else if(LocalInfoWidget.directions.useCustomDisplay){LocalInfoWidget.directions.googleReturn=new GDirections(LocalInfoWidget.map);}else{LocalInfoWidget.directions.googleReturn=new GDirections(LocalInfoWidget.map,document.getElementById('drivingDirections_results'));}
LocalInfoWidget.directions.googleReturn.loadFromWaypoints(waypoints,{getSteps:true});setTimeout(function(){LocalInfoWidget.fn.displayDrivingDirections(LocalInfoWidget.directions.googleReturn);},LocalInfoWidget.defaults.timeoutInterval);};LocalInfoWidget.fn.rememberStartingAddress=function(){try{Homescape.fn.expandDomainSecurity();jQuery.cookie('homescapeStartingAddressDrivingDirectionsStreetAddress',LocalInfoWidget.directions.eStartingAddress_line1.val(),LocalInfoWidget.defaults.cookieOptions);jQuery.cookie('homescapeStartingAddressDrivingDirectionsCity',LocalInfoWidget.directions.eStartingAddress_city.val(),LocalInfoWidget.defaults.cookieOptions);jQuery.cookie('homescapeStartingAddressDrivingDirectionsState',LocalInfoWidget.directions.eStartingAddress_state.val(),LocalInfoWidget.defaults.cookieOptions);jQuery.cookie('homescapeStartingAddressDrivingDirectionsZip',LocalInfoWidget.directions.eStartingAddress_zip.val(),LocalInfoWidget.defaults.cookieOptions);}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.recallStartingAddress=function(){Homescape.fn.expandDomainSecurity();try{LocalInfoWidget.directions.eStartingAddress_line1.val((jQuery.cookie('homescapeStartingAddressDrivingDirectionsStreetAddress')!==null)?jQuery.cookie('homescapeStartingAddressDrivingDirectionsStreetAddress'):'');LocalInfoWidget.directions.eStartingAddress_city.val((jQuery.cookie('homescapeStartingAddressDrivingDirectionsCity')!==null)?jQuery.cookie('homescapeStartingAddressDrivingDirectionsCity'):'');LocalInfoWidget.directions.eStartingAddress_state.val((jQuery.cookie('homescapeStartingAddressDrivingDirectionsState')!==null)?jQuery.cookie('homescapeStartingAddressDrivingDirectionsState'):'');LocalInfoWidget.directions.eStartingAddress_zip.val((jQuery.cookie('homescapeStartingAddressDrivingDirectionsZip')!==null)?jQuery.cookie('homescapeStartingAddressDrivingDirectionsZip'):'');}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.removeMapMarkers=function(markers){if(markers!==undefined&&markers.constructor!==Array){markers=[markers];}
var resize=false;jQuery.each(markers,function(i,n){if(LocalInfoWidget.defaults.useMapZoom){try{if(n.getLatLng().lat()==LocalInfoWidget.coordinateBounds.swLat||n.getLatLng().lat()==LocalInfoWidget.coordinateBounds.neLat||n.getLatLng().lng()==LocalInfoWidget.coordinateBounds.swLong||n.getLatLng().lng()==LocalInfoWidget.coordinateBounds.neLong){resize=true;}}catch(e){jQuery.log(e);}}
try{LocalInfoWidget.map.removeOverlay(n);LocalInfoWidget.mappedItems--;}catch(e){jQuery.log(e);}});if(LocalInfoWidget.defaults.useMapZoom&&resize){LocalInfoWidget.coordinateBounds.swLat=null;LocalInfoWidget.coordinateBounds.neLat=null;LocalInfoWidget.coordinateBounds.swLong=null;LocalInfoWidget.coordinateBounds.neLong=null;jQuery.each(LocalInfoWidget.defaults.categoryOptions,function(i,n){if(n!==null){jQuery.each(n,function(i,o){if(o!==null&&o.displayMapPlots&&typeof o.pagination=='object'){jQuery.each(o.markers.slice(o.pagination.startIndex,o.pagination.endIndex),function(i,m){LocalInfoWidget.fn.calculateCoordinateBounds(m.getLatLng().lat(),m.getLatLng().lng());});}});}});LocalInfoWidget.fn.lazyUpdateMapBounds();}};LocalInfoWidget.fn.addMapMarkers=function(markers){if(markers!==undefined&&markers.constructor!==Array){markers=[markers];}
jQuery.each(markers,function(i,n){try{LocalInfoWidget.map.addOverlay(n);LocalInfoWidget.mappedItems++;if(LocalInfoWidget.defaults.useMapZoom){LocalInfoWidget.fn.calculateCoordinateBounds(n.getLatLng().lat(),n.getLatLng().lng());}}catch(e){jQuery.log(e);}});if(LocalInfoWidget.defaults.useMapZoom&&LocalInfoWidget.mappedItems!=1){LocalInfoWidget.fn.lazyUpdateMapBounds();}};LocalInfoWidget.fn.lazySetupMapControls=function(){LocalInfoWidget.defaults.map.controls={overview:new GOverviewMapControl(),zoomAndPan:new GLargeMapControl(),mapType:new GMapTypeControl()};LocalInfoWidget.map.addControl(LocalInfoWidget.defaults.map.controls.overview);LocalInfoWidget.map.addControl(LocalInfoWidget.defaults.map.controls.zoomAndPan);if(LocalInfoWidget.widget.view!='drivingdirections'){LocalInfoWidget.map.addControl(LocalInfoWidget.defaults.map.controls.mapType);}};LocalInfoWidget.fn.plotProperty=function(){jQuery.log('Plotting the property');try{if(LocalInfoWidget.property.constructor!=Array){LocalInfoWidget.property=[LocalInfoWidget.property];}
var propertyIcon=new GIcon(G_DEFAULT_ICON,Homescape.cdnBaseUrl+'localInfoWidget/icons/mapicon_main2.png');LocalInfoWidget.propertyMarkers=[];jQuery.each(LocalInfoWidget.property,function(i,n){if(n.latitude!==undefined&&n.longitude!==undefined&&n.latitude!==''&&n.longitude!==''){n.latitude=Number(n.latitude);n.longitude=Number(n.longitude);if(LocalInfoWidget.widget.view=='default'&&LocalInfoWidget.fn.formatPropertyBriefText(n)!==''){jQuery.log('Changing area display text from "'+LocalInfoWidget.defaults.eAreaDisplay.text+'" to "'+LocalInfoWidget.fn.formatPropertyBriefText(n)+'"');LocalInfoWidget.defaults.eAreaDisplay.text(LocalInfoWidget.fn.formatPropertyBriefText(n)).removeClass('widgetLocation').addClass('widgetPropertyLocation').attr('title',LocalInfoWidget.fn.formatPropertyBriefText(n));}
jQuery.log(LocalInfoWidget.fn.formatPropertyBriefText(n)+'; plot = '+n.plot);if(n.plot!==undefined&&n.plot){var m=new GMarker(new GLatLng(n.latitude,n.longitude),{icon:propertyIcon,dragCrossMove:false,title:LocalInfoWidget.fn.formatPropertyBriefText(n),clickable:false,draggable:false});if(n.openMapInfoWindow){GEvent.addListener(m,"click",function(){m.openInfoWindowHtml(LocalInfoWidget.fn.formatPropertyBrief(n));});}
LocalInfoWidget.propertyMarkers[i]=m;}}});LocalInfoWidget.fn.addMapMarkers(LocalInfoWidget.propertyMarkers);}catch(e){jQuery.log(e);}};LocalInfoWidget.fn.loadGoogleSearchApi=function(){google.load("search","1",{"callback":LocalInfoWidget.fn.setupWidget});};LocalInfoWidget.fn.loadGoogleMapApi=function(){google.load("maps","2",{"callback":LocalInfoWidget.fn.loadGoogleSearchApi});};LocalInfoWidget.fn.setupWidget=function(){LocalInfoWidget.fn.displayLoadingOverlay();LocalInfoWidget.defaults.eAreaDisplay=jQuery('#localInfoWidget .widgetLocation');Homescape.fn.expandDomainSecurity();try{LocalInfoWidget.widget.parentReferrerURL=parent.document.referrer;}catch(e){LocalInfoWidget.widget.parentReferrerURL=document.referrer;}
if(LocalInfoWidget.widget.view=='minimap'||LocalInfoWidget.widget.parentReferrerURL.indexOf('listing_details.jsp')!=-1){LocalInfoWidget.widget.fromPage='listing_details';}else if(LocalInfoWidget.widget.view=='default'||LocalInfoWidget.widget.parentReferrerURL.indexOf('listing_details_local.jsp')!=-1){LocalInfoWidget.widget.fromPage='listing_details_local';}else{LocalInfoWidget.widget.fromPage='';}
try{if(jQuery.cookie('localInfoWidget_action')===undefined||jQuery.cookie('localInfoWidget_action')===null||jQuery.cookie('localInfoWidget_action')===''){jQuery.cookie('localInfoWidget_fromPage',LocalInfoWidget.widget.fromPage,LocalInfoWidget.defaults.cookieOptions);if(LocalInfoWidget.widget.view=='drivingdirections'){jQuery.cookie('localInfoWidget_action','viewLargerMap',LocalInfoWidget.defaults.cookieOptions);}}}catch(e){jQuery.log(e);}
if(jQuery('#localMap').length==1){var googleLoaded=false;try{GBrowserIsCompatible();googleLoaded=true;}catch(e){googleLoaded=false;var script=document.createElement("script");script.src="http://www.google.com/jsapi?key="+LocalInfoWidget.widget.settings.mapKey+"&callback=LocalInfoWidget.fn.loadGoogleMapApi";script.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(script);return;}
if(googleLoaded&&LocalInfoWidget.widget.view!='minimap'&&GBrowserIsCompatible!==null&&GBrowserIsCompatible()){jQuery.log('Setting up map');LocalInfoWidget.map=new GMap2(jQuery('#localMap')[0]);LocalInfoWidget.map.setCenter(new GLatLng(LocalInfoWidget.defaults.coordinate.latitude,LocalInfoWidget.defaults.coordinate.longitude),LocalInfoWidget.defaults.zoom);LocalInfoWidget.defaults.baseMapIcon=new GIcon(G_DEFAULT_ICON,Homescape.cdnBaseUrl+'localInfoWidget/icons/a/base_icon.png');LocalInfoWidget.defaults.baseMapIcon.shadow=Homescape.cdnBaseUrl+'localInfoWidget/icons/a/base_shadow.png';LocalInfoWidget.defaults.baseMapIcon.transparent=Homescape.cdnBaseUrl+'localInfoWidget/icons/a/base_icon_trans.png';LocalInfoWidget.defaults.baseMapIcon.iconSize=new GSize(22,44);LocalInfoWidget.defaults.baseMapIcon.shadowSize=new GSize(45,44);LocalInfoWidget.defaults.baseMapIcon.iconAnchor=new GPoint(11,44);LocalInfoWidget.defaults.baseMapIcon.infoWindowAnchor=new GPoint(9,26);LocalInfoWidget.defaults.baseMapIcon.imageMap=[0,0,0,44,44,44,44,0];GEvent.addListener(LocalInfoWidget.map,"zoomend",function(oldlevel,newlevel){jQuery.log("checking if user zoomed the map");if(oldlevel==LocalInfoWidget.defaults.zoom){jQuery.log("turn off auto-resizing, now and forever");LocalInfoWidget.defaults.useMapZoom=false;}
LocalInfoWidget.defaults.zoom=newlevel;});if(LocalInfoWidget.widget.settings.view=='default'){if(LocalInfoWidget.widget.settings.category_options.recentSales!==undefined){LocalInfoWidget.defaults.categoryOptions.recentSales=jQuery.extend(LocalInfoWidget.defaults.categoryOptions.recentSales,LocalInfoWidget.widget.settings.category_options.recentSales);}
if(LocalInfoWidget.widget.settings.category_options.schools!==undefined){LocalInfoWidget.defaults.categoryOptions.schools.elementary=jQuery.extend(LocalInfoWidget.defaults.categoryOptions.schools.elementary,LocalInfoWidget.widget.settings.category_options.schools.elementary);LocalInfoWidget.defaults.categoryOptions.schools.high=jQuery.extend(LocalInfoWidget.defaults.categoryOptions.schools.high,LocalInfoWidget.widget.settings.category_options.schools.high);LocalInfoWidget.defaults.categoryOptions.schools.middle=jQuery.extend(LocalInfoWidget.defaults.categoryOptions.schools.middle,LocalInfoWidget.widget.settings.category_options.schools.middle);LocalInfoWidget.defaults.categoryOptions.schools.preschool=jQuery.extend(LocalInfoWidget.defaults.categoryOptions.schools.preschool,LocalInfoWidget.widget.settings.category_options.schools.preschool);}
jQuery.each(LocalInfoWidget.defaults.categoryOptions,function(categoryName,categoryObject){jQuery.log('Merging options from client to defaults: '+categoryName);try{var clientCategoryObject=LocalInfoWidget.preferences.client.categoryOptions[categoryName];var userCategoryObject=LocalInfoWidget.preferences.user.categoryOptions[categoryName];if(categoryName=='recentSales'){if(clientCategoryObject!==undefined){jQuery.extend(categoryObject,clientCategoryObject,userCategoryObject);}
if(userCategoryObject!==undefined){jQuery.extend(categoryObject,userCategoryObject);}}else{jQuery.each(categoryObject,function(objectIndex,objectValue){jQuery.log('Merging options from client to defaults: '+categoryName+'.'+objectIndex);if(clientCategoryObject!==undefined&&clientCategoryObject.constructor===Object&&clientCategoryObject[objectIndex]!==undefined){jQuery.extend(objectValue,clientCategoryObject[objectIndex]);}
if(userCategoryObject!==undefined&&userCategoryObject.constructor===Object&&userCategoryObject[objectIndex]!==undefined){jQuery.extend(objectValue,userCategoryObject[objectIndex]);}});}}catch(e){jQuery.log(e);}});setTimeout(LocalInfoWidget.fn.setupGoogleCategories,LocalInfoWidget.defaults.lazyInterval);LocalInfoWidget.catsSetupRemaining++;setTimeout(LocalInfoWidget.fn.setupSchools,LocalInfoWidget.defaults.lazyInterval*2);LocalInfoWidget.catsSetupRemaining++;setTimeout(LocalInfoWidget.fn.setupRecentSales,LocalInfoWidget.defaults.lazyInterval*3);LocalInfoWidget.catsSetupRemaining++;LocalInfoWidget.fn.resizeWidget();jQuery('#toggleMoreCommunityInfo').click(function(){var msg=jQuery(this).text().indexOf('More')<0?'More Community Info...':'Less Community Info...';jQuery(this).text(msg);jQuery('#moreCommunityInfo').toggle();LocalInfoWidget.fn.resizeWidget();return false;});}
LocalInfoWidget.fn.plotProperty();setTimeout(LocalInfoWidget.fn.lazySetupMapControls,LocalInfoWidget.defaults.lazyInterval*5);jQuery.log('LocalInfoWidget.widget.action = '+LocalInfoWidget.widget.action);}else{jQuery.log('Google maps API is not here');}}
try{if(LocalInfoWidget.property.constructor===Object){LocalInfoWidget.property=[LocalInfoWidget.property];}
if((LocalInfoWidget.defaults.integrateDrivingDirections||LocalInfoWidget.widget.view=='minimap'||LocalInfoWidget.widget.view=='drivingdirections')&&LocalInfoWidget.property.constructor===Array&&LocalInfoWidget.property.length>0&&LocalInfoWidget.property[0].latitude!==undefined&&LocalInfoWidget.property[0].longitude!==undefined){LocalInfoWidget.fn.setupDrivingDirections();}}catch(e){jQuery.log(e);}
jQuery('.hoverable').hover(LocalInfoWidget.fn.mouseOverLocalPoiOption,LocalInfoWidget.fn.mouseOutLocalPoiOption);jQuery.cookie('localInfoWidget_action','',LocalInfoWidget.defaults.cookieOptions);LocalInfoWidget.widget.setupComplete=true;};LocalInfoWidget.eCss=document.createElement("link");LocalInfoWidget.eCss.href="http://www.homefinder.com/css/localInfoWidget.css";LocalInfoWidget.eCss.rel="stylesheet";LocalInfoWidget.eCss.type="text/css";document.getElementsByTagName("head")[0].appendChild(LocalInfoWidget.eCss);