tinyMCE.init({
        mode : "specific_textareas",
        theme : "advanced",
        editor_deselector  : "area",
        plugins: "advimage",
        theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect, |, cut,copy,paste,",
        theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,|,code,preview,|,forecolor,backcolor, |, insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,sub,sup,|,charmap,emotions",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
        file_browser_callback : "ajaxfilemanager",
        skin : "o2k7",
        skin_variant : "silver",
        convert_urls : false,
        width : "600",
        height : "250",
        language : "es",
        entity_encoding: "raw",
        relative_urls : true

      });
    function getCargando(){
      var _html = '<div style="margin:5em;text-align:center;"><img src="../../images/loading.gif" /></div>';
      return _html;
    }

    function ajaxfilemanager(field_name, url, type, win) {
      var ajaxfilemanagerurl = "/js/tinymce/plugins/ajaxfilemanager/ajaxfilemanager.php";
      var view = 'detail';
      switch (type) {
        case "image":
        view = 'thumbnail';
          break;
        case "media":
          break;
        case "flash":
          break;
        case "file":
          break;
        default:
          return false;
      }
            tinyMCE.activeEditor.windowManager.open({
                url: "/gestor/web/js/tinymce/plugins/ajaxfilemanager/ajaxfilemanager.php?view=" + view,
                width: 782,
                height: 440,
                inline : "yes",
                close_previous : "no"
            },{
                window : win,
                input : field_name
            });
    }


$(window).load(function() {
  Shadowbox.init();

  $('a.shadowbox').live('click', function(e){

    e.preventDefault();
    var _url = $(this).attr('href');

      Shadowbox.open ({
        content: _url,
        player: 'iframe',
        width:1024,
        height: 658
      });

   });
  GESTOR.config();
});

var GESTOR = (function ($,gestorOBJ) {
  gestorOBJ.config = function () {
    if ($('#lastFPhoto').length>0) FLICKER.config();
  }

  function getCargando(){
    var _html = '<div style="margin:5em;text-align:center;"><img src="../../../images/loading.gif" /></div>';
    return _html;
  }
  $('#new_comment').bind('submit', function(e){
    if ($(this).closest('#blog').length == 0) $('#comment_body').val($('#comment_body_ifr').contents().find('body').html())
    if ($('#comment_body').val() != ''){
      $('#contenedor_form').html(getCargando());
      $.post($(this).attr('action'), $(this).serialize()+'', function(data){
        $('#contenedor_form').html('<div class="flashOk">' + $(data).find('#contenedor_form .flashOk').html() + '</div>');
      });
    }
    e.preventDefault();
  });
  $('#deleteComment').on('click', function(e){
    $('#contenedor_form').html(getCargando());
    $.post($(this).attr('action'), $(this).serialize()+'', function(data){
      $('#detalleComentario').html('<div class="flashOk">' + $(data).find('#contenedor_form .flashOk').html() + '</div>');
    });
   });


  return gestorOBJ;
})(jQuery, GESTOR || {});



function cloneObject(source){for(i in source){if(typeof source[i]=='source'){this[i]=new cloneObject(source[i])}else{this[i]=source[i]}}}
if(typeof console === "undefined") { console = { log: function() { } };}








