/*
Version 2.1

*/
var infobox, offsetX, offsetY, isDragging=false;

function infoboxgo(linkvalue, ziel, breite, obj, offsetinfobox) {
	MM_showHideLayers(ziel,'','show');
	macheRequest(linkvalue, ziel+'_content');
	if(breite) MM_changeProp('infobox','width',breite);
	if(!offsetinfobox) offsetinfobox=0;
	if(obj) {
		r = getAbsolutePosition(obj);
		MM_changeProp('infobox','left',r.x-offsetinfobox);
	    MM_changeProp('infobox','top',r.y);
	}
	
window.onload = init;
document.onmousemove = mM;
document.onmouseup = mU;	
}


function init() {
	var ob = document.getElementById("infobox");
	
	ob.ondrag=function(){return false;};
	ob.onselectstart=function(){return false;};
	
	ob.style.left="100px";
	ob.style.top="100px";
	ob.style.display="block";
}

function mD(ob,e) {
	infobox = ob;
	
	if (window.event) e=window.event;
	
	var dragX = parseInt(infobox.style.left);
	var dragY = parseInt(infobox.style.top);
	
	var mouseX = e.clientX;
	var mouseY = e.clientY;
	
	offsetX = mouseX - dragX;
	offsetY = mouseY - dragY;
	
	isDragging = true;
	
	return false;
}

function mM(e) {
	if (!isDragging) return;
	
	if (window.event) e=window.event;
	
	var newX = e.clientX - offsetX;
	var newY = e.clientY - offsetY;
	
	infobox.style.left = newX + "px";
	infobox.style.top = newY + "px";
	
	return false;
}

function mU() {
	if (!isDragging) return;
	
	isDragging = false;
	
	return false;
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function MM_changeProp(objId,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}

// Mausposition ermitteln
function getAbsolutePosition(element) {
    var r = { x: element.offsetLeft, y: element.offsetTop };
    if (element.offsetParent) {
      var tmp = getAbsolutePosition(element.offsetParent);
      r.x += tmp.x;
      r.y += tmp.y;
    }
    return r;
}
