// JavaScript Document
var navArray = new Array("home","calendar","studies","fellowships","people","history","contact","donations","related");

for (var x=0; x<=9; x++) {
	eval("var " + navArray[x] + "_on = new Image;");
	eval(navArray[x] + "_on.src = 'images/nav/" + navArray[x] + "_on.gif';");
	eval("var " + navArray[x] + "_off = new Image;");
	eval(navArray[x] + "_off.src = 'images/nav/" + navArray[x] + "_off.gif';");
}

function rollOn(name){
	eval("document.images."+name+".src = "+name+"_on.src");
	return true;
}
function rollOff(name){
	eval("document.images."+name+".src = "+name+"_off.src");
	return true;
}

function writeMainNav(pagename){
	document.writeln("<DIV ID='topnav' name='topnav' style='position:absolute; left:0px; top:349px; z-index:12;'>");
	document.writeln("<table border='0' cellspacing='0' cellpadding='0' width='900'>");
	document.writeln("<tr>");
	if (pagename == 'home'){ 
		document.writeln("<td><img name='home' src='images/nav/home_on.gif' alt='Home' width='105' height='36' border='0' /></td>");
	}else{
		document.writeln("<td><a href='index.html' onMouseOver='hideAllNow(); rollOn(&quot;home&quot;);' onMouseOut='rollOff(&quot;home&quot;)'><img name='home' src='images/nav/home_off.gif' alt='Home' width='105' height='36' border='0' /></a></td>");
	}
	if (pagename == 'events'){
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;events_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='calendar' src='images/nav/calendar_on.gif' alt='Events' width='115' height='36' border='0' /></a></td>");
	}else{
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;events_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='calendar' src='images/nav/calendar_off.gif' alt='Events' width='115' height='36' border='0' /></a></td>");
	}
	if (pagename == 'studies'){
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;studies_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='studies' src='images/nav/studies_on.gif' alt='Undergrad & Grad Studies' width='295' height='36' border='0' /></a></td>");
	}else{
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;studies_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='studies' src='images/nav/studies_off.gif' alt='Undergrad & Grad Studies' width='295' height='36' border='0' /></a></td>");
	}
	if (pagename == 'fellowships'){
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;fellowships_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='fellowships' src='images/nav/fellowships_on.gif' alt='Fellowships and Prizes' width='265' height='36' border='0' /></a></td>");
	}else{
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;fellowships_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='fellowships' src='images/nav/fellowships_off.gif' alt='Fellowships and Prizes' width='265' height='36' border='0' /></a></td>");
	}
	if (pagename == 'people'){
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;people_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='people' src='images/nav/people_on.gif' alt='People' width='120' height='36' border='0' /></a></td>");
	}else{
		document.writeln("<td><a href='' onMouseOver='hideAllNow(); showDropdown(&quot;people_dropdown&quot;);' onMouseOut='hideDropdown();'><img name='people' src='images/nav/people_off.gif' alt='People' width='120' height='36' border='0' /></a></td>");
	}
	document.writeln("</tr></table>");
	document.writeln("</DIV>");
}

function writeSubNav(pagename){
	document.writeln("<DIV ID='subnav' name='subnav' style='position:absolute; left:0px; top:385px; z-index:8;'>");
	document.writeln("<table border='0' cellspacing='0' cellpadding='0' width='900'><tr>");
	if (pagename == 'history'){
		document.writeln("<td><img name='history' src='images/nav/history_on.gif' alt='Yale LGBTS History' width='200' height='25' border='0' /></td>");
	}else{
		document.writeln("<td><a href='lgbts_history.html' onMouseOver='hideAllNow(); rollOn(&quot;history&quot;);' onMouseOut='rollOff(&quot;history&quot;)'><img name='history' src='images/nav/history_off.gif' alt='Yale LGBTS History' width='200' height='25' border='0' /></a></td>");
	}
	if (pagename == 'contact'){
		document.writeln("<td><img name='contact' src='images/nav/contact_on.gif' alt='Contact Us' width='105' height='25' border='0' /></td>");
	}else{
		document.writeln("<td><a href='contact.html' onMouseOver='hideAllNow(); rollOn(&quot;contact&quot;);' onMouseOut='rollOff(&quot;contact&quot;)'><img name='contact' src='images/nav/contact_off.gif' alt='Contact Us' width='105' height='25' border='0' /></a></td>");
	}
	if (pagename == 'donations'){
		document.writeln("<td><img name='donations' src='images/nav/donations_on.gif' alt='Donations' width='95' height='25' border='0' /></td>");
	}else{
		document.writeln("<td><a href='donations.html' onMouseOver='hideAllNow(); rollOn(&quot;donations&quot;);' onMouseOut='rollOff(&quot;donations&quot;)'><img name='donations' src='images/nav/donations_off.gif' alt='Donations' width='95' height='25' border='0' /></a></td>");
	}
	if (pagename == 'related'){
		document.writeln("<td><img name='related' src='images/nav/related_on.gif' alt='Related Links' width='200' height='25' border='0' /></td>");
	}else{
		document.writeln("<td><a href='related.html' onMouseOver='hideAllNow(); rollOn(&quot;related&quot;);' onMouseOut='rollOff(&quot;related&quot;)'><img name='related' src='images/nav/related_off.gif' alt='Related Links' width='200' height='25' border='0' /></a></td>");
	}
	if (pagename == 'home'){
		document.writeln("<td><img src='images/darkgrey_pixel.gif' width='300' height='25' border='0' /></td>");
	}else{
		document.writeln("<td><img src='images/blue_pixel.gif' width='300' height='25' border='0' /></td>");
	}
	document.writeln("</tr></table>");
	document.writeln("</DIV>");
}

