var divVis = null;
var bOver = false;
var bLockMenu = false;
var timeoutHide = null;

var aopt = new Array();
	
aopt[0] = [];

aopt[1] = [ "<a href='/contact.asp'><b>Full Contact details</b></a>",
		    "->",
		    "<em>NoiseMeters Limited</em>",
		    "<em>West End</em>",
		    "<em>Muston</em>",
			"<em>YO14 0ES</em>",
			"<em>England</em>",
			"",
		    "Telephone: 0845 680 0312",
			"<a href='mailto:info@noisemeters.co.uk'>Email: info@noisemeters.co.uk</a>",
			"<-",
		    "",
			"<em>Other Regions</em>",
			"<img src='/images/flags/menu-eu.gif' width='20' height='12' align='right'>     <a href='http://www.noisemeters.eu'>NoiseMeters Europe",
		    "<img src='/images/flags/menu-us.gif' width='20' height='12' align='right'>     <a href='http://www.noisemeters.com'>NoiseMeters USA</a>",
		    "<img src='/images/flags/menu-ca.gif' width='20' height='12' align='right'>     <a href='http://www.noisemeters.ca'>NoiseMeters Canada</a>",
			"",
			"<a href='/help/export.asp'>Export Information</a>"
		  ];

aopt[2] = [ "<a href='/products.asp'><b>Product Price List</b></a>",
		    "",
		    "<img src='/menu/occ.gif' width='18' height='12' align='right'><a href='/safety.asp'><b>Noise at Work Page</b></a>",
			"->",
		    "<a href='/product/cr262.asp'>Integrating Meter</a>",
		    "<a href='/product/cr160/'>Advanced Noise at Work Meter</a>",
		    "<a href='/product/dbadge.asp'>doseBadge Noise Dosemeter</a>",
			"<-",
			"",
		    "<img src='/menu/env.gif' width='18' height='12' align='right'><a href='/env.asp'><b>Environmental Noise Page</b></a>",
			"->",
		    "<a href='/product/cr811.asp'>Data Logging Meter</a>",
		    "<a href='/product/p33.asp'>Real-Time Analyzer</a>",
		    "<a href='/product/noise-nuisance/'>Neighbour Noise</a>",
		    "<a href='/accessories/outdoorkits.asp'>Outdoor Noise Measurement</a>",
			"<-",
			"",
		    "<img src='/menu/sign.gif' width='18' height='12' align='right'><a href='/signs.asp'><b>Noise Warning Signs Page</b></a>",
			"->",
		    "<a href='/product/noise-sign/'><em>NoiseSign</em> Warning Sign</a>",
		    "<a href='/product/soundear/'><em>SoundEar</em> Warning Sign</a>",
		    "<a href='/product/soundearpro/'>Wireless Noise Monitor</a>",
			"<-",
			"",
		    "<img src='/menu/slm.gif' width='18' height='12' align='right'><a href='/general.asp'><b>General Purpose Page</b></a>",
			"->",
		    "<a href='/product/tm-102/noise-meter.asp'>Sound Level Meter</a>",
		    "<a href='/product/class-2/'>Calibrated Class 2 Meter</a>",
		    "<a href='/product/cr150/'>Optimus Sound Level Meter</a>",
			"<-",
			"",
		    "<a href='/accessories/'><b>Accessories</b> (Calibrators, Mics)</a>",
			"",
		    "<a href='/offers.asp'><b>Used Meters and Dosimeters</b></a>"
		  ];

aopt[3] = [ "<a href='/hire/'><b>Hire Price List</b></a>",
		    "",
		    "<img src='/menu/occ.gif' width='18' height='12' align='right'><a href='/hire/apps/noise-at-work.asp'><b>Noise at Work Page</b></a>",
			"->",
		    "<a href='/hire/detail/dosebadge.asp'>doseBadge Dosemeter</a>",
		    "<a href='/hire/detail/integrating.asp'>Basic Noise at Work Meter</a>",
		    "<a href='/hire/detail/type2-logging.asp'>Data Logging Meter</a>",
		    "<a href='/hire/detail/occ-octave.asp'>Advanced Noise at Work Meter</a>",
			"<-",
			"",
		    "<img src='/menu/env.gif' width='18' height='12' align='right'><a href='/hire/apps/environmental.asp'><b>Environmental Noise Page</b></a>",
			"->",
		    "<a href='/hire/detail/class-1-logging.asp'>Data Logging Meter</a>",
		    "<a href='/hire/detail/type1-logging.asp'>1/3 Octave Band</a>",
		    "<a href='/hire/detail/analyser.asp'>Real-Time Octaves</a>",
		    "<a href='/hire/detail/outdoor-light.asp'>Outdoor Noise Kit</a>",
		    "<a href='/hire/detail/noise-nuisance.asp'>Neighbour Noise Recording</a>",
			"<-"
		  ];

