function pintaMenuSubNav(act,col,cun){
	contenedorMenuSubNav = document.getElementById('subNav');
	contenedorMenuSubNav.style.background = "none";
	array=ashesSubNav;
	
	activo=act;
	anterior=null;
	intervalo=0;
	
	colorDest=col;
	srcCunia=cun;
	
	tdsSubNav=[];
	enlaceSubNav=[];
	textosEnlaces=[];
	
	pintaCunia();
}
function pintaCunia(){
	imagenSubNav = document.createElement('img');
	imagenSubNav.src = srcCunia;
	imagenSubNav.alt = "";
	imagenSubNav.border= 0;
	imagenSubNav.style.left = "0px";
	contenedorMenuSubNav.appendChild(imagenSubNav);
	
	pintaCont();
}
function pintaCont(){
	var tablaMenuSubNav = document.createElement('table');
	tablaMenuSubNav.cellPadding = 0;
	tablaMenuSubNav.cellSpacing = 0;
	
	contenedorMenuSubNav.appendChild(tablaMenuSubNav);
	
	tablaTrSubNav = document.createElement('tr');
	if(document.all){
		var ieTbody = document.createElement("tbody");
		tablaMenuSubNav.appendChild(ieTbody);
		ieTbody.appendChild(tablaTrSubNav);
	}else{	
		tablaMenuSubNav.appendChild(tablaTrSubNav);
	}
	
	for(var i=0;i<array.length;i++){
		pintaSeccion(i);
	}
	pintaResto();
}
function pintaSeccion(n){
	var textoBotonSubNav = array[n].split("--")[0];
	var linkBotonSubNav = array[n].split("--")[1];
	
	tdsSubNav[n] = document.createElement('td');
	tdsSubNav[n].id = "nav_"+n;
	tablaTrSubNav.appendChild(tdsSubNav[n]);
	
	enlaceSubNav[n] = document.createElement('a');
	enlaceSubNav[n].href = linkBotonSubNav;
	enlaceSubNav[n].n = "nav_"+n;
	enlaceSubNav[n].onmouseover=function(){mover(this.n);}
	enlaceSubNav[n].onmouseout=function(){mover(activo);}
	tdsSubNav[n].appendChild(enlaceSubNav[n]);
	
	textosEnlaces[n] = document.createTextNode(textoBotonSubNav);	
	enlaceSubNav[n].appendChild(textosEnlaces[n]);
	return;
}
function pintaResto(){
	var anchoTotal = document.getElementById("titSeccion").scrollWidth;
	var anchoTdTotal=0;
	for(var i=0;i<tdsSubNav.length;i++){
		anchoTdTotal+=tdsSubNav[i].scrollWidth;
	}
	tdSubNavResto = document.createElement("td");
	tdSubNavResto.style.margin ="0px";
	tdSubNavResto.style.width = ((anchoTotal - anchoTdTotal)-(array.length*2))-1 + "px";
	tdSubNavResto.style.height = tdsSubNav[0].scrollHeight+"px";
	tablaTrSubNav.appendChild(tdSubNavResto);
	mover(activo);
	setAlto();
}

function mover(idFinal){
	if (anterior!=null&&anterior!=activo){
		var tdCambiar=document.getElementById(anterior);
		tdCambiar.style.backgroundColor = "#fff";
	}
	
	var donde = document.getElementById(idFinal);
	posFinal = donde.offsetLeft+(Math.round(donde.scrollWidth/2))-4;
	posIni = Number(imagenSubNav.style.left.split("px")[0]);
	donde.style.backgroundColor = colorDest;
	anterior = idFinal;
	initMov();
	//alert(donde.offsetLeft);
}
function initMov(){
	clearInterval(intervalo);
	intervalo=setInterval(desplaza,1);
}
function desplaza(){
	posIni+=(posFinal-posIni)/7;
	imagenSubNav.style.left=posIni+"px";
	if(Math.round(posIni)==Math.round(posFinal)){
		clearInterval(intervalo);
	}
}