var printMenuStr = '<a href="javascript:print();">print this page</a> | <a href="javascript:close();">close this window</a>';

function removeAnchors() {
	ah = document.getElementsByTagName("A");
	var pNodes = new Array();
	var strArray = new Array();
	var urlArray = new Array();
	
	for(var i=0;i<ah.length;i++) { 
		if(ah[i].tagName) {
			pNodes.push(ah[i].parentNode);	
			strArray.push(ah[i].innerHTML);
			urlArray.push(ah[i].getAttribute('href'));
		}
	}


	for(i=0;i<pNodes.length;i++) { 
		testStr = pNodes[i].innerHTML.toLowerCase();
		fChk = testStr.indexOf("<a");
		sChk = testStr.indexOf("</a>");
		if(fChk!=-1 && sChk!=-1) {
		
			newStr1 = pNodes[i].innerHTML.substr(0,fChk);
			newStr2 = pNodes[i].innerHTML.substr(sChk+4,pNodes[i].innerHTML.length);
			if(urlArray[i].indexOf("javascript:")==-1 && urlArray[i].indexOf("?content=")==-1 && urlArray[i].indexOf("mailto:")==-1) {
			replaceStr = newStr1 + strArray[i] + " &lt;" + urlArray[i] + "&gt;" + newStr2;
			} else {
			replaceStr = newStr1 + strArray[i] + newStr2;
			}
			// replace the innerHTML
			pNodes[i].innerHTML = replaceStr;	
		}

	} 

	tObj = document.getElementById('print_menu');
	if(tObj) tObj.innerHTML = printMenuStr;

}

var showDateShort = 1;
var showDate= 2;
var showDateTime= 3;
var showTime= 4;

function ShowDateTime(dateStyle)
{ 
	var today = new Date();
	var dStr = "";
	
	switch (dateStyle)
	{
		case showDateShort:
			dStr = today.toDateString();
			break;
		case showDateTime:
			dStr = today.toLocaleString();
			break;
		case showTime:
			dStr = today.toLocaleTimeString();
			break;
		case showDate:
		default:
			dStr = today.toLocaleDateString();
			break;
	}
	document.write(dStr);
}

function ShowURL() {
	if(window.opener) { 
		document.write(window.opener.location.href);
	} else {
		// parse location to find current item
		loc=window.location.href;

		if(loc.lastIndexOf('?content')==-1) return;
		cont = loc.substr(loc.lastIndexOf('?content')+1,loc.length);
		// strip off any php parameters
		while(cont.lastIndexOf('?')!=-1) {
			cont = cont.substr(0,cont.lastIndexOf('?'));
		}
		while(cont.lastIndexOf('&')!=-1) {
			cont = cont.substr(0,cont.lastIndexOf('&'));
		}	
		loc2 = window.location.href;
		loc2 = loc2.substr(0,loc2.lastIndexOf('/')+1);
	
		document.write(loc2+'clt.php?'+cont);
	}
}