// JavaScript Document
function makeRequestSimple(url,scriptSortie) {
	//$('patientez').style.display="";
	var httpRequest = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
			// Voir la note ci-dessous à propos de cette ligne
		}
	}
	else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
}

	if (!httpRequest) {
		alert('Abandon :( Impossible de créer une instance XMLHTTP');
		return false;
	}
	httpRequest.onreadystatechange = function() { alertContentsSimple(httpRequest,scriptSortie); };
	httpRequest.open('GET', url, true);
	httpRequest.send(null);

}

function alertContentsSimple(httpRequest,scriptSortie) {
	if (httpRequest.readyState == 4) {
		if (httpRequest.status == 200 || httpRequest.status == 0) {
			//alert(httpRequest.responseText);
			var contenu_tab = httpRequest.responseText;
			//contenu_tab += '</table>';
			//alert(httpRequest.responseText);
			//affiche_infos();
			eval(eval(scriptSortie)(httpRequest.responseText));

			//alert(httpRequest.responseText);
			//document.getElementById('patientez').style.display="none";
		}else if(httpRequest.onError != undefined){
			//document.getElementById('patientez').style.display="none";
			alert('Un problème est survenu avec la requête.'+httpRequest.status+" --- "+httpRequest.onError);
		}
	}

}

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.isCH    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {
  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id){
	dragObj.elNode = document.getElementById(id);
	dragObj.elNode.className='div_trans';
  } else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }
// Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

// Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;


// Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex+2;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left =
    (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  =
    (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {
	dragObj.elNode.className='div_sans_trans';
  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

function check_email(mailtest){
	var verif 	= /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]{2,}[.][a-zA-Z]{2,3}$/
	if (verif.exec(mailtest) == null)
	{
		return false;
	}
	else
	{
		return true;
	}
}
function verif_email_connexion(mailtest){
	var verif 	= /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-.]{2,}[.][a-zA-Z]{2,3}$/
	if (verif.exec(mailtest) == null && mailtest!='')
	{
		alert("L'adresse saisie n'est pas conforme.");
		return false;
	}
	else if(mailtest!='')
	{
		return true;
	}
}
function envoyer_form_contact(contact_nom,contact_email,contact_objet,contact_message){
	var msg_alert = "Merci de renseigner le(s) champ(s) suivant(s) :\n";
	var nb_alert = 0;
	
	if(contact_nom==""){
		msg_alert+="- Nom\n";
		nb_alert += 1;
	}
	if(contact_email==""){
		msg_alert+="- Email\n";
		nb_alert += 1;
	}
	if(contact_objet==""){
		msg_alert+="- Objet du message\n";
		nb_alert += 1;
	}
	
	if(nb_alert > 0){
		if(contact_email!=""){
			if(check_email(contact_email)==false){
				alert(msg_alert + "Votre email est incorrecte.");
			}else{
				alert(msg_alert);
			}
		}else{
			alert(msg_alert);
		}
	}else{
		if(check_email(contact_email)==false){
			alert("Votre email est incorrecte.");
		}else{
			makeRequest("email.php?ctc_n="+contact_nom+"&ctc_e="+contact_email+"&ctc_o="+contact_objet+"&ctc_t="+contact_message,"Fformulaire_contact_contenu");
			//$('fiche_contact').style.display='none';
		}
	}
	
}

function $(element){
	return document.getElementById(element);	
}


function makeRequest(url,div) {
	var httpRequest = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
			// Voir la note ci-dessous à propos de cette ligne
		}
	}
	else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
}

	if (!httpRequest) {
		alert('Abandon :( Impossible de créer une instance XMLHTTP');
		return false;
	}
	httpRequest.onreadystatechange = function() { alertContents(httpRequest,div); };
	//alert(url);
	httpRequest.open('GET', url, true);
	httpRequest.send(null);

}

function alertContents(httpRequest,div) {
	if (httpRequest.readyState == 4) {
		if (httpRequest.status == 200) {
			//alert(httpRequest.responseText);
			var contenu_tab = httpRequest.responseText;
			//contenu_tab += '</table>';
			$(div).innerHTML=httpRequest.responseText;
			//alert(httpRequest.responseText);
		} else {
			try{
				$('patientez').style.display="none";
			}catch(e){}
			alert('Un problème est survenu avec la requête.'+httpRequest.status+' / '+div);
		}
	}

}

function test_scripts(){

	listes_scripts = document.getElementsByTagName('script');
	for(var i=0; i<listes_scripts.length; i++){
		if(listes_scripts[i].innerHTML!=""){
			//alert(listes_scripts[i].innerHTML);
			try{
				//setTimeout(eval(listes_scripts[i].innerHTML),50);
				eval(listes_scripts[i].innerHTML);
			}catch(e){}
		}
	}
}
function test_scripts_div(id_div){

	listes_scripts = document.getElementById(id_div).getElementsByTagName('script');
	for(var i=0; i<listes_scripts.length; i++){
		if(listes_scripts[i].innerHTML!=""){
			//alert(listes_scripts[i].innerHTML);
			try{
				//setTimeout(eval(listes_scripts[i].innerHTML),50);
				eval(listes_scripts[i].innerHTML);
			}catch(e){}
		}
	}
}

