/* Kanban Tool - http://www.kanbantool.com/
 * Copyright 2010 Shore Labs
 *
 * WARNING: This file is protected by copyright law. Reverse engineering of this file is strictly prohibited.
 * Do not remove this copyright message
 */

var KanbanTool = function(){
    return {

        showFormSpinner : function( spinner, form_elements ){
          spinner.show();
          if( form_elements )
            form_elements.each( function(){ this.disabled = 'disabled'; } );
        },

        hideFormSpinner : function( spinner, form_elements ){
          spinner.hide();
          if( form_elements )
            form_elements.each( function(){ this.disabled = null; } );
        },


        hideBoxy : function(){
            jQuery.data($('.boxy-wrapper')[0], 'boxy').hide();
            return 0;
        },

        showTab : function( tab_id, scope ){
          $('#' + scope + '_tabs li').removeClass('selected');
          $($('#' + scope + '_tabs #' + tab_id + '_link' )[0].parentNode).addClass('selected');

          $('#' + scope + '_tab_contents > div').hide();
          $('#' + scope + '_tab_contents > div#' + tab_id ).show();
        },

        textInputHint : function( input, text ){

          input.blur(function(){
            if( input.val() == '' ){
              input.val(text);
              input.addClass('inactive');
            }
          })

          input.focus(function(){
            if( input.val() == text ){
              input.val('');
              input.removeClass('inactive')
            }
          })

          input.val( text );
          input.addClass('inactive');

        },

        formSubmitActivator : function(submit, inputs){
          $(submit)[0].disabled = true;
          $(inputs).bind('click keyup', function(){
            $(submit)[0].disabled = false;
          })
        }


    }
}();
