/*******************************************************************
******************    Script des fonctionalit? g?n?r?e *************
********************************************************************/

/**
 *  mise ? jour des fonctions
 * charge dans la frame cach?e BufferFonction la page HTML issue du parse
 * serveur du flux XML, transform? par la feuille de style fonction.XSL 
 * OnLoad cette frame appel loadFonction pour mettre ? jour le divMAP 
 *
 **/
 
var isMinNS4=(navigator.appName.indexOf("Netscape")>=0&&parseFloat(navigator.appVersion)>=4)?1:0;
var nbMenu=0;
var xmlFileSRCFonction="";
function hideAll()
{
        var i;


        for(i=1;i<= nbMenu;i++)
        {
                hideObject("sousMenu"+i);
        }
        sousMenuVisible=0;
if(isMinNS4)
        {
//if(activeOnglet!="")
      //  ShowOng(activeOnglet);
}
        return true;
}

function hideObject(id)
{  
        var obj = null;
       
        if(isMinNS4)
        {
                obj = document.getElementById(id);
                if(obj!=null)
                {
if(id.indexOf("menu")>=0)
{

//if(activeOnglet!="")
     //   ShowOng(activeOnglet);
}
                        
                obj.style.visibility="hidden";

		
                }
        }
        else
        {
                obj = document.getElementById(id);
                if(obj!=null)
                {
                        if(obj.style!=null)
                        {
                                obj.style.visibility="hidden"; 
                        }
                }
        }
				hideObjectDisplay(id);
        return true;
}

function hideObjectDisplay(id)
{  
        var obj = null;
       
        if(isMinNS4)
        {

                obj = document.getElementById(id);
                if(obj!=null)
                {
                        
                obj.style.display="none";
		
                }
        }
        else
        {
                obj = document.getElementById(id);
                if(obj!=null)
                {
                        if(obj.style!=null)
                        {
                                obj.style.display="none"; 
                        }
                }
        }
        return true;
}

function setVar(nb)
{
        nbMenu = nb;
}

function showObject(id)
{  
        
        var obj = null;
        if(isMinNS4)
        {

                 obj = document.getElementById(id);
                if(obj!=null)
                {
if(id.indexOf("sousMenu")>=0)
{
/*
 hideObjectDisplay("fLegende");
 hideObjectDisplay("divLegende");
 hideObjectDisplay("iframRes");
 hideObjectDisplay("divResultat");
 hideObjectDisplay("fFiltre");
 hideObjectDisplay("divFiltre");*/

}
                obj.style.visibility="visible";
                obj.style.display="block";
                }
        }
        else
        {
                  obj = document.getElementById(id);
                if(obj!=null)
                {
                obj.style.visibility="visible";
obj.style.display="block";
                }
        }
        return true;
}


function loadscript(src) 
{
        var JS = document.createElement('script');
        JS.setAttribute('type', 'text/javascript');
        JS.setAttribute('text', src);
        document.getElementsByTagName('head').item(0).appendChild(JS);
}

function updateBufferFonction(target)
{
        frames['bufferFonction'].location.href=target; 
}

function loadFonction() 
{
        var inner;
        inner =  frames['bufferFonction'].document.body.innerHTML;
       
				if(flashMenu==true)
				{
				
				 		if(xmlFileSRCFonction!="")
						{
						
						
						var szInner = "";
						var sendMousePos = 0;
							
							iActivateClickMenu = 0;
							var valueparam = xmlFileSRCFonction + "|" + bkColorMenu + "|" + bkColorSubMenu + "|" + hlColorMenu + "|" + bdColorMenu + "|" + fontMenu + 
"|" + hlColorTextMenu + "|" + ColorTextMenu + "|" + iRoundedMenu + "|"+sendMousePos + "|" + iActivateClickMenu;

						//	var valueparam = xmlFileSRCFonction + "|" + bkColorMenu + "|" + bkColorSubMenu + "|" + hlColorMenu + "|" + bdColorMenu;
								var fo = new FlashObject("swf/canvasMenu.swf", "MenuFlash", 900,500, "8", "#FFFFFF");
								fo.addParam("allowScriptAccess", "sameDomain");
								fo.addVariable("xmlParametres", valueparam); // this is always optional, but this example uses the variable and displays this text inside the flash movie
								fo.addParam("salign","LT");
								fo.addParam("swLiveConnect","true");
								fo.addParam("WMode","transparent");
								fo.write("divFlashMenu");
							UpdateUserConnection();
							GetMiniCarte();
       				
						}
				}
				else
				{
				 	if (inner!="")
        	{
                document.getElementById("divFonction").innerHTML=inner;
				UpdateUserConnection();
        		GetMiniCarte();
					}
				}
      


}



function GetFonctions()
{
  hideObject("divParametre");
  hideObject("champLib1");
  hideObject("champLib2");
  
  var loc = location.href;
  

        if(szClientID == 0)
        {
        
        GetUserFromURL();
        UpdateUserConnection();
				 var chaine;
        if(flashMenu)
				{
         chaine = szHttpServeur +
                        "&ACTION=GetFonction!FORMATMENU=4!LOCATION=" + loc + "&XSL=fonctionFlash.xsl&PORT="+szPort;
												}
												else
												{
												 chaine = szHttpServeur +
                        "&ACTION=GetFonction!LOCATION=" + loc + "&PORT="+szPort;
												}
          updateBufferFonction(chaine);
        }
}




