var wIe  = (document.all) ? 1 : 0;
var wIeVers       = navigator.appVersion.substring(navigator.appVersion.lastIndexOf("MSIE") + 4,navigator.appVersion.lastIndexOf("MSIE") + 8);













function wOpenWindowX(url, name, options){

  url = url.replace(/&amp;/g, '&');
  name = name.replace(/\.|-|\//g, '');


  var width = screen.availWidth - 0;
  var regWidth = /width=(\d+)/;
  if(regWidth.exec(options)){
    width = RegExp.$1;
  }

  var height = screen.availHeight - 0;
  var regHeight = /height=(\d+)/;
  if(regHeight.exec(options)){
    height = RegExp.$1;
  }

  if(!name && !width && !height && !options){
    return window.open(url, name);
    return;
  }

  if(!options){
    options = ',resizable=no,scrollbars=no,status=no';
  }


  var posLeft = (screen.width / 2)  - (width  / 2);
  var posTop  = (screen.height / 2) - (height / 2);

  window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
}







function wCloseDialog(){

  if(opener){
    self.close();
  }
  else if(wGlobalDialogOpenedId){
    var iFrameId = wGlobalDialogOpenedId;
    document.getElementById(iFrameId).src = 'about:blank';
    document.getElementById(iFrameId).style.display = 'none';
  }
  else{
    var iFrameId = parent.wGlobalDialogOpenedId;
    parent.document.getElementById(iFrameId).src = 'about:blank';
    parent.document.getElementById(iFrameId).style.display = 'none';
  }
}







function wOpenDialog(url, iFrameId, width, height){

  wGlobalDialogOpenedId = iFrameId;
  var iFrameElement  = document.getElementById(iFrameId);
  var className = iFrameElement.parentNode.parentNode.className;
  var clientWidth    = 0;
  var clientHeight   = 0;
  var search = / *right */i;
  if(search.test(className)){
    if(wIe){
      clientHeight  = iFrameElement.parentNode.offsetHeight;
      clientWidth   = 0;
    }
    else {
      clientWidth   = iFrameElement.parentNode.offsetWidth;
    }
    iFrameElement.style.marginLeft  = '-' + (width - clientWidth) + 'px' ;
  }
  else{
    if(wIe){
      clientHeight  = iFrameElement.parentNode.offsetHeight;
      clientWidth   = iFrameElement.parentNode.offsetWidth;
    }
    else {
      clientWidth   = 0;
    }
    iFrameElement.style.marginLeft  = '-' + (clientWidth) + 'px' ;
  }
  iFrameElement.style.marginTop   = '-' + (height - clientHeight) + 'px';
  iFrameElement.style.height      = height + 'px';
  iFrameElement.style.width       = width  + 'px';
  iFrameElement.src               = url;
  iFrameElement.style.display     = 'block';
}









function wShowUploadMask(repositoryId, currPath){

  wOpenWindowX('/weblication/grid/scripts/wUploader.php?action=showmaskuploadfile&uploaddir='+ currPath +'&path=' + currPath + '&repository=' + repositoryId, 'wUploader', 'width=640,height=290');
}









function wToggleCheckbox(checkbox){

  if(checkbox.checked){
    checkbox.checked = false;
  }
  else{
    checkbox.checked = true;
  }
}









function wToggleElement(elementId){

  if(document.getElementById(elementId)){

    if(document.getElementById(elementId).style.display == 'none'){
      document.getElementById(elementId).style.display = 'block';
    }
    else{
      document.getElementById(elementId).style.display = 'none';
    }
  }
}









function wToggleConfig(portletId){

  configNode = document.getElementById("configMask_"+portletId);

  if(configNode){
    if(configNode.style.display == 'block'){
      configNode.style.display = 'none';
    }
    else{
      configNode.style.display = 'block';




    }
  }









}













function wRemoveElement(object, interval){
  wFadeOutElement(object, interval)
 
}
















var opacity_fadeIn        = 0;
var wObject_FadeInElement = null;

function wFadeInElement(object, interval){
  if(object != ''){

    wObject_FadeInElement                   = object;
    opacity_fadeIn                          = 0;
  }

  if(wIe){
  }
  else{
    wObject_FadeInElement.style.MozOpacity = opacity_fadeIn / 100;
  }

  if(opacity_fadeIn !=100){
    setTimeout('opacity_fadeIn = opacity_fadeIn + ' + interval + ';wFadeInElement("",' + interval + ');',5);
  }

}










var opacity_fadeOut        = 100;
var wObject_fadeOutElement = null;

function wFadeOutElement(object, interval){
  if(object != ''){

    wObject_fadeOutElement                   = object;
    opacity_fadeOut                          = 100;
  }
  if(wIe){
  }
  else{
    wObject_fadeOutElement.style.MozOpacity = opacity_fadeOut / 100;
  }

  if(opacity_fadeOut !=0){
    setTimeout('opacity_fadeOut = opacity_fadeOut - ' + interval + ';wFadeOutElement("",' + interval + ');',5);
  }
  else{
    var regExp = /wysiwyg_webtag_text_/;
    if(regExp.exec(wObject_fadeOutElement.innerHTML)){
      wObject_fadeOutElement.getElementsByTagName('textarea')[0].parentNode.removeChild(wObject_fadeOutElement.getElementsByTagName('textarea')[0]);
      wObject_fadeOutElement.style.display = 'none';
    }
    else{
      wObject_fadeOutElement.parentNode.removeChild(wObject_fadeOutElement);
    }
  }

}









function wEmbedString(elementId, string){


  var string   = string.replace(/[\n\r]+/g, '~_wnl_~');
  var string   = string.replace(/= function/g, '~_wfunc_~');

  var scripts  = string.split('<' + '/' + 's' + 'cript>');

  var jsString = '';

  for(var i = 0; i < scripts.length - 1; i++){
    var scriptStr = scripts[i].replace(/.*<script[^>]*>/, '');
    jsString += scriptStr;
  }







  var jsFunctions = jsString.split(/function\s+/);
  var jsVars      = jsString.split(/\s+var\s+/);

  string     = string.replace(/~_wnl_~/g, "\n");


  string     = string.replace(/~_wfunc_~/g, "= function");


  for(var i = 1; i < jsVars.length; i++){

      jsVars[i]     = jsVars[i].replace(/~_wnl_~/g, "\n");

      var jsV = jsVars[i].split(/\n/);
      if(jsV[0].substr(0, 7) == 'wGlobal'){


        var jsVarEval = '' + jsV[0];

        eval(jsVarEval);
      }






  }

  for(var i = 1; i < jsFunctions.length; i++){
    if(jsFunctions[i] != ''){
      jsFunctions[i] = jsFunctions[i].replace(/~_wnl_~/g, "\n");
      jsFunctions[i] = jsFunctions[i].replace(/~_wfunc_~/g, "= function");
      var jsFunction = jsFunctions[i].replace(/(\w+)/, 'DOLLAR_1_TMP = function');
      jsFunction = jsFunction.replace('DOLLAR_1_TMP', RegExp.$1);

      eval(jsFunction);
    }
  }

  document.getElementById(elementId).innerHTML = string;
}

var wGetUrlFunctionResult;

if(typeof wResultFunctions == 'undefined'){
  var wResultFunctions = new Array();
  var wRequests        = new Array();
}











function wGetUrlAjax(url, functionResult){

  var requestObject = new wRequestObject(url, functionResult);
}











function wSendFormAjaxPost(url, parameters, functionResult){

  var requestObjectPost = new wRequestObjectPost(url, parameters, functionResult);
}













function wGetUrlAjaxPost(url, parameters, functionResult){

  var requestObjectPost = new wRequestObjectPost(url, parameters, functionResult);
}











function wRequestObject(url, functionResult){

  if(typeof functionResult == 'function'){
    var id              = wResultFunctions.length;


    this.request        = null;

    if(document.all){
      this.request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
      this.request = new XMLHttpRequest();
    }

    wResultFunctions.push(functionResult);


    wRequests.push(this.request);
    this.request.open('GET', url, true);

    this.request.onreadystatechange = function(){
      var requestObject = wRequests[id];
      if(requestObject.readyState == 4){
        if(requestObject.status == '200'){
          wResultFunctions[id](requestObject.responseText);
        }
      }
    }

    this.request.send('');
  }
}











function wRequestObjectPost(url, parameters, functionResult){

  if(typeof functionResult == 'function'){
    var id              = wResultFunctions.length;

    this.request        = null;

    if(document.all){
      this.request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
      this.request = new XMLHttpRequest();
      if (this.request.overrideMimeType) {
         this.request.overrideMimeType('text/html');
      }
    }

    wResultFunctions.push(functionResult);


    wRequests.push(this.request);
    this.request.open('POST', url, true);

    this.request.onreadystatechange = function(){
      var requestObject = wRequests[id];
      if(requestObject.readyState == 4){
        if(requestObject.status == '200'){
          wResultFunctions[id](requestObject.responseText);
        }
      }
    }

    this.request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    this.request.setRequestHeader("Content-length", parameters.length);
    this.request.setRequestHeader("Connection", "close");
    this.request.send(parameters);
  }
}







function wGetWidthWindow(){

  var winWidth;

  if(wIe){
    if(document.documentElement.clientWidth){
      winWidth = document.documentElement.clientWidth;
    }
    else{
      winWidth = document.body.clientWidth;
    }
  }
  else{
    winWidth = window.innerWidth;
  }
  return winWidth;
}







function wGetHeightWindow(){

  var winHeight;

  if(wIe){
    if(document.documentElement.clientHeight){
      winHeight = document.documentElement.clientHeight;
    }
    else{
      winHeight = document.body.clientHeight;
    }
  }
  else{
    winHeight = window.innerHeight;
  }
  return winHeight;
}






function wGetHeightSite(){
  
  var siteHeight;
  
  if(ie){
    if(document.body){
      siteHeight = document.body.scrollHeight;
    }
    else{
      if(document.documentElement.scrollHeight){
        siteHeight = document.documentElement.scrollHeight;
      }
      else{
        siteHeight = 0;
      }
    }
  }
  else{
    siteHeight = window.outerHeight;
  }
  return siteHeight;
}









function wSetWidthWindow(winWidth){

  var winWidth;

  if(wIe){
    if(document.documentElement.clientWidth){
      document.documentElement.clientWidth = winWidth;
    }
    else{
      document.body.clientWidth = winWidth;
    }
  }
  else{
    window.innerWidth = winWidth;
  }
  return true;
}

var wMouseX      = 0;
var wMouseY      = 0;
var wMouseXAbs   = 0;
var wMouseYAbs   = 0;

function wOnMouseMove(e){
  if(wIe){
    e = event;
    wMouseX    = event.clientX;
    wMouseY    = event.clientY;
    wMouseXAbs = event.clientX;
    wMouseYAbs = event.clientY;
  }
  else{
    wMouseX    = e.pageX;
    wMouseY    = e.pageY;
    wMouseXAbs = e.pageX;
    wMouseYAbs = e.pageY;
  }
}










function wShowMessageboxX(id, title, text, buttons, icon, variable){
  initDialog(id, title, text, buttons, icon, variable);
  scrollMessageBox();
}

function scrollMessageBox(){

  if (window.pageYOffset) {

    pagey = window.pageYOffset;
    pagex = window.pageXOffset;
  }
  else if (document.documentElement && document.documentElement.scrollTop) {

    pagey = document.documentElement.scrollTop;
    pagex = document.documentElement.scrollLeft;
  }
  else if (document.body) {

    pagey = document.body.scrollTop;
    pagex = document.body.scrollLeft;
  }

  if(document.getElementById("blocker")){
    document.getElementById("blocker").style.marginTop = window.pagey+'px';
    document.getElementById("blocker").style.marginLeft = window.pagex+'px';
  }

  if(document.getElementById("dialog")){
    document.getElementById("dialog").style.marginTop = (window.pagey-75)+'px';
    document.getElementById("dialog").style.left = (parseInt(wGetWidthWindow()/2)+window.pagex)+'px';
  }

  if(document.getElementById("iframe")){
    document.getElementById("iframe").style.marginTop = (window.pagey-75)+'px';
    document.getElementById("iframe").style.left = (parseInt(wGetWidthWindow()/2)+window.pagex)+'px';
  }
}

var isShownDialog = false;
if(!TEXT_MESSAGEBOX_TITLE){
  var TEXT_MESSAGEBOX_TITLE   = null;
}
if(!TEXT_MESSAGEBOX_OK){
  var TEXT_MESSAGEBOX_OK      = null;
}
if(!TEXT_MESSAGEBOX_CANCEL){
  var TEXT_MESSAGEBOX_CANCEL  = null;
}
if(!TEXT_MESSAGEBOX_YES){
  var TEXT_MESSAGEBOX_YES     = null;
}
if(!TEXT_MESSAGEBOX_ALLWAYS){
  var TEXT_MESSAGEBOX_ALLWAYS = null;
}
if(!TEXT_MESSAGEBOX_NOT){
  var TEXT_MESSAGEBOX_NOT     = null;
}
if(!TEXT_MESSAGEBOX_BACK){
  var TEXT_MESSAGEBOX_BACK    = null;
}

function initDialog (id, title, text, buttons, icon, variable) {

  isShownMessageBox = true;
  window.onscroll = scrollMessageBox;

  text = text.replace(/<br \/>/, '<br/>')
  var parts       = text.split(' ');
  var texts       = '';
  var textsLine = '';
  var j             = 1;
  var length     = 0;

  if(parts.length != 0){
    for(var i= 0; i < parts.length; i++){
      if(i+1 == parts.length){
        texts     += textsLine+parts[i];

        j++;
        var tmpLength = (textsLine+parts[i]).length;
        if(tmpLength > length){
          length = tmpLength;
        }
      }
      else if(parts[i].search(/<br\/>/) != -1){
        texts     += textsLine+' '+parts[i].replace(/<br\/>/, '<br />');
        j++;
        var tmpLength = textsLine.length+parts[i].replace(/<br\/>/, '<br />').length+1;
        if(tmpLength > length){
          length = tmpLength;
        }
        textsLine = '';
      }
      else if((textsLine + parts[i]).length > 90 && parts[i].length <= 90){
        texts     += textsLine+'<br />\n';
        j++;
        textsLine = parts[i];
        length = 100;
      }
      else if(parts[i].length > 90){
        for(var k = 0; k < Math.round(parts[i].length/80); k++){
          texts += parts[i].substr(k*80, 80)+'<br />\n';
          j++;
        }
        length = 100;
      }
      else{
        textsLine += parts[i]+' ';
      }
    }
  }
  else{
    length = text.length;
    texts = text;
  }

  if(length < 50){
    length = 50;
  }

  if(title != '') {
    var dialogTitle = title;
  }
  else {
    if(TEXT_MESSAGEBOX_TITLE && TEXT_MESSAGEBOX_TITLE != ''){
      var dialogTitle = TEXT_MESSAGEBOX_TITLE;
    }
    else{
      var dialogTitle = 'Weblication Hinweis';
    }
  }

  if(TEXT_MESSAGEBOX_OK && TEXT_MESSAGEBOX_OK != ''){
    var buttonOKTxt   = TEXT_MESSAGEBOX_OK;
  }
  else{
    var buttonOKTxt   = 'Ok';
  }
  if(TEXT_MESSAGEBOX_CANCEL && TEXT_MESSAGEBOX_CANCEL != ''){
    var buttonCATxt   = TEXT_MESSAGEBOX_CANCEL;
  }
  else{
    var buttonCATxt   = 'Abbrechen';
  }
  if(TEXT_MESSAGEBOX_YES && TEXT_MESSAGEBOX_YES != ''){
    var buttonYESTxt   = TEXT_MESSAGEBOX_YES;
  }
  else{
    var buttonYESTxt  = 'Ja';
  }
  if(TEXT_MESSAGEBOX_ALLWAYS && TEXT_MESSAGEBOX_ALLWAYS != ''){
    var buttonALLWAYSTxt   = TEXT_MESSAGEBOX_ALLWAYS;
  }
  else{
    var buttonALLWAYSTxt  = 'Ja, alle';
  }
  if(TEXT_MESSAGEBOX_NOT && TEXT_MESSAGEBOX_NOT != ''){
    var buttonNOTxt   = TEXT_MESSAGEBOX_NOT;
  }
  else{
    var buttonNOTxt   = 'Nein';
  }
  if(TEXT_MESSAGEBOX_BACK && TEXT_MESSAGEBOX_BACK != ''){
    var buttonBACKTxt   = TEXT_MESSAGEBOX_BACK;
  }
  else{
    var buttonBACKTxt = 'Schließen';
  }

  if(icon == 'install'){
    var iconpath      = 'http://download.weblication.de/weblication/grid/gui/wImages/wMessagebox/loading.gif';
  }
  else{
    var iconpath      = '/weblication/grid/gui/wImages/wMessagebox/'+icon+'.gif';
  }

  var iconOk        = '/weblication/grid/gui/wImages/icon_small/ok.gif';
  var iconCancel    = '/weblication/grid/gui/wImages/icon_small/cancel.gif';
  var iconYes       = '/weblication/grid/gui/wImages/icon_small/ok.gif';
  var iconNo        = '/weblication/grid/gui/wImages/icon_small/cancel.gif';
  var iconBACK      = '/weblication/grid/gui/wImages/icon_small/cancel.gif';

  if(parent.frames.length < 1) {
    var docBody                 = document.body;
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET') {
      if(wIe){
        var docBody                 = document.body;
      }
      else{
        var docBody                 = document.body;
      }
    }
    else{
      var docBody                 = document.body;
    }
  }

    var blocker       = document.createElement("div");
    blocker.className = "blockerClass";
    blocker.id        = "blocker";
    docBody.appendChild(blocker);

    if(wIe && wIeVers < 7){
      docBody.firstChild.insertAdjacentHTML('afterEnd', "<iframe src='about:blank' id='blockerFrame' style='width:100%; height: 100%;z-index:999; position:absolute; filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)' />");
    }

    var dialog                 = document.createElement('div');
    dialog.id                  = 'dialog';
    dialog.style.display       = "block";

    dialog.style.marginTop      = -(j*10+80)/2+'px';
    dialog.style.marginLeft     = -((length*5+75)/2)+'px';
    dialog.style.width          = length*5+75+"px";
    dialog.style.height         = j*10+80+"px";
    docBody.appendChild(dialog);

    if(wIe && wIeVers <= 7){
      var cssLink          = document.createElement("link");
      cssLink.rel          = 'stylesheet';
      cssLink.text         = 'text/css';
      cssLink.href         = '/weblication/grid/gui/wStyles/wIe.css';
      docBody.appendChild(cssLink);
    }
    if(wIe && wIeVers < 7){
      var frame            = document.createElement("iframe");
      frame.src            = 'about:blank';
      frame.id             = 'blockerFrame';
      frame.style.width    = '100%';
      frame.style.height   = '140%';
      frame.style.zIndex   = '-1';
      frame.style.position = 'absolute';
      frame.style.display  = 'block';
      frame.style.filter   = 'mask()';

      dialog.appendChild(frame);
    }

    var d_head                   = document.createElement('div');
    d_head.id                     = 'd_head';
    d_head.style.width        = '100%';
    dialog.appendChild(d_head);

    var headline                  = document.createElement('h1');
    headline.innerHTML       = dialogTitle;
    headline.id                    = 'headline';
    headline.style.width       = dialog.offsetWidth+'px';

    d_head.appendChild(headline);

    if(icon) {
      var d_body              = document.createElement('div');
      d_body.innerHTML   = texts;
      d_body.id                = 'd_body_icon';
      dialog.appendChild(d_body);
      var d_icon              = document.createElement('div');
      d_icon.id                = 'd_icon';
      d_icon.style.top      = '40%';
      dialog.appendChild(d_icon);

      var d_icon_img          = document.createElement('img');
      d_icon_img.id            = 'd_icon_img';
      d_icon_img.src          = iconpath;
      d_icon.appendChild(d_icon_img);
    }
    else{
      var d_body              = document.createElement('div');

      d_body.innerHTML  = texts;
      d_body.id               = 'd_body';
      dialog.appendChild(d_body);
    }


    var d_shadow_right                                    = document.createElement('div');

    d_shadow_right.style.position                      = 'absolute';
    d_shadow_right.style.top                             = 0+'px';
    d_shadow_right.style.width                          = 5+'px';
    d_shadow_right.style.left                             = dialog.offsetWidth-1+'px';
    d_shadow_right.style.height                         = dialog.offsetHeight+'px';
    var d_shadow_right_top                               = document.createElement('div');
    d_shadow_right_top.id                                 = 'd_shadow_right_top';
    d_shadow_right_top.style.height                   = 3+'px';
    d_shadow_right_top.style.backgroundImage  = 'url("/weblication/grid/gui/wImages/wShadows/messagebox_right_top.png")';
    d_shadow_right_top.style.backgroundRepeat = 'no-repeat';
    d_shadow_right.appendChild(d_shadow_right_top);
    var d_shadow_right_middle      = document.createElement('div');
    d_shadow_right_middle.id                            = 'd_shadow_right_middle';
    if(wIeVers < 7){
      d_shadow_right_middle.style.marginTop     = - 11+'px';
    }
    d_shadow_right_middle.style.height                   = dialog.offsetHeight - 1+'px';
    d_shadow_right_middle.style.backgroundImage  = 'url("/weblication/grid/gui/wImages/wShadows/messagebox_right_middle.png")';
    d_shadow_right_middle.style.backgroundRepeat = 'repeat-y';
    d_shadow_right.appendChild(d_shadow_right_middle);
    dialog.appendChild(d_shadow_right);

    var d_shadow_bottom                                     = document.createElement('div');

    d_shadow_bottom.style.position                      = 'absolute';
    d_shadow_bottom.style.width                          = dialog.offsetWidth+2+'px';
    d_shadow_bottom.style.top                             = dialog.offsetHeight+'px';
    d_shadow_bottom.style.height                         = 5+'px';
    var d_shadow_bottom_left                               = document.createElement('div');
    d_shadow_bottom_left.id                                 = 'd_shadow_bottom_left';
    d_shadow_bottom_left.style.width                    = 3+'px';
    d_shadow_bottom_left.style.cssFloat               = 'left';
    d_shadow_bottom_left.style.styleFloat             = 'left';
    d_shadow_bottom_left.style.height                  = 5+'px';
    d_shadow_bottom_left.style.backgroundImage  = 'url("/weblication/grid/gui/wImages/wShadows/messagebox_bottom_left.png")';
    d_shadow_bottom_left.style.backgroundRepeat = 'no-repeat';
    d_shadow_bottom.appendChild(d_shadow_bottom_left);
    var d_shadow_bottom_middle                               = document.createElement('div');
    d_shadow_bottom_middle.id                                 = 'd_shadow_bottom_middle';
    d_shadow_bottom_middle.style.width                    = dialog.offsetWidth - 4 +'px';
    d_shadow_bottom_middle.style.cssFloat               = 'left';
    d_shadow_bottom_middle.style.styleFloat             = 'left';
    d_shadow_bottom_middle.style.height                   = 5+'px';
    d_shadow_bottom_middle.style.backgroundImage  = 'url("/weblication/grid/gui/wImages/wShadows/messagebox_bottom_middle.png")';
    d_shadow_bottom_middle.style.backgroundRepeat = 'repeat-x';
    d_shadow_bottom.appendChild(d_shadow_bottom_middle);
    var d_shadow_bottom_right                                = document.createElement('div');
    d_shadow_bottom_right.id                                  = 'd_shadow_bottom_right';
    d_shadow_bottom_right.style.width                     = 3 +'px';
    d_shadow_bottom_right.style.cssFloat                = 'left';
    d_shadow_bottom_right.style.styleFloat              = 'left';
    d_shadow_bottom_right.style.height                    = 5+'px';
    d_shadow_bottom_right.style.backgroundImage   = 'url("/weblication/grid/gui/wImages/wShadows/messagebox_bottom_right.png")';
    d_shadow_bottom_right.style.backgroundRepeat  = 'no-repeat';
    d_shadow_bottom.appendChild(d_shadow_bottom_right);
    dialog.appendChild(d_shadow_bottom);

    var d_buttons           = document.createElement('div');
    d_buttons.id            = 'd_buttons';
    dialog.appendChild(d_buttons);

    if(buttons.toLowerCase().indexOf('yes') != '-1') {
      var d_bYES               = document.createElement('div');

      newAttrOnMouseOver = "this.className='d_b_hi';";
      d_bYES.onmouseover = new Function('F',newAttrOnMouseOver);

      newAttrOnMouseOut  = "this.className='d_b';";
      d_bYES.onmouseout  = new Function('F',newAttrOnMouseOut);

      newAttrOnClick  = "button_YES_onClick('"+id+"','"+variable+"')";
      d_bYES.onclick  = new Function('F',newAttrOnClick);

      d_bYES.className         = 'd_b';
      d_bYES.id                = 'YES';
      if(wIe){
        d_bYES.innerHTML         = '<table style="display:inline; margin-top:1px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconYes+'"/></td><td style="padding-top:2px;">'+buttonYESTxt+'</td></tr></table>';
      }
      else{
        d_bYES.innerHTML         = '<table style="display:inline; margin-top:-2px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconYes+'"/></td><td style="padding-top:2px;">'+buttonYESTxt+'</td></tr></table>';
      }
      d_buttons.appendChild(d_bYES);

      var button_YES           = d_bYES;
      button_YES.name          = variable;
      button_YES.id            = id;
      if(wIe){

      }
      else{

      }
    }

    if(buttons.toLowerCase().indexOf('allways') != '-1') {
      var d_bALLWAYS               = document.createElement('div');

      newAttrOnMouseOver = "this.className='d_b_hi';";
      d_bALLWAYS.onmouseover = new Function('F',newAttrOnMouseOver);

      newAttrOnMouseOut  = "this.className='d_b';";
      d_bALLWAYS.onmouseout  = new Function('F',newAttrOnMouseOut);

      newAttrOnClick  = "button_ALLWAYS_onClick('"+id+"','"+variable+"')";
      d_bALLWAYS.onclick  = new Function('F',newAttrOnClick);

      d_bALLWAYS.className         = 'd_b';
      d_bALLWAYS.id                = 'ALLWAYS';
      if(wIe){
        d_bALLWAYS.innerHTML         = '<table style="display:inline; margin-top:1px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconYes+'"/></td><td style="padding-top:2px;">'+buttonALLWAYSTxt+'</td></tr></table>';
      }
      else{
        d_bALLWAYS.innerHTML         = '<table style="display:inline; margin-top:-2px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconYes+'"/></td><td style="padding-top:2px;">'+buttonALLWAYSTxt+'</td></tr></table>';
      }
      d_buttons.appendChild(d_bALLWAYS);

      var button_ALLWAYS           = d_bALLWAYS;
      button_ALLWAYS.name          = variable;
      button_ALLWAYS.id            = id;
      if(wIe){

      }
      else{

      }
    }

    if (buttons.toLowerCase().indexOf('no') != '-1') {
      var d_bNO               = document.createElement('div');

      newAttrOnMouseOver = "this.className='d_b_hi';";
      d_bNO.onmouseover = new Function('F',newAttrOnMouseOver);

      newAttrOnMouseOut  = "this.className='d_b';";
      d_bNO.onmouseout  = new Function('F',newAttrOnMouseOut);

      newAttrOnClick  = "button_NO_onClick('"+id+"','"+variable+"')";
      d_bNO.onclick  = new Function('F',newAttrOnClick);


      d_bNO.className         = 'd_b';
      d_bNO.id                = 'NO';
      if(wIe){
        d_bNO.innerHTML         = '<table style="display:inline; margin-top:1px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconNo+'"/></td><td style="padding-top:2px;">'+buttonNOTxt+'</td></tr></table>';
      }
      else{
        d_bNO.innerHTML         = '<table style="display:inline; margin-top:-2px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconNo+'"/></td><td style="padding-top:2px;">'+buttonNOTxt+'</td></tr></table>';
      }
      d_buttons.appendChild(d_bNO);

      var button_NO           = d_bNO;
      button_NO.name          = variable;
      button_NO.id            = id;
      if(wIe){

      }
      else{

      }
    }

    if (buttons.toLowerCase().indexOf('ok') != '-1') {
      var d_bOK               = document.createElement('div');

      newAttrOnMouseOver = "this.className='d_b_hi';";
      d_bOK.onmouseover = new Function('F',newAttrOnMouseOver);

      newAttrOnMouseOut  = "this.className='d_b';";
      d_bOK.onmouseout  = new Function('F',newAttrOnMouseOut);

      newAttrOnClick  = "button_OK_onClick('"+id+"','"+variable+"')";
      d_bOK.onclick  = new Function('F',newAttrOnClick);

      d_bOK.className         = 'd_b';
      d_bOK.id                = 'OK';
      if(wIe){
        d_bOK.innerHTML         = '<table style="display:inline; margin-top:1px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconOk+'"/></td><td style="padding-top:2px;">'+buttonOKTxt+'</td></tr></table>';
      }
      else{
        d_bOK.innerHTML         = '<table style="display:inline; margin-top:-2px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconOk+'"/></td><td style="padding-top:2px;">'+buttonOKTxt+'</td></tr></table>';
      }
      d_buttons.appendChild(d_bOK);

      var button_OK           = d_bOK;
      button_OK.name          = variable;
      button_OK.id            = id;
      if(wIe){

      }
      else{

      }
    }

    if (buttons.toLowerCase().indexOf('cancel') != '-1') {

      var d_bCANCEL           = document.createElement('div');

      newAttrOnMouseOver = "this.className='d_b_hi';";
      d_bCANCEL.onmouseover = new Function('F',newAttrOnMouseOver);

      newAttrOnMouseOut  = "this.className='d_b';";
      d_bCANCEL.onmouseout  = new Function('F',newAttrOnMouseOut);

      newAttrOnClick  = "button_CANCEL_onClick('"+id+"','"+variable+"')";
      d_bCANCEL.onclick  = new Function('F',newAttrOnClick);

      d_bCANCEL.className     = 'd_b';
      d_bCANCEL.id            = 'CANCEL';
      if(wIe){
        d_bCANCEL.innerHTML     = '<table style="display:inline; margin-top:1px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconCancel+'"/></td><td style="padding-top:2px;">'+buttonCATxt+'</td></tr></table>';
      }
      else{
        d_bCANCEL.innerHTML     = '<table style="display:inline; margin-top:-2px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconCancel+'"/></td><td style="padding-top:2px;">'+buttonCATxt+'</td></tr></table>';
      }
      d_buttons.appendChild(d_bCANCEL);

      var button_CANCEL       = d_bCANCEL;
      button_CANCEL.name      = variable;
      button_CANCEL.id        = id;
      if(wIe){

      }
      else{

      }
    }

    if (buttons.toLowerCase().indexOf('back') != '-1') {

      var d_bBACK               = document.createElement('div');

      newAttrOnMouseOver = "this.className='d_b_hi';";
      d_bBACK.onmouseover = new Function('F',newAttrOnMouseOver);

      newAttrOnMouseOut  = "this.className='d_b';";
      d_bBACK.onmouseout  = new Function('F',newAttrOnMouseOut);

      newAttrOnClick  = "button_BACK_onClick('"+id+"','"+variable+"')";
      d_bBACK.onclick  = new Function('F',newAttrOnClick);


      d_bBACK.className         = 'd_b';
      d_bBACK.id                = 'BACK';
      if(wIe){
        d_bBACK.innerHTML         = '<table style="display:inline; margin-top:1px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconBACK+'"/></td><td style="padding-top:2px;">'+buttonBACKTxt+'</td></tr></table>';
      }
      else{
        d_bBACK.innerHTML         = '<table style="display:inline; margin-top:-2px; border:0;" cellpadding="0" cellspacing="0"><tr><td><img style="margin-right:3px; margin-top:1px;" src="'+iconBACK+'"/></td><td style="padding-top:2px;">'+buttonBACKTxt+'</td></tr></table>';
      }
      d_buttons.appendChild(d_bBACK);

      var button_BACK           = d_bBACK;
      button_BACK.name          = variable;
      button_BACK.id            = id;
      if(wIe){

      }
      else{

      }
    }

    var pClear              = document.createElement('p');
    pClear.style.clear      = 'both';
    d_buttons.appendChild(pClear);

  isShownDialog = true;
}