function affiche_contact(){
	id_div='Fformulaire_contact';
	largeur=480;
	hauteur=330;
	if($(id_div)){
		document.body.removeChild($(id_div));
		affiche_contact();
	}else{
		if (document.getElementById && document.createElement)
		{
			var x = document.createElement('div');
			
			x.style.position='absolute';
			/*
			x.style.left='50%';
			x.style.top='50%';
			x.style.marginLeft='-'+(largeur/2)+'px';
			x.style.marginTop='-'+(hauteur/2)+'px';
			*/
			x.style.left='280px';
			//x.style.top='50%';
			//alert(document.body.scrollTop);
			//alert(document.body.clientHeight);-(document.body.clientHeight/2)-(hauteur / 2)
			ua = navigator.userAgent;
			s = "MSIE 7.";
  			if ((i = ua.indexOf(s)) >= 0) {
				//x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
				x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
			}else{
				s = "Chrome";
				if ((i = ua.indexOf(s)) >= 0) {
					//x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
					x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
				}else{
					s = "Gecko";
					if ((i = ua.indexOf(s)) >= 0) {
						x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
					}else{
						s = "MSIE 8.";
						if ((i = ua.indexOf(s)) >= 0) {
							//alert(document.documentElement.scrollTop);
							x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
						}else{
							s = "MSIE 6.";
							if ((i = ua.indexOf(s)) >= 0) {
								x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
							}else{
								x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
							}
						}
					}
				}
			}
			//x.style.marginTop=('-'+(hauteur/2)+document.body.scrollTop)+'px';
			x.style.width=largeur+'px';
			//x.style.height=hauteur+"px";

			x.style.backgroundColor='#FFFFFF';
			x.style.color='#000000';
			x.style.textAlign='center';
			x.className='';
			x.style.border='solid 1px #CCCCCC';
			x.id=id_div;
			//onMouseDown="dragStart(event,\''+id_div+'\');"
			
			x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " onMouseDown="dragStart(event,\''+id_div+'\');"><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">Nous contacter</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="$(\''+id_div+'\').style.display=\'none\';try{$(\'fond_transparent\').style.display=\'none\';}catch(e){}"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			
			//x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " ><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'_gros_titre\'));document.body.removeChild($(\''+id_div+'\'));"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			x_innerHTML+='<div style="position:relative; height:'+(hauteur-20)+'px; width:'+largeur+'px; overflow:auto;">';
			x_innerHTML+='<div id="'+id_div+'_contenu" style="padding:20px;"></div>';
			x_innerHTML+='</div>';
			x.innerHTML=x_innerHTML;
			//x.appendChild(t);
			document.body.appendChild(x);
			try{
				$('fond_transparent').style.display='';
				reposition_fond_transparent();
				//div_repositionable.push('fond_transparent');
			}catch(e){}
			div_repositionable.push(id_div);
			devant(id_div);
			
			//makeRequest(page_chargee,id_div+'_contenu');
			document.getElementById('Fformulaire_contact_contenu').innerHTML = '<table width="420" border="0" cellspacing="0" cellpadding="0" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#246EB5;"> <tr> <td width="150" height="30" align="right">Nom : </td> <td><input name="fcontact_contact_nom" type="text" id="fcontact_contact_nom" value="" size="36"/> *</td> </tr> <tr> <td height="30" align="right">Email :</td> <td><input name="fcontact_contact_email" type="text" id="fcontact_contact_email" value="" size="36"/> *</td> </tr> <tr> <td height="30" align="right">Objet du message :</td> <td><input name="fcontact_contact_objet" type="text" id="fcontact_contact_objet" value="" size="36"/> *</td> </tr> <tr> <td height="30" align="right" valign="top"><div style="margin-top:7px;">Texte du message :</div></td> <td rowspan="2" valign="top"><textarea name="fcontact_contact_texte" cols="30" rows="6" id="fcontact_contact_texte" ></textarea></td> </tr> <tr> <td align="center">&nbsp;</td> </tr> <tr> <td height="40" colspan="2" align="center"><input type="button" value="Envoyer le message" name="contact_envoyer" onClick="envoyer_form_contact(document.getElementById(\'fcontact_contact_nom\').value,document.getElementById(\'fcontact_contact_email\').value,document.getElementById(\'fcontact_contact_objet\').value,document.getElementById(\'fcontact_contact_texte\').value)"/></td> </tr> </table> <div style="margin-left:5px; font-style:italic; font-size:10px;">(*) Informations obligatoires</div>';
		}else{
			alert('Your browser doesn\'t support the Level 1 DOM');
		}
	}
	
	
}

  
function aff_escale(contenu,largeur){
	//alert(pos_y);
	$('zone_over').style.width=largeur;
	$('zone_over').innerHTML='<div id="text_zone_over">'+contenu+'</div>';
	$('zone_over').style.left=pos_x+3+"px";
	$('zone_over').style.top=pos_y+3+"px";
	$('zone_over').style.display="";
	
	if($('zone_over').offsetTop+$('zone_over').offsetHeight>fen_h){
		$('zone_over').style.top=pos_y-$('zone_over').offsetHeight-7+"px";
	}
	if($('zone_over').offsetTop<scr_top){
		$('zone_over').style.top=pos_y+3+'px';
	}
	//alert(scr_top);
}
function mask_escale(){
	$('zone_over').style.display="none";
	$('zone_over').innerHTML="";
}
function aff_tarif(indiv,double,ne_comprend_pas,largeur){
	//alert(pos_y);
	$('zone_over').style.width=largeur;
	if(ne_comprend_pas==''){
		var texte = '<div id="text_zone_over">Tarif TTC par personne, en pension complète<br/>- base 1 pers : '+indiv+'<br/>- base 2 pers. : '+double+'<br/><br/><span style="font-size:10px;">Ce prix ne comprend pas :<br/>- les frais de dossier<br/>- les frais de banque \351ventuels<br/>- les assurances<br/>- les acheminements pré et post croisi\350re<br/><br/>(tarifs sujets \340 modification)</span></div>';
	}else{
		tab_texte_ne_comp_pas = ne_comprend_pas.split(',');
		texte_ne_comp_pas='';
		for(var i in tab_texte_ne_comp_pas){
			texte_ne_comp_pas = texte_ne_comp_pas+'<br/>- '+tab_texte_ne_comp_pas[i];
		}
		var texte = '<div id="text_zone_over">Tarif TTC par personne, en pension complète<br/>- base 1 pers : '+indiv+'<br/>- base 2 pers. : '+double+'<br/><br/><span style="font-size:10px;">Ce prix ne comprend pas :'+texte_ne_comp_pas+'<br/><br/>(tarifs sujets \340 modification)</span></div>';
	}
	
	//alert();
	$('zone_over').innerHTML=texte;
	$('zone_over').style.left=pos_x-220+"px";

	$('zone_over').style.top=pos_y+3+"px";
	$('zone_over').style.display="";

	if($('zone_over').offsetTop+$('zone_over').offsetHeight>fen_h){
		$('zone_over').style.top=pos_y-$('zone_over').offsetHeight-7+"px";
	}
	if($('zone_over').offsetTop<scr_top){
		$('zone_over').style.top=pos_y+3+'px';
	}
}
function mask_tarif(){
	$('zone_over').style.display="none";
	$('zone_over').innerHTML="";
}

function position(event) {
	if (browser.isIE) {
		pos_x =0;
		pos_y=0;
    pos_x = window.event.clientX + document.body.scrollLeft;
    pos_y = window.event.clientY + document.body.scrollTop;
	scr_top = document.documentElement.scrollTop;
	fen_h = document.documentElement.clientHeight;
  }
  if (browser.isNS) {
    pos_x = event.clientX + window.scrollX;
    pos_y = event.clientY + window.scrollY;
	scr_top = window.scrollY;
	fen_h = window.innerHeight;
  }

/*pos_x = (navigator.appName.substring(0,3) == "Net") ? e.pageX+document.documentElement.scrollLeft : event.x+document.body.scrollLeft+document.documentElement.scrollLeft;
pos_y = (navigator.appName.substring(0,3) == "Net") ? e.pageY+document.documentElement.scrollTop : event.y+document.body.scrollTop+document.documentElement.scrollTop;*/
//window.status = "Souris x:"+x+" | y:"+y;
}

if (navigator.appName.substring(0,3) == "Net") document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = position;

function valider_acces(){
	var login =	$('identifiant').value;
	var mdp = $('mot_de_passe').value;
	
	makeRequestSimple('connexion.php?login='+login+'&mdp='+mdp,'fin_valider_acces');
}

function fin_valider_acces(reponse){
	if(reponse=='true'){
		window.location.reload();
		$('acces').style.display='none';	
	}else{
		alert("Erreur lors de l'identification.");	
	}
}

function clic_ville(valeur){
	var defaut = "Pays ou ville d'escale";
	if(valeur==defaut){
		//alert(valeur);
		$('ville').value='';
	}
}
function clic_prix_max(valeur){
	var defaut = "prix max. par personne";
	if(valeur==defaut){
		//alert(valeur);
		$('prix_max').value='';
	}
}
function clic_nb_jours(valeur){
	var defaut = "dur\351e max";
	if(valeur==defaut){
		//alert(valeur);
		$('nb_jours').value=''
	}
}
function sort_champ(zone_geo,base,page){
	var defaut_ville = "Pays ou ville d'escale";
	var defaut_prix_max = "prix max. par personne";
	var defaut_nb_jours = "dur\351e max";
	if($('ville').value==""){
		$('ville').value=defaut_ville;
	}
	if($('prix_max').value==""){
		$('prix_max').value=defaut_prix_max;
	}
	if($('nb_jours').value==""){
		$('nb_jours').value=defaut_nb_jours;
	}
	
	//////////////////////
	if(zone_geo=="zone_geo="){
		url="voyages_en_cargo.php?"+base+"&p=1";
	}else{
		url="voyages_en_cargo.php?"+zone_geo+"&"+base+"&p=1";
	}
	//alert(url);
	
	if($('ville').value!=defaut_ville){
		url = url + "&ville="+$('ville').value;
	}
	if($('prix_max').value!=defaut_prix_max){
		url = url + "&prix_max="+$('prix_max').value;
	}
	if($('nb_jours').value!=defaut_nb_jours){
		url = url + "&nb_jours="+$('nb_jours').value;
	}
	if($('ref_produit').value!=''){
		url = url+"&ref_produit="+$('ref_produit').value;
	}
	//////////////////////
	//alert(url);
	window.location.href=url;
}

function sort_champ_new(zone_geo,base,page){
	var defaut_ville = "Pays ou ville d'escale";
	var defaut_prix_max = "prix max. par personne";
	var defaut_nb_jours = "dur\351e max";
	if($('ville').value==defaut_ville){
		$('ville').value="";
	}
	if($('prix_max').value==defaut_prix_max){
		$('prix_max').value="";
	}
	if($('nb_jours').value==defaut_nb_jours){
		$('nb_jours').value="";
	}
	
	//////////////////////
	if(zone_geo=="zone_geo="){
		url="voyages_en_cargo.php?"+base+"&p=1";
	}else{
		url="voyages_en_cargo.php?"+zone_geo+"&"+base+"&p=1";
	}
	//alert('-'+url);
	
	if($('ville').value!=defaut_ville){
		url = url + "&ville="+$('ville').value;
	}
	if($('prix_max').value!=defaut_prix_max){
		url = url + "&prix_max="+$('prix_max').value;
	}
	if($('nb_jours').value!=defaut_nb_jours){
		url = url + "&nb_jours="+$('nb_jours').value;
	}
	if($('ref_produit').value!=''){
		url = url+"&ref_produit="+$('ref_produit').value;
	}
	//////////////////////
	//alert('-'+url);
	window.location=url;
}

function charge_fichier_dans_zone(fichier){
	makeRequestSimple(fichier,'fin_chargement');	
}
function fin_chargement(reponse){
	//recuperaion du titre
	titre=reponse.substr(reponse.indexOf("<title>")+7,reponse.indexOf("</title>")-(reponse.indexOf("<title>")+7));
	//recuperation de la largeur
	largeur=reponse.substr(reponse.indexOf("<largeur>")+9,reponse.indexOf("</largeur>")-(reponse.indexOf("<largeur>")+9));
	if(largeur==""){
		largeur=200;	
	}
	//recuperation de la hauteur
	hauteur=reponse.substr(reponse.indexOf("<hauteur>")+9,reponse.indexOf("</hauteur>")-(reponse.indexOf("<hauteur>")+9));
	if(hauteur==""){
		hauteur=100;	
	}
	//recuperation de la posiion horizontale
	horizontale=reponse.substr(reponse.indexOf("<horizontale>")+13,reponse.indexOf("</horizontale>")-(reponse.indexOf("<horizontale>")+13));
	if(horizontale==""){
		horizontale="C";	
	}
	//recuperation de la position verticale
	verticale=reponse.substr(reponse.indexOf("<verticale>")+11,reponse.indexOf("</verticale>")-(reponse.indexOf("<verticale>")+11));
	if(verticale==""){
		verticale="C";	
	}
	pos_debut = reponse.lastIndexOf('<!--debut_texte-->')+18;
	
	pos_fin = reponse.indexOf('<!--fin_texte-->',pos_debut);
	if(pos_debut!=-1){
		texte_affiche=reponse.substr(pos_debut+1,pos_fin-pos_debut-1);
	}
	/*dragStart(event,'zone_info');
	dragStop(event);*/
	/*$('zone_titre').innerHTML=titre;
	$('zone_info').style.width=largeur+'px';
	$('zone_info').style.height=hauteur+'px';
	$('zone_corp_over').style.height=hauteur-20+'px';
	if(horizontale!="C"){
		$('zone_info').style.left=horizontale+'px';
		$('zone_info').style.marginLeft='0px';
	}else{
		$('zone_info').style.left='50%';
		$('zone_info').style.marginLeft='-'+largeur/2+'px';
	}
	if(verticale!="C"){
		$('zone_info').style.top=verticale+'px';
		$('zone_info').style.marginTop='0px';
	}else{
		$('zone_info').style.top='50%';
		$('zone_info').style.marginTop='-'+hauteur/2+'px';
	}
	//affichage de la zone info
	$('zone_corp').innerHTML=reponse;
	//alert(texte_affiche);
	$('zone_corp').innerHTML=texte_affiche;
	$('zone_info').style.display='';*/
	
	//nouveau bloc
	id_div='zone_info_b';
	if($(id_div)){
		document.body.removeChild($(id_div));
		fin_chargement(reponse);
	}else{
		if (document.getElementById && document.createElement)
		{
			var x = document.createElement('div');
			
			x.style.position='absolute';
			/*
			x.style.left='50%';
			x.style.top='50%';
			x.style.marginLeft='-'+(largeur/2)+'px';
			x.style.marginTop='-'+(hauteur/2)+'px';
			*/
			x.style.left='280px';
			x.style.top='200px';
			
			x.style.width=largeur+'px';
			x.style.height=hauteur+"px";

			x.style.backgroundColor='#FFFFFF';
			x.style.color='#000000';
			x.style.textAlign='center';
			x.className='div_trans2';
			//x.style.border='solid 1px black';
			x.id=id_div;
			//onMouseDown="dragStart(event,\''+id_div+'\');"
			x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " onMouseDown="dragStart(event,\''+id_div+'\');"><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'\'));"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			x_innerHTML+='<div style="position:relative; height:'+(hauteur-20)+'px; overflow:auto;">';
			x_innerHTML+='<div id="'+id_div+'_contenu" style="padding:20px; text-align:justify;">'+texte_affiche+'</div>';
			x_innerHTML+='</div>';
			x.innerHTML=x_innerHTML;
			//x.appendChild(t);
			document.body.appendChild(x);
			//makeRequest(page_chargee,id_div+'_contenu');
			devant(id_div);
		}else{
			alert('Your browser doesn\'t support the Level 1 DOM');
		}
	}
}

function aff_envoi_fiche(fiche){
	$('zone_titre').innerHTML='Envoi de la fiche par mail';
	$('zone_info').style.width='620px';
	$('zone_info').style.height='500px';
	$('zone_info').style.left=pos_x+33+"px";
	$('zone_info').style.top=pos_y+3+"px";
	//$('zone_corp').innerHTML='<div style="text-align:center;"><input type="text" id="adr_mail_fiche" name="adr_mail_fiche" size="30"/><br/><br/><input type="button" value="Envoyer" onclick="fin_envoi_fiche(\''+fiche+'\');"/></div>';
	makeRequest('envoi_fiche.php?lien_fiche='+fiche,'zone_corp');
	$('zone_info').style.display='';
}
function aff_envoi_fiche_non_cargo(fiche){
	$('zone_titre').innerHTML='Envoi de la fiche par mail';
	$('zone_info').style.width='620px';
	$('zone_info').style.height='500px';
	$('zone_info').style.left=pos_x+33+"px";
	$('zone_info').style.top=pos_y+3+"px";
	//$('zone_corp').innerHTML='<div style="text-align:center;"><input type="text" id="adr_mail_fiche" name="adr_mail_fiche" size="30"/><br/><br/><input type="button" value="Envoyer" onclick="fin_envoi_fiche(\''+fiche+'\');"/></div>';
	makeRequest('envoi_fiche.php?lien_fiche='+fiche+'&non_cargo=oui','zone_corp');
	$('zone_info').style.display='';
}
var adr_email_fiche="email";
function fin_envoi_fiche(action,adr_email){
	if(check_email($('adr_email_fiche').value)==false){
		alert('Email incorrecte');	
	}else{
		makeRequestSimple('./admin_lists/inscription.php?subscribepage=1&le_email='+$('adr_email_fiche').value+'&list=1&autoconfirme=1','fin_inscr');
		if(action=="previsualisation"){
			$('action').value='previsualisation';
			
			document.forms['email_fiche'].submit();
			//alert(adr_email);
			adr_email_fiche=adr_email;
		}else{
			
			$('action').value='envoyer';
			document.forms['email_fiche'].submit();
		}
		//makeRequestSimple('email.php?adr_email='+$('adr_mail_fiche').value+'&lien_fiche='+fiche,'fin_inscr');
	}
}
function remet_email(){
	$('adr_email_fiche').value=adr_email_fiche;
}
function fin_inscr(reponse){
	//$('zone_corp').innerHTML+=reponse+'<br/>';
}
function action_visualise_produit(produit,categorie){
	makeRequestSimple('./action_visualise_produit.php?produit='+produit+'&categorie='+categorie,'fin_action_visualise_produit');	
}
function fin_action_visualise_produit(reponse){
	//rien
	//alert(reponse);
}
function clic_en_savoir_plus(fiche,categorie){
	makeRequestSimple('./demande_documentation_verif_connect.php?fiche='+fiche+'&categorie='+categorie,'fin_clic_en_savoir_plus');
}
function fin_clic_en_savoir_plus(reponse){
	position;
	connecte=reponse.substr(reponse.indexOf("<connecte>")+10,reponse.indexOf("</connecte>")-(reponse.indexOf("<connecte>")+10));
	fiche=reponse.substr(reponse.indexOf("<fiche>")+7,reponse.indexOf("</fiche>")-(reponse.indexOf("<fiche>")+7));
	adr_email=reponse.substr(reponse.indexOf("<adr_email>")+11,reponse.indexOf("</adr_email>")-(reponse.indexOf("<adr_email>")+11));
	categorie=reponse.substr(reponse.indexOf("<categorie>")+11,reponse.indexOf("</categorie>")-(reponse.indexOf("<categorie>")+11));
	if(connecte=='oui'){
		demande_documentation('oui',adr_email,fiche,categorie);
	}else{
		texte_div='<div style="margin:5px;">';
		texte_div+='<br/>Afin de recevoir cette documentation, ';
		texte_div+='merci de vous identifier.<br/><br/>';
		texte_div+='Adresse email : ';
		texte_div+='<input type="text" id="adr_email_doc" name="adr_email_doc" size="40" maxlength="64" value="'+adr_email+'"/>';
		texte_div+='</div>';
		texte_div+='<div style="text-align:center;"><input type="button" name="valider_doc" value="S\'identifier et recevoir la documentation" onclick="demande_documentation(\'non\',$(\'adr_email_doc\').value,\''+fiche+'\',\''+categorie+'\')"/></div>';
		texte_div+='<div style="margin:5px; font-size:10px;">Votre adresse email ne sera communiqu&eacute;e &agrave; aucune soci&eacute;t&eacute; ti&egrave;rce.<br>';
		texte_div+='Seules des informations concernant ce type de voyages vous seront transmises par Mer et Voyages.</div>';
		$('en_savoir_plus_contenu').innerHTML=texte_div;
		$('en_savoir_plus').style.display='';
		$('fond_transparent').style.display='';
		devant('en_savoir_plus');
		$('fond_transparent').style.height=getWindowHeight()+'px';
		//$('fond_transparent').style.top=document.documentElement.scrollTop+'px';
		//$('fond_transparent').style.top=document.body.scrollTop+"px";
		//$('en_savoir_plus').style.left=pos_x+33+"px";
		$('en_savoir_plus').style.left=(document.body.scrollLeft+(document.body.clientWidth/2)-($('en_savoir_plus').offsetWidth / 2))+'px';
		//$('en_savoir_plus').style.top=pos_y+3+"px";
		//$('en_savoir_plus').style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
		x=$('en_savoir_plus');
		ua = navigator.userAgent;
		s = "MSIE 7.";
		if ((i = ua.indexOf(s)) >= 0) {
			//x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
			x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
			$('fond_transparent').style.top=document.documentElement.scrollTop+'px';
		}else{
			s = "Chrome";
			if ((i = ua.indexOf(s)) >= 0) {
				//x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
				x.style.top=document.body.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2)+'px';
				$('fond_transparent').style.top=document.body.scrollTop+'px';
			}else{
				s = "Gecko";
				if ((i = ua.indexOf(s)) >= 0) {
					x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
					$('fond_transparent').style.top=document.documentElement.scrollTop+'px';
				}else{
					s = "MSIE 8.";
					if ((i = ua.indexOf(s)) >= 0) {
						//alert(document.documentElement.scrollTop);
						x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
						$('fond_transparent').style.top=document.documentElement.scrollTop+'px';
					}else{
						s = "MSIE 6.";
						if ((i = ua.indexOf(s)) >= 0) {
							x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
							$('fond_transparent').style.top=document.documentElement.scrollTop+'px';
						}else{
							x.style.top=document.body.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2)+'px';
							$('fond_transparent').style.top=document.body.scrollTop+'px';
						}
					}
				}
			}
		}
	}
}
function reposition_en_savoir_plus(){
	try{
		if($('en_savoir_plus').style.display==''){
			/*$('fond_transparent').style.top=document.documentElement.scrollTop+'px';
			$('en_savoir_plus').style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';*/
			x=$('en_savoir_plus');
			ua = navigator.userAgent;
			s = "MSIE 7.";
			if ((i = ua.indexOf(s)) >= 0) {
				x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
			}else{
				s = "Chrome";
				if ((i = ua.indexOf(s)) >= 0) {
					x.style.top=document.body.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2)+'px';
				}else{
					s = "Gecko";
					if ((i = ua.indexOf(s)) >= 0) {
						x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
					}else{
						s = "MSIE 8.";
						if ((i = ua.indexOf(s)) >= 0) {
							x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
						}else{
							s = "MSIE 6.";
							if ((i = ua.indexOf(s)) >= 0) {
								x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
							}else{
								x.style.top=document.body.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2)+'px';
							}
						}
					}
				}
			}
		}
	}catch(e){}
}

