function findObj(n, d) 
{
	var p,i,x;  
	if(!d) d=document; 
	if((p = n.indexOf("?")) > 0 && parent.frames.length) 
	{
		d = parent.frames[n.substring(p+1)].document; 
		n = n.substring(0,p);
	}
	if(!(x=d[n]) && d.all) x=d.all[n]; 
	for (i=0; !x && i<d.forms.length; i++) x = d.forms[i][n];
	for(i=0; !x && d.layers && i<d.layers.length; i++) x = findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x = d.getElementById(n); 
	return x;
}

function hideSubMenu() 
{
	if ((obj = findObj("sub_menu"))!=null) 
	{ 
		obj.style.visibility = "hidden"; 
	}
}
function showSubMenu() 
{
	if ((obj = findObj("sub_menu"))!=null) 
	{ 
		obj.style.visibility = "visible"; 
	}
}

function displayDetails(header, body)
{
	if((obj = findObj("sub_menu_head")) != null)
	{
		obj.innerHTML = header;
	}
	if((obj = findObj("sub_menu_links")) != null)
	{
		obj.innerHTML = body;
	}
	if(body == "") hideSubMenu();
}

function displaySubLinks(dir, sub_links)
{
	if((obj = findObj("sub_links")) != null)
	{
		obj.innerHTML = sub_links;
		if(sub_links != '')
		{
			obj.style.backgroundImage  = 'url('+dir+'images/sub_links.jpg)';
			if((obj = findObj("content")) !=null)
			{
				obj.style.marginTop = '0px';
				obj.style.paddingTop = '0px';
				obj.style.backgroundPosition = 'center 0px';
			}
		}
		else 
		{
			obj.style.backgroundImage  = 'url('+dir+'images/shadow_links.jpg)';
			if((obj = findObj("content")) !=null)
			{
				obj.style.marginTop = '-20px';
				obj.style.paddingTop = '20px';
				obj.style.backgroundPosition = 'center 20px';
			}
		}
	}
}

/***********************************************
* Email Validation script- © Dynamic Drive (www.dynamicdrive.com) / modifications by GweNa (http://www.twix-compote.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function checkmail(e, e2, popup) //e2, form added by Gwena
{	
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
	var returnval=emailfilter.test(e.value)
	if (e2 != '' && e.value != e2.value)
	{
		alert("Les adresses ne correspondent pas.")
		e.select()
		return false; // added by Gwena
	}
	else if (returnval==false)
	{
		alert("Cette adresse électronique n'est pas valide.")
		e.select()
		return false; // added by Gwena
	}
	else if(popup == "yes") // added by Gwena
	{
		window.open("", "formPopup", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=200,width=500,toolbar=no", true); 
        document.sub_form.target='formPopup';
		document.sub_form.submit();
		return true;
	}
	return returnval;
}

//picsengine
function saveUrl(u)
{
	window.open(u,"_self");
}
function getUrl()
{ 
	return window.location.toString(); 
}
					