// Show/Hide Enlargement for book jacket images
// Version 1.2.18.0; Created 05-Nov-2004; Latest: 05-Nov-2004
// Author: Pete Fairhurst, World Without Walls

// test for Internet Explorer or Netscape via DOM support
var IE = document.all && document.getElementById;
var IE7 = document.documentElement && typeof document.documentElement.style.maxHeight!="undefined";
var NS = document.getElementById && !document.all;

function showViewer(enlURL,enlW,enlH) {
	if (!IE && !NS) {
		// open image in new window for non-compatible browsers
		window.open(enlURL,"","width=enlW,height=enlH,scrollbars=1")
	} else {
		// DOM preperation
		var jV = document.getElementById("jacketViewer"); // containing DIV
		var jL = document.getElementById("jacketLoading"); // Loading message
		var jI = document.getElementById("jacketImage"); // IMG tag
		// position then show the viewer
		jV.style.position = "absolute";
		jV.style.left = "10px";
		jV.style.top = (NS ? window.pageYOffset : (IE7 ? document.documentElement.scrollTop : document.body.scrollTop))-0+"px";
//		jV.style.top = (NS ? window.pageYOffset : document.body.scrollTop)-100+"px";
		jV.style.width = enlW*1+16+"px";
		jV.style.height = enlH*1+16+"px";
		jV.style.display = "block";
		// show the loading message
		jL.style.display = "block";
		// hide the image but load the source
		jI.style.display = "none";
		jI.src = enlURL;
	}
}

function hideLoading() {
	// DOM preperation
	var jL = document.getElementById("jacketLoading"); // Loading message
	var jI = document.getElementById("jacketImage"); // IMG tag
	// hide the loading message
	jL.style.display = "none";
	// show the image
	jI.style.display = "block";
}

function hideViewer() {
	// DOM preperation
	var jV = document.getElementById("jacketViewer"); // containing DIV
	// hide the viewer
	jV.style.display = "none"
}

/* Details that can be expanded */
function initExpand(){
	WWW_showClass('div','short');
	WWW_hideClass('div','full');
	WWW_addEventToClass('div','short','onclick','expand');
}
function findExpandTarget(e){
	var x=WWW_findTarget(e); if(!x) return null;
	while(x!=document.body && !WWW_hasSpecificClass(x,'short'))
		x=x.parentNode;
	if(!WWW_hasSpecificClass(x,'short')) return null;
	else return x;
}
function expand(e){
	var oShort=findExpandTarget(e); if(!oShort) return;
	var i,aSibling=oShort.parentNode.childNodes;
	for(i=0;i<aSibling.length;i++){
		if (WWW_hasSpecificClass(aSibling[i],'full'))
			aSibling[i].style.display='block';
		else if (WWW_hasSpecificClass(aSibling[i],'short'))
			aSibling[i].style.display='none';
	}
}

/* Details that can be collapsed */
function initCollapse(){
	WWW_addEventToClass('div','full','onclick','collapse');
}
function findCollapseTarget(e){
	var x=WWW_findTarget(e); if(!x) return null;
	while(x!=document.body && !WWW_hasSpecificClass(x,'full'))
		x=x.parentNode;
	if(!WWW_hasSpecificClass(x,'full')) return null;
	else return x;
}
function collapse(e){
	var oShort=findCollapseTarget(e); if(!oShort) return;
	var i,aSibling=oShort.parentNode.childNodes;
	for(i=0;i<aSibling.length;i++){
		if (WWW_hasSpecificClass(aSibling[i],'full'))
			aSibling[i].style.display='none';
		else if (WWW_hasSpecificClass(aSibling[i],'short'))
			aSibling[i].style.display='block';
	}
}



function expandAll(){
	WWW_showClass('div','full');
	WWW_hideClass('div','short');
}
function collapseAll(){
	WWW_showClass('div','short');
	WWW_hideClass('div','full');
}
document.WWW.doOnLoad=document.WWW.doOnLoad+"initExpand();initCollapse();";

function showTopics(){
	var oCloud=MM_findObj('tag_cloud');
	var i;
	for(i=0;i<oCloud.childNodes.length;i++){
//		alert(oCloud.childNodes[i]);
		if(oCloud.childNodes[i].tagName=='P'||oCloud.childNodes[i].tagName=='H2'){
			MM_showHideLayers('p_tag_cloud','','show','showtopics','','hide','hidetopics','','show');
		}
	}
}

function hideTopics(){
	var oCloud=MM_findObj('tag_cloud');
	var i;
	for(i=0;i<oCloud.childNodes.length;i++){
//		alert(oCloud.childNodes[i]);
		if(oCloud.childNodes[i].tagName=='P'||oCloud.childNodes[i].tagName=='H2'){
			MM_showHideLayers('p_tag_cloud','','hide','showtopics','','show','hidetopics','','hide');
		}
	}
}





