// application wide javascript
App = {
  init: function() {
    if($.browser.msie) {
      $('li.tab').corner('cc:#0086CF top');
      if($.browser.version < 8.0){
        $('li.tab').css('position', 'relative');
        $('li.tab').css('bottom', '10px');
      }

    } else if(!$.browser.msie) {
//      $('#header').corner('bottom');

      if(!$.browser.safari) {
        $('.roundedl4').corner('4px tl, bl');
        $('.rounded7').corner('7px');
        $('.rounded14').corner('14px');
      }

      $('.buttonSmall').corner('6px');
      $('.button').corner('8px');

      $('#loginFieldsContainer').corner('14px tl, bl, br');
      $('#loginFields').corner('9px tl, bl, br');
    }
    
    $('.buttonLarge').corner('10px');
    
    if(!$.browser.safari) {
        $('.rounded3').corner('3px');
        $('.rounded10').corner('10px');
    }

    if($('.flash').length > 0) {
      setTimeout(function() { $('.flash').fadeOut(1000) }, 3000);
    }

    $(document).mouseup(function(click) {
      if( $(click.target).parents("#loginForm").length == 0) {
        $("#loginForm").hide();
      }
    });
  }
}
// window load
$(document).ready(function() {
    App.init();
});

function updateDealPreview(deal_level) {
    var inc_title = $('#' + deal_level + '_deal_title').val();
    var inc_title_elem_id = '#' + deal_level + '-inc-title';
    if (inc_title == '') {
        $(inc_title_elem_id).text("Your title goes here.");
    } else {
        $(inc_title_elem_id).text(inc_title);
    }
}