aopt[4] = [ "<a href='/consult/noise-at-work/'><b>Noise at Work Assessment</b></a>",
			"->",
			"<a href='/consult/noise-at-work/'>Overview</a>",
			"<a href='/consult/noise-at-work/survey.asp'>The Survey</a>",
			"<a href='/consult/noise-at-work/report.asp'>The Report</a>",
			"<a href='/consult/noise-at-work/qualifications.asp'>Qualifications</a>",
			"<-",
		    "",
			"<a href='/consult/noise-at-work/quote.asp'><b>Get a Quote</b></a>"
		  ]

aopt[5] = [ "<a href='/service/'>Calibration Information</a>",
		    sReg == "uk" ? "<a href='/service/cal-quote.asp'>Online Quote and Booking</a>" : ""
		  ]

aopt[6] = [ "<a href='/news/'><b>All News Stories</b></a>",
		    "",
			"<em>2010 Selected Stories</em>",
			"->",
		    "<a href='/news/2010-02-optimus.asp'>New <b>Optimus</b> Meter</a>",
		    "<a href='/news/2010-01-env.asp'>Noise Monitoring Systems</a>",
			"<-",
		    "",
			"<em>2009 Selected Stories</em>",
			"->",
		    "<a href='/news/2009-09-noise-sign.asp'>Noise Warning Sign</a>",
		    "<a href='/news/2009-05-noise-at-work.asp'>Noise at Work Information</a>",
		    "<a href='/news/dosebadge-black.asp'>Black doseBadge</a>",
			"<-",
			"",
			"<em>2008 Selected Stories</em>",
			"->",
		    "<a href='/news/neighbour-noise.asp'>Noisy Neighbours</a>",
		    "<a href='/news/n_notting-hill.asp'>Notting Hill Carnival</a>",
		    "<a href='/news/n_cr262a.asp'>&quot;C&quot; Weighting Added</a>",
			"<-",
			"",
			"<em>2007 Selected Stories</em>",
			"->",
		    "<a href='/news/noise-calculator.asp'>Noise Calculators</a>",
		    "<a href='/news/dosebadge-update.asp'>doseBadge Update</a>",
		    "<a href='/news/vehicle-noise.asp'>Vehicle Noise</a>",
			"<-",
			"",
			"<em>2006 Selected Stories</em>",
			"->",
		    "<a href='/news/combination-kits.asp'>Combination Kits</a>",
		    "<a href='/news/intrinsically-safe.asp'>Intrinsically Safe</a>",
			"<-",
			"",
		    "<a href='/news/'>Older stories...</a>"
		  ]
aopt[7] = [ "<a href='/apps/'><b>Noise Calculators</b></a>",
			"->",
		    "<a href='/apps/naw/lepd.asp'>Daily Exposure - LEP,d</a>",
		    "<a href='/apps/naw/lepw.asp'>Weekly Exposure - LEP,w</a>",
		    "<a href='/apps/naw/protector.asp'>Hearing Protection</a>",
		    "<a href='/apps/db-calculator/'>Decibel Addition and Subtraction</a>",
		    "<a href='/apps/ldn-calculator/'>Ldn, Lden, CNEL</a>",
			"<-",
		    "",
		    "<a href='/resources/experts.asp'>Ask the Experts</a>",
		    "<a href='/resources/selector.asp'>Product Selection Chart</a>",
			"",
		    "<a href='/resources/books/'>Books on Noise</a>",
		    "<a href='/help/faq/type-class.asp'>Acoustic Standards</a>",
		    "<a href='/resources/links.asp'>Web Links</a>"
		  ]
aopt[8] = [ "<a href='/help.asp'><b>Help from NoiseMeters</b></a>",
		    "",
		    "<a href='/help/faq/'>Frequently Asked Questions</a>",
		    "<a href='/shop.asp'>How to Buy</a>",
		    "<a href='/feedback.asp'>Customer Comments</a>",
			"",
		    "<a href='/delivery.asp'>Delivery Charges</a>",
			"<a href='/help/export.asp'>Export Information</a>"
		  ]
aopt[9] = [ "<input name='editNMSrch' type='text' id='editNMSrch' style='width:140px;height:20px;font-style:italic;background-color:#EBEBF1' value='search' onFocus='NMSrchFocus()' onBlur='NMSrchBlur()' onKeyPress='NMSrchKey(event)'>",
			""
//			"<a href='@@'>A-Z Index</a>"
	      ];
