function stripeList () {
	if(!document.getElementById) return false;
	if(!document.getElementById("gallery")) return false;

	var galleryList = document.getElementById("gallery");
	var galleryItems = galleryList.getElementsByTagName("LI");
	var odd = true;
	for (i=0;i<galleryItems.length;i++) {
		var itemClass =	galleryItems[i].getAttribute("class")
		if (odd == true) {
			if (itemClass){
				className = "odd "+itemClass;
			} else {
				className = "odd";
			}
			odd = false;
		} else {
			if (itemClass){
				className = "even "+itemClass;
			} else {
				className = "even";
			}
			odd = true;		
		}
		galleryItems[i].setAttribute("class",className);
	}
}

addLoadEvent(stripeList)

/*
function addHomePicture() {
	if (!document.getElementById) return false;
	if (!document.getElementById("wrapperHome")) return false;
	var contentDiv = document.getElementById("content");
	var newDivOne = document.createElement("DIV");
	newDivOne.id = "mainHomeTop";
	var newDivTwo = document.createElement("DIV");
	newDivTwo.id = "mainHome";
	var newDivThree = document.createElement("DIV");
	newDivThree.id = "mainHomeBottom";
	if (document.getElementById("homePicture")) {
		var targetPara = document.getElementById("homePicture");
		targetPara.innerHTML = "";
	} else {
		var contentParas = contentDiv.getElementsByTagName("P");
		for (k=0;k<contentParas.length;k++) {
			if (contentParas[k].innerHTML.indexOf("************") > -1) {
				var targetPara = contentParas[k];
				targetPara.innerHTML = "";
			}
		}
		if (!targetPara) {
			var middlePara = Math.floor(contentParas.length/2);
			var targetPara = contentParas[middlePara];
		}
	}
	insertAfter(newDivOne,targetPara)
	insertAfter(newDivTwo,newDivOne);
	insertAfter(newDivThree,newDivTwo);
}

addLoadEvent(addHomePicture);
*/

function ieFixes() {
	if (navigator.appName == "Microsoft Internet Explorer") {
 			addHover();
		replaceHRs();
	}
}

addLoadEvent(ieFixes);

// Function to replace the li:hover pseudo class
function addHover() {
	if (document.getElementById("menu")) {
		var allMenuItems = document.getElementById("menu").getElementsByTagName("LI");
		for (i=0;i<allMenuItems.length;i++) {
			allMenuItems[i].onmouseover = function() {
				if (!this.className) {
					this.className = "hover";
				} else {
					this.className = this.className+" hover";
				}
			}
			allMenuItems[i].onmouseout = function() {
				this.className = this.className.replace(/\s?hover/,"");
			}
		}
	}
}

// Function to replace HRs that have background images with Divs (IE doesn't like HR background images :( )
function replaceHRs() {
	if (!document.getElementById) return false;
	if ((document.getElementById("contentTop")) && (document.getElementById("contentBottom"))) {
		var contentTop = document.getElementById("contentTop");
		var contentBottom = document.getElementById("contentBottom");
		
		var newContentTop = document.createElement("div");
		newContentTop.setAttribute("id","contentTop");
		var newContentTopText = document.createTextNode(" ");
		newContentTop.appendChild(newContentTopText);
	
		var newContentBottom = document.createElement("div");
		newContentBottom.setAttribute("id","contentBottom");
		var newContentBottomText = document.createTextNode(" ");
		newContentBottom.appendChild(newContentBottomText);
		
		contentTop.parentNode.replaceChild(newContentTop,contentTop);
		contentBottom.parentNode.replaceChild(newContentBottom,contentBottom);
	}	
}

function getFirstElement(node) {
	if (node.firstChild.nodeType == 1) {
		return node.firstChild;
	}
	if (node.firstChild.nextSibling) {
		return getNextElement(node.firstChild);
	}
	return null;
}

function getNextElement (node) {
	if (node.nextSibling.nodeType == 1) {
		return node.nextSibling;
	}
	if (node.nextSibling.nextSibling) {
		return getNextElement (node.nextSibling);
	}
	return null;
}

function insertAfter (newElement,targetElement) {
	var parent = targetElement.parentNode;
	if (parent.lastChild == targetElement) {
		parent.appendChild(newElement);
	} else {
		parent.insertBefore(newElement,targetElement.nextSibling);
	}
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}