var ns4=window.Event?true:false
var mouseXposition
var mouseYposition
var divDestinatario=""

function posizione(evnt) {
	if (ns4) {
		if (evnt.pageX) {
			mouseXposition=evnt.pageX
			mouseYposition=evnt.pageY
		}
	}else{
		mouseXposition=event.clientX + document.body.scrollLeft
		mouseYposition=event.clientY + document.body.scrollTop
	}

//alert(mouseXposition)
//alert(mouseYposition)

}

function posizioneMouse() {


	if (ns4) {
		document.captureEvents(Event.MOUSEMOVE);
	}else{
		document.onmousemove = posizione;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	var w=window.open(theURL,winName,features);
	w.focus()
}

function posizioneWinCentro (leftX,topY) { 
	this.X = leftX; 
	this.Y = topY; 
}  


function centraSchermata(width,height)	{ // valorizza sWidth e sHeight

	var NS = (document.layers) ? 1 : 0;

	if (NS) {
		sWidth = top.window.innerWidth;
		sHeight = top.window.innerHeight;
	} else {

		sWidth = top.window.document.body

		if (sWidth) {
			sWidth=sWidth.clientWidth;
		}else{
			sWidth=screen.availWidth;
		}

		sHeight = top.window.document.body;

		if (sHeight) {
			sHeight=sHeight.clientHeight;
		}else{
			sWidth=screen.availHeight;
		}
	}

	sWidth=(sWidth-width)/2
	sHeight=(sHeight-height)/2

//alert(sWidth+"\n"+sHeight)

	posizione=new posizioneWinCentro(sWidth,sHeight)

	return posizione
}
