	/****CONFIG DEL SCROLL****/
	var eventoActivo="onmouseover";
	var eventoInactivo="onmouseout";
	var scrollspeed=2; //Velocidad del scroll
	var delay=20; //Retardo
	var subir=false;
	var bajar=false;
	var srcImagSup="";
	var srcImagInf="";
	var anchoContenedor=195;	
	var anchoContenedorSubMenu=195;
	var altoImagenFlecha=12;
	var altoCelda=31;	
	var numeroOpcionesVistas=4;
	var flechas=true; //Indica si necesitamos las flechas
	if (nombresPromociones.length<=numeroOpcionesVistas) {
		numeroOpcionesVistas=nombresPromociones.length;
		flechas=false;
	}
	if (flechas) var altoContenedor=altoCelda*numeroOpcionesVistas+(altoImagenFlecha*2);
	else var altoContenedor=altoCelda*numeroOpcionesVistas;
	var distancia=(nombresPromociones.length*altoCelda)-(numeroOpcionesVistas*altoCelda)-altoImagenFlecha;
	var alto2=(nombresPromociones.length*-altoCelda)+altoContenedor-(altoImagenFlecha*1.5);
	/*******/	
	
	/*****CONFIG DE LOS ENLACES*******/
	var objetivo="_blank";
	var textDecoration="none";
	var textDecorationO="underline";	
	var color="#000000";
	var colorO="#FF0000";
	var letra="Arial";
	/*******/	
	var movInicial=false; //Nos indica si ya se ha hecho algun movimiento 
	
	
	function insertaMenu (estado, seccion, subseccion,id) {
		//Incrusta por completo el carrusel

		document.write ("<div id='motioncontainer' class='motioncontainer' style='position:relative; background-color:#FFF;width: "+anchoContenedor+"px; height: "+altoContenedor+"px; overflow:hidden; border:1; text-align:center; visibility: hidden'>");		
		if (flechas) document.write ('<div style="cursor: pointer; z-index: 10; position: relative; color: #FF0000;" id="capaSube"><img src="imagenes/flechaMenuLateral.jpg" '+eventoActivo+'="subimos(true)" '+eventoInactivo+'="subimos(false);"></div>');
		//document.write ('<div style="z-index: 10; position: relative; color: #FF0000; height: 100px; background-color: #FF0000; width: 110px" onMouseOver="subimos(true)" onMouseOut="subimos(false)" id="capaSube"></div>');
		document.write ("<div id='motiongallery' style='position:absolute;left:0;top:0;white-space: nowrap; text-align:center;'>");
		document.write ("<nobr id='trueContainer' style='z-index: -2;'>");		
		insertaOpciones(subseccion, id);
		document.write ("</nobr>");			
		if (flechas) document.write ('<div style="cursor: pointer; z-index: 10; position: relative; top: -'+distancia+'px; color: #FF0000;" id="capaBaja"><img src="imagenes/flechaMenuLateralAbajo.jpg" '+eventoActivo+'="bajamos(true);" '+eventoInactivo+'="bajamos(false);"></div>');
		//document.write ('<div style="z-index: 10; position: relative; top: -'+distancia+'px; background-color: #FF0000; color: #FF0000; height: 100px; width: 110px" onMouseOver="bajamos(true);" onMouseOut="bajamos(false)" id="capaBaja"></div>');
		document.write ("</div></div>");
		if (estado) {
			document.getElementById("motioncontainer").style.visibility="visible";
			//Intentamos posicionar la opcion del menu lo accesible al arrancar el menu
			if (numeroOpcionesVistas<linksPromociones.length) {
				var indice=0;
				for (cont=0; cont<linksPromociones.length; cont++) if (id==linksPromociones[cont]) indice=cont;
				//Controlamos que tampoco se pase
				if (indice>(linksPromociones.length-numeroOpcionesVistas)) indice=linksPromociones.length-numeroOpcionesVistas;
				//Ahora movemos el menu hasta el punto en el que se encuentra la opcion del menu
				var altoTemp=indice*altoCelda;			
				document.getElementById('motiongallery').style.top=parseInt(document.getElementById('motiongallery').style.top)-altoTemp+"px";
				document.getElementById('capaBaja').style.top=parseInt(document.getElementById('capaBaja').style.top)+altoTemp+"px";
			}
		}
	}
	function insertaSubMenu (estado, seccion, subseccion, id) {
		//Incrusta por completo el carrusel de las promociones en Proyecto. Como leen de arrays distintas, debemos reinicar los valores
		
		flechas=true;
		numeroOpcionesVistas=4;
		altoCelda=20;
		if (subseccion=="tramitacion") {
			if (nombresPromocionesTramitacion.length<numeroOpcionesVistas) {
				numeroOpcionesVistas=nombresPromocionesTramitacion.length;
				flechas=false;
			}
			if (flechas) altoContenedor=altoCelda*numeroOpcionesVistas+(altoImagenFlecha*2);
			else altoContenedor=altoCelda*numeroOpcionesVistas;
			distancia=(nombresPromocionesTramitacion.length*altoCelda)-(altoImagenFlecha*1.15);
			alto2=(nombresPromocionesTramitacion.length*-altoCelda)+altoContenedor-(altoImagenFlecha*1.5);			
		}
		if (subseccion=="contratacion") {
			if (nombresPromocionesContratacion.length<numeroOpcionesVistas) {
				numeroOpcionesVistas=nombresPromocionesContratacion.length;
				flechas=false;
			}
			if (flechas) altoContenedor=altoCelda*numeroOpcionesVistas+(altoImagenFlecha*2);
			else altoContenedor=altoCelda*numeroOpcionesVistas;
			distancia=(nombresPromocionesContratacion.length*altoCelda)-(numeroOpcionesVistas*altoCelda)-altoImagenFlecha;
			alto2=(nombresPromocionesContratacion.length*-altoCelda)+altoContenedor-(altoImagenFlecha*1.5);
		} 
		document.write ("<div id='motioncontainer' class='motioncontainer' style='position:relative; width: "+anchoContenedorSubMenu+"px; height: "+altoContenedor+"px; overflow:hidden; border:1; text-align:left; visibility: hidden'>");		
		if (flechas) document.write ('<div style="cursor: pointer; z-index: 10; position: relative; color: #FFF;" id="capaSube"><img src="imagenes/flechaMenuLateral.jpg" '+eventoActivo+'="subimos(true)" '+eventoInactivo+'="subimos(false);"></div>');
		//document.write ('<div style="z-index: 10; position: relative; color: #FF0000; height: 100px; background-color: #FF0000; width: 110px" onMouseOver="subimos(true)" onMouseOut="subimos(false)" id="capaSube"></div>');
		document.write ("<div id='motiongallery' style='position:absolute;left:0;top:0;white-space: nowrap; text-align:center;'>");
		document.write ("<nobr id='trueContainer' style='z-index: -2;'>");		
		insertaOpcionesSub(subseccion, id);		
		document.write ("</nobr>");			
		if (flechas) document.write ('<div style="cursor: pointer; z-index: 10; position: relative; top: -'+distancia+'px; color: #FFF;" id="capaBaja"><img src="imagenes/flechaMenuLateralAbajo.jpg" '+eventoActivo+'="bajamos(true);" '+eventoInactivo+'="bajamos(false);"></div>');
		//document.write ('<div style="z-index: 10; position: relative; top: -'+distancia+'px; background-color: #FF0000; color: #FF0000; height: 100px; width: 110px" onMouseOver="bajamos(true);" onMouseOut="bajamos(false)" id="capaBaja"></div>');
		document.write ("</div></div>");
		if (estado) document.getElementById("motioncontainer").style.visibility="visible";
	}
	function subimos (estado) {
		//Se encarga de subir la galeria de imagenes

		//Ahora vendran los controles		
		if (parseInt(document.getElementById('motiongallery').style.top)<0) {
			document.getElementById('motiongallery').style.top=parseInt(document.getElementById('motiongallery').style.top)+scrollspeed+'px';			
			document.getElementById('capaBaja').style.top=parseInt(document.getElementById('capaBaja').style.top)-scrollspeed+'px';
			movInicial=true;
		} else if (movInicial) estado=false;		
		if (!estado) clearTimeout(idInterval);				
		else idInterval=setTimeout("subimos(true)",delay);		
	}
	function bajamos (estado) {
		//Se encarga de bajar la galeria de imagenes		
		
		//Ahora vendran los controles
		if (parseInt(document.getElementById('motiongallery').style.top)>alto2) {			
			document.getElementById('motiongallery').style.top=parseInt(document.getElementById('motiongallery').style.top)-scrollspeed+'px';			
			document.getElementById('capaBaja').style.top=parseInt(document.getElementById('capaBaja').style.top)+scrollspeed+'px';		
			movInicial=true;
		} else estado=false;
		if (!estado) clearTimeout(idInterval);				
		else idInterval=setTimeout("bajamos(true)",delay);		
	}	
	function  insertaOpciones (subseccion, id) {
		//Escribe las imagenes dentro del carrusel
		
		//document.write ("<div style='height: "+altoImagenFlecha+"px; background-color:#000'></div>");
		for (var cont=0; cont<nombresPromociones.length; cont++) {
			if (id==linksPromociones[cont]) {
				document.write ("<div id='menuLateral_opcion_"+id+"' class='celdaMenuLateral'");
				if (flechas) document.write (" style='position: relative; top: 7px'>");
				else document.write (" >");
				generaTextoImagen(183,26,nombresPromociones[cont], "", "fuentes/helvnm__.ttf", 9,8, 18, 8,105,86, 300, 300, 300, 0, 8, 105, 86, 300, 300, 300,"", "","", "", "", "");
				document.write ("</div>");		
			} else {
				document.write ("<div id='menuLateral_opcion_"+id+"' class='celdaMenuLateral'");
				if (flechas) document.write (" style='position: relative; top: 7px'>");
				else document.write (" >");
				document.write ("<a href='index.php?seccion=Promocion%20y%20Edificacion&subSeccion="+subseccion+"&id="+linksPromociones[cont]+"' style='color: "+color+"; text-decoration: "+textDecoration+"' onMouseOver='this.style.color=\""+colorO+"\"; this.style.textDecoration=\""+textDecorationO+"\";' onMouseOut='this.style.color=\""+color+"\"; this.style.textDecoration=\""+textDecoration+"\";'>");
				generaTextoImagen(183,26,nombresPromociones[cont], nombresPromociones[cont], "fuentes/helvnm__.ttf", 9,8, 18, 51,51,51, 300, 300, 300, 0, 8, 105, 86, 300, 300, 300,"", "","", "", "", "");
				document.write ("</a></div>");	
			}			
		}
	}
	function  insertaOpcionesSub (seccion, id) {
		//Escribe las imagenes dentro del carrusel. Recibe la seccion que debe mostrar y el id pulsado en ese momento
		
		//document.write ("<div style='height: "+altoImagenFlecha+"px; background-color:#000'></div>");
		if (seccion=="tramitacion") 
			for (var cont=0; cont<nombresPromocionesTramitacion.length; cont++) {
				if (id==linksPromocionesTramitacion[cont]) {
					document.write ("<div class='celdaSubMenuLateral'>");
					generaTextoImagen(171,26,nombresPromocionesTramitacion[cont], "", "fuentes/helvnm__.ttf", 9,8, 18, 8,105,86, 300, 300, 300, 0, 8, 105, 86, 300, 300, 300,"", "","", "", "", "");
					document.write ("</div>");
				} else {
					document.write ("<div class='celdaSubMenuLateral'><a href='index.php?seccion=Promocion%20y%20Edificacion&subSeccion=enfasedeproyecto&id="+linksPromocionesTramitacion[cont]+"' style='color: "+color+"; text-decoration: "+textDecoration+"' onMouseOver='this.style.color=\""+colorO+"\"; this.style.textDecoration=\""+textDecorationO+"\";' onMouseOut='this.style.color=\""+color+"\"; this.style.textDecoration=\""+textDecoration+"\";'>");
					generaTextoImagen(171,26,nombresPromocionesTramitacion[cont], nombresPromocionesTramitacion[cont], "fuentes/helvnm__.ttf", 9,8, 18, 51,51,51, 300, 300, 300, 0, 8, 105, 86, 300, 300, 300,"", "","", "", "", "");
					document.write ("</a></div>");	
				}
			}
		if (seccion=="contratacion") 
			for (var cont=0; cont<nombresPromocionesContratacion.length; cont++) {
				document.write ("<div class='celdaSubMenuLateral'><a href='index.php?seccion=Promocion%20y%20Edificacion&subSeccion=enfasedeproyecto&id="+linksPromocionesContratacion[cont]+"' style='color: "+color+"; text-decoration: "+textDecoration+"' onMouseOver='this.style.color=\""+colorO+"\"; this.style.textDecoration=\""+textDecorationO+"\";' onMouseOut='this.style.color=\""+color+"\"; this.style.textDecoration=\""+textDecoration+"\";'>");
				generaTextoImagen(171,26,nombresPromocionesContratacion[cont], nombresPromocionesContratacion[cont], "fuentes/helvnm__.ttf", 9,8, 20, 51,51,51, 300, 300, 300, 0, 8, 105, 86, 300, 300, 300,"", "","", "", "", "");
				document.write ("</a></div>");	
			}
	}	