//$Id: listrowselection.js,v 1.5.2.1 2004/02/05 13:43:56 prabhukm Exp $
    function Toggle(e,form)
    {
	if (e.checked) {
	    Highlight(e);
	    form.toggleAll.checked = AllChecked(form);
	}
	else {
	    Unhighlight(e);
	    form.toggleAll.checked = false;
	}
    }

    function ToggleAll(e,form)
    {
	if (e.checked) {
	    CheckAll(form);
	}
	else {
	    ClearAll(form);
	}
    }

    function Check(e)
    {
	e.checked = true;
	Highlight(e);
    }

    function Clear(e)
    {
	e.checked = false;
	Unhighlight(e);
    }

    function CheckAll(form)
    {
	var ml = form;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "rowSelection") {
		Check(e);
	    }
	}
	ml.toggleAll.checked = true;
    }

    function ClearAll(form)
    {
	var ml = form;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "rowSelection") {
		Clear(e);
	    }
	}
	ml.toggleAll.checked = false;
    }

    function Highlight(e)
    {
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
	    r = e.parentElement.parentElement;
	}
	if (r) {
        //        r.className = "selectedColor";
        
	    if (r.className == "rowOdd") {
		r.className = "rowOddSelected";
	    }
	    else if (r.className == "rowEven") {
		r.className = "rowEvenSelected";
	    }
        
	}
    }

    function Unhighlight(e)
    {
	var r = null;
	if (e.parentNode && e.parentNode.parentNode) {
	    r = e.parentNode.parentNode;
	}
	else if (e.parentElement && e.parentElement.parentElement) {
	    r = e.parentElement.parentElement;
	}
	if (r) {
        //        r.className = "deselectedColor";
       
	    if (r.className == "rowOddSelected") {
		r.className = "rowOdd";
	    }
	    else if (r.className == "rowEvenSelected") {
		r.className = "rowEven";
	    }
        
	}
    }

    function AllChecked(form)
    {
	ml = form;
	len = ml.elements.length;
	for(var i = 0 ; i < len ; i++) {
	    if (ml.elements[i].name == "rowSelection" && !ml.elements[i].checked) {
		return false;
	    }
	}
	return true;
    }
