
var mX = 0;
var mY = 0;

function Mausklick (Ereignis) {
  if (!Ereignis)
    Ereignis = window.event;
    
    var dX =  window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
    var dY =  window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
    
    
  if (document.getElementById) {
    mX = Ereignis.clientX + dX;
    mY = Ereignis.clientY + dY;
  } else if (document.all) {
    mX = Ereignis.clientX + dX;
    mY = Ereignis.clientY + dY;
  }
  
}

document.onmousemove = Mausklick;

function elmSetMousePos( el ) {
	makeZtop(el);
	var mposX = 0;
	var mposY = 0;
	var mposW = 0;
	var mposH = 0;
	var t;
			t = $(el).style.width;
			t = t.substr(0, t.length-2);
	var eW = t*1;
			t = $(el).style.height;
			t = t.substr(0, t.length-2);
	var eH = t*1;
	if ( eW < 1 ) eW = 200;
	if ( eH < 1 ) eH = 200;
	
	if ( $('mainFensterInhalt') ) {
			t = $('mainFensterInhalt').style.top;
			t = t.substr(0, t.length-2);
		mposY = t*1;
		
			t = $('mainFensterInhalt').style.left;
			t = t.substr(0, t.length-2);
		mposX = t*1;
		
			t = $('mainFensterInhalt').style.height
			t = t.substr(0, t.length-2);
		mposH = t*1;
		
			t = $('mainFensterInhalt').style.width
			t = t.substr(0, t.length-2);
		mposW = t*1;
	}

	
	var x = (((mX*1) + 20 )- mposX);
	var y = (((mY*1) + 20 )- mposY);
	if (  (x+eW) > mposW ) x = mposW - eW - 10;
	if (  (y+eH) > mposH ) y = mposH - eH - 10;
	
	
	$(el).style.top  = y + "px";
	$(el).style.left = x + "px";

	Element.show(el);
}


var maxLayerIndex = 1000;

function makeZtop( layer ) {

	maxLayerIndex = maxLayerIndex + 10;
	$(layer).style.zIndex = maxLayerIndex;
	//$('status').innerHTML = maxLayerIndex;
}

function tipE( inhalt ) {

	inhalt  = inhalt.replace(/\n/g, "<br>");

	$('tipInhalt').innerHTML= inhalt;
	var hohe = $('tipInhalt').style.height;
	hohe = hohe.substring( 0,hohe.length-2 );
		
	var tipposy = mY + ( 5 + parseInt(hohe) );
	var tipposx = mX - 40;
	
	if ( tipposy < 10 ) {
		tipposy = mY + 10
		//document.getElementsByName('tippfeil')[0].src="/bilder/blase/blank.gif";
		//document.getElementsByName('tippfeiloben')[0].src="/bilder/blase/pfeiloben.gif";
	} else {
		//document.getElementsByName('tippfeil')[0].src="/bilder/blase/pfeil.gif";
		//document.getElementsByName('tippfeiloben')[0].src="/bilder/blase/blank.gif";	
	}
	
	$('tip').style.top = tipposy + "px";
	$('tip').style.left = tipposx + "px";
	
	Element.show('tip');
	makeZtop('tip'); 
	//$('tipInhalt').innerHTML= "<table border='0' bgcolor='#fdffcf'><TR><TD nowrap>"+inhalt+"</TD></TR></table>";
}

function getWindowWidth(win)
{
    if (win == undefined)
        win = window;
    if (win.innerWidth) {
        return win.innerWidth;
    } else {
        if (win.document.documentElement 
                && win.document.documentElement.clientWidth) 
        {
            return win.document.documentElement.clientWidth;
        }
        return win.document.body.offsetWidth;
    }
}

function getWindowHeight(win)
{
    if (win == undefined)
        win = window;
    if (win.innerHeight) {
        return win.innerHeight;
    } else {
        if (win.document.documentElement 
                && win.document.documentElement.clientHeight) 
        {
            return win.document.documentElement.clientHeight;
        }
        return win.document.body.offsetHeight;
    }
}    
    
  String.prototype.leftTrim = function () {
    return (this.replace(/^\s+/,""));
  };
  String.prototype.rightTrim = function () {
    return (this.replace(/\s+$/,""));
  };
//kombiniert "leftTrim" und "rightTrim";
  String.prototype.basicTrim = function () {
    return (this.replace(/\s+$/,"").replace(/^\s+/,""));
  };
//dampft leerzeichen(-sequenzen) innerhalb einer zeichenkette auf ein einzelnes "space" ein;
  String.prototype.superTrim = function () {
    return(this.replace(/\s+/g," ").replace(/\s+$/,"").replace(/^\s+/,""));
  };

//zugabe: entfernt alle leerzeichen aus einer zeichenkette;
  String.prototype.removeWhiteSpaces = function () {
    return (this.replace(/\s+/g,""));
  };
    
  //------------------------------------------------------------------------------------
  //------------------------------------------------ neuse fenster ----------------
  	  
  var nw;	
  function neuesfenster( url, x, y, top, left, na, menubar, scrollbar) {
  
	var tmp = new Date();
	var se = tmp.getTime();
	
	if ( !na ) { na = "NeuesFenster"}
	if ( !top ) top = "0";
	if ( !left) left = "0";
	
	menubar = !menubar ? 0 : 1;
	scrollbar = !scrollbar ? 1 : 0;
	
	if ( x == 0 && y == 0 ) {
		var Groesse = 'left='+ left +',top='+ top +',width='+ ( screen.width - 10 ) +',height='+ ( screen.height-10 ) +',';
	} else {
		var Groesse = 'left='+ left +',top='+ top +',width='+ x +',height='+ y +',';
	}
	
	var DefParam = "scrollbars="+ scrollbar  + ", directories=0,location=0,location=no,locationbar=0,locationbar=no,menubar="+ menubar + ",resizable=0,status=1,toolbar=0";
	nw = window.open(url, na, Groesse+DefParam);
	
	setTimeout("nw.focus()",1000);
	
  	return nw;
  }
  
  function neuesfenster2( url ) {
      window.open( url );
  }
 	//---------------------------------------------------------------------------------------------	
 	//---------------------------------------------------------------------------------------------	
	function requestFilter( request ) {

		tex = request.responseText;
		
			var start 	= tex.indexOf("<!-- start ") + 11;
			var end 	= tex.indexOf(" ende -->") - start;
			var te 	= tex.substr( start, end );
			
			//var re = / |\n|\r|\t/g;
			//te = te.replace(re, "_");

			return te;

	}

