DOM= document.getElementById && !document.all;
IE4= document.all;
var currentSousrub="";
function displayMenu(nomlayer,lien_focus) {
	if(lien_focus!=''){
		lien_focus.blur();
	}
	if(currentSousrub==nomlayer){nomlayer="";}
	if (IE4) {
		if (currentSousrub!="") {document.all[currentSousrub].style.display="none";}
		currentSousrub = nomlayer;
		if (nomlayer!="") {document.all[currentSousrub].style.display="block";}
	}
	if(DOM){
		if (currentSousrub!="") {document.getElementById(currentSousrub).style.display="none";}
		currentSousrub=nomlayer;
		if (nomlayer!="") {document.getElementById(currentSousrub).style.display="block";}
	}
}
function popup(theURL,winName,features,w,h) { //v2.0
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 100;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 100; 
  features = features+'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition;
  var fen=window.open(theURL,winName,features);
  if(!fen){
	alert('Vous devez autoriser l\'ouverture de popup dans votre navigateur, pour utiliser cette commande');  
  }else{
  	fen.focus();
  }
}
function clicMenu(id) { 
  if (DOM){ var lediv = document.getElementById(id);}
  if (IE4){ var lediv = document.all[id];}
  if (lediv.style.display == "none"){
    lediv.style.display = "";
  } else {
    lediv.style.display = "none";
  }   
}
function fermer_pop(){
	if(window.fen){
		fen.close();
	}else{
		return false;		
	}
}
function display_style(classe,elemt){
	elemt.attributes['class'].nodeValue=classe;//alert(classe);
}
function actu_select(cible,source) {
	for(i=cible.length-1;i>=0;i--){
 		cible.options[i]=null;
	}
	for(i=0;i<source.length;i++){
		cible.options[i] = new Option(source.options[i].text,source.options[i].value)
	}
}
function ajoutFavoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel("Bellevue-décoration","http://www.bellevue-decoration.com",""); }
else { window.external.AddFavorite("http://www.bellevue-decoration.com","Bellevue-décoration"); } } 

function format_num(valeur,champ){
	var nombre = valeur.replace(/\s+/g,"");
	if(isNaN(nombre)){
		var longueur = nombre.length-1;
		nombre = nombre.substring(0,longueur);
	}
	nombre = parseInt(nombre);
	if(isNaN(nombre) || nombre==0){
		nombre = '';
	}
	//document.forms[0][champ].value = nombre;
	champ.value = nombre;
}
function checkEmailNews(formulaire){
	var good=1;
	var strTexte='';
	var EmailValue = formulaire.email_newsletter.value;
	if(EmailValue ==''){
		strTexte+='Vous devez saisir votre email \n';
		good=0;
	}
	if(EmailValue!=""){
		testm = false ;
		for (var j=1 ; j<(EmailValue.length) ; j++) {
			if (EmailValue.charAt(j)=='@') {
				if (j<(EmailValue.length-4)){
					for (var k=j ; k<(EmailValue.length-2) ; k++) {
						if (EmailValue.charAt(k)=='.') testm = true;
		}	}	}	}
		if (testm==false){
			strTexte+='Cet email n\'est pas valide\n';
			good="0";
		}
	}
	if (good==0){
		alert(strTexte);
		return false;
	}else{
		return true;
	}
}
