// remap jQuery to $
(function($){})(window.jQuery);

/* trigger when page is ready */
$(document).ready(function() {
  
  $('input[type=submit].jui').button();
  $('button.jui-cancel').button({icons:{primary: "ui-icon-close"}});
  
  $('input.in-field-label').each(function(){
    var label = $('label[for=' + $(this).attr('id') + ']').html();
    $(this).focus(function(){
      if ($(this).val() == label) {
        $(this).removeClass('labelled').val('');
      }
    }).blur(function(){
      if ($(this).val() == '' || $(this).val() == label) {
        $(this).addClass('labelled').val(label);
      }
    }).blur();
  });
  
  $('table.index tbody tr').click(function() {
    window.location = $('a', this).attr('href');
  });
      
  $( 'a.print' ).click(function() {
    window.print();
    return false;
  });
  
});


/* optional triggers

$(window).load(function() {
	
});

$(window).resize(function() {
	
});

*/