function button_OK_onClick(id, value){

  if(wIe){


  }
  else{


  }

  if(parent.frames.length < 1){
    docBody                 = document.body;
    blocker                 = document.getElementById('blocker');
    dialog                  = document.getElementById('dialog');
    iframe                  = document.getElementById('iframe');
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET'){
      if(wIe){
        var docBody                 = document.body;
        var blocker                 = document.getElementById('blocker');
        var dialog                  = document.getElementById('dialog');
        var iframe                  = document.getElementById('iframe');
      }
      else{
        docBody                 = document.body;
        blocker                 = document.getElementById('blocker');
        dialog                  = document.getElementById('dialog');
        iframe                  = document.getElementById('iframe');
      }
    }
    else{
      docBody                 = document.body;
      blocker                 = document.getElementById('blocker');
      dialog                  = document.getElementById('dialog');
      iframe                  = document.getElementById('iframe');
    }
  }

  if(window.removeEventListener){
    window.removeEventListener("scroll", scrollMessageBox, false );
  }
  else if (window.detachEvent){
    document.detachEvent("scroll", scrollMessageBox);
  }

  docBody.removeChild(blocker);
  docBody.removeChild(dialog);
  if(iframe){
    docBody.removeChild(iframe);
  }
  if(wIe && wIeVers < 7){
    docBody.removeChild(document.getElementById('blockerFrame'));
  }
  eval('messagebox_' + id + '_onConfirm("ok","' + value + '")');
  isShownDialog = false;
  isShownMessageBox = false;
}

