// Object you want to affect: TR or TD
var element_type = "TR"; 

function ts_animations_tableSort()
{
  // For tableSort used in class_table_sort php class

  // function designed by Jonathan Fenocchi
  // http://www.webreference.com/programming/javascript/jf/column7/3.html
  //
  // [Altered for readability and to match class names

  if(document.getElementsByTagName)
  {
    var element = document.getElementsByTagName(element_type);

    for (var Index=0; Index<element.length; Index++)
    {
      if (element[Index].childNodes[0].tagName != "TH" && element[Index].parentNode.parentNode.className.indexOf("tableSort") != -1)
      {
        if (Index%2 == 1)
        {
          element[Index].className = "odd";
          element[Index].oldClassName = "odd";
          element[Index].onmouseout  = function()
            { this.className = "odd"; }
        }
        else
        {
          element[Index].className = "even";
          element[Index].oldClassName = "even";
          element[Index].onmouseout  = function(){ this.className = "even"; }
        }

        element[Index].onmouseover = function()
        {
          if(this.className == this.oldClassName)
            { this.className = "hover"; }
          if(this.onmouseout == null && this.className != "highlight")
          {
            this.onmouseout = function(){ this.className = this.oldClassName; }
          }
        }

        element[Index].onclick = function()
        {
          if (this.className != "highlight")
            { this.className = "highlight"; }
          else
            { this.className = this.oldClassName; }
          this.onmouseout = null;
        }
      }
    }
  }
}

function ts_animations_detail()
{
  // For Details used in on info detail pages

  // function designed by Jonathan Fenocchi
  // http://www.webreference.com/programming/javascript/jf/column7/3.html
  //
  // [Altered for readability and to match class names]

  if(document.getElementsByTagName)
  {
    var element = document.getElementsByTagName(element_type);

    for (var Index=0; Index<element.length; Index++)
    {
//      alert(element[Index].parentNode.parentNode.className);
      if (element[Index].childNodes[0].tagName != "TH" && element[Index].parentNode.parentNode.className.indexOf("Details") != -1)
      {
//      alert(element[Index].parentNode.parentNode.className);
//      alert(element[Index].parentNode.parentNode.className.indexOf("Details"));
        if (Index%2 == 1)
        {
          element[Index].className = "odd";
          element[Index].oldClassName = "odd";
          element[Index].onmouseout  = function()
            { this.className = "odd"; }
        }
        else
        {
          element[Index].className = "even";
          element[Index].oldClassName = "even";
          element[Index].onmouseout  = function(){ this.className = "even"; }
        }

        element[Index].onmouseover = function()
        {
          if(this.className == this.oldClassName)
            { this.className = "hover"; }
          if(this.onmouseout == null && this.className != "highlight")
          {
            this.onmouseout = function(){ this.className = this.oldClassName; }
          }
        }

        element[Index].onclick = function()
        {
          if (this.className != "highlight")
            { this.className = "highlight"; }
          else
            { this.className = this.oldClassName; }
          this.onmouseout = null;
        }
      }
    }
  }
}
