window.onload    = documentLoaded;
window.onkeydown = keyPressed;
window.onresize  = windowOnresize;






var ns  = (document.layers) ? 1 : 0;
var ie  = (document.all) ? 1 : 0;
var dom = (document.getElementById) ? 1 : 0;
var mac = (navigator.platform.indexOf("Mac") != -1) ? 1 : 0;
var gecko     = (navigator.userAgent.indexOf("Gecko") != -1) ? 1 : 0;
var geckoVers = parseFloat(navigator.userAgent.replace(/.*rv:(\d+\.\d+).*/, '$1'));
var ieVers    = navigator.appVersion.substring(navigator.appVersion.lastIndexOf("MSIE") + 4,navigator.appVersion.lastIndexOf("MSIE") + 8);

var queryString = document.location.search;

if(gecko && geckoVers < 1.8){
 document.write('<style> .windowRegisterInner        {border-bottom:solid 1px #a0a0a0;}</style>');
}

var extension = 'cgi';
if(document.location.href.indexOf('cgi-php') >= 0 && document.location.href.indexOf('.php') >= 0){
  extension = 'php';
}

var isInline =  0;
if(window.name == 'wEditorInline'){
  isInline = 1;
}

if(self == top){
  self.focus();
}

if(isInline == 1){document.write('<link rel="stylesheet" type="text/css" href="/weblication/wEditor/wGui/wStyles/style_inline.css">');}




function toogleImage(ImgObj){
  var imageSrc    = document.images[ImgObj].src;
  var isHightlighted = /_h\./;
  if (isHightlighted.test(imageSrc) != true){
    document.images[ImgObj].src = imageSrc.replace(/^(.*[\\|\/])([^\.]*)(\..*)$/, '$1$2' + '_h' + '$3');
  }
  else{
    document.images[ImgObj].src = imageSrc.replace(/^(.*[\\|\/])([^\.]*)(_h)(\..*)$/, '$1$2$4');
  }
}






function getParam(name) {
  var value = '';
  if(document.location.search != ''){
    var hasParam = eval('/' + name + '=([^\&]+)/i');
    if(hasParam.test(queryString) == true){
      value = RegExp.$1;
    }
  }
  return decodeURIComponent(value);
}






function setParam(url, name, value) {
  var hasParam = eval('/' + name + '=([^\&]+)/i');
  if(hasParam.test(queryString) == true){
    var replaceParam = eval('/' + name + '=([^\&]+)/i');
    url = url.replace(replaceParam, name + '=' + value);
  }
  else{
    url = url + '&' + name + '=' + value;
  }
  return url;
}






function getParamStr(str, name) {
  var value = '';
  if(str != ''){
    var hasParam = eval('/' + name + '=([^\&]+)/i');
    if(hasParam.test(str) == true){
      value = RegExp.$1;
    }
  }
  return value;
}






function mouseOverWButtonDialog(button) {
  button.className = 'wButtonOver';
}






function mouseOutWButtonDialog(button) {
  button.className = 'wButton';
}






function mouseOverButtonDialogSmart(button) {
  button.className = 'buttonDialogSmartMo';
}






function mouseOutButtonDialogSmart(button) {
  button.className = 'buttonDialogSmart';
}






function mouseOverButtonForm(button) {
  button.className = 'buttonFormMo';
}






function mouseOutButtonForm(button) {
  button.className = 'buttonForm';
}






function mouseOverButtonMain(button){
  button.className = 'buttonMainMo';
}






function mouseOutButtonMain(button) {
  button.className = 'buttonMain';
}






function mouseOverButtonRegister(button) {
  button.className = 'registerMo';
}






function mouseOutButtonRegister(button) {
  button.className = 'register';
}






function mouseOverButtonRegisterSub(button) {
  button.className = 'registerSubMo';
}






function mouseOutButtonRegisterSub(button) {
  button.className = 'registerSub';
}






function mouseOverButtonDialog(button) {
  button.className = 'buttonDialogMo';
}






function mouseOutButtonDialog(button) {
  button.className = 'buttonDialog';
}






