// JavaScript Document

/* Fonction pour ajouter le site aux favoris */
function addfav() { 
   if (navigator.appName != 'Microsoft Internet Explorer'){ 
	    window.sidebar.addPanel('DixData : Facilitateur Sms - service smsplus - wap professionnel','http://www.dixdata.com',''); 
	 }else{ 
	    window.external.addFavorite('http://www.dixdata.com','DixData : Facilitateur Sms - service smsplus - wap professionnel'); 
	 } 
}

/* Fonction pop up */
function popup(url,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(url,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

/* Effets sur images */
function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function hoverdiv(href,div,img,etat){
	if(etat == 'on'){
		if(href != ''){
		  document.getElementById(href).style.borderColor='#FFA73D';
		}
		if(div != ''){
		/*document.getElementById(div).style.color='#E2E6E9';*/
		/*document.getElementById(div).style.backgroundColor='#293034';*/
		}
		/*changeOpac(100, img);*/
	}else{
		if(href != ''){
		  document.getElementById(href).style.borderColor='#ACB7BF';
		}
		if(div != ''){
		/*document.getElementById(div).style.color='#ACB7BF';*/
		/*document.getElementById(div).style.backgroundColor='transparent';*/
		}
		/*changeOpac(70, img);*/
	}
}

function showhide(id,etat){
	if(etat == 'on'){
		document.getElementById('textesuite_'+id).style.display='block'; 
		document.getElementById('linka_'+id).style.display='none';
		document.getElementById('linkb_'+id).style.display='block';
		/*document.getElementById('body').style.height='950px';*/
		/*for(var i=1;i<=10 && i!=id;i++){
			showhide(i,'off');
		}*/
	}else{
		document.getElementById('textesuite_'+id).style.display='none';
		document.getElementById('linka_'+id).style.display='block';
		document.getElementById('linkb_'+id).style.display='none';
	}
}

/* Vérification du formulaire de contact */
function verifFormMail(){
var correct = true
if (!document.formContact.sexe[0].checked && !document.formContact.sexe[1].checked) {
	correct = false; 
	texte = 'Choisissez votre civilité !';
	alert(texte);
	return correct
	}
if (document.formContact.nom.value == "") {
	correct = false; 
	texte = 'Saisissez votre nom de famille !';
	alert(texte);
	return correct
	}
if (document.formContact.prenom.value == "") {
	correct = false; 
	texte = 'Saisissez votre prénom !';
	alert(texte);
	return correct
	}
if (document.formContact.email.value == "") {
	correct = false; 
	texte = 'Saisissez votre adresse E-mail !';
	alert(texte);
	return correct
	}
if (document.formContact.email.value.indexOf("@")==-1) {
	correct = false; 
	texte = 'Votre adresse E-mail n\'est pas valide !';
	alert(texte);
	return correct
	}
if (document.formContact.contenu.value == "") {
	correct = false; 
	texte = 'Veuillez indiquer votre message !';
	alert(texte);
	return correct
	}
return correct
}

/* verification du login client */
function verifLog(){
var logon = true
if (document.connexion.LOGIN.value == "" || document.connexion.LOGIN.value == "Code d'Accès") {
	logon = false; 
	alert("Veuillez indiquer votre code d'accès !");
	document.connexion.LOGIN.value = "Code d'Accès"; 
	document.connexion.LOGIN.style.color='#ff931f';
	return logon;
}else{
    document.connexion.action = "http://82.97.9.50/cgi-bin/dixdata/admin/verif_logins.py";
}
if (document.connexion.PASSWORD.value == "" || document.connexion.PASSWORD.value == "motdepasse") {
	logon = false; 
	alert("Veuillez indiquer votre Mot de passe !");
	document.connexion.PASSWORD.value = "motdepasse"; 
	document.connexion.PASSWORD.style.color='#ff931f';
	return logon;
}
return logon
}
/* vidage des champs de log au click */
function videLog(id,valeur){
  if(valeur != '' && (valeur=='Code d\'Accès' || valeur=='motdepasse')){
    document.getElementById(id).value = '';
	document.getElementById(id).style.color='#ACB7BF';
  }
}
function rempliLog(id,valeur){
  if(id == 'LOGIN' && valeur == ''){
    document.getElementById(id).value = 'Code d\'Accès';
	  document.getElementById(id).style.color='#ACB7BF';
  }
  if(id== 'PASSWORD' && valeur == ''){
    document.getElementById(id).value = 'motdepasse';
	  document.getElementById(id).style.color='#ACB7BF';
  }
}