<!--
var libraryStem = "";
var commercialStem = "";

function setStems( stems )
{
	var roots = stems.split("|");
	
	if( stems.length > 0 )
	{
		libraryStem = roots[0];
	  commercialStem = roots[1];
	}
	else return false;
}
function popTops( list )
{
	$( "webs" ).innerHTML = ""; 
//	clearTable( $( "booktab" ) );
  var x = 1;
	var topicdiv = $("topic");
	topicdiv.options.length=0;
	topicdiv.options[0] = new Option("Select a Topic","",true,true);
	for( var item in list )
	{
		item = list[x-1];
		topicdiv.options[x] = new Option(item.displayName,item.name,false,false);//.value=( list[x] ).name;
//		topicdiv.options[x].text=( list[x] ).displayName;
//		alert( ( list[x++] ).name);
		x++;
	}
	DWRUtil.setValue( $("topic"),list);
}
<!-- Deals with change of topic selection. only calls server if option is other than default -->
function submitTopic( catid , topicid )
{
	if(topicid != 0 & topicid != "")
	{
		DWREngine.beginBatch();
		booksCacheBean.getUrlStems( setStems );
		booksCacheBean.getBooks( catid , topicid , popBooks );
		booksCacheBean.getWebs( catid , topicid , popWebs );
		DWREngine.endBatch();
	}
	else
	{
		clearData();
	}
	return false;
}
<!-- Make sure that an active category has been selected -->
function submitCategory( cat )
{
  clearTopics();
	clearData();
	
	if( cat.length > 0 )
	{
		booksCacheBean.getTopics( cat , popTops)	
	}
	else
	{
		 return false; 
	}
}
function createAnchor( stem , item , text )
{
		var anc = document.createElement("a");
		anc.innerHTML = text;
		anc.target = "_blank";
		anc.href = stem + item.isbn;
		anc.title = item.summary;
	return anc;
}
function popBooks( books )
{
	var booksDiv = $("books");//$("booktab");
	clearAnchors( booksDiv );
	$("bookstitle").style.visibility = "hidden";
	
//	DWRUtil.addRows( "booktab" , books , cellFuncs );

	clearAnchors( booksDiv );
	var x = 0;
	for( var book in books )
	{
	$("bookstitle").style.visibility = "visible";
	book = books[x++];
// span for title , and links
	var span = document.createElement("p");
	span.innerHTML = book.title + "   ";
	span.appendChild(  createAnchor( libraryStem , book , "Borrow" ) );
	booksDiv.appendChild( span );
	if( book.author != null && book.author.length > 0)
	{
		span = document.createElement( "p" );
		span.innerHTML = book.author;
		booksDiv.appendChild( span );
	}
	
	if( book.extrainfo != null && book.extrainfo.length > 0 )
	{
	  span = document.createElement( "p" );
	  span.innerHTML = book.extrainfo;
	  booksDiv.appendChild( span );
  }
	if( book.summary != null && book.summary.length > 0 )
	{
		var p = document.createElement("p");
		p.innerHTML = book.summary;
  	booksDiv.appendChild( p );
  }
//		anc.href = libraryStem + book.isbn;
//		anc.title = book.summary;
//		anc.onmouseover = function (evt) {
//						if (typeof evt == 'undefined') {
//							evt = window.event;
//						}
//							anchorMouseover(this, evt);
//						};
//		anc.addEventListener( "mouseover" , test( anc.id ) , false );
//		booksDiv.appendChild(anc);
		booksDiv.appendChild( document.createElement("hr") );
//		alert(anc.innerHTML);

	}
	
}
function popWebs( webs )
{
	var websDiv = $("webs");
	clearAnchors( websDiv );
	$("webstitle").style.visibility = "hidden";

	if( webs != null && webs != "")
	{
		websDiv.innerHTML = webs;
		$("webstitle").style.visibility = "visible";
	}
//	alert(websDiv.innerHTML);
}
function popDetails( ret )
{
	alert("JSON?");
}
function anchorMouseover( element , evt )
{
//	alert( element.id );
}
function clearAnchors( element )
{
//	alert( element.id + " being cleared of anchoas");
	var tags = element.getElementsByTagName("*");
//	var x = tags.length;
	while( tags.length > 0 )
	{
		element.removeChild( tags[0] );
	}
}
function clearTopics()
{
	var topicsel = $( "topic" );
	topicsel.length = 1;
}
function clearData()
{
	$("bookstitle").style.visibility = "hidden";
	$("webstitle").style.visibility = "hidden";
	clearAnchors( $("books") );
	clearAnchors( $("webs") );
}
//-->