
// common.js
// Geoff Pack, October 2005
// modified November 2006 JG - added return false for location.hash conditionals




function popIt(height, width) {
	
	if (height && width ) {
		popup = window.open('', 'popup', 'width=' + width + ',height=' + height + ',,top=20,left=20,resizable=1,status=0');
	 }
	else {
	popup = window.open('', 'popup', 'width=420,height=280,,top=20,left=20,resizable=1,status=0');
	
	}
	popup.focus();
}



function newwindow() {
	
	 {
	popup = window.open('', 'popup', 'fullscreen=yes');
	
	}
	popup.focus();
}



function hide(id) {
	if (document.getElementById && document.getElementById(id)) document.getElementById(id).style.display = "none";
}
function show(id) {
	if (document.getElementById && document.getElementById(id)) document.getElementById(id).style.display = "block";
}

// ------------------------------------------
// show/hide transcript functions

// if javascript, hide the transcript body -- unless linked to story.htm#transcript (or any #...)
if (!location.hash) {
	document.write("<\style type=\"text/css\">#transcript {display:none;}<\/style>");
}

function enableShowTranscript() {
	if (document.getElementById && document.getElementById('transcriptToggle')) {
		
		var label = document.getElementById('transcriptToggle').innerHTML;
		if (label.length <= 2) label = 'Transcript';
		
		var str = '<a href="#" class="showTranscript" id="showLink" onclick="showTranscript(); return false;">Show ' + label + '</a><b class="hide"> | </b><a href="#" id="hideLink" class="hideTranscript hide" onclick="hideTranscript(); return false">Hide ' + label + '</a>';
		document.getElementById('transcriptToggle').innerHTML = str;
		if (location.hash) {
			hide('showLink'); show('hideLink');
		}
	}
}
function showTranscript() {
	show('transcript'); hide('showLink'); show('hideLink'); 
}
function hideTranscript() {
	hide('transcript'); hide('hideLink'); show('showLink');
}

// ------------------------------------------
// for 'Browse By Date' pages 

var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

function showMonth(month) {
	for (var m in months) {
		hide(months[m]);
	}
	show(month);
}
function showAllMonths() {
	for (var m in months) {
		show(months[m]);
	}
}

// ------------------------------------------
// for 'Browse By Date' forms

function goToDate(month,year) {
	// get month and year from 'Browse by Date' form and create url
	var now = new Date();
	var thisYear = now.getFullYear();
	if (year == '') year = thisYear;
	document.location.href = "../index/date" + year + ".htm#" + month;
}
function showMonthFromHashString() {
	var section = location.hash.substring(1,location.hash.length);
	if (section != '') showMonth(section);
}

// ------------------------------------------
// enable transcript functions

window.onload = enableShowTranscript;

// ------------------------------------------

// Suckerfish dropdown menus
// http://www.htmldog.com/articles/suckerfish/dropdowns/
sfHover = function() {
	// suckerfish rolloever script for IE
	if(document.getElementById("siteNavList")){
		var sfEls = document.getElementById("siteNavList").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