function button_YES_onClick(id, value){

  if(wIe){


  }
  else{


  }

  if(parent.frames.length < 1){
    docBody                 = document.body;
    blocker                 = document.getElementById('blocker');
    dialog                  = document.getElementById('dialog');
    iframe                  = document.getElementById('iframe');
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET'){
      if(wIe){
        var docBody                 = document.body;
        var blocker                 = document.getElementById('blocker');
        var dialog                  = document.getElementById('dialog');
        var iframe                  = document.getElementById('iframe');
      }
      else{
        docBody                 = document.body;
        blocker                 = document.getElementById('blocker');
        dialog                  = document.getElementById('dialog');
        iframe                  = document.getElementById('iframe');
      }
    }
    else{
      docBody                 = document.body;
      blocker                 = document.getElementById('blocker');
      dialog                  = document.getElementById('dialog');
      iframe                  = document.getElementById('iframe');
    }
  }

  if(window.removeEventListener){
    window.removeEventListener("scroll", scrollMessageBox, false );
  }
  else if (window.detachEvent){
    document.detachEvent("scroll", scrollMessageBox);
  }

  docBody.removeChild(blocker);
  docBody.removeChild(dialog);
  if(iframe){
    docBody.removeChild(iframe);
  }
  if(wIe && wIeVers < 7){
    docBody.removeChild(document.getElementById('blockerFrame'));
  }
  eval ('messagebox_' + id + '_onConfirm("yes","' + value + '")');
  isShownDialog = false;
  isShownMessageBox = false;
}

