// CATALAN - CHARSET ISO-8859-1 ----------------------------------------------------------------------/

var openDesplegableMenu = '';	// 
var ContentHeight = 200;		// Opertura por defecto (tamaño) para opciones en sub menus (en cada idioma cambia segun tamaño de textos)

// ---------------------------------------------------------------------------------------------------/
function GeneraMenuIdioma(RutaRelativa){ 
	document.write('<table width="170" border="0">');
	document.write('<tr>');
    document.write('<td>&nbsp;</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'es/default.html" target="_self">Castellà</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'en/default.html" target="_self">Anglès</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'fr/default.html" target="_self">Francès</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'de/default.html" target="_self">Alemany</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'bg/default.html" target="_self">Búlgar</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'cs/default.html" target="_self">Txec</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'lt/default.html" target="_self">Lituà</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'pl/default.html" target="_self">Polonès</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'pt/default.html" target="_self">Portuguès</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'ro/default.html" target="_self">Romanès</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'ru/default.html" target="_self">Rus</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'tr/default.html" target="_self">Turc</a></td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td class="cellagris Estilo2"><a href="'+RutaRelativa+'nl/default.html" target="_self">Holandès</a></td>');
	document.write('</tr>');
	document.write('<tr>');
    document.write('<td>&nbsp;</td>');
	document.write('</tr>');
	document.write('</table>');
}

// Apartado de menu de seleccion del site - CONTENIDOS E IDIOMAS DISPONIBLES -------------------------/
function GeneraMenu(RutaRaizIdioma, RutaRelativa){
	document.write('<table width="180" border="0" cellspacing="0" cellpadding="0">');
	document.write('<tr><td align="center" valign="top">&nbsp;</td></tr>');
	document.write('<tr><td height="'+ContentHeight+'" align="center" valign="top">');
	// CATALAN ------------------------------------------------------------------------------------- //
	document.write('<div id="DesplegableMenuContainer" class="DesplegableMenuContainer">');
		// EMPRESA
			document.write('<div onclick="AplicarEnlaceDelMenu(1,\''+RutaRaizIdioma+'\');">');
				document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
					// CABECERA
					document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">Empresa</td></tr></table>');
				document.write('</div>');
			document.write('</div>');
		// DISTRIBUCIO COMBUSTIBLES I CARBURANTS
			document.write('<div onclick="runDesplegableMenu(2,0);AplicarEnlaceDelMenu(2,\''+RutaRaizIdioma+'\');">');
				document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
					// CABECERA
					document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">Distribució de combustibles i carburants</td></tr></table>');
				document.write('</div>');
			document.write('</div>');
				document.write('<div id="DesplegableMenu2Content" class="DesplegableMenuContent">');
					// CONTENIDOS
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'distribucio/operador.html">Operador petrolífer</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'distribucio/domicili.html">Distribució a domicili</a></td></tr></table>');
				document.write('</div>');
		// TARGETES CARBURANT I XARXA DE BENZINERES
			document.write('<div onclick="runDesplegableMenu(3,0);AplicarEnlaceDelMenu(3,\''+RutaRaizIdioma+'\');">');
				document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
					// CABECERA
					document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">Targetes carburant i Xarxa de benzineres</td></tr></table>');
				document.write('</div>');
			document.write('</div>');
				document.write('<div id="DesplegableMenu3Content" class="DesplegableMenuContent">');
					// CONTENIDOS
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/pluscard.html">PlusCard Gasóleo Profesional</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/dieselcredit.html">Diesel Card</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/dieselcontat.html">Diesel Card Tarjeta Contado</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/bonificat.html">Diesel Card Gasóleo B</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/prepago.html">Gasóleo Profesional PRE PAGO</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/guitrans.html">Pluscard GUITRANS</a></td></tr></table>');			
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/racingdc.html">RACING DC</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/xarxab.html">Xarxa de benzineres</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/internacional.html">Internacional</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'targetes/solicitud.html">Sol·licitud d\'informació de targetes</a></td></tr></table>');
				document.write('</div>');
		// ADD BLUE
			document.write('<div onclick="AplicarEnlaceDelMenu(4,\''+RutaRaizIdioma+'\');">');
				document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
					// CABECERA
					document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">AdBlue</td></tr></table>');
				document.write('</div>');
			document.write('</div>');
		// PRODUCTES BIO
			document.write('<div onclick="runDesplegableMenu(5,0);AplicarEnlaceDelMenu(5,\''+RutaRaizIdioma+'\');">');
				document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
					// CABECERA
					document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">Productes BIO</td></tr></table>');
				document.write('</div>');
			document.write('</div>');
				document.write('<div id="DesplegableMenu5Content" class="DesplegableMenuContent">');
					// CONTENIDOS
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'productesbio/biodiesel.html">Biodièsel</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'productesbio/bioetanol.html">Bioetanol</a></td></tr></table>');
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'productesbio/solar.html">Energia solar</a></td></tr></table>');
				document.write('</div>');
		// NOTICIES
			document.write('<div onclick="runDesplegableMenu(6,0);AplicarEnlaceDelMenu(6,\''+RutaRaizIdioma+'\');">');
				document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
					// CABECERA
					document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">Notícies</td></tr></table>');
				document.write('</div>');
			document.write('</div>');
				document.write('<div id="DesplegableMenu6Content" class="DesplegableMenuContent">');
					// CONTENIDOS
					document.write('<table align="center" width="160" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol" align="left"><a href="'+RutaRaizIdioma+'control_noticies_frames.html">Gestió notícies</a></td></tr></table>');
				document.write('</div>');
		// CONTACTE
			document.write('<div onclick="AplicarEnlaceDelMenu(7,\''+RutaRaizIdioma+'\');">');
				document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
					// CABECERA
					document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">Contacte</td></tr></table>');
				document.write('</div>');
			document.write('</div>');
		// ENLLAÇOS D'INTERES
		document.write('<div onclick="AplicarEnlaceDelMenu(8,\''+RutaRaizIdioma+'\');">');
			document.write('<div class="DesplegableMenuTitle" onselectstart="return false;">');
				// CABECERA
				document.write('<table align="center" width="180" border="0" cellspacing="0" cellpadding="0"><tr><td class="cellagris_titol_blanc" align="left">Enllaços d\'interès</td></tr></table>');
			document.write('</div>');
		document.write('</div>');
	document.write('</div>');
	// ----- FIN MENU ----------------------------------------
	document.write('</td></tr>');
	document.write('<tr><td>&nbsp;</td></tr>');
	document.write('</table>');
}