function writeEventsDrop(pagename){
	var eventsURLArray = new Array('calendar','schism','diaspora','anniversary','calendar');
	var eventsNameArray = new Array('This Year&rsquo;s Calendar ','Anglican Schism conference','Black Queer Diaspora symposium','WGSS/LGBTS Anniversary','Archive');
	document.writeln("<DIV ID='events_dropdown' name='events_dropdown' style='position:absolute; left:105px; top:385px; z-index:20; visibility:hidden;'>");
	document.writeln("<table border='0' bgcolor='#ffffff' cellspacing='0' cellpadding='5'>");
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;events_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1' border='0' /></td><td></td></tr>");
	var max = eventsNameArray.length;
	for(i=0;i<max; i++){
		document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;events_dropdown&quot;)' onmouseout='hideDropdown()' class='topdrop'>");
		if (pagename != eventsURLArray[i]){
			document.writeln("<a href='" + eventsURLArray[i] + ".html' class='topdrop'>");
		}
		document.writeln(eventsNameArray[i]);
		if (pagename != eventsURLArray[i]){
			document.writeln("</a>");
		}
		document.writeln("</td><td></td></tr>");
	}
	document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;events_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1'  border='0' /></td><td></td></tr>");
    document.writeln("</table>");
	document.writeln("</DIV>");	
}

function writeStudiesDrop(pagename){
	var eventsURLArray = new Array('calendar','schism','diaspora','anniversary','calendar');
	var eventsNameArray = new Array('This Year&rsquo;s Calendar ','Anglican Schism conference','Black Queer Diaspora symposium','WGSS/LGBTS Anniversary','Archive');
	document.writeln("<DIV ID='events_dropdown' name='events_dropdown' style='position:absolute; left:105px; top:385px; z-index:20; visibility:hidden;'>");
	document.writeln("<table border='0' bgcolor='#ffffff' cellspacing='0' cellpadding='5'>");
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;events_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1' border='0' /></td><td></td></tr>");
	var max = eventsNameArray.length;
	for(i=0;i<max; i++){
		document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;events_dropdown&quot;)' onmouseout='hideDropdown()' class='topdrop'>");
		if (pagename != eventsURLArray[i]){
			document.writeln("<a href='" + eventsURLArray[i] + ".html' class='topdrop'>");
		}
		document.writeln(eventsNameArray[i]);
		if (pagename != eventsURLArray[i]){
			document.writeln("</a>");
		}
		document.writeln("</td><td></td></tr>");
	}
	document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;events_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1'  border='0' /></td><td></td></tr>");
    document.writeln("</table>");
	document.writeln("</DIV>");	
	
	var studiesURLArray = new Array('undergrad','grad','pinkbook');
	var studiesNameArray = new Array('Undergraduates','Graduate Students','Pink Book');
	document.writeln("<DIV ID='studies_dropdown' name='studies_dropdown' style='position:absolute; left:220px; top:385px; z-index:20; visibility:hidden;'>");
	document.writeln("<table border='0' bgcolor='#ffffff' cellspacing='0' cellpadding='5'>");
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;studies_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1' border='0' /></td><td></td></tr>");
	var max = studiesNameArray.length;
	for(i=0;i<max; i++){
		document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;studies_dropdown&quot;)' onmouseout='hideDropdown()' class='topdrop'>");
		if (pagename != studiesURLArray[i]){
			document.writeln("<a href='" + studiesURLArray[i] + ".html' class='topdrop'>");
		}
		document.writeln(studiesNameArray[i]);
		if (pagename != studiesURLArray[i]){
			document.writeln("</a>");
		}
		document.writeln("</td><td></td></tr>");
	}
	document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;studies_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1'  border='0' /></td><td></td></tr>");
    document.writeln("</table>");
	document.writeln("</DIV>");	
}

