if (bEditMode == true) {
  tinyMCE.init({
    // General options
    mode : "exact",
    elements : "text",
    theme : "advanced",
    skins : "default",
    plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

    // Theme options
    theme_advanced_buttons1 : "justifyleft,justifycenter,formatselect,|,bullist,numlist,|,outdent,indent,|,sub,sup",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,undo,redo,|,link,unlink,image,charmap,iespell,media",
    theme_advanced_buttons3 : "tablecontrols",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_resizing : true,
    //theme_advanced_blockformats : "p,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp"

    // Example content CSS (should be your site CSS)
    content_css : "css/stylesheet.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "lists/template_list.js",
    external_link_list_url : "lists/link_list.js",
    external_image_list_url : "lists/image_list.js",
    media_external_list_url : "lists/media_list.js"
  });

}

function openPopup (url) {
  var qs = url.split('?')[1];
  var arQs = qs.split('&');
  var i = 0;
  var bPortret = false;

  for (i=0;i<arQs.length;i++) {
    if (arQs[i].split('=')[0] == 'pageid' && arQs[i].split('=')[1] == '101') {
      $('#popup #portret').show();
      $('#popup #portret .a').show();
      bPortret = true;
    }
    if (arQs[i].split('=')[0] == 'pageid' && arQs[i].split('=')[1] == '102') {
      $('#popup #portret').show();
      $('#popup #portret .k').show();
      bPortret = true;
    }
  }
  if (!bPortret) { $('#popup #portret').hide(); }
  $('#popup').supersleight();

  $('#fade').css('height', $(document).height() + 'px');
  $('#fade').css('width', $(document).width() + 'px');
  $('#fade').show();
  $('#popup iframe').attr('src', url);
  $('#popup').show();
  return true;
}

function closePopup (title) {
  $('#popup').hide();
  $('#popup iframe').attr('src', 'about:blank');
  $('#popup #portret .img').hide();
  $('#fade').hide();
  $('title').html(title);
  return true;
}

