document.write('<script type="text/javascript" src="/portal/javascript/prototype.js"></script>'); 
document.write('<script type="text/javascript" src="/portal/javascript/contextMenu.js"></script>');
document.write('<script type="text/javascript" src="/portal/javascript/shortcut.js"></script>');
document.write('<script type="text/javascript" src="/portal/javascript/directUpload.js"></script>');
document.write('<script type="text/javascript" src="/portal/javascript/AC_RunActiveContent.js"></script>');

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
var ie7 = false; 

var path=window.location.pathname;
var contextPath=path.substring(1,path.length);
contextPath='/'+contextPath.substring(0,contextPath.indexOf('/'));

var GlobalJs = true;

if((document.all)&&(navigator.appVersion.indexOf("MSIE 7.")!=-1))
{ 
	ie7=true;
} 

offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function toolTip(msg, ox, fg, bg)
{
  if(toolTip.arguments.length < 1) 
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else 
  {
    if(toolTip.arguments.length > 1)
    {
	  offsetX=ox;
    }
	else
	{
      offsetX=0;
	}
	moveToMouseLoc();
	if(!fg) fg = "#777777";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg +
    '"><td align="center"><font face="sans-serif" color="' + fg +
    '" size="-2">&nbsp\;' + msg +
    '&nbsp\;</font></td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
function moveToMouseLoc(e)
{
try
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
		x = event.x + document.body.scrollLeft;
    	y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  }
  catch(error)
  {
  }
  return true;
}


function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var remote;
function openPopup(initHtmlFile,winName)
{
	var width=400;
	var height=180;
	if (ie7)
	{
		width=750;
		height=294;
	}
	var newWindow=GP_AdvOpenWindow(initHtmlFile,winName,'fullscreen=no,toolbar=no,location=no,status=yes,menubar=no,scrollbars=auto,resizable=yes',width,height,'center','ignoreLink','',0,'');
	//return document.MM_returnValue;
	return newWindow;
}

function checkBlank()
{
if (document.userid_form.elements[0].value == "" || document.userid_form.elements[1].value == ""){
  alert('please enter user-id and password');
   return false;
}
return true;
}
function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) 
  {
	if (document.all || document.layers || document.getElementById) 
	{
		w = screen.availWidth; h = screen.availHeight;
	}
	if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
	if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
	if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;
  }
  popupWindow = window.open(theURL,winName,features);
  if (popupWindow.opener == null) 
  { 
  	popupWindow.opener = self;  
  }
  popupWindow.opener.name = "opener";
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;

/*
	if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) { popupWindow[wp].opener = self;  popupWindow[wp].opener.name = "opener";}
  if (document.all || document.layers || document.getElementById) 
  {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") 
	{
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; 
	}
    if (autoCloseTime && autoCloseTime > 0) 
	{
		popupWindow[wp].document.body.onbeforeunload = function() 
		{
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	
		}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); 
	  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; 
	}
  }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
  */
  return popupWindow;
}
function checksubmit(initHtmlFile,winName)
{
  if (checkBlank())
  {
	var newWindow=openPopup(initHtmlFile,"popup");
	
	var newMethod=true;
	if (newMethod)
	{
		var actionUrl=document.userid_form.action; 
		if (actionUrl.indexOf("disableGoto=true")==-1)
		{
			document.userid_form.action=actionUrl+"?disableGoto=true";
		}
		var gotoUrl=document.userid_form.goto.value;
		reloadOnClose(newWindow,gotoUrl);
	}

	//prüfen ob ausgeblendeter Submit-Button vorhanden ist -> dann Formular über Submit-Button abschicken 
	//damit autocomplete funktioniert
	if(document.getElementById('userIDFormSubmitButton')!=null)	
	{
		window.setTimeout("document.getElementById('userIDFormSubmitButton').click();", 300);
	}else
	{
		window.setTimeout("document.userid_form.submit();", 300);
	}
  }
}

function reloadOnClose(win,reloadUrl)
{
	if (win && !win.closed)
	{
		window.setTimeout(function(){reloadOnClose(win,reloadUrl)}, 100); 
	}
	else
	{
		location.href=reloadUrl;
	}
	
}

