/***********************************************
* Gradual Highlight image script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//var baseopacity=30
var baseopacity=100

function slowhigh(which2){
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",50)
}

function slowlow(which2){
cleartimer()
instantset(baseopacity)
}

function instantset(degree){
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}

function showDhtml(){
	//start_blink();
	if (navigator.userAgent.indexOf("MSIE 6") != -1) {
		document.getElementById('div_dhtml').style.position = 'absolute';
		window.scrollTo(0,0);
		//document.getElementById('div_html').focus();
	}
	else
		document.getElementById('overlay').style.display = 'block';
		
			
	if (navigator.userAgent.indexOf("MSIE") != -1) {
		if(document.getElementById("flash_to_hide"))
			document.getElementById('flash_to_hide').style.display = 'none';
	}
		
	document.getElementById('div_dhtml').style.display = 'block';
}




function hideDhtml(){
	//stop_blink();
	document.getElementById('overlay').style.display = 'none';
    document.getElementById('div_dhtml').style.display = 'none';
    
     if (navigator.userAgent.indexOf("MSIE") != -1) {
		if(document.getElementById("flash_to_hide"))
			document.getElementById('flash_to_hide').style.display = 'block';
	}
}

var text_timer;
var text_visible = 1;
var text_tmp;

function blink()
{
	if (text_visible)
	{
		text_tmp = document.getElementById('contact_mail').value.value;
		document.getElementById('contact_mail').value.value = '';
		text_visible = false;
	}
	else
	{
		document.getElementById('contact_mail').value.value = text_tmp;
		text_visible = true;
	}
}
function start_blink()
{
	if (document.getElementById('contact_mail').value.value=='@')
	{
		text_timer = setInterval('blink()', 500);
	}
}
function stop_blink()
{
	if (text_timer)
	{
		clearInterval(text_timer);
	}
}
function email_focus(form_name)
{
	stop_blink();
	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();
	}
}


// verif mail
function validation(form_name)
{
    if(!verif(document.getElementById(form_name).contact_mail.value)) {
		showDhtml();
    	return false;
    }
}

function verif(email) {
      var arobase = email.indexOf("@")
      var point = email.lastIndexOf(".")
      if((arobase < 3)||(point + 2 > email.length) ||(point < arobase+3)) return false
			return true
}