function aclicked(thisAppletId,pathFileName,dirPrefix) {	 
	// use dirPrefix="../" only	when aclicked is called from subfolder/a.htm (say) 
	var newWinName= (self.name=="aWin")?self.name+"aWin":"aWin";
	var newWinProp=	"status=yes,resizable=yes,scrollbars=yes,width=800,height=600";
	var thisApplet = eval("document."+thisAppletId);
	//alert("thisApplet.id="+thisApplet.id+";pathFileName="+pathFileName);
	if (pathFileName=='NormalView' && thisApplet) {  // normal view of htmlFile in ?htmlFile=x
		if (dirPrefix==null) {
			var ix=thisApplet.codeBase.indexOf("/");
			if (ix>0 && dirPrefix==null) dirPrefix=thisApplet.codeBase.substring(0,ix+1);
		}
		pathFileName=thisApplet.getHTMLFile();	// get filename in htmlFile param
		if (dirPrefix) pathFileName=dirPrefix+pathFileName;
	}
	if (pathFileName=="NormalView") { // normal view of AbookReader with no applet/no Java plugin
		window.location="AbookReader/AbookReaderHome.htm";
	}
	else if (pathFileName.substring(0,4)=="http") {
		aWin=window.open(pathFileName,newWinName,
			newWinProp+"toolbar=yes,location=yes,menubar=yes,directories=yes");
		if (aWin) aWin.focus();	//nb: href="mailto:.." results in aWin=null!
	}
	else {
		aWin=window.open(pathFileName,newWinName,
			newWinProp+"toolbar=no, location=no, menubar=no, directories=no");
		if (aWin) aWin.focus();	//nb: href="mailto:.." results in aWin=null!
	}
}

 function parseQueryString(targetName) {
	var targetValue="**ERROR**";
	var urlQueryString=window.location.toString();
	var ix1,ix2;
	ix1=urlQueryString.indexOf(targetName+"=");
	if (ix1>0) {
		ix2=urlQueryString.substring(ix1).indexOf("&");
		if (ix2<0) {
			ix2=urlQueryString.substring(ix1).indexOf("%26");  // '%26' = '&'
		}
		if (ix2<0)	ix2=urlQueryString.length;
		else		ix2=ix1+ix2;
		ix1=ix1+1+targetName.length;
		targetValue=urlQueryString.substring(ix1,ix2);
	}
	return targetValue;
} //parseQueryString


function rightJustStr(str,prefix,nChar) {
	var s1=prefix+str;
	return s1.substring(s1.length-nChar);
}

function formatStr(str) {
	return rightJustStr(str,"00",2);
}

function addCounter(cntString) {
	var divElem = document.createElement('DIV');
	var imgElem = document.createElement('IMG');
	// frontpage hit counter:
	// <img src="_vti_bin/fpcount.exe/count/?Page=vcube222|Image=2" alt="Hit Counter">
	imgElem.src="_vti_bin/fpcount.exe/count/?Page="+cntString+"|Image=2";
	divElem.style.display="none";
	divElem.appendChild(imgElem);
	document.body.appendChild(divElem);
}	


