function changeBckg (o) {

	for (i=0;box=document.getElementsByTagName("div")[i];i++) {
		if (box.className == 'inputRowActive')
			box.className = 'inputRow';
		
		if ((box.className == 'inputDescription') || (box.className == 'inputDescriptionBottom'))
			box.style.display = 'none';
	}
	
	o.parentNode.parentNode.className = 'inputRowActive';
	
	for (i=0;box=o.parentNode.parentNode.childNodes[i];i++)
		if ((box.className == 'inputDescription') || (box.className == 'inputDescriptionBottom'))
			box.style.display = 'block';

}

function updateDiscountType(o) {
	if (o.options[o.selectedIndex].value == 'AMOUNT') {
		document.getElementById('discountPercent').style.display = 'none';
		document.getElementById('discountValue').style.display = 'block';
	}

	if (o.options[o.selectedIndex].value == 'PERCENT') {
		document.getElementById('discountValue').style.display = 'none';
		document.getElementById('discountPercent').style.display = 'block';
	}
}

function highlightTableRows(tableId) {
    var previousClass = null;
    var table = document.getElementById(tableId); 
    var tbody = table.getElementsByTagName("tbody")[0];
    var rows = tbody.getElementsByTagName("tr");
    // add event handlers so rows light up and are clickable
    for (i=0; i < rows.length; i++) {
        rows[i].onmouseover = function() { previousClass=this.className;this.className+=' over' };
        rows[i].onmouseout = function() { this.className=previousClass };
        rows[i].onclick = function() {
            var cell = this.getElementsByTagName("td")[1];
            if (cell.getElementsByTagName("a").length > 0) {
                var link = cell.getElementsByTagName("a")[0];
                if (link.onclick) {
                    call = link.getAttributeValue("onclick");
                    // this will not work for links with onclick handlers that return false
                    eval(call);
                } else {
                    location.href = link.getAttribute("href");
                }
                this.style.cursor="wait";
            }
        }
    }
}

function searchSubmit() {
	if (document.getElementById('search').value.length == 0)
		return false;
}


function generateMailLink(to, server) {
	document.write('<a href="mailto:' + to + '@' + server + '">' + to + '@' + server + '</a>');
}