var ddMenu = function (parent)
{
	this.parent = parent;
	this.slideTime = 1000;
	this.obj = null;
	this.currentPos = null;
	for (var i = 0; i < parent.childNodes.length; i++)
	{
		if (parent.childNodes[i].nodeName == 'UL')
		{
			this.obj = parent.childNodes[i];
			break;
		}
	}
	
	this.dostuff = function ()
	{
		alert (this.parent.innerHTML);
	};
};

var Page = new function ()
{
	this.onLoads = [];
	this.onUnloads = [];
	
	this.addOnLoad = function (func)
	{
		var self = Page;
		
		self.onLoads[self.onLoads.length] = func;
	};
	
	this.addOnUnload = function (func)
	{
		var self = Page;
		
		self.onUnloads[self.onUnloads.length] = func;
	};
	
	this.onLoad = function ()
	{
		var self = Page;
		self.initNav ();
		self.externalLinks ();
		
		for (var i in self.onLoads)
		{
			self.onLoads[i] ();
		}
	};
	
	this.onUnload = function ()
	{
		var self = Page;
		
		for (var i in self.onLoads)
		{
			self.onUnloads[i];
		}
	};
	
	this.externalLinks = function ()
	{
		if (!document.getElementsByTagName)
		{
			return;
		}
		var anchors = document.getElementsByTagName ('a');
		for (var i = 0; i < anchors.length; i++)
		{
			var anchor = anchors[i];
			if (anchor.getAttribute ('href') && anchor.getAttribute ('rel') == 'external')
			{
				anchor.target = '_blank';
			}
		}
	};
	
	this.initNav = function ()
	{
		if (document.all && document.getElementById)
		{
			var nav = document.getElementById ('nav');
			if (nav)
			{
				for (var i = 0; i < nav.childNodes.length; i++)
				{
					var node = nav.childNodes[i];
					if (node.nodeName == 'LI')
					{
						node.onmouseover = function ()
						{
							this.className = 'over';
						};
						node.onmouseout = function ()
						{
							this.className = '';
						};
					}
				}
			}
		}
	};
};

window.onload = Page.onLoad;
window.onunload = Page.onUnload;