var menuItems = new Array(
		{ link : "hudsonTavern.html", title : "Hudson Tavern - 1/2008", img : "images/menu/hudsonTavern.gif",
			heading : "images/headings/hudsonTavern.gif", 
			onload : function() { swapPng24Image("hudsonTavern"); } },

		{ link : "linxPubs.html", title : "LINX Pubs - 9/2007", img : "images/menu/linxPubs.gif",
			heading : "images/headings/linxPubs.gif", 
			onload : function() { swapPng24Image("linx1"); swapPng24Image("linx2"); swapPng24Image("linx3"); } },
				
		{ link : "cryptKeeper.html", title : "CryptKeeper - 8/2007", img : "images/menu/cryptKeeper.gif",
			heading : "images/headings/cryptKeeper.gif", 
			onload : function() { swapPng24Image("crypt1"); } },
				
		{ link : "vacal.html", title : "Vacal - 8/2007", img : "images/menu/vacal.gif",
			heading : "images/headings/vacal.gif", 
			onload : function() { swapPng24Image("vacal1"); } },
				
		{ link : "sportsMetaBlogs.html", title : "Sports Meta Blogs - 3/2007", img : "images/menu/sportsMetaBlogs.gif",
			heading : "images/headings/sportsMetaBlogs.gif", 
			onload : function() { swapPng24Image("sports1"); swapPng24Image("sports2"); }  },
				
		{ link : "eightFatSwine.html", title : "EightFatSwine - 2/2007", img : "images/menu/eightFatSwine.gif",
			heading : "images/headings/eightFatSwine.gif", 
			onload : function() { swapPng24Image("eight1"); }  },
				
		{ link : "socialBlogWorks.html", title : "Social Blog Works - 1/2007", img : "images/menu/socialBlogWorks.gif",
			heading : "images/headings/socialBlogWorks.gif", 
			onload : function() { swapPng24Image("social1"); }  },
				
		{ link : "lovazaSpeaker.html", title : "LOVAZA Speaker/Consultant - 6/2007", img : "images/menu/lovazaSpeaker.gif",
			heading : "images/headings/lovazaSpeaker.gif", 
			onload : function() { swapPng24Image("lovaza1"); }  },
				
		{ link : "elysianCafe.html", title : "Elysian Cafe - 12/2006", img : "images/menu/elysianCafe.gif",
			heading : "images/headings/elysianCafe.gif", 
			onload : function() { swapPng24Image("elysian1"); swapPng24Image("elysian2"); }  },
				
		{ link : "ecsn.html", title : "Endocannabinoid - 9/2006", img : "images/menu/ecsn.gif",
			heading : "images/headings/ecsn.gif", 
			onload : function() { swapPng24Image("ecsn1"); swapPng24Image("ecsn2"); swapPng24Image("ecsn3"); }  },
				
		{ link : "mwcookies.html", title : "Mikes Wifes Cookies - 7/2006", img : "images/menu/mwcookies.gif",
			heading : "images/headings/mwcookies.gif", 
			onload : function() { swapPng24Image("mwcookies1"); swapPng24Image("mwcookies2"); swapPng24Image("mwcookies3"); swapPng24Image("mwcookies4"); }  },
				
		{ link : "imageGallery2.html", title : "New Image Gallery - 5/2006", img : "images/menu/imageGallery2.gif",
			heading : "images/headings/imageGallery2.gif", 
			onload : function() { swapPng24Image("gallery1"); }  },
				
		{ link : "mrchocolate.html", title : "MrChocolate.com", img : "images/menu/mrchocolate.gif",
			heading : "images/headings/mrchocolate.gif", 
			onload : function() { swapPng24Image("mrc1"); swapPng24Image("mrc2"); } },
				
		{ link : "linx.html", title : "LINX - 5/2004", img : "images/menu/linx.gif",
			heading : "images/headings/linx.gif", 
			onload : function() { swapPng24Image("linx1"); }  },
				
		{ link : "practicePathways.html", title : "Practice Pathways - 6/2005", img : "images/menu/practicePathways.gif",
			heading : "images/headings/practicePathways.gif", 
			onload : function() { swapPng24Image("practice1"); swapPng24Image("practice2"); }  },
				
		{ link : "scientiae.html", title : "Scientiae - 5/2005", img : "images/menu/scientiae.gif",
			heading : "images/headings/scientiae.gif", 
			onload : function() { swapPng24Image("scientiae1"); }  },
				
		{ link : "kbdewey.html", title : "KBDewey.com - 9/2004", img : "images/menu/kbdewey.gif",
			heading : "images/headings/kbdewey.gif", 
			onload : function() { swapPng24Image("kbdewey1"); swapPng24Image("kbdewey2"); }  },
				
		{ link : "secureFileTransfer.html", title : "Secure File Transfer - 10/2004", img : "images/menu/secureFileTransfer.gif",
			heading : "images/headings/secureFileTransfer.gif", 
			onload : function() { swapPng24Image("secureFile1"); }  },
				
		{ link : "statusTrak.html", title : "StatusTrak - 6/2004", img : "images/menu/statusTrak.gif",
			heading : "images/headings/statusTrak.gif", 
			onload : function() { swapPng24Image("status1"); }  },
				
		{ link : "shimano.html", title : "Shimano - 7/2002", img : "images/menu/shimano.gif",
			heading : "images/headings/shimano.gif", 
			onload : function() { swapPng24Image("shimano1"); swapPng24Image("shimano2"); }  },
				
		{ link : "imageGallery.html", title : "Image Gallery - 7/2002", img : "images/menu/imageGallery.gif",
			heading : "images/headings/imageGallery.gif", 
			onload : function() { swapPng24Image("gallery1"); swapPng24Image("gallery2"); }  },
				
		{ link : "lxa.html", title : "LXA - 10/2000", img : "images/menu/lxa.gif",
			heading : "images/headings/lxa.gif", 
			onload : function() { swapPng24Image("lxa1"); }  },
				
		{ link : "iservice.html", title : "iService - 8/2000", img : "images/menu/iservice.gif",
			heading : "images/headings/iservice.gif", 
			onload : function() { swapPng24Image("iservice1"); }  }
				
	);
	
	
