    var toggle = 0;
    var newwindow = '';
    
    function imgPopUp(img,w,h)
    {
        l = parseInt((screen.width-w)/2)
        t = parseInt((screen.height-h)/2)
        attribs = 'width='+w+',height='+h+',left='+l+',top='+t+'scrollbars=no';
        var newwindow = window.open(img,'imgWin',attribs);
        with ( newwindow ) {
            var contents="<HTML><HEAD><TITLE>Afbeelding</TITLE></HEAD> \
            <BODY BGCOLOR='#ffffff' TEXT='#000000' style=\"overflow: hidden; \" LEFTMARGIN=0 TOPMARGIN=0> \
            <IMG onclick='javascript:window.close();' SRC='" + img + "'> \
            </BODY></HTML>";
            document.open("text/html");
            document.write(contents);
            document.close();
        }
    }
    function NewWindow(mypage,myname,w,h,scroll,pos) {
        if(pos=="random") {
            LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
            TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
        } else {
            if(pos=="center") {
                LeftPosition=(screen.width)?(screen.width-w)/2:100;
                TopPosition=(screen.height)?(screen.height-h)/2:100;
            }
        }
        if((pos!="center" && pos!="random") || pos==null) {
            LeftPosition=0;TopPosition=20
        }
        settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
        if (!newwindow.closed && newwindow.location) {
            newwindow.focus();
        }
        else
        {
            newwindow=window.open(mypage,myname,settings);
            if (!newwindow.opener) newwindow.opener = self;
        }
        if (window.focus) {newwindow.focus()}
        return false;
    }
    function closenewwindow() {
        if (eval(newwindow)) {
          if (!newwindow.closed)
            newwindow.close();
        }
    } 

    function toggle_login() {
        //new Draggable('dologin',{revert:function(x,y){alert(x.style.left+' '+x.style.top)}});
        if ( document.getElementById('dologin').style.display == 'none' )
            toggle = 1;
        if ( toggle == 1 ) {
            new Effect.Appear('dologin');
            toggle = 0;
        }
        else {
            new Effect.Fade('dologin')
            toggle = 1;
        }
    }

    function insert_image(thumb_url,url,w,h,popup,align,floatt) {
        o = window.frames['cms_content___Frame'];
        var oImg = o.FCK.CreateElement( 'IMG' ) ;
        if (popup) {
            oImg.src = thumb_url ;
            oImg.setAttribute( 'onclick', "imgPopUp('"+url+"',"+w+","+h+");", 0 ) ;
            if (floatt)
                oImg.style.cssText = "cursor: pointer; cursor: hand; float: "+floatt+";";
            else
                oImg.style.cssText = "cursor: pointer; cursor: hand;";
        } else {
            oImg.src = url ;
            if (floatt)
                 oImg.setAttribute( 'style',"float: "+floatt+";");
        }
        if (align)
             oImg.setAttribute( 'align', align);
    }
    function keyHandler (evt) {
      var keyCode;
      if (evt) {
        keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
      }
      else if (window.event) {
        keyCode = window.event.keyCode;
      }
      // ctrl v = 22
      // v      = 118
      // ctrl shift v = 86
      // ctrl k = 11 || 107
      // cltl q 113 || 17
      // shift q = 81
      if ( keyCode == 81 || keyCode == 17 )
        toggle_login();
    }

    function initEventListening () {
      if (document.addEventListener) {
        document.addEventListener('keypress', keyHandler, false);
      }
      else if (document.attachEvent) {
        document.attachEvent('onkeypress', keyHandler);
      }
      else {
        document.onkeypress = keyHandler;
      }
    }
    function confirmSubmit( message ) {
        var agree=confirm( message );
        if (agree)
            return true ;
        else
            return false ;
    }
    
    function hideElementById(element) {
      document.getElementById(element).style.display = 'none';
    }
    function showElementById(element) {
      document.getElementById(element).style.display = 'block';
    }
    
  function setSessionCookie (myName,myValue) {
    if (testSessionCookie()) {
      writeSessionCookie (myName, myValue);
    }
  }
  
  function readCookie (myCookieName) {
    if (getCookieValue (myCookieName))
     return getCookieValue (myCookieName);
    else
      return false;
  }
  
  function savePosition(id,left,top) {
    setSessionCookie(id,left+','+top);
  }
  function getPosition(element) {
    value = readCookie(element);
    obj = document.getElementById(element);
    if (value && obj ) {
      positions = value.split(',');
      obj.style.left = positions[0];
      obj.style.top = positions[1];
    }
  }
  
  /**
  * Default function.  Usually would be overriden by the component
  */
  function submitbutton(pressbutton,message) {
  	submitform('adminForm',pressbutton,message);
  }
  function submitmenubutton(pressbutton,message) {
  	submitform('cmsmenu',pressbutton,message);
  }
  function submititemmenubutton(pressbutton,message) {
    submitform('pb_item_menu',pressbutton,message);
  }
  
  /**
  * Submit the admin form
  */
  function submitform(sForm,pressbutton,message){
    if (message) {
      if (confirmSubmit( message ) == false) 
        return false;
    }
    
  	document[sForm].task.value=pressbutton;
  	try {
  		document[sForm].onsubmit();
  		}
  	catch(e){}
  	document[sForm].submit();
  }
  
  /* COOKIE FUNCTIONS */
  function getCookieValue (cookieName) {
    var exp = new RegExp (escape(cookieName) + "=([^;]+)");
    if (exp.test (document.cookie + ";")) {
      exp.exec (document.cookie + ";");
      return unescape(RegExp.$1);
    }
    else return false;
  }
  
  function testSessionCookie () {
    document.cookie ="testSessionCookie=Enabled";
    if (getCookieValue ("testSessionCookie")=="Enabled")
      return true 
    else
      return false;
  }
  
  function writeSessionCookie (cookieName, cookieValue) {
    if (testSessionCookie()) {
      document.cookie = escape(cookieName) + "=" + escape(cookieValue) + "; path=/";
      return true;
    }
    else return false;
  }
  
  function deleteCookie (cookieName) {
     if (getCookieValue (cookieName)) writePersistentCookie (cookieName,"Pending delete","years", -1);  
        return true;     
  }
  
  function closeMenu(element) {
    if (document.getElementById(element)) {
      new Effect.Squish(document.getElementById(element));
    }
  }

