<!--

// position of the menu in pixels from offset 0
menuleft = 7; 
menutop  = 30;
menucat = new Array ();

var catnumber = 0;
var layercount;
var prevcatnum = "";

ns = document.layers;
ie = document.all;



// onload handlers can collide with other onload handlers 
// if they appear on the same html document...
// function start -> moved to bottom of document..
// onload = start;

// - - - - define submenu content start - - - - 

addcat ("masters");
addsubcat ("cursosmasters","http://www.about");
addcat ("empresa");
addsubcat ("cursosempresa","http://www.about");
addcat ("terrestre");
addsubcat ("cursosterrestre","http://www.about");
addcat ("maritimo");
addsubcat ("cursosmaritimo","http://www.about");
addcat ("tecnicos");
addsubcat ("cursostecnicos","http://www.about");
addcat ("preparatorios");
addsubcat ("cursospreparatorios","http://www.about");
addcat ("nauticos");
addsubcat ("cursosnauticos","http://www.about");

// - - - - define submenu content stop - - - - 


// resize fix for netscape start
if (ns  &&  !window.saveInnerWidth) 
{
    window.onresize = resize;
    window.saveInnerWidth = window.innerWidth;
    window.saveInnerHeight = window.innerHeight;
}
//resize fix for netscape stop



function addcat (name) 
{
    if (ns) 
    {
        menucat.push (name);
    }
    
    if (ie) 
    {
        mlen = menucat.length;
        menucat[mlen] = name;
    }
    
    ++catnumber;
    eval ("submenucat" + catnumber + " = new Array ()");
}



function addsubcat (name, url) 
{
    if (ns) 
    {
        eval ("submenucat" + catnumber + ".push (name)");
        eval ("submenucat" + catnumber + ".push (url)");
    }
    
    if (ie) 
    {
        mlen = eval ("submenucat" + catnumber + ".length");
        eval ("submenucat" + catnumber + "[mlen] = name");
        eval ("submenucat" + catnumber + "[mlen + 1] = url");
    }
}



function resize () 
{
    if (saveInnerWidth < window.innerWidth 
        ||  saveInnerWidth > window.innerWidth 
        ||  saveInnerHeight > window.innerHeight 
        ||  saveInnerHeight < window.innerHeight)
    {
        window.history.go (0);
    }
}


function start ()
{
    // load arrow pics
    arrow = new Image ();
    arrow.src = "img/bullet.gif";
    
    arrowA = new Image();
    arrowA.src = "img/bullet1.gif";
    
    reposition ();
    showmaincats ();
}
        


function show (catnum) 
{
    // check for no subcat
    if (eval ("submenucat" + catnum + ".length") != 0) 
    {
        showit (catnum);
    }
}



function showit (catnum) 
{
    catname = "subcat" + catnum;
    
    if (ns) 
        var vis = document.layers[catname].visibility;
    
    if (ie) 
        var vis = eval (catname + ".style.visibility");
    
    if (vis == "show"  ||  vis == "visible") 
    {
                vis = "hidden";
                arr = arrow;
    }
    else 
    {
                vis = "visible";
                arr = arrowA;
    }
    
    // hide previous subcat
    if (prevcatnum.length != ""  &&  catname != prevcatnum) 
    {
                if (ns) 
                    document.layers["subcat" + prevcatnum].visibility = "hidden";
        
                if (ie) 
                {
                    tmp = eval ("subcat" + prevcatnum + ".style");      
                    tmp.visibility = "hidden";
                }
                arrownum = "arrow" + prevcatnum;
                if (ns) 
                    eval ("document.cat" + prevcatnum + ".document.images[arrownum].src = arrow.src");
                
                if (ie) 
                    eval ("document.images[arrownum].src = arrow.src");
    }
    
    // save previous catnum
    prevcatnum = catnum;
        
    if (ns) 
                document.layers[catname].visibility = vis;
    
    if (ie) 
    {
                tmp = eval (catname + ".style");
                tmp.visibility = vis;
    }
    
    // change arrow
    arrownum = "arrow" + catnum;
    if (ns) 
                eval ("document.cat" + catnum + ".document.images[arrownum].src = arr.src");
    
    if (ie) 
                eval ("document.images[arrownum].src = arr.src");       
    
    reposition ();
}



function reposition () 
{
    var   thiscat;      
    var   nextcat;
    var   space    = 1;
    var   nextcatY = menutop;
    
    for (i = 1; i <= menucat.length; ++i)
    {
        // align main cats
        if (ns) 
            thiscat = eval ("document.layers.cat" + i);
        
        if (ie) 
            thiscat = eval ("cat" + i + ".style");
        
        if (i + 1 < menucat.length)
        {
            if (ns) 
                nextcat = eval ("document.layers.cat" + (i + 1));
            
            if (ie) 
            {
                tmpi = i + 1;
                nextcat = "cat" + tmpi + ".style";
            }
        }
        
        thiscat.left = menuleft;
        thiscat.top = nextcatY;
        
        if (ns) 
            nextcatY += thiscat.document.height + space;
        
        if (ie) 
        {
            tempY = eval ("document.all.cat" + i + ".offsetHeight");
            
            // safety check layer height... (explorer)
            while (tempY < 7) 
            {
                tempY = eval ("document.all.cat" + i + ".offsetHeight");
            }
            
            tempY = tempY + space;
            nextcatY += tempY;
        }
        
        // check for no subcat
        if (eval ("submenucat" + i + ".length") != 0) 
        {
            // align sub cats
            if (ns) 
                thiscat = eval ("document.layers.subcat" + i);
            
            if (ie) 
                thiscat = eval ("subcat" + i + ".style");
            
            if (thiscat.visibility == "show"  ||  thiscat.visibility == "visible")
            {
                thiscat.left = menuleft;
                thiscat.top = nextcatY;
                
                if (ns) 
                    nextcatY += thiscat.document.height + 7;
                
                if (ie) 
                {
                    tempY = eval ("document.all.subcat" + i + ".offsetHeight");
                    nextcatY += tempY + 7;
                }
            }
        }
    }
}



function showmaincats () 
{
    // do main cats visible
    for (i = 1; i <= menucat.length ; ++i) 
    {
        if (ns) 
            thiscat = eval ("document.layers.cat" + i);
        
        if (ie) 
            thiscat = eval ("cat" + i + ".style");
        
        thiscat.visibility = "visible";
    }
}

// -->