var couleur_vide_visiteur = "#006666"; // couleur si le champ n'est pas rempli 
var couleur_vide = "#FF9933"; // couleur si le champ n'est pas rempli 
var couleur_ok = "#CCCCCC"; // couleur du champ ok 

var css="conf/style.css";
var phrase = navigator.userAgent ;
var recherche1 = /(MSIE 5)/g;
var recherche2 = /(Windows)/g;
var resultat1 = recherche1.test(phrase);
var resultat2 = recherche2.test(phrase);
if((resultat1 == true)&&(resultat2 == true)){ css="conf/style_ie5w.css"; }
var recherche1 = /(Mac)/g;
var recherche2 = /(MSIE)/g;
var resultat1 = recherche1.test(phrase);
var resultat2 = recherche2.test(phrase);
if((resultat1 == true)&&(resultat1 == true)){ css="conf/style_ie5m.css"; }

var recherche1 = /(Windows)/g;
var recherche2 = /(MSIE 6)/g;
var resultat1 = recherche1.test(phrase);
var resultat2 = recherche2.test(phrase);

if((resultat1 == true)&&(resultat2 == true)){ css="conf/style.css"; }

var recherche1 = /(Windows)/g;
var recherche2 = /(Firefox)/g;
var resultat1 = recherche1.test(phrase);
var resultat2 = recherche2.test(phrase);
if((resultat1 == true)&&(resultat2 == true)){ css="conf/style_firew.css"; }

var recherche1 = /(Mac)/g;
var recherche2 = /(Firefox)/g;
var resultat1 = recherche1.test(phrase);
var resultat2 = recherche2.test(phrase);
if((resultat1 == true)&&(resultat2 == true)){ css="conf/style_firem.css"; }

var phrase = navigator.userAgent ;
var recherche2 = /(Safari)/g;
var resultat2 = recherche2.test(phrase);
if(resultat2 == true){ css="conf/style_safari.css"; }

document.write("<LINK rel='StyleSheet' type='text/css' href='"+css+"'>");


////////////////////////////////////////////////////Lien pop
function pop0(){	
window.open('','popup','toolbar=0, location=0, directories=0, status=0,  resizable=1, scrollbars=1, height=400,width=400');
}
//////////////////////////////////////////////////////popup centrage et redim
function pop(nx,ny) {
	xall = (screen.availWidth / 2);
	yall = (screen.availHeight / 2);
	window.resizeTo(nx,ny);
	self.moveTo(xall - (nx / 2), yall - (ny / 2));
	onblur=self.focus();
}

///////////////////////////////////fermer pop ou fenetre
function fermer() { 
	opener=self; 
	self.close(); 
} 

////////////////////////////////////////////////////select des menu
function bouge_menu(recherche,opt) { 
  nb = opt.length; 
  model = new RegExp('^' + recherche ,'i'); 
  for (var i=0; i < nb; i++) { 
    if (model.test(opt[i].value)) { 
      opt[i].selected = true; 
      break; 
    } 
  } 
}

////////////////////////////////////////////////////transfert de select vers tearea
function champ_tranfert(dest,expe) {
	if (expe[expe.selectedIndex].value!="") {
		model = new RegExp(expe[expe.selectedIndex].value);
		dest.value += expe[expe.selectedIndex].value + ", ";
	}
}

////////////////////////////////////////////////////transfert de input vers input
function champ_tranfert2(dest,expe) {
	if (expe.value!='') {
		model = new RegExp(expe.value);
		if (model.test(dest.value)) {
			dest.value=dest.value.replace(expe.value+',',""); 	
		}	else dest.value += expe.value + ", ";
	}
}

///////////////////////////////////////////////////formulaire
function couleur(obj) {
	obj.style.backgroundColor = couleur_ok;
} 


////////////////////interdire du bouton entré
function process_keypress(e,message) { 
	if(e) { 
		if (e.type == "keypress" & e.keyCode == 13)  {
			alert(message)
			return false;
			} else return true;
	} 
} 

//////////////////////fonction rool over coté utilisateur

///////////////////////////////////fonction de préchargement d'image

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//////////////////////////////////////////////équivalent de trim en php
function trim(val) {
  var retour = ""
  for(i=0;i < val.length;i++)
    if(val.charAt(i) != " ") {
      retour += val.charAt(i)
    }
  return retour;
}
////////////////////////////////////////:redirection
function redirige(page) {
	document.location.href='page';
}

////////////////////////////////////////confirmation d'action
function confirmm(message) {
	resultat=confirm(message);
	return resultat;
}

