var menuBegin = '<TD id="menu" WIDTH="152px" VALIGN="TOP">'+
'<FONT FACE="Verdana, Arial, Helvetica" SIZE="2">';

var menuEnd = '<BR />'+
'</DIV>'+
'<a href="../en/rubymain.shtml"><IMG SRC="../images/english.gif" WIDTH="32" HEIGHT="32" BORDER="0" ALT="rubyCHannel (english)"></a>'+
'  <a href="../de/rubymain.shtml"><IMG SRC="../images/german.gif" WIDTH="32" HEIGHT="32" BORDER="0" ALT="rubyCHannel (deutsch)"></a>'+

'</FONT>'+
'</TD>';

var langMenuMap = [
    ["rubywhat.shtml", "What is Ruby"],
    ["rubyhistory.shtml", "Ruby History"],
    ["rubycompare.shtml", "Compared to ..."]];

var downloadMenuMap = [
    ["rubysources.shtml", "Ruby Sources"],
    ["rubywin32.shtml", "Ruby Win32"],
//    ["rubylinux.shtml", "Ruby Linux"],
    ["rubyraa.shtml", "RAA"]];

var rubyAndMenuMap = [
    ["rubyxml.shtml", "XML/XSL(T)"],
    ["rubydb.shtml", "databases"]
    ];

var resourceMenuMap = [
    ["rubybooks.shtml", "Books"],
    ["rubyarticles.shtml", "Articles"],
    ["rubylinks.shtml", "Links"]];

var contactMenuMap = [
    ["mailto:clemensDOTwyssAThelblingDOTch?subject=rubyCHannel", "Clemens Wyss"]
    ];

var menuMap = [
    ["THE Language", langMenuMap],
    ["Downloads", downloadMenuMap],
    ["Ruby and...", rubyAndMenuMap],
    ["Resources", resourceMenuMap],
    ["Contact me", contactMenuMap]];

function drawMenu()
{
    var thisUrl = document.URL;
    var splittedPathArr = thisUrl.split('/');
    var selectedMenuPoint = splittedPathArr[splittedPathArr.length-1];
    document.write('<img src="../images/new1.gif" WIDTH="29" HEIGHT="16"><a alt="DAS deutsche Ruby Buch" href="/en/rubybooks.shtml"><b>"Programmieren mit Ruby", DAS deutsche Rubybuch</b></a><br /><br />');    
    document.write('<a alt="Wanna test the code in the book online?" href="/en/rubybookonline.shtml"><b>"Programming Ruby" book INTERACTIVE!</b></a><br /><br />');    
    document.write('<a alt="Open the Ruby Tutorial" href="../tutorial" target="_blank" ><b>The Ruby Tutorial</b></a><br /><br />');    
    document.write('<img src="../images/new1.gif" WIDTH="29" HEIGHT="16"><a alt="Open the Ruby interpreter" href="javascript:openInterpreter()"><b>The Ruby Interpreter</b></a><br /><br />');
    document.write('<a alt="Open the RWIKI with a Ruby interpreter connection" href="/cgi-bin/rw.cgi" target="_blank" ><b>RWIKI Plus</b></a><br /><br />');    
    for (var i = 0; i < menuMap.length; i++) { 
        document.write('<B>');
        document.write(menuMap[i][0]);
        document.write('</B><BR />');
        //document.write('<DIV STYLE="margin-left:9">'); // Netscape seems to habe a problem here!
        drawSubMenu(menuMap[i][1], selectedMenuPoint);
        document.write('<BR />');
        //document.write('</DIV>'); // Netscape seems to habe a problem here!
    } 

    document.write('<font size="-2"><b>supported by</b></font><br />');
    document.write('<a href="http://www.helbling.ch"><IMG SRC="../images/helbling_ani.gif" WIDTH="93" HEIGHT="56" BORDER="0" ALT="Helbling Group, where engineering meets consulting"></a>');
}

function drawSubMenu(submenu, selectedMenuPoint)
{
    for (var j = 0; j < submenu.length; j++) {
        if (submenu[j][0] == selectedMenuPoint)
        {
            document.write('<IMG SRC="../images/ruby_small.jpg" WIDTH="12" HEIGHT="15" BORDER="0" ALT="">  <font color="#7f2b2b"><b>' + submenu[j][1] + '</b></font><BR />');
        } else {
            document.write('<A HREF="' + submenu[j][0] +'">' + submenu[j][1] + '</A><BR />');
        }
    }
}


function showMenu ()
{
    document.write(menuEnd);
    document.write(menuBegin);
    drawMenu();

}


