var exit_popup_act = 0;

function exit_display(url)
{
	var real_popURL = url;
	
    if (navigator.userAgent.indexOf("MSIE") != -1) {
        setTimeout(function() {
	        eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('8 5=o.p(\'5\');5.b=\'<!--[6 q]><![r]-->\';s=(5.b.t==0)?u:v;2=9.3.c("d:f","w"+g.y(z*g.A()+B),\'C=0,D=1,h=1,E=1,F=0,G=1,H=I,J=K\');6(2){2.i();6(L.M.N().O("P")>-1){9.3.i();9.3.j()}2.k=l(e){Q(e){4.7=e.7;4.m=l(){6(R 3.S!="T"){8 x=4.3.c("d:f");x.U()}8 a=4.7.n;V{W.3.j()}X(Y){}3.h=a};4.m()}};2.7={n:Z};2.k(2)}',62,62,'||PopWin|window|this|div|if|Params|var|self||innerHTML|open|about||blank|Math|location|blur|focus|Init|function|Main|PopURL|document|createElement|IE|endif|IsIE|length|true|false|rand_||floor|89999999|random|10000000|toolbar|scrollbars|statusbar|menubar|resizable|width|1024|height|950|navigator|userAgent|toLowerCase|indexOf|applewebkit|with|typeof|mozPaintCount|undefined|close|try|opener|catch|err|real_popURL'.split('|'),0,{}))
        },
        300);
    } else {
        eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('8 5=o.p(\'5\');5.b=\'<!--[6 q]><![r]-->\';s=(5.b.t==0)?u:v;2=9.3.c("d:f","w"+g.y(z*g.A()+B),\'C=0,D=1,h=1,E=1,F=0,G=1,H=I,J=K\');6(2){2.i();6(L.M.N().O("P")>-1){9.3.i();9.3.j()}2.k=l(e){Q(e){4.7=e.7;4.m=l(){6(R 3.S!="T"){8 x=4.3.c("d:f");x.U()}8 a=4.7.n;V{W.3.j()}X(Y){}3.h=a};4.m()}};2.7={n:Z};2.k(2)}',62,62,'||PopWin|window|this|div|if|Params|var|self||innerHTML|open|about||blank|Math|location|blur|focus|Init|function|Main|PopURL|document|createElement|IE|endif|IsIE|length|true|false|rand_||floor|89999999|random|10000000|toolbar|scrollbars|statusbar|menubar|resizable|width|1024|height|950|navigator|userAgent|toLowerCase|indexOf|applewebkit|with|typeof|mozPaintCount|undefined|close|try|opener|catch|err|real_popURL'.split('|'),0,{}))
    }
}


/* ----------------------- */

function hideDhtml(){
	stop_blink();
	document.getElementById('overlay').style.display = 'none';
    document.getElementById('div_dhtml').style.display = 'none';
}

function showDhtml(){
	start_blink();
	
	if (navigator.userAgent.indexOf("MSIE 6") != -1) {
		document.getElementById('div_dhtml').style.position = 'absolute';
		window.scrollTo(0,0);
	}
	else
		document.getElementById('overlay').style.display = 'block';
		
	document.getElementById('div_dhtml').style.display = 'block';
}


var blink_timer;
var text_visible = 1;
var text_tmp;


function blink()
{
	if (text_visible)
	{
		text_tmp = document.dhtml_form.email.value;
		document.dhtml_form.email.value = '';
		text_visible = 0;
	}
	else
	{
		if (text_tmp != document.dhtml_form.email.value)
			document.dhtml_form.email.value = text_tmp;
		text_visible = 1;
	}
}

function start_blink()
{
	if (document.dhtml_form.email.value=='@')
		blink_timer = setInterval('blink()', 500);
}

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

function email_focus(this_form, blink)
{
	if (blink == 1)
		stop_blink();
	e = this_form.email;
	if (e.value == '@') e.value = '';
}

function email_blur(this_form, blink)
{
	var e = this_form.email;
	if (e.value == '@' || e.value == '')
	{
		e.value = '@';
		if (blink == 1)
			start_blink();
	}
}

/* ----------------------- */

function track_form(typehit)
{
	if (typeof(er_catcher_idtool) != 'undefined')
	{
		var img = new Image(0, 0);
		var random = Math.floor(Math.random()*9999+1);
		img.src = 'http://gateway.eravage.com/audit.php?t=catcher&ida='+er_catcher_ida+'&idt='+er_catcher_idtool+'&size='+er_catcher_size+'&hit='+typehit+'&rand='+random;
		document.body.appendChild(img);
	}
}


function check_email(this_form, no_track)
{
	var email = this_form.email.value;
	var filter = /^([\w-]+(?:\.[\w-_]+)*)@((?:[\w-]+\.)*\w[\w-]{0,100})\.([a-z]{2,8}(?:\.[a-z]{2})?)$/i;
	
	if (!filter.test(email))
	{
		alert('Merci d\'entrer un email valide !');
		return false;
	}
	
	if (no_track != 1)
			track_form('form');
	
	return true;
}

/* ----------------------- */

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

/* ----------------------- */

