	var hgt = 0, wid = 0; bodyid = "contentdiv"; navid = "spacerdiv"; divoffset = 120; winContent=null; infoContent=null;
    var fabricName = "";
	
	function sizeDiv() {
		bodyTarget = eval(getDocObj(bodyid));
		navTarget = eval(getDocObj(navid));

		hgt = getBodyHeight();
		bThgt = hgt - divoffset - 25; // space up from bottom of page
		if (bThgt < 300) {
			bThgt = 300;
		}
		bodyTarget.style.height = bThgt;

//		nThgt = bThgt - 242 - 15; // align nav length with body length
//		nThgt = bThgt - 242 - 30; // align nav length with body length
		nThgt = bThgt - 242 - 50; // align nav length with body length
		if (nThgt < 14) {
			nThgt = 14;
		}

//		var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
//        var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
//        alert(sPage);

		navTarget.style.height = nThgt;
//		alert("nth="+nThgt+";bth="+bThgt);
		window.onresize = sizeDiv;
	}

	function getBodyWidth() {
		if (parseInt (navigator.appVersion) > 3) {
			if (navigator.appName == "Netscape") {
				siz = window.innerWidth - 16;
			} else {
				siz = document.body.offsetWidth - 20;
			}
		}
		return siz;
	}

	function getBodyHeight() {
		if (parseInt (navigator.appVersion) > 3) {
			if (navigator.appName == "Netscape") {
				siz = window.innerHeight - 16;
			} else {
				siz = document.body.offsetHeight - 20;
			}
		}
		return siz;
	}

	function getDocObj(elem,parent) {
		if (document.layers) {
			if (parent) {
				return "document."+parent+".document."+elem;
			} else {
				return "document."+elem;
			}
		} else if (document.all) {
			return "document.all."+ elem;
		} else if (document.getElementById) {
			return "document.getElementById('"+elem+"')";
		}
	}

	function newWin(newContent, targetId, height, width) {
	    if (winContent != null) {winContent.close()}
		winAttr = 'right=0, top=0, width=' + width + ', height=' + height + ', toolbar=no,scrollbars=yes,resizable=yes';
		winContent = window.open(newContent,targetId,winAttr);
		if (window.focus) {winContent.focus();}
		// test
	}

	function newWin2(itemID, height, width) {
		itemThumb = eval(getDocObj(itemID+"thumb"));
		itemDesc  = eval(getDocObj(itemID+"desc"));
		itemDescText = itemDesc.innerHTML;
		itemThumbName = itemThumb.src;

	    if (winContent != null) {winContent.close()}
		winAttr = 'right=0, top=0, width=' + width + ', height=' + height + ', toolbar=no, scrollbars=yes, resizable=yes, menubar=no';
		winContent = window.open("detail.php?thumb="+itemThumbName+"&desc="+itemDescText,itemID,winAttr);
		if (window.focus) {winContent.focus();}
	}

	function newWin3(thumbID,descID, height, width) {
		itemThumb = eval(getDocObj(thumbID));
		itemDesc  = eval(getDocObj(descID));
		itemDescText = itemDesc.innerHTML;
		itemThumbName = itemThumb.src;
		pageTitle = document.title;

		thumb = eval(getDocObj(thumbID));
		thumbAlt = thumb.getAttribute("alt")
		thumbText = thumbAlt.substring(0,thumbAlt.lastIndexOf("Click")-1);
//		alert(thumbText);

	    if (winContent != null) {winContent.close()}
		winAttr = 'right=0, top=0, width=' + width + ', height=' + height + ', toolbar=no, scrollbars=yes, resizable=yes, menubar=no';
		winContent = window.open("detail2.php?thumb="+itemThumbName+"&desc="+escape(itemDescText)+"&alt="+escape(thumbText)+"&title="+escape(document.title),'detail',winAttr);
		if (window.focus) {winContent.focus();}
	}

	function newWin4(imageName,descID, height, width) {
		itemDesc  = eval(getDocObj(descID));
		itemDescText = itemDesc.innerHTML;
		pageTitle = document.title;

	    if (winContent != null) {winContent.close()}
		winAttr = 'right=0, top=0, width=' + width + ', height=' + height + ', toolbar=no, scrollbars=yes, resizable=yes, menubar=no';
		winContent = window.open("detail2.php?thumb="+imageName+"&desc="+escape(itemDescText)+"&title="+escape(document.title),'detail',winAttr);
		if (window.focus) {winContent.focus();}
	}

	function infoopen(page,descID) {
	    if (descID == "") {
		    descID = fabricName;
		}
//		  winAttr = 'right='+event.screenX+', top='+event.screenY+', width=' + 2 + ', height=' + 2 + ', toolbar=no, scrollbars=no, resizable=yes, menubar=no';
		winAttr = 'right='+'0'+', top='+'0'+', width=' + '400' + ', height=' + '250' + ', toolbar=no, scrollbars=no, resizable=yes, menubar=no';
		infoContent = window.open("info.php?page="+page+"&descID="+descID+"&title="+descID,'info',winAttr);
		if (window.focus) {infoContent.focus();}
	}

	function infoopen2(page) {
	    descID = fabricName;
//		  winAttr = 'right='+event.screenX+', top='+event.screenY+', width=' + 2 + ', height=' + 2 + ', toolbar=no, scrollbars=no, resizable=yes, menubar=no';
		winAttr = 'right='+'0'+', top='+'0'+', width=' + '400' + ', height=' + '250' + ', toolbar=no, scrollbars=no, resizable=yes, menubar=no';
		infoContent = window.open("info.php?page="+page+"&descID="+descID+"&title="+descID,'info',winAttr);
		if (window.focus) {infoContent.focus();}
	}

	function infoclose() {
		 if (infoContent != null) {infoContent.close()}
	}

	function myInnerText(obj) {
		 myHtml = obj.innerHTML;
		 myText = myHtml.replace(/(<([^>]+)>)/ig,"");
		 fabricName = myText;
		 return myText;
	}

	var mObj;
	var cX, cY;
    if (document.layers) {
       document.captureEvents(Event.MOUSEMOVE);
	   document.onmousemove = mm1;
    } else if (document.all) {
    	document.onmousemove = mm2;
	} else if (document.getElementById) {
		document.onmousemove = mm3;
	}

	function mm1(e) {
		cX = e.pageX;
		cY = e.pageY;
	}
	
	function mm2(e) {
		cX = event.clientX;
		cY = event.clientY;
	}

	function mm3(e) {
		cX = e.clientX;
		cY = e.clientY;
	}

	function tipDisplay (thumbID) {
	    mObj = eval(getDocObj("itemTip"));
//if (mObj) {
//	alert("got itemTip");
//} else {
//	alert("Failed itemTip");
//}
		tipPosition();
		thumb = eval(getDocObj(thumbID));
		thumbAlt = thumb.getAttribute("alt")
//alert(thumbAlt);
//		thumbText = thumbAlt.substring(0,thumbAlt.lastIndexOf("Click")-1);
//		tObj = eval(getDocObj("tipText"));
		mObj.innerHTML = "<table width=\"100%\" height=\"100%\"><tr><td align=\"center\" valign=\"middle\" name=\"tipText\" id=\"tipText\">"+thumbAlt+"</td></tr></table>";
//		mObj.innerHTML = thumbAlt;
		mObj.className = "itemTip";
	}

	function tipPosition (e) {
		if (document.layers) {
	    	mObj.left = cX;
	    	mObj.top = cY - mObj.scrollTop;
//	    	mObj.left = e.pageX + document.body.scrollLeft + mObj.scrollLeft;
//	    	mObj.top = e.pageY + document.body.scrollTop + mObj.scrollTop;
//alert("mObj.left="+mObj.left+" mObj.top="+mObj.top);
		} else if (document.all) {
	    	mObj.style.posLeft = cX;
	 		mObj.style.posTop = cY - mObj.scrollTop;
//	    	mObj.style.posLeft = event.clientX + document.body.scrollLeft + mObj.scrollLeft;
//	 		mObj.style.posTop = event.clientY + document.body.scrollTop + mObj.scrollTop;
//alert("mObj.style.posLeft="+mObj.style.posLeft+" mObj.style.posTop="+mObj.style.posTop+"\nd.b.sl="+document.body.scrollLeft+" d.b.st="+document.body.scrollTop+"\nObj.sl="+mObj.scrollLeft+" Obj.st="+mObj.scrollTop);
		} else if (document.getElementById) {
			mObj.style.left = cX + 'px';
			mObj.style.top = cY - mObj.scrollTop + 'px';
//			mObj.style.left = e.clientX + document.body.scrollLeft + mObj.scrollLeft +'px';
//			mObj.style.top = e.clientY + document.body.scrollTop + mObj.scrollTop + 'px';
//alert("mObj.style.left="+mObj.style.left+" mObj.style.top="+mObj.style.top);
		}
	}

	function tipHide () {
	    mObj = eval(getDocObj("itemTip"));
		mObj.className = "hide";
//		mObj.innerHTML = "dummy";
//		tObj = eval(getDocObj("tipText"));
		mObj.innerHTML = "";
	}
