NS4 = (this.document.layers) ? 1 : 0;

function layer_enter (id)
{
	on_layer_id = id;
}

function layer_exit (id)
{
	on_layer_id = - 1;
	setTimeout ('hide('+ id +')', delay/5);
}

function menu_enter (id)
{
	if (buff_id >= 0)
		hide (buff_id);
	show (id);
	active_layer_id = id;
}

function menu_exit (id)
{
	setTimeout ('hide('+ id +')', delay);
	buff_id = active_layer_id;
	active_layer_id = -1;
}

function show (id)
{
	if (!NS4)
		document.all['Menu' + id].style.visibility = "visible";
	else
		document.layers[id].visibility = "visible";
}

function hide (id)
{
	if (active_layer_id != id && on_layer_id != id)
	{
		if (!NS4)
			document.all['Menu' + id].style.visibility = "hidden";
		else
			document.layers[id].visibility = "hide";
	}
}

function side_menu()
{
	var smenu='';

	smenu +='<table width="135" border="0" cellspacing="0" cellpadding="0">';
	smenu +='<tr><td colspan=2 align="left"><img src="images/m_right_top2.gif" width="130" height="80"></td>';
	
	smenu +='<td><spacer type="block" width=1 height=1></td></tr>';
	
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="about.htm">About Us</a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	
	smenu +='<tr><td width="2" colspan=2 height=3 bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=3><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="2" bgcolor="#B08D00" colspan=2 height=2><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=2><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="2" colspan=2 height=3 bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=3><spacer type="block" width=1 height=1></td></tr>';
	
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="serv_schedule.htm"> Scheduled Services </a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	//smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="javascript:void(0)" onMouseOver="menu_enter(0);" onMouseOut="menu_exit(0);">Scheduled Services</a><img border="0" src="images/arrow_down.gif" width="8" height="8"></font></td>';
	
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="serv_express.htm"> Chartered Services </a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="serv_adhoc.htm"> Ad-hoc & Term Charters </a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="serv_others.htm"> Affiliated Services </a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	
	//smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	//smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="javascript:void(0)">Affiliated Services </a></font></td>';
	//smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';



   	smenu +='<tr><td width="2" colspan=2 height=3 bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=3><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="2" bgcolor="#B08D00" colspan=2 height=2><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=2><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="2" colspan=2 height=3 bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=3><spacer type="block" width=1 height=1></td></tr>';
	
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="construct.htm">Bus-Plus SMARTime System</a> </font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="promos.htm">Promotions</a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="advert.htm">Advertise With Us</a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="2" colspan=2 height=3 bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=3 ><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="2" bgcolor="#B08D00" colspan=2 height=2><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=2><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="2" bgcolor="#FFCC00" colspan=2 height=3><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="5" height=3 ><spacer type="block" width=1 height=1></td></tr>';

	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="booking.htm">Online Booking</a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="contact.htm">Contact Us</a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	smenu +='<tr><td width="4" bgcolor="#FFCC00"><spacer type="block" width=1 height=1></td>';
	smenu +='<td width="126" bgcolor="#FFCC00" height="20"><font class="txtF"><a href="feedback.htm">Service Feedback</a></font></td>';
	smenu +='<td width="5"><spacer type="block" width=1 height=1></td></tr>';
	smenu +='<tr><td colspan=2><img src="images/m_right_bot2.gif" width="130" height="26"></td>';
	smenu +='<td><spacer type="block" width=1 height=1></td></tr></table>';

	document.write(smenu);
}


function generate_layers ()
{
	for (i = 0; i < menu_content.length; i++)
	{
		if (!NS4)
			layer_header = '<div id=Menu' + i +
					   	   ' onMouseOver="layer_enter (' + i + ');" onMouseOut = "layer_exit (' + i + ');"' +
				           ' style="visibility: hidden; position: absolute; left: ' + (left_corner_x + menu_width) +
				           '; top: ' + left_corner_y + ';">';
		else
			layer_header = '<layer id=' + i +
						   ' onMouseOver="layer_enter (' + i + ');" onMouseOut = "layer_exit (' + i + ');"' +
						   ' visibility=hide left=' + (left_corner_x + menu_width) +
						   ' top = ' + left_corner_y + '>';

		layer_header += '<table width=' + menu_width +' cellpadding=0 cellspacing=0 border=0><tr>' +
					    '<td bgcolor=' + border_color + ' height=20 align=center><table width=' + menu_width + ' cellpadding=1 ' +
					    'cellspacing=' + border_size + ' border=0>';

		elements = menu_content[i].split (/\s*\|\s*/);
		
		layer_body = '';
		for (j = 0; j < elements.length; j++)
		{	
				
				if(j>4)
				back_color="#ECFF82";
				else if(j==4)
				back_color="#9DB900";
				
				layer_body +='<tr><td width=' + menu_width + ' bgcolor=' + back_color + '>';
				
				
			layer_body += elements[j];

			if ((NS4 && j < elements.length - 1) || (!NS4 && j < elements.length - 1))
				layer_body +='</td></tr>';
			

		}

		layer_footer = '</table></td></tr></table>';
		if (!NS4)
			layer_footer += '</div>';
		else
			layer_footer += '</layer>';
		document.writeln (layer_header + layer_body + layer_footer);
	}
}

generate_layers ();
