//code get the x and y of an object
var oCoor = {
   //get the x-coor by calculating the offsetLeft of it's parents.
   getLeft: function(o)
   {
     var left = 0;
      while(eval(o))
      {
         left += o.offsetLeft;
         o = o.offsetParent;
      }
      return left;
   },
   //get the y-coor by calculating the offsetTop of it's parents.
   getTop: function(o)
   {
      var top = 0;
      while(eval(o))
      {
         top += o.offsetTop;
         o = o.offsetParent;
      }
      return top;
   }
}

//=======================================================
//detect browser settings for showing and hiding DIVs    
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;
//=======================================================

function SwitchDiv(strDivName,bolVisible)
{
   //identify the element based on browser type
   if (isNS4)
   {
      objElement = document.layers[strDivName];
   }
   else if (isIE4)
   {
      objElement = document.all[strDivName].style;
   }
   else if (isIE5 || isNS6)
   {
      objElement = document.getElementById(strDivName).style;
   }
   
   if (isNS4)
   {
      if(!bolVisible)
      {
         objElement.visibility ="hidden"
      }
      else
      {
         objElement.visibility ="visible"
      }
   }
   else if (isIE4 || isIE5 || isNS6)
   {
      if(!bolVisible)
      {
         objElement.visibility = "hidden";
      }
      else
      {
         objElement.visibility = "visible";
      }
   }
   
   return objElement;
}

function openWebDialog(URL, dwidth, dheight, dname)
{
   var leftpos = (self.screen.width / 2) - (dwidth / 2);
   var toppos = (self.screen.height / 2) - (dheight / 2);
   //if (isIE5) window.showModalDialog(URL,dname,'dialogHeight:'+dheight+'px; dialogWidth:'+dwidth+'px; resizable:yes; status:no');
   //if (isNS6)
   window.open(URL,dname,'status=no,modal=yes,width='+dwidth+',height='+dheight+',left='+leftpos+',top='+toppos+'');
   
   /*return false;*/
}

function DeleteConfirmation()
{
   return window.confirm("You are about to delete this item.\nAre you sure?");
}