// Copyright (c) 2004 Business Lab (http:www.businesslab.com) //
// ********************************************************** //

// REDIMENSSIONNEMENT IFRAME

function recup_domain(test)
{
	
	var domaine ="";
	var arrayList1 = new Array();
	
	if(test=="")
	{
		return domaine;
	}
	else
	{
		arrayList1 = test.split(".");
		if(arrayList1.length > 1)
		{
			if (arrayList1[1]=="businesslab" || arrayList1[1]=="macallan" || arrayList1[1]=="elysair" || arrayList1[1]=="lavion")
				{
					domaine += arrayList1[1];
					for(var i=2; i < arrayList1.length; i++)
					{
					domaine += "." + arrayList1[i];
					}
				}
		}
		else
		{
		    //alert("Vous tes sur une URL incorrecte, l'affichage des iframes risque de poser un probleme");
		    domaine = test;
		}
		return domaine;
	}
}

function goSetHeight() {
  if (parent == window) return;
  else parent.setIframeHeight('iframeReservation');
}
function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function setIframeHeight(iframeName) {
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
    if ( iframeEl && iframeWin ) {
    	iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    	var docHt = getDocHeight(iframeWin.document);
    	//alert("doc HT :"+docHt);
    	// need to add to height to be sure it will all show
    	if (docHt) iframeEl.style.height = docHt + 30 + "px";
  }
}

function loadIframe(iframeName, url) {
  if ( window.frames[iframeName] ) {
    parent.setIframeHeight(iframeName);
    return false;
  }
  
  else return true;
}


function change_hauteur(h,nomIframe) 
{ 
	a = document.getElementById(nomIframe);
	a.style.height = h;
} 

//appel fonction qui fixe le doamin :
// document.domain = "businesslab.com";//recup_domain(document.domain);
document.domain = recup_domain(document.domain);



