function SymError(){return true;}
window.onerror = SymError;

function drucke(id,theme){
	// gibt eine Vorschau aus
	var html = document.getElementById(id).innerHTML;
	html = html.replace(/src="/gi, 'src="../' );
	html = html.replace(/&lt;/gi, '<' );
	html = html.replace(/&gt;/gi, '>' );
	var pFenster = window.open( '', null, 'height=600,width=780,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes' ) ;
	var HTML = '<html><head></head><body>' + html + '</body></html>' ;
	pFenster.document.write(HTML);
	pFenster.document.close();
}

var ie  = document.all  ? 1 : 0;
 function selall(kselect) {
   	var fmobj = document.kform;
   	for (var i=0;i<fmobj.elements.length;i++) {
   		var e = fmobj.elements[i];
   		if ((e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled)) {
   			e.checked = fmobj.allbox.checked;
   			
   		}
   	}
   }
   function CheckCheckAll(kselect) {
   	var fmobj = document.kform;
   	var TotalBoxes = 0;
   	var TotalOn = 0;
   	for (var i=0;i<fmobj.elements.length;i++) {
   		var e = fmobj.elements[i];
   		if ((e.name != 'allbox') && (e.type=='checkbox')) {
   			TotalBoxes++;
   			if (e.checked) {
   				TotalOn++;
   			}
   		}
   	}
   	if (TotalBoxes==TotalOn) {fmobj.allbox.checked=true;}
   	else {fmobj.allbox.checked=false;}
   }
   function select_read() {
   	var fmobj = document.kform;
   	for (var i=0;i<fmobj.elements.length;i++) {
   		var e = fmobj.elements[i];
   		if ((e.type=='hidden') && (e.value == 1) && (! isNaN(e.name) ))
   		{
   			eval("fmobj.msgid_" + e.name + ".checked=true;");
   			
   		}
   	}
   }
   function desel() {
   	var fmobj = document.uactions;
   	for (var i=0;i<fmobj.elements.length;i++) {
   		var e = fmobj.elements[i];
   		if (e.type=='checkbox') {
   			e.checked=false;
   			
   		}
   	}
   }
   
   
function MM_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
	



function katneu(url,name,h,w)
	{
		if(document.f.sel.options[1].selected == true)
			{
			popup(''+url+'',''+name+'',''+h+'',''+w+'')
			return true;
			}
		return false;
	}
	
function helpwin(title,msg)
{
  var width="400", height="200";
  var left = (screen.width/2) - width/2;
  var top = (screen.height/2) - height/2;
  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  var msgWindow = window.open("","msgWindow", styleStr);
  var head = '<head><title>'+title+'</title><link href="style.css" rel="stylesheet" type="text/css"></head><body scroll="auto" background="img/headerbg.gif">';
  var body = '<table width="100%"  border="0" cellpadding="5" cellspacing="1" class="tableborder"><tr><td class="secondrow">'+msg+'<br><p><form><center><input class="button" type="button" value="  OK  " onClick="self.close()"></center></form>	</td></tr></table>';
  msgWindow.document.write(head + body);

}


function popup(datei,name,breite,hoehe)
	{ 
	var posX=(screen.availWidth-breite)/2;
	var posY=(screen.availHeight-hoehe)/2;
	window.open(datei,name,"scrollbars=no,resizable=yes,width=" + breite + ",height=" + hoehe + "screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
}

function MediaPool(typ, target) {
  var winWidth = 820;
  var winHeight = 550;
  var w = (screen.width - winWidth)/2;
  var h = (screen.height - winHeight)/2 - 60;
  var url = 'mediapool.php?typ=' + typ + '&target=' + target;
  var name = 'mpool';
  var features = 'scrollbars=no,width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
  window.open(url,name,features);
}

function getRandomNum() {
    			var rndNum = Math.random()
				rndNum = parseInt(rndNum * 1000);
				rndNum = (rndNum % 94) + 33;

    			return rndNum;
			}

function checkPunc(num) {
    			if ((num >=33) && (num <=47)) { return true; }
   				if ((num >=58) && (num <=64)) { return true; }
    			if ((num >=91) && (num <=96)) { return true; }
    			if ((num >=123) && (num <=126)) { return true; }

    			return false;
}
			
function GeneratePassword() {
    			var sPassword = "";

			    for (i=0; i < 8; i++) {
			        numI = getRandomNum();
        			while (checkPunc(numI)) {
        				numI = getRandomNum();
        			}
			       	sPassword = sPassword + String.fromCharCode(numI);
    			}

    			return sPassword;
}

function toolpop(title, msg)
{
  var width="300", height="125";
  var left = (screen.width/2) - width/2;
  var top = (screen.height/2) - height/2;
  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  var msgWindow = window.open("","msgWindow", styleStr);
  var head = '<head><title>'+title+'</title></head>';
  var body = '<center>'+msg+'<br><p><form><input type="button" value="   Done   " onClick="self.close()"></form>';
  msgWindow.document.write(head + body);
}


function MM_preloadImages() { //v3.0
  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() { //v3.0
  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) { //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_swapImage() { //v3.0
  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];}
}


xMousePos = 0; 
yMousePos = 0; 
xMousePosMax = 0; 
yMousePosMax = 0; 
infoElement= null; 
xFromMouse=0;
yFromMouse=0;
yUpFromMouse=37;
standardStyle='position:absolute;left:0px;top:0px;visibility:hidden;text-align:left;z-index:999;filter: shadow(direction=135,color=#8E8E8E,strength=3);';
vars=new Object();
vars.tags=[ 'a' ]; 
vars.infoAttributeName= 'info'; 
vars.infoElementCentered= true; 
vars.infoElementId=null; 
vars.infoElementStyleClass=null; 
vars.infoElementFontSize= '11px'; 
vars.infoElementTextColor='#000000';
vars.infoElementBGColor= '#FAFAFA';
function setVariables(){
	var settings= window.infoSettings;
	if( settings==null ){
	} else {
	    for( var varName in settings ){
	    	if( settings[varName]!=null )
	    		vars[varName]= settings[varName];	
	    }
	}	
};
setVariables();	
begin();
function begin(){	
	attachInfoElement();
	installTagListeners();
	oldOnmousemove= document.onmousemove;
	if (document.all) {
	    yFromMouse=17;
	    xFromMouse=2;
	    document.onmousemove = captureMousePosition;	
	} else if (document.getElementById) {
	    yFromMouse=21;
	    xFromMouse=2;
	    document.onmousemove = captureMousePosition;		
	}
}
function captureMousePosition(e) {
    if ( document.documentElement&& window.event&& document.documentElement.clientWidth>0 ){
	xMousePos = window.event.x+ document.documentElement.scrollLeft; 
        yMousePos = window.event.y+document.documentElement.scrollTop;
        xMousePosMax = document.documentElement.clientWidth+document.documentElement.scrollLeft;
        yMousePosMax = document.documentElement.clientHeight+document.documentElement.scrollTop-12;        	
   } else if (document.all) {
	xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
	moveElements();	
	if( oldOnmousemove!=null ){		
		oldOnmousemove(e);
	}
}
function out( string ){
	var outDiv=document.getElementById('out')
	if(outDiv!=null) outDiv.firstChild.nodeValue+=string+" ";
}
function moveElements(){
	moveInfoElement();
}
function attachInfoElement( ){
	var str='<div style="'+standardStyle+'" id="';
	if(vars.infoElementId!=null &&vars.infoElementId.length>0){
		str+= vars.infoElementId+'" ';		
	} else {
		vars.infoElementId='infoElement';
		str+= vars.infoElementId+'"';	
		if(vars.infoElementStyleClass!=null && vars.infoElementStyleClass.length>0){
			str+= ' class="'+vars.infoElementStyleClass+'" ';			
		} else {
			str+=' class="'+vars.infoElementId+'" ';
			var sty='<style type="text/css"><!--';
			sty+=('#'+vars.infoElementId+' {');
			sty+=('background-color: '+vars.infoElementBGColor+';');	
			sty+='color:'+vars.infoElementTextColor+';';
			sty+=('border: 1px solid  #999999;filter: shadow(direction=135,color=#8E8E8E,strength=3);');
			sty+=('filter: shadow(direction=135,color=#8E8E8E,strength=3);');
			//sty+=('text-align:left;WIDTH: 100%;');
			//sty+=('border-bottom: 2px inset  #424242;');
			//sty+=('border-right: 2px inset  #424242;');
			sty+=('font-size: '+vars.infoElementFontSize+';');
			sty+=('font-family: Verdana,Arial, Helvetica, sans-serif;');
			sty+=('margin:4px;');
			sty+='padding:4px;';
			sty+=('}	--></style>');			
			document.writeln( sty );
		}
	}	
	str+=' > </div>'	
	out(str);
	document.writeln( str );	
}
function installTagListeners( delayTime ){
	infoElement=document.getElementById( vars.infoElementId );
	if( infoElement==null ){} else {		
		for( var k=0; k<vars.tags.length; k++){		
			var links=document.getElementsByTagName(  vars.tags[k].toUpperCase() );
			for(var i=0;links!=null&&i<links.length;i++){				
				var node= links[i];
				var infoText=node.getAttribute( vars.infoAttributeName ); 
				if( infoText!=null && infoText.length > 0&& node.infoText_==null ){
						node.infoText_= infoText;
						node.style.cursor='pointer';
						if( node.onmouseover==null ){
							node.onmouseover= showInfo;					
						} else {
							node.oldOnmouseover= node.onmouseover;
							node.newOnmouseover= showInfo;
							node.onmouseover= function(){
								this.newOnmouseover();
								this.oldOnmouseover();
							}
						}
						if( node.onmouseout==null ){
							node.onmouseout= hideInfo;					
						} else {
							node.oldOnmouseout= node.onmouseout;
							node.newOnmouseout= hideInfo;
							node.onmouseout= function(){
								this.newOnmouseout();
								this.oldOnmouseout();
							}
					   }
				}
			}
		}
	}	
	if( delayTime==null)
		delayTime=0;
	if( delayTime < 2 ){
		delayTime+=0.2;
	}	
	setTimeout('installTagListeners('+delayTime+')',delayTime*1000); 
}
function moveInfoElement(){	
	if( infoElement ==null ){
	} else if( infoElement.style.visibility != 'hidden'){		
		var x=xFromMouse+xMousePos;
		if(vars.infoElementCentered==true){
			x-=0.5*infoElement.offsetWidth;			
		}
		if( xMousePosMax>0 && x+ infoElement.offsetWidth> xMousePosMax-20 ){
			x= xMousePosMax-20- infoElement.offsetWidth;			
		}
		if( x<5 ){
			x=5;
		}		
		var y=yFromMouse+yMousePos;
		if( yMousePosMax>0 && y+ infoElement.offsetHeight> yMousePosMax ){
			y-= yFromMouse+yUpFromMouse;
		}		
		infoElement.style.left=x+'px'; 
		infoElement.style.top=y+'px';		
	} 
}
function setInfoText( text ){			
	var subtext='';
	for(var i=0;i<text.length;++i){		
		if(text.substr(i,4)=='<br>'){			
			infoElement.appendChild(document.createTextNode(subtext));
			infoElement.appendChild(document.createElement('br'));
			subtext='';
			i+=3;
		} else {
			subtext=subtext+text.charAt(i)
		}
	}	
	infoElement.appendChild( document.createTextNode(subtext));		
}
function unsetInfoText(){
	while(infoElement.hasChildNodes()){
		infoElement.removeChild(infoElement.lastChild);
	}	
}
function showInfo(){		
	unsetInfoText();
	infoElement.left='0px';
	infoElement.top='0px';
	setInfoText( this.infoText_ );		
	infoElement.style.visibility='visible';
	moveInfoElement();			
}
function hideInfo(){		
	infoElement.style.visibility='hidden';
	unsetInfoText();	
}

function disableRightClick(e)
{
  /*
	var message = "Right click disabled";
	*/
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
     /*  alert(message); */
      return false;
    }
  }
  else
  {
  /*  alert(message); */
    return false;
  }
}







