// JavaScript Document
var oldX = 10;
var oldY = 10;
function openWin(new_url, new_width, new_height) {
	detect = navigator.userAgent.toLowerCase();
	OS = "unknown";
	if (checkIt(detect,'linux')) OS = "Linux";
		else if (checkIt(detect,'x11')) OS = "Unix";
		else if (checkIt(detect,'mac')) OS = "Mac";
		else if (checkIt(detect,'win')) OS = "Windows";

	//alert( 'oldX='+oldX+', oldY='+oldY );
		if( typeof textwin != "undefined" ) {
			//oldX = textwin.screenX; oldY = textwin.screenY;
			if( (!textwin.closed) ) { //&& (OS != 'Mac') ) {
				oldX = textwin.screenX; 
				oldY = textwin.screenY;
				textwin.close();
			}
		} else {
			oldX=5; oldY=5;
	}
	width = new_width;
	height = new_height;
	url= new_url;
	
	winFeatures='width='+ new_width +',height=' +  new_height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,screenX='+oldX+',screenY='+oldY;
	winName= 'textwin' + (new Date()).getTime();
	textwin=window.open(url, winName, winFeatures );
	textwin.top.window.moveTo(10,10);
	//textwin.moveTo( textwin.screenX, textwin.screenY ); // no-op, but might help bring to front
	textwin.focus(); // if we have JavaScript1.1, we can bring window to the front too :o)
	
}
function checkIt( s1, s2 ) {
       place = s1.indexOf(s2) + 1;
       return place;
}
//top.window.moveTo(screen.availWidth-((top.window.width/2)),20);
if (document.all) {
	top.window.moveTo(10,10)
}
