function NewWindow(mypage, myname, w, h, scroll) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=0'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) 
	{ win.window.focus(); }
}// end NewWindow




function showHideComments() {

var comments = document.getElementById("DivComments");
var link = document.getElementById("lnkShowHideComments");

    if (comments.style.display == "block" || comments.style.display == "") {
            comments.style.display = "none";
            link.innerHTML = "Show comments";
    }
    
    else if (comments.style.display == "none") {
           comments.style.display = "block";
           link.innerHTML = "Hide comments";
         }
}

function commentTotal() {
var comments = document.getElementById("DivComments");
var total = document.getElementById("commentTotal");
    total.innerHTML = "(" + comments.getElementsByTagName("div").length + ")";
}




function showHideNews(id) {

var container = document.getElementById(id);
var containerQuantity = document.getElementById(id).getElementsByTagName("li");
var quantity = document.getElementById(id + "Total");
var link = document.getElementById(id + "Link");

var showMessage = "Show articles";
var hideMessage = "Hide articles";

quantity.innerHTML = "(" + containerQuantity.length + ")";

    if (container.style.display == "block" || container.style.display == "") {
        container.style.display = "none";
        link.innerHTML = showMessage;
    }
    
    else if (container.style.display == "none") {
             container.style.display = "block";
             link.innerHTML = hideMessage;
    }

}

function categoryTotals() {

var ULs = document.getElementsByTagName("UL");
var newsULs = new Array();
var link;
var x = 0;

for(i=0; i<ULs.length;i++) {
    if(ULs[i].className == "news") {
        newsULs[x] = ULs[i];
        x = x + 1;
    }
 }

for(i=0; i<newsULs.length;i++) {
    document.getElementById(newsULs[i]['id'] + "Total").innerHTML = "(" + document.getElementById(newsULs[i]['id']).getElementsByTagName("li").length + ")";
}
 
}

function hideJSError() {
    document.getElementById("JSError").style.display = "none";
}