function button_ALLWAYS_onClick(id, value){

  if(wIe){


  }
  else{


  }

  if(parent.frames.length < 1){
    docBody                 = document.body;
    blocker                 = document.getElementById('blocker');
    dialog                  = document.getElementById('dialog');
    iframe                  = document.getElementById('iframe');
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET'){
      if(wIe){
        var docBody                 = document.body;
        var blocker                 = document.getElementById('blocker');
        var dialog                  = document.getElementById('dialog');
        var iframe                  = document.getElementById('iframe');
      }
      else{
        docBody                 = document.body;
        blocker                 = document.getElementById('blocker');
        dialog                  = document.getElementById('dialog');
        iframe                  = document.getElementById('iframe');
      }
    }
    else{
      docBody                 = document.body;
      blocker                 = document.getElementById('blocker');
      dialog                  = document.getElementById('dialog');
      iframe                  = document.getElementById('iframe');
    }
  }

  if(window.removeEventListener){
    window.removeEventListener("scroll", scrollMessageBox, false );
  }
  else if (window.detachEvent){
    document.detachEvent("scroll", scrollMessageBox);
  }

  docBody.removeChild(blocker);
  docBody.removeChild(dialog);
  if(iframe){
    docBody.removeChild(iframe);
  }
  if(wIe && wIeVers < 7){
    docBody.removeChild(document.getElementById('blockerFrame'));
  }
  eval('messagebox_' + id + '_onConfirm("allways","' + value + '")');
  isShownDialog = false;
  isShownMessageBox = false;
}

