var nbArt;
var artSelect = 1;



function voirOnglet(idArt)
{
	//Création du cookie
	document.cookie = "lien =" + escape(idArt) + ";" 
	//Fin
	
	nbArt = document.getElementById("nombreRubrique").value;

	for(j=1;j<=nbArt;j++)
	{
		 if(idArt==j)
		{
			//alert(j);
			if(j==2)
			{
				window.document.getElementById("simplegallery1").style.visibility="visible";
				window.document.getElementById("simplegallery2").style.visibility="hidden";
			}
			if(j==3)
			{
				window.document.getElementById("simplegallery1").style.visibility="hidden";
				window.document.getElementById("simplegallery2").style.visibility="visible";
			}
			if(j==1)
			{
				window.document.getElementById("simplegallery1").style.visibility="hidden";
				window.document.getElementById("simplegallery2").style.visibility="hidden";
			}
			//On met le contenu de l'article cliqué en visible
			//alert(j);
	 		window.document.getElementById("cont_"+j).className="visible";
			//alert(window.document.getElementById("cont_"+j).className);
			//et met les rubriques en ON
			window.document.getElementById("rub_"+j).className="rub-article-on";
			window.document.getElementById("bg_"+j).className="bord_onglet-g-on";
			window.document.getElementById("bd_"+j).className="bord_onglet-d-on";
			window.document.getElementById("fleche"+j).className="fleche-on";
			//Menu de gauche
			window.document.getElementById("menu-g_"+j).style.display="block";
			artSelect = idArt;
		}
		else
			{
				//On cache les autres contenus 
				window.document.getElementById("cont_"+j).className="cache";
				//Menu de gauche
				window.document.getElementById("menu-g_"+j).style.display="none";
				//et met les rubriques en OFF
				if(j==1)
				{
					window.document.getElementById("bg_"+j).className="bord_onglet-g_fin-off";
					window.document.getElementById("bd_"+j).className="bord_onglet-d-off";
					window.document.getElementById("rub_"+j).className="rub-article-off";
					window.document.getElementById("fleche"+j).className="fleche";
				}
				else
				{
					if(j==nbArt)
					{
						window.document.getElementById("bg_"+j).className="bord_onglet-g-off";
						window.document.getElementById("bd_"+j).className="bord_onglet-d_fin-off";
						window.document.getElementById("rub_"+j).className="rub-article-off";
						window.document.getElementById("fleche"+j).className="fleche";
					}
					else
						{
							window.document.getElementById("bg_"+j).className="bord_onglet-g-off";
							window.document.getElementById("bd_"+j).className="bord_onglet-d-off";
							window.document.getElementById("rub_"+j).className="rub-article-off";
							window.document.getElementById("fleche"+j).className="fleche";
						}
				}
				
			}
	}
}

function outOnglet()
{
	nbArt = document.getElementById("nombreRubrique").value;
	
	for(j=1;j<=nbArt;j++)
	{
		if(j!=artSelect)
		{
			window.document.getElementById("rub_"+j).className="rub-article-off";
			//Si c'est le premier onglet (style particulier)
			if(j==1)
			 {
					window.document.getElementById("bg_"+j).className="bord_onglet-g_fin-off";
					window.document.getElementById("bd_"+j).className="bord_onglet-d-off";
			 }
			 else
				{
					window.document.getElementById("bg_"+j).className="bord_onglet-g-off";
					window.document.getElementById("bd_"+j).className="bord_onglet-d-off";
				}
		}
	}
		
}

/** sharepoint notre offre **/

function openDescription(id)
{
	if(window.document.getElementById('cont_'+id).style.height=="0px")
	{
	new Effect.Morph('cont_'+id, {style: 'height:200px', duration:0.5});
	}
	else
		{
		new Effect.Morph('cont_'+id, {style: 'height:0px',duration:0.5});	
		}
}

/** templates prets a l'emploi **/

function openTemplates(id)
{
	var nbTemp = window.document.getElementById("nbtemp").value;
	for(i=1;i<=nbTemp;i++)
	{
		if(i==id)
		{
			if(window.document.getElementById('temp_'+i).style.display=="none")
			{
			window.document.getElementById('temp_'+i).style.display="block";
			/*new Effect.Morph('temp_'+i, {style: 'display:block', duration:0.5});*/
			}
			else
				{
				/*new Effect.Morph('temp_'+i, {style: 'display:none',duration:0.5});*/
				window.document.getElementById('temp_'+i).style.display="none";
				}
		}
		else
		{
			//new Effect.Morph('temp_'+i, {style: 'display:none',duration:0.5});
			window.document.getElementById('temp_'+i).style.display="none";
		}
	}
}
