
////////////////////Please leave this notice////////////////////
//
//	DropDown Menu 1.0
//	By Evgeny Novikov (java@aladin.ru)
//	http://java.skyteam.ru
//	It works only with IE5.0(++) and Netscape6.0(++)
//	Free to use!
//
////////////////////Last modified 2002-03-05////////////////////

//	Modify following four lines to customize your menu
//var msIndTipoMenu = "0"		// 1:texto y 0:Imagen
var tdColor=''//="#E9EBED";		// menu item text color
//var tdBgColor//="#95B1DA";	// menu item background color
var hlColor=''//="#000000";		// highlight text color
//var hlBgColor//="#FFFFBB";	// highlight background color
//	After change, modify same values in your *.css file

var md=250;
var ti=-1;
var oTd=new Object;
oTd=null;

var userAgent = navigator.userAgent.toLowerCase();
var is_opera  = ((userAgent.indexOf('opera') != -1) || (typeof(window.opera) != 'undefined'));
var is_saf    = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.'));
var is_webtv  = (userAgent.indexOf('webtv') != -1);
var is_ie     = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));

function doMenu(td,pos){
	clearTimeout(ti);
	if(msIndTipoMenu=='1'){
		
		if(td.id.split("_").length > 2)
			td.style.backgroundColor=subhlBgColor;
		else
			td.style.backgroundColor=hlBgColor;
			
		td.style.color=hlColor;
	}
	else{
		
		if(td.id.split("_").length > 2){
			td.style.backgroundColor=subhlBgColor;
			td.style.color=hlColor;
		}
		else{
			td.firstChild.src = eval("imgOn"+pos)
		}
	}	
	
	
	var i;
	var sT="";
	var tda=new Array();
	tda=td.id.split("_");
	
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		for(i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			if(tdo[i]!=tda[i]){
				if(msIndTipoMenu=='1'){
					if(document.getElementById("td"+sT).id.split("_").length > 2)
						document.getElementById("td"+sT).style.backgroundColor=subtdBgColor;
					else
						document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
					
					document.getElementById("td"+sT).style.color=tdColor;
					
				}
				else{
					
					if(document.getElementById("td"+sT).id.split("_").length > 2){
						document.getElementById("td"+sT).style.backgroundColor=subtdBgColor;
						//document.getElementById("td"+sT).style.color=subtdColor;
						}
						else
							document.getElementById("td"+sT).firstChild.src = eval("imgOff"+sT)
					
				}
						

				if(document.getElementById("tbl"+sT)!=null)
					document.getElementById("tbl"+sT).style.display="none";
					
				
				for(w=1;w>-1;w++){

					
					if(document.getElementById("subtd"+sT+'_'+w)!=null)
						document.getElementById("subtd"+sT+'_'+w).style.display="none"
					else
						break;
				}

			}
		}			
	}
	
	oTd=td;
	sT="tbl";
	for(i=1;i<tda.length;i++)
		sT+="_"+tda[i];
	if(document.getElementById(sT)!=null)
		document.getElementById(sT).style.display=""
		
	for(w=1;w>-1;w++){

		if(document.getElementById("subtd"+pos+'_'+w)!=null)
			document.getElementById("subtd"+pos+'_'+w).style.display="";
		else
			break;
	}
}

function clearMenu(obj){
	
	if(msIndTipoMenu=='1'){
		if(obj.id.split("_").length > 2)
			obj.style.backgroundColor=subtdBgColor;
		else
			obj.style.backgroundColor=tdBgColor;
			
		obj.style.color=tdColor;
	}
	else{
		
		if(obj.id.split("_").length > 2){
			obj.style.backgroundColor=subtdBgColor;
			obj.style.color=tdColor;
		}
		else
			obj.firstChild.src = eval("imgOff"+sT)
	}

}

function runMenu(strURL){

	if(strURL.replace(/ /g,'')!='')
		location.href=strURL;
}

var tt="";
var sT="";
var pT=new Array();
var tA=new Array();