function button_CANCEL_onClick(id, value){

  if(wIe){


  }
  else{


  }

  if(parent.frames.length < 1){
    docBody                 = document.body;
    blocker                 = document.getElementById('blocker');
    dialog                  = document.getElementById('dialog');
    iframe                  = document.getElementById('iframe');
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET'){
      if(wIe){
        var docBody                 = document.body;
        var blocker                 = document.getElementById('blocker');
        var dialog                  = document.getElementById('dialog');
        var iframe                  = document.getElementById('iframe');
      }
      else{
        docBody                 = document.body;
        blocker                 = document.getElementById('blocker');
        dialog                  = document.getElementById('dialog');
        iframe                  = document.getElementById('iframe');
      }
    }
    else{
      docBody                 = document.body;
      blocker                 = document.getElementById('blocker');
      dialog                  = document.getElementById('dialog');
      iframe                  = document.getElementById('iframe');
    }
  }

  if(window.removeEventListener){
    window.removeEventListener("scroll", scrollMessageBox, false );
  }
  else if (window.detachEvent){
    document.detachEvent("scroll", scrollMessageBox);
  }

  docBody.removeChild(blocker);
  docBody.removeChild(dialog);
  if(iframe){
    docBody.removeChild(iframe);
  }
  if(wIe && wIeVers < 7){
    docBody.removeChild(document.getElementById('blockerFrame'));
  }
  eval('messagebox_' + id + '_onConfirm("cancel","' + value + '")');
  isShownDialog = false;
  isShownMessageBox = false;
}

