/* -------------------------------------------------------------
	Polo Grill
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Description:	Primary ECMA Script File
	Filename:		script.js
	Version:		1.2
	Date:			21 July 2006
------------------------------------------------------------- 

Table of Contents (subject to change):
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

	+ Custom Functions
	+ Document Initiation
	+ Event Listeners

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
*/


/* -------------------------------------------------------------
	Document Initiation
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

var roll = {
	define : function(){
		if (!document.all&&!document.getElementById) return;
		var links = document.getElementById("uiList");
		if (!links) return;
		for (var i=0; i<links.childNodes.length; i++) {
			var link = links.childNodes[i];
			if (link.nodeName == "LI") {
				link.onmouseover = function(){
					this.className = "over";
				}
				link.onmouseout = function(){
					this.className = this.className.replace("over", "");
				}
			}
		}
	}
}

var q = {
	imgArray : null,
	element : null,
	init : function(){
		if (!document.getElementById) return;
		if (a != 1) return;
		q.element = document.getElementById("messaging");
		imgArray = ["img_messaging_01.jpg","img_messaging_02.jpg","img_messaging_03.jpg","img_messaging_04.jpg","img_messaging_05.jpg","img_messaging_06.jpg"];
		q.run(imgArray);
	},
	run : function(theArray){
		var newNumber = Math.floor(Math.random()*theArray.length);
		var imgSrc = "/images/";
		var newBG = "url(" + imgSrc + theArray[newNumber] + ")";
		q.element.style.backgroundImage = newBG;
		q.element.style.visibility = "visible";
	}
};

/* -------------------------------------------------------------
	Document Initiation
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/*  Document Initiation Function
	Used to replace multiple function calls appended to listeners, etc.
	Add as many functions as you want.
*/

var doc = {
	loaded : function(){
		roll.define();
		q.init();
	}
};


/* -------------------------------------------------------------
	Event Listeners
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
if (window.addEventListener) {
	window.addEventListener("load", doc.loaded, false);
} else if (document.addEventListener) {
	document.addEventListener("load", doc.loaded, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", doc.loaded);
} else if (typeof window.onload == "function") {
	window.onload = function(){
		doc.loaded();
	};
} else {
	window.onload = doc.loaded;
}


