function trim(str) {
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function isBlank(str) {
	if(str == "")
		return true ;
	return false ;
}

function isEmail(s){
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/) != -1)
		return true ;
	return false ;
}

function verif()
{
	if (isBlank(document.contact.nom.value)) {
		alert("Merci de saisir votre nom");
		document.contact.nom.focus();
		return false;
	}
	if (isBlank(document.contact.prenom.value)) {
		alert("Merci de saisir votre prénom");
		document.contact.prenom.focus();
		return false;
	}

	if (isBlank(document.contact.email.value)) {
		alert("Merci de saisir votre adresse email");
		document.contact.email.focus();
		return false;
	}

	if (!isEmail(document.contact.email.value)) {
    alert("Merci de saisir un email valide");
    document.contact.email.focus();
		return false;
	}
	if (isBlank(document.contact.telephone.value)) {
		alert("Merci de saisir votre numéro de téléphone");
		document.contact.telephone.focus();
		return false;
	}	
  if (isBlank(document.contact.test.value)) {
    alert("Merci de répondre à la question : Combien font 2x2 ?");
    document.contact.test.focus();
		return false;
	}
	
  if (isBlank(document.contact.message.value)) {
    alert("Merci de saisir votre message");
    document.contact.message.focus();
		return false;
	}
	return true;
}

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_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function changement_image(bloc_en_cours,bloc_autre)
{
	MM_changeProp(bloc_en_cours,'','style.display','none','DIV');
	MM_changeProp(bloc_autre,'','style.display','block','DIV');
}

function changement_image_all(bloc_en_cours,bloc_autre)
{
	MM_changeProp('images_1','','style.display','none','DIV');
	MM_changeProp('images_2','','style.display','none','DIV');
	MM_changeProp('images_3','','style.display','none','DIV');
	MM_changeProp('images_4','','style.display','none','DIV');
	MM_changeProp('images_5','','style.display','none','DIV');
	MM_changeProp('images_6','','style.display','none','DIV');
	MM_changeProp('images_7','','style.display','none','DIV');
	MM_changeProp('images_8','','style.display','none','DIV');
	MM_changeProp('images_9','','style.display','none','DIV');
	MM_changeProp('images_10','','style.display','none','DIV');
	MM_changeProp('images_11','','style.display','none','DIV');
	MM_changeProp('images_12','','style.display','none','DIV');
	MM_changeProp(bloc_autre,'','style.display','block','DIV');
}

function changement_all(bloc_to_display)
{
	MM_changeProp('visuel1','','style.display','none','DIV');
	MM_changeProp('visuel2','','style.display','none','DIV');
	MM_changeProp('visuel3','','style.display','none','DIV');
	MM_changeProp(bloc_to_display,'','style.display','block','DIV');
}

function changement_pochette(bloc_to_display, bloc_to_hide1, bloc_to_hide2)
{
	MM_changeProp(bloc_to_hide1,'','style.display','none','DIV');
	MM_changeProp(bloc_to_hide2,'','style.display','none','DIV');
	MM_changeProp(bloc_to_display,'','style.display','block','DIV');
}

function existe_id(id) {
	return (document.getElementById(id)?true:false);
}

function afficheTexte(num){

	//alert(existe_id('depliant1')+"-"+existe_id('depliant2')+"-"+existe_id('depliant3')+"-"+existe_id('depliant4'))	;

  texte = document.getElementById('depliant' + num);
  
  puce = document.getElementById('puce' + num);
  
  // On ouvre ou ferme
  texte.style.display = (texte.style.display=="none"?"block":"none");
  if(texte.style.display=="none")
  {
	puce.src="../images/e_fleche_off.jpg";
  }else{
	puce.src="../images/e_fleche_on.jpg";
  }
	
  for (i=1; i<=5; i++){
	if(i!=num && existe_id('depliant' + i))
	{
		textes = document.getElementById('depliant' + i);;
		puces = document.getElementById('puce' + i);
		
		textes.style.display = "none";
		puces.src = "../images/e_fleche_off.jpg";
	}
  }
}

