//self.onError=null;
CurrentX = CurrentY = 0;
WhichIt = null;
LastScrollX = 0; LastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function InstallDiv() {
if(IE) { DiffY = document.body.scrollTop; DiffX = document.body.scrollLeft; }
if(NS) { DiffY = self.pageYOffset; DiffX = self.pageXOffset; }
if(DiffY != LastScrollY) {
Percent = .1 * (DiffY - LastScrollY);
if(Percent > 0) Percent = Math.ceil(Percent);
else Percent = Math.floor(Percent);
if(IE) document.all.ServiceDiv.style.pixelTop += Percent;
if(NS) document.ServiceDiv.top += Percent;
LastScrollY = LastScrollY + Percent;
}
if(DiffX != LastScrollX) {
Percent = .1 * (DiffX - LastScrollX);
if(Percent > 0) Percent = Math.ceil(Percent);
else Percent = Math.floor(Percent);
if(IE) document.all.ServiceDiv.style.pixelLeft += Percent;
if(NS) document.ServiceDiv.left += Percent;
LastScrollX = LastScrollX + Percent;
}
}
function CheckFocus(X,Y) {
StalkerX = document.ServiceDiv.pageX;
StalkerY = document.ServiceDiv.pageY;
StalkerWidth = document.ServiceDiv.clip.width;
StalkerHeight = document.ServiceDiv.clip.height;
if( (X > StalkerX && X < (StalkerX + StalkerWidth)) && (Y > StalkerY && Y < (StalkerY + StalkerHeight))) return true;
else return false;
}
function GrabIt(E) {
if(IE) {
WhichIt = event.srcElement;
while (WhichIt.id.indexOf("ServiceDiv") == -1) {
WhichIt = WhichIt.parentElement;
if (WhichIt == null) { return true; }
}
WhichIt.style.pixelLeft = WhichIt.offsetLeft;
WhichIt.style.pixelTop = WhichIt.offsetTop;
CurrentX = (event.clientX + document.body.scrollLeft);
CurrentY = (event.clientY + document.body.scrollTop);
} else {
window.captureEvents(Event.MOUSEMOVE);
if(CheckFocus (E.pageX,E.pageY)) {

WhichIt = document.ServiceDiv;
StalkerTouchedX = E.pageX-document.ServiceDiv.pageX;
StalkerTouchedY = E.pageY-document.ServiceDiv.pageY;
}
}
return true;
}
function MoveIt(E) {
if (WhichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - CurrentX); distanceY = (newY - CurrentY);
CurrentX = newX; CurrentY = newY;
WhichIt.style.pixelLeft += distanceX;
WhichIt.style.pixelTop += distanceY;
if(WhichIt.style.pixelTop < document.body.scrollTop) WhichIt.style.pixelTop = document.body.scrollTop;
if(WhichIt.style.pixelLeft < document.body.scrollLeft) WhichIt.style.pixelLeft = document.body.scrollLeft;
if(WhichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - WhichIt.style.pixelWidth - 20) WhichIt.style.pixelLeft = document.body.offsetWidth - WhichIt.style.pixelWidth - 20;
if(WhichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - WhichIt.style.pixelHeight - 5) WhichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - WhichIt.style.pixelHeight - 5;
event.returnValue = false;
} else {
WhichIt.moveTo(E.pageX-StalkerTouchedX,E.pageY-StalkerTouchedY);
if(WhichIt.left < 0+self.pageXOffset) WhichIt.left = 0+self.pageXOffset;
if(WhichIt.top < 0+self.pageYOffset) WhichIt.top = 0+self.pageYOffset;
if( (WhichIt.left + WhichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) WhichIt.left = ((window.innerWidth+self.pageXOffset)-WhichIt.clip.width)-17;
if( (WhichIt.top + WhichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) WhichIt.top = ((window.innerHeight+self.pageYOffset)-WhichIt.clip.height)-17;
return false;
}
return false;
}
function DropIt() {
WhichIt = null;
if(NS) window.releaseEvents (Event.MouseMove);
return true;
}
if(NS) {
window.captureEvents(Event.MouseUp|Event.MouseDown);
window.onmousedown = GrabIt;
window.onmousemove = MoveIt;
window.onmouseup = DropIt;
}
if(IE) {

document.onmousedown = GrabIt;
document.onmousemove = MoveIt;
document.onmouseup = DropIt;
}
if(NS || IE) action = window.setInterval("InstallDiv()",1);