
// JavaScript Document
var sRepeat=null;
// JavaScript Document

var ns4 = (document.layers)? true:false;         //NS 4
var ie4 = (document.all)? true:false;         //IE 4
var dom = (document.getElementById)? true:false;   //NS 6 ou IE 5

function SetDiv(ID,Content) {
  if (dom) {
  document.getElementById(ID).innerHTML = Content;
     return;
  }
  if (ie4) {
      document.all[ID].innerHTML = Content;
     return;
  }
  if (ns4) {
      with (eval('document.'+ID+'.document')) {
         open();
         write(Content);
         close();
     }
     return;
  }
}

function doScrollerIE(dir, src, amount) {	
if (amount==null) {
amount=10
}
//http://www.presencenet.net/
if (dir=="up") {
document.all[src].scrollTop-=amount
}	else {
document.all[src].scrollTop+=amount
}	if (sRepeat==null) {
sRepeat = setInterval("doScrollerIE('" + dir + "','" + src + "'," + amount + ")",100)}	return false
}
window.document.onmouseout = new Function("clearInterval(sRepeat);sRepeat=null");
window.document.ondragstart = new Function("return false");

function toggle( targetId ){
{target = document.all( targetId );
if (target.style.display == "none")
{
target.style.display = "";
} else {
target.style.display = "none";
  }
 }
}


function visibilite(thingId)
{
var d = document.getElementById(thingId);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('divid'+i)) {document.getElementById('divid'+i).style.display='none';}
	}
if (d) {d.style.display='';}
}



/* Poppup  */
function popupscroll(page,ht,lg,nom){
	x=(screen.width-lg)/2;
	y=(screen.height-ht)/2;
	var popup = window.open(page,nom,"width="+lg+",height="+ht+",left="+x+",top="+y+",toolbar=0,scrollbars=yes,resizable=yes");
	popup.focus();
}


/*fenetre d'apparition du  produit*/
/*Modif Andry 13-11-2008*/
/*Parametre variable chaine pour afficher le nom du produit*/

window.onload=montre;
function montre(menu) {
if(menu){
	var d = document.getElementById(menu);
}
	while (document.getElementById('smenu')) {
	if (document.getElementById('smenu')) {document.getElementById('smenu'+i).style.display='none';}
;
	}

	if (d) {d.style.display='block';}
}
window.onload=montre;
function cache(menu) {
if(menu){
	var d = document.getElementById(menu);
}
	while (document.getElementById('smenu')) {
	if (document.getElementById('smenu')) {document.getElementById('smenu'+i).style.display='block';}
;
	}

	if (d) {d.style.display='none';}
}

function verifChampsMail()
{
    var isTrue = true;
    
    var msg = "Attention les champs suivants doivent etre renseignes :";

    if (document.getElementById('user_mail').value=="")
    {
        isTrue = false;
        msg += "<br />Mon E-mail";
    }
    else
    {
        var new_string = new String(document.getElementById('user_mail').value);
        if (!new_string.match('^[-_\.0-9a-zA-Z]{1,}@[-_\.0-9a-zA-Z]{1,}[\.][0-9a-zA-Z]{2,}$'))
        {
        isTrue = false;
        msg += "<br />Mon E-mail : Adresse non valide";
        }
    }
    if (document.getElementById('user_nom').value=="")
    {
        isTrue = false;
        msg += "<br />Nom et Prénom";
    }
    
    if (document.getElementById('dest_mail').value=="")
    {
        isTrue = false;
        msg += "<br />E-mail du destinataire";
    }
    else
    {
        var new_string = new String(document.getElementById('dest_mail').value);
        if (!new_string.match('^[-_\.0-9a-zA-Z]{1,}@[-_\.0-9a-zA-Z]{1,}[\.][0-9a-zA-Z]{2,}$'))
        {
        isTrue = false;
        msg += "<br />E-mail : Adresse non valide";
        }
    }    
    if (!isTrue)
	{
        SetDiv('msgmail',msg);
	}
    else
    {	document.getElementById('sndmail').submit();
		window.alert("Votre message a bien été envoyé!");
	}
}    








