//cette fonction permet de cr��r un int�rrupteur il suffit de mettre les Id des element a afficher/masquer en arguments
function vaEtViens(){
	for (i=0;i<arguments.length;i++) {
		var myElement=document.getElementById(arguments[i]);
		myElement.style.display=(myElement.style.display=="block")?"none":"block";
	}
}
//correction des png pour IE6
function IE_CorrectAlpha_PNG(){
	for(i=0; i<document.images.length; i++){
		img    = document.images[i];
		imgExt  = img.src.substring(img.src.length-3, img.src.length);
		imgExt  = imgExt.toUpperCase();
		if (imgExt == "PNG"){
			allClass=(img.className!="")?img.className.split(" "):"";
			var alphaMe=false;
			for (j=0;j<allClass.length;j++) {
				if(allClass[j]=="alphaMe") {
					alphaMe=true;
				}
			}
			if (alphaMe) {//permet de ne traiter que certaine image
				imgID    = (img.id) ? "id='" + img.id + "' " : "";
				imgClass= (img.className) ? "class='" + img.className + "' " : "";
				imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
				imgStyle= "display:block;" + img.style.cssText;
				if (img.align == "left") { imgStyle = "float:left;"  + imgStyle; } else if (img.align == "right"){ imgStyle = "float:right;" + imgStyle; }
				if (img.parentElement.href)   { imgStyle = "cursor:hand;" + imgStyle; }       
				strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'px; height:'+img.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'scale\');"></span>';
				img.outerHTML = strNewHTML;
				i = i-1;
			}
		}
	}
}
//affiche un element et lance la fonction pour le centrer
function showPopup(myId,myEffect) {
	document.getElementById(myId).style.display="block";//hack IE qui pezu pas r�cup�rer les dimensions d'un element en disply:none;
	nova.dom.centerObjectOnViewport(document.getElementById(myId));
	document.getElementById(myId).style.display="none";
	if (myEffect) {
		document.getElementById(myId).style.zIndex=10;//pali un defaut des div  en relative
		nova.effects.addToQueue(nova.effects.fadeIn,document.getElementById(myId),{duration:500});
		nova.effects.queueNext();
	}
	else {
		document.getElementById(myId).style.display="block";
	}
}
function hidePopup(myId) {	
	nova.effects.addToQueue(nova.effects.fadeOut,document.getElementById(myId),{duration:500});
	nova.effects.queueNext();
	//nova.effects.fadeOut(document.getElementById(myId),500);
	//document.getElementById(myId).style.display="none";
}
function popupImg(chemin,titre){
	html = '<html><head><title>'+titre+'</title></head><body onblur="self.close()" style="margin:0;"><img id="myImg" src="'+chemin+'" onload="window.resizeTo(document.getElementById(\'myImg\').width+10, document.getElementById(\'myImg\').height+75)"></body></html>';
	popupImage =window.open('','_blank','toolbar=0, location=0, directories=0, menuBar=0, scrollbars=0, resizable=1');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close();
}
//initialisation de tinymce
function launchTinyMce(myElement) {
	tinyMCE.init({
		mode : "exact",
		elements : myElement,
		theme : "advanced",
		language: "fr",
		plugins : "save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
		theme_advanced_buttons1_add : "fontsizeselect",
		theme_advanced_buttons2_add : "separator,forecolor,backcolor,separator,cut,copy,paste",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		plugin_insertdate_dateFormat : "%Y-%m-%d",
		plugin_insertdate_timeFormat : "%H:%M:%S",
		extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
		relative_urls : false,convert_urls : false,
		file_browser_callback : 'FileBrowser'
	});
}
//prepare tinyMCE pour �tre lanc� ult�rieurement
function prepareTinyMce() {
tinyMCE.init({
	mode : "exact",
	theme : "advanced",
	language: "en",
	plugins : "save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
	theme_advanced_buttons1_add : "fontsizeselect",
	theme_advanced_buttons2_add : "separator,forecolor,backcolor,separator,cut,copy,paste",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	plugin_insertdate_dateFormat : "%Y-%m-%d",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	relative_urls : false,convert_urls : false,
	file_browser_callback : 'FileBrowser'
});
}

function PopupImage(img) { 
	titre="Agrandissement"; 
	w=open("",'image','toolbar=no,scrollbars=no,resizable=no'); 
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE><meta http-equiv='imagetoolbar' content='no'></HEAD>"); 
	w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+10,document.images[0].height+100); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
	w.document.write("<BODY onload='checksize()' onblur='window.close()' onclick='window.close()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
	w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
	w.document.write("<TD valign='middle' align='center'><img src='"+img+"' border=0 alt='' >"); 
	w.document.write("</TD></TR></TABLE>");
	w.document.write("</BODY></HTML>"); 
	w.document.close(); 
} 
