function pop_up (Url, Win, Features) {
	window.open(Url, Win, Features);
}

function anipop (Url) {
	window.open(Url, 'anico', 'width=450,height=350,scrollbars=no,resizeable=no');
}

function modal_pop_up (Url, Arg, Features) {
	window.showModalDialog(Url, Arg, Features);
}

function popup_goTo(popThrough) {
	if (!window.opener){
		self.open(popThrough)
	} else if (window.opener.closed){
		window.open(popThrough);
		window.close();
	} else {
		window.opener.location.href = popThrough;
		window.close();
	}
}

function pre_elt_acceuil_interface(couleur, img, lien, titre) {

	document.write("<table border='0' width='90%' cellspacing='0' cellpadding='0'>");
	document.write("<tr>");
	document.write("<td width='1%' background='"+ img +"' bgcolor='"+ couleur +"'><a href='"+ lien +"' class='titre_accueil'><img src='../img/shim.gif' width='206' height='36' border='0'></a>");
	document.write("</td>");
	document.write("<td width='98%' colspan='2' bgcolor='"+ couleur +"'>&nbsp;</td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td width='99%' align='justify' colspan='2'><a href='"+ lien +"' class='titre_accueil'>"+ titre +"</a>");
	document.write("<br><br><p align='justify'>");

}

function post_elt_acceuil_interface(couleur) {

	document.write("</p>");
	document.write("</td>");
	document.write("<td width='1%' bgcolor='"+ couleur +"'><img src='../img/shim.gif' width='2' height='30'></td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td colspan='3' width='99%' bgcolor='"+ couleur +"'><img src='../img/shim.gif' width='1' height='2'></td>");
	document.write("</tr>");
	document.write("</table>");

}

function pre_elt_niv2_interface(couleur, img, lien, titre) {

	document.write("<table border='0' width='90%' cellspacing='0' cellpadding='0'>");
	document.write("<tr>");
	if (lien != "") {
		document.write("<td width='99%' colspan='2'><a href='"+ lien +"' class='titre_accueil'>"+ titre +"</a></td>");
	} else {
		document.write("<td width='99%' colspan='2'><font size=+1>"+ titre +"</font></td>");
	}
	//document.write("<td width='1%' rowspan='2' bgcolor='"+ couleur +"'><img src='../img/shim.gif' width='2' height='10'>");
	document.write("<td width='1%' rowspan='2'><img src='../img/shim.gif' width='2' height='10'>");
	document.write("</td>");
	document.write("</tr>");
	document.write("<tr>");
	if (lien != "") {
		document.write("<td width='100'><br><a href='"+ lien +"' class='titre_accueil'><img src='"+ img +"' width='80' height='80' border='0'></a>&nbsp;&nbsp;&nbsp;</td>");
	} else {
		document.write("<td width='100'><br><img src='"+ img +"' width='80' height='80' border='0'>&nbsp;&nbsp;&nbsp;</td>");
	}

	document.write("<td align='justify' class='minimoi'>");

}

function post_elt_niv2_interface(couleur) {

	document.write("</td>");
	document.write("</tr>");
	document.write("<tr>");
	//document.write("<td width='100%' colspan='3' bgcolor='"+ couleur +"'><img src='../img/shim.gif' width='1' height='3'></td>");
	document.write("<td width='100%' colspan='3'><img src='../img/shim.gif' width='1' height='3'></td>");
	document.write("</tr>");
	document.write("</table>");
}


function isDigit(num) {
	if (num.length>1) {
		return false;
	}
	var string="1234567890";
	if (string.indexOf(num)!=-1) {
		return true;
	}
	return false;
}


function isBlank(val) {
	if(val==null) {
		return true;
	}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")) {
			return false;
		}
	}
	return true;
}



function isInteger(val)	{
	if (isBlank(val)) {
		return false;
	}
	for(var i=0;i<val.length;i++) {
		if(!isDigit(val.charAt(i))) {
			return false;
		}
	}
	return true;
}

// *************************************************************************
// *************** adresse eMail valide ************************************
// *************************************************************************
function valideMail(email) {

	mail = email.value;
	reg=/@\./gi
	reg2=/\.@/gi


	var index = mail.indexOf('@');
	var point = mail.lastIndexOf('.');
	var err = 0;

	if (index == 0) { err = 1;}
	if (point == 0) { err = 1;}
	if (index == -1) { err = 1;}
	if (point == -1) { err = 1;}
	if (point - 1 == index) { err = 1;}
	if (point + 1 == mail.length) { err = 1;}
	if (reg.test(mail)) { err = 1;}
	if (reg2.test(mail)) { err = 1;}
	if (point <= index) { err = 1;}

	if (err)
	{
		// alert("l'adresse e-mail n'est pas correcte !");
		return 0;
	} else {
		return 1;
	}
}

function verif_ligne_conn(login, mdp) {

	var go = 1;

	if (login.length < 5) {
		go = 0;
		alert("Votre login est incorrect (il s'agit de votre adresse e-mail).");
	} else if (mdp.length < 4) {
		go = 0;
		alert("Votre mot de passe est incorrect.");
	}
	
	if(go) {
		document.formLigneConn.submit();
	}
}

function menu_display(calque)
{ 
	document.getElementById(calque).style.visibility = "visible";
}

function menu_hide(calque)
{
	document.getElementById(calque).style.visibility = "hidden";
}

// Vérifie que le paramètre est un entier ou une chaine vide
function isNumber(num) {
	
	// Test chaîne vide
    if (num == ""){
      return true;
    }

	// Test valeur non numérique
    if (isNaN(num)){
       return false;
    }
	
	return true;
      
} 

// Vérifie que le paramètre est un entier positif ou une chaine vide
function isPositiveNumber(num){

	// Si ce n'est pas un nombre
	if (!isNumber(num)){
		return false;
	}
	
	// Si la valeur est négative
	if (num.length > 0 && num < 0){
		return false;
	}
		
	return true;
}

function initBackgroundColor(obj){

	obj.style.backgroundColor = "white";

}
