//to enable hovers for IE:
function jsHover()  {
    if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) {
        var hEls = document.getElementById("nav").getElementsByTagName("LI");
        for (var i=0, len=hEls.length; i<len; i++) {
            hEls[i].onmouseover=function() { this.className+=" jshover"; }
            hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", "");}
        }
    }
}

//to fix IE6, SELECT and Z-index Problem
function showOrHideAllDropDowns(newState) {
    var elements = document.documentElement.getElementsByTagName('select');
	for (var i=0; i<elements.length; i++) {
    	elements[i].style.visibility = newState;
	}
} 

//to show popup windows:
function openPopup(url, width, height) {
	var wx = (screen.availWidth - width) / 2;
	var wy = (screen.availHeight - height) / 2;
    window.open(
        url + '&popup=1&print=1',
        'popup',
        'width=' + width + ', height=' + height +
        ', status=no, title=no, scrollbars=no, resizable=no, left=' + 
        wx + ', top=' + wy
    );
}

//for AJAX calls:
function getXMLDoc(url) {
    //IE first because of IE7 bug, see jQuery.
    var xmlhttp = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
    if (xmlhttp) {
        xmlhttp.open("GET", url, true);
        xmlhttp.send(null);
    }
} 

function toCurrency(value) {
	var value2 = new Number(value);
	return value2.toFixed(2);
}

var get_element = function(id) {return document.getElementById(id)};