function checkEnter(e,initHtmlFile)
{ 	var characterCode 

	 if(e && e.which)
	 { 		 e = e
		 characterCode = e.which 
	 }
	 else
	 {
	 	 try
		 {
			 e = event
			 characterCode = e.keyCode 
		 } catch (Error){}
	 }


	 if(characterCode == 13)
	 { 	checksubmit(initHtmlFile);
		 return false
	 }
	 else
	 {
	 	return true
	 }


}


var refer=true;
function showComboPanel() 
{
	obj=MM_findObj("comboPanel");
	if (refer) 
	{
	  	obj.style.visibility="visible";
	  	refer=false;
	}
	else 
	{
		obj.style.visibility="hidden";
		refer=true;
	}
}


var refer2=true;
function showComboPanel2() 
{
	obj=MM_findObj("comboPanel2");
	if (refer2) 
	{
		obj.style.visibility="visible";
		refer2=false;
	}
	else 
	{
		obj.style.visibility="hidden";
		refer2=true;
	}
}

function scrollToElement(elementId)
{
	obj=MM_findObj(elementId);
//	alert(obj);
	obj.scrollIntoView(true)
//	alert("test");
}

function showElement(elementId)
{
	obj=MM_findObj(elementId);
	obj.style.visibility="visible";
//	alert(obj);
}

function hideElement(elementId)
{
	obj=MM_findObj(elementId);
	obj.style.visibility="hidden";
//	alert(obj);
}

var ajaxXmlHttp = false;

function getAjaxInstance(key)
{
	var ajaxInstance=null;

	if (typeof(XMLHttpRequest) != 'undefined') 
	{
		ajaxInstance = new XMLHttpRequest();
//			alert(ajaxInstance);
//			ajaxInstance.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			//ajaxXmlHttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");
			//ajaxXmlHttp.setRequestHeader("Content-Transfer-Encoding", "8bit");
	}
	if (!ajaxInstance) 
	{
		// Internet Explorer 6 und älter
		try {
			ajaxInstance  = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				ajaxInstance  = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				ajaxInstance  = false;
			}
		}
	}
	if (!ajaxInstance) 
	{
		alert("error creating ajax instance");
	}
	return ajaxInstance;
}
ajaxXmlHttp=getAjaxInstance();


function ajaxLoad(url,elementId,asynchronous,afterLoad,evalScripts)
{
	if (evalScripts && evalScripts!=null)
	{
		if (afterLoad!=null)
		{
			if (asynchronous==false)
			{
				new Ajax.Updater(elementId, url, {   
					asynchronous: false,
					onComplete: afterLoad,
					evalScripts: true
				}); 
			}
			else
			{
				new Ajax.Updater(elementId, url, {   
					onComplete: afterLoad,
					evalScripts: true
				}); 
			}
		}
		else
		{
			if (asynchronous==false)
			{
				new Ajax.Updater(elementId, url, {   
					asynchronous: false,
					evalScripts: true
				}); 
			}
			else
			{
				new Ajax.Updater(elementId, url, {
 					evalScripts: true
				}); 
			}
		}
	}
	else
	{
		if (afterLoad)
		{
			if (asynchronous==false)
			{
				new Ajax.Updater(elementId, url, {   
					asynchronous: false,
					onComplete: afterLoad
				}); 
			}
			else
			{
				new Ajax.Updater(elementId, url, {   
					onComplete: afterLoad
				}); 
			}
		}
		else
		{
			if (asynchronous==false)
			{
				new Ajax.Updater(elementId, url, {   
					asynchronous: false
				}); 
			}
			else
			{
				new Ajax.Updater(elementId, url); 
			}
		}
	}
}

function ajaxLoadSynchronous(url,elementId)
{
	return ajaxLoad(url,elementId,false);
}

function ajaxLoadString(url)
{
	if (ajaxXmlHttp) 
	{
		ajaxXmlHttp.open('GET', url, false);
		ajaxXmlHttp.onreadystatechange = function () 
		{
			if (ajaxXmlHttp.readyState == 4) 
			{
				result = ajaxXmlHttp.responseText;
			}
		};
		ajaxXmlHttp.send(null);
	}
	return result;
}

function openEditorWindow(url)
{	
	GP_AdvOpenWindow(url,'','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes',1000,750);
}