function button_NO_onClick(id, value){

  if(wIe){


  }
  else{


  }

  if(parent.frames.length < 1){
    docBody                 = document.body;
    blocker                 = document.getElementById('blocker');
    dialog                  = document.getElementById('dialog');
    iframe                  = document.getElementById('iframe');
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET'){
      if(wIe){
        var docBody                 = document.body;
        var blocker                 = document.getElementById('blocker');
        var dialog                  = document.getElementById('dialog');
        var iframe                  = document.getElementById('iframe');
      }
      else{
        docBody                 = document.body;
        blocker                 = document.getElementById('blocker');
        dialog                  = document.getElementById('dialog');
        iframe                  = document.getElementById('iframe');
      }
    }
    else{
      docBody                 = document.body;
      blocker                 = document.getElementById('blocker');
      dialog                  = document.getElementById('dialog');
      iframe                  = document.getElementById('iframe');
    }
  }

  if(window.removeEventListener){
    window.removeEventListener("onscroll", scrollMessageBox, false );
  }
  else if (window.detachEvent){
    window.detachEvent("onscroll", scrollMessageBox);
  }

  docBody.removeChild(blocker);
  docBody.removeChild(dialog);
  if(iframe){
    docBody.removeChild(iframe);
  }
  if(wIe && wIeVers < 7){
    docBody.removeChild(document.getElementById('blockerFrame'));
  }
  eval('messagebox_' + id + '_onConfirm("no","' + value + '")');
  isShownDialog = false;
  isShownMessageBox = false;
}

function button_BACK_onClick(id, value){

  if(wIe){


  }
  else{


  }

  if(parent.frames.length < 1){
    docBody                 = document.body;
    blocker                 = document.getElementById('blocker');
    dialog                  = document.getElementById('dialog');
    iframe                  = document.getElementById('iframe');
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET'){
      if(wIe){
        var docBody                 = document.body;
        var blocker                 = document.getElementById('blocker');
        var dialog                  = document.getElementById('dialog');
        var iframe                  = document.getElementById('iframe');
      }
      else{
        docBody                 = document.body;
        blocker                 = document.getElementById('blocker');
        dialog                  = document.getElementById('dialog');
        iframe                  = document.getElementById('iframe');
      }
    }
    else{
      docBody                 = document.body;
      blocker                 = document.getElementById('blocker');
      dialog                  = document.getElementById('dialog');
      iframe                  = document.getElementById('iframe');
    }
  }

  if(window.removeEventListener){
    window.removeEventListener("scroll", scrollMessageBox, false );
  }
  else if (window.detachEvent){
    document.detachEvent("scroll", scrollMessageBox);
  }

  docBody.removeChild(blocker);
  docBody.removeChild(dialog);
  if(iframe){
    docBody.removeChild(iframe);
  }
  if(wIe && wIeVers < 7){
    docBody.removeChild(document.getElementById('blockerFrame'));
  }
  eval('messagebox_' + id + '_onConfirm("back","' + value + '")');
  isShownDialog = false;
  isShownMessageBox = false;
}


function wGetParentForm(element){

  var currentElement = element;
  while(currentElement.tagName != 'FORM' && currentElement.tagName != 'BODY'){
    currentElement = currentElement.parentNode;
  }
  return currentElement;
}









function wLoadXmlX(str){

  var domObject = null;

  if(wIe){
    var domObject = new ActiveXObject("MSXML.DomDocument");
    if(!domObject.loadXML(str)){
      throw "wLoadXml Parse error";
    }
  }
  else{
    var domParser = new DOMParser()
    domObject = domParser.parseFromString(str, "text/xml");
  }
  return domObject;
}










function wDomX(){

  this.wGetElementById = function(id, domObject){

    var childs  = domObject.childNodes;
    var element = null;
    if(childs.length > 0){
      for(var i = 0; i < childs.length; i++){
        if(childs[i].nodeName != "SCRIPT" && childs[i].nodeType == 1){

          if(id == childs[i].id){
            return childs[i];
          }
          if(childs[i].hasChildNodes() ){
            element = this.wGetElementById(id, childs[i]);
          }
          if(element != null){
            return element;
          }
        }
      }
    }
    else{
      return element;
    }
  };

  this.wGetElementByName = function(name, domObject){

    var childs  = domObject.childNodes;
    var element = null;
    if(childs.length > 0){
      for(var i = 0; i < childs.length; i++){
        if(childs[i].nodeName != "SCRIPT" && childs[i].nodeType == 1){
          if(name == childs[i].name){
            return childs[i];
          }
          if(childs[i].hasChildNodes() ){
            element = this.wGetElementByName(name, childs[i]);
          }
          if(element != null){
            return element;
          }
        }
      }
    }
    else{
      return element;
    }
  };

  this.wGetFirstChild = function(object){
    if(object == null || typeof object != 'object'){
      return false;
    }
    if(object.firstChild.nodeType != 1){
      return object.firstChild.nextSibling;
    }
    return object.firstChild;
  };

  this.wGetPreviousSibling = function(object){
    if(object == null || typeof object != 'object'){
      return false;
    }
    if(object.previousSibling.nodeType != 1){
      return object.previousSibling.previousSibling;
    }
    return object.previousSibling;
  };

  this.wGetNextSibling = function(object){
    if(object == null || typeof object != 'object'){
      return false;
    }
    if(object.nextSibling != null && object.nextSibling.nodeType != 1){
      return object.nextSibling.previousSibling;
    }
    return object.nextSibling;
  };

  this.wGetParentNodeId = function(parentId, domObject){
    var parentNode = domObject.parentNode;

    while (parentNode != null && parentNode.id != null && parentNode.id != parentId) {
      parentNode = parentNode.parentNode;
    }
    if(parentNode == null){
      return false;
    }
    return parentNode;
  };

  this.wGetParentNodeTagName = function(parent, domObject){

    var parentNode = domObject.parentNode;

    while (parentNode != null && parentNode.tagName != parent) {
      parentNode = parentNode.parentNode;
    }
    if(parentNode == null){
      return false;
    }
    return parentNode;
  };

  this.wGetInputByValue = function(name, value){

    var inputs = document.getElementsByName(name);
    for(var i = 0; i < inputs.length && i < 20; i++){
      if(inputs.item(i).value == value){
        return inputs.item(i);
      }
    }
    return false;
  };

}








function showAllAttributes(obj){
  var attStr;
  var regExp = /funct/i;
  var regExp2 = /Text/i;
  var regExp3 = /^on/i;
  for (var att in obj){

      if (regExp.test(obj[att]) == false && regExp2.test(obj[att]) == false && regExp3.test(obj[att]) == false){
        if(att != 'outerText' && att != 'innerText' && att.indexOf('on' < 0)){
          attStr += att + "=" + obj[att] + "        ";
        }



        alert(att + " = " + obj[att]);
	    }

  }

}









function wGetDirFileToSelect(file){

  if(file.indexOf('http://') == 0 || file.indexOf('https://') == 0  || file.indexOf('ftp://') == 0  || file.indexOf('//') == 0){
    return '/';
  }
  var dirFile = file.replace(/(.*\/)[^\/]*/, '$1');
  return dirFile;
}



