
var Generic = {

  load: function()
  {
    if($('#ClientSwitcher'))
    {
      this.clientSwitcher();
    }
  },
  
  
  clientSwitcher: function()
  {
    var form = $('#ClientSwitcher');
    
    $('#ClientSwitcher select').bind("change", function(e){
      form.submit();
    });
    
    $('#clientAccountsInfo').hover(
      function() {
        var offset = $('#clientAccountsInfo').offset();
        $('#clientAccountsInfoBox').css('top',(offset.top+18)+'px');
        $('#clientAccountsInfoBox').css('left',(offset.left-120)+'px');
        $('#clientAccountsInfoBox').show();
      },
      function() {
        $('#clientAccountsInfoBox').hide();
      }
    );
  },
  
  
  checkAll: function(obj)
  {
    if(obj.checked)
    {
      $(obj).parents('table').find('tbody input:checkbox').each(function(no,obj) { obj.checked = true; });
    }
    else
    {
      $(obj).parents('table').find('tbody input:checkbox').each(function(no,obj) { obj.checked = false; });
    }
  }
  
}


$(document).ready(function() {
  Generic.load();
});
