var menu_names = new Array('info','News','Events','About Us','Member Info','FAQ','competition','Tournaments','Dual Meets','Ladder','people','Roster','Officers/Contacts','Photos','other','Links','Officers Only');
var link_names = new Array('info.html','index.shtml','events.html','about.html','memberinfo.html','faq.html','competition.html','tournament.html','meets.html','ladder.shtml','people.html','memberroster.shtml','officers.html','photos.html','other.html','links.html','protected/staffonly.shtml','shirts.html');
var pic_url = new Array('images/menu/info','images/border/topt','images/border/leftt','images/border/rightt','images/border/bott','','images/menu/competition','images/left','images/right','','images/menu/people','','','','images/menu/other','','images/ocf_binnov.gif','');

function drawHeader(num) {
	if(num == 16) {
		for(i=0;i<17;i=i+1) {
			link_names[i] = "../"+link_names[i];
			pic_url[i] = "../"+pic_url[i];
		}
	} else if(num == 17) {
		for(i=0;i<17;i=i+1) {
			link_names[i] = "../../"+link_names[i];
			pic_url[i] = "../../"+pic_url[i];
		}
		num = 8;
	} else if(num == 18) {
		for(i=0;i<17;i=i+1) {
			link_names[i] = "../../"+link_names[i];
			pic_url[i] = "../../"+pic_url[i];
		}
	} else if(num == 19) {
		for(i=0;i<17;i=i+1) {
			link_names[i] = "../../"+link_names[i];
			pic_url[i] = "../../"+pic_url[i];
		}
		num = 16;
	}

    var randNum = Math.ceil(Math.random()*2);

	// draw top header
	document.write("<center><div style=\"width: 700; background-color: white;\">");
	document.write("<table id=\"banner\" width=100% border=0 cellpadding=0 cellspacing=0><tr height=190><td></table>");
	document.write("<table width=100% border=0 cellpadding=0 cellspacing=0><tr class=\"top\" height=30 align=center><td class=\"topl\" width=6>");
	//document.write("<td class=\"top\">Everything you need to know about badminton at Berkeley... and then some.<td class=\"topr\" width=6></table>");
    if (randNum == 1) {
	    document.write("<td class=\"top\">7-time Northern California Intercollegiate Badminton League Champions.<td class=\"topr\" width=6></table>");
    } else {
        document.write("<td class=\"top\">2009 1st Place Collegiate National Team Champions.<td class=\"topr\" width=6></table>");
    }
        
    // end header
	
	// draw menu
	document.write("<table width=100% border=0 cellpadding=0 cellspacing=0><tr height=30 valign=top><td class=\"left\" width=4><td align=center width=150>");
	document.write("<div id=\"masterdiv\" style=\"width: 150;\">");
	document.write("<img id=\"tt\" src=\""+pic_url[1]+".gif\" width=4 height=4>");
	// draw menu links
	for(i=0;i<17;i=i+1) {
		if(i == 0 || i == 6 || i == 10 || i == 14) {
			if(i == num) {
				document.write("<img class=\"menu\" src=\""+pic_url[i]+"_sel.gif\"><br>");
			} else {
				document.write("<a href=\""+link_names[i]+"\"><img class=\"menu\" src=\""+pic_url[i]+".gif\"></a><br>");
			}
		} else {
			if(i == num) {
				document.write("<span class=\"selected\">"+menu_names[i]+"</span><br>");
			} else {
				document.write("<a class=\"menu\" href=\""+link_names[i]+"\">"+menu_names[i]+"</a><br>");
			}
			if(i == 5 || i == 9 || i == 13 || i == 16)	document.write("<br>");
		}
	}
	document.write("</div>");
	// close off menu
	document.write("<table width=100% border=0 cellpadding=0 cellspacing=0><tr height=4><td class=\"bottom\">");
	document.write("<img id=\"tl\" src=\""+pic_url[2]+".gif\" width=4 height=4>");
	document.write("<img id=\"tr\" src=\""+pic_url[3]+".gif\" width=4 height=4></table>");

	// draw tournament and gym bars
	printGymBar();
	//printTrainBar();

	document.write("<br><a href=\"http://www.ocf.berkeley.edu\" target=\"links\"><img src=\""+pic_url[16]+"\" width=133 height=39><br>&nbsp;");
	// end menu

	document.write("<td class=\"right\" width=4><td style=\"padding: 15px;\">");
}

function drawFooter() {
	// close off content cell
	document.write("<td class=\"right\" width=4></table>");

	// draw bottom of page
	document.write("<table width=100% border=0 cellpadding=0 cellspacing=0><tr class=\"bot\" height=20 align=center>");
	document.write("<td class=\"botl\" width=4><td class=\"bot\" valign=top width=4><img id=\"tb\" src=\""+pic_url[4]+".gif\" width=4 height=4>");
	document.write("<td class=\"bot\">Webpage designed by Justin Hsia, 2006.  Banner designed by Sophia Law, 2009.");
	document.write("<td class=\"botr\" width=4></table></div></center>");
	
	if(navigator.userAgent.match("Firefox") == null && navigator.userAgent.match("Safari") == null) {fixImgPositions();}
}

function fixImgPositions()	{
	document.getElementById('tt').style.left = "7";
	document.getElementById('tr').style.left = "7";
	document.getElementById('tb').style.left = "147";
	document.getElementById('tl').style.right = "7";
}
