function makeactive (thisdiv) {	
	// first we turn everything back to normal state, then we make the current div and its elements active
	// build array of elements
	var thedivnames = new Array( "bookcontent","info", "also", "related");
				
	for (var i = 0; i < thedivnames.length; i++) {
		// hide nav tier one 				
		document.getElementById(thedivnames[i] + '_nav2').style.display='none';
																
		// hide rich data
		document.getElementById(thedivnames[i] + '_richdata').style.display='none'; 
									
		// set the id back
		if (document.getElementById('navbutton_' + thedivnames[i] + '_over')) { 					
				document.getElementById('navbutton_' + thedivnames[i] + '_over').id="navbutton_" + thedivnames[i];												
				}														
				
		// remove active states											
		document.getElementById('navbutton_' + thedivnames[i]).style.backgroundColor='#959595';				         
	}
										
	// make first tier visable			
	document.getElementById(thisdiv + '_nav2').style.display='block';
	// make second tier visable
	document.getElementById(thisdiv + '_richdata').style.display='block';
														
	// make active state sticky by removing mouseover
	document.getElementById('navbutton_' + thisdiv).onmouseout="";
	document.getElementById('navbutton_' + thisdiv).onmouseover="";
	// set id to over
	document.getElementById('navbutton_' + thisdiv).id="navbutton_" + thisdiv + '_over';
	document.getElementById('navbutton_' + thisdiv + '_over').style.backgroundColor='#CEDBF5';				
}

function makeactive_subnav (thisdiv,whichtab) {
	// first we turn everything back to normal state, then we make the current div and its elements active
	
	// build array of elements
	var DIVcoll = document.getElementsByTagName("DIV"), hidden = new Array();
	
	for (LC = 0; LC < DIVcoll.length; LC ++) {
		// if the div has a class of richdata_object_whichtab, we know we can hide it
		if (DIVcoll[LC].className == ("richdata_tab_" + whichtab)) {			
			DIVcoll[LC].style.display="none";
		}			
	}												
	// make  rich content visable 
	document.getElementById( thisdiv ).style.display='block';						
}

// this is used to toggle a specific div's status
function div_toggle (thisdiv) {
	var the_div = document.getElementById( thisdiv );
	if (the_div.style.display == 'block') {
		the_div.style.display='none'; }
	else { the_div.style.display='block';}
	}	
		
function choose_search (theform) {
	//alert(location.href);
	//location.href='/cgi-bin/htsearch?words=' + theform.action.query.value;
	if  (theform.search_key.value == 'all' ) {
	// return false;
		//alert(theform.search_key.value);
		theform.action='/cgi-bin/htsearch?words=' + theform.action.query.value; 
	return false;
	}
	
	else {
		theform.action='/search?action=find_book&query=' + theform.action.query.value;	
	}
	alert(theform.search_key.value);
	theform.submit();
	return true;
	}
	
	
function openWindow(url, name, w, h, perc, scrollbars) {
  // initialize winX and winY to default values
  // for cases where Screen object isn't supported
  var winX = 0;
  var winY = 0;

  // only set new values if 4.0 browser
  if (parseInt(navigator.appVersion) >= 4) {
    winX = (screen.availWidth - w)*perc*.01;
    winY = (screen.availHeight - h)*perc*.01;
	}
  popupWin = window.open(url, name, 'width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY + ',scrollbars=yes, menubar=yes,resiable=yes');
}
	