function popupLegals(articleKey){
  open("/common/viewArticlePopup?articleKey=" + articleKey,"Information","width=300,height=350,scrollbars,resizable").focus();
}   

function openAdminLink(url){
    open(url,"admin").focus();
}

function searchWord(inputId) {
    var badWords = new Array("filmcafe","film cafe","stagepool","stage pool","Filmcafe","Film cafe","Stagepool","Stage pool","FILMCAFE","FILM CAFE","STAGEPOOL","STAGE POOL");
    var badWord = "";
    var str = document.getElementById(inputId).value;

    for(x=0;x<badWords.length;x++) {
        if(str.search(badWords[x])>-1) {
            badWord = badWords[x];
            str = str.replace(badWord,"");
            document.getElementById(inputId).value = str;
        }
    }

    return badWord;
}

/**
 * Use this to wright debug text to screen.
 * Create a div in document.
 * This method takes 0 or 2 arguments.
 * Arguments are left position and top position.
 * No arguments use default position.
 * Call this method once and then call method pr().
 * 
 * Example:
 * function init() { setDebug(200, 100); }
 * function else() { pr("Kalle", "Pelle"); }
 * Result:
 * 0. Kalle
 * 1. Pelle
 */
function setDebug(x, y) {
  var body = document.getElementsByTagName('body')[0];

  if(document.getElementById('helper')) { body.removeChild(document.getElementById('helper')); }

  var helper = document.createElement("div");

  helper.id = "helper";
  helper.style.fontFamily = "Verdana, Helvetica";
  helper.style.fontSize = "12px";

  if(arguments.length > 0) {
    helper.style.position = "absolute";
    helper.style.left = x + "px";
    helper.style.top = y + "px";
  }
  body.appendChild(helper);
}

/**
 * Call method with one or many String arguments. Each argument will be written to screen.
 */
function pr(arg) {
  if(arguments.length > 1) {
    var result = "";
  
    for(var i = 0; i < arguments.length; i++) { result += i + ". " + arguments[i] + "<br>"; }
    
    document.getElementById('helper').innerHTML = result;
  }
  else { document.getElementById('helper').innerHTML = arg; }
}