$(document).ready(function() {
   //-------------------------------------------------------------------------------------
   shadeEvenLines();
   //-------------------------------------------------------------------------------------
   //--- Link non link tags such as tr,td,div
   $('* [href!=""]').each(function() {
      var href = $(this).attr('href');
      if(href) {
         if($(this)[0].tagName == 'LINK') return;
         if($(this)[0].tagName == 'A') return;
         $(this).click(function() { document.location = href; });
      }
   });
   //------------------------------------------------------------------------
});
//------------------------------------------------------------------------

function m_alert(title,body,opts) {
   var ele = document.createElement('div');
   ele.title = title;
   ele.innerHTML = body;
   $(ele).dialog(opts);
}
//------------------------------------------------------------------------
function addCommas(nStr) {
        nStr += '';
        x = nStr.split('.');
        x1 = x[0];
        x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
                x1 = x1.replace(rgx, '$1' + ',' + '$2');
        }
        return x1 + x2;
}
//------------------------------------------------------------------------
function shadeEvenLines() {
   $('table.table1').each(function() {
      var cnt = 0;
      $(this).find('tr').each(function() {
         if(cnt % 2 == 0) {
            $(this).addClass('even');
         }
         cnt++;
      });
   });
}
//------------------------------------------------------------------------

