$URL_P="http://www.paiement.safar.ma";

List_combo = new Array();
 function dateinf_recher(champ1,champ2,message,champs){
	var reg=new RegExp("/", "g");
	// Compare 2 dates au format jj/mm/aaaa
	// Renvoye 0 si égalité, 1 si la première est supérieure, sinon 2
	
	date1=document.getElementById(champ1).value.replace(reg,"-")
	date2=document.getElementById(champ2).value.replace(reg,"-")
	
	var date1 = dato(date1,"-");// Ne pas oublier d'utiliser cette fonction
	// pour convertir en date anglaise, sinon le 05/07/2003 sera compris "7 mai 2003" par JavaScript
	var date2 = dato(date2,"-");

	date1 = Date.parse(date1);
	date2 = Date.parse(date2);
	
	//if (date1 == date2) { return true;}
	if (date1 < date2){
	alert(message)		 
		document.getElementById(champs).value=''
		document.getElementById(champs).focus()
		return false
	}else{
		 
		return true
	}

}
function messages_mdp(champs,libelle){
	if (document.getElementById(champs).value==""){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le champs "+libelle+" est obligatoire !"
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}
function RemplirCombo(champ,libelle,valeur,division,classe){
	var sel="";
	sel ="<select  name='"+champ+"' id='"+champ+"'   OnChange=\"RemplirComboo('sltssfam','Toutes les SSfamille',sltfam.value,sltsfam.value,'divssfam','"+classe+"');\" style='margin:1px;font-size: 10px;height:18px;color: #000;width:220px;background-color: #F7F7F7;border:1px solid #E9EEF5;'>";
		// Parcourir le tableau
		sel= sel + "<option value=0>"+libelle+"</option>";
		for (var i=0;i<List_combo.length;i++){
		  // tester si la ligne du tableau (Sous-cat?gorie) correspond r la valeur de la cat?horie
		  if (List_combo[i][1]==valeur){
			// Ajouter une rubrique sous-cat?gorie au variable SEL
			sel= sel + "<option value="+List_combo[i][0]+">"+List_combo[i][2]+"</option>";
		  }
		}
	sel=sel+"</select>";
	// Modifier le DIV scat par la nouvelle List r partir du variable SEL
	obj(division).innerHTML=sel;
}
function popupcentree(page,largeur,hauteur,options) 
{ 
    var top=(screen.height-hauteur)/2; 
    var left=(screen.width-largeur)/2;
    window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options); 
} 
function dateinf(champ1,champ2,message,champs){
	var reg=new RegExp("/", "g");
	// Compare 2 dates au format jj/mm/aaaa
	// Renvoye 0 si égalité, 1 si la première est supérieure, sinon 2
	
	date1=document.getElementById(champ1).value.replace(reg,"-")
	date2=document.getElementById(champ2).value.replace(reg,"-")
	
	var date1 = dato(date1,"-");// Ne pas oublier d'utiliser cette fonction
	// pour convertir en date anglaise, sinon le 05/07/2003 sera compris "7 mai 2003" par JavaScript
	var date2 = dato(date2,"-");

	date1 = Date.parse(date1);
	date2 = Date.parse(date2);
	
	//if (date1 == date2) { return true;}
	if (date1 < date2){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML=message
		document.getElementById(champs).value=''
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}

}

function Mask_adad_sahih(e) { 
// if aEvent is null, means the Internet Explorer event model, 
// so get window.event. 
	var IE5 = false; 
	if (!e) var e = window.event; 
	if (e.keyCode) { IE5= true; code = e.keyCode;} 
	else if (e.which) code = e.which ;
//test du code
	if (code < 48 || code > 57) {
		if(IE5) e.returnValue = false;
		else e.preventDefault();
	}
}

List_combo_ = new Array();
function RemplirCombo_(champ,libelle,valeur,division,classe){
	var sel="";
	sel ="<select  name='"+champ+"' id='"+champ+"'  style='margin:1px;font-size: 10px;height:18px;color: #000;width:130px;background-color: #F7F7F7;border:1px solid #E9EEF5;'>";
		// Parcourir le tableau
		sel= sel + "<option value=0>"+libelle+"</option>";
		for (var i=0;i<List_combo_.length;i++){
		  // tester si la ligne du tableau (Sous-cat?gorie) correspond r la valeur de la cat?horie
		  if (List_combo_[i][1]==valeur){
			// Ajouter une rubrique sous-cat?gorie au variable SEL
			sel= sel + "<option value="+List_combo_[i][0]+">"+List_combo_[i][2]+"</option>";
		  }
		}
	sel=sel+"</select>";
	// Modifier le DIV scat par la nouvelle List r partir du variable SEL
	obj(division).innerHTML=sel;
}


List_comboo = new Array();
function RemplirComboo(champ,libelle,valeur1,valeur2,division,classe){
	var sel="";
	sel ="<select  name='"+champ+"' id='"+champ+"'  OnChange=\"RemplirCombooo('sltsssfam','Toutes les SSSfamille',sltsfam.value,sltssfam.value,'divsssfam','"+classe+"');\" style='margin:1px;font-size: 10px;height:18px;color: #000;width:220px;background-color: #F7F7F7;border:1px solid #E9EEF5;'>";
		// Parcourir le tableau
		sel= sel + "<option value=0>"+libelle+"</option>";
		for (var i=0;i<List_comboo.length;i++){
		  // tester si la ligne du tableau (Sous-cat?gorie) correspond r la valeur de la cat?horie
		  if (List_comboo[i][0]==valeur1 && List_comboo[i][1]==valeur2){
			// Ajouter une rubrique sous-cat?gorie au variable SEL
			sel= sel + "<option value="+List_comboo[i][2]+">"+List_comboo[i][3]+"</option>";
		  }
		}
	sel=sel+"</select>";
	// Modifier le DIV scat par la nouvelle List r partir du variable SEL
	obj(division).innerHTML=sel;
	//alert(sel);
}

List_combooo = new Array();
function RemplirCombooo(champ,libelle,valeur1,valeur2,division,classe){
	var sel="";
	sel ="<select  name='"+champ+"' id='"+champ+"' style='margin:1px;font-size: 10px; height:18px; color: #000;width:220px;background-color: #F7F7F7;border:1px solid #E9EEF5;'>";
		// Parcourir le tableau
		sel= sel + "<option value=0>"+libelle+"</option>";
		for (var i=0;i<List_combooo.length;i++){
		  // tester si la ligne du tableau (Sous-cat?gorie) correspond r la valeur de la cat?horie
		  if (List_combooo[i][0]==valeur1 && List_combooo[i][1]==valeur2){
			// Ajouter une rubrique sous-cat?gorie au variable SEL
			sel= sel + "<option value="+List_combooo[i][2]+">"+List_combooo[i][3]+"</option>";
		  }
		}
	sel=sel+"</select>";
	// Modifier le DIV scat par la nouvelle List r partir du variable SEL
	obj(division).innerHTML=sel;
	//alert(sel);
}

