/**************************************
* MaToolBox v0.14 — Nicolas Feschotte *
**************************************/

/* ----------------------------------- GESTION MENU ----------------------------------- */

var lemenu = new Array ("formation","homestaging","notresociete");

var montimeout = setTimeout('',10000);

/* affichage des éléments du menu */
function affiche(obj) {

	block_menu();
	
	var i = 0;

	while (i < lemenu.length) {
		if (obj != lemenu[i]) {
			affiche_masque(lemenu[i], 'hide');
		} else {
			 affiche_masque(obj, 'show');
		//	mon_appear(obj);
		}
		i++;
	}
	
}

function cache_menu() {
	/* fonction d'amandine qui traite un sous menu avec un n° de sub */

	/*
	for (var i = 1; i<=10; i++) {
		if (getID('smenu'+i)) {
			getID('smenu'+i).style.display='none';
		}
	}
	*/
	
	block_menu();

	montimeout = setTimeout("affiche('rien')", 1000);
	
}

function block_menu() {
	if(is_set(montimeout)) {
		clearTimeout(montimeout);
	}	
}

/* scriptaculous */
function mon_appear(cet_id) {
	Effect.toggle(cet_id, 'appear', { duration: 0.7, delay: 0 }); return false;
}



/* ----------------------------------- FIN GESTION MENU ----------------------------------- */

/* récup de l'id d'un obj */
function getID(obj) {
	return MM_findObj(obj);	
}

/* affichage / masque forcé ou non d'un obj */
function affiche_masque(obj,force) {
	target = getID(obj);	
	if(target.style.display!="none") { target.style.display="none"; } 
	else { target.style.display="block"; }
	
	if(force=="show") target.style.display = "block";
	if(force=="hide") target.style.display = "none";
}

/* box l'alerte de confirmation */
function alerte(contenu) {
	return confirm(contenu);
}

/* redim une window */
function resize(percentage_largeur,percentage_hauteur) {
	largeur_ecran = screen.width;
	hauteur_ecran = screen.height;
	new_largeur = (percentage_largeur * largeur_ecran) / 100;
	new_hauteur = (percentage_hauteur * hauteur_ecran) / 100;
	window.resizeTo(new_largeur, new_hauteur);
	
}

/* déplace une window */
function move(topx,topy) {
	window.moveTo(topx,topy);
}

/* coche ou décoche toutes les checkbox du formulaire "form" */
function selectAllChk(form){
	var frm = document.forms[form] ;
	var chk = eval(form+'.checked') ;
	var cpt = eval(form+'.length') ;
	if(cpt) {
		for(i=0;i<cpt;i+=1){
			eval(form+'[i].checked = chk') ;
		}
	} else {
		eval(form+'.checked = chk') ;
	}
}

/* on click tu coche / décoche une box */
function checkmabox(mabox) {
	labox = getID(mabox);
	if (labox.checked == 1) labox.checked = 0;
	else labox.checked = 1;
}

/* recharger ou aller à une page */
function recharge_page(dest) {
	if (dest != null) 
	window.location.href = dest;
	else window.location.href= window.location.href;
}
/* recharger dans une frame */
function charge(dest, maframe) {
	parent.frames[maframe].window.location = dest; 
}

function is_set(variablename){
	if(variablename.value == "") {
		return false;
	}
	return true;
}


/*****************************************************************
* You may use this code for free on any web page provided that 
* these comment lines and the following credit remain in the code.
* Floating Div from http://www.javascript-fx.com
*****************************************************************/

function JSFX_FloatDiv(id, sx, sy) {
	var ns = (navigator.appName.indexOf("Netscape") != -1);

	var el = document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers[id];
	var px = document.layers ? "" : "px";
	
	window[id + "_obj"] = el;
	
	if(document.layers) el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP = function(x,y) { this.style.left=x+px;this.style.top=y+px; };

	el.floatIt = function() {
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		if (this.sy < 0) pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 100);
	}
	return el;
} 

function le_focus(form,champ) {
	document.forms[form].elements[champ].focus(); 
}

function aj_favoris(nom,adresse) {
	if ( navigator.appName != 'Microsoft Internet Explorer' )
	{ window.sidebar.addPanel(nom,adresse,""); }
	else { window.external.AddFavorite(adresse,nom); }
}