
// Pour les references du mois

function showDoc(id,constid,compid, locationid, type)
{
	document.location.href="/srt/leongrosse/showReference?location.id:="+locationid+"&type="+type+"&id="+id+"&compid="+compid+"&constid="+constid;
}


	function aclickDiv (id,cpt)
	{
		var mondiv= document.getElementById(id);
		// test sur l'element? visible?
		if (mondiv.style.display == "block")
		{
			mondiv.style.display = "none";
		}
		else
		{
			// on boucle sur tous les elements : on les rend invisibles, puis visibilit� de notre element
			for(i=1; i<=cpt; i++)
			{
				var tempDiv= document.getElementById("bloc_"+i);
				tempDiv.style.display = "none";
			}
			mondiv.style.display='block';
		}

	}


	//////
	function ImageMax(chemin,titre)
	{
		   html = '<html> <head> <title>'+titre+'</title> </head> <body onBlur="top.close()"><img src="'+chemin+'" border=0 name=ImageMax id=ImageMax onLoad="window.resizeTo(document.ImageMax.width+25, document.ImageMax.height+60)"></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();
	}



	//Verifie si un champs est vide
	function isEmpty(field){
			 if(field==null) return true;
			 if(field.length<1) return true;
			 for(i=0;i<field.length;i++) {
					if(field.charAt(i)!=' ') return false;
			 }
			 return true;
	}


	function CheckLenAlert(field, size)
	{
			strLen =field.value.length;
			if(strLen>size)
			{
					field.value = field.value.substring(0,size);
			}
			return true;
	}
		
	//
	function CheckIsIE()
	{
		if  (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER')  { return true;}
		else { return false; }
	}




	function showBlock(id) {
		if (document.getElementById(id)) {document.getElementById(id).style.display='block';}
	}


	function hideBlock(id) {
		if (document.getElementById(id)) {document.getElementById(id).style.display='none';}
	}


	function rand_number(n)
	{
		var x;
		x=Math.round(Math.random()*100);
		x%=n;
		return x;
	}





	function Remplace(str,find,rep){
		var reg = new RegExp(find,"gi")
		return(str.replace(reg,rep));
	}


