function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_controlSound(x, _sndObj, sndFile) { //v3.0
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = "play";
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else window.location = sndFile;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function ventana(myurl,wl,wh)
	{
		myWindow = window.open(myurl,'myWindow','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width='+wl+',height='+wh);
		if (! ((navigator.appName=='Microsoft Internet Explorer') && (parseInt(navigator.appVersion.substring(0,1),10)<4)) )
		myWindow.focus();
	}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function ventana(myurl,wl,wh)
	{
		myWindow = window.open(myurl,'myWindow','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,width='+wl+',height='+wh);
		if (! ((navigator.appName=='Microsoft Internet Explorer') && (parseInt(navigator.appVersion.substring(0,1),10)<4)) )
		myWindow.focus();
	}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// JavaScript Document
function mOvr(src,clrOver) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'borde-ptos';
src.bgColor = clrOver;
}
}
function mOut(src,clrIn) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'borde-ptos';
src.bgColor = clrIn;
}
}
function mClk(src) {
if(event.srcElement.tagName=='TD'){
src.children.tags('A')[0].click();
}
}
function mueveReloj(){ 
    momentoActual = new Date() 
    hora = momentoActual.getHours() 
    minuto = momentoActual.getMinutes() 
    segundo = momentoActual.getSeconds() 

    str_segundo = new String (segundo) 
    if (str_segundo.length == 1) 
       segundo = "0" + segundo 

    str_minuto = new String (minuto) 
    if (str_minuto.length == 1) 
       minuto = "0" + minuto 

    str_hora = new String (hora) 
    if (str_hora.length == 1) 
       hora = "0" + hora 

    horaImprimible = hora + " : " + minuto + " : " + segundo 

    document.form_reloj.reloj.value = horaImprimible 

    setTimeout("mueveReloj()",1000) 
} 
function tS()
{
 x=new Date(); x.setTime(x.getTime()); return x;
  }
function lZ(x)
{ 
return (x>9)?x:'0'+x; 
}
function dT()
{ 
if(fr==0)
{ 
fr=1; document.write('<font size=1 face=Verdana color=white><span id="tP">'+eval(oT)+'</span></font>'); 
} 
tP.innerText=eval(oT); setTimeout('dT()',1000); 
}
var fr=0,oT="lZ(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '";
function is_right_available(box,e) {
	if ((box.clientWidth+e.clientX+h_padding)>=winWidth){
		return false; // not available
	}
	return true;
}

function is_top_available(box,e) {

	if ((e.clientY-box.clientHeight-v_padding) < 0){
		return false;
	}
	return true;

}

function is_bot_available(box,e) {
	if ((e.clientY+box.clientHeight+v_padding) > winHeight){
		return false;
	}
	return true;
}

function is_left_available(box,e) {
	if ((e.clientX-box.clientWidth-h_padding)<0){

		return false;
	}
	return true;

}

function boxFinishedMoving(box) {

	var y=box.offsetTop;
	var x=box.offsetLeft;

	if ((y<box.ypos)||(y>box.ypos)||(x<box.xpos)||(x>box.xpos)) {
		return false;
	} else {
		return true;
	}


}


function moveBox() {

	var box = document.getElementById('bubble');

	var y=box.offsetTop;
	var x=box.offsetLeft;

	if (!boxFinishedMoving(box))
	{
		if (y<box.ypos)
		{
			y++;
			box.style.top = y;
		}

		if (y>box.ypos)
		{
			y--;
			box.style.top = y;
		}

		if (x<box.xpos)
		{
			x++;
			box.style.left = x;
		}

		if (x>box.xpos)
		{
			x--;
			box.style.left = x;
		}
		window.setTimeout("moveBox()", 10);
	}


}

winWidth=0;
winHeight=0;
initFrameSize();
function initFrameSize() {

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  winWidth=myWidth;
	winHeight=myHeight;
}
pos = 'right';
h_padding=0;
v_padding=0;
function  showBubble(e, str, area)
{
	posRefX= ((e.pageX && !e.clientX) ? e.pageX : e.clientX + document.body.scrollLeft);
	posRefY= ((e.pageY && !e.clientY) ? e.pagey : e.clientY + document.body.scrollTop);
	var relTarg;
	var bubble = document.getElementById('bubble');
	if (!e) var e = window.event;
	if (e.relatedTarget) relTarg = e.relatedTarget;
	else if (e.fromElement) relTarg = e.fromElement;

	b = bubble.style
	document.getElementById('bubble').innerHTML=str;
	var mytop =  is_top_available(bubble,e);
	var mybot = is_bot_available(bubble, e);
	var myright = is_right_available(bubble,e);
	var myleft = is_left_available(bubble,e);

	if (mytop)
	{
		// move to the top
		//b.top=e.clientY-bubble.clientHeight-v_padding;
		bubble.ypos=posRefY-bubble.clientHeight-v_padding;
		//document.write(bubble.ypos);
		//alert(bubble.xpos);
	}

	if (myright)
	{
		// move to the right
		//b.left=e.clientX+h_padding;//+bubble.clientWidth;
		bubble.xpos=posRefX+h_padding;
	}

	if (myleft)
	{
		// move to the left
		//b.left=posRefX-bubble.clientWidth-h_padding ;
		bubble.xpos=posRefX-bubble.clientWidth-h_padding ;
	}
	if (mybot)
	{
		// move to the bottom
		//b.top=posRefY+v_padding;
		bubble.ypos=posRefY+v_padding;
	}
	b.visibility='visible';
	moveBox()
	//moveBox(bubble);
	window.setTimeout("moveBox()", 10);
}

function hideBubble(e) {
	var bubble = document.getElementById('bubble');
	b = bubble.style;
	b.visibility='hidden';
}
var timeoutId=0;
function hideIt() {
	if (timeoutId==0) {
		timeoutId = window.setTimeout('hideBubble()', '500')
	}
}
function cancelIt() {
	if (timeoutId!=0) {
		window.clearTimeout(timeoutId);
		timeoutId=0;
	}
}

