﻿// JScript File

//Holdes the current mouse x and y position
var moux, mouy;

//Determines if mouse is over an object
function MouseNotOver(obj)
{
    var position= findPos(obj);
    
    if (position[0] + 2 >= moux) return true; //mouse left of object
    if (position[0] + -2 + parseInt(obj.style.width)<= moux) return true; //mouse right of object
    
    if (position[1] + 2 >= mouy) return true; //mouse obove object
    if (position[1] + 2+ parseInt(obj.style.height)<=mouy) return true; // mouse under object
}
//Gets the window's size
function getwindow() 
{
    var d = document, v = window, w, h, l, t;
    if( typeof v.innerWidth==='number' ) 
    {
        w = v.innerWidth;
        h = v.innerHeight;
        l = v.pageXOffset;
        t = v.pageYOffset;
    } 
    else 
    if( ( v = d.documentElement ) && typeof v.clientWidth==='number' && v.clientWidth !== 0 || ( v = d.body ) ) 
    {
        w = v.clientWidth;
        h = v.clientHeight;
        l = v.scrollLeft;
        t = v.scrollTop;
    }
    return {w: w, h: h, l: l, t: t};
}
//Get current mouse position
function getmouse( e ) 
{
    e = e || window.event || {};
    var w = getwindow(),
    minx = w.l,
    miny = w.t,
    maxx = w.w + w.l,
    maxy = w.h + w.t;
    if( typeof e.pageX==='number' ) 
    {
        moux = e.pageX;
        mouy = e.pageY;
    } 
    else 
    {
        moux = e.x + w.l;
        mouy = e.y + w.t;
    }  
  checkMenus();
}
//Get element position
function findPos(obj) 
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}