function toggleRow(linkName, rowId){
	row = document.getElementById(rowId);
	var bShow=(row.style.display=="none");
	showItem(rowId,bShow);
	if (bShow) {
		document.getElementById(linkName).innerHTML = "-";
	} else  {
		document.getElementById(linkName).innerHTML = "+";	
	}
}

function showItem(itemId, bShow, linkName){
	var sProperty = bShow ? "" : "none";
	var item=document.getElementById(itemId);
	if (item==null) return;
	item.style.display = sProperty;
	if (linkName) {
		if (bShow) {
			document.getElementById(linkName).innerHTML = "-";
		} else  {
			document.getElementById(linkName).innerHTML = "+";	
		}
	}
}

function showAllTableRows(tableId, bShow) {
	var tbl=document.getElementById(tableId);
	var sProperty = bShow ? "" : "none";
	if (tbl!=null) {
		for (i=0; i<tbl.rows.length; i++) {
			tbl.rows[i].style.display=sProperty;
		}
	}
	
}

function Highlight(sControlName, bHighlight, sColor) {
	if (typeof sColor == "undefined") sColor='#C0C030';
	if (bHighlight) {
		document.getElementById(sControlName).oldColor=document.getElementById(sControlName).style.backgroundColor;
		document.getElementById(sControlName).style.backgroundColor=sColor;
	}else {
		document.getElementById(sControlName).style.backgroundColor=document.getElementById(sControlName).oldColor;
	}
}

function HighlightWithMemory(sControlName, bHighlight, aAllControls, sColor) {
	if (typeof sColor == "undefined") sColor='#C0C030';
	if (typeof document.getElementById(sControlName).oldColor !='undefined' && 
		document.getElementById(sControlName).oldColor!=document.getElementById(sControlName).style.backgroundColor) {
		return;
	}
	if (bHighlight) {
		for (i=0; i<aAllControls.length; i++) {
			if (aAllControls[i]!='') {
				if (aAllControls[i]!=sControlName && typeof document.getElementById(aAllControls[i]).oldColor != 'undefined') {
					document.getElementById(aAllControls[i]).style.backgroundColor = document.getElementById(aAllControls[i]).oldColor;
				}
			}
		}
		document.getElementById(sControlName).oldColor=document.getElementById(sControlName).style.backgroundColor;
		document.getElementById(sControlName).style.backgroundColor=sColor;
	}else {
		document.getElementById(sControlName).style.backgroundColor=document.getElementById(sControlName).oldColor;
	}
}



function outlineTableRow(rowId, borderColor, borderWidth, borderStyle){
    var tableRow = document.getElementById(rowId);
    if (tableRow) {
        var table = tableRow.parentNode;
         while (table.tagName.toLowerCase() != "table") {
             table = table.parentNode;
         }
         table.style.borderCollapse = "collapse";
         var tableCells = tableRow.getElementsByTagName('td');
         if (tableCells.length > 0) {
       
            for (i = 0; i < tableCells.length; i++) {
                if (i == 0) {
                    tableCells[i].style.borderLeftColor = borderColor;
                    tableCells[i].style.borderLeftStyle = borderStyle;
                    tableCells[i].style.borderLeftWidth = borderWidth;
                }
                else
                    if (i == tableCells.length - 1) {
                        tableCells[i].style.borderRightColor = borderColor;
                        tableCells[i].style.borderRightStyle = borderStyle;
                        tableCells[i].style.borderRightWidth = borderWidth;
                    }
                tableCells[i].style.borderTopColor = borderColor;
                tableCells[i].style.borderTopStyle = borderStyle;
                tableCells[i].style.borderTopWidth = borderWidth;
                tableCells[i].style.borderBottomColor = borderColor;
                tableCells[i].style.borderBottomStyle = borderStyle;
                tableCells[i].style.borderBottomWidth = borderWidth;
               
            }
        }
    }
}
   
