var current_frm = "layer_hotel";

var no_classe_2_classe_name;
no_classe_2_classe_name = new Array(3);
no_classe_2_classe_name[0] =  "hotelprivilege";
no_classe_2_classe_name[1] =  "hotelconfort";
no_classe_2_classe_name[2] =  "hotelcharme";

var flag_classe_hotel;
flag_classe_hotel = new Array(3);

flag_classe_hotel[0] = 0;
flag_classe_hotel[1] = 0;
flag_classe_hotel[2] = 0;
flag_classe_hotel[3]=0;

function get_no_classe_hotel(classe_hotel_name)
{
 var i;
 for(i=0;i<=2;i++)
 {
   if(no_classe_2_classe_name[i] == classe_hotel_name) return i;
 }
 return -1;
}

function hide_frm()
{
	MM_showHideLayers(current_frm,'','hide')
}
function show_frm()
{
	MM_showHideLayers(current_frm,'','show')
}

function hide_menu_hotel(classe_hotel)
{
   flag_classe_hotel[get_no_classe_hotel(classe_hotel)]--;
   flag_classe_hotel[3]--;
   setTimeout('do_hide_menu_hotel("'+classe_hotel+'")',100);
}
function do_hide_menu_hotel(classe_hotel)
{
    if(flag_classe_hotel[get_no_classe_hotel(classe_hotel)]==0)
	{
	 if(flag_classe_hotel[3]==0) show_frm();
	 MM_showHideLayers(classe_hotel,'','hide');
	}
}
function show_menu_hotel(classe_hotel)
{
	hide_frm();
	flag_classe_hotel[3]++;
	MM_showHideLayers(classe_hotel,'','show');
	flag_classe_hotel[get_no_classe_hotel(classe_hotel)]++;
}

function hide_onglets()
{
	setTimeout("document.Image11.src='../images/imgrecherche/untitled-3_02_off.gif';", 50);
	setTimeout("document.Image12.src='../images/imgrecherche/untitled-3_03_off.gif';", 50);
	setTimeout("document.Image13.src='../images/imgrecherche/untitled-3_04_off.gif';", 50);
}
function show_onglet()
{
	if (current_frm == 'localisation')	setTimeout("document.Image11.src='../images/imgrecherche/untitled-3_02_on.gif';", 50);
	if (current_frm == 'layer_hotel')			setTimeout("document.Image12.src='../images/imgrecherche/untitled-3_03_on.gif';", 50);
	if (current_frm == 'criteres')		setTimeout("document.Image13.src='../images/imgrecherche/untitled-3_04_on.gif';", 50);
}

function goto_monument()
{
    if(document.frm_monuments.keywords.value!="" || document.frm_monuments.id[document.frm_monuments.monument.selectedIndex].value!="0")
	{
		if(document.frm_monuments.id[document.frm_monuments.monuemnt.selectedIndex].value!="0")
		{
			document.frm_monuments.action = "../s12_guide/s12p02_fiche_touristique.php";
		}
		else
		{
			document.frm_monuments.action = "../s12_guide/s12p01_guide.php";
		}	
   	    	ret = true;
	}
	else
	{
	   alert("Vous devez sélectionner un monument ou saisir un mot dans la zone de recherche");
	   ret = false;
	}
	return ret;
}

function search_hotel(todo)
{
	if (todo == 'criteres')
	{
		if (document.frm_criteres.id_service.selectedIndex == 0)	
		{
			document.location.href="../s13_budget/s13p01_budget.php?tranche_prix=" + document.frm_criteres.tranche_prix[document.frm_criteres.tranche_prix.selectedIndex].value;
		}
		else
		{
			document.location.href="../s20_criteres/s20p01_criteres.php?id_service=" + document.frm_criteres.id_service[document.frm_criteres.id_service.selectedIndex].value;
		}
	}
	else
	{
		document.location.href="../s03_hotels/s03p16_recherche.php?todo=" + todo + "&monument_keywords=" + document.frm_monuments.keywords.value +
							   "&id_hotel=" + document.frm_hotels.hotel[frm_hotels.hotel.selectedIndex].value +
							   "&nb_etoiles=" + document.frm_hotels.nb_etoiles[frm_hotels.nb_etoiles.selectedIndex].value +
							   "&id_enseigne=" + document.frm_hotels.id_enseigne.value;
	}
}

function valid_select(objsel)
{ 
  if(objsel.options[objsel.selectedIndex].value == 0) return false;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ValidateEmail(inForm)
{
	ret = true;
	ret=valid_email(inForm,"inscript_email","Wrong email, Please verify your email.");
	return ret;
}

