// JavaScript Document
var siteWidth = 900;
function getWidth() {
	var n_win = window.innerWidth ? window.innerWidth : 0;
	var n_docel = document.documentElement ? document.documentElement.clientWidth : 0;
	var n_body = document.body ? document.body.clientWidth : 0;
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	var currentWidth = n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	if(currentWidth < siteWidth)
		return siteWidth;
	else
		return currentWidth;
}
var old_index = 0;
var timeout_id;
function clear_timeouts() {
	if(document.getElementById) {
		if(timeout_id != null)
			self.clearTimeout(timeout_id);
	}
}
function popupon(index, leftPx) {
	if(document.getElementById) {
		clear_timeouts();
		if(old_index != 0) {
			if(document.getElementById(old_index + "Sub"))
				document.getElementById(old_index + "Sub").style.display = "none";
		}
		if(document.getElementById(index + "Sub")) {
                        myobj = document.getElementById(index + "Sub");
			myobj.style.top = 166;
                        newPos = new String(((getWidth() - siteWidth) / 2) + leftPx) + 'px';
			myobj.style.left = newPos;
			myobj.style.display = "inline";
		}
		old_index = index;
	}
}
function popupoff() {
	if(document.getElementById) {
		if(old_index != 0)
			timeout_id = setTimeout("if(document.getElementById(old_index + 'Sub'))document.getElementById(old_index + 'Sub').style.display = 'none';", 200);
	}
}
function toggleComments(entryID) {
	if(document.getElementById("comment" + entryID).style.display == "none") {
		document.getElementById("comment" + entryID).style.display = "inline";
		document.getElementById("textshow" + entryID).style.display = "none";
		document.getElementById("texthide" + entryID).style.display = "inline";
	}
	else {
		document.getElementById("comment" + entryID).style.display = "none";
		document.getElementById("textshow" + entryID).style.display = "inline";
		document.getElementById("texthide" + entryID).style.display = "none";
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function textCounter(field, countfield, maxlimit) {
     if (field.value.length > maxlimit) {
         field.value = field.value.substring(0, maxlimit);
     } else {
         countfield.value = maxlimit - field.value.length;
    }
}
