//Requires browser_detect.js

//GET ELEMENT PROPERTY

//Get an element's style property. Supply two string parameters: The element's id and the property to get.

function GetElementProperty(id,prop)
{
   if (browser_ie5up)
   {
      return eval(id + '.style.' + prop);
   }
   else if (browser_ns6up)
   {
      return eval ('document.getElementById(id).style.' + prop);
   }
   else if (browser_firefox1up)
   {
      return eval(id + '.style.' + prop);
   }
   else if (browser_opera8up)
   {
      return eval(id + '.style.' + prop);
   }
   else if (document.getElementById && !document.all)
   {
      return eval ('document.getElementById(id).style.' + prop);
   }
   else 
   {
      return eval(id + '.style.' + prop);
   }
}

//GET ELEMENT CURRENT PROPERTY

//Gets an element's cascaded style value. Similar to GetElementProperty(), but it works with elements defined in external style sheets.
//Supply three string parameters: The element's id, the javascript property name (e.g., backgroundColor) and the css property name (e.g., background-color) of the property to get.

function GetElementCurrentProperty (id, jsPropertyName, cssPropertyName)
{
   var element = document.getElementById(id);

   if (browser_ie5up)
   {
      return element.currentStyle[jsPropertyName];
   }
   else if (browser_ns6up)
   {
      var elementStyle=window.getComputedStyle(element, "");
      return elementStyle.getPropertyValue(cssPropertyName);      
   }
   else if (browser_firefox1up)
   {
      var elementStyle=window.getComputedStyle(element, "");
      return elementStyle.getPropertyValue(cssPropertyName); 
   }
   else if (browser_opera8up)
   {
      var elementStyle=window.getComputedStyle(element, "");
      return elementStyle.getPropertyValue(cssPropertyName);  
   }
   else if (document.getElementById && !document.all)
   {
      var elementStyle=window.getComputedStyle(element, "");
      return elementStyle.getPropertyValue(cssPropertyName);
   }
   else 
   {
      return element.currentStyle[jsPropertyName];
   }
}

//SET ELEMENT PROPERTY

//Set an element's style property. Supply three string parameters: The element's id, the property to set and the value of the property.

function SetElementProperty(id,prop,value)
{
   if (browser_ie5up)
   {
      eval(id + '.style.' + prop + ' = "' + value + '"');
   }
   else if (browser_ns6up)
   {
      eval ('document.getElementById(id).style.' + prop + ' = "' + value + '"');
   }
   else if (browser_firefox1up)
   {
      eval(id + '.style.' + prop + ' = "' + value + '"');
   }
   else if (browser_opera8up)
   {
      eval(id + '.style.' + prop + ' = "' + value + '"');
   }
   else if (document.getElementById && !document.all)
   {
      eval ('document.getElementById(id).style.' + prop + ' = "' + value + '"');
   }
   else 
   {
      eval(id + '.style.' + prop + ' = "' + value + '"');
   }
}

//////////////////////////////////////////////////////////////////////////////////////////////

//Functions to set specific styles.

//////////////////////////////////////////////////////////////////////////////////////////////

//SET ELEMENT VISIBILTY

//Set an element's visibility. Supply two parameters: The element's id and a boolean value (0 to hide, 1 to show).

function SetElementVisibility(id, visible)
{
   var value = visible?'visible':'hidden';

   SetElementProperty(id,'visibility',value);
}