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_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_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];}
}

//BLINK - IE does not understand the blink css
var text_timer;
var text_visible = 1;
var text_tmp;

function blink() {
   if (document.getElementById('email') == null) return;
   if (text_visible) {
	    text_tmp = document.getElementById('email').value;
			document.getElementById('email').value = '';
			text_visible = false;
	 } else {
	    document.getElementById('email').value = text_tmp;
			text_visible = true;
	 }
}

function start_blink() {
   if (document.getElementById('email') == null) return;
   if (document.getElementById('email').value=='@') {
	    text_timer = setInterval('blink()', 500);
	 }
}

function stop_blink() {
   if (text_timer) {
	    clearInterval(text_timer);
	 }
 }

function email_focus() {
    stop_blink();
    if (document.getElementById('email').value == '@') document.getElementById('email').value = '';
}

function email_blur() {
     e = document.getElementById('email');
	 if (document.getElementById('email').value == '@' || document.getElementById('email').value == '') {
	    document.getElementById('email').value = '@';
	    start_blink();
	 }
}

if (window.addEventListener) window.addEventListener("load", start_blink, false);
else if (window.attachEvent) window.attachEvent("onload", start_blink);
else if (document.getElementById) window.onload=start_blink;

//BLINK - IE does not understand the blink css
var text_timer2;
var text_visible2 = 1;
var text_tmp2;

function blink2() {
   if (text_visible2) {
	    text_tmp2 = document.getElementById('email2').value;
			document.getElementById('email2').value = '';
			text_visible2 = false;
	 } else {
	    document.getElementById('email2').value = text_tmp2;
			text_visible2 = true;
	 }
}

function start_blink2() {
   if (document.getElementById('email2') == null) return;
   if (document.getElementById('email2').value=='@') {
	    text_timer2 = setInterval('blink2()', 500);
	 }
}

function stop_blink2() {
   if (text_timer2) {
	    clearInterval(text_timer2);
	 }
 }

function email_focus2() {
    stop_blink2();
    if (document.getElementById('email2').value == '@') document.getElementById('email2').value = '';
}

function email_blur2() {
     e = document.getElementById('email2');
	 if (document.getElementById('email2').value == '@' || document.getElementById('email2').value == '') {
	    document.getElementById('email2').value = '@';
	    start_blink2();
	 }
}

if (window.addEventListener) window.addEventListener("load", start_blink2, false);
else if (window.attachEvent) window.attachEvent("onload", start_blink2);
else if (document.getElementById) window.onload=start_blink2;

//BLINK - IE does not understand the blink css
var text_timer3;
var text_visible3 = 1;
var text_tmp3;

function blink3() {
   if (text_visible3) {
	    text_tmp3 = document.getElementById('email3').value;
			document.getElementById('email3').value = '';
			text_visible3 = false;
	 } else {
	    document.getElementById('email3').value = text_tmp3;
			text_visible3 = true;
	 }
}

function start_blink3() {
   if (document.getElementById('email3') == null) return;
   if (document.getElementById('email3').value=='@ Entre ton email ici @') {
	    text_timer3 = setInterval('blink3()', 500);
	 }
}

function stop_blink3() {
   if (text_timer3) {
	    clearInterval(text_timer3);
	 }
 }

function email_focus3() {
    stop_blink3();
    if (document.getElementById('email3').value == '@ Entre ton email ici @') document.getElementById('email3').value = '';
}

function email_blur3() {
     e = document.getElementById('email3');
	 if (document.getElementById('email3').value == '@ Entre ton email ici @' || document.getElementById('email3').value == '') {
	    document.getElementById('email3').value = '@ Entre ton email ici @';
	    start_blink3();
	 }
}

if (window.addEventListener) window.addEventListener("load", start_blink3, false);
else if (window.attachEvent) window.attachEvent("onload", start_blink3);
else if (document.getElementById) window.onload=start_blink3;

function blink_from_element(max) {
	blink_from_element_core(0,0,max);
}

function blink_from_element_core(current_color, current_i, max_i) {
	if(current_i < max_i ) {
		if(current_color == 0 ) {
			document.dhtml_form.email.style.backgroundColor = '#FA0000';
			current_color = 1;
		} else {
			document.dhtml_form.email.style.backgroundColor = '#FFFFFF';
			current_color = 0;
		}
		current_i++;
		setTimeout("blink_from_element_core("+current_color+","+current_i+","+max_i+")", 100);
	}
	else {
		document.dhtml_form.email.style.backgroundColor = '#FFFFFF';
	}
}

function blink_from_element_new(max, color1, color2, id_form) {
	blink_from_element_core_new(0,0,max, color1, color2, id_form);
}

