if (document.layers) { // Netscape
   document.captureEvents(Event.MOUSEMOVE);
   document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
	//alert("entrou");
   document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
   document.onmousemove = captureMousePosition;
}
// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

meux=0;
meuy=0;

function Browser() {
	var b=navigator.appName;
	if (b=="Microsoft Internet Explorer" && navigator.userAgent.indexOf('Opera') == -1 && navigator.appVersion.indexOf("Mac")==-1) this.b="ie";
  else {this.b="other";}
}
is = new Browser();
//alert(is.b);


function captureMousePosition(e) {
   if (document.layers) {
       xMousePos = e.pageX;
       yMousePos = e.pageY;
       xMousePosMax = window.innerWidth+window.pageXOffset;
       yMousePosMax = window.innerHeight+window.pageYOffset;
   } else if (document.all) {
   		 meux=window.event.x;
		 meuy=window.event.y;
       /*
	   xMousePos = window.event.x+document.body.scrollLeft;
       yMousePos = window.event.y+document.body.scrollTop;
       xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
       yMousePosMax = document.body.clientHeight+document.body.scrollTop;
	   */
   	   xMousePos = document.body.scrollLeft;
       yMousePos = document.body.scrollTop;
       xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
       yMousePosMax = document.body.clientHeight+document.body.scrollTop;

   } else if (document.getElementById) {
       // Netscape 6 behaves the same as Netscape 4 in this regard 
       xMousePos = e.pageX;
       yMousePos = e.pageY;
       xMousePosMax = window.innerWidth+window.pageXOffset;
       yMousePosMax = window.innerHeight+window.pageYOffset;
   }

}
			
//o urlaberto é para o caso de a janela da infopedia ja estar aberta
function abre_popup(url,urlaberto){

	if(typeof p != "undefined" && !p.closed){
	//if(typeof window.frames["infopediamz"] != "undefined"){
	//agora tenho de ver o url e transforma-lo!
		p.corpo.location=urlaberto;
		p.focus();
	}
	else {
		var left,top,top1;
		var wit=275;
		var hei=250;
	    if(is.b!="other"){
		  left=meux + document.body.scrollLeft;
	      if((left+wit)>document.body.clientWidth) {
	         left=left - wit;
	      }
	      top=meuy + document.body.scrollTop +10;
	      if((top + hei)>document.body.clientHeight) {
	        top1=top - hei -18;
	        if((top - hei)<0) {
	          top=10;
	        }
	        else{
	          top=top1;
	        }
	      }
	      //alert("left=" + left + "top=" + top);
	      document.all['anotacaoTextFrame'].src=url;
	      document.all['anotacao'].style.left=left;
	      document.all['anotacao'].style.top=top;
	      document.all['anotacao'].style.visibility = 'visible';

      //window.open(url,'anotacao','resizable=no,status=yes,menubar=no,width=' + wit + ',height=' + (hei+20));
	    }
	    else{ //netscape
	      //alert("rui");
	      var otherparam="other=sim";
	      var urlPage=url + "&" + otherparam;
	      window.open(urlPage,'anotacao','resizable=no,status=no,menubar=no,width=' + wit + ',height=' + (hei+20));
	    }
	
	}
}

