var commentWin;

function DoClick() {

	var elemId = prompt("Enter an element ID:");
	if (!elemId) return;
	var elem = document.getElementById(elemId);
	if (!elem) {
		alert("Element \"" + elemId + "\" not found.");
		return;
	}
	var styleProp = prompt("Enter a property:");
	if (!styleProp) return;
	if(document.defaultView) {
		alert(document.defaultView.getComputedStyle(elem, '').getPropertyValue(styleProp));
	}
	else if(elem.currentStyle) {
		alert(elem.currentStyle[styleProp]);
	}
}

function ToggleComments(which, linkObj) {

															 // Remove this once Opera plays nicely.
	if (!document.getElementById || (navigator.userAgent.indexOf("Opera")+1)) {
		commentWin = window.open("cgi-bin/comments.cgi?" + which, "comments", "width=350,height=450,resizable=yes,scrollbars=yes");
	}
	else {
		var commentObj = document.getElementById("comments" + which);
		if (!commentObj) return 1;

		if (!commentObj.style.display || commentObj.style.display == "none") {
			var commentDoc;
			if (commentObj.contentDocument) { commentDoc = commentObj.contentDocument; }
			else if (commentObj.contentWindow) { commentDoc = commentObj.contentWindow; }
			else if (commentObj.document) { commentDoc = commentObj.document; }
			else return 2;

			commentDoc.location.replace("http://www.serve.com/apg/cgi-bin/comments.cgi?" + which);
			commentObj.style.display = "block";
			SetLinkText(linkObj, "hide comments");
		}
		else {
			commentObj.style.display = "none";
			SetLinkText(linkObj, "show comments");
		}
		return 0;
	}
}

function SetLinkText(linkObj, newText) {

	if (linkObj.removeChild && linkObj.appendChild && document.createTextNode) {
		linkObj.removeChild(linkObj.firstChild);
		linkObj.appendChild(document.createTextNode(newText));
	}
	else if (linkObj.innerHTML) {
		linkObj.innerHTML = newText;
	}
}

/*
function init() {

	if (document.location.hash) {
		ToggleComments(document.location.hash.substr(5));
	}
}

onload = init;
*/