function writeFellowshipsDrop(pagename){
	var fellowshipsURLArray = new Array('overview','brudner','pettit','flags','solomon','cohen','gala');
	var fellowshipsNameArray = new Array('Overview','Brudner Prize','Pettit Fellowship','FLAGS Grants','Solomon Fellowships','Cohen Fund','GALA Senior Essay Prize');
	document.writeln("<DIV ID='fellowships_dropdown' name='fellowships_dropdown' style='position:absolute; left:515px; top:385px; z-index:20; visibility:hidden;'>");
	document.writeln("<table border='0' bgcolor='#ffffff' cellspacing='0' cellpadding='5'>");
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;fellowships_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1' border='0' /></td><td></td></tr>");
	var max = fellowshipsNameArray.length;
	for(i=0;i<max; i++){
		document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;fellowships_dropdown&quot;)' onmouseout='hideDropdown()' class='topdrop'>");
		if (pagename != fellowshipsURLArray[i]){
			document.writeln("<a href='" + fellowshipsURLArray[i] + ".html' class='topdrop'>");
		}
		document.writeln(fellowshipsNameArray[i]);
		if (pagename != fellowshipsURLArray[i]){
			document.writeln("</a>");
		}
		document.writeln("</td><td></td></tr>");
	}
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;fellowships_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1'  border='0' /></td><td></td></tr>");
    document.writeln("</table>");
	document.writeln("</DIV>");	
}

function writePeopleDrop(pagename){
	var peopleURLArray = new Array('faculty','visiting');
	var peopleNameArray = new Array('Faculty','Visiting Lecturers<br>& Pettit Fellow');
	document.writeln("<DIV ID='people_dropdown' name='people_dropdown' style='position:absolute; left:752px; top:385px; z-index:20; visibility:hidden;'>");
	document.writeln("<table border='0' bgcolor='#ffffff' cellspacing='0' cellpadding='5'>");
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;people_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1' border='0' /></td><td></td></tr>");
	var max = peopleNameArray.length;
	for(i=0;i<max; i++){
		document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;people_dropdown&quot;)' onmouseout='hideDropdown()' class='topdrop'>");
		if (pagename != peopleURLArray[i]){
			document.writeln("<a href='" + peopleURLArray[i] + ".html' class='topdrop'>");
		}
		document.writeln(peopleNameArray[i]);
		if (pagename != peopleURLArray[i]){
			document.writeln("</a>");
		}
		document.writeln("</td><td></td></tr>");
	}
	
	
    //document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;people_dropdown&quot;)' onmouseout='hideDropdown()' align='right'><a href='faculty.html' class='topdrop'>Faculty</a></td><td></td></tr>");
    //document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;people_dropdown&quot;)' onmouseout='hideDropdown()' align='right'><a href='visiting.html' class='topdrop'>Visiting Lecturers<br>& Pettit Fellow</a></td><td></td></tr>");
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;people_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1'  border='0' /></td><td></td></tr>");
    document.writeln("</table>");
	document.writeln("</DIV>");	
}

function writeHistoryDrop(pagename){
	var historyURLArray = new Array('lgbts_history','yale_ct_history');
	var historyNameArray = new Array('History of Yale LGBTS','Yale/Connecticut LGBT History');
	document.writeln("<DIV ID='history_dropdown' name='history_dropdown' style='position:absolute; left:40px; top:410px; z-index:20; visibility:hidden;'>");
	document.writeln("<table border='0' bgcolor='#374157' cellspacing='0' cellpadding='5'>");
    document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;history_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1' border='0' /></td><td></td></tr>");
	var max = historyNameArray.length;
	for(i=0;i<max; i++){
		document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;history_dropdown&quot;)' onmouseout='hideDropdown()' class='subdrop'>");
		if (pagename != historyURLArray[i]){
			document.writeln("<a href='" + historyURLArray[i] + ".html' class='subdrop'>");
		}
		document.writeln(historyNameArray[i]);
		if (pagename != historyURLArray[i]){
			document.writeln("</a>");
		}
		document.writeln("</td><td></td></tr>");
	}
	document.writeln("<tr><td></td><td onmouseover='showDropdown(&quot;history_dropdown&quot;)' onmouseout='hideDropdown()'><img src='images/spacer.gif' width='1' height='1'  border='0' /></td><td></td></tr>");
    document.writeln("</table>");
	document.writeln("</DIV>");	
}

var currentdiv = null;
var timerID = null;
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
W3C = document.getElementById ? 1 : 0;

function hideDropdown(){
	timerID = setTimeout('hideAll2()',10)
} 

function clearAll(){
 clearTimeout(timerID)
} 

function hideAll2(){
	 if (ns4) {
		eval("document."+currentdiv+".visibility = 'hide'");
	} else if (ie4) {
		eval("document.all."+currentdiv+".style.visibility = 'hidden'");
	} else if (W3C) {
		eval("document.getElementById('"+currentdiv+"').style.visibility = 'hidden'");
	}
} 

function hideAllNow(){
clearTimeout(timerID);
  if (currentdiv != null){
	 if (ns4) {
		eval("document."+currentdiv+".visibility = 'hide'");
	} else if (ie4) {
		eval("document.all."+currentdiv+".style.visibility = 'hidden'");
	} else if (W3C) {
		eval("document.getElementById('"+currentdiv+"').style.visibility = 'hidden'");
	}
  }
} 

function showDropdown(div) {
clearTimeout(timerID);
	 if (ns4) {
		eval("document."+div+".visibility = 'show'");
	} else if (ie4) {
		eval("document.all."+div+".style.visibility = 'visible'");
	} else if (W3C) {
		eval("document.getElementById('"+div+"').style.visibility = 'visible'");
	}
currentdiv = div;
}	