function openWin(url, name, width, height, options){


  if(width == ''){
    var regWidth = /width=(\d+)/;
    regWidth.exec(options);
    width = RegExp.$1;
    if(width == ''){
      width = 640;
    }
  }
  else if(width == 'max'){
    width = screen.width;
  }

  if(height == ''){
    var regHeight = /height=(\d+)/;
    regHeight.exec(options);
    height = RegExp.$1;
    if(height == ''){
      height = 480;
    }
  }
  else if(height == 'max'){
    height = screen.height;
  }

  if(!name && !width && !height && !options){
    return window.open(url, name);
  }

  if(!options){
    options = ',resizable=no,scrollbars=no,status=no,location=no';
  }


  var posLeft = (screen.width / 2)  - (width  / 2);
  var posTop  = (screen.height / 2) - (height / 2);
  var rtc = window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);

  if(!rtc){
    var link = document.createElement('A');
    link.href = "javascript:window.open('" + url + "', '', 'width=" + width + ",height=" + height + "');void(0);";
    link.className = 'popupLink';
    link.innerHTML = 'Fenster jetzt öffnen';
    var popupBlockerBox = document.createElement('DIV');
    popupBlockerBox.className = 'wPopupblocker';
    var popupBlockerBoxInner = document.createElement('DIV');
    popupBlockerBoxInner.className = 'popupBlockerInner'

    var textBeforeLink = document.createElement('SPAN');
    textBeforeLink.innerHTML = 'Der Browser hat das Öffnen eines neuen Fensters verhindert!&#160;';

    popupBlockerBoxInner.appendChild(textBeforeLink);

    popupBlockerBox.appendChild(popupBlockerBoxInner);

    popupBlockerBoxInner.appendChild(link);
    document.body.insertBefore(popupBlockerBox, document.body.firstChild);
  }

  return rtc;
}











function wUsersX(id){
  this.id = id;

  this.wShowSelectUsers = function(title, term, maxEntries, group, type, fieldsToSearch, embedMode, projectGroup){
    var url = '/weblication/grid/scripts/wUsermanager.php?action=showmaskselectuser&returnType=object&filterGroupType=organisation&title='+  title +  '&id=' + this.id + '&limit='+ maxEntries +'&mode=public&embedMode=' + embedMode + '&term=' + term + '&group=' + group + '&type=' + type + '&fieldsToSearch=' + fieldsToSearch + '&projectPath=' + projectGroup;
    wOpenWindowX(url, 'wUsersX', 'width=420,height=470');
  }

}











function wGroupsX(id){
  this.id = id;

  this.wShowSelectGroups = function(title, ok_button, term, maxEntries, group, type, embedMode, projectGroup){
    var url = '/weblication/grid/scripts/wUsermanager.php?action=showmaskselectgroup&returnType=object&mode=public&title=' + title + '&ok_button=' + ok_button + '&term=' + term + '&maxEntries=' + maxEntries + '&group=' + group + '&id=' + this.id + '&embedMode=' + embedMode + '&groupType=' + type + '&projectPath=' + projectGroup;
    wOpenWindowX(url, 'wGroupsX', 'width=420,height=320');
  }

}










function wglInputGroupAdmin(input, input_display){

  this.inputObject  = input;
  this.inputId      = input.name;
  this.inputDisplay = input_display;

  this.wGetCaption = function(group, respFuncId){
    var url = null;
    url = '/weblication/grid/scripts/wUsermanager.php?action=getgroupcaption&group=' + group;
    if(url != null){
      wGetUrlAjax(url, eval(respFuncId));
    }
  };

  this.wSetCaption = function(caption){
    if(typeof this.inputDisplay == 'object' && this.inputDisplay != null){
      this.inputDisplay.value = caption;
    }
  };

  this.wSetInputValues = function(userId, caption){
    if(typeof this.inputObject == 'object' && this.inputObject != null){
      this.inputObject.value = userId;
    }
    if(typeof this.inputDisplay == 'object' && this.inputDisplay != null){
      this.inputDisplay.value = caption;
      this.inputDisplay.title = caption;
    }
  };

  this.wGetInputDisplayValue = function(display){
    if(typeof this.inputDisplay == 'object' && this.inputDisplay != null){
      return this.inputDisplay.value;
    }
    return '';
  };

  this.wGetInputDisplay = function(){
    return this.inputDisplay;
  };

}










function wglInputUserAdmin(input, input_display, listObject, imgObject, type, userType, group){

  this.inputObject  = input;
  this.inputId         = input.name;
  this.inputDisplay = input_display;
  this.imgObject    = imgObject;
  this.imgOpen      = '/weblication/grid/gui/wImages/icon_small/open.gif';
  this.imgClose     = '/weblication/grid/gui/wImages/icon_small/close.gif';
  this.listObject     = listObject;
  this.height          = this.listObject.style.height;
  this.listId            = listObject.id;
  this.type             = type;
  this.userType     = userType;
  this.group           = group;
  this.maxEntries   = 10;

  this.wGetObjectList = function(term, maxEntries, respFuncId){
    if(maxEntries != '' && maxEntries != null){
      this.maxEntries = maxEntries;
    }
    if(typeof this.listObject == 'object' && this.listObject != null){
      var url = '/weblication/grid/scripts/wUsermanager.php?action=showmaskselectuserembed&inputId=' + this.inputId + '&limit='+ this.maxEntries +'&embedMode=public&term=' + term + '&group=' + this.group + '&type=' + this.userType + '&fieldsToSearch=firstname,surname,username';
      wGetUrlAjax(url, eval(respFuncId));
    }
  };

  this.wSetObjectList = function(responseStr){
    if(typeof this.listObject == 'object' && this.listObject != null){
      this.listObject.innerHTML = responseStr;
      var countElement = document.getElementById('countUserEntries_'+ this.inputId);
      var countUsers = countElement.innerHTML;
      if(countUsers == 0){
        this.listObject.style.height = 15 + 'px';
      }
      else if(countUsers < this.maxEntries){
        this.listObject.style.height = (15 * countUsers) + 'px';
      }
      else{
        this.listObject.style.height = this.height;
      }
    }
  };

  this.wGetCaption = function(user, respFuncId){
    var url = null;
    url = '/weblication/grid/scripts/wUsermanager.php?action=getuserdisplayname&user=' + user;
    if(url != null){
      wGetUrlAjax(url, eval(respFuncId));
    }
  };

  this.wSetCaption = function(caption){
    if(typeof this.inputDisplay == 'object' && this.inputDisplay != null){
      this.inputDisplay.value = caption;
    }
  };

  this.wSetInputValues = function(userId, caption){
    if(typeof this.inputObject == 'object' && this.inputObject != null){
      this.inputObject.value = userId;
    }
    if(typeof this.inputDisplay == 'object' && this.inputDisplay != null){
      this.inputDisplay.value = caption;
      this.inputDisplay.title = caption;
    }
  };

  this.wToggleList = function(){


  };

  this.wShowObjectList = function(){
    var dom = new wDomX()
    var prevSib = dom.wGetPreviousSibling(this.listObject);
    var childNodes = prevSib.childNodes;
    var height = -1;
    for(var i = 0; i < childNodes.length; i++){
      height = height + childNodes.item(i).clientWidth;
    }

    this.listObject.style.width = height + 'px';
    this.listObject.style.display = 'block';
  };

  this.wGetInputDisplayValue = function(display){
    if(typeof this.inputDisplay == 'object' && this.inputDisplay != null){
      return this.inputDisplay.value;
    }
    return '';
  };

  this.wGetInputDisplay = function(){
    return this.inputDisplay;
  };

  this.wGetListObject = function(){
    return this.listObject;
  };

  this.wResetInputs = function(caption){
    if(typeof this.inputDisplay == 'object' && this.inputDisplay != null){
      this.inputDisplay.value = '';
    }
    if(typeof this.inputObject == 'object' && this.inputObject != null){
      this.inputObject.value = '';
    }
  };
}








