// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function change_form(form) {
  if(form == 0) {
    $('#newsletter_item_based_on_form').css({'display' : 'block'});
    $('#newsletter_item_new_form').css({'display' : 'none'});
    IE7 = (navigator.appVersion.indexOf("MSIE 7.")==-1) ? false : true;
    if(!IE7) {
      $("body select").msDropDown();
    }
  }
  else {
    $('#newsletter_item_based_on_form').css({'display' : 'none'});
    $('#newsletter_item_new_form').css({'display' : 'block'});
  }
}

function createEditor(element_id)
{
  // Create the editor again, with the appropriate settings.
  editor = CKEDITOR.replace( element_id,
  {
    enterMode		: 1, //En apretar ENTER fa un p
    shiftEnterMode	: 2 //En apretar shift+ENTER fa un br
  });
}

function publish_news_item() {
  if($('#published').attr('checked')) {
    $('#post_published_at').parent().show();
  }
  else {
    $('#post_published_at').parent().hide();
  }
}

$.growl.settings.displayTimeout = 4000;
$.growl.settings.noticeTemplate = ''
  + '<div>'
  + '<div style="float: right; background-image: url(/images/growl/top.gif); position: relative; width: 300px; height: 16px; margin: 0pt;"></div>'
  + '<div style="float: right; background-image: url(/images/growl/body.gif); position: relative; display: block; color: #ffffff; font-family: Arial; font-size: 12px; line-height: 14px; width: 300px; margin: 0pt;">' 
  + '  <h3 style="margin: 0pt; margin-left: 0px; padding-bottom: 10px; font-size: 13px;">%title%</h3>'
  + '  <p style="margin: 0pt 14px; margin-left: 40px; font-size: 12px;">%message%</p>'
  + '</div>'
  + '<div style="float: right; background-image: url(/images/growl/bottom.gif); position: relative; width: 282px; height: 16px; margin-bottom: 10px;"></div>'
  + '</div>';
$.growl.settings.noticeCss = {
  position: 'relative'
};

