function verifNewsletter(f){
	if (!isEmail(f.email.value)){
		alert("Vous devez saisir une adresse email valide !");
		f.email.focus();
		return false;
	}
	if (!f.data[0].checked && !f.data[1].checked && !f.data[2].checked && !f.data[3].checked){
		alert("Vous devez choisir votre spécialité !");
		return false;
	}
	return true;
}

function chemin_fer_rub(elt){
	var rubName=escape(elt.innerHTML);
	self.location.href="index.php?rubname="+rubName;
}

function envoiAmi(article_id){
	popup("envoi_ami.php?article_id="+article_id,400,350,0);
}

function popup(loc,larg,haut,scro){
	nouvelle_fenetre = window.open(loc,"","menubar=0,resizable=1,scrollbars="+scro+",width="+larg+",height="+haut+",top=100,left=100");
	if (parseInt(navigator.appVersion) > 2) { nouvelle_fenetre.focus();}	
}

function roll(img){
	if (img.src.indexOf("R.gif")<0 && self.location.href.indexOf("testRoll")>0){
		img.src = img.src.replace(".gif","R.gif");
	}
}

function rollO(img){
	if (img.src.indexOf("R.gif")>0){
		img.src = img.src.replace("R.gif",".gif");
	}
}

/*
function isEmail(value){
  var re=/^[a-z0-9_-](\.?[a-z0-9_-])*[@]([a-z0-9_-]+\.)+([a-z]{2,3})$/i;
  return re.test(value)?true:false;
}

function only_space(chaine) {
  if (chaine=="") {return true;}
  if (chaine==" ") {return true;}
  for (var i=0 ; i<chaine.length ; i++) {
    if (chaine.charAt(i)!=" ") {
      return false;
    }
  }
  return true;
}
*/

function viewArticle(id,rub_id,num){
	self.location.href="index.php?display=article&rubId="+rub_id+"&num="+num+"&articleId="+id;
}



function showFondSurimpression(){
	w="800";
	h="600";
	
	try{
		if (document.documentElement && (document.documentElement.clientWidth||document.documentElement.clientHeight)){
			// IE 6+
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}else if ( typeof( window.innerWidth ) == 'number' ){
			// Non IE
			w = window.innerWidth;
			h = window.innerHeight;
		}else if(document.body && (document.body.clientWidth||document.body.clientHeight )){
			// Old IE
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}		
	}catch(e){}	
	var fd = document.getElementById("surimpression");
	_show("surimpression");
	fd.style.width=w;
	fd.style.height=h;	
}



function stopDew(){
	/* stop dewplayer : */
	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; 
	var dews = document.getElementsByTagName("object");
	for(i=0;i<dews.length;i++){
		if (dews[i].className=="dewplayer") {
			tmp = InternetExplorer ? eval("window."+dews[i].id) : eval("window.document."+dews[i].id);
			try{
				tmp.GotoFrame(4);
			}catch(e){
				//alert(e);	
			}
		}
		
		if (dews[i].id.substr(0,9)=="swfVideo_") {
			tmp = InternetExplorer ? eval("window."+dews[i].id) : eval("window.document."+dews[i].id);
			try{
				tmp.SetVariable("setPause","oui");
			}catch(e){
				//alert(e);	
			}		
		}
		
	}
	
	
	
	/*
	var dews = document.getElementsByTagName("embed");
	for(i=0;i<dews.length;i++){
		if (dews[i].className=="dewplayer") {
			try{
				dews[i].stop();
			}catch(e){}
		}
	}
	*/
}


var currIpg="";
function hideAllIpg(){
	var divs = document.getElementsByTagName("div");
	for(i=0;i<divs.length;i++){
		if (divs[i].id.substring(0,4)=="ipg_") {
			_hide(divs[i].id);
		}
	}
	
}


function showIpg(id){
	hideAllIpg();
	showFondSurimpression();
	_show(id);
	self.location.href="#top";
	currIpg = id;
	activateActiveX();
}


function hideIpg(id){
	stopDew();
	_hide('surimpression');
	_hide(id);	
}




function kp_init(){
    if (document.addEventListener){
       document.addEventListener("keypress",keypress,false);
    }else if (document.attachEvent){
       document.attachEvent("onkeypress", keypress);
    }else{
       document.onkeypress= keypress;
    }
}

function keypress(e){
	if (!e) e= event;
	if (e.keyCode==27){
		if (swf_!=null){
			LaunchFullScreen(swf_)	
		}
	}
}




/*
function _show(calque){
	try{
		document.getElementById(calque).style.visibility="visible";
		document.getElementById(calque).style.display="block";
	}catch(e){}
}
function _hide(calque){
	try{
		document.getElementById(calque).style.visibility="hidden";
		document.getElementById(calque).style.display="none";
	}catch(e){}
}

function showHide(calque){
	if (document.getElementById(calque).style.visibility=="hidden" || document.getElementById(calque).style.display=="none"){
		_show(calque);
	}else{
		_hide(calque);
	}
}

function ajaxGet(url,cible){
	https[https_i]=getHTTPObject();
	document.getElementById(cible).innerHTML = "<DIV style='width: 100%; height: 100%; text-align: center; vertical-align: middle;'><br /><img src='img/chargement.gif' border=0 alt='Chargement en cours...' /><br /><br /></DIV>";
//	document.getElementById(cible).innerHTML="<DIV style='width: 100%; height: 100%; text-align: center; vertical-align: middle;'><br /><img src='img/chargement.gif' border=0 alt='Chargement en cours...' /><br /><br /></DIV>";
	gr_cible[https_i]=cible;
	getUrl(url,"ajaxWrite("+https_i+")",https_i);
	https_i++;
}

function ajaxWrite(i){
	if (https[i].readyState == 4) {
		try{
			document.getElementById(gr_cible[i]).innerHTML = https[i].responseText;
		}catch(e){}
		gr_cible[i]="";
	}
}


function ajaxAndFunc(url,func){
	https[https_i]=getHTTPObject();
	gr_cible[https_i]=null;
	getUrl(url,func+"("+https_i+")",https_i);
	https_i++;
}
*/

/* ---------------------------------------------------- */
/* ---------------------------------------------------- */
/* ajax : */


/*
function getUrl(url,callback,i){
	if (url.indexOf("?")>0){
		url += "&randomNumber="+Math.random();
	}else{
		url += "?randomNumber="+Math.random();
	}
	https[i].open("GET", url, true);
	https[i].onreadystatechange = function(){eval(callback);};
	https[i].send(null);
}

function postUrl(url,callback,i){
	https[i].open("POST", url, true);
	https[i].onreadystatechange = function(){eval(callback);};
	https[i].send(null);
}
*/