
// Comprobación de navegador
var nc = (document.layers) ? true:false;
var ie = (document.all) ? true:false;
var n6 = (document.getElementById) ? true:false;

var tiempo;
var altura; 

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];}}
}

// función para corregir error de alineación de capas en NetScape
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();
}


function two_digits ( number ) {
	return number >= 10 ? number : '0'+number;
}

function j_max ( n1, n2 ) {
 return n1 > n2 ? n1 : n2;	
}

function j_min ( n1, n2 ) {
 return n1 > n2 ? n1 : n2;	
}

function Scroll_Layer_Begin ( name, width, height ) {

	document.write ( '<div id="parent_'+name+'" style="position:relative; left:0px; top:0px; width:'+width+'px; height:'+height+'px; z-index:1; border: none; overflow: hidden;"> ');
	document.write ( '<div id="'+name+'" style="position:relative; left:0px; top:0px; width:'+width+'px; z-index:1; border: none; overflow: visible;"> ');
	
	clearTimeout ( tiempo );
}

function Scroll_Layer_End ( ) {
	document.write ( '</div></div>');
}

function Scroll_Layer_Recorta ( name, lineas ) {
	
	var Y	=	parseInt ( document.getElementById(name).style.top );
	var H	=	document.getElementById(name).clientHeight+30;
	var pH  =	document.getElementById('parent_'+name).clientHeight;

	clearTimeout (tiempo);
	if ( ( lineas > 0 ) && ( (-Y) > 0 ) ) {
		document.getElementById ( name ).style.top = Y + lineas + "px";
		tiempo = setTimeout ("Scroll_Layer_Recorta('"+name+"',"+lineas+")",50);
	} else if ( ( lineas < 0 )  && ( (-Y) < (H -pH)) ) {
		document.getElementById ( name ).style.top = Y + lineas + "px"; //j_min((Y + lineas),H);
		tiempo = setTimeout ("Scroll_Layer_Recorta('"+name+"',"+lineas+")",50);
	}
}

function Scroll_Layer_Maximize ( name ) {
	var H = document.getElementById(name).clientHeight+30;
	var pH  = document.getElementById('parent_'+name).clientHeight;

	if ( pH < H  ) {
		altura = document.getElementById('parent_'+name).clientHeight;
		document.getElementById( name ).style.top = 0+"px";
		document.getElementById('parent_'+name).style.height = H+"px";
		document.getElementById('layer_up').style.visibility = 'hidden';
		document.getElementById('layer_down').style.visibility = 'hidden';	
	} else {
		document.getElementById('parent_'+name).style.height = altura+"px";
		document.getElementById('layer_up').style.visibility = 'visible';
		document.getElementById('layer_down').style.visibility = 'visible';
	}
}

function Max_Window_Link ( name, width, height, url ) {
	var x, y;
	x= (screen.width /2)-(width/2);
	y= (screen.height/2)-(height/2);
	mywnd = window.open(url, name, "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width="+width+",height="+height+",left="+x+",top="+y);
	mywnd.focus();
}


// Definición de la función para uso en "<body onLoad"
function LoadPage () { return true;	}

// Llamada a la función MM_reloadPage
MM_reloadPage(true);