var div_repositionable = new Array();
function reposition_div(){
	try{
		for(i=0; i<div_repositionable.length; i++){
			div = div_repositionable[i];
			//alert(div);
			if($(div)){
				if($(div).style.display==''){
					/*$('fond_transparent').style.top=document.documentElement.scrollTop+'px';
					$('en_savoir_plus').style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';*/
					x=$(div);
					ua = navigator.userAgent;
					//alert(ua);
					
					if(document.documentElement && document.documentElement.scrollTop){
						//alert('1');
						x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(x.offsetHeight / 2))+'px';
					}else if(document.body && document.body.scrollTop){
						//alert('2');
						x.style.top=(document.body.scrollTop+(getWindowHeight()/2)-(x.offsetHeight / 2))+'px';
					}else{
						//alert('3');
						x.style.top=((getWindowHeight()/2)-(x.offsetHeight / 2))+'px';
					}

				}
			}
		}
	}catch(e){}
}
function reposition_fond_transparent(){
	try{
		if($('fond_transparent').style.display==''){
			if(document.documentElement && document.documentElement.scrollTop){
				//alert('1');
				$('fond_transparent').style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('fond_transparent').offsetHeight / 2))+'px';
			}else if(document.body && document.body.scrollTop){
				//alert('2');
				$('fond_transparent').style.top=(document.body.scrollTop+(getWindowHeight()/2)-($('fond_transparent').offsetHeight / 2))+'px';
			}else{
				//alert('3');
				$('fond_transparent').style.top=((getWindowHeight()/2)-($('fond_transparent').offsetHeight / 2))+'px';
			}
		}
	}catch(e){}
}
function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientHeight) {
         windowHeight = document.documentElement.clientHeight;
    }
    else {
     if (document.body&&document.body.clientHeight) {
         windowHeight=document.body.clientHeight;
      }
     }
    }
    return windowHeight;
}
function demande_documentation(connecte,adr_email,fiche,categorie){
	if(connecte=='non'){
		if(check_email(adr_email)==true){
			$('en_savoir_plus').style.display='none';
			$('fond_transparent').style.display='none';
			makeRequestSimple('./demande_documentation.php?adr_email='+adr_email+'&produit='+fiche+'&connecte='+connecte+'&categorie='+categorie,'fin_demande_documentation');
			
		}else{
			alert('Adresse email non valide.');
		}
	}else{
		$('en_savoir_plus').style.display='none';
		$('fond_transparent').style.display='none';
		makeRequestSimple('./demande_documentation.php?adr_email='+adr_email+'&produit='+fiche+'&connecte='+connecte+'&categorie='+categorie,'fin_demande_documentation');
	}
}
function fin_demande_documentation(reponse){
	/*fiche=reponse.substr(reponse.indexOf("<connecte>")+10,reponse.indexOf("</connecte>")-(reponse.indexOf("<connecte>")+10));
	adr_email=reponse.substr(reponse.indexOf("<adr_email>")+11,reponse.indexOf("</adr_email>")-(reponse.indexOf("<adr_email>")+11));
	if(connecte=='oui'){
		texte_div='<div style="text-align:center;">';
		texte_div+='<br/>';
		texte_div+='Un email concernant la documentation demand&eacute;e vient d\'&ecirc;tre envoy&eacute; &agrave; l\'adresse : ';
		texte_div+='<br/>';
		texte_div+=adr_email;
		texte_div+='<br/><br/>';
		texte_div+='<input type="button" value="Fermer" onclick="$(\'en_savoir_plus\').style.display=\'none\'"/>';
		texte_div+='</div>';
		$('en_savoir_plus_contenu').innerHTML=texte_div;
	}*/
	fiche=reponse.substr(reponse.indexOf("<fiche>")+7,reponse.indexOf("</fiche>")-(reponse.indexOf("<fiche>")+7));
	erreur=reponse.substr(reponse.indexOf("<erreur>")+8,reponse.indexOf("</erreur>")-(reponse.indexOf("<erreur>")+8));
	categorie=reponse.substr(reponse.indexOf("<categorie>")+11,reponse.indexOf("</categorie>")-(reponse.indexOf("<categorie>")+11));
	test='';
	try{
		test=reponse.substr(reponse.indexOf("<test>")+6,reponse.indexOf("</test>")-(reponse.indexOf("<test>")+6));
		texte=reponse.substr(reponse.indexOf("<texte>")+7,reponse.indexOf("</texte>")-(reponse.indexOf("<texte>")+7));
	}catch(e){}
	if(erreur!=''){
		texte_div='<div style="margin:5px;">';
		texte_div+='<br/>Afin de visualiser cette documentation, ';
		texte_div+='merci de vous identifier.<br/><br/>';
		texte_div+='<span style="color:red;">L\'adresse entr&eacute;e a &eacute;t&eacute; rejet&eacute;e au moins 3 fois par les serveur,<br/> merci d\'en entrer une autre.</span><br/>';
		texte_div+='Adresse email : ';
		texte_div+='<input type="text" id="adr_email_doc" name="adr_email_doc" size="40" maxlength="64"/>';
		texte_div+='</div>';
		texte_div+='<div style="text-align:center;"><input type="button" name="valider_doc" value="S\'identifier et visualiser la documentation" onclick="demande_documentation(\'non\',$(\'adr_email_doc\').value,\''+fiche+'\',\''+categorie+'\')"/></div>';
		texte_div+='<div style="margin-top:20px; font-size:10px; color:#999">Votre adresse email ne sera communiqu&eacute;e &agrave; aucune soci&eacute;t&eacute; ti&egrave;rce.<br>';
		texte_div+='Seules des informations concernant ce type de voyages vous seront transmises par Mer et Voyages.</div>';
		$('en_savoir_plus_contenu').innerHTML=texte_div;
		$('en_savoir_plus').style.display='';
		$('en_savoir_plus').style.left=pos_x+33+"px";
		//$('en_savoir_plus').style.top=pos_y+3+"px";
		$('en_savoir_plus').style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-($('en_savoir_plus').offsetHeight / 2))+'px';
	}else{
		/*if(fiche.substr(fiche.length-3,3)=='pdf'){
			window.location.href=('./download.php?file='+fiche);
			//window.open('./download.php?file='+fiche,"Fiche produit","menubar=yes, status=yes, scrollbars=yes, width=600, height=500");
		}else{
			window.location.href=fiche;
			//window.open(fiche,"Fiche produit","menubar=yes, status=yes, scrollbars=yes, width=600, height=500");
		}*/
		affiche_div_flotant_deplacable_contenu('retour_en_savoir_plus','En savoir plus',600,230,texte);
		/*if(test!=''){
			
		}*/
	}
}


