// JavaScript Document Akaoka version 2.1

function pixel(img)
	{	
		if(img && img.filters && img.filters[0])
		{
			img.filters[0].apply();
			img.filters[0].play();
		}
	}
	
	var Sens = 2;
	function alpha()
	{
		var TM = setTimeout("alpha()",50);
		var IMG = eval("document.getElementById('imgalpha')");
		
		IMG.filters.alpha.opacity = IMG.filters.alpha.opacity - Sens;
		if (IMG.filters.alpha.opacity <=20 || IMG.filters.alpha.opacity >=100 )
			{
			Sens=-Sens
			}
	}
	
	
function addrow()
{
 var t=document.getElementById("tab");

 var l=t.insertRow(t.rows.length);

 var c=l.insertCell(l.cells.length);

 c.innerHTML="<b>Pièces jointes :</b> <input type='file' name='picture[]' class='option'>";

 c=l.insertCell(l.cells.length);

 c.innerHTML="<input type='button' class='btn' value='+' onclick='this.style.visibility=\"hidden\"; addrow();'>";
}



function ouvrir(page,nom,option) {
  window.open(page,nom,option+",resizable=yes,scrollbars=yes");
}

  function ouvrirpage(code){
     window.open('news_letter_complete_form.php?mail='+code+'&','newsletter','scrollbars=yes,resizable=yes,width=400,height=500');
  }
  function lanewsletter(){
     var init=0;	
     var nlleform=document.forms["nlformulaire"].elements;
	if(nlleform.monemail.value==""){
	  init+=1;
	}
	if(nlleform.monemail.value=="votre email"){
	  init+=1;
	}
	if(init==0){
	ouvrirpage(nlleform.monemail.value);
	}
  }

var coche = true;
function toutcocher(){
l=document.forms["resultat"].getElementsByTagName("INPUT");
for(var i=0; i<l.length; i++) {
    if(l[i].type.toUpperCase()=="CHECKBOX")
    {l[i].checked = coche; }
    }
    coche = (coche) ? false : true;
}



function PopupImage(image,titulo) {
var tete="AKAOKA Voyages";
var texte=titulo;
var imgtitle="Cliquer pour fermer";
var alt="Image agrandie, cliquer pour fermer";
var style="";
var h = 250;
var l = 250;
var mh = 70;
var mv = 30;
var ln = 20;
var hn = 40;
var lfm,hfm,hautfm,gauchefm;
if (typeof self.innerHeight != 'undefined')
{
ln2 = self.outerWidth-document.body.offsetWidth;
hn2 = self.outerHeight-self.innerHeight;
hautfm = self.screenY;
gauchefm = self.screenX;
lfm = self.outerWidth-ln2;
hfm = self.innerHeight+hn2;
}
else if (typeof document.documentElement != 'undefined' && document.documentElement.clientHeight != 'undefined')
{
hautfm = window.screenTop;
gauchefm = window.screenLeft;
lfm = document.documentElement.clientWidth-ln;
hfm = document.documentElement.clientHeight-hn;
}
else if (typeof document.body != 'undefined')
{
hautfm = window.screenTop;
gauchefm = window.screenLeft;
lfm = document.body.clientWidth-ln;
hfm = document.body.clientHeight-hn;
}
var PosX = 0;
var PosY = 5;
var option = "resizable,toolbar=no,scrollbars=no,top="+PosX+",left="+PosY+",width="+l+",height="+h+"";
w=open('',"titre",option);
w.document.write("<html>");
w.document.write("<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />");
w.document.write("<html><head><title>"+tete+"</title></head>");
w.document.write("<link href='"+style+"' rel='stylesheet' type='text/css' />");
w.document.write("<script type=text/javascript>function checkSize() { if (document.images[0].width > 1 && document.images[0].height > 1) { window.resizeTo(document.images[0].width+"+ln+"+"+mv+",document.images[0].height+"+hn+"+"+mh+")} else { setTimeout('checksize()',250) } }</"+"script>");
w.document.write("<body onload='checkSize()' onblur='window.close()' onclick='window.close()' bgcolor='fdba1a'>");
w.document.write("<div align='center'><img src='"+image+"' alt='"+alt+"' title='"+imgtitle+"'></div><div align='center'><font color='006699'><b>"+texte+"</b></font></div>");
w.document.write("</body></html>");
w.document.close();
}



