var mapSearch ={  
    siteCode : "ALL",
    maporamaDirectory : "accor",
    maporamaSiteOrigin : "ALL",
    currency : "EUR",
    complementaryBrands : null,
    
    init : function(){
        //request ajax
        ajaxRequest._executeByUrl(
            "/bean/getViewBeans.action?beans=CurrenciesViewBean|OriginViewBean",
            "validatorInvalidState",
            "mapSearch.success(errors, response)"
            );
    },
	
	
    success : function(errors, json){
        if(json.viewBeans && json.viewBeans.CurrenciesViewBean && json.viewBeans.OriginViewBean ){
            this.siteCode = json.viewBeans.OriginViewBean.siteCode;
            this.maporamaDirectory = json.viewBeans.OriginViewBean.maporamaDirectory;
            this.maporamaSiteOrigin = json.viewBeans.OriginViewBean.maporamaSiteOrigin;
            this.currency = json.viewBeans.CurrenciesViewBean.defaultCurrency;
            this.complementaryBrands = json.viewBeans.OriginViewBean.complementaryBrands;
        }
        this.getParamMap();
		
    },
    

    getParamMap:function() {
        var urlMap = "http://accor.maporama.com/idl/"+this.maporamaDirectory+"/process.aspx";
        var mapoXml = "world";
        if(this.maporamaSiteOrigin=="BUS" || this.maporamaSiteOrigin == "TRV")	mapoXml = "resa2010pro";

        var url = location.href;
        var start = url.lastIndexOf('?') + 1;
        if (start > 0) {// change flash src
            var params = url.slice(window.location.href.indexOf('?'));
            urlMap += params;
        }
        else
            urlMap += "?xsl=cm&xml="+mapoXml+"&Lang="+ jQuery("html").attr("lang")+"&siteOrigine="+this.maporamaSiteOrigin+"&Search=World&startCountry="+utils.getCookie("userLocalization");

        if(this.currency) urlMap += "&Currency="+this.currency;
        jQuery('iframe.tMap').attr("src", urlMap);
    }
}

jQuery(document).ready(function(){
    utils.rewriteTitle();
    jQuery.noConflict();
    utils.tooltips.init();
    mapSearch.init();
});
