var Common = $.inherit({
  __constructor : function() {
    $("#flash .flash").live("click",this.hideFlash).livequery($.delegate(this, function(src){$(src).oneTime("5s",this.hideFlash)}));    
    $("#notification").live("click",this.hideFlash).livequery($.delegate(this, function(src){$(src).oneTime("5s",this.hideFlash)}));    

  },

  hideFlash: function() {
    $(this).fadeOut("slow",function(){                                                                                                                                 
      $(this).remove();           
    });                            
    return false;                                                                                                                                                       
  }

}, {

  validate: function(src, obj) {
    $(src).validate(obj);
  },

  redirect: function(response) {
    if(response.redirect_to){
      window.location.href = response.redirect_to;
    } else {
      Application.reloadPage();
    }
  },

  reloadPage: function() {
    window.location.href = window.location.href;
  },

  openNewPage: function(response) {
    window.open(response.redirect_to);
    return false;
  }

});

jQuery(document).ready(function() {
  new Common();
});