function getCoord(st){
	
	
	tA=st.split("_");
	if(tA.length>2){
		tA=tA.slice(0,-1);
		tt=tA.join("_");
		
		return (document.getElementById("tbl"+tt).offsetTop+document.getElementById("td"+st).offsetTop+4)+"px;left:"+
			(document.getElementById("tbl"+tt).offsetLeft+document.getElementById("td"+st).offsetWidth-2)+"px\">";
			
	}
	
	return (Number(findPosTop(document.getElementById("mainmenu")))+document.getElementById("td"+st).offsetHeight-2)+"px;left:"+
		  (Number(findPosLeft(document.getElementById("mainmenu")))+document.getElementById("td"+st).offsetLeft+5)+"px\">";

}
function findPosLeft(obj) {
	var curleft = 0;//curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		//curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			//curtop += obj.offsetTop
		}
	}
	return curleft;
}
function findPosTop(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			
			curtop += obj.offsetTop
		}
	}
	return curtop;
}
var sH="<table class=\"menu\" id=\"mainmenu\" width='165px'";
var p=0;
var j=0;


sH+="cellspacing=\"0\" "
	
sH+= ">";

while(eval("typeof(td_"+ ++j +")!=\"undefined\"")){

//onmouseover=\"doMenu(this,'_"+j+"')\" onmouseout=\"ti=setTimeout('clearMenu()',md)\""

	sH+="<tr><td class='tdShow' bgcolor="+tdBgColor+" id=\"td_"+j+"\" height=20 nowrap width='163px'";
	sH+=(eval("typeof(url_"+j+")!=\"undefined\""))?" onclick=\"doMenu(this,'_"+j+"');runMenu('"+eval("url_"+j)+"')\">":">";
	if(msIndTipoMenu=='1')
		sH+=eval("td_"+j)
	else
		sH+="<img src="+eval("imgOff_"+j)+" border=0>"
		
	///////////////////////////////////////////////////////////////////////	
	sH+="</td></tr>";
	
	
	k=0
	
	while (eval("typeof(td_"+j+"_"+ ++k +")!=\"undefined\"")){
		//onmouseover=\"doMenu(this,'_"+j+"_"+k+"')\" onmouseout=\"ti=setTimeout('clearMenu()',md)\"
		
		sH+="<tr id=\"subtd_"+j+"_"+k+"\" style=\"display:none; \" >"
		sH+="<td width='156px' class='tdHidde' nowrap bgcolor="+subtdBgColor+" id=\"td_"+j+"_"+k+"\" onmouseover=\"doMenu(this,'_"+j+"_"+k+"')\" onmouseout=\"clearMenu(this)\" ";
		sH+=(eval("typeof(url_"+j+"_"+k+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url_"+j+"_"+k)+"')\">":">";
		//if(msIndTipoMenu=='1')
			sH+=eval("td_"+j+"_"+k)
		//else
		//	sH+="<img src="+eval("imgOff_"+j+"_"+k)+" border=0>"
			
		sH+="</td></tr>";
	
	}

	
	///////////////////////////////////////////////////////////////////////
	
	if (eval("typeof(td_"+j+"_1)!=\"undefined\""))
		pT[p++]="_"+j;
		
		
		
}
sH+="</td></tr></table>";
//alert(sH)
//document.getElementById('txa').value=sH
document.write(sH);

/*for(var q=0;typeof(pT[q])!="undefined";q++){

	sT=pT[q];
	sH="";
	j=0;
	

		
	sH+="<table class=\"menu\" id=\"tbl"+sT+"\" ";
	
	if(msIndTipoMenu=='1')
		sH+="cellspacing=\"5\"  "
	else  
		sH+="cellspacing=\"0\" "
	
	sH+="style=\"top:"+getCoord(sT);
	
	while (eval("typeof(td"+sT+"_"+ ++j +")!=\"undefined\"")){
		sH+="<tr><td id=\"td"+sT+"_"+j+"\" onmouseover=\"doMenu(this,'"+sT+"_"+j+"')\" onmouseout=\"ti=setTimeout('clearMenu()',md)\"";
		sH+=(eval("typeof(url"+sT+"_"+j+")!=\"undefined\""))?" onclick=\"runMenu('"+eval("url"+sT+"_"+j)+"')\">":">";
		if(msIndTipoMenu=='1')
			sH+=eval("td"+sT+"_"+j)
		else
			sH+="<img src="+eval("imgOff"+sT+"_"+j)+" border=0>"
			
		sH+="</td></tr>";
		if (eval("typeof(td"+sT+"_"+j+"_1)!=\"undefined\""))
			pT[p++]=sT+"_"+j;
	}
	sH+="</table>";
	//document.write(sH);
}*/
document.getElementById("mainmenu").style.visibility="visible";

