/*Kristina Edit 12/20/07
* With help from David Miller's Zebra Tables
* www.alistapart.com/articles/zebratables
*/
var requiredStripeClass = 'calendartable'; //optional variable, defining the class which is required to "stripe" a table. If empty or null, all tables will be "striped"
var evenColor = '#ffffff';
var oddColor = '#ebe6f2';
 
  // this function is needed to work around
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }  
  function stripeObj(obj) {
    var even = true;
 
    // if arguments are provided to specify the colours
    // of the even and odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#ebe6f2";
 
    var table = obj;
    if (! table) { return; }
   
    var tbodies = table.getElementsByTagName("tbody");
   
    for (var h = 0; h < tbodies.length; h++) {
      var trs = tbodies[h].getElementsByTagName("tr");
      for (var i = 0; i < trs.length; i++) {
        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
          var tds = trs[i].getElementsByTagName("td");
          for (var j = 0; j < tds.length; j++) {
            var mytd = tds[j];
            // avoid cells that have
            // backgroundColor style
            if (! mytd.style.backgroundColor) {
				
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            }
          }
        }
        even =  ! even;
      }
    }
  }
  
function stripeAll(){ //stripe all tables, OR all tables containing the "requiredStripeClass" class
    tList = document.getElementsByTagName('table');
    var t;
    if((typeof evenColor == 'undefined'))
        evenColor = null;
    if((typeof oddColor == 'undefined'))
        oddColor = null;
    for(var x = 0; x < tList.length; x++){
        t = tList[x];
        if((typeof requiredStripeClass != 'undefined') && (requiredStripeClass != null) && (requiredStripeClass != '')){
            if(hasClass(t) == requiredStripeClass)
                stripeObj(t, evenColor, oddColor);
        }
        else
            stripeObj(t, evenColor, oddColor);
    }
}