function swaprestor() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImg() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImg.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}


function findObj(n, d) {
  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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImg() {
  var i,j=0,x,a=swapImg.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function NewWindow(mypage, myname, w, h, scroll,redimens) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+redimens+''
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// ex. syntaxe : <a href="javascript:NewWindow('mapage.asp','',300,300,0,0)" >

function showpopup (url, w, h)
	{
	link=window.open(url,'show','width='+w+',height='+h+',scrollbars=yes,menubar=yes,resizable=no,copyhistory=no,status=no,toolbar=no,location=no,directories=no,status=no,top=10,left=10');
	}

function fenadapte(mypage, myname, scroll, menu, pourc) {
var winl = (screen.width - (screen.width*pourc/100)) / 2;
var wint = (screen.height - (screen.height*(pourc-10)/100)) / 2;
winprops = 'height='+screen.height*(pourc-10)/100+',width='+screen.width*pourc/100+',top='+wint+',left='+winl+',scrollbars='+scroll+',menubar='+menu+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function promopop()
	{
	var Wwidth=620; // largeur pop
	var Wheight=110 // hauteur pop
	var Wtop=120;   // top pop
	var centre_frame = ((screen.width - 126)- Wwidth) / 2;  // calcul des pixels restant de chaque côté du pop dans frame blanche
	var Wleft=110 + centre_frame;   // pour center dans la frame blanche
	
	url="parrain/poppar.htm"  // pop à afficher
		link=window.open(url,'show','width='+Wwidth+',height='+Wheight+',scrollbars=no,toolbar=no,location=no,menubar=no,directories=no,status=no,top='+Wtop+',left='+Wleft+'');
	}

	function promopop2()
	{
	var nomfich="casino"  // nom du fichier pop
	var Wwidth=250; // largeur pop
	var Wheight=250 // hauteur pop
	var Wtop=118;   // top pop
	//var centre_frame = ((screen.width - 126)- Wwidth) / 2;  // calcul des pixels restant de chaque côté du pop dans frame blanche
	var Wleft=130   // pour center dans la frame blanche
	
	url="chart/pop/pop"+nomfich+".htm"  // pop à afficher
		link=window.open(url,'show','width='+Wwidth+',height='+Wheight+',scrollbars=no,toolbar=no,location=no,menubar=no,directories=no,status=no,top='+Wtop+',left='+Wleft+'');
	}
	
function showHideLayers() { //v3.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=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; }
}

// rollover sur bouton form
// ne fonctionne pas avec Fx
function highlightButton(s) {
nav = navigator.appName.substring(0,3);
ver = navigator.appVersion.substring(0,1)
if ((nav == "Mic" && ver >= 4))
{
    if ("INPUT"==event.srcElement.tagName)
      event.srcElement.className=s
  }
}
  
  
function eclaire(image,lux)
{ 
if (lux==0) image.filters.alpha.opacity=100 
else image.filters.alpha.opacity=20
}   
  
function closewin() {
window.opener = self;
self.close();
}

// Confirmation de suppression  
function confirmeSupp (ref)
	{
	var ouinon = confirm("La suppression du numéro "+ref+" sera DEFINITIVE !\n\nConfirmer = OK\nNon = Annuler");
	if (ouinon)
		return true;
	else
		return false;
	}
	
	
/******************************/
/* validation comptes clients*/
/******************************/

function CtrlLogin(Form)
{

	 if (Form.login.value == "") // login doit etre renseigne 
  {
  	 alert("Veuillez renseigner votre compte");
    Form.login.focus();
    return (false);
  }
	
	if ((Form.login.value !="") &&(isNaN(Form.login.value) == true))  // si login non numérique alors e-mail correct
	{
	testm = false ;
	var string1=Form.login.value
	
	for (var j=1 ; j<(string1.length) ; j++) {
			if (string1.charAt(j)=='@') { 
				if (j<(string1.length-4)){ 
					for (var k=j ; k<(string1.length-2) ; k++) { 
				if (string1.charAt(k)=='.') testm = true; 
			} 
			} 
			} 
			} 
	
 	 if ((string1.indexOf("@")==-1) || (string1.length< 8) || (string1.indexOf(".")==-1) || (string1.indexOf(" ")  != -1) || (string1.indexOf("www")  != -1) || (string1.indexOf("http")  != -1) || (testm==false))
  	{
  	alert("Vous avez commis une erreur dans votre compte.");
    Form.login.value="";
	Form.login.focus();
    return (false);
  }
   }

	if ((Form.login.value !="") &&(isNaN(Form.login.value) == false) &&(Form.login.value.length >5)) // si numérique, pas + de 5 caractères
	{
  	alert("Vous avez commis une erreur dans votre compte.");
    Form.login.value="";
	Form.login.focus();
    return (false);
  }
 
	
  if (Form.password.value == "")
  {
  	 alert("Veuillez renseigner votre mot de passe.");
    Form.password.focus();
    return false
  }
  return (true);
}

/******************************/
/* validation newsletter*/
/******************************/

function setColor(el, bg)
{
  if (el.style) el.style.backgroundColor = bg;
}

function CtrlNewsletter(Form)
{
	var bgBad = "#FFFFCC";
    
  if (Form.myemail.value == "" || Form.myemail.value == "mon email")
  {
  	setColor(Form.myemail, bgBad);
    alert("Veuillez renseigner votre adresse e-mail.\n\nCelle-ci est indispensable pour recevoir\nnotre lettre d'information");
    Form.myemail.focus();
    return (false);
  }
  	
  var string1=Form.myemail.value
 	 if ((string1.indexOf("@")==-1) || (string1.length< 8) || (string1.indexOf(".")==-1) || (string1.indexOf(" ")  != -1) || (string1.indexOf("www")  != -1) || (string1.indexOf("http")  != -1))
  {
    setColor(Form.myemail, bgBad);
	alert("Veuillez entrer une adresse e-mail valide.");
    Form.myemail.focus();
    return false
  }
  
return (true);
}
  
// images à préloader  
function chargerolls() 
 { 
 preloadImg('../img/accueil2.gif','../img/ok2.gif','../img/chercher2.gif','../img/flecheD2.gif','../img/fl_up2.gif','../img/fl_dn2.gif','../img/imp2.gif','../img/flchtop2.gif','../img/3offres2.gif','../img/send_cv2.gif','../img/envoyer2.gif','../img/modifier2.gif','../img/send_cv_www2.gif','../img/send_cv_mail2.gif','../img/small_print2.gif');
 }  
    