// RUTAS POR DEFECTO EN CABECERA DE CONTENIDOS DE MENU POR IDIOMAS DISPONIBLES -----------------------/
function AplicarEnlaceDelMenu(index,RutaRaizIdioma){
	var enlace = "";
	switch(index){
		case 1:		// EMPRESA
			enlace = RutaRaizIdioma+"empresa.html";
			break;
		case 2:		// DISTRIBUCIO
			enlace = RutaRaizIdioma+"distribucio.html";
			break;
		case 3:		// TARGETES
			enlace = RutaRaizIdioma+"xarxa.html";
			break;
		case 4:		// AD BLUE
			enlace = RutaRaizIdioma+"adblue/adblue.html";
			break;
		case 5:		// PRODUCTES BIO
			enlace = RutaRaizIdioma+"productesbio.html";
			break;
		case 6:		// NOTICIES
			enlace = RutaRaizIdioma+"noticies.html";
			break;
		case 7:		// CONTACTE
			enlace = RutaRaizIdioma+"contacte.html";
			break;
		case 8:		// ENLLAÇOS
			enlace = RutaRaizIdioma+"links.html";
			break;
	}
	if (enlace.length>0){
	   	location.href = enlace;
		}
	}

// ---------------------------------------------------------------------------------------------------/
function runDesplegableMenu(index,bAnularTiempo){
  	var nID = "DesplegableMenu" + index + "Content";
  	if(openDesplegableMenu == nID)
	    nID = '';
	// Opciones de desplazamiento segun contexto
	switch(index){
		case 1:
			// Empresa
			ContentHeight = 0;
			break;
		case 2:
			// Distribucio
			ContentHeight = 38;
			break;
		case 3:
			// Targetes
			ContentHeight = 225;
			break;
		case 4:
			// AddBlue
			ContentHeight = 0;
			break;
		case 5:
			// Productes BIO
			ContentHeight = 55;
			break;
		case 6:
			// Noticies
			ContentHeight = 20;
			break;
		case 7:
			// Contacte
			ContentHeight = 0;
			break;
		case 8:
			// Enllaços
			ContentHeight = 0;
			break;
		}
	if (bAnularTiempo==1){
		animate(new Date().getTime() , TimeToSlide , openDesplegableMenu , nID, bAnularTiempo);
	}else{
		setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'" + openDesplegableMenu + "','" + nID + "')", 33);
	}
	openDesplegableMenu = nID;
	}	