/*

Projects Menu

*/
ProjectMenu = function(id, menuElementId, contentElementId, headingImgElementId, headingElementId, loadingElementId, items, listId, css)
{
	this._id = id;
	
	this._menuElementId = menuElementId;
	this._menuElement = document.getElementById(menuElementId);
	
	this._contentElementId = contentElementId;
	this._contentElement = document.getElementById(contentElementId);
	
	this._headingImgElementId = headingImgElementId;
	this._headingImgElement = document.getElementById(headingImgElementId);
	
	this._headingElementId = headingElementId;
	this._headingElement = document.getElementById(headingElementId);
	
	this._loadingElementId = loadingElementId;
	this._loadingElement = document.getElementById(loadingElementId);

	if (!items) items = new Array();
	this._items = items;
	
	if (!listId) listId = "projectsMenu";
	this._listId = listId;
	
	if (!css) css = "projectIcons";
	this._css = css;
	
	this.xmlRequest = new XMLHttpRequest;
	
	this._currentId = 0;
	
	this._debugMode = true;
	
	this._write();
}

ProjectMenu.prototype = {
	_write : function()
	{
		if (this._menuElement)
		{
			items = this._items;
			
			html = "<ul id='" + this._listId + "' class='" + this._css + "'>";
			for(i in items)
				html += "<li><a href='" + items[i].link + "' onclick='return " + this._id + ".loadContent(event, " + i + ");' title='" + items[i].title + "' class='projectIcon'><img src='" + items[i].img + "' alt='" + items[i].title + "' style='width:135px; height:105px;' /></a></li>";
			html += "</ul>";
			
			//alert(html);
			this._menuElement.innerHTML = html;
		}
		else alert('No Menu Element.');
	},
	
	loadContent : function(e,i)
	{
		if (!e) e = window.event;
		this._currentId = i;
		
		try
		{
			if (this._items)
			{
				if (this.xmlRequest && this._items[i].link)
				{
					if (this._items[i].heading && this._headingImgElement)
						this._headingImgElement.src = this._items[i].heading;
					
					if (this._items[i].title && this._headingElement)
						this._headingElement.innerHTML = this._items[i].title;
				
					if (this._contentElement)
						this._contentElement.style.display = "none";	
					
					if (this._loadingElement)
						this._loadingElement.style.display = "block";
					
					this.xmlRequest.open("GET", this._items[i].link, true);
					this.xmlRequest.onreadystatechange = createObjectCallback(this, this._xmlLoaded);
					this.xmlRequest.send("")
					
					e.cancelBubble = true;
					return false;
				}
			}
		}
		catch(ex) { alert(ex.message);} 
		
		return true;
	},
	
	_xmlLoaded : function()
	{
		if (this.xmlRequest)
		{
			if (this.xmlRequest.readyState==4) 
			{
				this.xmlRequest.onreadystatechange = function() {};
				
				if (this._contentElement)
				{	
					try
					{
						//debugger;
						xml = this.get_xml();
						if (xml)
						{
							this._contentElement.innerHTML = this.get_xmlContent(xml);
						}
						else location.href=this._items[this._currentId].link;
					}
					catch(e)
					{
					}
					
					// Load Complete
					if (this._loadingElement)
						this._loadingElement.style.display = "none";
						
					this._contentElement.style.display = "block";	
	 			}
	 			
	 			if (typeof this._items[this._currentId].onload === 'function')
				{
					this._items[this._currentId].onload();
				}
			}
		} 	
	}
	,
	get_xmlContent : function(xml)
	{
		if (window.DOMParser)
		{
			// test with no prefix doesn't find nodes:
			var xpathResult = xml.evaluate(
			  "//div[@id='content']/*[@class='left']",
			  xml,
			  null,
			  XPathResult.FIRST_ORDERED_NODE_TYPE,
			  null
			);
			
			var xmlSerializer = new XMLSerializer();
			
			var html = "";
			if (xpathResult.singleNodeValue) {
				html = xmlSerializer.serializeToString(xpathResult.singleNodeValue)
		  } 
		  
		  // test with no prefix doesn't find nodes:
			xpathResult = xml.evaluate(
			  "//div[@id='content']/*[@class='right']",
			  xml,
			  null,
			  XPathResult.FIRST_ORDERED_NODE_TYPE,
			  null
			);
			
			if (xpathResult.singleNodeValue) {
				html += xmlSerializer.serializeToString(xpathResult.singleNodeValue)
			}

			return html;
		}
		else
		{
			var content = xml.selectSingleNode("//div[@id='content']");
			var result = "";
			var n = content.firstChild;			
			while (n != null)
			{
				result += n.xml;
				n = n.nextSibling;
			}
			
			return result;
		}
	}
	,
	get_xml : function()
	{
		var a=this.xmlRequest.responseXML;
		if(!a||!a.documentElement)
		{
			if (this.xmlRequest.status === 404)
			{
				if (this._debugMode)
					alert('404 Page Not Found');
				return null;
			}
			
			response =  this.xmlRequest.responseText.replace(' xmlns="http://www.w3.org/1999/xhtml"', "");
			response = response.replace('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', '');
			a = new XMLDOM(response);
			if(!a||!a.documentElement)
			{
				debugger;
				if (this._debugMode)
							alert(a.parseError.reason);
				return null
			}
			}else if(navigator.userAgent.indexOf("MSIE")!==-1)
				a.setProperty("SelectionLanguage","XPath");
				if(a.documentElement.namespaceURI==="http://www.mozilla.org/newlayout/xml/parsererror.xml"&&a.documentElement.tagName==="parsererror")
					return null;
				if(a.documentElement.firstChild&&a.documentElement.firstChild.tagName==="parsererror")
					return null;
				return a;
	}
}

if(!window.XMLHttpRequest)
	window.XMLHttpRequest=function()
	{
		var b=["Msxml2.XMLHTTP","Microsoft.XMLHTTP"];
		for(var a=0;a<b.length;a++)
			try{
				var c = new ActiveXObject(b[a]);
				return c;
			}catch(d){}
			
			return null;
	};
	
window.XMLDOM=function(d)
{
	if(!window.DOMParser)
	{
		var c=["Msxml2.DOMDocument.3.0","Msxml2.DOMDocument"];
		for(var b=0;b<c.length;b++)
			try
			{
				var a=new ActiveXObject(c[b]);
				a.async=false;
				a.loadXML(d);
				//a.setProperty("SelectionLanguage","XPath");
				//a.setProperty("SelectionNamespaces", "xmlns='http://www.w3.org/1999/xhtml'");
				return a;
			}
			catch(f) {}
			
			return null;
	}
	else
		try
		{
			var e=new window.DOMParser;
			return e.parseFromString(d,"text/xml");
		}
		catch(f)
		{
			return null;
		}
		
		return null;
};