var xa=screen.availwidth;
var ya=screen.availHeight;
function bookmark () {if (document.all) {	window.external.AddFavorite ('http://www.maghrebtourism.com','Reservations hotels et sejours');	}else {alert("Sous Netscape, pour ajouter Maghreb Tourism à vos favoris, il vous suffit d'appuyer sur Ctrl + D.");}}

function CheckTheEmail() {if (!isEmail(document.em1.emailoffre.value)){alert("Cette adresse email est non valide");document.em1.emailoffre.value="";document.em1.emailoffre.focus(); return false;}return true;}

function CheckTheEmail2() {if (!isEmail(document.em2.emailoffre.value)){alert("Cette adresse email est non valide");document.em2.emailoffre.value="";document.em2.emailoffre.focus(); return false;}return true;}

function VersionNavigateur(Netscape, Explorer) {if ((navigator.appVersion.substring(0,3) >= Netscape && navigator.appName == 'Netscape') || (navigator.appVersion.substring(0,3) >= Explorer && navigator.appName.substring(0,9) == 'Microsoft')) return true; else return false;}
function fenetre(url,target,h,w){	window.open (url,target,"dependent,width="+w+",height="+h+",status=no,directories=no,toolbar=no,resizable=no,scrollbars=no");}

function fenetre2(url,target,h,w){	window.open (url,target,"dependent,width="+w+",height="+h+",status=no,directories=no,toolbar=no,resizable=no,scrollbars=yes");}

function fenetre4(url,target,h,w){	window.open (url,target,"dependent,width="+w+",height="+h+",status=no,directories=no,toolbar=no,resizable=no,scrollbars=no");}

function fenetre_3(x){
window.open(x,"presentation","menubar=no,scrollbars=no,width=475,height=390,resizable=0");
}



function exec(i){
 if (document.F_meteo.ville.options[i].value != '--'){
   fenetre_3(document.F_meteo.ville.options[i].value)
   }
}


function filtrePhoto(filtre) {
	if (navigator.appName == "Microsoft Internet Explorer") {
		if (filtre.length > 0) {
			document.all["photo"].style.filter += " " + filtre;}
		else {
			document.all["photo"].style.filter = "";}
	}
	else {
		alert("Cette fonction n'est pas disponible dans votre navigateur.\nNos excuses...");}
}



//-------------------------------------------

 var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);
 var nbflocon = 18;
 var coordx=new Array(nbflocon);var coordy=new Array(nbflocon);
 var vity=new Array(nbflocon);var temx=new Array(nbflocon);var decx=new Array(nbflocon);
 var floc=1;

 function InitNeige() {
  if (isNS) {
   tailley = window.innerHeight;taillex = window.innerWidth;offsety = window.pageYOffset;offsetx = window.pageXOffset;
   var vara="LAYER NAME";var varb="/LAYER";var styl=""; 
  }
  else {
   tailley = document.body.clientHeight;taillex = document.body.clientWidth;offsety = document.body.scrollTop;offsetx = document.body.scrollLeft;
   var vara="DIV ID";var varb="/DIV";var styl='style="position:absolute;left:0px;top:0px;width:1px;height:1px;visibility:visible;"';}
  for (i=0;i<nbflocon;i++){
   chaine='<'+vara+'="flocon'+i+'" '+styl+'><img src="flocon'+floc+'.gif"><'+varb+'>';
   document.write(chaine);
   coordx[i]=80+(Math.random()*taillex-160);coordy[i]=i*(tailley/(nbflocon-1));
   vity[i]=floc;   temx[i]=(Math.random()*19);decx[i]=0;
   floc+=1;if (floc>3){floc=1};
  }
 }

 function neige() {
  if (isNS) {tailley = window.innerHeight;taillex = window.innerWidth;offsety = window.pageYOffset;offsetx = window.pageXOffset;}
  else {tailley = document.body.clientHeight;taillex = document.body.clientWidth;offsety = document.body.scrollTop;offsetx = document.body.scrollLeft;}
  for (i=0;i<nbflocon;i++){
   if (isNS){
    eval ('document.flocon'+i+'.top = coordy[i];');
    eval ('document.flocon'+i+'.left = coordx[i];');
   }
   else{
    eval ('document.all.flocon'+i+'.style.top = coordy[i];');
    eval ('document.all.flocon'+i+'.style.left = coordx[i];');
   }
   temx[i]+=1
   if (temx[i]>20) {
    decx[i]=1-(Math.random()*2);
    temx[i]=0;
   }
   coordx[i]+=decx[i];
   coordy[i]+=vity[i];
   maxi=tailley+offsety;
   if (coordy[i]>maxi) {coordx[i]=80+(Math.random()*taillex-160);coordy[i]=-100;}
  }
  tempo = setTimeout("neige()", 5);
 }


//------------------------------------------






// -------------------fenetres ajout 21 mars 2008-------------------------
var numDivPopUp=1;
var zdx=25;

