// Timeout ID for rollover menus
var tID;

window.onload = function() {
	
	// Look for tables and shade alternating rows
	// Only apply shading to tables in this class
	var targetClass = "altRows";
	
	// Shade table headings? (the <th> tag)
	var includeHeadings = false;
	
	// Color definitions
	var evenColor = "#fff";
	var oddColor = "#eee";
	
	var tables = document.getElementsByTagName("table");
	
	for (var i=0; i<tables.length; i++) {
		if (tables[i].className == targetClass) {
			var tbody = tables[i].firstChild;
			if (tbody.hasChildNodes()) {
				for (j=0; j<tbody.childNodes.length; j++) {
					var tr = tbody.childNodes[j];
					if (tr.nodeName.toLowerCase() == "tr") {
						for (k=0; k<tr.childNodes.length; k++) {
							var td = tr.childNodes[k];
							if (td.nodeName.toLowerCase() == "td" || (includeHeadings && td.nodeName.toLowerCase() == "th")) {
								td.style.background = j/2 == parseInt((j/2).toString()) ? evenColor : oddColor;
							}
						}
					}
				}
			}
		}
	}
	
	if (document.getElementById) {
		var nav = document.getElementById("leftNav");
		for (var i=0; i<nav.childNodes.length; i++) {
			node = nav.childNodes[i];
			if (node.nodeName.toLowerCase() == "li") {
				node.onmouseover = function() {
					this.className = this.className ? this.className : "over";
					clearTimeout(tID);
					with (this.parentNode) {
						for (var d=0; d<childNodes.length; d++) {
							if (childNodes[d].nodeName.toLowerCase() == "li" && childNodes[d] != this) {
								childNodes[d].className = childNodes[d].className == "current" ? "current" : "";
							}
						}
					}
				}
	  			node.onmouseout = function() {
					target = this;
	  				tID = setTimeout("target.className = target.className == 'current' ? 'current' : ''",500);
				}
			}
		}
	}
}

// Function to show disclaimer for external links
function disclaimer(url) {
	var legalText="NOTICE: Thank you for visiting Root River State Bank Online.  You are now leaving the Root River State Bank Website and being transferred to a third party website that is not affiliated with Root River State Bank and may have different privacy policies.  Root River State Bank is not responsible for the content of any linked site, or have control over the content on any linked site.  The inclusion of a link does not imply or constitute an endorsement by Root River State Bank, it's ownership or management, the products or services it offers, or any advertisers or sponsors appearing on the linked sites.  Please click on OK to continue or CANCEL to return to the previous page.";
	var openWin = window.confirm(legalText) ? window.open(url,"_blank") : null;
}
function securityNotice(url) {
	var legalText="NOTICE: Root River State Bank will never ask you to send non-public private information through e-mail, such as PIN numbers, Social Security numbers, or account numbers.  Please do not respond to any e-mails requesting this type of information.";
	var openWin = window.confirm(legalText) ? null : null;
}