$(document).ready( function() {
	if ( ScanCookie("dejapopup") == 0 ) {
		$.getScript("/disclaimer.js");
	} else {
		if ( ScanCookie("popdhtml") == 0 )
		$.get("/index.php?js_call=true");
	}
});

var expDays = 1; 
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function marqueestart() {
	document.write('<marquee direction="right" scrollamount="3" onmouseover="this.scrollAmount=0" onmouseout="this.scrollAmount=3">');
}

function marqueeend() {
	document.write('</marquee>');
}

function visibilite(thingId) {
 var i;
 var targetElement;
 targetElement = document.getElementById("divid" + thingId) ;
 if ( targetElement.style.display == "none")
     targetElement.style.display = "" ;
 else
     targetElement.style.display = "none" ;
}

function Searchit (requete) {
	window.location.href='/search/'+this.requete.value.replace(' ','-')+'.html'; 
	return false;
}

function goto(id) {
	(new Image()).src="/goto.php?id="+id;
	return true;
}

function ScanCookie(variable) {
    cook = document.cookie;
    variable += "=";
    place = cook.indexOf(variable,0);
    if (place <= -1)
        return("0" );
    else
       {
        end = cook.indexOf(";",place)
        if (end <= -1) return(unescape(cook.substring(place+variable.length,cook.length)));
        else return(unescape(cook.substring(place+variable.length,end)));
       }
   }
function SetCookie(nom,valeur,permanent) {
    if(permanent)
       {
        dateExp = new Date(2020,11,11);
        dateExp = dateExp.toGMTString();
            ifpermanent = '; expires=' + dateExp + ';';
       }
    else
        ifpermanent = '';
    document.cookie = nom + '=' + escape(valeur) + ifpermanent + '; path = /';
   }
   
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = ScanCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function amt() {
	var count = ScanCookie('count')
	if(count == null) {
		SetCookie('count','1');
		return 1;
		}
	else {
		var newcount = parseInt(count) + 1;
		DeleteCookie('count');
		SetCookie('count',newcount,exp);
		return count;
		}
	}

function bookmarksite(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")
}

function checkCount() {
	var count = ScanCookie('count');
	if (count == null) {
		count=1;
		SetCookie('count', count, exp);
		
		var mwidth=screen.availHeight;
		var mheight=screen.availWidth;
		
		if (window.showModelessDialog) //si c est ie5 ou compatible IE5
		{

		window.showModelessDialog('http://www.eurolive.com/?id=48781&langue=fr&e=0&tracker=asexeunder&w=0&buying=1','',"help:0;resizable:1;dialogHeight: 400px; dialogWidth: 700px; edge:1 ; scrollbars:1 ; status:1 ; maximize:yes ; minimize:yes ; menubar:1 ")
		//window.showModelessDialog('http://www.allopass.com/check/red.php4?CA=X295713Z28U6B7','',"help:0;resizable:1;dialogHeight: 400px; dialogWidth: 700px; edge:1 ; scrollbars:1 ; status:1 ; maximize:yes ; minimize:yes ; menubar:1 ")
		
		// window.focus()
     	 window.focus();
		
        }
    else
        {
		var mheight=screen.Height;
		var mwidth=screen.Width;
		popunder = window.open('http://www.eurolive.com/?id=48781&langue=fr&e=0&tracker=asexeunder&w=0&buying=1','_blank','center=yes,toolbar=1,location=1,directories=0,status=0,scrollbars=1,resizable=1,copyhistory=0,menuBar=1,width='+mwidth+',height='+mheight+'')
		//popunder = window.open('http://www.allopass.com/check/red.php4?CA=X295713Z28U6B7','_blank','center=yes,toolbar=1,location=1,directories=0,status=0,scrollbars=1,resizable=1,copyhistory=0,menuBar=1,width='+mwidth+',height='+mheight+'')

     popunder.blur()
     window.focus(); //suprimer cette ligne pour faire un popup, suprimer uniqument le comentaire pour garder une popunder
		}
	 
		}
	else {
		count++;
		SetCookie('count', count, exp);
		}
	}
	
	document.onclick = checkCount;