function mouseOverButtonStatus(button) {
  button.className = 'buttonStatusMo';
}






function mouseOutButtonStatus(button) {
  button.className = 'buttonStatus';
}






function mouseOverButton(button) {
  button.className = 'buttonWysiwygMo';
}






function mouseOutButton(button) {
  button.className = 'buttonWysiwyg';
}






function mouseOverCell(cell) {
  if(!mac){
    cell.className='cellMo';
  }
}






function mouseOutCell(cell) {
  if(!mac){
    cell.className='cell';
  }
}






function mouseOverObjectCell(cell) {
  if(!mac){
    cell.className='objectCellMo';
  }
}






function mouseOutObjectCell(cell) {
  if(!mac){
    cell.className='objectCell';
  }
}






function mouseOverObjectFunction(img) {
  img.className='imgObjectFunctionMo';
}






function mouseOutObjectFunction(img) {
  img.className='imgObjectFunction';
}






function mouseOverButtonWysiwyg(button){
  button.className = 'buttonWysiwygMo';
}






function mouseOutButtonWysiwyg(button){

  if(button.getAttribute('wIsActive') != '1'){
    button.className = 'buttonWysiwyg';
  }
}








function showLayer(layerId, positionX, positionY){

   if(layerId == ""){
     return;
   }

	if(ie){
		if(document.all[layerId]){
			document.all[layerId].style.visibility = 'visible';
            if(positionX){
              document.all[layerId].style.left = positionX;
            }
            if(positionY){
              document.all[layerId].style.top = positionY;
            }
		}
	}
	else if(ns){
		if(document.layers[layerId]){
			document.layers[layerId].visibility = 'visible';
            if(positionX){
              document.layers[layerId].style.left = positionX;
            }
            if(positionY){
              document.layers[layerId].style.top = positionY;
            }
		}
	}
	else if(dom){
		if(document.getElementById(layerId)){
			document.getElementById(layerId).style.visibility = 'visible';
            if(positionX){
              document.getElementById(layerId).style.left = positionX;
            }
            if(positionY){
              document.getElementById(layerId).style.top = positionY;
            }
		}
	}
}








function setClassName(elementId, className){

   if(elementId == ""){
     return;
   }

	if(ie){
      if(document.all[elementId]){
        document.all[elementId].className = className;
      }
	}
	else if(dom){
	  if(document.getElementById(elementId)){
		document.getElementById(elementId).className = className;
      }
	}
}








function hideLayer(layerId){

   if(layerId == ""){
     return;
   }

	if(ie){
		if(document.all[layerId]){
			document.all[layerId].style.visibility = 'hidden';
		}

	}
	else if(ns){
		if(document.layers[layerId]){
			document.layers[layerId].visibility = 'hide';
		}
	}
	else if(dom){
		if(document.getElementById(layerId)){
			document.getElementById(layerId).style.visibility = 'hidden';
		}
	}
}










function isVisibleLayer(layerId){

	if(ie){
		if(document.all[layerId].style.visibility == 'visible'){
			return 1;
		}
		else{
			return 0;
		}
	}
	else if(ns){
		if(document.layers[layerId].visibility == 'visible'){
			return 1;
		}
		else{
			return 0;
		}
	}
	else if(dom){
		if(document.getElementById(layerId).style.visibility == 'visible'){
			return 1;
		}
		else{
			return 0;
		}
	}
}








function showLayerFrame(frame, layerId){

   if(layerId == ""){
     return;
   }

	if(ie){
		if(frames[frame].document.all[layerId]){
			frames[frame].document.all[layerId].style.visibility = 'visible';
		}
	}
	else if(ns){
		if(frames[frame].document.layers[layerId]){
			frames[frame].document.layers[layerId].visibility = 'visible';
        }
	}
	else if(dom){
		if(frames[frame].document.getElementById(layerId)){
			frames[frame].document.getElementById(layerId).style.visibility = 'visible';

		}
	}
}