function createPopUp(){
	outerdiv=document.getElementById(this.id);
	outerdiv.style.height=this.height+'px';
	outerdiv.style.width=this.width+'px';
	outerdiv.style.display="block";
	outerdiv.style.borderStyle=this.borderStyle;
	outerdiv.style.borderWidth=this.borderWidth+'px';
	outerdiv.style.borderColor=this.borderColor;
	outerdiv.style.backgroundColor=this.bgColor;
	outerdiv.style.position='absolute';
	outerdiv.style.left=this.x+'px';
	outerdiv.style.top=this.y+'px';
	outerdiv.style.display='none';
	outerdiv.style.zIndex=zdx++;
	
	iframeObj = document.createElement('IFRAME');
	
	iframeObj.style.position = 'absolute';
	iframeObj.frameBorder='0px';
	iframeObj.style.left='0px';
	iframeObj.style.top='0px';
	iframeObj.style.display = '';
	iframeObj.style.height = this.height+'px';
	iframeObj.style.width = this.width+'px';
	iframeObj.style.zIndex =-1000;
	//outerdiv.appendChild(iframeObj);
	//alert(this.content);
	if (this.isExternalPage){
		if (this.showClose==true){
	 		outerdiv.innerHTML='<div style="20px;background-color:#4b3e37" align="right" >'+
			'<a style="background-color:#4b3e37;cursor:pointer;color:#FFFFFF" onClick="hidebox(\''+this.id+'\')"  >close x</a> &nbsp;'+
			'</div><iframe  src="'+this.content+'" width="100%" height="100%" frameborder="0"></iframe>';
		}
		else {
	 		outerdiv.innerHTML='<iframe  src="'+this.content+'" width="100%" height="100%" frameborder="0"></iframe>';
		}
	}
	
	else{
		outerdiv.innerHTML=this.content;
	}
	this.isInit=true;
}

function hidebox(id){
	div=document.getElementById(id);
	div.style.display='none';
	return false;
}


function hide(){
	 hidebox(this.id);
}


function showbox(id){
	
	div=document.getElementById(id);
	div.style.display='block';
	return false;
}
function show(){
	if (!this.isInit){
		this.createPopUp();
	}
	showbox(this.id);
}


function setSize(width,height){
		this.height=height;
		this.width=width;
}
function setSeize(width,height){
		this.height=height;
		this.width=width;
}

function setPos(x,y){
		this.x=x;
		this.y=y;
}



function addContent(text){
	this.isExternalPage=false;
	this.content=text;
}
function setUrl(url){
		this.isExternalPage=true;
		this.content=url;
}
function center(){
	var largeur = 0, hauteur = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
  		largeur = window.innerWidth;
  		hauteur = window.innerHeight;
  	} 
	else if( document.documentElement &&
			( document.documentElement.clientWidth || document.documentElement.clientHeight )) {
 		 largeur = document.documentElement.clientWidth;
  		 hauteur = document.documentElement.clientHeight;
 	 } 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		  largeur = document.body.clientWidth;
		  hauteur = document.body.clientHeight;
  	}
	else {
	  largeur = -1;
	  hauteur = -1;
    }
	/*----------------------------------------------------------------------*/
	var pos=0;
	if (window.innerHeight) {
    	pos = window.pageYOffset
	  }
 	 else if (document.documentElement && document.documentElement.scrollTop) {
    	pos = document.documentElement.scrollTop
 	 }
  	else if (document.body) {
    	pos = document.body.scrollTop
  	}

	dx=((largeur-this.width > 0)? parseInt((largeur-this.width)/2) :100);
	dy=((hauteur-this.height > 0)? parseInt((hauteur-this.height)/2) :100);
	this.x=document.body.scrollLeft+dx;
	this.y=pos+dy ;

	
}

function  PopUpTs(){
	numDivPopUp++;
	this.id="DivPopUp"+numDivPopUp;
	objdiv=document.createElement('DIV');
	objdiv.id=this.id;
	document.body.appendChild(objdiv);
	
	if (document.body){
		this.x=document.body.scrollLeft+100;
		this.y=document.body.scrollTop+100 ;
	}else{
		this.x=100;
		this.y=100;
	}
	this.height=200;
	this.width=200;
	this.isExternalPage=true;
	this.content="";
	this.title="";
	this.isInit=false;
	this.showClose=false;
	
	this.borderColor="#95b5d6";
	this.bgColor="#FFFFFF";
	this.borderWidth="1px";
	this.borderStyle="solid";
	
	/*methode*/
	this.hide=hide;
	this.show=show;
	this.setUrl=setUrl;
	this.center=center;
	this.addContent=addContent;
	// erreur d'orthographe !!!!!!!!
	
	this.setSeize=setSeize;
	this.setSize=setSize;
	this.setPos=setPos;
	this.createPopUp=createPopUp;
}


// Google Map
var gMap;
function openGoogleMap(longitude_gps, latitude_gps, nomEtabl) {
	if (gMap!=null)
		gMap.hide();
	gMap = new PopUpTs();
	gMap.setSeize(550,440);
	gMap.center();

/*
	gMap.addContent('<iframe src="ajax/gmaps.php?lon='+lon+
					'&lat='+lat+'&hotelName='+hotelName+
					'" marginheight="0" marginwidth="0" frameborder="0" '+
					'scrolling="no"  width="100%" height="100%">');
*/

        gMap.addContent('<iframe src="http://www.maghrebtravel.com/inclusion1/test10_map.php?longitude_gps='+longitude_gps+
					'&latitude_gps='+latitude_gps+'&nomEtabl='+nomEtabl+
					'" marginheight="0" marginwidth="0" frameborder="0" '+
					'scrolling="no"  width="100%" height="100%">');




	gMap.show();
}

// ----------------------- fin fenetres ajout 21 mars 2008 -----------------------------