function debut_voeux(){
	setTimeout("fin_voeux()",5000);
}
function fin_voeux(){
	$('voeux').style.display="none";
	$('voeux_back').style.display="none";
}

function debut_info_accueil(){
	setTimeout("fin_info_accueil()",12000);
}
function fin_info_accueil(){
	document.body.removeChild($('news_accueil'));
	document.body.removeChild($('news_accueil_gros_titre'));
}

function affiche_div_flotant(id_div,titre,largeur,hauteur,page_chargee){
	if($(id_div)){
		document.body.removeChild($(id_div));
		affiche_div_flotant(id_div,titre,largeur,hauteur,page_chargee);
	}else{
		if (document.getElementById && document.createElement)
		{
			var x = document.createElement('div');
			
			x.style.position='absolute';
			/*
			x.style.left='50%';
			x.style.top='50%';
			x.style.marginLeft='-'+(largeur/2)+'px';
			x.style.marginTop='-'+(hauteur/2)+'px';
			*/
			x.style.left='280px';
			x.style.top='200px';
			
			x.style.width=largeur+'px';
			x.style.height=hauteur+"px";

			x.style.backgroundColor='#FFFFFF';
			x.style.color='#000000';
			x.style.textAlign='center';
			x.className='div_trans';
			//x.style.border='solid 1px black';
			x.id=id_div;
			//onMouseDown="dragStart(event,\''+id_div+'\');"
			if(page_chargee=='http://www.mer-et-voyages.info/news_accueil.html'){
				x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " ><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'_gros_titre\'));document.body.removeChild($(\''+id_div+'\'));"><b style="font-size:14px; color:#777777;">X</b></div></div>';	
			}else{
				x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " ><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="$(\''+id_div+'\').style.display=\'none\'"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			}
			//x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " ><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'_gros_titre\'));document.body.removeChild($(\''+id_div+'\'));"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			x_innerHTML+='<div style="position:relative; height:'+(hauteur-20)+'px; width:'+largeur+'px; overflow:auto;">';
			x_innerHTML+='<div id="'+id_div+'_contenu" style="padding:20px;"></div>';
			x_innerHTML+='</div>';
			x.innerHTML=x_innerHTML;
			//x.appendChild(t);
			document.body.appendChild(x);
			devant(id_div);
			if(page_chargee=='http://www.mer-et-voyages.info/news_accueil.html'){
				creer_image_flash_info(id_div);
			}
			
			makeRequest(page_chargee,id_div+'_contenu');
		}else{
			alert('Your browser doesn\'t support the Level 1 DOM');
		}
	}
}

function affiche_div_flotant_deplacable(id_div,titre,largeur,hauteur,page_chargee){
	if($(id_div)){

		document.body.removeChild($(id_div));

		affiche_div_flotant_deplacable(id_div,titre,largeur,hauteur,page_chargee);
	}else{
		if (document.getElementById && document.createElement)
		{
			var x = document.createElement('div');
			
			x.style.position='absolute';
			/*
			x.style.left='50%';
			x.style.top='50%';
			x.style.marginLeft='-'+(largeur/2)+'px';
			x.style.marginTop='-'+(hauteur/2)+'px';
			*/
			x.style.left='280px';
			//x.style.top='50%';
			//alert(document.body.scrollTop);
			//alert(document.body.clientHeight);-(document.body.clientHeight/2)-(hauteur / 2)
			//x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
			ua = navigator.userAgent;
			s = "MSIE 7.";
  			if ((i = ua.indexOf(s)) >= 0) {
				//x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
				x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
			}else{
				s = "Chrome";
				if ((i = ua.indexOf(s)) >= 0) {
					//x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
					x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
				}else{
					s = "Gecko";
					if ((i = ua.indexOf(s)) >= 0) {
						x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
					}else{
						s = "MSIE 8.";
						if ((i = ua.indexOf(s)) >= 0) {
							//alert(document.documentElement.scrollTop);
							x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
						}else{
							s = "MSIE 6.";
							if ((i = ua.indexOf(s)) >= 0) {
								x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
							}else{
								x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
							}
						}
					}
				}
			}
			
			//x.style.marginTop=('-'+(hauteur/2)+document.body.scrollTop)+'px';
			x.style.width=largeur+'px';
			x.style.height=hauteur+"px";

			x.style.backgroundColor='#FFFFFF';
			x.style.color='#000000';
			x.style.textAlign='center';
			x.className='';
			//x.style.border='solid 1px black';
			x.id=id_div;
			//onMouseDown="dragStart(event,\''+id_div+'\');"
			
			x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " onMouseDown="dragStart(event,\''+id_div+'\');"><span style="float:left; color:#000000; line-height:20px; padding-left:5px;" id="'+id_div+'_titre">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'\'));try{$(\'fond_transparent\').style.display=\'none\';}catch(e){}"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			
			//x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " ><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'_gros_titre\'));document.body.removeChild($(\''+id_div+'\'));"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			x_innerHTML+='<div style="position:relative; height:'+(hauteur-20)+'px; width:'+largeur+'px; overflow:auto;">';
			x_innerHTML+='<div id="'+id_div+'_contenu" style="padding:20px;"></div>';
			x_innerHTML+='</div>';
			x.innerHTML=x_innerHTML;
			//x.appendChild(t);
			document.body.appendChild(x);
			devant(id_div);
			if(page_chargee=='http://www.mer-et-voyages.info/news_accueil.html'){
				creer_image_flash_info(id_div);
			}
			try{
				$('fond_transparent').style.display='';
				reposition_fond_transparent();
				//div_repositionable.push('fond_transparent');
			}catch(e){}
			div_repositionable.push(id_div);
			makeRequest(page_chargee,id_div+'_contenu');
		}else{
			alert('Your browser doesn\'t support the Level 1 DOM');
		}
	}
}
function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientHeight) {
         windowHeight = document.documentElement.clientHeight;
    }
    else {
     if (document.body&&document.body.clientHeight) {
         windowHeight=document.body.clientHeight;
      }
     }
    }
    return windowHeight;
}