function switchp(page, frame) {
	var frame = 'mainFrame';
  parent.frames[frame].location.href=page;
}

function MM_displayStatusMsg(msgStr) { 
  status=msgStr;
  document.MM_returnValue = true;
}

/* COOKIES */
function MWJ_retrieveCookie( cookieName ) {
	var cookieJar = document.cookie.split( "; " );
	for( var x = 0; x < cookieJar.length; x++ ) {
		var oneCookie = cookieJar[x].split( "=" );
		if( oneCookie[0] == escape( cookieName ) ) { return unescape( oneCookie[1] ); }
	}
	return null;
}

function koobi4_setCookie(name,value) {
	value = value+'@';
    
    // ein Jahr
    var lifeTime = 31536000;
	var currentStr = MWJ_retrieveCookie(name);
	
    if( !currentStr ) {
		//store the id
		MWJ_setCookie( name, value, lifeTime );
	} else if ( currentStr.indexOf(value)+1 ) {
		//delete from list of ids
		value = new RegExp(value,'');
		MWJ_setCookie(name, currentStr.replace(value,''), lifeTime);
	} else {
		//add to list of ids
		MWJ_setCookie(name, currentStr+value, lifeTime);
	}
}


function MWJ_setCookie( cookieName, cookieValue, lifeTime, path, domain, isSecure ) {
	if( !cookieName ) { return false; }
	if( lifeTime == "delete" ) { lifeTime = -10; }
	document.cookie = escape( cookieName ) + "=" + escape( cookieValue ) +
		( lifeTime ? ";expires=" + ( new Date( ( new Date() ).getTime() + ( 1000 * lifeTime ) ) ).toGMTString() : "" ) +
		( path ? ";path=" + path : "") + ( domain ? ";domain=" + domain : "") + 
		( isSecure ? ";secure" : "");
	//check if the cookie has been set/deleted as required
	if( lifeTime < 0 ) { if( typeof( MWJ_retrieveCookie( cookieName ) ) == "string" ) { return false; } return true; }
	if( typeof( MWJ_retrieveCookie( cookieName ) ) == "string" ) { return true; } return false;
}
function SymError(){return true;}
window.onerror = SymError;

