function mouse_call(){
	//  xajax.callback.global.onRequest = onRequest;
	//xajax.callback.global.beforeResponseProcessing = beforeResponseProcessing;
	var params = {};
	var i;
	for(i=0; i<arguments.length; i++) {
		params[i] = arguments[i];
	}
	
	//xajax.call("xajax", {parameters: [arguments], onRequest: onRequest, onComplete:beforeResponseProcessing});
	
	xajax.request( { xjxfun: 'xajax' }, { parameters: [params] });
}

function show_overlay(){
    el = document.getElementById('m_overlay');
    if(el.style.display == 'none'){
	el.style.display = 'block';
	w = document.getElementById('main').offsetWidth;
	h = document.getElementById('main').offsetHeight;
	el.src="/?mod=clicks&w=" + w + "&h=" + h;
    }else{
	el.style.display = 'none';
	el.src='';
    }
    //document.getElementById('overlay').src = block;
    
    
}

var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
//document.main.onmousedown = getMouseXY;
//document.getElementById('main').onmousedown = getMouseXY;
document.onmousedown = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  dx = document.getElementById('main').offsetLeft;
  dy = document.getElementById('main').offsetTop;
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }
  tempX = tempX - dx
  tempY = tempY - dy
  // catch possible negative values in NS4
  if (tempX < 0)return true;
  if (tempY < 0)return true;
  w = document.getElementById('main').offsetWidth;
  h = document.getElementById('main').offsetHeight;
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  if(tempY > h - 50)return true;
  if(tempX > w)return true;
  mouse_call('clicks', tempX, tempY, w, h);
  return true
}
