// JavaScript Document

var 	descriptionDictionary = new Array();
descriptionDictionary[ "centralSearchTab" ] = [ document.createTextNode( "One-stop search of select databases, the library catalog, and the web." ), "" ];
/* 
descriptionDictionary[ "catalogSearchTab" ] = [ document.createTextNode( "Search the Library Catalog." ), "http://www.opac.co.nz/pics/opac-logo.gif" ]; 
*/
descriptionDictionary[ "catalogSearchTab" ] = [ document.createTextNode( "Search the Library Catalog." ), "" ]; 
/*
descriptionDictionary[ "databaseSearchTab" ] = [ document.createTextNode( "Find articles in electronic resource databases." ), "http://www.aristotle360.com/images/360-blue-logo-200px.jpg" ];
*/
descriptionDictionary[ "databaseSearchTab" ] = [ document.createTextNode( "Find articles in electronic resource databases." ), "" ];
/*
descriptionDictionary[ "journalSearchTab" ] = [ document.createTextNode( "Search and browse electronic journal titles." ), "http://educ.queensu.ca/atep/atep_logo.gif" ];
*/
descriptionDictionary[ "journalSearchTab" ] = [ document.createTextNode( "Search and browse electronic journal titles." ), "" ];
descriptionDictionary[ "scholarSearchTab" ] = [ document.createTextNode( "Find academic works indexed by Google using Google Scholar." ), "" ];
descriptionDictionary[ "worldcatSearchTab" ] = [ document.createTextNode( "Search for an item in libraries near you using WorldCat Search." ), "" ];

function getEventTarget( evt ) {
	targ = ( evt.target ) ? evt.target : ( evt.srcElement ) ? evt.srcElement : "";
	return ( targ.nodeType != 3 ) ? targ : targ.parentNode;
}

function returnActiveSearchTab() {
/*	if( getEventTarget( evt ).nodeName.toLowerCase() == "ul" || getEventTarget( evt ).nodeName.toLowerCase() == "li" ) {
*/
	n = document.getElementById( "comboSearchTabs" );
		for( i = 0; i < n.childNodes.length; i++ ) {
			nLi = n.childNodes[ i ];
			if( nLi.nodeType == 1 && nLi.nodeName.toLowerCase() == "li" ) {
				if( nLi.className == "activeTab" ) {
					elem = document.getElementById( "searchDescriptionBox" );
					while( elem.firstChild ) {
						elem.removeChild( elem.firstChild );
					}
					elem.appendChild( descriptionDictionary[ nLi.id ][ 0 ] );
					document.getElementById( "searchLogoBox" ).src = descriptionDictionary[ nLi.id ][ 1 ];
					break;
				}
			}
		}
/*	} */
	return false;
}

function toggleSearchDescription( evt ) {
	n = getEventTarget( evt );
	if( n.nodeType == 1 ) {
		while( n.nodeName.toLowerCase() != "li" ) {
			n = n.parentNode;
		}
		elem = document.getElementById( "searchDescriptionBox" );
		while( elem.firstChild ) {
			elem.removeChild( elem.firstChild );
		}
		elem.appendChild( descriptionDictionary[ n.id ][ 0 ] );
		document.getElementById( "searchLogoBox" ).src = descriptionDictionary[ n.id ][ 1 ];
	}
	return false;
}
	
function toggleSearchTabs( evt ) {
	var eHref = getEventTarget( evt ).href;
	getEventTarget( evt ).href = "#";
	elem = getEventTarget( evt ).parentNode;
	if ( elem.className == "inactiveTab" ) {
		elem.className = "activeTab";
		document.getElementById( elem.id.substring( 0, elem.id.length - 3 ) + "Box" ).className = "comboSearchBoxBody activeSearchBox";
	}
	nl = elem.parentNode.childNodes;
	for( i = 0; i < nl.length; i++ ) {
		n = nl[ i ];
		if( ( n.nodeName == "LI" || n.nodeName == "li" ) && n != elem ) {
			n.className = "inactiveTab";
			document.getElementById( n.id.substring( 0, n.id.length - 3 ) + "Box" ).className = "comboSearchBoxBody inactiveSearchBox";
		}
	}
	getEventTarget( evt ).blur();
	getEventTarget( evt ).href = eHref;
	return false;
}