// identification du navigateur
var myAgent   = navigator.userAgent.toLowerCase();
var myVersion = parseInt(navigator.appVersion);

var is_ie   = ((myAgent.indexOf("msie") != -1)  && (myAgent.indexOf("opera") == -1));
var is_nav  = ((myAgent.indexOf('mozilla')!=-1) && (myAgent.indexOf('spoofer')==-1)
                && (myAgent.indexOf('compatible') == -1) && (myAgent.indexOf('opera')==-1)
                && (myAgent.indexOf('webtv') ==-1)       && (myAgent.indexOf('hotjava')==-1));

var is_win   =  ((myAgent.indexOf("win")!=-1) || (myAgent.indexOf("16bit")!=-1));
var is_mac    = (myAgent.indexOf("mac")!=-1);


//changement couleur balise h3 stand


function salon_cate_choix(salon_categ){
	
	
	document.getElementById("salon_cate").value = salon_categ;
	
}




/*

function standH3(salon_cate_style)
	{
		j=document.getElementsByTagName('h3');
		jligne=j.length;
		
		for (i=0;i<jligne;i++){
		
		switch(salon_cate_style){
			
			
		case "sante" : document.getElementsByTagName('h3')[i].style.color='#cc6699';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_violet.gif) no-repeat';
		document.getElementById('standOngletSante').style.background='url(../medias/images/ongletsante.gif) center center  no-repeat';
		break;
		
		
		case "sante_balneo" : document.getElementsByTagName('h3')[i].style.color='#cc6699';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_violet.gif) no-repeat';
		document.getElementById('standOngletSante').style.background='url(../medias/images/ongletsante.gif) center center  no-repeat';
		break;
						
		case "alimentation" : document.getElementsByTagName('h3')[i].style.color='#cc6699';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_violet.gif) no-repeat';
		document.getElementById("standOngletSante").style.background='url(../medias/images/ongletsante.gif) center center no-repeat';
		break;
		
		case  "habitat": document.getElementsByTagName('h3')[i].style.color='#f49e00';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_orange.gif) no-repeat';
		document.getElementById('standOngletHabitat').style.background='url(../medias/images/onglethabitat.gif) center center  no-repeat';
		break;
		
		case  "loisir": document.getElementsByTagName('h3')[i].style.color='#00aec7';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_bleu.gif) no-repeat';
		document.getElementById('standOngletLoisir').style.background='url(../medias/images/ongletloisir.gif) center center  no-repeat';
		break;
		
		case  "developpement": document.getElementsByTagName('h3')[i].style.color='#978255';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_marron.gif) no-repeat';
		document.getElementById('standOngletDeveloppement').style.background='url(../medias/images/ongletdeveloppement.gif) center center  no-repeat';
		break;
		
		case  "developpement_ethique": document.getElementsByTagName('h3')[i].style.color='#978255';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_marron.gif) no-repeat';
		document.getElementById('standOngletDeveloppement').style.background='url(../medias/images/ongletdeveloppement.gif) center center  no-repeat';
		break;
		
		
		case  "om": document.getElementsByTagName('h3')[i].style.color='#978255';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre_marron.gif) no-repeat';
		document.getElementById('standOngletDeveloppement').style.background='url(../medias/images/ongletdeveloppement.gif) center center  no-repeat';
		break;
		
		
		
		default : document.getElementsByTagName('h3')[i].style.color='#000000';
		document.getElementsByTagName('h3')[i].style.background='url(../medias/images/puce_titre.gif) no-repeat';
		break;
		
		
			
			
		}
	}
}
*/



function aff_div(id_div) {
			document.getElementById(id_div).style.visibility = "visible";
			document.getElementById(id_div).style.display = "block";
}

function masque_div(id_div) {
			document.getElementById(id_div).style.visibility = "hidden";
			document.getElementById(id_div).style.display = "none";
}