function showLayerParent(layerId){

   if(layerId == ""){
     return;
   }

	if(ie){
		if(parent.document.all[layerId]){
			parent.document.all[layerId].style.visibility = 'visible';
		}
	}
	else if(ns){
		if(parent.document.layers[layerId]){
			parent.document.layers[layerId].visibility = 'visible';
    }
	}
	else if(dom){
		if(parent.document.getElementById(layerId)){
			parent.document.getElementById(layerId).style.visibility = 'visible';
		}
	}
}












function checkMask(windObject, maskName){

  if(windObject.maskName){
    if(windObject.maskName == maskName){
      return 1;
    }
  }
  return 0;
}


function showProgressbar(){
  showLayer("progressBar");
  showLayer("actionBlocker");
}

function hideProgressbar(){
  hideLayer("progressBar");
  hideLayer("actionBlocker");
}

function adaptClassSizeCss(className){
  var winWidth  = 800;
  var winHeight = 600;

  if(ie){
    winWidth  = document.body.clientWidth;
    winHeight = document.body.clientHeight;
  }
  else{
    winWidth  = window.innerWidth;
    winHeight = window.innerHeight;
  }
  document.writeln('<style>.' + className + ' {height:' + (winHeight - 100) + 'px;}</style>');
}

function adaptClassSizeCssDiff(className, diffWidth, diffHeight){
  var winWidth  = 800;
  var winHeight = 600;

  if(ie){
    winWidth  = document.body.clientWidth;
    winHeight = document.body.clientHeight;
  }
  else{
    winWidth  = window.innerWidth;
    winHeight = window.innerHeight;
  }
  if(diffHeight && diffHeight != ""){
    document.writeln('<style>.' + className + ' {height:' + (winHeight - diffHeight) + 'px;}</style>');
  }
  if(diffWidth && diffWidth != ""){
    document.writeln('<style>.' + className + ' {width:' + (winWidth - diffWidth) + 'px;}</style>');
  }
}

function adaptClassPositionTopDiff(className, diffTop){
  var winHeight = 600;

  if(ie){
    winHeight = document.body.clientHeight;
  }
  else{
    winHeight = window.innerHeight;
  }

  document.writeln('<style>.' + className + ' {top:' + (winHeight - diffTop) + 'px;}</style>');
}


function adaptElementPositionTopDiff(elementId, diffTop){

  var winHeight = 600;

  if(ie){
    winHeight = document.body.clientHeight;
  }
  else{
    winHeight = window.innerHeight;
  }
  var element = document.getElementById(elementId);
  if(element){
    element.style.top = (winHeight - diffTop);
  }
}

 function closeEditorPopup(){
   if(top == self){self.close();}
 }


function setOverflowAuto(className){

  document.writeln('<style>.' + className + ' {overflow:auto}</style>');

}








