// JavaScript Document

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;






	startList = function() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("nav");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}

	 randomNews = function() {
		if (document.getElementById) {
			var news = document.getElementById('news');
			var articles = news.childNodes;
			
			// get num articles
			var numArticles = 0;
			for (var i=0; i < articles.length; i++) {
				var article_id = articles[i].id;
				if (article_id) {
					if ( article_id.search("article") == 0 ) {
						numArticles++;
					}
				}
				
			}
	
			// set random numbers
			var rn1 = Math.floor(Math.random() * numArticles); 
			var rn2 = rn1;
			while (rn2 == rn1) {
				var rn2 = Math.floor(Math.random() * numArticles); 	
			}
				
			// display articles			
			for (var i=0; i < articles.length; i++) {
				var article_id = articles[i].id;
				if (article_id) {
					if ( article_id.search("article") == 0 ) {
						if ( article_id.split("_")[1] == rn1 || article_id.split("_")[1] == rn2 ) {
							document.getElementById(article_id).className = "visible";	
						}
					}
				}
			}
	
		}
	}
	
	runFunctions = function() {
		startList();
		randomNews();	
	}
	
  window.onload=runFunctions;



