function img_on(imgName, type) {
   imgOn = 'img/nav/' + type + '/' + imgName + '.gif';
   //alert(imgOn);
   document.images[imgName].src = imgOn;
}


/**
* Pops up a dialog box.
*/
function dialog(url) {
    var features="dialogHeight:600px; dialogWidth:700px; status:no; unadorned:yes; resizable: yes";
    // pass in a reference the base window
    var arguments = new Array(2);
    arguments[0] = url;
    window.showModalDialog('modalContainer.html', arguments, features);
    // works with normal windows
    window.location.reload();
    // in case this was launched from modalContainer.html
    var selfHref = window.location.href;
    self.navigate(selfHref);
}

/**
*
*/
function remoteFormSubmit(theWindow, theForm) {
    theWindow.location.reload();
}

/**
* Trap the escape key and cause it to close the browser window.
*
* Must be used in conjunction with
* <BODY onKeyPress="microsoftKeyPress()">
*
* I think this only works with Internet Explorer.
*/
function microsoftKeyPress() {
    if (window.event.keyCode == 27)
        window.close();
}

/*
* Show/hide functions for abstracts on the publications search result pages
*/
function hideShowKicker() {
	for (var i=0; i < document.getElementsByTagName('span').length; i++) { // Look for abstracts
		var a = document.getElementsByTagName('span')[i];
		if (a.className == 'abstract') { // Abstract found: turn it off.
			a.style.display = "none";
		}
		if (a.className == 'absplace') { // placeholder found: turn it on.
			a.style.display = "inline";
		}
	}
}
function hideShowClicker() { // Generate the hide/show button
	document.writeln('<div id="on" style="display: none;"><a href="javascript: hideShow(\'expand\', \'on\');">Hide all abstracts</a></div><div id="expand" style="display: block;"><a href="javascript: hideShow(\'expand\', \'on\');">Show all abstracts</a></div>');
}
function hideShow() {
	for (var i=0; i < hideShow.arguments.length; i++) { // Hide and show the button
		var element = document.getElementById(hideShow.arguments[i]);
		element.style.display = (element.style.display == "none") ? "inline" : "none";
	}
	for (var i=0; i < document.getElementsByTagName('span').length; i++) { // Look for abstracts
		var a = document.getElementsByTagName('span')[i];
		if (document.getElementById('expand').style.display == "none") { // 'show abstracts' button fires
			if (a.className == 'abstract') { // Abstract found: turn it on.
				a.style.display = "inline";
			}
			if (a.className == 'absplace') { // placeholder found: turn it off.
				a.style.display = "none";
			}
		} else {
			if (a.className == 'abstract') { // Abstract found: turn it off.
				a.style.display = "none";
			}
			if (a.className == 'absplace') { // placeholder found: turn it on.
				a.style.display = "inline";
			}
		}
	}
}
function hideShowOne(psid) {
	var p = 'abp' + psid;
	var s = 'abs' + psid;
	var abpid = document.getElementById(p);
	var absid = document.getElementById(s);
	if (abpid.style.display == "inline") {
		abpid.style.display = "none";
		absid.style.display = "inline";
	} else {
		abpid.style.display = "inline";
		absid.style.display = "none";
	}
}

