// Drop-down menu v1.1
// -------------------
// 
// Revision history:
// 1.0	First version, simple show/hide of menu on mouseover
// 1.1  Current version, with "wipe down" transition for showing menu, "wipe up" transition for hiding menu.
//
// All menus should be defined with a <DIV> tag, with the visibility set to "hidden"
// The showmenu() function should then be called to make it visible.
// To hide the menu, call hidemenu()
//

// Setup defaults
if ( trans==null )
	var trans=true;

if ( duration==null )
	var duration=0.3;

menuOn=false;

document.onclick=hidemenu2;

// Test for Internet Explorer 4.0
function IsIE4()	{
	return ( navigator.appName == "Microsoft Internet Explorer" && parseInt( navigator.appVersion ) >= 4 );
}


// Shows the menu
function showmenu2( menuNum )
{

	if ( IsIE4() )	{
		var a=document.all.item("menu");

		// Only allow mouseover to take place after the document is completely loaded
		if ( document.readyState == "complete" )	{
			hidemenu2();												// Hide every other menu which might be displaying at this time

//			toggleFlash();						
			
			// Show the desired menu
			if ( a(menuNum))	{									// Check if the menu exists, if not, ignore
				if ( a(menuNum).filters.item(0) && trans==true )	{				// Only apply transition if its defined in the menu itself, otherwise, simply make it visible
					a(menuNum).filters.item(0).transition=5;		// Set Transition to "wipe down"
					if ( a(menuNum).filters.item(0).status == 0 )	
						a(menuNum).filters.item(0).apply();			// Apply the transition effect
					a(menuNum).style.visibility="visible";			// Set the final state of the menu (i.e. make it visible)
					a(menuNum).filters.item(0).play( duration );				// "Play" the transition
				}	
				else
					a(menuNum).style.visibility="visible";			// Simply make the menu visible if it has no transition filters defined
			}
		}
	menuOn=true;
	return true;
	}
}

// Hides the menu



function hidemenu2()
{

	var a;
	if ( IsIE4() )	{
		if ( menuOn )	{		
			a=document.all.item("menu");
			if ( a != null )	{
				if ( a.length != null )	{
					for (i=0; i<a.length; i++)	{
						menuNum=i;
						if( a(menuNum).filters.item(0) && trans==true )	{	
							if ( a(menuNum).filters.item(0).status == 0 )	{
								a(menuNum).filters.item(0).transition=4;
								a(menuNum).filters.item(0).apply();
								a(i).style.visibility="hidden";
								a(menuNum).filters.item(0).play( duration );
							}
							else
								a(i).style.visibility="hidden";
						}
						else
							a(i).style.visibility="hidden";
					}	
				}
			}
		}
		else
			return true;
	}
	menuOn=false;
	return true;
}


// All the required menus should be defined here.
function drawmenus()
{
	var s;

	if ( IsIE4() )	{

		// About us Menu
	
		s +=	'<div id="menu" style="position:absolute; left:225; top:208; z-index:1; visibility:hidden; filter: revealtrans(duration=0.25, transition=5)">';
		s +=	'<table cellpadding="4" cellspacing="1" border="0" width="120" BGCOLOR="#999999">';
		s +=	'<tr>';
		s +=  	'	<td bgcolor="#ffffff">';
		s += 	'About Us';
		s += 	'<%=strSideMenu%><BR>';
		s += 	'<%=strSideMenu%><BR>';
		s += 	'<%=strSideMenu%><BR>';
		s +=	'</tr>';
		s +=	'</table>';
		s +=	'</div>';

		// Services Menu			
		s +=	'<div id="menu" style="position:absolute; left:277; top:208; z-index:1; visibility:hidden; filter: revealtrans(duration=0.25, transition=5)">';
		s +=	'<table cellpadding="4" cellspacing="1" border="0" width="120" BGCOLOR="#999999">';
		s +=	'<tr>';
		s +=  	'	<td bgcolor="#ffffff">';
		s += 	'Services<BR>';
//		s += 	'<%=strSideMenu?Section_ID=1%>';
		s +=	'	</td>';
		s +=	'</tr>';
		s +=	'</table>';
		s +=	'</div>';
	
		// Case Histories Menu
		s +=	'<div id="menu" style="position:absolute; left:332; top:208; z-index:1; visibility:hidden; filter: revealtrans(duration=0.25, transition=5)">';
		s +=	'<table cellpadding="4" cellspacing="1" border="0" width="120" BGCOLOR="#999999">';
		s +=	'<tr>';
		s +=  	'	<td bgcolor="#ffffff">';
		s += 	'Case Histories';
//		s += 	'<%=strSideMenu?SectionID=1%>';
		s +=	'	</td>';
		s +=	'</tr>';
		s +=	'</table>';
		s +=	'</div>';

		// News Menu
		s +=	'<div id="menu" style="position:absolute; left:413; top:208; z-index:1; visibility:hidden; filter: revealtrans(duration=0.25, transition=5)">';
		s +=	'<table cellpadding="4" cellspacing="1" border="0" width="120" BGCOLOR="#999999">';
		s +=	'<tr>';
		s +=  	'	<td bgcolor="#ffffff">';
		s += 	'News';
//		s += 	'<%=strSideMenu?pSectionID=1%>';
		s +=	'	</td>';
		s +=	'</tr>';
		s +=	'</table>';
		s +=	'</div>';

		// Contact Menu
		s +=	'<div id="menu" style="position:absolute; left:570; top:208; z-index:1; visibility:hidden; filter: revealtrans(duration=0.25, transition=5)">';
		s +=	'<table cellpadding="4" cellspacing="1" border="0" width="140" BGCOLOR="#999999">';
		s +=	'<tr>';
		s +=  	'	<td bgcolor="#ffffff">';
		s += 	'Contact';
//		s += 	'<%secID=1%>';
//		s += 	'<%=strSideMenu%>';
		s +=	'	</td>';
		s +=	'</tr>';
		s +=	'</table>';
		s +=	'</div>';

		document.write( s );
	}
}

function toggleFlash( n )
{
	if ( document.all("staticImg") && document.all("flash") )	{
		if ( n==1 )	{
			staticImg.style.display="none";
			flash.style.display="block";
		}
		else	{
			staticImg.style.display="block";
			flash.style.display="none";
		}
	}
}
