/**
 * Fonctions Monkey
 * Auteurs : Lambo, Asumbaa
 * http://www.residivjeux.com/monkey
 * contact@residivjeux.com
 */

function popupURL(url,target,W,H) {
   if (!W) W=200;
   if (!H) H=200;
   if (!target) target="_new";
   var X = (screen.width/2)-(W/2);
   var Y = (screen.height/2)-(H/2);
   var winPref = "width=" + W + ",height=" + H
			   + ",innerWidth=" + W + ",innerHeight=" + H
			   + ",left=" + X + ",top=" + Y
			   + ",screenX=" + X + ",screenY=" + Y
			   + ",dependent=yes,titlebar=no,scrollbars=yes,resizable=yes";
   popupURL.popup = window.open( url, target, winPref );
   popupURL.popup.resizeTo(1*W,1*H);
   popupURL.popup.focus();
   return true;
} // popupURL

/**
 *	Fonction qui gère l'ouverture et la fermeture du menu des guides soluce
 */
function changerStyle(id) {
	var li = document.getElementById(id);
	if (li!=null) {
		var cssClass = li.className;
		if (cssClass.indexOf("expanded")!=-1) {
			li.className = li.className.replace("expanded", "collapsed");
		} // if
		else if (cssClass.indexOf("collapsed")!=-1) {
			li.className = li.className.replace("collapsed", "expanded");
		} // else if
	} // if
	return false;
} // changerStyle

function compterLettres(texte, compteur, limite) {
	if (texte.value.length > limite) {
		texte.value = texte.value.substring(0, limite);
	} // if
	else {
		compteur.value = limite - texte.value.length;
	} // else
} // compteur
		
function validateForm(ok) {
	if (ok != "ok") {
		alert ("Veuillez lire les conditions d'utilisation !");
		return false;
	} // else
	return true;
} // validateForm

function afficher(div) {
	if (document.getElementById) { // Standard
		document.getElementById(div).style.visibility = "visible";
	}
	else {
		if(document.all) { // IE
			document.all[div].style.visibility = "visible";
		}
		else if(document.layers) { // Vieux NS
			document.layers[div].visibility = "show";
		}
	}
}

function reloadArbre() {
	lesdiv = document.getElementsByTagName("div");
	for (i=0; i<lesdiv.length; i++) {
		var cssClass = lesdiv[i].className;
		if (cssClass.indexOf("divsoluce") != -1) {
			lesdiv[i].style.visibility = "hidden";
		} // if
	} // for
	document.getElementById("question").style.visibility = "visible";
}
