var theObj="";

function toolTip(prodName,prodDescr,me,itens) {
  theObj=me;
  theObj.onmousemove=updatePos;
  if(itens == "2"){
  	document.getElementById('toolTipBox').innerHTML= "<div id=\"tt_content\"><dt>" + prodName + "</dt><dd>" + prodDescr + "</dd></div><span id=\"tt_bottom\"></span>";
  } else {
	  document.getElementById('toolTipBox').innerHTML= "<div id=\"tt_content\"><dd style=\"padding-top:10px;\">" + prodDescr + "</dd></div><span id=\"tt_bottom\"></span>";
  }
  document.getElementById('toolTipBox').style.top = -500;
  document.getElementById('toolTipBox').style.display="block";
  window.onscroll=updatePos;
}

function updatePos() {
	
	var ev=arguments[0]?arguments[0]:event;
	var x=ev.clientX;
  
	if (x > 800){ 
		document.getElementById('toolTipBox').style.marginLeft = '-160px';
		//document.getElementById('tt_bottom').style.backgroundRepeat = 'no-repeat';
		//document.getElementById('tt_bottom').style.backgroundPosition = '160px -2px';
		} else {
			document.getElementById('toolTipBox').style.marginLeft = '-10px';
			//document.getElementById('tt_bottom').style.backgroundRepeat = 'no-repeat';
			//document.getElementById('tt_bottom').style.backgroundPosition = '10px -2px';
			}
  
	var y=ev.clientY;	
	
	var divHeight = document.getElementById('toolTipBox').offsetHeight;
	diffX=-15;
	diffY=-(divHeight - document.documentElement.scrollTop);
	document.getElementById('toolTipBox').style.top  = y-5+diffY+(document.body.scrollTop)+ "px";
	document.getElementById('toolTipBox').style.left = x-2+diffX+document.body.scrollLeft+"px";
	//theObj.onmouseout=hideMe;
}

function hideMe() {
  document.getElementById('toolTipBox').style.display="none";
}

function NewWindow(mypage, myname, w, h, scroll, center) {
	if (typeof h == "string") {
		if (mm = h.match(/(.*?)\%/)) {
			h = (mm[1]/100) * screen.height;
		}
	}
	if (typeof w == "string") {
		if (mm = w.match(/(.*?)\%/)) {
			w = (mm[1]/100) * screen.width;
		}
	}

	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	if (center == null || center == undefined) {
		center = true;
	}
	
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
