function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block' || e.style.display =='')
          e.style.display = 'none';
       else
          e.style.display = 'block';
}


function toggle(){
	var fadeDiv = document.getElementById('fadeDiv');
	if (fadeDiv.style.display == 'none') {
		fadeIn('fadeDiv');
	} else {
		fadeOut('fadeDiv');
	}
}


function Fader(el, fadeIn)
      {
        var me = this;
        this.el = (typeof(el) == "object")?el:(typeof(el) == "string")?document.getElementById(el):null;
        this.fadeIn = fadeIn;
        this.doFade = doFade;
        this.setOpacity = setOpacity;
        this.showElement = showElement;
        this.opacity = 0;
        
        this.doFade();
        
        function setOpacity()
        {
          if (typeof(this.el.style.opacity) != null) this.el.style.opacity = this.opacity / 100;
          if (typeof(this.el.style.filter) != null) this.el.style.filter = "alpha(opacity=" + this.opacity + ")";
          this.opacity += (this.fadeIn)?1:-1;
        }
        
        function showElement(show)
        {
          if (this.el && this.el.style) this.el.style.display = (show)?"block":(this.fadeIn)?"block":"none";
        }
        
        function doFade()
        {
                                   
          this.showElement(true);
          if (this.fadeIn)
          {
            this.opacity = 0;
            this.setOpacity();
            
            for (var i=0; i<=100; i++)
            {
              var newFunc = function() { me.setOpacity(); };
              setTimeout(newFunc, 8*i);
            }
          }
          else
          {
            this.opacity = 100;
            this.setOpacity();
            
            for (var i=0; i<=100; i++)
            {
              var newFunc = function() { me.setOpacity(); };
              setTimeout(newFunc, 8*i);
            }
          }
          
          var newFunc = function () { me.showElement(); };
          
          setTimeout(newFunc, 810);
        }
      }

      function fade(obj, fadeIn)
      {
        if (obj) new Fader(obj, fadeIn);
      }
      
      function fadeIn(objID)
      {
        fade(objID, true);
      }
      
      function fadeOut(objID)
      {
        fade(objID, false);
      }



























//  The functions have been adapted from various sources
//  and re-written to provide maximum flexibility
//  and compatability with various browsers.

//Global Declarations
var ie = (document.all) ? true : false;

function toggleClass(objClass){
//  This function will toggle obj visibility of an Element
//  based on Element's Class
//  Works with IE and Mozilla based browsers

  if (getElementByClass(objClass).style.display=="none"){
    showClass(objClass)
  }else{
    hideClass(objClass)
  }
}

function hideClass(objClass){
//  This function will hide Elements by object Class
//  Works with IE and Mozilla based browsers

var elements = (ie) ? document.all : document.getElementsByTagName('*');
  for (i=0; i<elements.length; i++){
    if (elements[i].className==objClass){
      elements[i].style.display="none"
    }
  }
}

function showClass(objClass){
//  This function will show Elements by object Class
//  Works with IE and Mozilla based browsers
var elements = (ie) ? document.all : document.getElementsByTagName('*');
  for (i=0; i<elements.length; i++){
    if (elements[i].className==objClass){
      elements[i].style.display="block"
    }
  }
}

function toggleID(objID){
//  This function will toggle obj visibility of an Element
//  based on Element's ID
//  Works with IE and Mozilla based browsers
var element = (ie) ? document.all(objID) : document.getElementById(objID);
  if (element.style.display=="none"){
    showID(objID)
  }else{
    hideID(objID)
  }
}

function hideID(objID){
//  This function will hide Elements by object ID
//  Works with IE and Mozilla based browsers
var element = (ie) ? document.all(objID) : document.getElementById(objID);
  element.style.display="none"
}

function showID(objID){
//  This function will show Elements by object ID
//  Works with IE and Mozilla based browsers
var element = (ie) ? document.all(objID) : document.getElementById(objID);
  element.style.display="block"
}

function getElementByClass(objClass){
//  This function is similar to 'getElementByID' since there
//  is no inherent function to get an element by it's class
//  Works with IE and Mozilla based browsers
var elements = (ie) ? document.all : document.getElementsByTagName('*');
  for (i=0; i<elements.length; i++){
    //alert(elements[i].className)
    //alert(objClass)
    if (elements[i].className==objClass){
    return elements[i]
    }
  }
}

