$(document).ready(function(){

	/* hack to determine if author links exist--could do this in ektron code-behind */
	var links = $(".author_link")	
	var tempURL = "http://www.focalpress.com/authors/";
	var finalURL = "";
	
	if(links.length > 0)
	{
	    links.each(function(i){
	    	var authorLink = $(this).text();
	    	authorLink = authorLink.replace(/ /g,"_");
	    	authorLink = authorLink.toLowerCase();
	        finalURL = tempURL + authorLink + ".aspx";
	        var tmpp = $(this);
	        $("#dontshowme").load(finalURL + " #nogo", function(){
	        
	         if ($(this).find('span').length == 0){	     
	               if($.browser.msie)
	               {
	               tmpp.html('<a href="/authors/'+authorLink+'.aspx">'+tmpp.text()+'</a>');
	               }
	               else
	               {
	               tmpp.wrapInner('<a href="/authors/'+authorLink+'.aspx">');	                
	               }
	               
	                
	            }	         
	        });  
	    });	
	}	


    var stuff = $('#related-stuff > div:not(.fixedshadowbox), #related-stuff > span');    
    var target = $('.book .bookinfo');
    if (stuff.find('table').length > 0)
    {
        target.append("<br /><br /><hr style='width:95%;border:none;border-top:1px solid #666;' />");
        target.append(stuff);
    }
    
	$("#forcetable").treeview({
		persist: "location",
		collapsed: true,
		unique: true
	});
	

	
});
