// JScript source code

var gAllBars = new Array();

function CreateOutLookToolBar ( name, width, height )
{
	this.name = name;
	this.width = width;
	this.height = height;
	
	this.bgcolor = "#f1f1f1"
	this.headercolor = "#FFFFFF";
	
	this.addPanel = _AddPanel;
	this.draw = _DrawOutLookToolBar;
	this.displayPanel = _ShowPanel; //_DisplayPanel;

	this.panels = new Array();
	
	this.index = gAllBars.length;
	gAllBars[gAllBars.length] = this;
}

function CreatePanel ( name, title )
{
	this.name = name;
	this.title = title;
	this.active = false;
	
	this.addNodes  = _AddPanelNodes;
	
	this.nodes = new Array();
	this.nodelinks = new Array();
}

function _ShowPanel ( panelID )
{
	_DisplayPanel ( this.index, panelID )
}

function _DisplayPanel ( nIndex, panelID )
{
	var uparrow = new Image();
	var dnarrow = new Image();
	uparrow.src = "/common/images/uparrow1.gif";
	dnarrow.src = "/common/images/downarrow.gif";
	
    for (i=0;i<gAllBars[nIndex].panels.length;i++) 
    {
		document.all[gAllBars[nIndex].panels[i].name+'_panel'+i].style.display = "none";
		if (gAllBars[nIndex].panels[i].active == true) 
		{
			gAllBars[nIndex].panels[i].active = false;
			document.all[gAllBars[nIndex].panels[i].name+'_img'].src = uparrow.src;
		}
		
		if ( panelID == gAllBars[nIndex].panels[i].name)
		{
			gAllBars[nIndex].panels[i].active = true;
			gActiveIndex = nIndex
			document.all[panelID+"_panel"+i].style.display = "";
			document.all[gAllBars[nIndex].panels[i].name+'_img'].src = dnarrow.src;			
		}
	}	
}

function _AddPanelNodes ( text, url )
{
	this.nodes[this.nodes.length] = text;
	this.nodelinks[this.nodelinks.length] = url;
}

function _AddPanel ( objPanel )
{
	//objPanel.name = this.name + '_panel' + this.panels.length
	this.panels[this.panels.length] = objPanel;
}

function _DrawOutLookToolBar()
{
	//OutlookBar layer..
    document.write('<div id='+this.name+' Style="height:' + this.height + 'px; width:' + this.width + 'px;"> ');
//    document.write(' background-color: white;">')
    
    for (i=0;i<this.panels.length;i++) 
    {
		document.write('<div id='+this.name+'_panel'+i+'>');
		
		if ( i != 0 ) document.write ('<table height=1px><tr height=1px><td height=1px></td></tr></table>');
		
		//document.write('<div id='+this.panels[i].name+' onclick="javascript:_DisplayPanel ('+this.index+", '"+this.panels[i].name+"')"+'" ' );
		document.write('<div style="height:19;" id='+this.panels[i].name+'>');
		document.write('<TABLE height=19 class=olbtab cellSpacing=0 cellPadding=0 width=150 border=0><tbody><TR><TD ');
		document.write(' style="cursor:pointer;" onclick="javascript:_DisplayPanel ('+this.index+", '"+this.panels[i].name+"')"+'">');
        document.write(''+this.panels[i].title+'</TD><td width=13 style="cursor:pointer;">');
		document.write('<img id='+this.panels[i].name+'_img'+' src="/common/images/uparrow1.gif"');
		document.write(' onclick="javascript:_DisplayPanel ('+this.index+", '"+this.panels[i].name+"')"+'"></td></TR></tbody></TABLE></div>');
		
		//document.write ( this.panels[i].title + '<img src="/common/images/chevronUp.gif" align="middle"></div>');
		document.write('<div id='+this.panels[i].name+'_panel'+i+' style="overflow:auto; padding:5px; display: none; height:' + this.height + 'px; ">');
		
		for (j=0;j<this.panels[i].nodes.length;j++) 
		{
			document.write('<TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" border=0>');
			document.write('<tr><td class="lt00" onmouseover="this.className='+ "'" + "lt11'" +'" ');
			document.write('onmouseout="this.className=' + "'" + "lt00'" +'" ');

/*	  
			document.write('<a id='+this.panels[i].name+'_panel'+i+'_lnk'+j);
			document.write(' style="text-decoration:none;" href="javascript:LoadIFrame('+"'"+this.panels[i].nodelinks[j]+"','"+this.panels[i].name+"')" + '">' + this.panels[i].nodes[j] + '</a>');
			document.write ('</td></tr></table>');
*/
			document.write(' id='+this.panels[i].name+'_panel'+i+'_lnk'+j);
			document.write(' style="cursor:pointer;text-decoration:none;" onclick="javascript:LoadIFrame('+"'"+this.panels[i].nodelinks[j]+"','"+this.panels[i].name+"')" + '">' + '&raquo;' + '&nbsp;&nbsp;' + this.panels[i].nodes[j]);
			document.write ('</td></tr></table>');
		}
		
		document.write ('</div></div>');
	}
}