// JavaScript Document
<!--
function Timer() {
       var dt=new Date()
       window.status=dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds();
       setTimeout("Timer()",1000);
   }

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function close_time(id){
	
	if(id)
	{
		var c = document.getElementById(id);
		if(c)
		{
			if(c.style.display=='block')
			{
					c.style.display='none';
			}
		}
	}
	/*else
	{
		for(i=0;i<100;i++)
		{
			if (document.getElementById('smenu'+i)) 
			{
				if(document.getElementById('smenu'+i).style.display=='block'){
					document.getElementById('smenu'+i).style.display='none';
				}
			}
		}
	}*/
}

function montre(id) {
	var d = document.getElementById(id);
	if (d) {d.style.display='block';}
	setTimeout("close_time('"+id+"')",3000);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' doit contenir un adresse Email.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' doit contenir un nombre.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' doit contenir un nombre entre '+min+' et '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' est requis.\n'; }
  } if (errors) alert('Les erreurs suivante ont été détecté :\n'+errors);
  document.MM_returnValue = (errors == '');
  if(errors=='')
  {
  	MM_openBrWindow('http://www.prim.net/cgi_bin/citoyen/macommune/bddrm_commune.php?debut=1&mode=10&chaine='+document.forms['rechcom'].nom_commune.value,'','scrollbars=yes,resizable=yes,width=800,height=600');
  }
}
function redirect_prim2()
{
	MM_openBrWindow('http://www.prim.net/cgi_bin/citoyen/macommune/bddrm_choix_reg.php?.cgifields=typerisk&mode=13&typerisk=1&region='+document.forms['selreg'].region.value,'','scrollbars=yes,resizable=yes,width=800,height=600');
}

	// Cette fonction affiche le lien de barre latérale selon le type de navigateur
	function TJS_PrintAddSidebar() { 
		if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {  // Cas d'un navigateur qui supporte sidebar
			// Création du lien texte
			document.write("<A href='javascript:AddSidebar()'>Plan du site</A>");

			// Message de confirmation
			AddSidebar()
		} else {	// Le navigateur ne supporte pas les sidebar
			if (document.all) {// Internet explorer supporte le volet de recherche
				document.write("<A href='javascript:AddSidebar()'>Plan du site</A>");
			} else {
				document.write("<A href='http://www.approchecoop.info/ddrm/page.php?fond=plan'>Plan du site</A>")
			}
		} 
	} 

	function AddSidebar() {
		var titre="DDRM sommaire";
		var url_moz="http://www.approchecoop.info/ddrm/page.php?fond=plan2"; // url de la barre latérale mozilla
		var url_ie="http://www.approchecoop.info/ddrm/page.php?fond=plan2"; // url de la barre latérale internet explorer
		if (document.all) {	// Internet explorer supporte le volet de recherche
			window.open(url_ie,"_search");
		} else {			// Mozilla
			window.sidebar.addPanel(titre, url_moz, ""); 
		}
	}


Timer();
//-->