function isExtsAllowed(path) {
	var lastDot = path.lastIndexOf("."); //index of last dot, the extension will follow this dot
	if(lastDot != 1) { //if we found a dot, that means we have an extension
		var fileExts = path.substring(lastDot + 1, path.length).toLowerCase();
		//loop through array of allowed extensions and check if this one is allowed
		for(var i = 0; i < allowedExts.length; i++) {
			//alert (fileExts);
			if(fileExts == allowedExts[i]) //if the extension is in the list of allowed
				return true;
		}
	}
	
	return false;
}

function chawaib(chaine){
	var chawa=new RegExp("'", "g");
	return chaine.replace(chawa,"\'")
}

function cacher(objet){
	document.getElementById(objet).style.visibility='hidden';	
	document.getElementById(objet).style.display='none';
}


//FONCTION POUR AGRANDIR UNE IMAGE
	function agrandir_photo(chemin,photo){
		window.open(chemin+photo)	
	}

function getHTTPObject() {
	var xmlhttp;
	if (navigator.appName=="Microsoft Internet Explorer")
		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		//il faut remplacer "Microsoft.XMLHTTP" par "Msxml2.XMLHTTP.5.0" pour eviter l'erreur system : 1072896748 
		//pour les actentues : test r ussi est valid		
	else 	
		var xmlhttp = new XMLHttpRequest();  

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
      } catch (e) {
      	xmlhttp = false;
      }
    }
  return xmlhttp;
}

var http = getHTTPObject();

function setCheckboxColumn(theCheckbox){
    if (document.getElementById(theCheckbox)) {
        document.getElementById(theCheckbox).checked = (document.getElementById(theCheckbox).checked ? false : true);
        if (document.getElementById(theCheckbox + 'r')) {
            document.getElementById(theCheckbox + 'r').checked = document.getElementById(theCheckbox).checked;
        }
    } else {
        if (document.getElementById(theCheckbox + 'r')) {
            document.getElementById(theCheckbox + 'r').checked = (document.getElementById(theCheckbox +'r').checked ? false : true);
            if (document.getElementById(theCheckbox)) {
                document.getElementById(theCheckbox).checked = document.getElementById(theCheckbox + 'r').checked;
            }
        }
    }
}


//POUR AFFICHER UNE GRANDE IMAGE SOUS FORME D'UNE POPUS
function PopupImage(img,largeur,hauteur) { 
	w=open("",'image','weigth=toolbar=no,scrollbars=no,resizable=no, width='+largeur+', height='+hauteur+', left=200, top=100'); 
	w.document.write("<HTML><BODY topmargin='0px' bottommargin='0px'   leftmargin='0px' rightmargin='0px' onblur=\"window.close();\"><IMG src="+img+">"); 		
	w.document.write("</BODY></HTML>"); 
	w.document.close(); 
} 

//POUR AFFICHER UNE GRANDE IMAGE SAUS UNE AUTRE PAGE WEB NOT A POPUS
function grande(liencontrol,imgcontrol){	
	v=document.getElementById(liencontrol)
	v.target="_blank"
	v1=document.getElementById(imgcontrol).src
	//v1=v1.replace('petites','grandes')
	v.href=v1
}	

function changeImages(name,image) {
	document.images[name].src=image
}

function mailtooo(email,titre){
	chaine_mail = "mailto:"+email+"?subject=" + titre;      
	chaine_mail += "&body="; 
	chaine_mail += ""; location.href = chaine_mail;     
} 
function message(champs,libelle){
	if (document.getElementById(champs).value==""){
		 
		alert("Le champs "+libelle+" ne doit pas être une chaine vide !")
		document.getElementById(champs).focus()
		return false
	}else{
		
		return true
	}
}
function checkmail_(champs,libelle){
	if ( !filter.test(document.getElementById(champs).value) ){
		
		alert("L'adresse email du champ "+libelle+" n'est pas valide ")
		document.getElementById(champs).focus()
		return false
	}else{
		
		return true
	}
}

