// **********************
function _debug(string){
	var DEBUG = false;
	if(DEBUG){document.write("DEBUG: ",string,"<BR>")}
}

// **********************
function spawn(expr,qty,reversed){

//Thanks to http://www.mickweb.com for the original version of this code

	var spawnee=[expr];  for(s=1;s<qty;s++){
		spawnee[s]=expr+spawnee[s-1]  
	}  
	if(reversed){
		return spawnee.reverse()  
	}else{
		return spawnee  
	}
}

// **********************
function mrutc_Crumbs(root,divider,default_page) {

//Thanks to http://www.mickweb.com for the original version of this code

	if(!divider) {divider = " : "}
	if(!default_page){default_page = "index.htm"}
_debug(location)

	var m = location.toString(),h = "";
	m = m.substring(m.indexOf("/")+1);
	m = m.split("/");
_debug(m)
	var howmany = spawn("../",m.length,true);
_debug(howmany)
	howmany[m.length] = default_page;

	for(i = 1;i<m.length-1;i++){
_debug(i)
		h += ("<a href = "+howmany[i+2]+">"+unescape( m[i]+"</a>"+divider))
	}

	h += document.title;
	if(root) {
		h = h.replace(eval("/"+location.host+"/"),root)
	}

_debug(h)
	return h
	
}

// **********************
function wistrans_Header(){

	var backColor = "#CC0000"
	var textColor = "white"
	theCrumb = mrutc_Crumbs("mrutc.org"); 

	// Header bar
	document.write(
"<table border=0 cellpadding=5 cellspacing=0 width='100%' bgcolor='" + backColor + "'>" + 
"  <tr valign=center> " + 
"    <td width='100%' height='37' valign='top'>" +
"    <b><font face='Arial, Helvetica, sans-serif' size='5' color='" + textColor + "'>" + 
"      Wisconsin Transportation Center (Wistrans)</font></b></td>" + 
"    <td width='1'></td>" + 
"    <td width='80' rowspan='5' halign='right'>" + 
"    <a href='/'><img src='/images/wistrans.jpg' alt='Wisconsin Transportation Center's logo' border=0 height=90></a></td>" + 
"  </tr> " + 
"  <tr valign=center> " + 
"    <td rowspan='2' valign='top'><p>" + 
"        <FONT face='Arial, Helvetica, sans-serif' size='2'><B><em>A facilitating university-based transportation effort</em></B></FONT></p></td>" + 
"    <td height='32'></td>" + 
"  </tr>" + 
"  <tr valign=center> " + 
"    <td height='3'></td>" + 
"    <td></td>" + 
"  </tr>" + 
"  <tr valign=center> " + 
// "    <td height='23' colspan='2' valign='top'> <hr noshade> </td>" + 
 "    <td height='20'</td>" + 
"    <td></td>" + 
"  </tr>" + 
//"  <tr valign=center><td height='35'><FONT face='arial, Helvetica' size=2>" + theCrumb + "</font></td></tr>" + 
"</table>"
	);

}


function wistrans_Footer(){

	// Horizontal rule
//	document.write("<hr color='#C0C0C0' size='5'>");
//	document.write("<hr noshade>");

	// Last updated
	document.write("<FONT face='Arial' size=1 color='#FFFFFF'>");
	mrutc_LastUpdated();
	document.write("</FONT>");

	// Footer text
	document.write(
"<BR><font face='Arial' size='1' color='black'>" + 
"©2004 <a href='http://www.wistrans.org/'>WisTrans</a>. All rights reserved.</font>"
	);
}

function mrutc_LastUpdated(){
	revdate = new Date(document.lastModified);
	year = revdate.getYear();
	if (year > 1999)
		year = year
	else
		if (year < 90)
			year = year+2000
		else
			year = year+1900;
			month = revdate.getMonth() + 1;
			day = revdate.getDate();
			var mon;
			if (month==0) mon = "January";
			if (month==1) mon = "January";
			if (month==2) mon = "February";
			if (month==3) mon = "March";
			if (month==4) mon = "April";
			if (month==5) mon = "May";
			if (month==6) mon = "June";
			if (month==7) mon = "July";
			if (month==8) mon = "August";
			if (month==9) mon = "September";
			if (month==10) mon = "October";
			if (month==11) mon = "November";
			if (month==12) mon = "December";

	document.write("This page last modified on " + mon + " " + day + ", " + year);

}

