/*
        LeftNavMenu Class

Author: Eriko Hidalgo
Date:   09-Jun-2007      
*/

function LeftNavMenu ()
{
    var _title = "";
    var _childs = new Array() ;
	var _width = 0;
	var _height = 0;
	var _imagesFolder = "images";
	
    
    this.DrawMenu = function DrawMenu ()
    {
        //document.writeln ("LALALALA" + _title);
        document.write ("<TABLE cellspacing='0' cellpadding='0' width='" + _width + "'>");
        
		//DrawTableTopRow ();
        DrawTableTopRow (_title, "LeftNavMenu_Title");
        
        for (i = 0; i < _childs.length; i++)
        {
            DrawTableRow ( _childs[i].GetHTMLValue() , "LeftNavMenu_Items" );
        }
        
        document.write ("</TABLE>");
    };
    
    this.SetTitle = function SetTitle (title)
    {
        _title = title ;
    };
	
    this.SetImagesFolder = function SetImagesFolder (imagesFolder)
    {
        _imagesFolder = imagesFolder ;
    };	
	
	this.SetSize = function SetSize (width, height)
	{
		_width = width;
		_height = height;
	}
    
    this.AddChild = function AddChild (title, href)
    {
        var menuItem = new LeftNavMenuItem () ;
        menuItem.SetValues (title, href) ;
        _childs[_childs.length] = menuItem ;
    }; 
	
	function DrawTableTopRow (rowContent , style)
	{
        document.write ("<TR>");
		document.write ("<TD valign='top' class='LeftNavMenu_Title'>");
		document.write ("<IMG src='" + _imagesFolder + "/topLeftCorner.gif" + "'/>");
		document.write ("</TD>");
        document.write ("<TD class='" + style + "' height='" + _height + "'>");
        document.write ("<DIV class='LeftNavMenu_TitleText'>" + rowContent + "</DIV>");
        document.write ("</TD>");
		document.write ("<TD valign='top' class='LeftNavMenu_Title' align='right'>");
		document.write ("<IMG src='" + _imagesFolder + "/topRightCorner.gif" + "'/ >");
		document.write ("</TD>");		
        document.write ("</TR>");		
	}
    
    function DrawTableRow (rowContent , style)
    {
        document.write ("<TR>");
        document.write ("<TD colspan='3' class='" + style + "' height='" + _height + "'>");
        document.write ("<DIV class='LeftNavMenu_ItemsText'>" + rowContent + "<DIV>");
        document.write ("</TD>");
        document.write ("</TR>");
    };
}

    // LeftNavMenuItem Class Definition 
    function LeftNavMenuItem ()
    {
        var _title = "";
        var _href = "";
        
        this.SetValues = function SetValues (title , href)
        {
            _title = title;
            _href = href;
        };
        
        this.GetHTMLValue = function GetHTMLValue ()
        {
           return "<a class='LeftNavMenu_Anchor' href='" + _href + "'>" + _title + "</a>" ;
        };
        
    }

