var to_showtip;

function Ventana(url,nombre,opc)
{
	v=window.open(url,nombre,opc);
	v.focus();
}

function VentWH(url,nombre,w,h,sb,opc)
{
	o="";
	maxw=screen.width-16;
	maxh=screen.height-75;
	l=0;t=0;
	
	if(maxw && w>maxw)
	{
		h=h*(maxw/w);
		w=maxw;
		sb=1;
	}
	
	if(maxh && h>maxh)
	{
		w=w*(maxh/h);
		h=maxh;
		sb=1;
	}
	
	if(maxw) l=(maxw-w)/2;
	if(maxh) t=(maxh-h)/2;
	
	o+="left="+parseInt(l)+",top="+parseInt(t)+",width="+parseInt(w)+",height="+parseInt(h);
	if(sb) {
		o+=",scrollbars";
	}
	
	if(opc!="") o+=","+opc;
	Ventana(url,nombre,o);
}
function getX(obj)
{
	if(obj.tagName=="DIV") return 0;
	return(obj.offsetParent==null?obj.offsetLeft:obj.offsetLeft+getX(obj.offsetParent));
}

function getY(obj)
{
	if(obj.tagName=="DIV") return 0;
	return(obj.offsetParent==null?obj.offsetTop:obj.offsetTop+getY(obj.offsetParent));
}

function showtipshow()
{
    elmtooltip=document.getElementById("tooltip");
	if(elmtooltip) {
		elmtooltip.style.visibility = "visible"
	}
}

function showtip(current,texto,delay)
{
   	if(document.getElementById) {  // Netscape 6.0+ and Internet Explorer 5.0+
        elm=current;
	    elmtooltip=document.getElementById("tooltip");
		if(elmtooltip) {
		    elmtooltip.innerHTML=texto;
		    elmtooltip.style.top=parseInt(getY(elm)+elm.offsetHeight+2)
			elmtooltip.style.left=parseInt(getX(elm))
			if(delay>0) {
				to_showtip=setTimeout('showtipshow()',delay);
			} else {
				showtipshow();
			}
		}
	}
}

function hidetip()
{
	clearTimeout(to_showtip);
	if(document.getElementById)
	{
		elmtooltip.style.visibility="hidden"
	}
}

function hideLoadingPage() {
	if (document.getElementById) {  // DOM3 = IE5, NS6
    	document.getElementById('hidepage').style.visibility = 'hidden';
	} else {
		if (document.layers) {  // Netscape 4
			document.hidepage.visibility = 'hidden';
		} else {  // IE 4
			document.all.hidepage.style.visibility = 'hidden';
		}
	}
}

function Redondea(x,n)
{
	var p;
	n=(!n?2:n);
	a=Math.pow(10,n);
	
	q=Math.round(x*a)/a;
	
	q=String(q);
	p=q.indexOf('.');
	if(p<0) return q;
	while (q.length <= p+n) q+='0'
	return q;
}