function affiche_div_flotant_deplacable_contenu(id_div,titre,largeur,hauteur,contenu){
	if($(id_div)){
		document.body.removeChild($(id_div));
		affiche_div_flotant_deplacable_contenu(id_div,titre,largeur,hauteur,contenu);
	}else{
		if (document.getElementById && document.createElement)
		{
			var x = document.createElement('div');
			
			x.style.position='absolute';
			
			x.style.left=(document.body.scrollLeft+(document.body.clientWidth/2)-(largeur / 2))+'px';

			ua = navigator.userAgent;
			s = "MSIE 7.";
  			if ((i = ua.indexOf(s)) >= 0) {
				x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
			}else{
				s = "Chrome";
				if ((i = ua.indexOf(s)) >= 0) {
					x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
				}else{
					s = "Gecko";
					if ((i = ua.indexOf(s)) >= 0) {
						x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
					}else{
						s = "MSIE 8.";
						if ((i = ua.indexOf(s)) >= 0) {
							x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
						}else{
							s = "MSIE 6.";
							if ((i = ua.indexOf(s)) >= 0) {
								x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
							}else{
								x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
							}
						}
					}
				}
			}

			//x.style.marginTop=('-'+(hauteur/2)+document.body.scrollTop)+'px';
			x.style.width=largeur+'px';
			x.style.height=hauteur+"px";

			x.style.backgroundColor='#FFFFFF';
			x.style.color='#000000';
			x.style.textAlign='left';
			x.className='';
			x.style.border='solid 1px #dddddd';
			x.id=id_div;
			//onMouseDown="dragStart(event,\''+id_div+'\');"
			
			x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " onMouseDown="dragStart(event,\''+id_div+'\');"><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'\'));try{$(\'fond_transparent\').style.display=\'none\';}catch(e){}"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			
			//x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " ><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'_gros_titre\'));document.body.removeChild($(\''+id_div+'\'));"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			x_innerHTML+='<div style="position:relative; height:'+(hauteur-20)+'px; width:'+largeur+'px; overflow:auto;">';
			x_innerHTML+='<div id="'+id_div+'_contenu" style="padding:20px; text-align:left;"></div>';
			x_innerHTML+='</div>';
			//x_innerHTML+=navigator.userAgent;
			x.innerHTML=x_innerHTML;
			//x.appendChild(t);
			document.body.appendChild(x);
			devant(id_div);
			//document.body.onscroll.appendChild('reposition_fond_transparent('+div+');');
			
				
			
			$(id_div+'_contenu').innerHTML = contenu;
			//document.body.onscroll = reposition_fond_transparent('+div+');
			//addEvent(function(){addEvent(document, 'scroll', reposition_fond_transparent(div));});
			div_repositionable = new Array(id_div);
			try{
			$('fond_transparent').style.display='';
			}catch(e){}
			reposition_fond_transparent();
		}else{
			alert('Your browser doesn\'t support the Level 1 DOM');
		}
	}
}
function affiche_div_flotant_deplacable_contenu2(id_div,titre,largeur,hauteur,contenu){
	
	if($(id_div)){
		document.body.removeChild($(id_div));
		affiche_div_flotant_deplacable_contenu2(id_div,titre,largeur,hauteur,contenu);
	}else{
		
		if (document.getElementById && document.createElement)
		{
			var x = document.createElement('div');
			
			x.style.position='absolute';
			
			x.style.left=(document.body.scrollLeft+(document.body.clientWidth/2)-(largeur / 2))+'px';

			ua = navigator.userAgent;
			s = "MSIE 7.";
  			if ((i = ua.indexOf(s)) >= 0) {
				x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
			}else{
				s = "Chrome";
				if ((i = ua.indexOf(s)) >= 0) {
					x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
				}else{
					s = "Gecko";
					if ((i = ua.indexOf(s)) >= 0) {
						x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
					}else{
						s = "MSIE 8.";
						if ((i = ua.indexOf(s)) >= 0) {
							x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
						}else{
							s = "MSIE 6.";
							if ((i = ua.indexOf(s)) >= 0) {
								x.style.top=(document.documentElement.scrollTop+(getWindowHeight()/2)-(hauteur / 2))+'px';
							}else{
								x.style.top=document.body.scrollTop+(getWindowHeight()/2)-(hauteur / 2)+'px';
							}
						}
					}
				}
			}

			//x.style.marginTop=('-'+(hauteur/2)+document.body.scrollTop)+'px';
			x.style.width=largeur+'px';
			x.style.height=hauteur+"px";

			x.style.backgroundColor='#FFFFFF';
			x.style.color='#000000';
			x.style.textAlign='left';
			x.className='';
			x.style.border='solid 1px #dddddd';
			x.id=id_div;
			//onMouseDown="dragStart(event,\''+id_div+'\');"
			
			x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " onMouseDown="dragStart(event,\''+id_div+'\');"><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'\'));$(\'fond_transparent\').style.display=\'none\';"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			
			//x_innerHTML='<div id="'+id_div+'_tete" class="div_trans" style="height:20px; cursor:pointer; background-color:#CCCCCC; " ><span style="float:left; color:#000000; line-height:20px; padding-left:5px;">'+titre+'</span><div style="width:15px; height:15px; float:right; cursor:pointer; color:#000000; line-height:20px;" id="sortie_'+id_div+'" onClick="document.body.removeChild($(\''+id_div+'_gros_titre\'));document.body.removeChild($(\''+id_div+'\'));"><b style="font-size:14px; color:#777777;">X</b></div></div>';
			x_innerHTML+='<div style="position:relative; height:'+(hauteur-20)+'px; width:'+largeur+'px; overflow:auto;">';
			x_innerHTML+='<div id="'+id_div+'_contenu" style="padding:20px; text-align:left;"></div>';
			x_innerHTML+='</div>';
			//x_innerHTML+=navigator.userAgent;
			x.innerHTML=x_innerHTML;
			//x.appendChild(t);
			document.body.appendChild(x);
			devant(id_div);
			//document.body.onscroll.appendChild('reposition_fond_transparent('+div+');');
			//alert(id_div+' - '+titre+' - '+largeur+' - '+hauteur+' - '+contenu);
				
			
			$(id_div+'_contenu').innerHTML = contenu;
			//document.body.onscroll = reposition_fond_transparent('+div+');
			//addEvent(function(){addEvent(document, 'scroll', reposition_fond_transparent(div));});
			div_repositionable = new Array(id_div);
			try{
			$('fond_transparent').style.display='';
			}catch(e){}
			reposition_fond_transparent();
		}else{
			alert('Your browser doesn\'t support the Level 1 DOM');
		}
	}
}
function creer_image_flash_info(div_dessous){
	div_left = ($(div_dessous).offsetLeft)-35;
	div_top = $(div_dessous).offsetTop+15;
	//alert(div_top);
	if($(div_dessous+'_gros_titre')){
		document.body.removeChild($(div_dessous+'_gros_titre'));
		creer_image_flash_info(div_dessous);
	}else{
		if (document.getElementById && document.createElement)
		{
			var x = document.createElement('div');
			
			x.style.position='absolute';
			x.style.left=div_left+'px';
			x.style.top=div_top+'px';
			
			x.style.width='250px';
			x.style.height="97px";
			
			x.id=div_dessous+'_gros_titre';
			x_innerHTML='<img src="http://www.mer-et-voyages.info/images_site/flash_info.png" />';
			x.innerHTML=x_innerHTML;
			
			document.body.appendChild(x);
			devant(div_dessous+'_gros_titre');
		}else{
			alert('Your browser doesn\'t support the Level 1 DOM');
		}
	}
}
function devant(id){
	var allElems = document.getElementsByTagName("*");
	var maxZIndex = 0;
	for(var i=0;i<allElems.length;i++) {
		var elem = allElems[i];
		var cStyle = null;
		if (elem.currentStyle) {
			cStyle = elem.currentStyle;
		}else if (document.defaultView && document.defaultView.getComputedStyle) {
			cStyle = document.defaultView.getComputedStyle(elem,"");
		}
		var sNum;
		if (cStyle) {
			sNum = Number(cStyle.zIndex);
		} else {
			sNum = Number(elem.style.zIndex);
		}
		if (!isNaN(sNum)) {
			maxZIndex = Math.max(maxZIndex,sNum);
		}
	}
	$(id).style.zIndex=maxZIndex+1;
}

function selecteur_mois_periode(type_voyage){
	var annees_choisies = "";
	var annee_periode = document.getElementById('selecteur_annee_periode').getElementsByTagName('input');
	for(var i=0; i<annee_periode.length; i++){
		if(annee_periode[i].id.substr(0,14)=="periode_annee_"){
			if($(annee_periode[i].id).checked==true){
				annees_choisies+=$(annee_periode[i].id).value+',';
			}
		}
	}
	if(type_voyage=='thematique'){
		page='nos_croisieres.php';
	}else if(type_voyage=='expedition'){
		page='croisieres_expeditions.php';
	}
	window.location='./'+page+'?annees_choisies='+annees_choisies.substr(0,annees_choisies.length-1)+'&mois_choisi=tous';
	//makeRequest('./site_fonctions_php/selecteur_mois.php?annees_choisies='+annees_choisies+'&types_voyages='+type_voyage,'selecteur_mois_periode');
}


function recharges_voyages(type_voyage,mois){
	var annees_choisies = "";
	var annee_periode = document.getElementById('selecteur_annee_periode').getElementsByTagName('input');
	for(var i=0; i<annee_periode.length; i++){
		if(annee_periode[i].id.substr(0,14)=="periode_annee_"){
			if($(annee_periode[i].id).checked==true){
				annees_choisies+=$(annee_periode[i].id).value+',';
			}
		}
	}
	
	if(type_voyage=='thematique'){
		var categories="";
		var categ = document.getElementById('categorie_voyage').getElementsByTagName('input');
		var nb_categ=0;
		for(var i=0; i<categ.length; i++){
			if(categ[i].name=='Maritime' || categ[i].name=='Fluvial'){
				if($(categ[i].id).checked==true){
					categories+=categ[i].name+",";
					nb_categ++;
				}
			}
		}
		//alert(categories);
		page='nos_croisieres.php';
		if(categories!=""){
			window.location='./'+page+'?annees_choisies='+annees_choisies.substr(0,annees_choisies.length-1)+'&mois_choisi='+mois+'&categories='+categories.substr(0,categories.length-1);
		}else{
			window.location='./'+page+'?annees_choisies='+annees_choisies.substr(0,annees_choisies.length-1)+'&mois_choisi='+mois;
		}
	}else if(type_voyage=='expedition'){
		page='croisieres_expeditions.php';
		window.location='./'+page+'?annees_choisies='+annees_choisies.substr(0,annees_choisies.length-1)+'&mois_choisi='+mois;
	}
	
}

function recharge_page_thematique(ss_select_annee_mois){
	//alert(ss_select_annee_mois);
	//recuperation de maritime et fluvial
	categories='';
	if($('Maritime').checked==true){
		categories='Maritime';
	}
	if($('Fluvial').checked==true){
		if(categories==''){
			categories='Fluvial';
		}else{
			categories+=',Fluvial';
		}
	}
	try{
		if($('Cargo').checked==true){
			if(categories==''){
				categories='Cargo';
			}else{
				categories+=',Cargo';
			}
		}
	}catch(e){}
	
	try{
	//alert(categories);
	variable = ss_select_annee_mois.split(',');
	//alert(variable[1]);
	ss_select = variable[0];
	v2=variable[1];
	variableb = v2.split('.');
	//alert(variableb[1]);
	var annee=0;
	annee = variableb[0];
	var mois="";
	mois = variableb[1];
	
	mois_ok=false;
	for(i=0; i<lst_annee_mois[annee].length; i++){
		//alert(annee+" : "+temp_mois[i]);
		if(lst_annee_mois[annee][i]==mois){
			mois_ok=true;
		}
	}
	if(mois_ok==false){
		mois='tous';
	}
		window.location="http://www.mer-et-voyages.info/nos_croisieres.php?categories="+categories+"&ss_select="+ss_select+"&annee="+annee+"&mois="+mois;
	}catch(e){
		window.location="http://www.mer-et-voyages.info/nos_croisieres.php?categories="+categories;
	}
}

function target_connexion_ma_selection(reponse){
	document.getElementById('target_connexion_ma_selection').innerHTML=reponse;

	test_scripts();
	
}
function target_connexion_ma_selection2(reponse){
	//alert(reponse);
	document.getElementById('target_connexion_ma_selection').innerHTML=reponse;

	test_scripts_div('target_connexion_ma_selection');
	
}
function charge_maselection(){
	window.location="http://www.mer-et-voyages.fr/ma_selection_visualiser.php";
}
function parse_xml(texte,info){
	retour=texte.substr(texte.indexOf("<"+info+">")+(info.length+2),texte.indexOf("</"+info+">")-(texte.indexOf("<"+info+">")+(info.length+2)));
	return retour;
}

function ajout_a_ma_selection(id_produit,type_produit,div_html){
	
	if(document.getElementById('fin_insert_a_ma_selection')){
		document.body.removeChild($('fin_insert_a_ma_selection'));
	}
	
		if (document.getElementById && document.createElement)
		{
			
			
			ua = navigator.userAgent;
			s = "MSIE 7.";
  			if ((i = ua.indexOf(s)) >= 0) {
				var x = document.createElement('<iframe name="fin_insert_a_ma_selection" id="fin_insert_a_ma_selection" src="#">');
				x.src='#';
				x.style.display='none';
				document.body.appendChild(x);
			}else{
				s = "MSIE 6.";
				if ((i = ua.indexOf(s)) >= 0) {
					alert("Votre navigateur internet ne permet pas d'utiliser cette fonction. Utilisez la derni\350re ersion de ce navigateur ou utilisez un autre (Firefox, Chrome, ...)");
				}else{
				
					var x = document.createElement('iframe');
					x.id='fin_insert_a_ma_selection';
					x.name='fin_insert_a_ma_selection';
					x.style.display='none';
					document.body.appendChild(x);
				}
			}
			
		}
	
	try{
		s = "MSIE 6.";
		if ((i = ua.indexOf(s)) >= 0) {
			
		}else{
			//alert(id_produit+' - '+type_produit+' - '+div_html);
			document.forms['form_ajout_a_ma_selection'].id_produit.value=id_produit;
			document.forms['form_ajout_a_ma_selection'].type_produit.value=type_produit;

			texte = document.getElementById(div_html).innerHTML.replace("\244","&euro;");
			texte = texte.replace("€","&euro;");
			texte = texte.replace("\u20AC","&euro;");
			//alert(texte);
			document.forms['form_ajout_a_ma_selection'].code_html.value=encodeURIComponent(texte);
			//alert(document.getElementById(div_html).innerHTML);
			document.forms['form_ajout_a_ma_selection'].div_html.value=div_html;
			
			//alert(document.forms['form_ajout_a_ma_selection'].id_produit.value);
			document.forms['form_ajout_a_ma_selection'].submit();
			
			/*document.forms['form_ajout_a_ma_selection'].id_produit.value='';
			document.forms['form_ajout_a_ma_selection'].type_produit.value='';
			document.forms['form_ajout_a_ma_selection'].code_html.value='';
			document.forms['form_ajout_a_ma_selection'].div_html.value='';
			
			document.getElementById('fin_insert_a_ma_selection').innerHTML='';*/
		}
	}catch(e){}
	
	
	try{
		document.body.removeChild(document.getElementById('connexion'));
	}catch(e){}
	try{
		$('fond_transparent').style.display='none';
	}catch(e){}
}

function demander_devis(id_produit,type_produit,div_html){
	
	if(document.getElementById('fin_demander_devis')){
		document.body.removeChild($('fin_demander_devis'));
	}
	
		if (document.getElementById && document.createElement)
		{
			
			
			ua = navigator.userAgent;
			s = "MSIE 7.";
  			if ((i = ua.indexOf(s)) >= 0) {
				var x = document.createElement('<iframe name="fin_demander_devis" id="fin_demander_devis" src="#">');
				x.src='#';
				x.style.display='none';
				document.body.appendChild(x);
			}else{
				s = "MSIE 6.";
				if ((i = ua.indexOf(s)) >= 0) {
					alert("Votre navigateur internet ne permet pas d'utiliser cette fonction. Utilisez la derni\350re ersion de ce navigateur ou utilisez un autre (Firefox, Chrome, ...)");
				}else{
				
					var x = document.createElement('iframe');
					x.id='fin_demander_devis';
					x.name='fin_demander_devis';
					x.style.display='none';
					document.body.appendChild(x);
				}
			}
			
		}
	
	try{
		s = "MSIE 6.";
		if ((i = ua.indexOf(s)) >= 0) {
			
		}else{
			if(id_produit!='' && type_produit!='' && div_html!=''){
				//alert(id_produit+' - '+type_produit+' - '+div_html);
				document.forms['form_target_demander_devis'].id_produit_devis.value=id_produit;
				document.forms['form_target_demander_devis'].type_produit_devis.value=type_produit;
				document.forms['form_target_demander_devis'].code_html_devis.value=document.getElementById(div_html).innerHTML;
				document.forms['form_target_demander_devis'].div_html_devis.value=div_html;
			}
			//alert(document.forms['form_ajout_a_ma_selection'].id_produit.value);
			document.forms['form_target_demander_devis'].submit();
			
			/*document.forms['form_ajout_a_ma_selection'].id_produit.value='';
			document.forms['form_ajout_a_ma_selection'].type_produit.value='';
			document.forms['form_ajout_a_ma_selection'].code_html.value='';
			document.forms['form_ajout_a_ma_selection'].div_html.value='';
			
			document.getElementById('fin_insert_a_ma_selection').innerHTML='';*/
		}
	}catch(e){}
	
	
	try{
		document.body.removeChild(document.getElementById('connexion'));
	}catch(e){}
	try{
		$('fond_transparent').style.display='none';
	}catch(e){}
}

function devis_tmp_onglets(menu){
	//2 menus possibles : coordonnees_devis et produits_devis
	if(menu=='coordonnees_devis'){
		document.getElementById('onglet_coordonnees_devis').className='menu_haut_gauche_on';
		document.getElementById('onglet_produits_devis').className='menu_haut_gauche_off';
		document.getElementById('coordonnees_devis').style.display='';
		document.getElementById('produits_devis').style.display='none';
	}else{
		document.getElementById('onglet_coordonnees_devis').className='menu_haut_gauche_off';
		document.getElementById('onglet_produits_devis').className='menu_haut_gauche_on';
		document.getElementById('coordonnees_devis').style.display='none';
		document.getElementById('produits_devis').style.display='';
	}
}

function continuer_ma_selection_devis_tmp(){
	//alert(document.getElementById('form_devis').innerHTML);
		document.getElementById('action_tmp').value='continuer';
	try{
		document.forms['form_devis_tmp'].submit();
		document.body.removeChild(document.getElementById('demande_devis_tmp'));
		document.getElementById('fond_transparent').style.display='none';
	}catch(e){alert(e);}
}
function verif_produits_devis_tmp(id_devis){
	nb_check=0;
	lst_prod = document.getElementById('demande_devis_tmp').getElementsByTagName('input');
	for(i=0; i<lst_prod.length; i++){
		if(lst_prod[i].id.substr(0,9)=='etat_chk_' && lst_prod[i].type=='checkbox' && lst_prod[i].checked==true){
			nb_check++;
		}
	}
	if(nb_check>0){
		valider_demande_devis_tmp();
	}else{
		alert('Au moins un voyage doit \350tre s\351lectionn\351.');
	}
}

function valider_demande_devis_tmp(){
	verifier_form_devis_tmp();
	if(document.getElementById('erreur_devis').style.display=='none'){
		document.getElementById('action_tmp').value='valider';
		document.forms['form_devis_tmp'].submit();
	}else{
		devis_tmp_onglets('coordonnees_devis');
	}
}

function fin_inser_a_ma_selection(nb_prod){
	document.getElementById('btn_ma_selection_new').innerHTML='Ma s&eacute;lection<span style="font-size:12px;"> ('+nb_prod+' prod.)</span>';
	if(nb_prod>0){
		try{
			devis_temporaire_encours_new('oui');
		}catch(e){}
	}
}
function envoyer_ami(adr_email_ami,message,telephone,date_relance){
	makeRequest('./ma_selection/envoyer_ami.php?adr_email_ami='+adr_email_ami+'&message='+encodeURIComponent(message)+'&telephone='+telephone+'&date_relance='+date_relance,'envoi_selection_a_ami_contenu');
}
function fin_conserver_selection(reponse){
	//alert(reponse);
	window.location='http://www.mer-et-voyages.info/ma_selection_visualiser.php?premiere_visite=1';
}

function verif_numeric(id_div){
	
	if(isNaN(document.getElementById(id_div).value)==true){
		document.getElementById(id_div).value='0';
	}else{
		if(document.getElementById(id_div).name=='nb_adultes'){
			change_nb_adultes(parseInt(document.getElementById(id_div).value));
		}else{
			change_nb_enfants(parseInt(document.getElementById(id_div).value));
		}
	}
	form_evis_corriger();
	/*if (isNaN(val)==false){
		return parseInt(val);
	}else{
		return false;
	}*/
}

function change_nb_adultes(nb){
	lst = document.getElementById('detail_adultes').getElementsByTagName('input');
	retour='';
	if(nb!=lst.length){
		for(i=0; i<nb; i++){
			try{
				retour+='Age adulte '+(i+1)+' : <input class="input" type="text" size="4" maxlength="3" name="adulte[]" id="adulte_'+i+'" value="'+document.getElementById('adulte_'+i+'').value+'" onblur="form_evis_corriger()"/> *<br/>';
			}catch(e){
				retour+='Age adulte '+(i+1)+' : <input class="input" type="text" size="4" maxlength="3" name="adulte[]" id="adulte_'+i+'" value="0" onblur="form_evis_corriger()"/> *<br/>';
			}
		}
		document.getElementById('detail_adultes').innerHTML=retour;
	}
}
function change_nb_enfants(nb){
	lst = document.getElementById('detail_enfants').getElementsByTagName('input');
	retour='';
	if(nb!=lst.length){
		for(i=0; i<nb; i++){
			try{
				retour+='Age enfant '+(i+1)+' : <input class="input" type="text" size="4" maxlength="3" name="enfant[]" id="enfant_'+i+'" value="'+document.getElementById('enfant_'+i+'').value+'" onblur="form_evis_corriger()"/> *<br/>';
			}catch(e){
				retour+='Age enfant '+(i+1)+' : <input class="input" type="text" size="4" maxlength="3" name="enfant[]" id="enfant_'+i+'" value="0" onblur="form_evis_corriger()"/> *<br/>';
			}
		}
		document.getElementById('detail_enfants').innerHTML=retour;
	}
}
function verifier_form_devis(){
	erreur=0;
	erreur_name1='';
	//verifier si au moins un passager et si age renseigné
	nb_pas = document.forms['form_devis'].nb_adultes.value+document.forms['form_devis'].nb_enfants.value;
	if(nb_pas==0){
		alert("Merci de renseigner le nombre de passagers.");
	}else{
		if(document.forms['form_devis'].nb_adultes.value>0){
			for(i=0; i<document.forms['form_devis'].nb_adultes.value; i++){
				if(document.getElementById('adulte_'+i).value==0){
					document.getElementById('adulte_'+i).style.borderColor="red";
					erreur++;
				}else{
					document.getElementById('adulte_'+i).style.borderColor="#dddddd";
				}
			}
		}
		if(document.forms['form_devis'].nb_enfants.value>0){
			for(i=0; i<document.forms['form_devis'].nb_enfants.value; i++){
				if(document.getElementById('enfant_'+i).value==0){
					document.getElementById('enfant_'+i).style.borderColor="red";
					erreur++;
				}else{
					document.getElementById('enfant_'+i).style.borderColor="#dddddd";
				}
			}
		}
	}
	
	//verifier les coordonnees
	if(document.forms['form_devis'].client_nom.value==''){
		document.forms['form_devis'].client_nom.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis'].client_nom.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis'].client_prenom.value==''){
		document.forms['form_devis'].client_prenom.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis'].client_prenom.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis'].client_adresse1.value==''){
		document.forms['form_devis'].client_adresse1.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis'].client_adresse1.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis'].client_cp.value==''){
		document.forms['form_devis'].client_cp.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis'].client_cp.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis'].client_ville.value==''){
		document.forms['form_devis'].client_ville.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis'].client_ville.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis'].client_telephone.value==''){
		document.forms['form_devis'].client_telephone.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis'].client_telephone.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis'].client_adr_email.value==''){
		document.forms['form_devis'].client_adr_email.style.borderColor="red";
		erreur++;
	}else{
		if(check_email(document.forms['form_devis'].client_adr_email.value)==false){
			document.forms['form_devis'].client_adr_email.style.borderColor="red";
			erreur++;
		}
		document.forms['form_devis'].client_adr_email.style.borderColor="#dddddd";
	}
	
	
	if(erreur>0){
		document.getElementById('erreur_devis').style.display='';
	}else{
		document.getElementById('erreur_devis').style.display='none';
	}
}
function verifier_form_devis_tmp(){
	erreur=0;
	erreur_name1='';
	//verifier si au moins un passager et si age renseigné
	nb_pas = document.forms['form_devis_tmp'].nb_adultes.value+document.forms['form_devis_tmp'].nb_enfants.value;
	if(nb_pas==0){
		alert("Merci de renseigner le nombre de passagers.");
	}else{
		if(document.forms['form_devis_tmp'].nb_adultes.value>0){
			for(i=0; i<document.forms['form_devis_tmp'].nb_adultes.value; i++){
				if(document.getElementById('adulte_'+i).value==0){
					document.getElementById('adulte_'+i).style.borderColor="red";
					erreur++;
				}else{
					document.getElementById('adulte_'+i).style.borderColor="#dddddd";
				}
			}
		}
		if(document.forms['form_devis_tmp'].nb_enfants.value>0){
			for(i=0; i<document.forms['form_devis_tmp'].nb_enfants.value; i++){
				if(document.getElementById('enfant_'+i).value==0){
					document.getElementById('enfant_'+i).style.borderColor="red";
					erreur++;
				}else{
					document.getElementById('enfant_'+i).style.borderColor="#dddddd";
				}
			}
		}
	}
	
	//verifier les coordonnees
	if(document.forms['form_devis_tmp'].client_nom.value==''){
		document.forms['form_devis_tmp'].client_nom.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis_tmp'].client_nom.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis_tmp'].client_prenom.value==''){
		document.forms['form_devis_tmp'].client_prenom.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis_tmp'].client_prenom.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis_tmp'].client_adresse1.value==''){
		document.forms['form_devis_tmp'].client_adresse1.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis_tmp'].client_adresse1.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis_tmp'].client_cp.value==''){
		document.forms['form_devis_tmp'].client_cp.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis_tmp'].client_cp.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis_tmp'].client_ville.value==''){
		document.forms['form_devis_tmp'].client_ville.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis_tmp'].client_ville.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis_tmp'].client_telephone.value==''){
		document.forms['form_devis_tmp'].client_telephone.style.borderColor="red";
		erreur++;
	}else{
		document.forms['form_devis_tmp'].client_telephone.style.borderColor="#dddddd";
	}
	if(document.forms['form_devis_tmp'].client_adr_email.value==''){
		document.forms['form_devis_tmp'].client_adr_email.style.borderColor="red";
		erreur++;
	}else{
		if(check_email(document.forms['form_devis_tmp'].client_adr_email.value)==false){
			document.forms['form_devis_tmp'].client_adr_email.style.borderColor="red";
			erreur++;
		}
		document.forms['form_devis_tmp'].client_adr_email.style.borderColor="#dddddd";
	}
	
	
	if(erreur>0){
		document.getElementById('erreur_devis').style.display='';
	}else{
		document.getElementById('erreur_devis').style.display='none';
	}
}

