function MenuItem(name, link) {
	this.name = name;
	this.link = link;
	if(this.link == "")
		this.type = "header";
	else
		this.type = "link";
}
compArr = new Array();
compArr[0] = new MenuItem("History", "company.html");
compArr[1] = new MenuItem("Contact Us", "contact.php");
compArr[2] = new MenuItem("Staff", "staff.html");
prodArr = new Array();
prodArr[0] = new MenuItem("Industrial", "");
prodArr[1] = new MenuItem("Paint Odor Eliminator", "products.html#paint-odor");
prodArr[2] = new MenuItem("Smoke & Fire Odor Eliminator", "products.html#smoke-fire");
prodArr[3] = new MenuItem("Odor-Stop", "products.html#odor-stop");
prodArr[4] = new MenuItem("EPA 2000", "products.html#epa-2000");
prodArr[5] = new MenuItem("Public Safety & Animal Care", "");
prodArr[6] = new MenuItem("Bio-Tac Odor Eliminator","products.html#odor-eliminator");
prodArr[7] = new MenuItem("Bio-Tac Kennel Care","products.html#kennel-care");
prodArr[8] = new MenuItem("Bio-Tac K-9 Derma Care","products.html#k9-derma");
function menu(obj, link) {
        var popup = document.getElementById("drop_down");
        var pos = findPos(obj);
        popup.style.display = "inline";
        popup.style.left=pos[0];
        popup.style.width=getWidth(obj, link);
        popup.style.height=getHeight(link);
        popup.innerHTML=getInnerHTML(link);
}
function getWidth(obj, link) {
	switch(link) {
		case 'comp': return obj.offsetWidth; break;
		case 'prod': return "225px"; break;
		default: return -1;
	}
}
function getHeight(link) {
        var line = (navigator.appName.search("Microsoft") > -1 ? 12 : 21);
        switch(link) {
			case 'comp': return compArr.length*line; break;
			case 'prod': return prodArr.length*line; break;
        }
        return -1;
}
function getInnerHTML(link) {
        switch(link) {
			case 'comp': return buildInnerHTML(compArr); break;
			case 'prod': return buildInnerHTML(prodArr); break;
        }
        return "";
}
function buildInnerHTML(menuArr) {
	toReturn = "";
	for(i = 0; i < menuArr.length; i++) {
		if(menuArr[i].type == "link")
			toReturn += "<a href=\""+menuArr[i].link+"\">"+menuArr[i].name+"</a>\n"+(menuArr.length-1==i ? "" : "<hr />\n");
		else
			toReturn += menuArr[i].name+"\n"+(menuArr.length-1==i ? "" : "<hr />\n");
	}
	return toReturn;
}
function collapse() {
        var popup = document.getElementById("drop_down");
        popup.style.display = "none";
        popup.innerHTML="";
}
function findPos(obj) {
        var curleft = 0, curtop = 0;
        if (obj.offsetParent) {
                curleft = obj.offsetLeft;
                curtop = obj.offsetTop;
                while (obj = obj.offsetParent) {
                        curleft += obj.offsetLeft;
                        curtop += obj.offsetTop;
                }
        }
        return [curleft,curtop];
}

