function setNav() {
	if (document.getElementById && document.getElementById("navlist")) {
		navRoot = document.getElementById("navlist");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.className == "collapse") {
			
				node.onmouseover = function() {
					this.className = 'expand';
				}
				
				node.onmouseout = function() {
					this.className = 'collapse';
				}
			}
			for (j=0; j<node.childNodes.length; j++) {
				if (node.childNodes[j].className == "dropdown") {
							menuElem = node.childNodes[j];
							for (q=0; q<menuElem.childNodes.length; q++) {
								if (menuElem.childNodes[q].className == "dropitem") {
									dropElem = menuElem.childNodes[q];
									dropElem.onmouseover = function() {
										this.className = 'dropitemHi';
									}
									dropElem.onmouseout = function() {
										this.className = 'dropitem';
									}
								}
							}
				}
			}
		}
	}
	
}
function goTo(where) {
	window.location = where;
}

	
	function imageItem(image_location) {
		this.image_item = new Image();
		this.image_item.src = image_location;
	}
	
	function get_ImageItemLocation(imageObj) {
		return(imageObj.image_item.src)
	}

	function getNextImage() {
		if (image_index<number_of_image-1) {
			image_index++;
		} else {
			image_index = 0;
		}
		var new_image = get_ImageItemLocation(image_list[image_index]);
		return(new_image);
	}
	
	function rotateImage(place) {
		var new_image = getNextImage();
		document.getElementById(place).src = new_image;
		var recur_call = "rotateImage('"+place+"')";
		setTimeout(recur_call, interval);
	}
	
	
	
var whichWayOld = "";
function directions (whichWay){
	
	if (whichWayOld==whichWay) {
			document.getElementById(whichWay).style.display = (document.getElementById(whichWay).style.display=='none') ? '' : 'none';
	} else {
		if (document.getElementById && document.getElementById(whichWayOld)) {
			document.getElementById(whichWayOld).style.display = 'none';
		}
		document.getElementById(whichWay).style.display = '';
	}
	whichWayOld = whichWay;
}

setRotate=false;
function start(){
	setNav();
	if (setRotate){
		rotateImage('mainpic')
	}
}


window.onload = start;