function wSelectMultipleX(id){
  this.id     = id;
  this.object = null;

  this.wSetStateByValue = function(value, state){
    this.object = document.getElementById(this.id);
    if(typeof this.object == 'object' && this.object.tagName == 'SELECT' && this.object.type == 'select-multiple'){
      if(this.object.options.length == 0){
        return false;
      }
      for(var i = 0; i < this.object.options.length; i++){
        if(this.object.options[i].value == value){
          if(wIe){
            this.object.options[i].setAttribute("selected", state);
          }
          else{
            this.object.options[i].selected = state;
          }
          return true;
        }
      }
    }
    return false;
  };

  this.wValueIsSet = function(value){
    this.object = document.getElementById(this.id);
    if(typeof this.object == 'object' && this.object.nodeName == 'SELECT'){
      for(var i = 0; i < this.object.options.length; i++){
        if(this.object.options[i].value == value && this.object.options[i].selected == true){
          return true;
        }
      }
    }
    return false;
  };

  this.wGetIndex = function(value){
    this.object = document.getElementById(this.id);
    if(typeof this.object == 'object' && this.object.nodeName == 'SELECT'){
      for(var i = 0; i < this.object.options.length; i++){
        if(this.object.options[i].value == value){
          return i;
        }
      }
    }
    return false;
  };

  this.wAddOption = function(value, text){
    this.object = document.getElementById(this.id);
    if(typeof this.object == 'object' && this.object.nodeName == 'SELECT'){
      var option = document.createElement("option");
      this.object.appendChild(option);
      this.object.options[this.object.options.length - 1].value = value;
      this.object.options[this.object.options.length - 1].appendChild(document.createTextNode(text));
      return true;
    }
    return false;
  };

  this.wDeleteOption = function(value){
    this.object = document.getElementById(this.id);
    if(typeof this.object == 'object' && this.object.tagName == 'SELECT'){
      for(var i = 0; i < this.object.options.length; i++){
        if(this.object.options[i].value == value){
          this.object.options[i].parentNode.removeChild(this.object.options[i]);
          return true;
        }
      }
    }
    return false;
  };
}










function wShowLanguageVersionX(langVersion, redirectUrl){

  var url = '/weblication/grid/scripts/wSystem.php?action=showLanguageVersion&redirectUrl=' + decodeURI(redirectUrl) + '&langVersion=' + langVersion;
  location.href = url;
}










function wSetSelectDisplayValueX(selectObject, inputObject){

  if(typeof selectObject == 'object' && typeof inputObject == 'object'){
    if(selectObject.nodeName == 'SELECT' && inputObject.nodeName == 'INPUT'){
      inputObject.value = selectObject.options[selectObject.selectedIndex].text;
    }
  }
}









function wLockContextMenueX(){

  return false;
}









function wValidateFormElementX(formObject, id, type, required){

  if(typeof formObject == 'object' && formObject.nodeName == 'FORM'){
    var result = true;
    if(required == 1){
      if(type == 'checkbox' && !formObject.elements[id].checked){
        result = false;
      }
      else if(type == 'radio'){
        var isSet = false;
        if(formObject.elements[id].nodeName == 'INPUT' && formObject.elements[id].checked){
          isSet = true;
        }
        else{
          for(var i = 0; i < formObject.elements[id].length && !isSet; i++){
            if(formObject.elements[id][i].checked){
              isSet = true;
            }
          }
        }
        result = isSet;
      }
      else if(formObject.elements[id].value.replace(/^\s+|\s+$/, '') == ''){
        result = false;
      }
    }
    if(!wValidateFormElementTypeX(formObject, id, type) && (formObject.elements[id].value != '' || type == 'calendarSelect')){
      result = false;
    }

    var classNameObject = null;
    if(type == 'select' || type == 'calendarSelect'){
      classNameObject = 'wglSelectOk';
    }
    else if(type == 'calendar' || type == 'calendarClock'){
      classNameObject = 'wglInputCalendar';
    }
    else if(type == 'radio'){
      classNameObject = 'wglRadiobuttonOk';
    }
    else if(type == 'checkbox'){
      classNameObject = 'wglInputCheckbox';
    }
    else{
      classNameObject = 'wglInputOk';
    }

    if(!result){
      if(type == 'select' || type == 'calendarSelect'){
        classNameObject = 'wglSelectError';
      }
      else if(type == 'radio'){
        classNameObject = 'wglRadiobuttonError';
      }
      else{
        classNameObject = 'wglInputError';
      }
    }

    if(type == 'checkbox'){
      formObject.elements[id].parentNode.className = formObject.elements[id].parentNode.className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
    }
    else if(type == 'radio'){
      for(var i = 0; i < formObject.elements[id].length; i++){
        formObject.elements[id][i].className = formObject.elements[id][i].className.replace(/\swglRadiobuttonError|\swglInputError|\swglSelectError|\swglRadiobuttonOk|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
      }
    }
    else if(type == 'calendarSelect'){
      formObject.elements['day_' + id].className = formObject.elements['day_' + id].className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
      formObject.elements['month_' + id].className = formObject.elements['month_' + id].className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
      formObject.elements['year_' + id].className = formObject.elements['year_' + id].className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
    }
    else if(formObject.elements[id + '_display'] && formObject.elements[id + '_display'].type != 'hidden'){
      formObject.elements[id + '_display'].className = formObject.elements[id].className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
    }
    else if(formObject.elements['display_' + id] && formObject.elements['display_' + id].type != 'hidden'){
      formObject.elements['display_' + id].className = formObject.elements['display_' + id].className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
    }
    else{
      formObject.elements[id].className = formObject.elements[id].className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + classNameObject;
    }
    return result;
  }
  return false;
}









function wValidateFormElementTypeX(formObject, id, type){
  if(type == 'email'){
    var value   = formObject.elements[id].value;
    if(value.search(/([a-zA-Z0-9\.\-_]+@[a-zA-Z0-9][a-zA-Z0-9\.-]*\.\w\w+)/) != 0){
      return false;
    }
    else if(RegExp.$1.length != value.length){
      return false;
    }
  }
  else if (type == 'calendarSelect'){
    return wValidateCalendarSelectX(id);
  }
  return true;
}










function wValidateCalendarSelectX(id){
  var day = document.getElementsByName('day_' + id)[0].value;
  var month = document.getElementsByName('month_' + id)[0].value;
  var year = document.getElementsByName('year_' + id)[0].value;
  if((day == '' || month == '' || year == '' || year < 1901) && (day != '' || month != '' || year != '')){
    return false;
  }
  return true;
}










function wAddErrorClass(object, className){
  if(typeof object == 'object' && object != null){
    object.className = object.className.replace(/\swglInputError|\swglSelectError|\swglInputOk|\swglSelectOk/, "") + " " + className;
  }
}









function wHideMessageboxX(){
  hideMessagebox();
}









function hideMessagebox(){

  if(parent.frames.length < 1){
    docBody                 = document.body;
    blocker                 = document.getElementById('blocker');
    dialog                  = document.getElementById('dialog');
  }
  else{
    if(parent.document.body.tagName != 'FRAMESET'){
      if(ie){
        var docBody                 = document.body;
        var blocker                 = document.getElementById('blocker');
        var dialog                  = document.getElementById('dialog');
      }
      else{
        docBody                 = document.body;
        blocker                 = document.getElementById('blocker');
        dialog                  = document.getElementById('dialog');
      }
    }
    else{
      docBody                 = document.body;
      blocker                 = document.getElementById('blocker');
      dialog                  = document.getElementById('dialog');
    }
  }


  if(blocker){
    docBody.removeChild(blocker);
  }
  if(dialog){
    docBody.removeChild(dialog);
  }
  if(ie && ieVers < 7){
  	docBody.removeChild(document.getElementById('blockerFrame'));
  }
  clickEvents = new Array();

  isShownDialog = false;
  isShownMessageBox = false;
}
