// JavaScript Document

//*********************************************************************************************

var nombre_bateaux;

var adultes = new Array;

adultes[0] = new Array("2", "2");
adultes[1] = new Array("3", "3");
adultes[2] = new Array("4", "4");

var enfants = new Array;

enfants["2"] = new Array;
enfants["2"][0] = new Array("0", "0");
enfants["2"][1] = new Array("1", "1");
enfants["2"][2] = new Array("2", "2");

enfants["3"] = new Array;
enfants["3"][0] = new Array("0", "0");
enfants["3"][1] = new Array("1", "1");

enfants["4"] = new Array;
enfants["4"][0] = new Array("0", "0");

//*********************************************************************************************

function replacement_page_destail_escale() {
	window.moveTo(0,0);
	if (document.getElementById || document.all) 
	  {
	  window.resizeTo(680, screen.availHeight);
	  }
	else if (document.layers) 
	  {
	  if (window.outerHeight<screen.availHeight || window.outerWidth<screen.availWidth)
		{
		window.outerHeight = screen.availHeight;
		window.outerWidth = 680;
		}
	  }
}

//*********************************************************************************************

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_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_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}

//*********************************************************************************************

function popup(url, titre) 
{
  window.open(url, titre, 'width=640, height=400, left=100, top=100, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}
  
//*********************************************************************************************

function popup2(url, titre) 
{
  window.open(url, titre, 'width=400, height=600, left=120, top=120, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

//*********************************************************************************************

function popup3(url, titre) 
{
  window.open(url, titre, 'width=300, height=500, left=140, top=140, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

//*********************************************************************************************

function popup4(url, titre) 
{
  window.open(url, titre, 'width=340, height=200, left=100, top=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

//*********************************************************************************************

function popup5(url, titre) 
{
  window.open(url, titre, 'width=305, height=202, left=100, top=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
}

//*********************************************************************************************

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//*********************************************************************************************

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_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 MM_ajoutdate(msg) { //v1.0
	document.formulaire.choixdates.value=document.formulaire.choixdates.value+msg;
	document.formulaire.affiche_dates.value=msg+document.formulaire.affiche_dates.value;
}

//*********************************************************************************************

function filltheselect_methode2(liste, choix)
{
  raz_methode2("listeenfants");
  for (i=0; i<enfants[choix].length; i++)
	 {
	 new_option = new Option(enfants[choix][i][1],enfants[choix][i][0]);
	 document.form200.elements["listeenfants"].options[document.form200.elements["listeenfants"].length]=new_option;
	 }
}

//*********************************************************************************************

function raz_methode2(liste)
{
	l=document.form200.elements[liste].length;
	for (i=l; i>=0; i--)
	{
  	document.form200.elements[liste].options[i]=null;
	}
}

//*********************************************************************************************

function chargement(valeur)
{
	for (i=0; i<nombre_bateaux; i++) {
		liste_originale_valeur[i]=document.form_recherche_croisiere.elements["select_bateau_bis"].options[i].value;
		liste_originale_nom[i]=document.form_recherche_croisiere.elements["select_bateau_bis"].options[i].text;
	}
}

//*********************************************************************************************

function chargement_prestige1030(valeur)
{
	for (i=0; i<nombre_bateaux_prestige1030; i++) {
		liste_originale_valeur[i]=document.form_recherche_croisiere.elements["select_bateau_bis"].options[i].value;
		liste_originale_nom[i]=document.form_recherche_croisiere.elements["select_bateau_bis"].options[i].text;
	}
}

//*********************************************************************************************

function filltheselect(liste, choix) // récupère le nom de la liste "select_compagnie" et le code_compagnie
{

switch (liste)
   {
   case "select_compagnie":
      raz2("select_bateau_bis",choix);
      break;
   }
}

//*********************************************************************************************

function raz(liste)
{
	l=document.form_recherche_croisiere.elements[liste].length;
	for (i=l; i>=0; i--) document.form_recherche_croisiere.elements[liste].options[i]=null;
}

//*********************************************************************************************

function raz2(liste,choix2) // supprime uniquement les bateaux qui ne correspondent pas à la compagnie
{
	raz(liste);
	
	for (i=0; i<nombre_bateaux; i++)
	{
		new_option = new Option(liste_originale_nom[i],liste_originale_valeur[i]);
		document.form_recherche_croisiere.elements[liste].options[document.form_recherche_croisiere.elements[liste].length]=new_option;
	}

	l=document.form_recherche_croisiere.elements[liste].length;
	for (i=l-1; i>=0; i--) {
	   if ((bateaux[document.form_recherche_croisiere.elements[liste].options[i].value]!=choix2)&&(document.form_recherche_croisiere.elements[liste].options[i].value!="99999"))
			{
				document.form_recherche_croisiere.elements[liste].options[i]=null;
			}
	}
}

//*********************************************************************************************