var newWindow = null;

	function closeWin(){
		if (newWindow != null){
			if(!newWindow.closed)
				newWindow.close();
		}
	}
	
	function popUpWin(url, type, strWidth, strHeight){
		closeWin();
		if (type == "fullScreen"){
			strWidth = screen.availWidth - 10;
			strHeight = screen.availHeight - 160;
		}
		var tools="";
		if (type == "standard" || type == "fullScreen") tools = "resizable=no,toolbar=no,location=no,scroll=yes,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
		if (type == "console") tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
		newWindow = window.open(url, 'newWin', tools);
		newWindow.focus();
	}


function clearText(thefield) {
	  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
	} 
function replaceText(thefield) {
	  if (thefield.value=="") { thefield.value = thefield.defaultValue }
	}

var newwindow;
function SameWindow(url){
	newwindow=window.open(url,'allExternal');
	if (window.focus) {newwindow.focus()}
	}

function showHide(obj) {
	var el = document.getElementById(obj);
	if ( el.className != 'show' ) {
		el.className = 'show';
	}
	else {
		el.className = 'hide';
	}
}

function newsNav(obj) {
	var el = document.getElementById(obj);
	if ( el.className != 'on' ) {
		el.className = 'on';
	}
	else {
		el.className = '';
	}
}

function newseventsNav(obj,obj2) {
	var news = document.getElementById(obj);
	var events = document.getElementById(obj2);
	if ( news.className != 'on' && events.className == 'on' ) {
		news.className = 'on';
		events.className = '';
	} else {
		news.className = '';
		events.className = 'on';
	}
}


function showArticle(){
	query = document.location.search;
	articleNumber = query.substring(query.indexOf('?')+1, query.length);
	if(articleNumber!=''){
		showHide('article-div');
		showHide(articleNumber);
	}
	//document.getElementsByTagName('div').className('show');
}

function moveLoginMasthead(){
		document.getElementById('LoginForm').style.position="absolute";
		document.getElementById('LoginForm').style.top="50px";
		document.getElementById('LoginForm').style.left="730px";
}

function moveLoginMastheadHomepage(){
		document.getElementById('LoginForm').style.position="absolute";
		document.getElementById('LoginForm').style.top="40px";
		document.getElementById('LoginForm').style.left="740px";
}

function moveLoginNav(){
		document.getElementById('LoginForm').style.position="static";
		document.getElementById('LoginForm').style.marginLeft="25px";
}

function loginAlert (){
	alert('Fellows and Alumni may sign in using the link at the top right.');
	moveLoginMastheadHomepage();
	showHide('LoginForm');
}

function printFlash(source, width, height, id, bg_color) {
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
document.write('width="'+width+'" height="'+height+'" id="'+id+'" align="middle" />');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="'+source+'" />');
document.write('<param name="menu" value="false" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="bgcolor" value="'+bg_color+'" />');
document.write('<embed src="'+source+'" menu="false" quality="high" bgcolor="'+bg_color+'" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" ');
document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

function showSearchNewThread( strID ) {
	document.getElementById('search').className = ( (strID=="01") ? 'show' : 'hide');
	document.getElementById('new-thread').className = ( (strID=="02") ? 'show' : 'hide');
}

function highlightText( strID ) {
	document.getElementById('search-text').className = ( (strID=="search-text") ? 'red-title2' : '');
	document.getElementById('new-thread-text').className = ( (strID=="new-thread-text") ? 'red-title2' : '');
}