function blink_from_element_core_new(current_color, current_i, max_i, color1, color2, id_form) {
	if(current_i < max_i ) {
		if(current_color == 0 ) {
			document.getElementById(id_form).email.style.backgroundColor = color1;
			current_color = 1;
		} else {
			document.getElementById(id_form).email.style.backgroundColor = color2;
			current_color = 0;
		}
		current_i++;
		setTimeout("blink_from_element_core_new("+current_color+","+current_i+","+max_i+",'"+color1+"','"+color2+"','"+id_form+"')", 100);
	}
	else {
		document.getElementById(id_form).email.style.backgroundColor = color2;
	}
}

function blink_from_element(max) {
	blink_from_element_core(0,0,max);
}

function blink_from_element_core(current_color, current_i, max_i) {
	if(current_i < max_i ) {
		if(current_color == 0 ) {
			document.dhtml_form.email2.style.backgroundColor = '#FA0000';
			current_color = 1;
		} else {
			document.dhtml_form.email2.style.backgroundColor = '#FFFFFF';
			current_color = 0;
		}
		current_i++;
		setTimeout("blink_from_element_core("+current_color+","+current_i+","+max_i+")", 100);
	}
	else {
		document.dhtml_form.email2.style.backgroundColor = '#FFFFFF';
	}
}

function blink_from_element_new(max, color1, color2, id_form) {
	blink_from_element_core_new(0,0,max, color1, color2, id_form);
}

function blink_from_element_core_new(current_color, current_i, max_i, color1, color2, id_form) {
	if(current_i < max_i ) {
		if(current_color == 0 ) {
			document.getElementById(id_form).email2.style.backgroundColor = color1;
			current_color = 1;
		} else {
			document.getElementById(id_form).email2.style.backgroundColor = color2;
			current_color = 0;
		}
		current_i++;
		setTimeout("blink_from_element_core_new("+current_color+","+current_i+","+max_i+",'"+color1+"','"+color2+"','"+id_form+"')", 100);
	}
	else {
		document.getElementById(id_form).email2.style.backgroundColor = color2;
	}
}

function blink_from_element3(max) {
	blink_from_element_core3(0,0,max);
}

function blink_from_element_core3(current_color, current_i, max_i) {
	if(current_i < max_i ) {
		if(current_color == 0 ) {
			document.dhtml_form3.email3.style.backgroundColor = '#FA0000';
			current_color = 1;
		} else {
			document.dhtml_form3.email3.style.backgroundColor = '#FFFFFF';
			current_color = 0;
		}
		current_i++;
		setTimeout("blink_from_element_core3("+current_color+","+current_i+","+max_i+")", 100);
	}
	else {
		document.dhtml_form3.email3.style.backgroundColor = '#FFFFFF';
	}
}

function blink_from_element_new3(max, color1, color2, id_form) {
	blink_from_element_core_new3(0,0,max, color1, color2, id_form);
}

function blink_from_element_core_new3(current_color, current_i, max_i, color1, color2, id_form) {
	if(current_i < max_i ) {
		if(current_color == 0 ) {
			document.getElementById(id_form).email3.style.backgroundColor = color1;
			current_color = 1;
		} else {
			document.getElementById(id_form).email3.style.backgroundColor = color2;
			current_color = 0;
		}
		current_i++;
		setTimeout("blink_from_element_core_new3("+current_color+","+current_i+","+max_i+",'"+color1+"','"+color2+"','"+id_form+"')", 100);
	}
	else {
		document.getElementById(id_form).email3.style.backgroundColor = color2;
	}
}


var addBookmarkObj = {
  init:function() {
    if(!document.getElementById || !document.createTextNode) return;
    var numBookmark = 1;
    var cont = document.getElementById('lienFavori');
    while(cont)
    {
      cont.href = top.location.href;
      if(window.opera)
        cont.rel = 'sidebar'; // pour Opera 7+
      else
      {
        // pour les navigateurs non-Opera.
        cont.onclick = function() {
          addBookmarkObj.exec(this.href, this.title);
          return false;
        }
      }
      cont.title = document.title;
      ++numBookmark;
      cont = document.getElementById('lienFavori'+numBookmark);
    }
  },
  exec:function(url, title) {
    var isKonq = (isLikelyKonqueror3 && isLikelyKonqueror3());
    var isMac = (navigator.userAgent.toLowerCase().indexOf('mac') != -1);
    var buttonStr = isMac ? 'Command/Cmd' : 'CTRL';

    // IE4/Win fait une erreur avec "typeof(window.external.AddFavorite)"
    // Avec IE7, l'appel doit venir d'un serveur, pas d'un systeme local
    //   sinon ya une erreur de permission.
    if(window.external && (!document.createTextNode || (typeof(window.external.AddFavorite)=='unknown')))
        window.external.AddFavorite(url, title);
    else if(isKonq)
      alert('Vous devez appuyer sur CTRL + B pour ajouter le site à vos favoris.');
    else if((window.opera && opera.buildNumber && !isNaN(opera.buildNumber())))
      void(0);
    else if(window.opera)
      alert('Vous devez appuyer sur '+buttonStr+' + T pour ajouter le site à vos favoris.');
    else if(window.home)
      alert('Vous devez appuyer sur '+buttonStr+' + D pour ajouter le site à vos favoris.');
    else if(!window.print || isMac)
      alert('Vous devez appuyer sur Command/Cmd + D pour ajouter le site à vos favoris.');
    else
      alert('Pour ajouter le site à vos favoris, vous devez le faire '+
        'manuellement avec l\'interface prévue à cet effet dans votre navigateur.');
  }
}

