function addmailing(email, lang){
	if(validMail(email.value)){
		killAjax();
		ret = function() {
			if(ajaxOk()){
				document.getElementById('liste').innerHTML = objAjax.responseText;
			}
		}
		callAjax('/script/ajax.php?what=mailing&courriel='+email.value+'&lang='+lang,ret,null);
	}
	else{
		email.focus();
		email.select();
		alert('Veuillez entrer une adresse de courriel valide.');
	}
}

function addcomment(lang, post){
	if(validForm(post)){
		killAjax();
		ret = function(){
			if(ajaxOk()){
				document.getElementById('comment_form').innerHTML = objAjax.responseText;
			}
		}
		callAjax('/script/ajax.php?what=comment&lang='+lang,ret,null,post);
	}
}

// Dropdown menu ...
var currMenu = null;
function mainmenu(sender,classe){
	sender = document.getElementById(sender);
	if(sender){
		sender = (sender.tagName=="UL") ? sender : sender.childNodes[0];
		sender = (sender && sender.tagName=="UL") ? sender : sender.nextSibling;
		if(sender){
			if(sender.tagName=="UL"){
				if(classe!=""){
					var uls = sender.getElementsByTagName("UL");
					for(i=0;i<uls.length;i++){
						if(uls[i].className==classe) currMenu = uls[i].parentNode;
					}
					if(currMenu) currMenu.className+=" shover";
				}
				var lis = sender.getElementsByTagName("LI");
				for(i=0;i<lis.length;i++){
					if(lis[i].className!="vide"){
						lis[i].onmouseover=function() {
							if(currMenu) currMenu.className=currMenu.className.replace("shover", "");
							this.className+=" shover";
							//if(document.all) this.style.zIndex=100;
						}
						lis[i].onmouseout=function() {
							this.className=this.className.replace("shover", "");
							if(currMenu) if(currMenu.className.indexOf("shover")==-1) currMenu.className+=" shover";
							//if(document.all) this.style.zIndex=1;
						}
					}
				}
			}else{
				alert("Le sender n\'est pas un UL");
			}
		}
	}
}

var aImgs = null;
var aLink = null;
var aImg = null;
var theInt = null;
var curclicked = 0;
var speed = 1000;

function scrollNews(s){
	if($("#produits ul.liste")){
		speed = s;
		$("#produits ul.liste a").bind('mouseover',function(){
			curclicked = $("#produits ul.liste a").index(this);
			changePic();
		});
		changePic();
	}
}
function changePic(){
	$("#produits ul.liste a").removeClass("selected");
	$("#produits ul.liste a").eq(curclicked).addClass("selected");
	$("#produit .produit").css("display","none");
	$("#produit .produit").eq(curclicked).css("display","");
	runInt(speed);
}
function runInt(s){
	clearInterval(theInt);
	theInt = setInterval(function(){
		curclicked++;
		if(curclicked>=$("#produits ul.liste a").length) curclicked = 0;
		changePic();
	}, s);
}
