// this is a crucial object and needs to be declared in global space
var searchForm;

function getFlashMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}

HomeSearch.prototype.switchSearchTypeToBuy = function() {
    this.switchSearchType(minimumPricesBuy, maximumPricesBuy);
    getFlashMovie( 'topLevelMap' ).switchLocationsTo( 'buy' );
};

HomeSearch.prototype.switchSearchTypeToRent = function() {
    this.switchSearchType(minimumPricesRent, maximumPricesRent);
    getFlashMovie( 'topLevelMap' ).switchLocationsTo( 'rent' );
};


$(document).ready(function() {
    searchForm = new HomeSearch('homeSearch');
    searchForm.switchCenterTypeToGeoName();

    // load top level flash map
    var flashvars = {
        propertyNums: "/toplevelmap",
        purchaseType: purchaseType
    };
    var params = {
        wmode: 'transparent',
        swliveconnect: 'true'
    };
    var attributes = {
        id:"topLevelMap",
        name:"topLevelMap"
    };
    swfobject.embedSWF("/flash/HomePageSearchForm_BS.swf", "topLevelMap", "596", "337", "9.0.60","/flash/expressInstall.swf", flashvars, params, attributes);

});
