document.domain = "exotismes.fr";

var curparam;
function loadDialog(url1,url2) {
      //alert("loadDialog url1:"+url1+" url2:"+url2);
    	curparam=url1;
    	curparam2=url2;
    	if (curparam!=null && curparam!="") {
      	var myPanel1 = dojo.widget.byId("paneChoix");
       	myPanel1.setUrl("loadgrille.html");
      	myPanel1.show();
			}
    	return false;
}

function getSearchURL() {
    	return window.location.search;
}
 	

function getHashURL() {
  return window.location.hash;
}

function setHashURL( newhash ) {
    window.location.hash = newhash;
}

    
function addHistory(url,data) {
  dhtmlHistory.add(url,data);
}

function closeLoadGrille() {
        var myPanel1 = dojo.widget.byId("paneChoix");
        myPanel1.hide();
}

function showAlert(text1) {
    //alert("showAlert "+text1);
}

function getFlashMovie() {
    return (window["brochure"]) ? window["brochure"] : document["brochure"];
}

function loadForIE6(aObject){
  if (navigator.appVersion){
       if(navigator.appVersion.lastIndexOf("MSIE 6.0")!=-1){
           dojo.byId("tarifframe").src=aObject.href;
      }
  }
}

function getMeilleurPrix(idGrille,nbNuit,id_obj) {
  var url="http://www.exotismes.fr/wsxml/js/script.jsp?fct=getMeilleurPrix&idgrille="+idGrille+"&nbnuits="+nbNuit+"&idobj="+id_obj;
  var obj=new JSONscriptRequest(url);     
  obj.buildScriptTag(); 
  obj.addScriptTag(); 
	//obj.removeScriptTag();
}

function setMeilleurPrix(result,idObj) {
   var flashMovie = getFlashMovie();
    try {
      flashMovie.setMeilleurPrix(result,idObj);
    } catch (e) {
      
    }
}

window.dhtmlHistory.create();

var historyListener = function(newLocation, historyData) {
   var flashMovie = getFlashMovie();
   try {
      flashMovie.historyEvent(newLocation,historyData);
   } catch (e) {}
};

dojo.addOnLoad(function() {
        dhtmlHistory.initialize();
        dhtmlHistory.addListener(historyListener);
});

dojo.addOnLoad(function() {
  adaptFlashMovie();
});


window.onresize = function() {
  adaptFlashMovie();
};


function adaptFlashMovie() {
    var ratio=1400/970;
    var minwidth = 1000, minheight = 682;
    var width = 1000, height = 682;
    if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      width = window.innerWidth;
      height = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      width = document.documentElement.clientWidth;
      height = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      width = document.body.clientWidth;
      height = document.body.clientHeight;
    }
    if (height<minheight) {
      height=minheight;
    }
    var height=height-20;
    var width=height*ratio;
    var flashMovie = getFlashMovie();
    try {
      flashMovie.height=height;
      flashMovie.width=width;
    } catch (e) {}

}


function printFrame() {
	dojo.byId("tarifframe").contentWindow.print();
};