function form_evis_corriger(){
	if(document.getElementById('erreur_devis').style.display==''){
		verifier_form_devis();
	}
}
function form_evis_tmp_corriger(){
	if(document.getElementById('erreur_devis').style.display==''){
		verifier_form_devis_tmp();
	}
}
function devis_tmp_etape_suiv(etape_suiv){
	//verifier_form_devis_tmp();
	if(document.getElementById('erreur_devis').style.display==''){
		verifier_form_devis_tmp();
		if(document.getElementById('erreur_devis').style.display==''){
			document.getElementById('onglet_produits_devis').className='menu_haut_gauche_descative';
			document.getElementById('onglet_produits_devis').onClick='';
			document.getElementById('onglet_produits_devis').setAttribute('onclick','');
		}else{
			document.getElementById('onglet_produits_devis').className='menu_haut_gauche_off';
			document.getElementById('onglet_produits_devis').onClick=function(){devis_tmp_onglets('produits_devis');};
			document.getElementById('onglet_produits_devis').setAttribute('onclick',function(){devis_tmp_onglets('produits_devis');});
			if(etape_suiv=='oui'){
				devis_tmp_onglets('produits_devis');
			}
		}
		
		
	}else if(etape_suiv=='oui'){
		verifier_form_devis_tmp();
		if(document.getElementById('erreur_devis').style.display==''){
			devis_tmp_etape_suiv(etape_suiv);
		}else{
			devis_tmp_onglets('produits_devis');
		}
	}
}

