// Browser Detection
if ((document.all)&&(document.getElementById)) ie = true; else ie = false;

// Navigate Function (All Browsers)
function JumpTo(e)
{
	location.href = e;
}

// Navigate Function (All Browsers)
function JumpToTemp(e,link)
{
	if(e.ctrlKey && e.shiftKey)
	{
		alert("Bypass Sequence Activated");
		location.href = link;
	}
	else
		alert("English version is under construction\n\nPlease come back soon...");	
}

// Alert Function (All Browsers)
function AlertMe(msg)
{   	
	alert(msg);
}

// Global MouseOver (All Browsers)
function mOver(e,filter) 
{
	if(ie) e = event.srcElement; else e = e.target;
	
	switch(e.tagName)
	{
		case "IMG":
			e.style.cursor = "pointer";
			if(filter != null)
			{
				e.setAttribute("oldImage", e.src);						
				e.src = filter;
			}
			break;
		
		case "B": 
			if(e.parentNode.tagName == "TD")
			{
				e.parentNode.style.cursor = "pointer";
				e.parentNode.style.textDecoration = "underline";
			}
			break;
			
		case "TD": 
			e.style.cursor = "pointer";
			e.style.textDecoration = "underline";
			break;
	}
}	

// Global MouseOut (All Browsers)
function mOut(e)
{   	
	if(ie) e = event.srcElement; else e = e.target;	
	
	switch(e.tagName)
	{
		case "IMG":
			if(e.getAttribute("oldImage"))
				e.src = e.getAttribute("oldImage");
			break;
		
		case "B": 
			if(e.parentNode.tagName == "TD")
			{
				e.parentNode.style.textDecoration = "none";
			}
			break;
			
		case "TD":
			e.style.textDecoration = "none";
			break;
	}
}

// Random Rotation (All Browsers)
// DESCIPTION:
// This function will randomly display elements part of a collection when the page
// is loaded. Can be used is all pages and customized to each of them. 
//
// USAGE:
// Create any html element and set the element style seting to "display:none" via css
// or directly on the element opening tag. Add a unique id with a incrementing number
// ex: id="test1", id="test2", id="test3"... thus creating a collection.
// Finally call the JRandom(ObjectCount,Context) function at the end of the page.
// Replace "ObjectCount" by the number of objects in your collection and "Context" by
// a unique case to be defined in the functions switch{}.

var JRandomObj = "";
var JRandomIndex = 1;
var JRandomCount = "";
var JRandomContext = "";

function JRandom(c,context,override)
{	
	JRandomCount = c;	
	JRandomContext = context;
	JRandomIndex = Math.round(Math.random()*JRandomCount);
	
	if(JRandomIndex == 0)
		JRandomIndex = 1;	

	if(override)
		JRandomIndex = override;
	
	if(show != "")
	{
		if(Number(show) <= JRandomCount && Number(show) > 0)
			JRandomIndex = show;
		else
			JRandomIndex = 1;
	}
		
	if(JRandomContext)
	{
		switch(JRandomContext)
		{
			case "default":
				if (document.getElementById("index_ref"+JRandomIndex))
				{
					document.getElementById("index_ref"+JRandomIndex).className = "Show";							
				}
				break;

			case "clients":
				if (document.getElementById("index_ref"+JRandomIndex))
				{
					document.getElementById("index_ref"+JRandomIndex).className = "Show";					
					document.getElementById("link_ref"+JRandomIndex).style.color = "#FFFFFF";						
					document.getElementById("link_ref"+JRandomIndex).style.textDecoration = "none";
					document.getElementById("link_ref"+JRandomIndex).style.backgroundColor = "#BEB69A";					
				}
				break;	

			case "slides":
				if (document.getElementById("index_ref"+JRandomIndex))
				{
					document.getElementById("index_ref"+JRandomIndex).className = "Show";
				}
				break;
		}
	}
}

// Show / Hide Display (All Browsers)
function JShowHide(e,i,c)
{
	if(e)
		if(ie) e = event.srcElement; else e = e.target;	
	
	switch(c)
	{
		case "default":
			if (document.getElementById("index_ref"+JRandomIndex))
			{
				document.getElementById("index_ref"+JRandomIndex).className = "Hide";										
				document.getElementById("index_ref"+i).className = "Show";			
				JRandomIndex = i;			
			}
			break;
		
		case "equipe":
			if (document.getElementById("index_ref"+JRandomIndex))
			{
				document.getElementById("index_ref0").className = "Hide";
				document.getElementById("index_ref"+JRandomIndex).className = "Hide";										
				document.getElementById("index_ref"+i).className = "Show";			
				JRandomIndex = i;			
			}
			break;
		
		case "present":
			if (document.getElementById("index_ref"+JRandomIndex))
			{
				document.getElementById("index_ref"+JRandomIndex).className = "Hide";										
				document.getElementById("index_ref"+i).className = "ShowT";			
				JRandomIndex = i;			
			}
			break;
	}
}