//<![CDATA[
function switch_onglet(id_div_actif, numero_onglet_actif, id_div, numero_onglet)
{
	var array_textes = new Array('<a href="#" title="Présentation" onclick="switch_onglet(\''+id_div+'\', '+numero_onglet+', \'presentation-zone\', 0);return false;">Présentation</a>', 
							 	'<a href="#" title="Implantation type" onclick="switch_onglet(\''+id_div+'\', '+numero_onglet+', \'implantation-zone\', 1);return false;">Implantation type</a>', 
								'<a href="#" title="Equipements" onclick="switch_onglet(\''+id_div+'\', '+numero_onglet+', \'equipements-zone\', 2);return false;">Equipements</a>', 
								'<a href="#" title="Conseils déco" onclick="switch_onglet(\''+id_div+'\', '+numero_onglet+', \'conseils-zone\', 3);return false;">Conseils déco</a>', 
								'<a href="#" title="Garantie, informations techniques et tarifs" onclick="switch_onglet(\''+id_div+'\', '+numero_onglet+', \'garantie-zone\', 4);return false;">Garantie, informations techniques et tarifs</a>');
	var array_textes_actif = new Array('<span class="active-product-menu-button0">Présentation</span>', 
								   		'<span class="active-product-menu-button1">Implantation type</span>', 
										'<span class="active-product-menu-button2">Equipements</span>', 
										'<span class="active-product-menu-button3">Conseils déco</span>', 
										'<span class="active-product-menu-button4">Garantie, informations techniques et tarifs</span>');
	
	for (var i = 0; i < 5; i++)
	{
		Element.update('product-menu-button'+i, array_textes[i], {duration: 0.1, queue : 'end'});
	}
	
	new Effect.Fade(id_div_actif, {duration: 0.5, queue : 'end'});
	Element.update('product-menu-button'+numero_onglet, array_textes_actif[numero_onglet], {duration: 0.1, queue : 'end'});
	new Effect.Appear(id_div, {duration: 0.5, queue : 'end'});
}

function popupcentree(page,largeur,hauteur,options)
{
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function toggle_menu(id_gamme_n0, classe_gamme_n0, id_gamme_n1_active, libelle_n0, libelle_n1)
{
	var data = $H({'id_gamme_n0' : id_gamme_n0, 
				  'classe_gamme_n0' : classe_gamme_n0, 
				  'id_gamme_n1_active' : id_gamme_n1_active, 
				  'libelle_n0' : libelle_n0, 
				  'libelle_n1' : libelle_n1}).toQueryString();
	
	new Ajax.Updater('menu-gauche-'+id_gamme_n0, 'ajax-maj-menu-gauche-electromenagers.php', 
					 {
						method: 'post',
						synchronous: true,
						contentType: 'application/x-www-form-urlencoded',
						encoding: 'UTF-8',
						postBody: data, 
						onFailure: function() {
										Element.update('menu-gauche-'+id_gamme_n0, 'Une erreur est survenue, veuillez ré-essayer plus tard.');
									}
					 });
	
	new Ajax.Updater('menu-droite-'+id_gamme_n0, 'ajax-maj-menu-droite-electromenagers.php', 
					 {
						method : 'post', 
						synchronous: true,
						contentType: 'application/x-www-form-urlencoded',
						encoding: 'UTF-8',
						postBody: data, 
						onFailure: function() {
										Element.update('menu-droite-'+id_gamme_n0, 'Une erreur est survenue, veuillez ré-essayer plus tard.');
									}
					 });
}
 
function affiche_sous_gamme(div_n0, span_n0, picto_open, picto_close)
{
	// toggle du div
	new Effect.toggle(div_n0, 'appear');
	// toggle du picto
	if (Element.visible(div_n0))
	{
		Element.setStyle(span_n0, {backgroundImage: 'url(images/'+picto_close+')'});
	}
	else
	{
		Element.setStyle(span_n0, {backgroundImage: 'url(images/'+picto_open+')'});	
	}
}
//]]>