<!-- -----------------------------------------------------------------  -->
<!-- Active une fonction : typeFonction = 1 dans le cas d'une recherche -->
<!-- szNomFonction = nom de la fonction ? activer -->
<!-- szParam1 = nom du libell? 1 dans le cas d'une recherche -->
<!-- szParam2 = nom du libell? 2 dans le cas d'une recherche -->
<!-- -----------------------------------------------------------------  -->
function ActivateFonction(typeFonction,szNomFonction,szParam1,szParam2,iIntercative) 
{

	reg = new RegExp("&eacute;","ig");
	szNomFonction = szNomFonction.replace(reg,"é");
	

hideAll();
if(flashMenu)
CollapseMenu();

	szCurrentRecherche = "";
        
        hideObject("divParametre");
        hideObject("divResultat");
        hideObject("champLib2");
        hideObject("champLib1");
        //hideObject("iframRes");

	if (typeFonction==1)
	{
	if(editSvg)
	{
					alert(msgEditionInProgress);
					return;
					}
   	 szCurrentRecherche = szNomFonction;
	if(iIntercative==0)
	{
       /*  showObject("divParametre");
	 document.getElementById('champLib1').innerHTML = szParam1;
	 showObject("champLib1");
	 document.getElementById('champLib2').innerHTML = szParam2;
	 showObject("champLib2");*/
    LanceRecherche(szCurrentRecherche,-1,'');
	}
	else
	{
		LanceRecherche(szCurrentRecherche,-1,'');
	}
 
	}
	else if (typeFonction == 2)
	{
			if(editSvg)
	{
					alert(msgEditionInProgress);
					return;
					}
		LanceAnalyse(szNomFonction, szParam1,0,iIntercative);
	}	
		//Statistique
	else if (typeFonction == 3)
	{
		LanceStatistique(szNomFonction, '', '', iIntercative);
	}
	else if (typeFonction == 4)
	{
		LanceTableauBord(szNomFonction, '', '', iIntercative);
	}
	else if (typeFonction == 5)
	{
 		var loc = location.href;
		var chaine = szHttpServeur  +
                "&ACTION=Plugin!NAME="+szNomFonction+"!LOCATION=" + loc + "!INTERACTIVE="+iIntercative;
		updateBufferResultat(chaine)
		
	}	
	else if (typeFonction == 6)
	{
						
			if(isMinNS4)
				 {
				 alert("Cette fonctionalit? n'est disponible que sur Internet Explorer");
				 }
				 hideObject("divRight");
			var loc = location.href;
			var chaine;
		
			{

             resizeSvgMode(true);
			 newwidth = (mapright - mapleft);
	  		 newheight = (maptop - mapbottom);
			 newbottom = mapbottom;
			 newleft = mapleft;
			 chaine = szHttpServeur  +
			 "&ACTION=EditLayer!NAME="+szNomFonction+"!EMPRISE="+ newleft + "@" + newbottom + "@" + newwidth + "@" +  newheight + "!OUTPUTSIZE=" + mapClientwidth + "@" + mapClientheight +"!LOCATION=" + loc + "!LAYER_EDITION";
			}
			
			showFlashTb = false;
			editSvg=true;					
			updateBufferEditLayer(chaine);
			currentEditedLayer=szNomFonction;
			showObject("divEditLayer");
			showObject("divResultat");
			showObject("iframRes");
		
	}
	else if (typeFonction == 100)
	{
							
		updateListPoint();
		
	}
	else if (typeFonction == 99)
	{
 		if(szNomFonction=="Format Flash")
		{
		szFormat = 4;
		RedrawMap();
		}
		if(szNomFonction=="Format Image")
		{
		szFormat = 0;
		RedrawMap();
		}
		if(szNomFonction=="Activer l'aide")
		{
		useHelp = true;
		}
		if(szNomFonction=="D?sactiver l'aide")
		{
		useHelp = false;
		}
		
	}	

}

function resizeSvgMode( open ){
 var marge = 0;
 if( open ) marge = -29;
 
 var cliW = document.body.clientWidth + marge;
 var cliH = document.body.clientHeight;
 var objDivMap = document.getElementById("divMap");
 
 if(!redimAuto) return;
 resizing = 1;

 if( navig_isFFOX() ){
  mapClientwidth  = cliW - objDivMap.offsetLeft - 15;
  mapClientheight = cliH - objDivMap.offsetTop - 5;
 }
 else{
  mapClientwidth  = cliW - objDivMap.offsetLeft - 15;
  mapClientheight = cliH - objDivMap.offsetTop - 20; 
 }
 
 if(mapClientwidth<300) mapClientwidth = 300;

 var objDivMap = document.getElementById("divMap");
 objDivMap.style.width = mapClientwidth;
 objDivMap.style.height = mapClientheight;
 
 curObj = document.getElementById("IMG");
 if(curObj!=null){
  curObj.width = mapClientwidth;
  curObj.height = mapClientheight;
 }

 if(isMinNS4){
  // pas d'edition SVG en mozilla
 }
 else{
  svgDocSelect.width = mapClientwidth;
  svgDocSelect.height = mapClientheight;
 }

 if((fo!=null)&&(ttimeredraw==null)){
  ttimeredraw = setTimeout("resizeRedrawMap();",500);
 }
 resizing = 0;
 return(false);
}