function devis_tmp_etape_suiv_2(etape_suiv){
	//alert('test');
	//verifier_form_devis_tmp();
	if(document.getElementById('erreur_devis').style.display==''){
		//verifier_form_devis_tmp();
		if(document.getElementById('erreur_devis').style.display==''){
			document.getElementById('onglet_produits_devis').className='menu_haut_gauche_descative';
			document.getElementById('onglet_produits_devis').onClick='';
			document.getElementById('onglet_produits_devis').setAttribute('onclick','');
		}else{
			document.getElementById('onglet_produits_devis').className='menu_haut_gauche_off';
			document.getElementById('onglet_produits_devis').onClick=function(){devis_tmp_onglets('produits_devis');};
			document.getElementById('onglet_produits_devis').setAttribute('onclick',function(){devis_tmp_onglets('produits_devis');});
			if(etape_suiv=='oui'){
				devis_tmp_onglets('produits_devis');
			}
		}
		
		
	}else if(etape_suiv=='oui'){
		//verifier_form_devis_tmp();
		if(document.getElementById('erreur_devis').style.display==''){
			devis_tmp_etape_suiv(etape_suiv);
		}else{
			devis_tmp_onglets('produits_devis');
		}
	}
}
function masqu_devis_demande(){
	document.body.removeChild(document.getElementById('demande_devis'));
}
function masquer_demande_devis_tmp(){
	//alert(document.body.innerHTML);
	try{
		document.getElementById('demande_devis_tmp').style.display='none';
		$('fond_transparent').style.display='none';
	}catch(e){
		window.parent.document.getElementById('demande_devis_tmp').style.display='none';
		window.parent.document.getElementById('fond_transparent').style.display='none';
	}
}

