
// pop up
function popen(urlstr,nom,larg,haut,top,gch,scrl,rsz) {
	new_win = window.open(urlstr, nom, 'toolbar=no, location=no, directories=no, status=no, scrollbars='+scrl+', resizable='+rsz+', menubar=no, width='+larg+', height='+haut+', top='+top+', left='+gch+'');
	new_win.focus();
	return;
}
// capture mouse pos event
if (document.layers) {// Netscape 4
	document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = captureMousePosition;
} else {
	document.onmousemove = captureMousePosition;
}

var cOffsetX=20, cOffsetY=-200;
var winX = 0;
var winY = 0;

function captureMousePosition(e){
	if (document.all) {
		winX=(Math.ceil((event.screenX)/20)*20);
		winY=(Math.ceil((event.screenY)/20)*20);
		winXb=(Math.ceil((event.x+document.body.scrollLeft)/5)*5);
		winYb=(Math.ceil((event.y+document.body.scrollTop)/5)*5);
	} else {
		winX=(Math.ceil((e.screenX)/20)*20);
		winY=(Math.ceil((e.screenY)/20)*20);
		winXb=(Math.ceil((e.pageX)/5)*5);
		winYb=(Math.ceil((e.pageY)/5)*5);
	}
}

var calendrier=null;
// calendrier popup
function winit2(presdate, nomfrom, nomchamp) {
	var cOffsetX=-100, cOffsetY=5;
	var pWidth = "200"; var pHeight = "190"; var pNom = "cal";
	var pLeft = (winX+cOffsetX); var pTop = (winY+cOffsetY);

	if (navigator.platform.indexOf("Mac") == 0) {
		var pUrlstr = "calendrier.php?presdate="+presdate+"&formu="+nomfrom+"&champ="+nomchamp+"&posL="+winX+"&posT="+winY+"";
		calendrier = popen(pUrlstr, pNom, pWidth, pHeight, pTop, pLeft, 0, 0);
	} else {
		if (calendrier!=null) { calendrier.close(); calendrier=null; }
		var pUrlstr = "calendrier.php?presdate="+presdate+"&formu="+nomfrom+"&champ="+nomchamp+"";
		calendrier = popen(pUrlstr, pNom, pWidth, pHeight, pTop, pLeft, 0, 0);

		if ( (navigator.appName.indexOf("Netscape") == 0) && (navigator.appVersion.indexOf("4") == 0) ){// Netscape 4 :(
			calendrier=null;
		}
	}
}