/********************************************************/
/* Affichage de la date du jour
/* © Signo - C. Thibault
/********************************************************/
function affiche_date(){
	now = new Date();
	jour = now.getDate();
	mois = now.getMonth() + 1;
	annee = now.getFullYear();
	lettres = ('' + now.toGMTString() + '');
	
	//On recherche le jour de la semaine
	joursemaine = lettres.substring(0,3);
	if(joursemaine=='Mon'){js='Lundi';}
	if(joursemaine=='Tue'){js='Mardi';}
	if(joursemaine=='Wed'){js='Mercredi';}
	if(joursemaine=='Thu'){js='Jeudi';}
	if(joursemaine=='Fri'){js='Vendredi';}
	if(joursemaine=='Sat'){js='Samedi';}
	if(joursemaine=='Sun'){js='Dimanche';}
	
	//On recherche le mois
	if(mois=='1'){mois2='Janvier';}
	if(mois=='2'){mois2='Février';}
	if(mois=='3'){mois2='Mars';}
	if(mois=='4'){mois2='Avril';}
	if(mois=='5'){mois2='Mai';}
	if(mois=='6'){mois2='Juin';}
	if(mois=='7'){mois2='Juillet';}
	if(mois=='8'){mois2='Aout';}
	if(mois=='9'){mois2='Septembre';}
	if(mois=='10'){mois2='Octobre';}
	if(mois=='11'){mois2='Novembre';}
	if(mois=='12'){mois2='Décembre';}
	
	document.write(js +' '+ jour +' '+ mois2 +' '+annee);
}





/********************************************************/
/* Module AJAX - version 2.00 - 02/04/2007              */
/* © Signo - C. Thibault                                */
/********************************************************/
function getHTTPObject(){
	var xmlhttp;

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

var http = getHTTPObject();

function affiche_xmlhttprequest(url){
	http.open("GET", url, true);
	http.onreadystatechange = handleHttpResponse;
	http.send(null);
}

function handleHttpResponse() {
	if (http.readyState == 4) // 4 -> resultat arrive...
	{
		info = http.responseText.split("|");
		//alert (info[0]);
		document.getElementById(info[0]).innerHTML = info[1];
	}
}

function maj_caddie(id,nom,v1,v2,v3,v4,v5,v6,qte,dest){
	if (id == "perso")
	{
		id += Math.floor(Math.random() * 65534)+1;
	}
	
	var url = "caddie.php?id="+id+"&nom="+nom+"&v1="+v1+"&v2="+v2+"&v3="+v3+"&v4="+v4+"&v5="+v5+"&v6="+v6+"&qte="+qte+"&dest="+dest;
	//alert (url);
	affiche_xmlhttprequest(url);
}

function nb_art()
{
	affiche_xmlhttprequest("nb_art.php");
}

function maj_art(id,qte,chp)
{
	
	var new_qte = document.getElementById(chp).value;
	var url = "maj_caddie.php?id="+id+"&qte="+qte;
	//alert (url);
	affiche_xmlhttprequest(url);
}


function checkForm(monForm) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(monForm.mail.value))
	{
		if (monForm.nom.value && monForm.prenom.value && monForm.adr1.value && monForm.cp.value && monForm.ville.value && monForm.pays.value!='---')
			return (true);
		else
		{
			alert ("Les Champs avec (*) sont obligatoires...");
			return (false);
		}
	}
	else
	{
		alert ("E-Mail non valide...");
		return (false);
	}
}

/////////////////////////////////////////////////////////////////////////////////////////
// Gestion des rollovers pour le menu
/////////////////////////////////////////////////////////////////////////////////////////

function roll(img, etat)
{
	if (etat)
	{
		monImg = eval(img + "_on");
		monImg = document.getElementById(img).src = monImg.src;
	}
	else
	{
		monImg = eval(img + "_off");
		monImg = document.getElementById(img).src = monImg.src;	
	}
}

/********************************************************/
/* Gestion de l'affichage des popup			            */
/* © Signo - C. Thibault                                */
/********************************************************/
function popup(page,xx,yy) 
{
	var haut=(screen.height-xx)/2;
	var gauche=(screen.width-yy)/2;
    window.open(page, 'ag', 'top='+haut+', left='+gauche+', resizable=no, location=no, width='+xx+', height='+yy+', menubar=no, status=no, scrollbars=no, menubar=no');
}


/////////////////////////////////////////////////////////////////////////////////////////
// Gestion des effets d'opacités
/////////////////////////////////////////////////////////////////////////////////////////
var timer = 0;
var iOpacity = 0;

function NoFade()
{
	var elem = document.getElementById("conteneur");

	iOpacity += 1;
	elem.style.opacity = iOpacity;
	elem.style.MozOpacity = iOpacity;
	elem.style.KhtmlOpacity = iOpacity;
	elem.style.filter = "alpha(opacity=" + iOpacity * 100 + ")";
	if (iOpacity >= 1)
		CancelFade();
}

function FadeI()
{
	iOpacity = 0;
	timer = setInterval("FadeIn()", 30);
}

function CancelFade() 
{
	if (timer == 0) 
		return;
	clearInterval(timer);
	timer = 0;
}

function FadeIn() 
{
	var elem = document.getElementById("conteneur");

	iOpacity += 0.05;
	elem.style.opacity = iOpacity;
	elem.style.MozOpacity = iOpacity;
	elem.style.KhtmlOpacity = iOpacity;
	elem.style.filter = "alpha(opacity=" + iOpacity * 100 + ")";
	if (iOpacity >= 1)
		CancelFade();
}