/*
	
	function gestion_affiche_stand(cate){
	
	
	switch(cate)
	{
		
		case "santeAlimentation" : masque_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");masque_div("titreStandchoixDeveloppement"); masque_div("optionstand");aff_div("choixSante");masque_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");masque_div("balneo");masque_div("equipe");masque_div("cleEnMain");masque_div("nu");masque_div("confort");masque_div("module");masque_div("villageEcocitoyen");masque_div("ecoEquipe");masque_div("ecoAmenage");
		break;
		
		case "sante" :  aff_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");masque_div("titreStandchoixDeveloppement");aff_div("optionstand");aff_div("choixSante");aff_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");masque_div("balneo");masque_div("equipe");masque_div("cleEnMain");masque_div("nu");masque_div("confort");masque_div("module");masque_div("villageEcocitoyen");masque_div("ecoEquipe");masque_div("ecoAmenage");
		break;
		case "sante_balneo" :  masque_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");masque_div("titreStandchoixDeveloppement");aff_div("optionstand");masque_div("choixSante");masque_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");aff_div("balneo");aff_div("equipe");masque_div("cleEnMain");aff_div("nu");masque_div("confort");masque_div("module");masque_div("villageEcocitoyen");masque_div("ecoEquipe");masque_div("ecoAmenage");
		break;
		
		case "alimentation" :  masque_div("titreStandchoixSante"); aff_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");masque_div("titreStandchoixDeveloppement");aff_div("optionstand");aff_div("choixSante");aff_div("cloisonne");aff_div("transbio");aff_div("marche");aff_div("vin");masque_div("balneo");masque_div("equipe");masque_div("cleEnMain");masque_div("nu");masque_div("confort");masque_div("module");masque_div("villageEcocitoyen");masque_div("ecoEquipe");masque_div("ecoAmenage");
		break;
		case  "habitat":  masque_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");aff_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");masque_div("titreStandchoixDeveloppement");aff_div("optionstand");masque_div("choixSante");masque_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");masque_div("balneo");aff_div("equipe");aff_div("cleEnMain");aff_div("nu");aff_div("confort");masque_div("module");masque_div("villageEcocitoyen");masque_div("ecoEquipe");masque_div("ecoAmenage");
		break;
		case  "loisir":  masque_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");aff_div("titreStandchoixLoisir");masque_div("titreStandchoixDeveloppement");aff_div("optionstand");masque_div("choixSante");masque_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");masque_div("balneo");aff_div("equipe");aff_div("cleEnMain");aff_div("nu");masque_div("confort");aff_div("module");masque_div("villageEcocitoyen");masque_div("ecoEquipe");masque_div("ecoAmenage");
		break;
		case  "developpement": masque_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");aff_div("titreStandchoixDeveloppement");aff_div("optionstand");masque_div("choixSante");masque_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");masque_div("balneo");aff_div("equipe");masque_div("cleEnMain");masque_div("nu");masque_div("confort");aff_div("espace-decouverte");aff_div("module");aff_div("villageEcocitoyen");aff_div("ecoEquipe");aff_div("ecoAmenage");
		break;
		case  "developpement_ethique": masque_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");aff_div("titreStandchoixDeveloppement");aff_div("optionstand");masque_div("choixSante");masque_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");masque_div("balneo");aff_div("equipe");masque_div("cleEnMain");masque_div("nu");masque_div("confort");aff_div("espace-decouverte");aff_div("module");aff_div("villageEcocitoyen");aff_div("ecoEquipe");aff_div("ecoAmenage");
		break;
		default :  masque_div("titreStandchoixSante"); masque_div("titreStandchoixAlimentation");masque_div("titreStandchoixHabitat");masque_div("titreStandchoixLoisir");masque_div("titreStandchoixDeveloppement");masque_div("optionstand");masque_div("choixSante");masque_div("cloisonne");masque_div("transbio");masque_div("marche");masque_div("vin");masque_div("balneo");masque_div("equipe");masque_div("cleEnMain");masque_div("nu");masque_div("confort");masque_div("espace-decouverte");masque_div("module");masque_div("villageEcocitoyen");masque_div("ecoEquipe");masque_div("ecoAmenage");
		break;
		
		
	}
}   
*/

// JavaScript Document
	function popupcentree(page,titre,largeur,hauteur,options)
	{
		if (screen.height-hauteur>0){
			var top=(screen.height-hauteur)/2;
		}
		else{
			var top=0;
		}
		if (screen.width-largeur>0){
			var left=((screen.width-largeur)/2)-3;
		}
		else{
			var left=0;
		}
		
	window.open(page,titre,"'top="+top+",left="+left+",width="+largeur+",height="+hauteur+"',"+options+"");
}




function change_checked(id_div) {
			document.getElementById(id_div).checked = false;
}

function masque_div_checked(id_div,aff_div){
	var check =document.getElementById(id_div).checked;
	if(!check){
				document.getElementById(aff_div).style.visibility = "hidden";
				document.getElementById(aff_div).style.display = "none";
	}
	
}
function check_case(id_div){
	document.getElementById(id_div).checked = true;
}
//preload
function preloadImages() { //v3.0
	var d=document; 
	if(d.images){ if(!d.preload) d.preload=new Array();
		var i
		var j=d.preload.length
		var a=preloadImages.arguments; 
		for(i=0; i<a.length; i++){
			if (a[i].indexOf("#")!=0){ d.preload[j]=new Image; d.preload[j++].src=a[i];}
		}
	}
}


  function limiteur(maximum,champid,indicid)
    {

    if ( document.getElementById(champid).value.length > maximum)
      document.getElementById(champid).value = document.getElementById(champid).value.substring(0, maximum);
    else
      document.getElementById(indicid).value = maximum - document.getElementById(champid).value.length;
    }
	
	function codeTouche(evenement)
	{
        for (prop in evenement)
        {
                if(prop == 'which') return(evenement.which);
        }
        return(evenement.keyCode);
	}

function scanTouche(evenement)
{
        var reCarSpeciaux = /[\x08]/;
        var reCarValides = /\w/;

        var codeDecimal  = codeTouche(evenement);
        var car = String.fromCharCode(codeDecimal);
        var autorisation = reCarValides.test(car) || reCarSpeciaux.test(car);

        return autorisation;
}

//position de la souris
function getMousePos(e)
	{
	clikd_x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	clikd_y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
	}

if(navigator.appName.substring(0,3) == "Net"){	document.captureEvents(Event.MOUSEMOVE);}
	
document.onmousemove = getMousePos;
