 function miniwindow(target,nameofwindow,height,width,status,left,top)
  {
    window.open(target,nameofwindow,'location=0,toolbar=0,directories=0,status='+status+',menubar=0,scrollbars=0,resizable=1,width='+width+',height='+height+',left='+left+',top='+top+'');
  }

  function Toggle(e)
    {
	if (e.checked) {
	    Highlight(e);
	    document.myform.toggleAll.checked = AllChecked();
	}
	else {
	    Unhighlight(e);
	    document.myform.toggleAll.checked = false;
	}
    }
  function o(e)
  {
     window.open(e,'studentinfo','location=0,toolbar=0,directoris=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=450');
  }
  function miniwindow(target,nameofwindow,height,width,status,left,top)
  {
    window.open(target,nameofwindow,'location=0,toolbar=0,directoris=0,status='+status+',menubar=0,scrollbars=1,resizable=1,width='+width+',height='+height+',left='+left+',top='+top+'');
  }
  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) {
         var c = null;
            //r.style.backgroundColor = "RED";
            //r.setAttribute('bgcolor', '#000000', 0);
            var theCells = r.cells;
            var rowCellsCnt  = theCells.length;

            r.className = "ones";
             /*for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = "#D6E7EF";
                }
              */
              for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', '#D6E7EF', 0);
            } // end for



	}
    }

    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) {
            var c = null;
            var theCells = r.cells;
            var rowCellsCnt  = theCells.length;
            r.className = "one";

/*             for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = "#fff7e5";
                    }*/
              for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', '#fff7e5', 0);
            } // end for

          //r.style.backgroundColor = "#FFFFFF";
         }
    }









var marked_row = new Array();


function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;
    var check = null;
   //  var check = document.ddd.check[0].checked;
   if(document.myform != null)
      var check = document.myform.select_student[theRowNum];

    // alert(check);
    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3


 ///   alert("Current Color = "+currentColor);
 //   alert("Pointer Color = "+thePointerColor);
  //  alert("Default Color = "+theDefaultColor);
    // 4. Defines the new color
    // 4.1 Current color is the default one
//theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor

    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase() || currentColor.toLowerCase() == "#d6e7ef")
        {
        if (theAction == 'over' && thePointerColor != '') {

            newColor  = thePointerColor;
      //      alert("newColor ="+newColor);
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
     && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum]))
             {
        if (theAction == 'out') {
         //   alert(document.myform.select_student[theRowNum].checked);
              newColor  = theDefaultColor;
             if(check != null && document.myform.select_student[theRowNum].checked == true)
                 newColor = '#D6E7EF';
             if(check != null && document.myform.select_student[theRowNum].checked == false)
                 newColor = '#fff7e5';
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;

        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4



    // 5. Sets the new color...

//ky



//domDetect = false;
    if (newColor) {
 //      alert(newColor);
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
         // alert("newColor in domDetect="+newColor);
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
            //alert("newColor in other="+newColor);
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function



function setPointer1(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;
  //  var check = null;
   //  var check = document.ddd.check[0].checked;
//   if(document.myform != null)
  //    var check = document.myform.select_student[theRowNum];

    // alert(check);
    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3


 ///   alert("Current Color = "+currentColor);
 //   alert("Pointer Color = "+thePointerColor);
  //  alert("Default Color = "+theDefaultColor);
    // 4. Defines the new color
    // 4.1 Current color is the default one
//theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor

    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase() || currentColor.toLowerCase() == "#d6e7ef")
        {
        if (theAction == 'over' && thePointerColor != '') {

            newColor  = thePointerColor;
      //      alert("newColor ="+newColor);
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
     && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum]))
             {
        if (theAction == 'out') {
         //   alert(document.myform.select_student[theRowNum].checked);
              newColor  = theDefaultColor;
          
           //  if(check != null && document.myform.select_student[theRowNum].checked == true)
            //     newColor = '#D6E7EF';
            // if(check != null && document.myform.select_student[theRowNum].checked == false)
              //   newColor = '#fff7e5';
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;

        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4



    // 5. Sets the new color...

//ky



//domDetect = false;
    if (newColor) {
 //      alert(newColor);
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
         // alert("newColor in domDetect="+newColor);
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
            //alert("newColor in other="+newColor);
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer1()' function









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

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

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

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

    function ClearAll()
    {
	var ml = document.myform;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "select_student") {
		Clear(e);
	    }
	}
	ml.toggleAll.checked = false;
    }
  function AllChecked()
    {
	var ml = document.myform;
	var len = ml.elements.length;
	for(var i = 0 ; i < len ; i++) {
	    if (ml.elements[i].name == "select_student" && !ml.elements[i].checked) {
		return false;
	    }
	}
	return true;
    }