if (navigator.appVersion.indexOf("Win")!=-1) eol="\r\n";
if (navigator.appVersion.indexOf("Mac")!=-1) eol="\n";
if (navigator.appVersion.indexOf("X11")!=-1) eol="\r\n";
if (navigator.appVersion.indexOf("Linux")!=-1) eol="\r\n";


   function formverifier(){
	var ok=0;
	var alerte="";
      with (document.formCarnet){
	if(nom.value==""){
		alerte+="Votre nom"+eol;
		ok+=1;
	}
	if(verifiermail(mail.value)==false){
		alerte+="Email non valide"+eol;
		ok+=1;
	}
	if(tel.value==""){
		if(portable.value==""){
		alerte+="Merci de nous communiquer un téléphone"+eol;
		ok+=1;
		}
	}
	if(nbpax.value==""){
		alerte+="Combien de personnes ?"+eol;
		ok+=1;
	}
      }
	var mois=document.getElementById("mdepart");
	var annee=document.getElementById("adepart");
	if(mois.value==""){
		alerte+="Mois de départ ?"+eol;
		ok+=1;
	}
	if(annee.value==""){
		alerte+="Année de départ ?"+eol;
		ok+=1;
	}
	if(ok!=0){
	   window.alert(alerte);
	}else{
	document.formCarnet.submit();
	}
   }
   
   function formverifierdevis1(){
	var ok=0;
	var alerte="";
      with (document.formulaireUn){
	if(ville.value==""){
		alerte+="Depuis quelle ville ?"+eol;
		ok+=1;
	}
	if(duree.value==""){
		alerte+="Combien de jours prevoyez-vous?"+eol;
		ok+=1;
	}
	if(budget.value==""){
		alerte+="Quel est votre buget?"+eol;
		ok+=1;
	}	
	if(nombre.value==""){
		alerte+="Combien de personnes?"+eol;
		ok+=1;
	}
	if(hebergement.value==""){
		alerte+="Type hébergement ?"+eol;
		ok+=1;
	}
	if(commentaires.value==""){
		alerte+="Quelques commentaires SVP"+eol;
		ok+=1;
	}
      }
	var mois=document.getElementById("md");
	var annee=document.getElementById("ad");
	if(mois.value==""){
		alerte+="Mois de départ ?"+eol;
		ok+=1;
	}
	if(annee.value==""){
		alerte+="Année de départ ?"+eol;
		ok+=1;
	}
	var checkdate=annee.value+""+mois.value;
	if(ok!=0){
		window.alert(alerte);
	}else{
	document.formulaireUn.submit();
	}
   }

   function verifierdate(unedate){
	var ladate=new Date()
	var jourcours=ladate.getFullYear();
        var moiscours=(ladate.getMonth()+1);
	var hoy=jourcours+""+moiscours;
	var aujour=parseInt(hoy);
	var searchfecha=parseInt(unedate);
	if(searchfecha<aujour) {
          return false;
	}else{
	  return true;
	}
   }

   function verifiermail(mail) {
      if ((mail.indexOf("@")>=0)&&(mail.indexOf(".")>=0)) {
         return true
      } else {
         return false
      }
   }

function verifcontact()
  {
	var ok = 1;
    with (document.contactform)
    {
		if(nom.value==""){
		   ok=0;
		   nom.focus();
        }
        if(mail.value==""){
		   ok=0;
		   mail.focus();
        }
        if(message.value==""){
		   ok=0;
		   message.focus();
        }
        if(ok==0){
             alert("Merci de remplir tous les champs !");
             return false;
	}
	else{
	      return true;
	}
    }
  }
  
  // fonction pour masquer/afficher le menu haut
function menumontre(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	if (d) {d.style.display='block';}
}
 
var level = 0;
var delay;
 
function over() {
  level++;
  if(delay) clearTimeout(delay);
}
 
function out() {
  level--;
  if(delay) clearTimeout(delay);
  if(level==0) delay = setTimeout("retard()", 200);
}
 
function retard() {
	menumontre('');
}


		function VformRecherche(){			
			with(document.fra){
				if((tipo.value=="")&&(pays.value=="")&&(activite.value=="")){
					document.getElementById('msgerror').innerHTML="Merci de faire au moins un choix !";
					return false;
				}
				else{
					return true;
				}
			}
		}
		
function galerie(pays){
	var w=420;
	var l=420;
  	var top=(screen.height-w)/2;
  	var left=(screen.width-l)/2;
  	window.open("http://akaoka.com/diapo/?idp="+pays,"diaporama","top="+top+",left="+left+",width=420px,height=420px,scrollbars=no,resizable=no");
}

	// FORMULAIRE JEU CONCOURS =====
	function VJC(){
		var ok=0;
		with(document.jeu){
			if(pays.value==""){
				alert("Nom du pays ?");
				ok=1;
			}
			if(nom.value==""){
				alert("Votre nom ?");
				ok=1;
			}
			if(prenom.value==""){
				alert("Votre prénom ?");
				ok=1;
			}
			if(mail.value==""){
				alert("Votre email ?");
				ok=1;
			}
		}
		
		if(ok==1) return false;
		else return true;
	}