/***********/
/** Email **/
/***********/
function mail(u, c)
{
	d_o_m_a_i_n = '3vis.com';
	fullAlias = u + "&#64;" + d_o_m_a_i_n;
	document.write("<div class=" + c + "><a href=mailto:" + fullAlias + ">" + fullAlias + "</a></div>");
}

/*****************/
/** Window Size **/
/*****************/
function getBrowserHeight() 
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	return myHeight;
}

/**********/
/** Menu **/
/**********/
var elementArray = new Array(4);
var submenuOpened = "";
var submenuTimer = null;

function showMenu(id) 
{
	var d = document.getElementById(id);

	for (var i = 0; i<=elementArray.length; i++)
	{
		if (document.getElementById(elementArray[i]))
		{
			hideMenu(elementArray[i]);
		}
	}

	if (d) 
	{
		d.style.display='block';
		submenuOpened = id;
	}
}	

function hideMenu(id) 
{
	var d = document.getElementById(id);

	if (d) 
	{
		d.style.display='none';
		submenuOpened = "";
		if (submenuTimer) {
			clearInterval(submenuTimer);
			submenuTimer = null;
		}
	}
}

function menuTimerCallback(id)
{
	hideMenu(id);		
}

function menuRollout(id)
{
	if (submenuOpened == id && !submenuTimer) {
		submenuTimer = setInterval("menuTimerCallback('"+id+"')", 500);
	}
}

function menuRollover(id)
{	
	if (submenuOpened == id && submenuTimer) {
		clearInterval(submenuTimer);
		submenuTimer = null;
	}
}
		
function addElement(element)
{
	elementArray[elementArray.length] = element;
}
	
/*******************/
/** inlineBrowser **/
/*******************/

function closeURLInline(divID)
{
	var d = document.getElementById(divID);
	if (d) {
		d.innerHTML = '';
	}
}

function openURLInline(divID, url, imageURL)
{
	var d = document.getElementById(divID);
	var height = getBrowserHeight();
	
	if (d) {
		d.innerHTML = '<div onclick="closeURLInline(\''+divID+'\')"><img src="'+ imageURL + '" border="0"></div><div style="clear:both;"><!--empty--></div><iframe src="'+url+'" frameborder="0" height="'+height+'"></iframe>';
	}
}

/******************/
/** Consultation **/
/******************/
var itemList = new Array();
var textOpened = "";
var overOpened = "";
var itemTimer = null;
var clickActive = null;

function itemShow(id) 
{
	var d = document.getElementById(id);

	for (var i = 0; i<=itemList.length; i++)
	{
		if (document.getElementById(itemList[i]))
		{
			itemHide(itemList[i]);
		}
	}

	if (d) 
	{
		document.getElementById(id).style.display = 'none';
		document.getElementById(id + "_text").style.display = 'none';
		overOpened = id;
	}
}

function itemShowText(id)
{
	var d = document.getElementById(id);

	for (var i = 0; i<=itemList.length; i++)
	{
		if (document.getElementById(itemList[i]))
		{
			itemHide(itemList[i]);
		}
	}

	if (d) 
	{
		document.getElementById(id).style.display = 'none';
		document.getElementById(id + "_text").style.display = 'block';
		textOpened = id;
	}
}

function itemHide(id) 
{
	var d = document.getElementById(id);

	if (d) 
	{
		if(id == textOpened)
		{
			document.getElementById(id).style.display = 'none';
			document.getElementById(id + "_text").style.display = 'block';
		}
		else
		{
			document.getElementById(id).style.display = 'block';
			document.getElementById(id + "_text").style.display = 'none';
		}
		
		if (itemTimer) 
		{
			clearInterval(itemTimer);
			itemTimer = null;
		}
	}
}

function itemTimerCallback(id)
{
	itemHide(id);
}

function itemRollout(id)
{
	if (overOpened == id && !itemTimer) 
	{
		itemTimer = setInterval("itemTimerCallback('"+id+"')", 50);
		overOpened = "";
	}
}

function itemRollover(id)
{
	if (textOpened == id )
	{
		overOpened = "";
		if( overOpened != "" && overOpened != id && itemTimer) 
		{
			clearInterval(itemTimer);
			itemTimer = null;
		}
	}
	else 
	{
		itemShow(id);
	}
}	

function itemClick(id)
{
	textOpened = "";
	itemShowText(id);
}

function itemAdd(id)
{
	itemList.push(id);
}


/******************/
/** Consultation **/
/******************/
var popupWindow = null;

function newsPopupImage( url, width, height )
{
	var maxWidth = 1200;
	var maxHeight = 768;

	if(popupWindow != null)
		popupWindow.close();
	
	width = width + 15;
	height = height + 15;
	
	if( width > maxWidth )
		width = maxWidth;
	
	if( height > maxHeight )
		height = maxHeight;
		
	popupWindow = window.open(url, 'ImgZoom', 'height='+height+',width='+width+',status=no,toolbar=no,menubar=no,location=no');
	popupWindow.focus();
}

/******************/
/**   Accueil    **/
/******************/

function newsletterRollOver(element, src)
{
	element.src = src;
}

function newsletterRollOut(element, src)
{
	element.src = src;
}

function submit_newsletter_inscription(id)
{
	document.getElementById('discard').name='NewButton';
	document.getElementById(id).submit();
}

/******************/
/**   Service    **/
/******************/
function submenu_link_over(element)
{
	element.className = "submenu_content_over";
}

function submenu_link_out(element)
{
	element.className = "submenu_content_out";
}