var submenu    = new Array();
var lastActive = 99;
var menuobj;
		
submenu[0] = '<a href="http://hotels4.bookmotel.com/common-cgi/motels/b2c/enquiry.pl?action=create&amp;Id=22">Online Specials</a> | <a href="http://www.hotelinauckland.co.nz/accommodation.htm">Accommodation</a> | <a href="http://www.hotelinauckland.co.nz/activities_northshore.htm">Activities</a> | <a href="http://www.hotelinauckland.co.nz/location.htm">Location</a> | <a href="http://www.hotelinauckland.co.nz/contact_us.htm">Contact Us</a>';
submenu[1] = '<a href="https://hotels4.bookmotel.com/common-cgi/motels/b2c/enquiry.pl?action=create&amp;Id=165">Online Specials</a> | <a href="accommodation.htm">Accommodation </a> | <a href="location.htm">Location</a> | <a href="contact-us.htm">Contact Us</a> | <a href="conferences.htm">Conferences</a> | <a href="weddings.htm">Weddings &amp; Functions</a> | <a href="guest-facilities.htm">Facilities</a> | <a href="attractions.htm">Attractions</a> | <a href="restaurant.htm">Restaurant &amp; Coffee Shoppe</a>';
submenu[2] = '<a href="accommodation-mtrichmond-lodge.htm">Accommodation</a> | <a href="conferences-functions-mtrichmond-lodge.htm">Conferences &amp; Functions</a> | <a href="weddings-mtrichmond-lodge.htm">Weddings</a> | <a href="specials-mtrichmond-lodge.htm">Specials</a> | <a href="https://hotels4.bookmotel.com/common-cgi/motels/b2c/enquiry.pl?action=create&Id=98">Book Now!</a> | <a href="contact-us-mtrichmond-lodge.htm">Contact Us</a>  ';
submenu[5] = '<a href="whats-on.htm">Whats On</a> | <a href="service-facilities.htm">Service &amp; Facilities</a> | <a href="conferences.htm">Conferences</a> | <a href="dining.htm">Dining</a> | <a href="contact-us.htm">Contact Us</a>';
submenu[4] = '';
submenu[8] = '';

function initTopNav() {
	
	menuobj = document.getElementById("navCrumb");
	
}

function showit(which) {
	var thecontent = (which == -1) ? submenu[11] : submenu[which];
	
	menuobj.innerHTML = thecontent;
	
	if (lastActive != 99) {
	
		if (lastActive == 0) {
		
			document.getElementById("topnavAcc").style.backgroundPosition = "0px 0%";
		
		} else if (lastActive == 1) {
		
			document.getElementById("topnavWTSD").style.backgroundPosition = "0px 0%";
		
		} else if (lastActive == 2) {
		
			document.getElementById("topnavDrive").style.backgroundPosition = "0px 0%";
		} else if (lastActive == 3) {
		
			document.getElementById("topnavAbout").style.backgroundPosition = "0px 0%";
		
		} else if (lastActive == 4) {
		
			document.getElementById("topnavHome").style.backgroundPosition = "0px 0%";
		
		} else if (lastActive == 5) {
		
			document.getElementById("topnavDeals").style.backgroundPosition = "0px 0%";
		
		} else if (lastActive == 8) {
		
			document.getElementById("topnavEqu").style.backgroundPosition = "0px 0%";
		
		}

		lastActive = 99;
	
	}

	if (which != -1) lastActive = which;
	
	if (which == 0) {
	
		menuobj.style.backgroundPosition = "0px -154px";
		document.getElementById("topnavAcc").style.backgroundPosition = "-93px 0%";
		
	} else if (which == 1) {
	
		menuobj.style.backgroundPosition = "0px -66px";
		document.getElementById("topnavWTSD").style.backgroundPosition = "-108px 0%";
	
	} else if (which == 2) {
	
		menuobj.style.backgroundPosition = "0px -88px";
		document.getElementById("topnavDrive").style.backgroundPosition = "-128px 0%";
		
	} else if (which == 3) {
	
		menuobj.style.backgroundPosition = "0px -110px";
		document.getElementById("topnavAbout").style.backgroundPosition = "-93px 0%";
		
	} else if (which == 4) {
	
		menuobj.style.backgroundPosition = "0px -198px";
		document.getElementById("topnavHome").style.backgroundPosition = "-73px 0%";
		
	} else if (which == 5) {
	
		menuobj.style.backgroundPosition = "0px -132px";
		document.getElementById("topnavDeals").style.backgroundPosition = "-178px 0%";
		
	} else if (which == 6) {
	
		menuobj.style.backgroundPosition = "0px -22px";
		document.getElementById("topnavMaps").style.backgroundPosition = "-132px 0%";
		
	} else if (which == 7) {
	
		menuobj.style.backgroundPosition = "0px 0px";
		document.getElementById("topnavServices").style.backgroundPosition = "-110px 0%";
	
	} 
	 else if (which == 8) {
	
		menuobj.style.backgroundPosition = "0px -198px";
		document.getElementById("topnavEqu").style.backgroundPosition = "-93px 0%";
	
	}
	else if (which == -1) {
	
		menuobj.style.backgroundPosition = "0px -198px";
	
	}
	 
	
}

function resetit(e) { showit(-1) }

function contains_ns6(a, b) {
	while (b.parentNode)
	if ((b = b.parentNode) == a)
	return true;
	return false;
}

function attachKeyEvents() {
	
	var el = document.getElementById(txtCityId);
	
	if (el.addEventListener) {
		
		el.addEventListener ("keydown",processKeyDown,false);
		el.addEventListener ("keyup",processKeyUp,false);
		
	} else if (el.attachEvent) {
		
		el.attachEvent ("onkeydown",processKeyDown);
		el.attachEvent ("onkeyup",processKeyUp);
		
	} else {
		
		el.onkeydown = processKeyDown;
		el.onkeyup = processKeyUp;
		
	}
	
}

function setMultipleValues4(y, m, d) {
	
	document.searchaccom.checkinYear.value = y;
	document.searchaccom.checkinMonth.selectedIndex = m;
	
	for (var i=0; i<document.searchaccom.checkinDate.options.length; i++) {
		
		if (document.searchaccom.checkinDate.options[i].value == d) document.searchaccom.checkinDate.selectedIndex = i;
		
	}
	
}

function setMultipleValues5(y, m, d) {
	
	document.searchaccom.toYear.value = y;
	document.searchaccom.toMonth.selectedIndex = m;
	
	for (var i=0; i<document.searchaccom.toDate.options.length; i++) {
		
		if (document.searchaccom.toDate.options[i].value == d) document.searchaccom.toDate.selectedIndex = i;
		
	}
	
}

function getDateString(y_obj, m_obj, d_obj) {
	
	var y = y_obj.options[y_obj.selectedIndex].value;
	var m = m_obj.options[m_obj.selectedIndex].value;
	var d = d_obj.options[d_obj.selectedIndex].value;
	
	if (y == "" || m == "") return null;
	if (d == "") d = 1;
	
	return str = y + '-' + m + '-' + d;
	
}
