/*********************************************************
 *	File:		  clickOnce.js
 *	Author:		Kelvin Chui
 *	Created:	May 21, 2008
 *
 *	Description:
 *	Javascript for disabling link buttons before postback
 ********************************************************/

function disableAnchor(objId, disable) 
{ 
  var obj = document.getElementById(objId); 
  if (obj != null) 
  { 
    if (disable) 
    { 
      var href = obj.getAttribute("href"); 
      var onclick = obj.getAttribute("onclick"); 

      //First we store previous value in a new attribute 
      if(href && href != "" && href != null) 
      { 
        obj.setAttribute('href_bak', href); 
      } 

      if (onclick != null) 
      { 
        obj.setAttribute('onclick_back', onclick); 
        obj.setAttribute('onclick', "void(0);"); 
      } 

      obj.removeAttribute('href'); 
      //obj.style.color="gray"; 
    } 
    else 
    { 
      var hrefBack = obj.getAttribute("href_bak"); 
      var onclickBack = obj.getAttribute("onclick_back"); 
      if(onclickBack != null)
      { 
        obj.setAttribute('onclick', onclickBack); 
        obj.removeAttribute('onclick_back'); 
      } 

      if (hrefBack != null) 
      { 
        obj.setAttribute('href', hrefBack); 
        obj.removeAttribute('href_bak'); 
        //obj.style.color="blue"; 
      } 
    } 
  } 
} 

