 /*------------------------------------------------------*
  *-------FUNCIONES JAVASCRIPT    ----*
  *------------------------------------------------------*/


/*1 Pop Up centrada inicio (utilizada por infos legales y páginas planos) */

function popup(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);
}

/*1 Pop Up centrada FIN  */

/*----------------------------------------------------*/

/*2 AFFICHE-CACHE-MENU DEBUT  2*/

var postit_on=new Array();
var num=0;
var sousnum_length=0;
var nb_num=0;
var taille_totale;
var taille_totale2;
var taille_totale3;
var vitesse=1;//vitesse en millisecondes (en principe)
var pat=8;//espacement entre les déplacements (pour accroitre la vitesse, augmenter le pas ou réduire la variable vitesse)
var boucle_maDiv2;
var boucle_maDiv;
var boucle_maDiv3;
var maDiv;
var maDiv2;
var maDiv3;
function glissement(maDiv,letotal,boucle_maDiv)
{
		if(boucle_maDiv>=letotal)
		{
			maDiv.style.visibility='visible';
			maDiv.style.height=letotal+"px";
			window.clearTimeout();
			
		}
		else
		{
		maDiv.style.height=boucle_maDiv+"px";
		boucle_maDiv=boucle_maDiv+pat;
		window.setTimeout(function(){glissement(maDiv,letotal,boucle_maDiv)},vitesse);
		}
}


function glissement2(maDiv,letotal,boucle_maDiv2)
{
		if(boucle_maDiv2<=0)
		{
			maDiv.style.display='none';
			maDiv.style.height=letotal+"px";
			window.clearTimeout();
		}
		else
		{
		maDiv.style.height=boucle_maDiv2+"px";
		boucle_maDiv2=boucle_maDiv2-pat;
		window.setTimeout(function(){glissement2(maDiv,letotal,boucle_maDiv2)},vitesse);
		}
}
function glissement3(maDiv3,letotal,boucle_maDiv3)
{
		if(boucle_maDiv3<=0)
		{
			maDiv3.style.display='none';
			maDiv3.style.height=letotal+"px";
			window.clearTimeout();
		}
		else
		{
		maDiv3.style.height=boucle_maDiv3+"px";
		boucle_maDiv3=boucle_maDiv3-pat;
		window.setTimeout(function(){glissement2(maDiv3,letotal,boucle_maDiv3)},vitesse);
		}
}

function cache_postit(num,sousnum_length)
{
	var maDiv=document.getElementById('subMenu_'+num);
	if(!postit_on[num])
	{
		postit_on[num]=0;
	}
	if(postit_on[num]==0)
	{
	boucle_maDiv=0;
		if(sousnum_length!=0)
			{
				var zz=1;
				var zz2=1;
				for(zz=1;zz<=sousnum_length;zz++)
				{
					if(zz<10)
					{
						zz2 = "0"+zz;
					}
					else{zz2=zz;}
						
					if(zz2!=num)
					{
						
						postit_on[zz2]=0;
						
						
						
						if(document.getElementById('subMenu_'+zz2).style.display=='block')
						{
							
							document.getElementById('subMenu_'+zz2).style.visibility='hidden';
							maDiv2=document.getElementById('subMenu_'+zz2);
							boucle_maDiv2=document.getElementById('subMenu_'+zz2).style.height;
							var a=new Array();
							a=boucle_maDiv2.split('px');
							boucle_maDiv2=a[0];
							window.setTimeout(function(){glissement3(maDiv2,boucle_maDiv2,boucle_maDiv2)},vitesse);
						}
						else
						{
							
							document.getElementById('subMenu_'+zz2).style.display='none';
							document.getElementById('subMenu_'+zz2).style.visibility='hidden';
						}
					}
				}
			}
		
		postit_on[num]=1;
		
		document.getElementById('subMenu_'+num).style.display='block';
		
		taille_totale3=document.getElementById('subMenu_'+num).offsetHeight;
		document.getElementById('subMenu_'+num).style.height="0px";
		window.setTimeout(function(){glissement(maDiv,taille_totale3,boucle_maDiv)},vitesse);
		
	}
	else
	{
		
			postit_on[num]=0;
			if(sousnum_length!=0)
			{
				var zz=1;
				var zz2=1;
				for(zz=1;zz<=sousnum_length;zz++)
				{
					if(zz<10)
					{
						zz2 = "0"+zz;
					}
					else{zz2=zz;}
					if(zz2!=num)
					{
						document.getElementById('subMenu_'+zz2).style.display='none';
						document.getElementById('subMenu_'+zz2).style.visibility='hidden';
						postit_on[zz2]=0;
					}
				}
			}
		
		document.getElementById('subMenu_'+num).style.visibility='hidden';
		
		taille_totale=document.getElementById('subMenu_'+num).offsetHeight;
		boucle_maDiv2=document.getElementById('subMenu_'+num).style.height;
		var a=new Array();
		a=boucle_maDiv2.split('px');
		boucle_maDiv2=a[0];
		window.setTimeout(function(){glissement2(maDiv,taille_totale,boucle_maDiv2)},vitesse);
	}
}




/*2 AFFICHE-CACHE-MENU FIN  2*/

/*----------------------------------------------------*/



/*3 LIEN SELECT PRODUIT DEBUT  3*/

/*----------------------------------------------------*/
function lien(monUrl)
{
window.location.href=monUrl;
}
function carsher()
{
var Boy_lien = document.getElementById('lien_form');
Boy_lien.removeAttribute('href');
Boy_lien.setAttribute('href','#',false);
}
function verif()
{
	var Dadverif = document.form_url;
	var Boy1 = Dadverif.Provincias;
	var Boy2 = Dadverif.denominacion;
	
	with (Dadverif)
	{
		//window.alert(Boy1.selectedIndex+'[  -  ]'+Boy2.selectedIndex);
		if(Boy1.selectedIndex != 0 && Boy2.selectedIndex == 0)
		{
			//window.alert(Boy1.options[Boy1.selectedIndex].value);
			window.location.href=Boy1.options[Boy1.selectedIndex].value;
		}
		else if(Boy2.selectedIndex != 0)
		{
			//window.alert(Boy2.options[Boy2.selectedIndex].value);
			window.location.href=Boy2.options[Boy2.selectedIndex].value;
		}
		else if(Boy1.selectedIndex == 0 && Boy2.selectedIndex == 0)
		{
			//window.alert(Boy1.options[Boy1.selectedIndex].value);
			window.location.href=Boy1.options[Boy1.selectedIndex].value;
		}
	}
} 


function cat_url(nomForm,hisName)
{
	var Dad = document.getElementById(nomForm);
	var Boy = Dad.elements[hisName];
	
	with (Dad)
	{
		window.location.href=Boy.options[Boy.selectedIndex].value;
	}
} 

/*3 LIEN SELECT PRODUIT FIN  3*/

/*----------------------------------------------------*/

function arrondi(valeur)
{
	return Math.round(valeur*100)/100
}

function charge(qui,total_sans_remise)
{
	var conteneur = document.getElementById('chargement_total_remise');
	var valeur = qui.value;
	//window.alert(total_sans_remise);
	if(valeur)
	{
		var compte = arrondi(total_sans_remise) * ((100-arrondi(valeur))/100);
		conteneur.innerHTML = '';
		conteneur.innerHTML = arrondi(compte) + " &euro;" ;
		//window.alert(compte);
	}
}


