/**********************************************
web concept by positv media (http://www.positiv.com.es)
positivGo.js -x/10/03
Version: 0.2
Autor: jaime.crespillo.vilchez
Comentarios: jota@positiv.com.es
************************************************/
//inicio
onload=function(){
	secConstructor();
	if(n1>=0 && n2>=0){overN2(n1,n2);}else{imgOn(n1+1);}
	//getObject("falsa").style.visibility="hidden";//////////////////////////MODIFICADA
	bCargado=true;
	
	finalX=Math.ceil(document.body.clientWidth/2)-375;

}
onresize=function(){
	finalX=Math.ceil(document.body.clientWidth/2)-375;
}
//variables globales conf
var iInitY=-40;
var iDestY=158;
var iDestX=180;
var iOfsY=120;
var iWidth=240;
var iHeight=21;
var n1=-1;
var n2=-1;
var bgColorOut="#E8E8EC";
var bgColorOver="#F9FCF3";
var bgColorS="#326E56";
var bgColorItem="#FF9900";

//globales
var timer1=null;
var arrDivs=new Array();
var arrDivss=new Array();
var arrXDivs=new Array();
var arrYDivs=new Array();
var arrNameDivs=new Array();
var preNomCapa="azGo";
var bIsOpen=false;
var bIsOnN2=false;
var barra=null;
var bCargado=false;

niv =arrNameDivs
//procedimientos
function secConstructor(){
	var f1=niv.length;
	for(var z=0;z<f1;z++){
		var f2=niv[z].length;
		arrDivs[z]=new Array();
		arrYDivs[z]=new Array();
		for(var i=0;i<f2;i++){
			var strTemp;
			if(z==n1 && i==n2){
				strTemp="<table border='0' cellpadding='0' cellspacing='0' width='"+iWidth+"' height='"+iHeight+"'><tr><td colspan='2' height='1'><img src='img/sp.gif' width='1' height='1' alt=''></td></tr><tr><td width='20' class='txtMen' align=center height=10><div id='flec"+z+""+i+"' style='width:5px;height:5px;' class='sp4'><img id='iflec"+z+""+i+"' src='img/flecha.gif' width=5 height=5></div></td><td><font class='txtMen2'>"+niv[z][i]+"</font></td></tr><tr><td colspan='2' height='1'><img src='img/sp.gif' width='1' height='1' alt=''></td></tr></table>";
			}else{
				strTemp="<table border='0' cellpadding='0' cellspacing='0' width='"+iWidth+"' height='"+iHeight+"'><tr><td colspan='2' height='1'><img src='img/sp.gif' width='1' height='1' alt=''></td></tr><tr><td width='20' class='txtMen'align=center height=5><div id='flec"+z+""+i+"' style='width:5px;height:5px;' class='sp4'><img id='iflec"+z+""+i+"' src='img/flecha.gif' width=5 height=5></div></td><td><a href='"+arrNameDivsURL[z][i]+"' class='txtMen'>"+niv[z][i]+"</a></td></tr><tr><td colspan='2' height='1'><img src='img/sp.gif' width='1' height='1' alt=''></td></tr></table>";
			}		
			//(capa,x,y,z,w,h,visibility,bgcolor,contenido)
			arrDivs[z][i]=new acDiv((preNomCapa+z+i),arrXDivs[z],iInitY,z+50,iWidth,iHeight,"visible",bgColorOut,strTemp);
			arrDivs[z][i].mOver("bIsOpen=true;overN2("+z+","+i+")");
			arrDivs[z][i].mOut("bIsOpen=true;secOut("+z+");outN2("+z+","+i+")");
			arrYDivs[z][i]=arrWDivs[z][i];
		}
	}
}

function secGo(index){
	
	if(bCargado){
		secOff(index);
		var f2=niv[index].length;
		for(var i=0;i<f2;i++){
			arrDivs[index][i].show();
			arrDivs[index][i].setXY(finalX+arrXDivs[index]+arrYDivs[index][i],iDestY);
		}
		bIsOpen=true;
	}
}
function secOff(index){
	var f1=niv.length;
	for(var z=0;z<f1;z++){
		if(z!=index){
			var f2=niv[z].length;
			for(var i=0;i<f2;i++){
				arrDivs[z][i].hide();
				arrDivs[z][i].setXY(arrXDivs[z],iInitY);
			}
		}
	}
}
function secOut(index){
	if(bCargado){
		runOutRutine(index);
		bIsOpen=false;
	}
}
function secBack(index){
	var f2=niv[index].length;
	for(var i=0;i<f2;i++){
		arrDivs[index][i].hide();
		arrDivs[index][i].setXY(arrXDivs[index],iInitY);
	}
	imgOff(index+1);
}	
function runOutRutine(index){
	if(bIsOpen){
		if(timer1!=null) clearTimeout(timer1);
		timer1=setTimeout('runOutRutine('+index+')',500);
	}else{
		clearTimeout(timer1);
		secBack(index);
	}
}
function overN2(i1,i2){
	if(i1>=0 && i2>=0){
		tempName="iflec"+i1+i2;
		getObject(tempName).src="img/flechan.gif";
		imgOn(i1+1);
		//getObject(tempName).style.backgroundColor=bgColorS;////////////////////////MODIFICADA
		//arrDivs[i1][i2].nST.backgroundColor=bgColorOver;
	}
}
function outN2(i1,i2){
	if(i1!=n1 || i2!=n2){
		tempName="iflec"+i1+i2;
		getObject(tempName).src="img/flecha.gif";
		
		//getObject(tempName).style.backgroundColor=bgColorItem;////////////////////////MODIFICADA
		//arrDivs[i1][i2].nST.backgroundColor=bgColorOut;
	}
}

//////////////// Util //////// ANADIDA
function getObject(id){
	var o;
	if(document.getElementById){
		o=document.getElementById(id);
	}else{
		o=document.all[id];
	}
	return o;
}
//////////////////////////////////////
function imgOn(id){
		for(var i=1;i<=6;i++){
			if(i==id){
				tempName="ipunto"+id;
				getObject(tempName).src="img/punton.gif";
			}else{
				imgOff(i);
			}
		}
}
function imgOff(id){
	if(id!=(n1+1)){
		tempName="ipunto"+id;
		getObject(tempName).src="img/punto.gif";
	}
}
///////////////////
/*
//opera Netscape 6 Netscape 4x Mozilla 
if (window.innerWidth || window.innerHeight){ 
docwidth = window.innerWidth; 
docheight = window.innerHeight; 
} 
//IE Mozilla 
if (document.body.clientWidth || document.body.clientHeight){ 
docwidth = document.body.clientWidth; 
docheight = document.body.clientHeight; 
} */