function devis_temporaire_encours(oui_non){
	if(oui_non=='oui'){
		//document.getElementById('target_btn_devis_temp').innerHTML = '<input type="button" value="Demander un devis (sur ma s&eacute;lection)" onclick="demander_devis(\'\',\'\',\'\');" style="color:#FFFFFF; background:url(./images/fond_btn_ma_selection.gif); font-weight:bold; border:solid 1px #cccccc; cursor:pointer; height:30px;"/>';
		document.getElementById('target_btn_devis_temp').innerHTML = '<div id="btn_demander_devis" onclick="demander_devis(\'\',\'\',\'\');">Demander un devis<br/><span style="font-size:12px;">(sur ma s&eacute;lection)</span></div>';
	}else{
		document.getElementById('target_btn_devis_temp').innerHTML = '';
	}
}
function devis_temporaire_encours_new(oui_non){
	if(oui_non=='oui'){
		document.getElementById('target_btn_devis_temp').innerHTML = '<div id="btn_demander_devis" onclick="demander_devis(\'\',\'\',\'\');">Demander un devis<br/><span style="font-size:12px;">(sur ma s&eacute;lection)</span></div>';
	}else{
		document.getElementById('target_btn_devis_temp').innerHTML = '<div id="btn_demander_devis_desactive" >Demander un devis<br/><span style="font-size:12px;">(sur ma s&eacute;lection)</span></div>';
	}
}
function finalise_envoi_devis_temp(contenu){
	masquer_demande_devis_tmp();
	affiche_div_flotant_deplacable_contenu2('fin_envoi_devis','Votre demande a &eacute;t&eacute; transmise',400,170,contenu);
	//devis_temporaire_encours('non');
}