function messages(champs,libelle){
	if (document.getElementById(champs).value==""){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le champs <span style='text-decoration:underline;font-weight:bold'>"+libelle+"</span> ne doit pas  etre une chaine vide "
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function messages1(champs,libelle){
	if (document.getElementById(champs).value==""){
		document.getElementById('id_validationn').style.visibility='visible'
		document.getElementById('id_validationn').innerHTML="Le champs <span style='text-decoration:underline;font-weight:bold'>"+libelle+"</span> ne doit pas  etre une chaine vide "
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validationn').style.visibility='hidden'
		return true
	}
}

function messages_login(champs,libelle){
	if (document.getElementById(champs).value==""){
		alert("Le champ "+libelle+" ne doit pas être une chaine vide !")
		document.getElementById(champs).focus()		
		return false
	}
}

var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

function checkmail(champs,libelle){
	
	if ( !filter.test(document.getElementById(champs).value) ){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="L'adresse email du champ <span style='text-decoration:underline;font-weight:bold'>"+libelle+"</span> n'est pas valide "
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function checkdate(champs,libelle){
	if(!isDate(document.getElementById(champs).value)  ) {
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le format de la date du champs "+libelle+" n'est pas valide (ex: 31-02-2007) "
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function comparerdates(champ1,champ2,chaine1,chaine2){
	var reg=new RegExp("/", "g");
	// Compare 2 dates au format jj/mm/aaaa
	// Renvoye 0 si galit , 1 si la premire est sup rieure, sinon 2
	
	date1=document.getElementById(champ1).value.replace(reg,"-")
	date2=document.getElementById(champ2).value.replace(reg,"-")
	
	var date1 = dato(date1,"-");// Ne pas oublier d'utiliser cette fonction
	// pour convertir en date anglaise, sinon le 05/07/2003 sera compris "7 mai 2003" par JavaScript
	var date2 = dato(date2,"-");

	date1 = Date.parse(date1);
	date2 = Date.parse(date2);

	//if (date1 == date2) { return true;}
	if (date1 > date2){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML=chaine1+ " doit être inférieure ou égal (<=)   "+chaine2
		document.getElementById(champ2).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}

}

function dato(date,sep){
	var elem = date.split(sep); 
	jour = elem[0]; 
	mois = elem[1]; 
	annee = elem[2]; 
	return annee+"/"+mois+"/"+jour
}

function dateact(date1,date2,chaine){
	// Compare 2 dates au format jj/mm/aaaa
	// Renvoye 0 si galit , 1 si la premire est sup rieure, sinon 2
	var date1 = dato(date1,"-");// Ne pas oublier d'utiliser cette fonction
	// pour convertir en date anglaise, sinon le 05/07/2003 sera compris "7 mai 2003" par JavaScript
	var date2 = dato(date2,"-");

	date1 = Date.parse(date1);
	date2 = Date.parse(date2);

	//if (date1 == date2) { return true;}
	if (date1 > date2){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML=chaine + "doit être supérieure ou égal (>=) à la date d'aujourd'hui"
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}

}

function DateSystem (){
		d= new Date();
		d.setDate(d.getDate());
		strDay = (d.getDate()<10?"0":"")+d.getDate();
		month = d.getMonth()+1;
		strMonth = (month<10?"0":"")+month;
		strDate = ""+strDay+"-"+strMonth+"-"+d.getFullYear();	
		return strDate;
}

function isDate(d) {
	var reg=new RegExp("/", "g");
	d=d.replace(reg,"-")
	// Cette fonction permet de vrifier la validit  d'une date au format jj/mm/aa ou jj/mm/aaaa
	// Par Romuald
	
	if (d == "") // si la variable est vide on retourne faux
		return false;
	
	e = new RegExp("^[0-9]{1,2}\-[0-9]{1,2}\-([0-9]{2}|[0-9]{4})$");
	
	if (!e.test(d)) // On teste l'expression rguli re pour valider la forme de la date
		return false; // Si pas bon, retourne faux

	// On spare la date en 3 variables pour v rification, parseInt() converti du texte en entier
	j = parseInt(d.split("-")[0], 10); // jour
	m = parseInt(d.split("-")[1], 10); // mois
	a = parseInt(d.split("-")[2], 10); // anne

	// Si l'ann e n'est compose que de 2 chiffres on compl te automatiquement
	if (a < 1000) {
		if (a < 89)	a+=2000; // Si a < 89 alors on ajoute 2000 sinon on ajoute 1900
		else a+=1900;
	}

	// Dfinition du dernier jour de f vrier
	// Anne bissextile si annn e divisible par 4 et que ce n'est pas un sicle, ou bien si divisible par 400
	if (a%4 == 0 && a%100 !=0 || a%400 == 0) fev = 29;
	else fev = 28;

	// Nombre de jours pour chaque mois
	nbJours = new Array(31,fev,31,30,31,30,31,31,30,31,30,31);

	// Enfin, retourne vrai si le jour est bien entre 1 et le bon nombre de jours, idem pour les mois, sinon retourn faux
	return ( m >= 1 && m <=12 && j >= 1 && j <= nbJours[m-1] );
}

function visibilite(thingId){
	var targetElement;
	targetElement = document.getElementById(thingId) ;
	if (ancien!=""){
		document.getElementById(ancien).style.display = "none"
		document.getElementById(ancien).style.visibility = "hidden"
	}
	if (targetElement.style.display == "none"){
		targetElement.style.display = "" ;
		targetElement.style.visibility = "visible" ;
	} else {
		targetElement.style.display = "none" ;
		targetElement.style.visibility = "hidden" ;
	}
	ancien=thingId

}



/*
* Le code suivant va apprendre la balise blink   IE
*/
if ( document.all )
{
	function blink_show()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'visible';
		}
		
		window.setTimeout( 'blink_hide()', 700 );
	}
	
	function blink_hide()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'hidden';
		}
		
		window.setTimeout( 'blink_show()', 250 );
	}
	
	window.onload = blink_show;
}


function imprime_zone(titre, obj) {
	// Dfinie la zone   imprimer
	var zi = document.getElementById(obj).innerHTML;

	// Ouvre une nouvelle fenetre
	var f = window.open("", "ZoneImpr", "height=500, width=600,toolbar=0, menubar=0, scrollbars=1, resizable=1,status=0, location=0, left=10, top=10");
	
	// Ajoute les Donnes
	f.document.title = titre;

	f.document.body.innerHTML += " " + zi + "	";

	// Imprime et ferme la fenetre
	f.window.print();
	f.window.close();
	return true;
} 


//Function pour r cuperer la valeur d'un element radio d'un groupe
function radioCliked(form,champ) { 
var r = false; 
var d = document.getElementById(form); 

for(var i=0; i<d.length; i++) { 

   for(var k=0; k<d.length; k++) { 
     if(d[k].type=='radio' && d[k].name==champ) { 
       for(var j=0; j<d[champ].length; j++) 
       if(d[champ][j].checked) 
          r = d[champ][j].value; 
       } 
     } 


} 



	return r?r:0; 
} 

function obj(champs){
	return document.getElementById(champs)
	}
function remplacer(chaine1,chaine2,champs){
	var reg=new RegExp(chaine1, "g");
	return document.getElementById(champs).value.replace(reg,chaine2)
	}
	
	
function change_prix(container_id,nbr,champs,taux,base){
	var divs = document.getElementById(container_id).getElementsByTagName('span');
	vbase=document.getElementById(base).value
	document.getElementById(base).value=taux
	for (var i=0;i<divs.length;i++){
		if(divs[i].id.substr(0,nbr)==champs){			
			//alert(eval(divs[i].innerHTML*taux/base))
			//valeur=eval((eval(divs[i].innerHTML)*taux)/base)
			if (divs[i].innerHTML!='-' && divs[i].innerHTML!=''){
				divs[i].innerHTML = eval(divs[i].innerHTML*taux/vbase).toFixed(2);
			}
		}
	}
	return true;
 }	

function montrer(objet){
	document.getElementById(objet).style.visibility='visible';	
	document.getElementById(objet).style.display='block';
}

function adad(champs,libelle){
	if (isNaN(document.getElementById(champs).value) || eval(document.getElementById(champs).value==0)){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le champs "+libelle+" n'est pas une valuer numérique !"
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function adad_(champs,libelle){
	if (isNaN(document.getElementById(champs).value)){
		alert("Le champs "+libelle+" n'est pas une valuer numérique !")
		document.getElementById(champs).value=""
		document.getElementById(champs).focus()
		
		return false
	}else{
		//document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
	if (theAction=='over'){
		if (document.getElementById(theRow).className!=theMarkColor)
			document.getElementById(theRow).className=thePointerColor
	}
	if (theAction=='out'){
		if (document.getElementById(theRow).className!=theMarkColor)
			document.getElementById(theRow).className=theDefaultColor
	}
	if (theAction=='click'){
		if (document.getElementById(theRow).className!=theMarkColor){
			document.getElementById(theRow).className=theMarkColor
		}else{
			document.getElementById(theRow).className=thePointerColor			
		}
			
	}
	
	return true
} // end of the 'setPointer()' function


function longchaine(champs,libelle,longeur){	
	if (document.getElementById(champs).value.length<longeur){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le champs "+libelle+" doit avoir au moins "+longeur+" caractères"
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var actionSLK="http://shopping.maroctelecommerce.com/test/gateway/paiement.asp"
  function writediv12(nm,texte)
{
	document.getElementById(nm).innerHTML = texte;
}

function MisAjourProduit_ofligne(IDPrds,ModePay){	 
 
	data="&IDPrds="+IDPrds
	data+="&TypsPay=OL"
	data+="&Mode_PM="+ModePay		
	
	 
	http.open("POST","actions.php?actions=MisAjours_Panier&"+data, true); 
	http.onreadystatechange = recchaMisAjourProduitofligne;
	http.send(null); 
	document.getElementById('payer').style.visibility='hidden'
	 
	
}
function recchaMisAjourProduitofligne() {
writediv12('Messg','<center><font color=green>Attendez s\'il vous plait....</font></center> ')
	//alert(http.readyState);
	
	if (http.readyState == 4) {		
		results = http.responseText.split("::");		
 
		if(results[0]==1){
			  
			document.paymentForm.method='post';
			document.paymentForm.action='Paiment_Update_ofligne.php';
			document.paymentForm.submit();			
		}
		else if(results[0]==3){
			 writediv12('Messg','<center><font color=red>Les lignes selectionner ne sont pas disponible !!</font></center>')
			alert("Les lignes selectionner ne sont pas disponible !!")
		}
		else if(results[0]==2){
			  writediv12('Messg','<center><font color=red>Les lignes Commander sont  En cours de traitement!!</font></center>')
			alert("Les lignes Commander sont  En cours de traitement!!")
		}

		else {
			alert("Erreur de Donnee !!?")
			return false
		}	
		
	}
}



 



function MisAjourProduit(IDPrds,url){	 

	data="&IDPrds="+IDPrds	
	data+="&TypsPay=EL"		 	
	http.open("POST","actions.php?actions=MisAjours_Panier&"+data, true);
	http.onreadystatechange = recchaMisAjourProduit;
	http.send(null); 
	//
	//alert("Attendez s'il vous plait....")
	//paymentForm.paiement.disabled = true;
	document.getElementById('payer').style.visibility='hidden'
	
}

 
function recchaMisAjourProduit() {
writediv12('Messg','<center><font color=green>Attendez s\'il vous plait....</font></center> ')
	//alert(http.readyState);
	if (http.readyState == 4) {		
		results = http.responseText.split("::");		

		if(results[0]==1){
			 
			document.paymentForm.method='post';
			document.paymentForm.action=actionSLK;
			document.paymentForm.submit();			
		}
		else if(results[0]==3){
			 writediv12('Messg','<center><font color=red>Les lignes selectionner ne sont pas disponible !!</font></center>')
			alert("Les lignes selectionner ne sont pas disponible !!")
		}
		else if(results[0]==2){
			  writediv12('Messg','<center><font color=red>Les lignes Commander sont  En cours de traitement!!</font></center>')
			alert("Les lignes Commander sont  En cours de traitement!!")
		}

		else {
			alert("Erreur de Donnee !!?")
			return false
		}	
		
	}
}

 
function Mode_Paiment_BT(choix,Nclient){ 
//alert(formres.conditionGenr.checked)
	//domlength=formres.Mode_Paiment.length
	//alert(domlength)
	//alert(formres.conditionGenr.checked)
	 if(!(obj('conditionGenr').checked)){	 
	 alert("Vous devez accepter les conditions générales de vente !!")
	 return false
	 }
	/*for(i=0 ; i<domlength ; i++)
	{
		if(document.formres.Mode_Paiment[i].checked)
		{
			ModeP=document.formres.Mode_Paiment[i].value
			break;
		}
	}*/
	ModeP=obj('Mode_Paiment').value
	 
	obj('actions').value="modPaiem"
	obj('txtcodevoy').value=ModeP
	obj('txtcodeclient').value=Nclient
	obj('txtChoix').value=choix
	
	obj('formvoy').method="post"
	if(ModeP=='CB')
	obj('formvoy').action=$URL_P
	else obj('formvoy').action="Paiment_oflinge.php?choix="+choix
	obj('formvoy').submit()
	
}

function Mode_Paiment_BTN(choix,Nclient,N){ 

	 if(!(obj('conditionGenr').checked)){	 
	 alert("Vous devez accepter les conditions générales de vente !!")
	 return false
	 }
	 var date_jr=obj('txtajrd2').value
	 ModeP=obj('Mode_Paiment').value
	 
	
	 if(ModeP=='CB'){
	 for(i=1;i<=N;i++){
		if (!dateinf_recher('datetest'+i,"txtajrd2","La date d'arrivée doit etre majorée avec 3 jours.\n En tenant compte des weekend (samedi, dimanche) et des jours fériés.\n Veuillez choisir un autre mode de paiement",'txtajrd3')) return false 
		
	}	
		
	} 
	
	 
	obj('actions').value="modPaiem"
	obj('txtcodevoy').value=ModeP
	obj('txtcodeclient').value=Nclient
	obj('txtChoix').value=choix
	
	obj('formvoy').method="post"
	if(ModeP=='CB')
	obj('formvoy').action=$URL_P
	else obj('formvoy').action="Paiment_oflinge.php?choix="+choix
	obj('formvoy').submit()
	
}
function detail_Panier(codehot,type,VentFL){ 
	obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('formvoy').method="post"
	if(VentFL==1){
		if(type=='H')	obj('formvoy').action=""
		else if(type=='V')	obj('formvoy').action=""
		else obj('formvoy').action=""
	}
	else{
		if(type=='H')	obj('formvoy').action=""
		else if(type=='V')	obj('formvoy').action="Detail_Vol.php"
		else if(type=='S')	obj('formvoy').action="Detail_Sejours.php"
		else if(type=='O')	obj('formvoy').action="Detail_Omra.php"
		else obj('formvoy').action="Detail_Voyage.php"
	}
	obj('formvoy').submit()
}

function number_format(number, decimals, dec_point, thousands_sep) {
 
    var n = !isFinite(+number) ? 0 : +number, 
        prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
        sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
        dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
        s = '',
        toFixedFix = function (n, prec) {
            var k = Math.pow(10, prec);
            return '' + Math.round(n * k) / k;
        };
    // Fix for IE parseFloat(0.55).toFixed(0) = 0;
    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
    if (s[0].length > 3) {
        s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
    }
    if ((s[1] || '').length < prec) {
        s[1] = s[1] || '';
        s[1] += new Array(prec - s[1].length + 1).join('0');
    }
    return s.join(dec);
}
  
function Ajouter_panier_Hot(ID_HOT,TYPE){
sltadultes=formres.sltadultes.value;
sltenfants=formres.sltenfants.value;
sltbebes=formres.sltbebes.value;
depart=formres.depart.value;

NbPers=sltadultes-(-sltenfants)

txtnom1=formres.txtnom1.value;
txtprenom1=formres.txtprenom1.value;
txtage1=formres.txtage1.value;
if (!message('txtnom1','Nom ')) return false
if (!message('txtprenom1','Prénom ')) return false

data="&sltadultes="+sltadultes
data+="&sltenfants="+sltenfants
data+="&sltbebes="+sltbebes
data+="&IDPrix="+depart
data+="&txtnom1="+txtnom1
data+="&txtprenom1="+txtprenom1
data+="&txtage1="+txtage1
 

if(NbPers>=2){
txtnom2=formres.txtnom2.value;
txtprenom2=formres.txtprenom2.value;
txtage2=formres.txtage2.value;
if (!message('txtnom2','Nom ')) return false
if (!message('txtprenom2','Prénom ')) return false
data+="&txtnom2="+txtnom2
data+="&txtprenom2="+txtprenom2
data+="&txtage2="+txtage2
}
if(NbPers==3){
txtnom3=formres.txtnom3.value;
txtprenom3=formres.txtprenom3.value;
txtage3=formres.txtage3.value;
if (!message('txtnom3','Nom ')) return false
if (!message('txtprenom3','Prénom ')) return false
data+="&txtnom3="+txtnom3
data+="&txtprenom3="+txtprenom3
data+="&txtage3="+txtage3
}	

	data+="&ID_HOT="+ID_HOT
	data+="&TYPE="+TYPE 					
	http.open("POST","client_actions.php?actions=Ajouter_Panier&"+data, true);
	http.onreadystatechange = recchaAjPanier;
	http.send(null);
	document.getElementById('ajouterPan').style.visibility='hidden'
	//document.getElementById('ajouterPan2').style.visibility='visible'
	writediv12('id_validation','<center><font color=green>Attendez s\'il vous plait....</font></center> ')
}

function Ajouter_panier_Vol(ID_VOL){
//obj('id_validation').style.visibility='hidden'
	txtnom= new Array();
	txtprenom= new Array();
	txtDateN= new Array();
	txtNation= new Array();
	txtNCIN= new Array();
	
	sltadultes=obj('sltadultes').value;
	sltenfants=obj('sltenfants').value;
	sltbebes=obj('sltbebes').value; 			
	
	data="&sltadultes="+sltadultes
	data+="&sltenfants="+sltenfants
	data+="&sltbebes="+sltbebes	 	
	j=0;
	for(i=1;i<=eval(sltadultes);i++){
		txtnom[j]=obj('txtnom'+i).value;
		txtprenom[j]=obj('txtprenom'+i).value;					
		
		txtNation[j]=obj('txtNation'+i).value;	
		txtNCIN[j]=obj('txtNCIN'+i).value;
		txtDateN_day=obj('txtDateN_day'+i).value;
		txtDateN_month=obj('txtDateN_month'+i).value;
		txtDateN_year=obj('txtDateN_year'+i).value;
		
		if(txtDateN_month=='01' || txtDateN_month=='03' || txtDateN_month=='05' || txtDateN_month=='07' || txtDateN_month=='08' || txtDateN_month=='10' || txtDateN_month=='12' ){
		 if(txtDateN_day=='31'){
		 obj('txtDateN_day'+i).value='30'
		 txtDateN_day='30'
		
		}
		}
		if(txtDateN_month=='02'){
			 if(txtDateN_day=='31' || txtDateN_day=='30'){
				 obj('txtDateN_day'+i).value='29'
				 txtDateN_day='29'
				
			}
		}
		txtDateN[j]=txtDateN_day+"/"+txtDateN_month+"/"+txtDateN_year;
		if (!message('txtnom'+i,'Nom ')) return false
		if (!message('txtprenom'+i,'Prénom ')) return false
			if (!message('txtNation'+i,'Nationalité ')) return false
		
		if(txtDateN_day=='-1'){
		alert("Le Jour Date Naissance est obligatoire")
		obj('txtDateN_day'+i).focus();
			 return false
		}
	if(txtDateN_month=='-1'){
		alert("Le Mois Date Naissance est obligatoire")
		obj('txtDateN_month'+i).focus();
			 return false
		}
		

	if(txtDateN_year=='-1'){
		alert("L'Année Date Naissance est obligatoire")
		obj('txtDateN_year'+i).focus();
			 return false
		}
		
	//	if (!message('txtDateN'+i,'Date Naissance ')) return false
	
		if (!message('txtNCIN'+i,'N CIN / Passport ')) return false
		
		data+="&txtnom="+txtnom
		data+="&txtprenom="+txtprenom
		data+="&txtDateN="+txtDateN
		data+="&txtNation="+txtNation
		data+="&txtNCIN="+txtNCIN
		j++;
	}
 
	for(i=10;i<=eval(eval(sltenfants)+9);i++){
		txtnom[j]=obj('txtnom'+i).value;
		txtprenom[j]=obj('txtprenom'+i).value;
		
	 
		txtNation[j]=obj('txtNation'+i).value;	
		txtNCIN[j]=obj('txtNCIN'+i).value;
		txtDateN_day=obj('txtDateN_day'+i).value;
		txtDateN_month=obj('txtDateN_month'+i).value;
		txtDateN_year=obj('txtDateN_year'+i).value;
		
		if(txtDateN_month=='01' || txtDateN_month=='03' || txtDateN_month=='05' || txtDateN_month=='07' || txtDateN_month=='08' || txtDateN_month=='10' || txtDateN_month=='12' ){
		 if(txtDateN_day=='31'){
		 obj('txtDateN_day'+i).value='30'
		 txtDateN_day='30'
		
		}
		}
		if(txtDateN_month=='02'){
			 if(txtDateN_day=='31' || txtDateN_day=='30'){
				 obj('txtDateN_day'+i).value='29'
				 txtDateN_day='29'
				
			}
		}
		
		txtDateN[j]=txtDateN_day+"/"+txtDateN_month+"/"+txtDateN_year;
		if (!message('txtnom'+i,'Nom ')) return false
		if (!message('txtprenom'+i,'Prénom ')) return false
		if (!message('txtNation'+i,'Nationalité ')) return false
		if(txtDateN_day=='-1'){
		alert("Le Jour Date Naissance est obligatoire")
		obj('txtDateN_day'+i).focus();
			 return false
		}
	if(txtDateN_month=='-1'){
		alert("Le Mois Date Naissance est obligatoire")
		obj('txtDateN_month'+i).focus();
			 return false
		}
		

	if(txtDateN_year=='-1'){
		alert("L'Année Date Naissance est obligatoire")
		obj('txtDateN_year'+i).focus();
			 return false
		}
		
	//	if (!message('txtDateN'+i,'Date Naissance ')) return false
		
		if (!message('txtNCIN'+i,'N CIN / Passport ')) return false
		
		data+="&txtnom="+txtnom
		data+="&txtprenom="+txtprenom
		data+="&txtDateN="+txtDateN
		data+="&txtNation="+txtNation
		data+="&txtNCIN="+txtNCIN
		j++;
	}
		 
	for(i=19;i<=eval(eval(sltbebes)+18);i++){
		txtnom[j]=obj('txtnom'+i).value;
		txtprenom[j]=obj('txtprenom'+i).value;
		
		txtNation[j]=obj('txtNation'+i).value;	
		txtNCIN[j]=obj('txtNCIN'+i).value;
		txtDateN_day=obj('txtDateN_day'+i).value;
		txtDateN_month=obj('txtDateN_month'+i).value;
		txtDateN_year=obj('txtDateN_year'+i).value;
		
		if(txtDateN_month=='01' || txtDateN_month=='03' || txtDateN_month=='05' || txtDateN_month=='07' || txtDateN_month=='08' || txtDateN_month=='10' || txtDateN_month=='12' ){
		 if(txtDateN_day=='31'){
		 obj('txtDateN_day'+i).value='30'
		 txtDateN_day='30'
		
		}
		}
		if(txtDateN_month=='02'){
			 if(txtDateN_day=='31' || txtDateN_day=='30'){
				 obj('txtDateN_day'+i).value='29'
				 txtDateN_day='29'
				
			}
		}
		txtDateN[j]=txtDateN_day+"/"+txtDateN_month+"/"+txtDateN_year;
		if (!message('txtnom'+i,'Nom ')) return false
		if (!message('txtprenom'+i,'Prénom ')) return false
		if (!message('txtNation'+i,'Nationalité ')) return false
		if(txtDateN_day=='-1'){
		alert("Le Jour Date Naissance est obligatoire")
		obj('txtDateN_day'+i).focus();
			 return false
		}
	if(txtDateN_month=='-1'){
		alert("Le Mois Date Naissance est obligatoire")
		obj('txtDateN_month'+i).focus();
			 return false
		}
		

	if(txtDateN_year=='-1'){
		alert("L'Année Date Naissance est obligatoire")
		obj('txtDateN_year'+i).focus();
			 return false
		}
		
	//	if (!message('txtDateN'+i,'Date Naissance ')) return false
		
		if (!message('txtNCIN'+i,'N CIN / Passport ')) return false
		
		data+="&txtnom="+txtnom
		data+="&txtprenom="+txtprenom
		data+="&txtDateN="+txtDateN
		data+="&txtNation="+txtNation
		data+="&txtNCIN="+txtNCIN
		j++;	
	}		
		data+="&ID_VOL="+ID_VOL		 					
		http.open("POST","client_actions.php?actions=Ajouter_VPanier&"+data, true);
		http.onreadystatechange = recchaAjPanier;
		http.send(null);
		document.getElementById('ajouterPan').style.visibility='hidden'
		//document.getElementById('ajouterPan2').style.visibility='visible'
		writediv12('id_validation','<center><font color=green>Attendez s\'il vous plait....</font></center> ')
}

function Ajouter_chambre_Hot(ID_HOT,TYPE){
sltadultes=formres.sltadultes.value;
sltenfants=formres.sltenfants.value;
sltbebes=formres.sltbebes.value;
depart=formres.depart.value;

NbPers=sltadultes-(-sltenfants)

txtnom1=formres.txtnom1.value;
txtprenom1=formres.txtprenom1.value;
txtage1=formres.txtage1.value;
if (!message('txtnom1','Nom ')) return false
if (!message('txtprenom1','Prénom ')) return false

data="&sltadultes="+sltadultes
data+="&sltenfants="+sltenfants
data+="&sltbebes="+sltbebes
data+="&IDPrix="+depart
data+="&txtnom1="+txtnom1
data+="&txtprenom1="+txtprenom1
data+="&txtage1="+txtage1
 

if(NbPers>=2){
txtnom2=formres.txtnom2.value;
txtprenom2=formres.txtprenom2.value;
txtage2=formres.txtage2.value;
if (!message('txtnom2','Nom ')) return false
if (!message('txtprenom2','Prénom ')) return false
data+="&txtnom2="+txtnom2
data+="&txtprenom2="+txtprenom2
data+="&txtage2="+txtage2
}
if(NbPers==3){
txtnom3=formres.txtnom3.value;
txtprenom3=formres.txtprenom3.value;
txtage3=formres.txtage3.value;
if (!message('txtnom3','Nom ')) return false
if (!message('txtprenom3','Prénom ')) return false
data+="&txtnom3="+txtnom3
data+="&txtprenom3="+txtprenom3
data+="&txtage3="+txtage3
}	

	data+="&ID_HOT="+ID_HOT
	data+="&TYPE="+TYPE 					
	http.open("POST","client_actions.php?actions=Ajouter_Panier_Session&"+data, true);
	http.onreadystatechange = recchaAjChambre;
	http.send(null);
	document.getElementById('ajouterPan').style.visibility='hidden'
	//document.getElementById('ajouterPan2').style.visibility='visible'
	writediv12('id_validation','<center><font color=green>Attendez s\'il vous plait....</font></center> ')
	
}

function recchaAjChambre() {
	//alert(http.readyState);
	if (http.readyState == 4) {		
		results = http.responseText.split("::");		
		//alert(results)
		if(results[0]==1){
			alert("C'est réservation existe déja dans votre panier !!")
			/*obj('actions').value="commander_Deja"			 
			obj('formvoy').method="post"
			obj('formvoy').action='./home.php?mod=Message_Panier'
			obj('formvoy').submit()*/
			//javascript:document.location='./home.php?mod=Moncompt&smod=Pan'
//			return false
		}
		else if(results[0]==2){
			//alert("Ajoute avec succès au panier ")
			//obj('actions').value="commander_Ajouter"			 
			//obj('formvoy').method="post"
			obj('formres').reset();				 
			document.getElementById('ajouterPan').style.visibility='visible'
			writediv12('id_validation','<center><font color=green>Votre produit a bien été ajouté à votre panier.</font></center> ')
			ChangerAdulte(1,0);
			alert("Votre produit a bien été ajouté à votre panier.");
			//obj('formvoy').action='./home.php?mod=Message_Panier'
			//obj('formvoy').submit()
			
//			javascript:document.location='./home.php?mod=Moncompt&smod=Pan'
		}
		else if(results[0]==3){
			//alert("Vous devez être connecter !!")
			//javascript:document.location='./connexion.php'
			obj('actions').value="Connection"			 
			obj('formvoy').method="post"
			obj('formvoy').action='./home.php?mod=Message_Panier&smod=Ajouter'
			obj('formvoy').submit()
			
		}
		else if(results[0]==4){
			//alert("Vous devez être connecter !!")
			//javascript:document.location='./connexion.php'
			obj('actions').value="Connection"						 
			obj('formvoy').method="post"
			obj('formvoy').action='./home.php?mod=Message_Panier&smod=AjouterVol'
			obj('formvoy').submit()
			
		}
		else {
			//alert("Erreur de Donnee !!?")
			return false
		}	
		
	}
}
function SETValuePOP( href,codehot){

	obj('actions').value="affhot"
	obj('txtcodehot').value=codehot
	obj('formvoy').method="post"
	obj('formvoy').action=href
	obj('formvoy').submit()
}

function fichevoyage(codevoy){
	obj('actions').value="affvoy"
	obj('txtcodevoy').value=codevoy
	obj('formvoy').method="post"
	obj('formvoy').action="fiche_voyage.php"
	obj('formvoy').submit()
}
function fichehotel(codehot){
	obj('actions').value="affhot"
	obj('txtcodehot').value=codehot
	obj('formvoy').method="post"
	obj('formvoy').action="fiche_hotel.php"
	obj('formvoy').submit()
}
function fichesejour(codesej){
	obj('actions').value="affsej"
	obj('txtcodesej').value=codesej
	obj('formvoy').method="post"
	obj('formvoy').action="fiche_sejour.php"
	obj('formvoy').submit()
}
function res_vol(codevol){
	obj('actions').value="resvol"
	obj('txtcodevol').value=codevol
	obj('formvoy').method="post"
	obj('formvoy').action="f_vols.php"
	obj('formvoy').submit()
}
function det_hotel(code){
	 
}
function coupe_de_coeur_hotel(){
	 
}
 
function reservation_hotel(codehot,Codeprix,prix){
 
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	 obj('formvoy').method="post"
	obj('formvoy').action="res_hotel.php"
	obj('formvoy').submit()
}
function Inscrire(){
	 
}

function plus_info_hotel(codehot,Prixhot){
	
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="f_hotel.php"
	obj('formvoy').submit()
	 
}
function plus_info(codehot,Prixhot,type){
 
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	 
	if(type=='hotels')
	obj('formvoy').action="f_hotel.php"
	if(type=='sejours')	
	obj('formvoy').action="f_sejour.php"
	if(type=='voyage')
	obj('formvoy').action="f_voyage.php"
	 if(type=='croisiere')
	obj('formvoy').action="f_croisiere.php"
	 if(type=='omra')
	obj('formvoy').action="f_omra.php"
	
	obj('formvoy').submit()
	 
}
function reservation_rech(codehot,Codeprix,prix,type){
 
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix 
	 obj('formvoy').method="post"
	 if(type=='hotels')
	obj('formvoy').action="./home.php?mod=Hotels&smod=res_hot"
	if(type=='sejours')	
	obj('formvoy').action="./home.php?mod=Sejours&smod=res_sej"
	if(type=='week-end')
	obj('formvoy').action="./home.php?mod=weekend&smod=res_sej"
	if(type=='bien-etre')	
	obj('formvoy').action="./home.php?mod=Bien_etre&smod=res_sej"
	if(type=='aventure')	
	obj('formvoy').action="./home.php?mod=aventure&smod=res_sej"
	
	
	obj('formvoy').submit()
}
function coupe_de_coeur_sejours(){
	 
}
function reservation_sejours(codehot,Codeprix,prix){
 //alert(codehot)
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	 obj('formvoy').method="post"
	obj('formvoy').action="res_sejour.php"
	obj('formvoy').submit()
}
function reservation_omra(codehot,Codeprix,prix){
 //alert(codehot)
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	 obj('formvoy').method="post"
	obj('formvoy').action="res_omra.php"
	obj('formvoy').submit()
}
function reservation_voyage(codehot,Codeprix,prix){
 //alert(codehot)
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	 obj('formvoy').method="post"
	obj('formvoy').action="res_voyage.php"
	obj('formvoy').submit()
}
function Inscrire_voyage(codehot,Codeprix,prix){
 //alert(codehot)
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	 obj('formvoy').method="post"
	obj('formvoy').action="inscrire_voyage.php"
	obj('formvoy').submit()
}
function reservation_croisiere(codehot,Codeprix,prix){
 //alert(codehot)
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	 obj('formvoy').method="post"
	obj('formvoy').action="res_croisiere.php"
	obj('formvoy').submit()
}
function plus_info_sejours(codehot,Prixhot){
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="f_sejour.php"
	obj('formvoy').submit()
	 
}
function plus_info_omra(codehot,Prixhot){
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="f_omra.php"
	obj('formvoy').submit()
	 
}
function coupe_de_coeur_weekend(){
	 
}
function reservation_weekend(codehot,Codeprix,prix){
 
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	obj('formvoy').method="post"
	obj('formvoy').action="./home.php?mod=weekend&smod=res_sej"
	obj('formvoy').submit()
}
function plus_info_weekend(codehot,Prixhot){
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="./home.php?mod=weekend&smod=week_det"
	obj('formvoy').submit()
	 
}
//
function coupe_de_coeur_maroc(){
	 
}
function reservation_maroc(codehot,Codeprix,prix,type){

	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
	obj('formvoy').method="post"
	if(type=='hotels')
	obj('formvoy').action="./home.php?mod=maroc&smod=res_Hmaroc"
	else obj('formvoy').action="./home.php?mod=maroc&smod=res_maroc"
	obj('formvoy').submit()
}
function Retour(url,codehot,Prixhot){
 
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action=url
	obj('formvoy').submit()
}
function Retour_(type,codehot,Prixhot){
 
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	if(type=='hotels')
	obj('formvoy').action="f_hotel.php"
	if(type=='sejours')	
	obj('formvoy').action="f_sejour.php"
	if(type=='voyage')
	obj('formvoy').action="f_voyage.php"
	 if(type=='croisiere')
	obj('formvoy').action="f_croisiere.php"
	if(type=='omra')
	obj('formvoy').action="f_omra.php"
	
	obj('formvoy').submit()
}
function plus_info_maroc(codehot,Prixhot){
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="./home.php?mod=maroc&smod=maroc_det"
	obj('formvoy').submit()
	 
}
//
function coupe_de_coeur_bienetre(){
	 
}
function reservation_bienetre(codehot,Codeprix,prix){
 
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	obj('formvoy').method="post"
	obj('formvoy').action="./home.php?mod=Bien_etre&smod=res_sej"
	obj('formvoy').submit()
}
function plus_info_bienetre(codehot,Prixhot){
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="./home.php?mod=Bien_etre&smod=bienetre_det"
	obj('formvoy').submit()
	 
}
//
function coupe_de_coeur_aventure(){
	 
}
function reservation_aventure(codehot,Codeprix,prix){
 
	 obj('actions').value="ressej"
	obj('txtcodehot').value=codehot
	obj('Codeprix').value=Codeprix
	obj('txtPrxhot').value=prix
 
	obj('formvoy').method="post"
	obj('formvoy').action="./home.php?mod=aventure&smod=res_sej"
	obj('formvoy').submit()
}
function plus_info_voyage(codehot,Prixhot){
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="f_voyage.php"
	obj('formvoy').submit()
	 
}
function plus_info_croisiere(codehot,Prixhot){
	obj('actions').value="dethotel"
	obj('txtcodehot').value=codehot
	obj('txtPrxhot').value=Prixhot
	obj('formvoy').method="post"
	obj('formvoy').action="f_croisiere.php"
	obj('formvoy').submit()
	 
}
//


function res_hotel(code){
	obj('actions').value="demres"
	obj('txtcodehot').value=code
	obj('formvoy').method="post"
	obj('formvoy').action="res_hotel.php"
	obj('formvoy').target="_self"
	obj('formvoy').submit()
}
function res_voyage(code){
	obj('actions').value="demres"
	obj('txtcodevoy').value=code
	obj('formvoy').method="post"
	obj('formvoy').action="res_voyage.php"
	obj('formvoy').target="_self"
	obj('formvoy').submit()
}
function res_sejour(codesej){
	obj('actions').value="demres"
	obj('txtcodesej').value=codesej
	obj('formvoy').method="post"
	obj('formvoy').action="res_sejour.php"
	obj('formvoy').target="_self"
	obj('formvoy').submit()
}

function choix_Recharger(){	 		 
		obj('form1').method="post"
		obj('form1').action="f_hotel.php"
		obj('form1').submit()
	}
function ReservationH(total){
 if(total<=0){
 	alert('Chambre Non disponible, Veuillez choisir une autre date.')
	return false
 }
		obj('form1').method="post"
		obj('form1').action="fiche_reservation_hot_mar.php"
		obj('form1').submit()
}
function Ajouter_Panier(ID_PROD,TYPE,d_D,d_R){
	
	txtnom= new Array();
	txtprenom= new Array();
	txtage= new Array();
	TypeVoyages= new Array();
	Civilite= new Array();
	Chambre= new Array();
	//Nom_h=""
	//alert(ID_PROD+','+TYPE+','+d_D+','+d_R)
	var IDPrix=obj('DEPART_ID').value
	var PrixT=0;
	var Frais_id=0;
	var PrixTotal=0;
	Nbrchambre=obj('Nbrchambre').value;
	PrixT=obj('PrixTotal2_id').innerHTML;
	Frais_id=obj('Frais_id').innerHTML;
	PrixTotal=obj('Total_id').innerHTML;
	
	/**/
	var data="";
	 
	data+="&ID_PROD="+ID_PROD
	data+="&TYPE="+TYPE
	data+="&IDPrix="+IDPrix
	//data+="&Nom_h="+Nom_h
	data+="&d_D="+d_D
	data+="&d_R="+d_R
	data+="&Nbrchambre="+Nbrchambre
	data+="&PrixT="+PrixT
	data+="&Frais_id="+Frais_id
	data+="&PrixTotal="+PrixTotal	
	
	var sltadultes=0;
	var sltenfants=0;
	var sltbebes=0;
	
	var Adulte=0;
	var Enfant=0;
	var Bebe=0;
	
	var NbPers=0;
	
	j=0;
	for(i=1;i<=eval(Nbrchambre);i++){
		Adulte=obj('Adulte'+i).value;
		Enfant=obj('Enfant'+i).value;
		Bebe=obj('Bebe'+i).value; 
		NbPers=0;
		sltadultes=eval(Adulte)-(-eval(sltadultes));
		sltenfants=eval(Enfant)-(-eval(sltenfants));
		sltbebes=eval(Bebe)-(-eval(sltbebes));
		
		NbPers=eval(Adulte)-(-eval(Enfant));
		
		 for(k=1;k<=eval(NbPers);k++){
			Chambre[j]=i;
			TypeVoyages[j]=obj('TypeVoyages'+i+k).innerHTML;
			Civilite[j]=obj('Civilite'+i+k).value;
			txtnom[j]=obj('Nom'+i+k).value;
			txtprenom[j]=obj('Prenom'+i+k).value;					
			txtage[j]=obj('Age'+i+k).value;
			
			
		 if (!message('Nom'+i+k,'Nom ')) return false
			if (!message('Prenom'+i+k,'Prénom ')) return false
			if (!message('Age'+i+k,'Age ')) return false
	 		 
			 data+="&Chambre="+Chambre
			data+="&TypeVoyages="+TypeVoyages
			data+="&Civilite="+Civilite
			data+="&txtnom="+txtnom
			data+="&txtprenom="+txtprenom
			data+="&txtage="+txtage
			 
			
			j++;
		}
	}
 
		data+="&sltadultes="+sltadultes
		data+="&sltenfants="+sltenfants
		data+="&sltbebes="+sltbebes	 	
		/*alert("actions.php?actions=Ajouter_Panier&"+data);
		return false*/
		http.open("POST","actions.php?actions=Ajouter_Panier&"+data, true);
		http.onreadystatechange = recchaAjPanier;
		http.send(null);
		document.getElementById('ajouterPan').style.visibility='hidden'
		//document.getElementById('ajouterPan2').style.visibility='visible'
		writediv12('id_validation','<center><font color=green>Attendez s\'il vous plait....</font></center> ')
}

function recchaAjPanier() {
//alert(http.responseText)
	if (http.readyState == 4) {
		results = http.responseText.split("::");
	//alert(results)
		if (results[0]==2){		
			obj('actions1').value="commander_Ajouter"			 
			obj('formvoy2').method="post"
			obj('formvoy2').action='Ajoute_Panier.php'
			obj('formvoy2').submit()								 			
		}else if(results[0]==3){		
		  
			obj('actions1').value="ConnectionV"	
			 	 
			obj('formvoy2').method="post"
			obj('formvoy2').action='Ajoute_Panier.php'
			obj('formvoy2').submit()
			
		}else{
			document.getElementById('id_validation').style.visibility='hidden'
			document.getElementById('id_validation').innerHTML="Vos informations ne sont pas envoyees avec succes..."
			document.getElementById('txtnom').focus()
		}
		
	}
	
}  		