function showPleaseWait()
{
	document.getElementById('pleaseWaitPanel').style.display = 'block';
}

function hidePleaseWait()
{
	document.getElementById('pleaseWaitPanel').style.display = 'none';
}

function beginLoading()
{
	if (window.addEventListener)
	window.addEventListener("load", endLoading, false)
	else if (window.attachEvent)
	window.attachEvent("onload", endLoading)

	pwTimer=window.setTimeout("showPleaseWait()",2000);
}

function endLoading()
{
	hidePleaseWait();
	window.clearTimeout(pwTimer);
}

function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v4.01
  //Copyright 1998 Macromedia, Inc. All rights reserved.
  var i,j,aLayer,retVal,curDrag=null,curLeft,curTop,IE=document.all,NS4=document.layers;
  var NS6=(!IE&&document.getElementById), NS=(NS4||NS6); if (!IE && !NS) return false;
  retVal = true; if(IE && event) event.returnValue = true;
  if (MM_dragLayer.arguments.length > 1) {
    curDrag = MM_findObj(objName); if (!curDrag) return false;
    if (!document.allLayers) { document.allLayers = new Array();
      with (document) if (NS4) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
        for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
          with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
      } else {
        if (NS6) { var spns = getElementsByTagName("span"); var all = getElementsByTagName("div"); 
          for (i=0;i<spns.length;i++) if (spns[i].style&&spns[i].style.position) allLayers[allLayers.length]=spns[i];}
        for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i]; 
    } }
    curDrag.MM_dragOk=true; curDrag.MM_targL=targL; curDrag.MM_targT=targT;
    curDrag.MM_tol=Math.pow(tol,2); curDrag.MM_hLeft=hL; curDrag.MM_hTop=hT;
    curDrag.MM_hWidth=hW; curDrag.MM_hHeight=hH; curDrag.MM_toFront=toFront;
    curDrag.MM_dropBack=dropBack; curDrag.MM_dropJS=dropJS;
    curDrag.MM_everyTime=et; curDrag.MM_dragJS=dragJS;
    curDrag.MM_oldZ = (NS4)?curDrag.zIndex:curDrag.style.zIndex;
    curLeft= (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft; 
    if (String(curLeft)=="NaN") curLeft=0; curDrag.MM_startL = curLeft;
    curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop; 
    if (String(curTop)=="NaN") curTop=0; curDrag.MM_startT = curTop;
    curDrag.MM_bL=(cL<0)?null:curLeft-cL; curDrag.MM_bT=(cU<0)?null:curTop-cU;
    curDrag.MM_bR=(cR<0)?null:curLeft+cR; curDrag.MM_bB=(cD<0)?null:curTop+cD;
    curDrag.MM_LEFTRIGHT=0; curDrag.MM_UPDOWN=0; curDrag.MM_SNAPPED=false; //use in your JS!
    document.onmousedown = MM_dragLayer; document.onmouseup = MM_dragLayer;
    if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  } else {
    var theEvent = ((NS)?objName.type:event.type);
    if (theEvent == 'mousedown') {
      var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
      var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
      var maxDragZ=null; document.MM_maxZ = 0;
      for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
        var aLayerZ = (NS4)?aLayer.zIndex:parseInt(aLayer.style.zIndex);
        if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
        var isVisible = (((NS4)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
        if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
          var parentL=0; var parentT=0;
          if (NS6) { parentLayer = aLayer.parentNode;
            while (parentLayer != null && parentLayer.style.position) {             
              parentL += parseInt(parentLayer.offsetLeft); parentT += parseInt(parentLayer.offsetTop);
              parentLayer = parentLayer.parentNode;
          } } else if (IE) { parentLayer = aLayer.parentElement;       
            while (parentLayer != null && parentLayer.style.position) {
              parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
              parentLayer = parentLayer.parentElement; } }
          var tmpX=mouseX-(((NS4)?pageX:((NS6)?parseInt(style.left):style.pixelLeft)+parentL)+MM_hLeft);
          var tmpY=mouseY-(((NS4)?pageY:((NS6)?parseInt(style.top):style.pixelTop) +parentT)+MM_hTop);
          if (String(tmpX)=="NaN") tmpX=0; if (String(tmpY)=="NaN") tmpY=0;
          var tmpW = MM_hWidth;  if (tmpW <= 0) tmpW += ((NS4)?clip.width :offsetWidth);
          var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS4)?clip.height:offsetHeight);
          if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
              || maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
      if (curDrag) {
        document.onmousemove = MM_dragLayer; if (NS4) document.captureEvents(Event.MOUSEMOVE);
        curLeft = (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft;
        curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop;
        if (String(curLeft)=="NaN") curLeft=0; if (String(curTop)=="NaN") curTop=0;
        MM_oldX = mouseX - curLeft; MM_oldY = mouseY - curTop;
        document.MM_curDrag = curDrag;  curDrag.MM_SNAPPED=false;
        if(curDrag.MM_toFront) {
          eval('curDrag.'+((NS4)?'':'style.')+'zIndex=document.MM_maxZ+1');
          if (!curDrag.MM_dropBack) document.MM_maxZ++; }
        retVal = false; if(!NS4&&!NS6) event.returnValue = false;
    } } else if (theEvent == 'mousemove') {
      if (document.MM_curDrag) with (document.MM_curDrag) {
        var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
        var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
        newLeft = mouseX-MM_oldX; newTop  = mouseY-MM_oldY;
        if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
        if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
        if (MM_bT!=null) newTop  = Math.max(newTop ,MM_bT);
        if (MM_bB!=null) newTop  = Math.min(newTop ,MM_bB);
        MM_LEFTRIGHT = newLeft-MM_startL; MM_UPDOWN = newTop-MM_startT;
        if (NS4) {left = newLeft; top = newTop;}
        else if (NS6){style.left = newLeft; style.top = newTop;}
        else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
        if (MM_dragJS) eval(MM_dragJS);
        retVal = false; if(!NS) event.returnValue = false;
    } } else if (theEvent == 'mouseup') {
      document.onmousemove = null;
      if (NS) document.releaseEvents(Event.MOUSEMOVE);
      if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
      if (document.MM_curDrag) with (document.MM_curDrag) {
        if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
            (Math.pow(MM_targL-((NS4)?left:(NS6)?parseInt(style.left):style.pixelLeft),2)+
             Math.pow(MM_targT-((NS4)?top:(NS6)?parseInt(style.top):style.pixelTop),2))<=MM_tol) {
          if (NS4) {left = MM_targL; top = MM_targT;}
          else if (NS6) {style.left = MM_targL; style.top = MM_targT;}
          else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
          MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
        if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
        if(MM_dropBack) {if (NS4) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
        retVal = false; if(!NS) event.returnValue = false; }
      document.MM_curDrag = null;
    }
    if (NS) document.routeEvent(objName);
  } return retVal;
}

function getAbsolutePos(element) {
	var r = { x: element.offsetLeft, y: element.offsetTop };

	do{
		element = element.offsetParent;
		r.x += element.offsetLeft;
		r.y += element.offsetTop;
	}while (element.id!="content" && element.offsetParent.id!="content")
	return r;
}

function changeFrameMode(url,hideId,showId,hideId2,showId2,hideId3,showId3)
{
	$(hideId).hide();
	$(showId).show();
	if (hideId2!=null) $(hideId2).hide();
	if (showId2!=null) $(showId2).show();
	
	if (hideId3!=null) 
	{
		elem=$(hideId3);
		if (elem!=null) elem.hide();
	}
	if (showId3!=null) 
	{
		elem=$(showId3)
		if (elem!=null) elem.show();
	}
	
	
//	if (hideId2!=null) new Effect.Fade(hideId2);
//	if (hideId2!=null) new Effect.SwitchOff(hideId2);
//	if (showId2!=null) new Effect.Grow(showId2);

	new Ajax.Request(url); 
//window.frames["loader"].window.location=url;
}

function changeFrameModeClass(frameId)
{
	var channelFrame = document.getElementById(frameId);

	if (channelFrame.className.indexOf("frameModeNormal") != -1)
	{
		channelFrame.className=channelFrame.className.replace("frameModeNormal","frameModeMinimized");
	}
	else if (channelFrame.className.indexOf("frameModeMinimized") != -1)
	{
		channelFrame.className=channelFrame.className.replace("frameModeMinimized","frameModeNormal");
	}

}

/// Context menu

var state = false;

function showContextMenu(eid, pid, mid,contextWidth,contextHeight,contextLeft,contextTop)
{
	var offsetLeft = document.getElementById('base').style.left;
	var offsetLeftNr = parseInt(offsetLeft.substring(0,(offsetLeft.length-2)))+contextLeft;
	document.getElementById('contextMenuDiv').style.left = offsetLeftNr+"px";
	
	var offsetTop = document.getElementById('base').style.top;
	var offsetTopNr = parseInt(offsetTop.substring(0,(offsetTop.length-2)))+contextTop;
	document.getElementById('contextMenuDiv').style.top = offsetTopNr+"px";
	
	document.getElementById('contextMenuDiv').style.width=contextWidth+"px";
	document.getElementById('contextMenuDiv').style.height=contextHeight+"px";
	document.getElementById('contextMenu').style.width=contextWidth+"px";
	document.getElementById('contextMenu').style.height=contextHeight+"px";
	document.getElementById('contextMenu').src="../../util/contextMenu/master.jsp?eid="+eid+"&pid="+pid+"&mid="+mid;
	document.getElementById('contextMenuDiv').style.visibility='visible';
}

function scaleHeightToBrowserOnResize(elementID, reduceBy, minHeight, initialResize)
{
	if (initialResize!="false")
	{
		Event.observe(window, 'load', function(){
			scaleHeightToBrowserWorker(elementID, reduceBy, minHeight);
		});
	}
	Event.observe(window, 'resize', function(){
		scaleHeightToBrowserWorker(elementID, reduceBy, minHeight);
	});

}

function scaleHeightToBrowserWorker(elementID, reduceBy, minHeight)
{
	elem=$(elementID);
//	alert("scaleHeightToBrowserWorker elem="+elem+" elementID="+elementID+" reduceBy="+reduceBy+" minHeight="+minHeight);

var bodyElement=null;
	for (var i=0; i<document.body.childNodes.length && bodyElement==null; i++)
	{
		if (document.body.childNodes[i].nodeName == "DIV")
		{
			bodyElement=document.body.childNodes[i];
		}
	}

	var bwidth=Element.getWidth(bodyElement);
	var bheight=Element.getHeight(bodyElement);


	// hier passiert der fehler	
	var wwidth=document.viewport.getWidth();
	var wheight=document.viewport.getHeight();

	var ewidth=Element.getWidth(elem);
	var eheight=Element.getHeight(elem);

	var rwheight=wheight-reduceBy;

	var delta=rwheight-bheight;
	eheight=eheight+delta;
	
	if (eheight<minHeight) eheight=minHeight;

	elem.style.height = eheight;
	
//	window.status="["+i+"] bwidth="+bwidth+" bheight="+bheight+" wwidth="+wwidth+" wheight="+wheight+" ewidth="+ewidth+" eheight="+eheight ;
	/*
	var newHeight = document.body.clientHeight - reduceBy;
	if (newHeight < minHeight)
		newHeight = minHeight;

	document.getElementById(elementID).style.height = newHeight;
	*/
}

function onReloadPortlet(channelId, afterOnReloadFunction)
{
	Event.observe(window, "load", function() {  
	if (parent!=self) 
	{
		var newContent = document.getElementById("channelId_"+channelId);
		var oldContent = parent.document.getElementById("channelId_"+channelId);
		oldContent.innerHTML = newContent.innerHTML;
	}
	
	if (afterOnReloadFunction!=null) afterOnReloadFunction.call();
	});
}

function createDraggable(channelId, options)
{
	new Draggable(channelId, options);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function submitEditorAppzTemplateForm(){
	MM_validateForm('name','','R');
	if(document.MM_returnValue){
		document.form1.submit();
	}
	else
	{
		$('saveButton').removeClassName('buttonDisabled');
	}
}
function openMaximizedWindow(url)
{
	var w = 1024, h = 768;
	if (document.all || document.layers || document.getElementById) 
	{
		w = screen.availWidth; h = screen.availHeight;
	}
	var win = window.open(url, '_blank','width='+w+',height='+h+',left=0,top=0, scrollbars=yes');
	win.moveTo(-10,-25);
}

function selectStyle(styleName) 
{
	window.frames["loader"].window.location=contextPath+"/util/userProfile/setUserProfile.jsp?reloadParent=true&userProfile.style=" + styleName;
}
function selectZoom(delta) 
{
	if (delta)
	{
		var value=document.body.style.zoom;
		if (!value) value=1;
		else value=parseFloat(value);
		value+=delta;
		if (value==0) value=0.1;
		document.body.style.zoom=value;
		new Ajax.Request(contextPath+"/util/userProfile/setUserProfile.jsp?userProfile.zoom=" + value); 
//		window.frames["loader"].window.location=contextPath+"/util/userProfile/setUserProfile.jsp?userProfile.zoom=" + value;
	}
	else
	{
		document.body.style.zoom=1;
		new Ajax.Request(contextPath+"/util/userProfile/setUserProfile.jsp?userProfile.zoom=NULL"); 
//		window.frames["loader"].window.location=contextPath+"/util/userProfile/setUserProfile.jsp?userProfile.zoom=NULL";
	}
}

function enableEditing(pinEditId)
{			
	var divId='loadingFrame';
	if(pinEditId)
	{		
		divId+='_'+pinEditId;	
	}		
	try
	{				
		document.getElementById(divId).style.display='none';		
	}catch(e){}	
}	
	
function right(e) {
	var msg = "Function Disabled!";
	if (navigator.appName == 'Netscape' && e.which == 3) {
		alert(msg);
		return false;
	}
		if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
		alert(msg);
		return false;
	}
	else return true;
}

function trap()
{
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }
  
 	function closeOverlayFrame() 
	{
		document.getElementById('ContainerOverlayDiv').style.display='none';
		document.getElementById('ContainerOverlayBg').style.display='none';
		document.getElementById('ContainerOverlayIframe').style.display='none';
		document.body.style.overflow='visible';
		document.body.scroll='yes';
	}
	
	//alert("document.cookie:"+document.cookie);
	
	function showOverlayFrame(url)
	{
		try
		{
			document.getElementById('ContainerOverlayDiv').style.display='block';
			document.getElementById('ContainerOverlayBg').style.display='block';
			ajaxLoad(url,"ContainerOverlayDiv");
			document.body.scroll='no';
			document.body.style.overflow='hidden';
		}
		catch(Error)
		{
		}
	}

// Funktion zum Öffnen von Links in MHTs in neuem Fenster
function openLinkInMHT(url)
{
	var openUrl = url;
	GP_AdvOpenWindow(openUrl,'userprofile','fullscreen=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,channelmode=no,directories=no',500,300,'center','ignoreLink','',0,'',0,1,5,'');
	return;
}

var virtualClipboard=null;
function setClipboard(val)
	{
		try
		{
			if(document.all && window.clipboardData && window.clipboardData.setData)
			{
//				alert("set Clipboard: "+val);
				window.clipboardData.setData("Text",val);
//				var cliboardValue=window.clipboardData.getData("Text");
//				alert("cliboardValue: "+cliboardValue);
			}
			else
			{
//				alert(virtualClipboard+" -> "+val);
				alert("set virtualClipboard: "+val);
				virtualClipboard=val;
	//			(new Clipboard()).copy(val);
			}
		}
		catch(error)
		{
			alert(error.description+" "+error.message+" "+error.number);
		}
	}
	
	// ***************************************************************************************************
	function getClipboard()
	{
		try
		{
			if(document.all && window.clipboardData && window.clipboardData.getData)
			{
				return window.clipboardData.getData("Text");
			}
			else
			{
				return virtualClipboard;
	//			return(new Clipboard()).paste();
			}
		}
		catch(error)
		{
			//alert(error.description);
		}
	}
	
	function getClipboardAsync(callbackFunction)
	{
		callClipboardHelperFrame(function(helperFrame){
			try
			{				
				var value=helperFrame.contentWindow.getClipboard();
				if (callbackFunction) callbackFunction(value);
			}
			catch(e)
			{
			}	
		});
	}

	function setClipboardAsync(val, callbackFunction)
	{
		callClipboardHelperFrame(function(helperFrame){
			try
			{				
				helperFrame.contentWindow.setClipboard(val);
				if (callbackFunction) callbackFunction();
			}
			catch(e)
			{
			}	
		});
	}


	var callbackHelperIFrameReady=false;
	var callbackHelperIFrame=null;
	function callClipboardHelperFrame(func)
	{
		var helperFrame=document.getElementById("clipboardHelper");
		
		if (callbackHelperIFrameReady==false)
		{
			if (helperFrame!=null)
			{
				window.setTimeout(function(){callClipboardHelperFrame(func)}, 200); 
				return;
			}
		
//			alert("setzen "+func);
			callbackHelperIFrame=func;
			var clipdiv = document.createElement("div");
			clipdiv.style.position='absolute';
//			clipdiv.style.top='20px';
//			clipdiv.style.left='20px';
			clipdiv.innerHTML = "<iframe id='clipboardHelper' width='18' height='0' frameborder='0' name='clipboardHelper' src='"+contextPath+"/util/ClientBridge/clipboard.jsp'></iframe>";
			document.body.insertBefore(clipdiv, document.body.firstChild);
//			$('tb_parentDirectory').parentNode.insertBefore(clipdiv, $('tb_parentDirectory'));
		}
		else
		{
			func(helperFrame);
		}
	}
	
	function bodyOnloadIFrame()
	{
		var helperFrame=document.getElementById("clipboardHelper");
		callbackHelperIFrame(helperFrame);
		callbackHelperIFrameReady=true;
//		callbackHelperIFrame=null;
	}

// *** Funktion zum entfernen von Leerzeichen eines Strings
	function removeWhitespaces(s)
	{
	  	return s.replace( /\s/g, "" );
	}
	
	function EMail(s)
	{
		 var a = false;
		 var res = false;
		 if(typeof(RegExp) == 'function')
		 {
		  var b = new RegExp('abc');
		  if(b.test('abc') == true){a = true;}
		 }
		
		 if(a == true)
		 {
		  reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
						   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
						   '(\\.)([a-zA-Z]{2,4})$');
		  res = (reg.test(s));
		 }
		 else
		 {
		  res = (s.search('@') >= 1 &&
				 s.lastIndexOf('.') > s.search('@') &&
				 s.lastIndexOf('.') >= s.length-5)
		 }
		 return(res);
 	}
	
