﻿// JScript File
function findTop(obj) {//esta funcion devuelve la coordenada vertical real con respecto a la pagina y no al parent de un control
	
	var curtop = 0;
	if (obj.offsetParent) {
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curtop += obj.offsetTop
		}
	}
		
	return curtop;
}
function showHelp(page)
{ 
   var iHeight = screen.height;
   var iLeft = 0;
   var iTop = 0;
   var param2 = 'toolbar=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=1, width=1190, height=' + iHeight;
   var url = "";
   if(page == "c_administrator_users.aspx")
   {
     url = "../../Help_English_Ajax/"+page+"?open=adm";
   } 
   if(page == "c_login.aspx")
   {
     url = "../Help_English_Ajax/c_login.aspx?open=login";
   } 
   if(page == "c_search.aspx")
   {
     url = "../Help_English_Ajax/c_login.aspx?open=search";
   } 
   mywindowMessages = window.open(url);
   mywindowMessages.moveTo(0,0);
   event.returnValue = false;
}
var currentColor = "";
var lastRowObj = "";
var lastRowColor = "";
function paintRow(idRow, eventType)
  {
       if((eventType == 'onmouseout') && (currentColor != "#ccffff"))
       {
         paintRowCells(idRow, currentColor);
         document.getElementById(idRow).style.cursor="hand";
       }
       if((eventType == 'onmouseover') && (document.getElementById(idRow).style.background != "#ccffff"))
       {
         currentColor = document.getElementById(idRow).cells[1].style.backgroundColor;
         paintRowCells(idRow, '#ccffff');
       }
  }
  function paintOnClick(obj)
  {
          if(typeof(lastRowObj) == 'object')
          {
            paintRowCells(lastRowObj.id, lastRowColor);
          }
          lastRowObj = obj;
          if(currentColor != '#cccccc')
          {lastRowColor = currentColor;}
          paintRowCells(obj.id, '#cccccc');
          currentColor = "#cccccc";
          hiddendiv("ie5menu");
  }
  function paintRowCells(idRow, color)
  {
    var noCells = document.getElementById(idRow).cells.length;
    for (var j = 0; j < noCells; j++)
	 {
	   document.getElementById(idRow).cells[j].style.background = color;
	 }
  }
  function paintRowsWhite(obj)
  {
      var theBody = obj.parentNode;
      var theTable = document.getElementById(theBody.parentNode.id);
      for (var j = 1; j < theTable.rows.length ; j++)
	  {
	    theTable.rows[j].style.background = "#FFFFFF";
	  }
  }
  function paintAllWhite()
  {
     for (var j = 0; j < document.getElementById("Grid_Exams").rows.length -1; j++)
	 {
	   document.getElementById("row"+j).style.background = "#ffffff";
	 }
  }
  function hiddendiv(divObj)
{
  document.getElementById(divObj).style.visibility = "hidden";
  CloseDialog();
}
String.prototype.rtrim = function() 
{
	return this.replace(/\s+$/,"");
}
