
var screenHeight = screen.height;
var screenWidth = screen.width;



function openWin(url,windowname,winHeight,winWidth,opt) {

var winTop = (screenHeight/2) - (winHeight/2);
var winLeft = (screenWidth/2) - (winWidth/2);

        var win = open(url,windowname,'height='+winHeight+',width='+winWidth+','+opt+',top='+winTop+',left='+winLeft)
        win.focus();
}

function openNewsPopup(news_id)
{

myWindow = window.open("news/process.php?cmd=showEntry&newsID="+news_id, "newsWin", 'width=640,height=480,scrollbars=yes')
myWindow.document.close()
}

<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

//-->

function allstates(state, o) {

        var i;

        for (i = 0; i<= o.length; i++) {
                o[i].checked = state;
        }

}

function onestates(state, o, i) {

                o[i].checked = state;

}


 function closeWin()
{
    opener.location.reload(true);
    self.close();
}



// detect browser

NS4 = (document.layers) ? 1 : 0;

IE4 = (document.all) ? 1 : 0;

// W3C stands for the W3C standard

W3C = (document.getElementById) ? 1 : 0;



function makeVisible ( name ) {

  var ele;



  if ( W3C ) {

    ele = document.getElementById(name);

  } else if ( NS4 ) {

    ele = document.layers[name];

  } else { // IE4

    ele = document.all[name];

  }



  if ( NS4 ) {

    ele.visibility = "show";

  } else {  // IE4 & W3C & Mozilla

    ele.style.visibility = "visible";

    ele.style.display = "inline";

  }

}



function makeInvisible ( name ) {

  if (W3C) {

    document.getElementById(name).style.visibility = "hidden";

    document.getElementById(name).style.display = "none";

  } else if (NS4) {

    document.layers[name].visibility = "hide";

  } else {

    document.all[name].style.visibility = "hidden";

    document.all[name].style.style.display = "none";

  }

}


///////////////////////// CHANGED /////////////////////////////////
function showNewsEntries(){
    makeVisible('newsEntries');
}

///////////////////////// CHANGED /////////////////////////////////
function hideNewsEntries(){
    makeInvisible('newsEntries');
}



function showNews(i){
    makeVisible ('moreNews'+i);
    makeInvisible ('moreNewsInfo'+i);
}
function hideNews(i){
    makeInvisible ('moreNews'+i);
    makeVisible ('moreNewsInfo'+i);
}


///////////////////////// CHANGED /////////////////////////////////
function insertNewsEntriesHeadlines(o){
var i;
    for (i = 0; i<= o.length; i++) {
                    if(o[i].checked == true)
                    {
                       insertAtCursor(document.newsEditor.FCKeditor1, 'this value');
                    }
    }

}
/*
function InsertText(input, insTexte)
{

startTag = '';
endTag = '';


     if (input.createTextRange)
     {
      var text;
      input.focus(input.caretPos);
      input.caretPos = document.selection.createRange().duplicate();
      if(input.caretPos.text.length>0)
      {
       input.caretPos.text = startTag + input.caretPos.text + endTag;
      }
      else
      {
       input.caretPos.text = startTag + " " + insTexte + " " + endTag;
      }
     }
     else input.value += startTag + insTexte + endTag;
}
*/

function insertAtCursor(myField, myValue) {
//IE support
if (document.selection) {
    myField.focus();
    sel = document.selection.createRange();
    sel.text = myValue;
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
// calling the function