init = function() 
	{ 
	if(document.all && document.getElementById) 
		{	
		navRoot = document.getElementById("menu");
		for (i=0; i<navRoot.childNodes.length; i++) 
			{
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") 
				{
				node.onmouseover=function() 
					{
					this.className+=" over";
					}
  			
				node.onmouseout=function() 
					{
  					this.className=this.className.replace(" over", "");
   					}
   				}
  			}
 		}
	
	if(document.getElementById('services')) mainDiv=document.getElementById('services');
	else if(document.getElementById('autoservices')) mainDiv=document.getElementById('autoservices');
	else mainDiv=document.getElementById('nolist');
	var as=mainDiv.getElementsByTagName('a');
	for (var i=0;i<as.length;i++)
		{ 
		if(as[i].className == 'close')
			{
			as[i].onclick=function() { hideParent(this); }
			as[i].onkeypress=function() { hideParent(this); }
			}
		else if(as[i].className == 'explanation')	
			{ 
			as[i].onmouseover= popUpExp;
			as[i].onmouseout=function()  { unPopUpExp(this); }
			}		
		else if(as[i].className && as[i].className != 'close')	
			{
			as[i].onclick=function() { popUpJpg(this); }
			as[i].onkeypress=function() { popUpJpg(this); }
			}
		else
			{
			as[i].onclick=function() { toggleShow(this); }
			as[i].onkeypress=function() { toggleShow(this); }
			}
		} 
	}  

function toggleShow(node)
	{
	if(node.parentNode.style.backgroundImage == 'url(images/vbullet.gif)' || node.parentNode.style.backgroundImage == 'url("http://www.americanlockandkeyonline.com/images/vbullet.gif")') 
		{ node.parentNode.style.backgroundImage = 'url(images/hbullet.gif)'; }
	else if(node.parentNode.nodeName != 'P')
		{ node.parentNode.style.backgroundImage = 'url(images/vbullet.gif)'; }
	var id=node.href.match(/#(\w.+)/)[1];
	id = id + 'DIV';
	var toggle = document.getElementById(id).style.display;
	if(!toggle || toggle == 'none') { document.getElementById(id).style.display = 'block'; }
	if(toggle == 'block') { document.getElementById(id).style.display = 'none'; }
	}

function hideParent(node)
	{ 
	node.parentNode.parentNode.childNodes[0].style.backgroundImage='url(images/hbullet.gif)';
	for(i=0;i<node.parentNode.childNodes.length;i++)
		{
		if(node.parentNode.childNodes[i].nodeName == 'DIV')
			{  
			if(node.parentNode.childNodes[1].nodeName == 'DIV')
				{}
			else if(node.parentNode.childNodes[i-1].nodeName == 'H3')
				{ 
				node.parentNode.childNodes[i].style.display = 'none';
				node.parentNode.childNodes[i-1].style.backgroundImage = 
				'url(images/hbullet.gif)'; 
				} 
			else if(node.parentNode.childNodes[i-2].nodeName == 'H3')
				{ 
				node.parentNode.childNodes[i].style.display = 'none';
				node.parentNode.childNodes[i-2].style.backgroundImage = 
				'url(images/hbullet.gif)'; 
				}
			}
		}
	node.parentNode.style.display = 'none';
	}	

function popUpJpg(node)
	{ 
	aClass = node.className.split('_');
	jWidth = parseInt(aClass[2]);
	jHeight = parseInt(aClass[3]);
	folder = '';
	if(aClass[4]) folder = aClass[4] + '/';
	if(isOpera >= 0 || isNetscape >= 0) 
		{
		newWindow = window.open("images/" + folder + aClass[0] + "." + aClass[1],"", "width=" + jWidth + ",height=" + jHeight + ",location=no, menubar=no, toolbar=no, status=no, resizable=yes, scrollbars=no, left=50, top=20"); 
		}
	else
		{
newWindow = window.open("javascript: document.write('<html><head></head><body><img src=\"images/" + folder + aClass[0] + "." + aClass[1] + "\" width=\"" + aClass[2] + "\" height=\"" + aClass[3] + "\" /></body></html>')" ,"", "width=" + jWidth + ",height=" + jHeight + ",location=no, menubar=no, toolbar=no, status=no, resizable=yes, scrollbars=no, left=50, top=20"); 
		}
		newWindow.document.body.style.backgroundColor = "#ffffff";		
		newWindow.document.body.style.margin = '0'; 
	}

function popUpExp(e)
{
if(busy) previousExp.style.display = 'none';
if(!e) e = window.event; 
if (e.srcElement) exSpan = e.srcElement.nextSibling;
else if (e.target) exSpan = e.target.nextSibling;
spanX = e.clientX;
setTimeout('hoverExplanation(exSpan,spanX)', 400);
}

function unPopUpExp(node)
{
exSpan = node.nextSibling;
previousExp = exSpan;
setTimeout('hideExplanation(exSpan)', 400);
busy = true;
}

function hoverExplanation(exSpan,spanX)
{
exSpan.style.display = 'block';
exSpan.style.left = spanX + 20 + 'px';
}

function hideExplanation(node)
{
node.style.display = 'none';
busy = false; 
}

var busy;
var previousExp;
var isOpera = navigator.userAgent.toLowerCase().indexOf("opera");
var isNetscape = navigator.userAgent.toLowerCase().indexOf("netscape");
window.onload=init;