function JSW_EventManager()
{
	this.getMouseXPos = function(e)
	{
    // returns x-coordinate of mouse cursor
    }
	this.getMouseYPos = function(e)
	{
    // returns y-coordinate of mouse cursor
    }
    this.addEvent = function(event_type, method_name, obj)
    {
    // adds specified event to object
    }
    this.removeEvent = function(event_type, method_name, obj)
    {
    // removes specified event from object
    }
    this.getEventCaller = function(evt)
    {
    // returns caller-object of specified event
    }
    this.getKeyCode = function(evt)
    {
    // returns keycode
    }
}

function JSW_EventManagerMicrosoft()
{
	JSW_EventManagerMicrosoft.prototype = new JSW_EventManager();
	this.getMouseXPos = function(e)
	{
		var mousex = null;
		try
		{
			mousex = parseInt(window.event.clientX);
		}
		catch(e) {}
		return(mousex);
	}
	this.getMouseYPos = function(e)
	{
		var mousey = null;
		try
		{
			mousey = parseInt(window.event.clientY);
		}
		catch(e) {}
		return(mousey);
	}
	this.addEvent = function(event_type, method_name, obj)
	{
	    //obj.method_name = method_name;
		var addevent = null;
		try
		{
			addevent = obj.attachEvent('on'+event_type, method_name);
		}
		catch(e) {}
	    return(addevent);
	}
	this.removeEvent = function(event_type, method_name, obj)
	{
	    var detachevent = null;
	    try
	    {
	    	detachevent = obj.detachEvent("on"+event_type, method_name); 
	    }
	    catch(e) {}
	    return(detachevent);
	}
	this.getEventCaller = function(evt)
	{
	    return(window.event.srcElement);
	}	
    this.getKeyCode = function(evt)
    {
        return(window.event.keyCode);
    }	
}
function JSW_EventManagerOpera()
{
	JSW_EventManagerOpera.prototype = new JSW_EventManager();
	this.getMouseXPos = function(e)
	{
		return(parseInt(e.clientX));
	}
	this.getMouseYPos = function(e)
	{
		return(parseInt(e.clientY));
	}
	this.addEvent = function(event_type, method_name, obj)
	{
	    obj.method_name = method_name;
	    return(obj.addEventListener(event_type, method_name, false));
	}
	this.getEventCaller = function(evt)
	{
	    return(evt.target);
	}			
    this.getKeyCode = function(evt)
    {
        return(evt.which);
    }	
}
function JSW_EventManagerNetscape()
{
	JSW_EventManagerNetscape.prototype = new JSW_EventManager();
	this.getMouseXPos = function(e)
	{
		var pagex = null;
		try
		{
			pagex = parseInt(e.pageX);
		}
		catch(e) {}
		return(pagex);
	}
	this.getMouseYPos = function(e)
	{
		var pagey = null;
		try
		{
			pagey = parseInt(e.pageY);
		}
		catch(e) {}
		return(pagey);
	}
	this.addEvent = function(event_type, method_name, obj)
	{
		var addevent = null;
		try
		{
			obj.method_name = method_name;
			addevent = obj.addEventListener(event_type, method_name, false);
		}
		catch(e) {}
		return(addevent);
	}		
	this.removeEvent = function(event_type, method_name, obj)
	{
		var removeevent = null;
		try
		{
			obj.method_name = method_name;
			removeevent = obj.removeEventListener(event_type, method_name, false);
		}
		catch(e) {}
		return(removeevent);
	}
	this.getEventCaller = function(evt)
	{
	    return(evt.target);
	}						
    this.getKeyCode = function(evt)
    {
        return(evt.which);
    }		
}

