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

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

/* affichage / masque forcé ou non d'un id */
function affiche_masque(cet_obj,force) {
	target = getID(cet_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;
}