var text_timer;
var text_visible = 1;
var text_tmp;

function blink()
{

	if (text_visible)
	{
		text_tmp = document.form_dhtml.contact_mail.value;
		document.form_dhtml.contact_mail.value = '';
		text_visible = false;
	}
	else
	{
		document.form_dhtml.contact_mail.value = text_tmp;
		text_visible = true;
	}

}

var text_timer_default;
var text_visible_default = 1;
var text_tmp_default;

function blink_default()
{

	if (text_visible_default)
	{
		text_tmp_default = document.form_dhtml_default.contact_mail.value;
		document.form_dhtml_default.contact_mail.value = '';
		text_visible_default = false;
	}
	else
	{
		document.form_dhtml_default.contact_mail.value = text_tmp_default;
		text_visible_default = true;
	}

}

function start_blink()
{
	if (document.form_dhtml) {
		if (document.form_dhtml.contact_mail.value=='@') {
			text_timer = setInterval('blink()', 500);
		}
	}
}

function start_blink_default()
{
	
	if (document.form_dhtml_default) {
		if (document.form_dhtml_default.contact_mail.value=='@') {
			text_timer_default = setInterval('blink_default()', 500);
		}
	}
}

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

function stop_blink_default()
{
	if (text_timer_default)
	{
		clearInterval(text_timer_default);
	}
}

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

function email_focus_default(form_name)
{
	stop_blink_default();
	e = document.getElementById(form_name).contact_mail;
	if (e.value == '@') e.value = '';
}


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

function email_blur_default(form_name)
{
	e = document.getElementById(form_name).contact_mail;
	if (e.value == '@' || e.value == '')
	{
		e.value = '@';
		start_blink_default();
	}
}

// verif mail
function validation(form_name)
{
    if(!verif(document.getElementById(form_name).contact_mail.value)) {
    	return false;
    } else {
    	return true;
    }
}

function verif(email) { 
	var arobase = email.indexOf("@")
	var point = email.lastIndexOf(".")
	if((arobase < 3)||(point + 2 > email.length) ||(point < arobase+3)){
		return false;
	}
	else {
		return true;
	}
}

function popunder(url,name) {
	if (url && url != '' && name && name != '') {
		fenpop = window.open(url, name, "toolbar=yes, scrollbars=yes, menubar=yes, location=yes, resizable=yes");
		if (fenpop) {
			fenpop.blur();
		}
		window.focus();
	}
}

function changepic(i,code)
{ var loop=0;

	if (stat[code])
	{
		while ((pics[code][i]==0 || i>=16) && loop<100)
		{ if (i>=16) { i=0; }
			else
			{ i++;
			}		
			loop++;
		}
		
		if (pic[code][i]) {
			if (pic[code][i].complete)
			{	
				if (document.getElementById(code)) {
					document.getElementById(code).src=pic[code][i].src;
				}
				
				if (document.getElementById('dhtml_img0_320x240')) {
					document.getElementById('dhtml_img0_320x240').src=pic[code][i].src;
				}
				setTimeout("changepic("+(i+1)+",'"+code+"')",500);
			}
			else
			{	
				setTimeout("changepic("+i+",'"+code+"')",20);
			}
		}
	}
	
	
}

function loadpic(url,code,j)
{	if (stat[code]) { pic[code][j].src=url; }
}

function startm(code,ta,te)
{	stat[code]=1;
	var jj, jjj;
	var first=1;
		
	for(var j=0;j<16;j++)
	{ if (pics[code][j]==1)
		{ pic[code][j]=new Image();
			jj=j+1;
			if (first) { first=0; loadpic(ta+jj+te,code,j); }
			else { setTimeout("loadpic('"+ta+jj+te+"','"+code+"',"+j+")",j*50); }
		}
	}
	changepic(0,code);
}

function endm(code)
{	stat[code]=0;
}


function showFlash() {
	if (document.getElementById('flash_to_hide1')) {
		document.getElementById('flash_to_hide1').style.display='block';
	}
	if (document.getElementById('flash_to_hide2')) {
		document.getElementById('flash_to_hide2').style.display='block';
	}
}

function hideFlash() {
	if (document.getElementById('flash_to_hide1')) {
		document.getElementById('flash_to_hide1').style.display='none';
	}
	if (document.getElementById('flash_to_hide2')) {
		document.getElementById('flash_to_hide2').style.display='none';
	}
}

function hideDhtmlDefault() {
	document.getElementById('overlay_default').style.display = 'none';
    document.getElementById('div_dhtml_default').style.display = 'none';
}
