//20070919 KUV
var dragactive = false; // flag, durch klick auf lupe gesetzt

var dragx = 0; var dragy = 0; // position des klicks
var posx = 0; var posy = 0; // position der maus
var lupeobj;
var clipobj;
var inhaltobj;

window.onload = function() {

 lupeobj = new XElement("lupe");
 lupeobj.sichtbar = false;
 //alert(lupeobj.x+"/"+lupeobj.y);
 //lupeobj.moveTo((lupeobj.x+28), ((lupeobj.el.offsetTop)));  //lupe gleiche hoehe wie !!offsetTop
 lupeobj.toggleV();

 clipobj = new XElement("bindex");
 clipobj.sichtbar = false;
 clipobj.clipTo((lupeobj.y + 13), (lupeobj.x + 13 + 61), (lupeobj.y + 13 + 61), (lupeobj.x + 13));
 clipobj.toggleV();
 inhaltobj = new XElement("inhalt");
 clipobj.css.height = inhaltobj.hoehe + 'px'; //wegen overflow min-height fehler in firefox

 // draginit
 document.onmousemove = drag;
 document.onmouseup = dragstop;
}

function drag(ereignis) {
  //Wird aufgerufen, wenn die Maus bewegt wird und bewegt bei Bedarf das Objekt.
  posx = document.all ? window.event.clientX : ereignis.pageX;  // Mausposition
  posy = document.all ? window.event.clientY : ereignis.pageY;

  if(dragactive) {
    x = (posx - dragx);
    y = (posy - dragy);
    //if (x>0 && y>0) {
    lupeobj.moveTo(x,y);
      clipobj.clipTo((lupeobj.y + 13), (lupeobj.x + 13 + 61), (lupeobj.y + 13 + 61), (lupeobj.x + 13));
  }
}

function dragstop() {
	dragactive = false;
}

function dragstart() {
	dragactive = true;
  	dragx = posx - lupeobj.x;
  	dragy = posy - lupeobj.y;
}
function donothing() {alert("upps - dat geht noch nich");}