aopt[10]= [ 
			"<img src='/images/flags/menu-uk.gif' width='20' height='12'> &nbsp;<a href='http://www.noisemeters.co.uk" + sPage + "'>United Kingdom</a>",
			"<img src='/images/flags/menu-eu.gif' width='20' height='12'> &nbsp;<a href='http://www.noisemeters.eu" + sPage + "'>Europe</a>",
		    "<img src='/images/flags/menu-us.gif' width='20' height='12'> &nbsp;<a href='http://www.noisemeters.com/regions/?action=set&region=us&page=" + sUSPage + "'>United States</a>",
		   	"<img src='/images/flags/menu-ca.gif' width='20' height='12'> &nbsp;<a href='http://www.noisemeters.ca/regions/?action=set&region=ca&page=" + sUSPage + "'>Canada</a>",
			"",
			"<em>Export Regions</em>",
			"->",
			"<a href='http://www.noisemeters.com/regions/?action=set&region=ap&page=" + sPage + "'>Asia Pacific</a>",
			"<a href='http://www.noisemeters.com/regions/?action=set&region=la&page=" + sPage + "'>Latin America</a>",
			"<a href='http://www.noisemeters.com/regions/?action=set&region=me&page=" + sPage + "'>Middle East & N. Africa</a>",
			"<a href='http://www.noisemeters.com/regions/?action=set&region=sa&page=" + sPage + "'>Sub-Saharan Africa</a>",
			"<-",
			"",
			"<a href='/help/export.asp'>Export Information</a>"
	      ];

window.onload = function()
{
	for(i=1; i<=10; i++)
	{
		document.getElementById("nmmenu" + i).onmouseover = NMCreateMenu;
		document.getElementById("nmmenu" + i).onmouseout = NMHideMenu;

		document.getElementById("divMenu" + i).onmouseover = NMOverMenu;
		document.getElementById("divMenu" + i).onmouseout = NMHideMenu;
	}

	if(typeof(NM_onload) == "function")
		NM_onload();
}


window.onunload = function()
{
	NMHideNow();
}


function NMCreateMenu()
{
	var nMenu = parseInt(this.id.substr(6,2));
	
	bLockMenu = false;
	
	if(divVis != null)
	{
		bOver = false;
		NMHideNow();
	}

	if(aopt[nMenu].length > 0)
	{
		var div = document.getElementById("divMenu" + nMenu);
	
		var sOpts = "<table id='tblMenu" + nMenu + "'><tr><td height='4px'></td></tr>";
		var sIndent = "";
		
		for(iOpt=0; iOpt < aopt[nMenu].length; iOpt++)
		{
			switch(aopt[nMenu][iOpt])
			{
				case "->" : sIndent += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; break;
				case "<-" : sIndent = sIndent.substr(0,sIndent.length-30); break;
				case "" : sOpts += "<tr><td height='8px'></td></tr>"; break;
				
				default : sOpts += "<tr><td>" + sIndent + aopt[nMenu][iOpt] + "</tr></td>";
			}
		}
		
		sOpts += "<tr><td height='4px'></td></tr>";
		sOpts += "</table>";
		div.innerHTML = sOpts;
		
		div.style.width = 400;
		
		var nWidth = document.getElementById("tblMenu" + nMenu).offsetWidth;
		var nHeight = document.getElementById("tblMenu" + nMenu).offsetHeight;
	
		div.style.height = (nHeight + 4) + "px";
		div.style.width = (nWidth + 8) + "px";
		div.style.padding = "4px";
	
		divVis = div;
		
		bOver = true;
	}
}


function NMOverMenu()
{
	bOver = true;
}


function NMHideMenu()
{
	bOver = false;
	
	if(timeoutHide != null)
		clearTimeout(timeoutHide);
		
	timeoutHide = setTimeout("NMHideNow()",500);
}


function NMHideNow()
{
	if((divVis != null) && !bOver && !bLockMenu)
	{
		divVis.style.height = "1px";
		divVis.style.width = "1px";
		divVis.style.padding = "0px";

		divVis = null;
	}
	
	timeoutHide = null;
}


function NMSrchFocus()
{
	if(document.getElementById("editNMSrch").value == "search")
	{
		document.getElementById("editNMSrch").value = "";
		document.getElementById("editNMSrch").style.fontStyle = "normal";
	}
	
	bLockMenu = true;
}

function NMSrchKey(e)
{
	if(e.keyCode == 13)
		location.href = "/search/?searchTerm=" + document.getElementById("editNMSrch").value;
}

function NMSrchBlur()
{
	bLockMenu = false;
	NMHideMenu();
}