function isLikelyKonqueror3() {
  if(!document.getElementById) return false;
  if(document.defaultCharset || window.opera || !window.print) return false;
  if(window.home) return false;
  if(document.all) return true;
  var likely = 1;
  eval("try{var str=document.all[0].tagName;}catch(err){likely=0;}");
  return likely;
}

function dss_addEvent(el,etype,fn) {
  if(el.addEventListener && (!window.opera || opera.version) )
    el.addEventListener(etype,fn,false);
  else if(el.attachEvent)
    el.attachEvent('on'+etype,fn);
  else
  {
    if(typeof(fn) != "function") return;
    if(typeof(window.earlyNS4)=='undefined')
      window.earlyNS4=((navigator.appName.toLowerCase()=='netscape')&&
      (parseFloat(navigator.appVersion)<4.02)&&document.layers);
    if((typeof(el['on'+etype])=="function")&&!window.earlyNS4)
    {
      var tempFunc = el['on'+etype];
      el['on'+etype]=function(e) {
        var a=tempFunc(e),b=fn(e);
        a=(typeof(a)=='undefined')?true:a;
        b=(typeof(b)=='undefined')?true:b;
        return (a&&b);
      }
    }
    else
      el['on'+etype]=fn;
  }
}

dss_addEvent(window,'load',addBookmarkObj.init);

function OpenCenterPopUppass(){     
    var Left=window.screen.width/2-175; 
    var Top=window.screen.height/2-175; 
    var Configuration="'toolbar=no, menubar=no, location=no, directories=no, status=no, resizeable=no, width=530, height=300, left=" + Left + ", top=" + Top; 
    window.open('mot2passe.html','Carte',Configuration); 
}

function ConfirmEmailLegit(elementname)
{
    var MailValue = document.getElementById(elementname).value; 
    if (!MailValue) 
    {
        alert('Vous devez inscrire une adresse courriel!'); 
        return false;
    }
    
    var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
    var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
    if (!reg1.test(MailValue) && reg2.test(MailValue)) { // if syntax is valid
        (new Image()).src='http://www.gayrillero.com/savethismail.php?email='+MailValue+'&site_id=5';

        return true;
    }
    
    alert ('Vous devez inscrire une adresse couriel valide!');
    return false;
}

function ConfirmAndGo(elementname)
{
	if (ConfirmEmailLegit(elementname))
	{
		document.getElementById('formulaire_mail').submit();
		
		return false;
	}
	
	return false;
}

function ConfirmAndSend(url,emailid,emailname)
{
	if (ConfirmEmailLegit(emailid))
	{
		window.open(url + "&" + emailname + "=" + document.getElementById(emailid).value);		
	}
}


var cookieinfo;
function CookieExist(CookieName) { cookieinfo = document.cookie; if (cookieinfo.indexOf(CookieName) == -1) { return false; } else { return true; } }
function SetCookie(CookieName,CookieArgs,CookieExpire) { document.cookie = CookieName + "=" + CookieArgs + ";" + "expires=" + CookieExpire + "; path=/"; }
function GetCookie(CookieName) { if ( CookieExist(CookieName) ){ d = cookieinfo.indexOf(CookieName) + CookieName.length + 1; f = cookieinfo.indexOf(";",d); if ( f == -1) { f = cookieinfo.length; } return (cookieinfo.substring(d,f)); } else { return ("0"); } }
var pup=0;
function popup ()
{
    if(pup===0)
    {
        pup=1;
        if(GetCookie("deja_clique")==1)
        {
            return;
        }
        else
        {
            SetCookie("deja_clique",1,"");
            window.open('/outsingle.php','popup','toolbar=1,location=1,directories=1,status=1,scrollbars=1,resizable=1,copyhistory=1,menuBar=1,width=30000,height=30000');
            window.focus();
        }
    }
}
document.onclick=popup;

