function cycleImage() {
	img_captions = new Array();

// captions: (link-url,image-path,alt-text)

	img_captions[0] = Array('http://www.nd.edu/~NETID/','http://www.nd.edu/~NETID/assets/images/rotator/1.jpg','');
	img_captions[1] = Array('http://www.nd.edu/~NETID/','http://www.nd.edu/~NETID/assets/images/rotator/2.jpg','');
	img_captions[2] = Array('http://www.nd.edu/~NETID/','http://www.nd.edu/~NETID/assets/images/rotator/3.jpg','');	


var num = img_captions.length;
	img_number  = Math.floor(Math.random()*(num));
	document.write('<a href="../../../assets/scripts/' + img_captions[img_number][0] + '"><img src="../../../assets/scripts/' + img_captions[img_number][1] + '" alt="' + img_captions[img_number][2] + '" border="0" /></a>');
}


function currentNav() {
	currPage = getCurrentPath();
	navdiv = document.getElementById("nav-global")
	navli = navdiv.getElementsByTagName("li")
	if ((typeof(currPage[0])=="undefined")||currPage[0].length<2){
		for (var j = 0; j < navli.length; j++) {
			if (cleanLastSlash(currPage) == cleanLastSlash(getPath(navli[j].firstChild.href))) {
					navli[j].className = 'nav-current';
			}
		}
	}
	else {
		for (var i = 0; i < currPage.length; i++) {
			currPage[i];
			for (var j = 0; j < navli.length; j++) {
				if (currPage[i] == cleanLastSlash(getPath(navli[j].firstChild.href))) {
					navli[j].className = 'nav-current';
				}
			}
		}
	}
}


function getPath(someurl){
 d = document;
 csite = d.domain;
 sp = someurl.indexOf(csite) + csite.length;
 cpath = someurl.substring(sp);
 if (cpath.search(/index/)!=-1){
  re = "(.*?)\/index.shtml";
  myRe = new RegExp(re);
  cpath = cpath.match(myRe);
 }
return cpath;
}

function cleanLastSlash(someurl){
 lastchar = someurl.length-1;
 if (someurl.charAt(lastchar)=="/"){someurl = someurl.substring(0,(someurl.length-1))}
 return someurl;
}

function getCurrentPath(){
 d = document;
 cpage = d.URL;
 csite = d.domain;
 sp = cpage.indexOf(csite) + csite.length;
 cpath = cpage.substring(sp);
 if (cpath.search(/index/)!=-1){
  re = "(.*?)\/index.shtml";
  myRe = new RegExp(re);
  cpath = cpath.match(myRe);
 }
return cpath;
}

window.onload = init;

function init(){
	currentNav();
}