function publishFile(fid)
{
	window.open("../HomepageExplorer/functions/publish.jsp?fid="+fid+"&publishLevel=3","","resizable,scrollbars=auto,width=500,height=200,left=100,top=100");
}
function publishFile(fid, publishLevel)
{
	if(publishLevel==undefined)
		window.open("../HomepageExplorer/functions/publish.jsp?fid="+fid+"&publishLevel=3","","resizable,scrollbars=auto,width=500,height=200,left=100,top=100");
	else
	{
		try
		{
			window.frames["loader"].window.location= "../HomepageExplorer/functions/publish.jsp?fid="+fid+"&publishLevel="+publishLevel;
		}
		catch(e)
		{
			window.open("../HomepageExplorer/functions/publish.jsp?fid="+fid+"&publishLevel="+publishLevel,"","resizable,scrollbars=auto,width=500,height=200,left=100,top=100");
		}
	}
}


 	var eventMatchers = 
	{    
		'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,    
		'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/  
	}  
	var defaultOptions = {    pointerX: 0,    pointerY: 0,    button: 0,    ctrlKey: false,    altKey: false,    shiftKey: false,    metaKey: false,    bubbles: true,    cancelable: true  }    
	simulate = function(element, eventName) 
	{
		var options = Object.extend(defaultOptions, arguments[2] || { });    
		var oEvent, eventType = null;       
		element = $(element);        
		for (var name in eventMatchers) 
		{      
			if (eventMatchers[name].test(eventName)) 
			{ 
				eventType = name; 
				break;
			}    
		}
		if (!eventType) throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');     
		if (document.createEvent) 
		{      
			oEvent = document.createEvent(eventType);      
			if (eventType == 'HTMLEvents') 
			{
				oEvent.initEvent(eventName, options.bubbles, options.cancelable);
			}
			else
			{
				oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView, options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);      
			}      
			element.dispatchEvent(oEvent);    
		}
		else
		{ 
			options.clientX = options.pointerX;
			options.clientY = options.pointerY;
			oEvent = Object.extend(document.createEventObject(), options); 
			element.fireEvent('on' + eventName, oEvent);   
		}
		return element;
	}