function displayElement(elementId){

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








function hideElement(elementId){

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

function getUrlReload(){
  var urlReload = location.href;
  urlReload = urlReload.replace(/\&reloadid=\d+/, '');
  var dateObj = new Date();
  urlReload += '&reloadid=' + dateObj.getTime();
  return urlReload;
}



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 wOpenWindow(url, name, width, height, options, widthMax, heightMax){

  url = url.replace(/&amp;/g, '&');
  name = name.replace(/\.|-|\//g, '');    
  
  if(!name && !width && !height && !options){
    window.open(url, name);
  }

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

  
  if(typeof widthMax != 'undefined'){ 
    var posLeft = (screen.width / 2)  - (widthMax  / 2);  
  }
  else{
    var posLeft = (screen.width / 2)  - (width  / 2);  
  }
  
  if(typeof heightMax != 'undefined'){
    var posTop  = (screen.height / 2) - (heightMax / 2);    
  }
  else{
    var posTop  = (screen.height / 2) - (height / 2);    
  }  
  
  window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
}



function wPopUp(url, width, height){
	var name = '';
	
	if(width == '' || width == ' '){
		width = 786;
	}
	if(height == '' || height == ' '){
		height = 677;
	}
	url = url.replace(/&amp;/g, '&');
	options = ',location=no, menubar=no,toolbar=no,resizable=no,scrollbars=no,status=no';
  width 	= parseInt(width);
  height 	= parseInt(height);

  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 wOpenImageAdaptSize(url){

	var name = '';
	var path = '/weblication/grid/scripts/wImage.php?action=getImageSize&path='+url;
	curImageUrl = url;
	getUrl(path, wOpenImageAdaptSizeResponse);
}

function wOpenImageAdaptSizeResponse(response){
	
	var name = '';
	var size = response;
	if(response == ''){
		size = 'width="800" height="600"';
	}
	
	var regex = /(?:")(\d+?)(?:").*(?:")(\d+?)(?:")/;
	var match = size.match(regex);
	
	if(match){
		width 	= match[1];
		height 	= match[2];	
	}
	else{
		width 	= 800;
		height 	= 600;
	}
	
	curImageUrl = curImageUrl.replace(/&amp;/g, '&');
	options = ',location=no, menubar=no,toolbar=no,resizable=no,scrollbars=no,status=no';
  width 	= parseInt(width);
  height 	= parseInt(height);

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

var request;

var wGetUrlFunctionResult;

if(typeof resultFunctions == 'undefined'){

var resultFunctions = new Array();
var requests        = new Array();

}











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













function getUrlPost(url, postStr, functionResult){
  
  var requestObject = new wRequestObjectPost(url, postStr, functionResult);
    
}











function wRequestObject(url, functionResult){
  
  if(typeof functionResult == 'function'){
    var id              = resultFunctions.length;
    this.request        = null;

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


    requests.push(this.request);
    this.request.open('GET', url, true);
    
    this.request.onreadystatechange = function(){
      if(typeof requests != 'undefined'){
        var requestObject = requests[id];
        if(requestObject.readyState == 4){
          if(requestObject.status == '200'){
            resultFunctions[id](requestObject.responseText);
          }
        }
      }
    }
    
    this.request.send('');
    
  }
}











function wRequestObjectPost(url, postStr, functionResult){
  
  if(typeof functionResult == 'function'){
    var id              = resultFunctions.length;
    this.request        = null;

    if(document.all){
      this.request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
      this.request = new XMLHttpRequest();
    }
    
    resultFunctions.push(functionResult);
  
    requests.push(this.request);
    this.request.open('POST', url, true);
    this.request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    this.request.setRequestHeader("Content-length", postStr.length);
    this.request.setRequestHeader("Connection", "close");    
    
    this.request.onreadystatechange = function(){
      if(typeof requests != 'undefined'){
        var requestObject = requests[id];
        if(requestObject.readyState == 4){
          if(requestObject.status == '200'){
            resultFunctions[id](requestObject.responseText);
          }
        }
      }
    }
    
    this.request.send(postStr);
    
  }
}













if(typeof responseObjects == 'undefined'){

  var responseObjects = new Array();
  var rspObjRequests  = new Array();

}

function getUrlResponseObject(callId, url, responseHandler, functionResult){
  var requestObject = new wRequestObjectResponseObject(callId, url, responseHandler, functionResult);
}











function wRequestObjectResponseObject(callId, url, responseObject, functionResult){

  if(typeof responseObject == 'object' && responseObject != null){
    var id              = responseObjects.length;
    this.request        = null;

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

    responseObjects.push(responseObject);
    rspObjRequests.push(this.request);
    this.request.open('GET', url, true);
    
    this.request.onreadystatechange = function(){
      if(typeof rspObjRequests != 'undefined'){      
        var requestObject = rspObjRequests[id];
        if(requestObject.readyState == 4){
          if(requestObject.status == '200'){
            responseObjects[id].response(callId, requestObject.responseText, functionResult);
          }
        }
      }
    }

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









function getStatusSoap(soapStr){

  if(soapStr.indexOf('<w:status>1</w:status>') > -1){
    return 1;
  }
  else{
    return 0;
  }
}









function getFaultCode(soapStr){

  var searchFaultCode = soapStr.search(/<faultcode>(.*)<\/faultcode>/);
  
  if(searchFaultCode > -1){

    return RegExp.$1
  }
  else{
    return 0;
  }
}








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(attStr);
}







function EventUtils() {
  throw 'RuntimeException: EventUtils is a static utility class ' +
  ' and may not be instantiated';
}

EventUtils.addEventListener = function (target,type,callback,captures) {
  if (target.addEventListener) {
    target.addEventListener(type,callback,captures);
	}
  else if (target.attachEvent) {
	 target.attachEvent('on'+type,callback,captures);
	}
  else{
    target['on'+type] = callback;
	}
}









function keyPressed(e){
  
  if(typeof window_onKeyDown == 'function'){
    window_onKeyDown((window.Event) ? e.which : event.keyCode);
    return;
  }
}











function wSetElementValue(nodeObject, attributeValue){
  if (attributeValue){
	  if (nodeObject.tagName == 'SELECT'){
	    for (var i=0; i < nodeObject.options.length; i++){
	     if(nodeObject.options[i].value == attributeValue){
	       nodeObject.options[i].selected=true;
	     }
	    }
	  }
	  else{
	   nodeObject.value = attributeValue;
	  }
	}
	else {
	  if (nodeObject.tagName == 'SELECT'){
	    for (var i=0; i < nodeObject.options.length; i++){
	      nodeObject.options[i].selected=false;
	    }
	  }
	  else{
	   nodeObject.value = '';
	  }
	}
}











function wGetElementValue(nodeObject, append){
  if(nodeObject){
    var value;
    if(nodeObject.tagName == 'SELECT'){
      value = nodeObject.options[nodeObject.selectedIndex].value;
    }
    else{
      value = nodeObject.value;
    }
    if(append){
      if(parseInt(value) == value){
        value = String(value) + append;
      }
    }
    return value;
  }
}











function wGetTagObjAttributeValue(tagObj, attributeName){

	if(tagObj && tagObj.tagName){
	  if(attributeName == 'class'){
	    var attributeValue = tagObj['className'];
	  }
	  else{
	    if(attributeName == 'href'){
        var attributeValue = tagObj.getAttribute(attributeName,'2');  
	    }
	    else if(tagObj.getAttribute(attributeName+'_fckprotectedatt')){
	      var attributeValue = tagObj.getAttribute(attributeName+'_fckprotectedatt');
	    }	    
      else if(attributeName == 'onclick'){
        var attributeValue = tagObj.getAttribute(attributeName);
      }
	    else{
        var attributeValue = tagObj.getAttribute(attributeName);
	    }

    }
    return attributeValue;
  }
  else{
    return '';
  }
}











function wGetTagStrAttributeValue(tagStr, attributeName){

  var attributeValue = '';
  eval('var attribute = /' + attributeName + '="([^"]*)"/');

  if(tagStr.match(attribute)){
    attributeValue = RegExp.$1;
  }
  return attributeValue;
}











function wGetTagObjStyleValue(tagObj, styleName){

	if(tagObj){
    return tagObj.style[styleName];
  }
  else{
    return '';
  }
}











function wGetTagStrStyleValue(tagStr, styleName){
  styleStr   = wGetTagStrAttributeValue(tagStr, 'style');
  styleValue = wGetStyleStrStyleValue(styleStr, styleName);
  return styleValue;
}











function wGetStyleStrStyleValue(styleStr, styleName){

  var hasStyle = 0;
  var evalStr = 'if(styleStr.match(/;\\s*' + styleName + ':\\s*([^;]*)/))hasStyle = 1;';

  eval(evalStr);
  if(hasStyle == 1){
    return RegExp.$1;
  }
  else{
    var evalStr = 'if(styleStr.match(/^' + styleName + ':\\s*([^;]*)/))hasStyle = 1;';

    eval(evalStr);
    if(hasStyle == 1){
      return RegExp.$1;
    }
    else{
      return "";
    }
  }
  return "";
}













function wSetTagStrStyleValue(pictureOuterHtml, styleName, styleValue){

  if (styleValue != ''){
	  if (wGetTagStrAttributeValue(pictureOuterHtml, 'style') == ''){
      eval("pictureOuterHtml = wSetTagStrAttributeValue(pictureOuterHtml, 'style', '" + styleName + ": " + styleValue + ";')");
	  }
	  else {
	    styleStr = wGetTagStrAttributeValue(pictureOuterHtml, 'style');
	    eval("styleStr = styleStr.replace(/"+styleName+" *[^;]*;*/, '')");
	    styleStr = styleStr + styleName + ":" + styleValue +";"
	    eval("pictureOuterHtml = wSetTagStrAttributeValue(pictureOuterHtml, 'style', '" + styleStr + "')");
	  }
	}
	else {
	  if (wGetTagStrAttributeValue(pictureOuterHtml, 'style') == ''){
      var evalStr = "pictureOuterHtml = wClearTagStrAttribute(pictureOuterHtml, 'style')";
      eval(evalStr);
	  }
	  else {
	    styleStr = wGetTagStrAttributeValue(pictureOuterHtml, 'style');
	    eval("styleStr = styleStr.replace(/(<\w+)"+styleName+" *[^;]*;*/, '')");
	    eval("pictureOuterHtml = wSetTagStrAttributeValue(pictureOuterHtml, 'style', '" + styleStr + "')");
	  }
  }
  return pictureOuterHtml;
}













function wSetAttributeObject(tagObj, attributeName, attributeValue){
  
  if(ie && attributeName == 'class'){
    attributeName = 'className';
  }  
  
  if(attributeValue != ''){
    if(tagObj.getAttribute(attributeName+'_fckprotectedatt')){
      tagObj.removeAttribute(attributeName+'_fckprotectedatt', '');      
      tagObj.setAttribute(attributeName, attributeValue);
    }	     
    else if (attributeName == 'class'){
      tagObj['className'] = attributeValue;
    }
    else if (attributeName == 'whref'){
      tagObj.setAttribute('whref', attributeValue);
    }
    else if (attributeName == 'wsrc'){
      tagObj.setAttribute('wsrc', attributeValue);
    }   
    else if (attributeName == '_fcksavedurl'){
      tagObj.setAttribute('_fcksavedurl', attributeValue);
    }       
    else if(attributeName == 'onclick'){
      tagObj.setAttribute('onclick', attributeValue);

    }
    else{
      tagObj[attributeName] = attributeValue;
    }
  }
  else{
    tagObj.removeAttribute(attributeName);
  }

}













function wSetStyleObject(tagObj, styleName, styleValue){

  tagObj.style[styleName] = styleValue;
}













function wSetTagStrAttributeValue(tagStr, attributeName, attributeValue){
  
  if(attributeValue != ''){
	  var evalStr = 'var attribute = / ' + attributeName + '="[^"]*"/';
	  eval(evalStr);
	  if(tagStr.match(attribute)){
	    tagStr = tagStr.replace(attribute, ' ' + attributeName + '="' + attributeValue + '"');
	  }
	  else{
	    tagStr = tagStr.replace(/(<\w+)/, '$1 ' + attributeName + '="' + attributeValue + '"');
	  }
  }
  else{
    var evalStr = "tagStr = wClearTagStrAttribute(tagStr, '" + attributeName + "')";
    eval(evalStr);
  }
  return tagStr;
}











function wClearTagStrAttribute(tagStr, attributeName){

  eval('var attribute = / ' + attributeName + '="[^"]*"/');
  if(tagStr.match(attribute)){
    tagStr = tagStr.replace(attribute, '');
  }
  return tagStr;
}









function documentLoaded(){
  if(typeof document_onLoad == 'function'){
    document_onLoad();
  }
}









function windowOnresize(){
  if(typeof window_onResize == 'function'){
    window_onResize();
  }
}









function embedString(elementId, string){
  string   = string.replace(/[\n\r]+/g, '~_wnl_~');
  string   = string.replace(/= function/g, '~_wfunc_~');
  string   = string.replace(/= 'function'/g, '~_wfuncext_~');
  string   = string.replace(/= "function"/g, '~_wfuncext_~');
  
  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;
  }
  
  jsString     = jsString.replace(/~_wnl_~/g, "\n");

  string = string.replace(/~_wnl_~/g, "\n");
  string = string.replace(/~_wfuncext_~/g, "= 'function'");
  var jsFunctions = jsString.split(/function\s*/);

   
  
  for(var i = 1; i < jsFunctions.length; i++){
    if(jsFunctions[i] != ''){
      jsFunctions[i] = jsFunctions[i].replace(/~_wfunc_~/g, "= function");
      jsFunctions[i] = jsFunctions[i].replace(/~_wfuncext_~/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;
}









function embedStringIntoObject(element, string){

  string   = string.replace(/[\n\r]+/g, '~_wnl_~');
  string   = string.replace(/= function/g, '~_wfunc_~');
  string   = string.replace(/= 'function'/g, '~_wfuncext_~');
  string   = string.replace(/= "function"/g, '~_wfuncext_~');
  
  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;
  }
  
  jsString     = jsString.replace(/~_wnl_~/g, "\n");

  string = string.replace(/~_wnl_~/g, "\n");
  string = string.replace(/~_wfuncext_~/g, "= 'function'");
  var jsFunctions = jsString.split(/function\s*/);

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









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 validateSource(htmlStr){

  htmlStr = htmlStr.replace(/[\n\r\t]*/g, '');
  htmlStr = htmlStr.replace(/\w+:/g, '');
  htmlStr = htmlStr.replace(/<!--.*?(-->)/g, '');
  htmlStr = htmlStr.replace(/<![^>]*>/g, '');
  htmlStr = htmlStr.replace(/<\?.*?(\?>)/g, '');
  htmlStr = htmlStr.replace(/[\w-:]+="[^"<>]*"\s*/g, '');
  htmlStr = htmlStr.replace(/<\w+[^<>]*\/>/g, '');

  htmlStr = htmlStr.replace(/[\w-]+="[^<>"]*"/g, '');

  var i = 0;

  while(htmlStr != '' && i < 16){
    htmlStr = htmlStr.replace(/<[\w-]+\s*>[^<]*<\/[\w-]+>/g, '');
    i++;
  }

  if(htmlStr == ''){
    return true;
  }

  return false;
}









function wLoadXml(str){

  var domObject = null;

  if(ie){
    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 getElementOfForm(form, name){
  
  if(form.elements[name]){
    return form.elements[name];
  }
  else{
    for(var i = 0; i < form.length; i++){
      if(form.elements[i]){
        return form.elements[i];
      }  
    }
  }
  return false;
}

function logActionHelper(object, action, data){
  
  helper = null
  
  if(top.logAction){
    helper = top;
  }
  else if(top.opener && top.opener.logAction){
    helper = top.opener;
  }    
  else if(top.opener && top.opener.top.opener && top.opener.top.opener.logAction){
    helper = top.opener.top.opener;
  }    
  if(helper){
    helper.logAction(object + action + data);
  }
}
function showHelper(){
  var helperFragment = document.createElement('div');
  helperFragment.style.position = 'absolute';
  var helperImage    = document.createElement('img');
  helperImage.src = '/helper.gif';
  helperFragment.appendChild(helperImage);
  document.body.insertBefore(helperFragment, document.body.firstChild);
}
if(self == top){

}









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 loadListEmbedHandler(){
  
    this.loadLists = new Array();
    
    this.constructor = function(){
      this.loadLists[0] = new Object();
    }
    this.constructor();
    
    this.addLoadList = function(element){
      this.loadLists[0][element.id] = element;
    }
    
    this.show = function(id){
      id = id + '_loadList';
      this.loadLists[0][id].style.display = 'block';
    }
    
    this.hide = function(id){
      id = id + '_loadList';
      this.loadLists[0][id].style.display = 'none';
    }
    
  }
  



          
function appendListEmbed(listElement){
  if(typeof loadListHandler != 'undefined'){
    loadListHandler.addLoadList(listElement);
  }
}  









function refreshCacheUsers(url){

  if(url == ''){
    url = '/weblication/grid/scripts/wUsermanager.php?action=refreshCacheUsers';
  }  
  getUrl2(url, refreshCacheUsersResponse);
}
function refreshCacheUsersResponse(responseStr){}
