/* Loïc Pennamen pour Magnana.com */

function upImage(image, ext){
	image.src=image.src.substr(0, image.src.length - 4) + "-up." + ext;
}
function downImage(image, ext){
	image.src=image.src.substr(0, image.src.length - 7) + "." + ext;
}

/* Pierre-MarieVial pour raffin et Associe.com , fonction pour le survol du menu, ajoute dans menu.php */

function upImagespecialMenu(image){
	image.src=image.src.substr(0, image.src.length - 4) + "-up." + "png";
}
function downImagespecialMenu(image){
	image.src=image.src.substr(0, image.src.length - 7) + "." + "png";
}

function afficher(idAAfficher){
	if(document.getElementById(idAAfficher)) document.getElementById(idAAfficher).style.display='block';
}

// onOffBlock fonctionne comme un interrupteur sur un bloc donné par son id
function onOffBlock(afficher){
	if(document.getElementById(afficher).style.display=='block') {		document.getElementById(afficher).style.display='none';	}
	else if(document.getElementById(afficher).style.display=='none') {	document.getElementById(afficher).style.display='block';	}
}

///////////
function changerImage(idImage, srcImage){
	idImage.src=srcImage;
}
///////////
var newWin = null;
function closeWin(){
	if (newWin != null){
		if(!newWin.closed)
		newWin.close();
	}
}
///////////
function popUp(strURL,strType,strHeight,strWidth) {
closeWin();
var strOptions="";
if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
newWin = window.open(strURL, 'newWin', strOptions);
newWin.focus();
} 
// limiter le nombre de caracteres d'un textarea
function limiterTA(monTA,nbCaracteres,temoin){
	nbActuel=monTA.value.length;
	if(nbActuel>=nbCaracteres+1){
		alert('Vous ne pouvez entrer que '+nbCaracteres+' caractères maximum');
		monTA.value=monTA.value.substr(0,nbCaracteres-2);
	}
	document.getElementById(temoin).innerHTML='<sup>'+ (nbCaracteres-nbActuel) + ' caractères restants</sup>';
}
