
/* You may edit the following variables */
var mozilla_opt = 1; // change to 0 to use Netscape and Firefox built-in search window
var start_at = 0; // Change to which character you want to start with on the page if IE gives an error because of searching in menus
var cursorX = 10;
var cursorY = 10;
// Example: start_at = 300, makes the find start at the 300th character on the page
/* Do not edit anything below this line */

//var ie = ((navigator.appVersion.indexOf("MSIE")!= -1)&&!window.opera)? true : false; // to detect if IE
var ie = (document.all)
//if (document.getElementById && !document.all)
if (window.find) {
	var nav = 1; // to detect if netscape or firefox
}else {
	var nav = 0;
}

var t = 0;  // used for timer to move window in IE when scrolling
var sel; // Selection object needed for Firefox
var range; // range object needed for Firefox


// The following is to capture mouse movement
// If Netscape or Mozilla -- then set up for mouse capture
if (!ie) {
	document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}

document.onmousedown = MouseDown;
document.onmousemove = MouseMove;
//document.onmouseup = MouseUp;


if (ie) {
	document.attachEvent('onmouseup',MouseUp);
}else{
	document.addEventListener('mouseup',MouseUp,false);
}



function getMouseX(evt) {
	if (evt.pageX) {
		return evt.pageX;
	}else if (evt.clientX){
		 return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
	}	else {
		return null;
	}
}

function getMouseY(evt) {
	if (evt.pageY) {
		return evt.pageY;
	}else if (evt.clientY){
		 return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	}else {
		return null;
	}
}

function MouseDown(e) {
    if (over == 1) 
    	DivID = 'Layer1';
	
	if (over) {
		if (ie) {
            objDiv = document.getElementById(DivID);
            objDiv = objDiv.style;
            mousex=event.offsetX;
            mousey=event.offsetY;
        }  else { // if Mozilla or Netscape 
            objDiv = document.getElementById(DivID);
            mousex=e.layerX;
            mousey=e.layerY;
            return false;
        } // end if (ie)
    } // end if (over)
}

function MouseUp() {
    objDiv = null;
}

function MouseMove(e) {
    
	// get current top 
	if (document.documentElement.scrollTop) {// Needed if you use doctype loose.htm
		current_top = document.documentElement.scrollTop;
	}else {
		current_top = document.body.scrollTop;
	}
	
	// get current left
	if (document.documentElement.scrollLeft) {// Needed if you use doctype loose.htm
		current_top = document.documentElement.scrollLeft;
	}else {
		current_left = document.body.scrollLeft;
	}
	
	if (objDiv)	{
        if (ie) {
            objDiv.pixelLeft = event.clientX-mousex + current_left;
            objDiv.pixelTop = event.clientY-mousey + current_top;
            return false;
        }else {// if Mozilla or Netscape
            objDiv.style.left = (e.pageX-mousex) + 'px';
            objDiv.style.top = (e.pageY-mousey) + 'px';
            return false;
        } // end if (ie)
    } // end if (objDiv)
}  // end function MouseMove(e)


// over variable is whether mouse pointer is over the DIV to move
var over = 0;

// Object to hold findwindow for MouseMove
var objDiv = null;

// ID of DIV for MouseMove functions
var DivID = null;

