window.onresize = positionMenu
var clearing, unknownBrowser
var nsubs=6
var submenunames=new Array("why","about","services","first","faq", "flash")//,"examples","manual")
var submenurows=new Array(0,0,0,0,0,0)          //2,3)
var submenucolumns=new Array(0,1,2,3,4,0)       //3,3)
var submenuparents=new Array(-1,-1,-1,-1,-1,2)   //2,2)
var positioned=false
var menutop, menuObj, menuStyle
if (typeof(document.getElementById) != 'undefined')	//IE5+, Opera 5, NN6, Mozilla5
{
	var docstr1='document.getElementById("'
	var docstr2='").style'
	var docstr2a='")'
}
else if (typeof(document.all) != 'undefined')		// IE4+
{
	var docstr1='document.all.'
	var docstr2='.style'
	var docstr2a=''
}
else if (typeof(document.layers) != 'undefined')	//NN4
{
	var docstr1='document.layers.'
	var docstr2=''
	var docstr2a=''
}
else
{
	unknownBrowser=true
	alert('Sorry - Your browser does not support the functions required to operate drop-down menus on this page')
}

function showMenu(sm)
{
	eval('menuObj='+docstr1+sm+docstr2a)
	if (unknownBrowser || !menuObj || !nsubs) return
	eval('menuStyle='+docstr1+sm+docstr2)
	if (!positioned) positionMenu()
	clearTimeout(clearing)
	var parent=0
	for (var i=5-1;i>=0;i--)
	{
		if (submenunames[i]==sm || i==parent)
		{
			parent=submenuparents[i]
			eval(docstr1+submenunames[i]+docstr2+'.visibility="visible"')
		}

		else
		{
			eval(docstr1+submenunames[i]+docstr2+'.visibility="hidden"')
		}
	}
}
function hideMenu(sm)
{
	eval('menuObj='+docstr1+sm+docstr2a)
	if (unknownBrowser || !menuObj || !nsubs) return
	clearing=setTimeout('hideAll()',1000)
	
}

function hideFlash()
{
  eval(docstr1+submenunames[5]+docstr2+'.visibility="hidden"')
}
function showFlash()
{
eval(docstr1+submenunames[5]+docstr2+'.visibility="visible"')
}
function hideAll()
{
	if (unknownBrowser || !nsubs) return
	for (var i=0;i<5;i++)
	{
		eval(docstr1+submenunames[i]+docstr2+'.visibility="hidden"')
	}
	eval(docstr1+submenunames[5]+docstr2+'.visibility="visible"')
}


function onSubMenu(sm)
{
	clearTimeout(clearing)
}
function positionMenu()
{
	if (unknownBrowser || !nsubs) return
	var mleft,mtop
	if (typeof(document.body) == 'undefined' || typeof(document.body.leftMargin) == 'undefined')
	{
		menutop=7+90
		if (window.innerWidth<=(720+10))
		{
			var menuleft=7
		}
		else
		{
			var menuleft=(window.innerWidth-720)/2-10
		}
	}
	else
	{
		menutop=parseInt(document.body.topMargin)+98 // this is the top of the menu
				if ((document.body.clientWidth-document.body.leftMargin-document.body.rightMargin)<=720)
		{
			var menuleft=parseInt(document.body.leftMargin)
		}
		else
		{
			var menuleft=(document.body.clientWidth-720)/2
		}
	}
	var menuleft = 0
	for (var i=0;i<5;i++)
	{
		
		mleft= menuleft + 144 * submenucolumns[i] 
		mtop=menutop+15*submenurows[i]
		eval(docstr1+submenunames[i]+docstr2+'.left='+mleft)
		eval(docstr1+submenunames[i]+docstr2+'.top='+mtop)
	}
		   
	eval(docstr1+submenunames[5]+docstr2+'.left='+320)
		eval(docstr1+submenunames[5]+docstr2+'.top='+144)
	
	if (typeof(document.opera)!='undefined') positioned=true //window.onresize doesn't work in Opera...
}
function changeImage(image,source)
{
	image.src=source
}

