/* Written by Dan Narsavage (spazmaster@cableone.net) on 11/27/03 */
/* Copy it if you want, leaving this heading, but I don't know why you'd want to. */
/* It's doubtlessly buggy as hell  */
/* Seems to work on MS Internet Explorer 6.x and Netscape 7.x. in both Windows XP and Windows 98 */


/* TAKES pageNum AND USES IT TO DETERMINE COLOR OF NAVIGATION BAR PANELS (var navClass) AND THE PROPER MESSAGE TO  APPLY TO heading (var page), WRITES THE REDUNDANT CODE FOR EACH PAGE  */
function header(pageNum,folders) {
	//alert ("I'm working on it");
	var page = new Array();						//THE NAME OF EACH PAGE
		page[0] = "Home";  							// HOMEPAGE
		page[1] = "Training Classes";				// CLASSES
		page[2] = "Class Schedule";		 			// SCHEDULE OF CLASSES FOR UPCOMING SESSIONS
		page[3] = "ODMAD People";		 			// INSTRUCTORS & ASSISTANTS
		page[4] = "Titles &amp; Awards";			// TITLES
		page[5] = "Other Activities";				// OTHER ACTIVITIES
		page[6] = "Agility Equipment";	 			// AGILITY EQUIPMENT
		page[7] = "ODMAD Contacts";  				// CONTACT ODMAD
	var heading = page[pageNum];				//HEADING FOR PRESENT PAGE - TAKEN FROM ABOVE
	var navClass = new Array(page.length);		//CSS STYLES TO APPLY TO TOC ELEMENTS
	var i = folders;
	//alert(i);
	var linkPrefix = "";
	while (i > 0) {
		linkPrefix = linkPrefix + "../";
		i--
	} 
	var link = new Array(page.length);		//URLs (RELATIVE) FOR EACH PAGE
		link[0] = linkPrefix + "./"
		link[1] = linkPrefix + "classes.html"
		link[2] = linkPrefix + "schedule.html"
		link[3] = linkPrefix + "people.html"
		link[4] = linkPrefix + "awards.html"
		link[5] = linkPrefix + "activities.html"
		link[6] = linkPrefix + "equipment/"
		link[7] = linkPrefix + "contact.html"
	//alert("Heading length = " + heading.length);


	/* SETS heading TO "One Dog Makes A Difference" IF EMPTY  */
	if (heading.length < 1) {
		heading = "One Dog Makes A Difference";
	}


	/* SETS ALL NAVIGATION BAR ITEMS TO CLASS=CONTENTS  */
	var i=0;
	var x = page.length;
	while (i < x) {
		//alert(i);
		navClass[i] = 'contents';			
		//alert(i + " = " + navClass[i]);
		//alert(page[i] + " = " + navClass[i]);
		i++;
	}  
	/*  DETERMINES WHICH NAVIGATION BAR ITEM TO MAKE CLASS=URHERE  */
	if (pageNum != 0) {
		navClass[pageNum] = 'urhere';
	}
	//alert (pageNum);

	/* WRITE THE HTML  */


	document.write (" <div id=\"redbar\">");
	document.write ("   <div id=\"sneakyCounter\"><a onClick=\"showCounter();\">&nbsp;&nbsp;&nbsp;</a></div>");
	document.write (" </div>");
	document.write (" <div id=\"main\">");
	document.write ("  <div id=\"title\"></div>");
	document.write ("  <div id=\"onedog\">");
	document.write ("    <img align=\"right\" src=\"" + linkPrefix + "images/onedog.gif\">");
	document.write ("  </div>");

/*	if (pageNum == 0) {
		document.write ("  <div id=\"logo\"><img id=\"circle\" src=\"" + linkPrefix + "images/logo.gif\" /></div>");
	}
*/
	if (pageNum != 0) {
		document.write ("  <div id=\"heading\">");
		document.write ("   <h1>");
		document.write ("    " + heading);
		document.write ("   </h1>");
		document.write ("  </div> <!-- id=\"heading\" -->");
		document.write (" <div id=\"body\">");
		document.write (" <div id=\"vert_divider\"></div>");
	}

	var i=0;
	while (i < page.length) {
		document.write ("	 <div id=\"contents" + i + "\" class=\"" + navClass[i] + "\">");
		document.write ("		<a href=\"" + link[i] + "\">" + page[i]+ "</a>");
		document.write ("	 </div>");
		i++
	}

}  //END OF FUNCTION HEADER


function awardHeader() {
	var firstyear = 2008; // First year listed in all awards pages
	var lastyear = 2011; // last year listed in all awards pages
	var cols = 4;  // number of columns in table of year links on awards pages
	var j = 0;  // variable to count cells per table row
	document.write ("<table class=\"awardhead\" cols=\"" + cols + "\">");
	document.write (" </tr>");
	for (i=firstyear; i<=lastyear; i++) {
		document.write ("  <td class=\"awardYear\">");
		document.write ("   <a href=\"" + i + ".html\">" + i + "</a>");
		document.write ("  </td>");
		j++;
		if ((j == cols) && (i!=lastyear)) {
			document.write (" </tr>");
			document.write (" <tr>");
			j = 0;
		}
	}
	document.write (" <tr>");
	document.write ("  <td colspan=\"" + cols + "\">");
	document.write ("   <a href=\"../../awards.html\">Back to the awards main page</a>");
	document.write ("  </td>");
	document.write (" </tr>");
	document.write ("</table>");
}


//  WILL OPEN A POP UP WINDOW OF [PARAMETERS] SIZE - NOT RESIZABLE OR SCROLLABLE
function popUpWindow(URLStr, left, top, width, height) {
	var popUpWin=0;
	if ((popUpWin) && (!popUpWin.closed)) popUpWin.close();
	//alert('URL =' + URLStr);
	//alert('Left =' + left);
	//alert('Top =' + top);
	//alert('Width =' + width);
	//alert('Height =' + height);
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width='+width+', height='+height+', left='+left+', top='+top+', screenX='+left+', screenY='+top+''); 
	popUpWin.focus();
}


//  WILL OPEN A POP UP WINDOW OF [PARAMETERS] SIZE - RESIZABLE AND SCROLLABLE
function openSizedWindow(URLStr, width, height, name) {
var sizedWin=0;
var winName = new String(name);
//alert('Window Name is ' + winName);
if (winName.length == 0) {
	winName = "Sized_Window";
}
//alert('Window Name is ' + winName);
	if ((sizedWin) && (!sizedWin.closed)) sizedWin.close();
	sizedWin = open(URLStr, winName, 'toolbar=yes, location=yes, directories=no, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width='+width+', height='+height+'');
	sizedWin.focus();
}


//  WILL BRING THE COUNTER TO THE FRONT OR PUT IT BACK AGAIN
function showCounter() {
	if (document.getElementById("counter").style.zIndex == 120) {
		document.getElementById("counter").style.zIndex = -1;
	}
	else {
		document.getElementById("counter").style.zIndex = 120;
	}
}




