
function setLoading(id,show){
	/*if(show)myelt(id).innerHTML = 'loading...';
	else myelt(id).innerHTML = '';*/
}


function FindPos(AObject)
{
	var posX = 0, posY = 0;
	do
	{
		posX += AObject.offsetLeft;
		posY += AObject.offsetTop;
		AObject = AObject.offsetParent;
	}
	while( AObject != null );
	var pos = [];
	pos['x'] = posX;
	pos['y'] = posY;    

	return pos;
}


function showMenu(src, dest){
	
	var pos = FindPos(dest);
	myelt(src).style.display = 'block';
	myelt(src).style.top = (pos['y']+25)+'px';
	myelt(src).style.left = pos['x']+'px';
	
}
function showMenu2(obj){
	
	obj.style.display = 'block';
	
}

function hideMenu(src){
	
	myelt(src).style.display = 'none';
	
}

function myelt(id){
	return (document.getElementById(id))?document.getElementById(id):false;
}

function  switchSrc(id , src1, src2)
{
	if(myelt(id).src){
		if(myelt(id).src == src1)myelt(id).src = src2;
		else myelt(id).src = src1;
	}
}

function markMenu(obj, type)
{
	if(obj.className != 'menuVisited2'){
		if(type=='over')obj.className = 'menuVisited';
		else if(type=='out')obj.className = 'menu';
	}
}

function mydisplay(type, id)
{
	if(type=='hide' && myelt(id))myelt(id).style.display='none';
	else if(type=='show' && myelt(id))myelt(id).style.display='';
}

function bulkDisplay(id)
{
	if(myelt(id).style.display=='none')mydisplay('show', id);
	else mydisplay('hide', id);
}

function setOpacity(obj, value)
{
	obj.style.opacity = value/10; 
	obj.style.filter = 'alpha(opacity=' + value*10 + ')';
}

function verifDec(id){
	var j=1;
	for(var i=0;i<myelt(id).value.length;i++){
		var caractere=myelt(id).value.substring(i,i+1);
		if(((caractere<'0' || caractere>'9') && (caractere!='.' && caractere!=',')) || ((caractere=='.' || caractere==',') && j==0)){               
			myelt(id).value=myelt(id).value.substring(0,i);
			return false;
		}else if(caractere=='.' || caractere==',')j=0;
	}
	return true;
}

function verifNum(id){
	for(var i=0;i<myelt(id).value.length;i++){
		var caractere=myelt(id).value.substring(i,i+1);
		if((caractere<'0' || caractere>'9')){               
			myelt(id).value=myelt(id).value.substring(0,i);
			return false;
	  }			  
	}
	return true;
}

function verifNumEccept(id, eccept){
	for(var i=0;i<myelt(id).value.length;i++){
		var caractere=myelt(id).value.substring(i,i+1);
		if((caractere<'0' || caractere>'9') && caractere!=eccept){               
			myelt(id).value=myelt(id).value.substring(0,i);
			return false;
	  }			  
	}
	return true;
}

function verifDate(id){
	if(myelt(id).value.length==2){
		myelt(id).value = myelt(id).value+'/';
	}    
	else if(myelt(id).value.length==5){
		myelt(id).value = myelt(id).value+'/';
	}else verifNumEccept(id, '/');
}



function sendPassword(repertoire){
	var email = prompt('Veuillez nous indiquer l\'adresse e-mail utilisée lors de votre inscription','');
	if(email.split('@').length==2)ajaxReq2(repertoire+'sendPassword.php','email='+email,'POST','if(result[6]!="")alert(result[6])',6);
	else {alert('Veuillez entrer une adresse e-mail valide'); sendPassword(repertoire);}
}


//Affichage de localisations//////////////////////////////////////////////////////////////////////////
	function show_localisation(loc_code,loc_class,boxId)
	{
		myelt(boxId).innerHTML = 'en cours...';
		ajaxReq('bib/localisation.php','loc_code='+ loc_code +'&loc_class='+ loc_class +'&zone='+boxId,boxId,'POST','');
	}


	
// ////////////////////////////////////////////
	function loadTinyMCELevel1(id) {
		tinyMCE.init({
			// General options
				language : "fr",
				mode : "exact",
				elements : id,
				width : "100%",		
				height : "100px",		
				theme : "advanced",		
				skin : "o2k7",		
				skin_variant : "black",
				plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

			// Theme options
				theme_advanced_buttons1 : "bold,italic,|,sub,sup,|,forecolor,backcolor,|,removeformat",
				theme_advanced_buttons2 : "",
				theme_advanced_buttons3 : "",
				theme_advanced_buttons4 : "",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "none",
				theme_advanced_resizing : true
		});	
		
		tinyMCE.add(tinyMCE);
		//tinyMCE.execInstanceCommand(id, 'mceResize',false,'height:100px', true); 
	}
	
	
	function loadTinyMCELevel2(id) {
		tinyMCE.init({
			// General options
				language : "fr",
				mode : "exact",
				elements : id,
				width : "80%",		
				theme : "advanced",		
				skin : "o2k7",
				plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

			// Theme options
				theme_advanced_buttons1 : "bold,italic,underline,|,sub,sup,|,undo,redo,|,bullist,numlist,|,forecolor,backcolor,emotions,|,link,unlink,|,removeformat",
				theme_advanced_buttons2 : "",
				theme_advanced_buttons3 : "",
				theme_advanced_buttons4 : "",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resizing : true
		});	
		
		tinyMCE.add(tinyMCE);
	}
	
	
	function loadTinyMCELevel2b(id) {
		tinyMCE.init({
			// General options
				language : "fr",
				mode : "exact",
				elements : id,
				width : "100%",		
				theme : "advanced",		
				skin : "o2k7",
				skin_variant : "black",
				plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

			// Theme options
				theme_advanced_buttons1 : "bold,italic,underline,|,sub,sup,|,undo,redo,|,bullist,numlist,|,forecolor,backcolor,emotions,|,link,unlink,|,removeformat",
				theme_advanced_buttons2 : "",
				theme_advanced_buttons3 : "",
				theme_advanced_buttons4 : "",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resizing : true
		});	
		
		tinyMCE.add(tinyMCE);
	}
	
	
	function loadTinyMCELevel3(id) {
		tinyMCE.init({
			// General options
				language : "fr",
				mode : "exact",
				elements : id,
				width : "100%",		
				theme : "advanced",		
				skin : "o2k7",
				plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

			// Theme options
				theme_advanced_buttons1 : "forecolor,backcolor,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,|,fullscreen",
				theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,|,insertdate,inserttime,preview,|,insertlayer,moveforward,movebackward,absolute",
				theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,|,sub,sup,|,charmap,emotions,iespell,advhr,|,print,|,nonbreaking,pagebreak",
				theme_advanced_buttons4 : "",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resizing : true
		});	
		
		tinyMCE.add(tinyMCE);
	}
	
	
// ////////////////////////////////////////////