
ie = (window.navigator.appName.indexOf("Internet Explorer") != -1);

var radioButtons = new Object();
radioButtons.length = 0;


/****************************************************
 * METHOD NAME: initCheckboxRadioButtons            *
 *                                                  *
 * DESCRIPTION: This function initializes the radio *
 *              buttons so that they look like      *
 *              checkboxes. It also assigns the     *
 *              onclick value for each of the radio *
 *              buttons.                            *
 *                                                  *
 * PARAMETERS:  None.                               *
 *                                                  *
 * RETURNS:     None.                               *
 ****************************************************/
function initCheckboxRadioButtons()
{
   var inputs = document.getElementsByTagName("input");

   for(var a = 0; a < inputs.length; a++)
   {
      if(inputs[a].type == "radio")
      {
         var radioName = inputs[a].name;

         if(radioButtons[radioName] == null)
         {
            radioButtons[radioName] = new Array();
            radioButtons[radioName].push(inputs[a]);
            radioButtons.length++;
         }
         else
         {
            radioButtons[radioName].push(inputs[a]);
         }

         var opacity = 0;

         /////////////////////////////////////////
         inputs[a].style.opacity = (opacity / 100);
         inputs[a].style.MozOpacity = (opacity / 100);
         inputs[a].style.KhtmlOpacity = (opacity / 100);
         inputs[a].style.filter = "alpha(opacity=" + opacity + ")";
         if(inputs[a].checked)
            inputs[a].parentNode.style.backgroundPosition = "0px 0px";
         /////////////////////////////////////////


         inputs[a].onclick= function()
         {
            for(var b = 0; b < radioButtons[this.name].length; b++)
            {
               if(radioButtons[this.name][b].checked)
               {
                  radioButtons[this.name][b].parentNode.style.backgroundPosition = "0 0";
               }
               else
               {
                  radioButtons[this.name][b].parentNode.style.backgroundPosition = "0 -27px";
               }
            }
         }
      }
   }
}

// Used to open links in a new window.
// XHTML 1.0 valid.
function newWindowLink(link)
{
   var d = new Date();
   window.open(link.href,"newWindows"+d.getTime());
}


// Used to open links in a new window.
// XHTML 1.0 valid.
function newWindowForm(form)
{
   form.target = "_blank";
}


// Used for the final page of the tool.
// Used to make sure that the information
// entered into the form on the last page
// is included in the PDF if one is
// created.
function updateSessionVars(formElement)
{
   // Create AJAX object
   var myAjax = new Ajax("setSessionVar.php", endSessionUpdate);
   myAjax.returnType = "full";

   // Send AJAX call.
   myAjax.send(formElement.name+"="+encodeURI(formElement.value), "GET");
}

// Null function used to end the AJAX call
function endSessionUpdate(response, status)
{
   return;
}

function initToolTips()
{
   links = document.getElementsByTagName("a");
   
   for(var a = 0, len = links.length; a < len; a++)
   {
      tagText = links[a].innerHTML;
      tipDiv = links[a].href.substr(  links[a].href.indexOf("=") + 1  );

      if((links[a].className.indexOf("toolTip") != -1 || links[a].className.indexOf("tooltip") != -1)
          &&  document.getElementById(tipDiv) )
      {
         if(ie)
         {
            links[a].onclick = function() { return doTips(this); };
         }
         else
            links[a].setAttribute("onclick", "TagToTip('"+tipDiv+"', WIDTH, -300, TITLE, '"+tagText+"'); return false");
         //links[a].attachEvent("onclick", function() { alert('here')} , false);
         //links[a].onclick = ();("onclick", function() { alert('here');TagToTip(tipDiv, WIDTH, -300, TITLE, tagText); alert(tipDiv);return false}  , false);
         
         //links[a].href = "#";
      }
   }
}

function doTips(index)
{

   tagText = index.innerHTML;
   tipDiv = index.href.substr(  index.href.indexOf("=") + 1  );
   TagToTip(tipDiv, WIDTH, -300, TITLE, tagText);
   return false;
   //return false;
}
