// Affichage du menu
function menu_open()
{
	var btn = this.getElementsByTagName("a")[0];
	var ul = this.getElementsByTagName("ul");
	
	if (ul.length > 0)
	{
		var lvl = this.parentNode.style.zIndex;
		if (menu_last[lvl] != undefined) document.getElementById(menu_last[lvl]).style.display = "none";
		menu_last[lvl] = ul[0].id;
		clearTimeout(menu_timeout[ul[0].id]);
		ul[0].style.display = 'block';
		btn.className = "over parent";
	}
	else btn.className = "over";
}

// Fermeture du menu
function menu_close()
{
	var btn = this.getElementsByTagName("a")[0];
	var ul = this.getElementsByTagName("ul");
	
	if (ul.length > 0)
	{
		menu_timeout[ul[0].id] = setTimeout("document.getElementById('"+ul[0].id+"').style.display='none'", 500);
		btn.className = "out parent";
	}
	else btn.className = "out";
}

// Initialisation du menu
function menu_init(div)
{
	menu_timeout =  new Array();
	menu_last = new Array();
	var nav = /MSIE/;
	var ie = nav.test(navigator.appVersion);
	var li = document.getElementById(div).getElementsByTagName("li");
	var ul = document.getElementById(div).getElementsByTagName("ul");
	
	// Configuration des LI
	for (var i=0; i<li.length; i++)
	{
		// Evenements de la souris
		li[i].onmouseover = menu_open;
		li[i].onmouseout = menu_close;
		
		// Détection des sous-menus
		if (li[i].getElementsByTagName("ul").length > 0)
		{
			li[i].getElementsByTagName("a")[0].className = "out parent";
		}
		
		// Bug fix pour IE (Microsoft please learn to code)
		//if (ie == true) li[i].style.display = "inline";
	}
	
	// Configuration des UL
	for (var i=0; i<ul.length; i++)
	{
		// Détecion du niveau d'arborescence
		var lvl = 1;
		var item = ul[i];
		while (item.parentNode.id != div)
		{
			item = item.parentNode.parentNode;
			lvl++;
		}

		// Paramètres de l'élement
		ul[i].style.zIndex = lvl;
		ul[i].id = "menu_"+div+"_"+i;
	}
}

function shine_star(id)
{
	for (i=0; i<=id; i++)
	{ 
		document.getElementById('star_'+i).src='/src/icons/silk/star.png';
	}
	for (i=id+1; i<=4; i++)
	{
		document.getElementById('star_'+i).src='http://www.elegance-faire-part.fr/images/star_grey.png';
	}
}


function show_larger(id, href)
{
		//document.getElementById('link_'+i).src='/src/icons/silk/star.png';
		if (id != 0)
			{	document.getElementById('src_vgn').src='http://elegance-faire-part.fr/media/logo-'+id+'-180x180.jpg';	}
		else 
			{	document.getElementById('src_vgn').src='http://elegance-faire-part.fr/images/index_block2-img.jpg';	}
		
		document.getElementById('link_vgn').href='http://elegance-faire-part.fr/faire-part-p'+href+'.html';
}


function changetotext(id)
{
	document.getElementById('selecttext'+id).style.display='block';
	// Effect.BlindDown('selecttext'+id);
	
	if (id == 1)
	{
		document.getElementById('selecttext'+2).style.display='none';
		document.getElementById('selecttext'+3).style.display='none';
		document.getElementById('textchangecolor'+id).style.background='#CC0000';
		document.getElementById('textchangecolor'+2).style.background='#EEEEEE';
		document.getElementById('textchangecolor'+3).style.background='#EEEEEE';
	}
	if (id == 2)
	{
		document.getElementById('selecttext'+1).style.display='none';
		document.getElementById('selecttext'+3).style.display='none';
		document.getElementById('textchangecolor'+id).style.background='#CC0000';
		document.getElementById('textchangecolor'+1).style.background='#EEEEEE';
		document.getElementById('textchangecolor'+3).style.background='#EEEEEE';
	}
	if (id == 3)
	{
		document.getElementById('selecttext'+1).style.display='none';
		document.getElementById('selecttext'+2).style.display='none';
		document.getElementById('textchangecolor'+id).style.background='#CC0000';
		document.getElementById('textchangecolor'+1).style.background='#EEEEEE';
		document.getElementById('textchangecolor'+2).style.background='#EEEEEE';
	}
}

function deroule_photo(id)
{
	if (document.getElementById(id).style.display == "none")
	{
		Effect.BlindDown(id);
	}
	else
	{
		Effect.BlindUp(id);
	}
}

function colorize(i)
{
	if (i == 1)
	{
		document.getElementById("displaypaint").style.display ='block';
	}
	
	
	if (i == 0)
	{
		document.getElementById("displaypaint").style.display ='none';
	}
}

