var b;
var altura;

var popupWindow = null;
var MAXHW = 300; // change as needed
/////////////////////////////
PositionX = 300;
PositionY = 300;

defaultWidth  = 500;
defaultHeight = 500;

var AutoClose = true;
// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;

/////////////////////////////////////

//Esta Funcion se carga cada vez que una página se actuliza.
function carrega(){
	var i, cont;
	var str;
	cont = 0; 
	for (i=0;i<document.links.length;i++) { 
		str=document.links[i].href;
		if (str.substring(str.length-5,str.length)=="#link")
			cont++;
		}
	b=cont;
	for (j=0; j<b; j++){
		document.all("abajo_t"+(j+1)).style.visibility="hidden";
  	  	document.all("t"+(j+1)).style.display="none";
  	  	document.all("abajo_t"+(j+1)).style.width="0px";
		document.all("abajo_t"+(j+1)).style.height="0px";
	}
}

function mostrar(textoid){
	if (document.all(textoid).style.display == "none"){
		for (j=0; j<b; j++){
			document.all("t"+(j+1)).style.display="none";
			document.all("abajo_t"+(j+1)).style.visibility="hidden";
			document.all("derecha_t"+(j+1)).style.visibility="visible";
			document.all("derecha_t"+(j+1)).style.width="5px";
			document.all("derecha_t"+(j+1)).style.height="5px";
			document.all("abajo_t"+(j+1)).style.width="0px";
			document.all("abajo_t"+(j+1)).style.height="0px";
		}
  		document.all(textoid).style.display="block";
		document.all("derecha_"+textoid).style.visibility="hidden";
		document.all("abajo_"+textoid).style.visibility="visible";
		document.all("derecha_"+textoid).style.width="0px";
		document.all("derecha_"+textoid).style.height="0px";
		document.all("abajo_"+textoid).style.width="5px";
		document.all("abajo_"+textoid).style.height="5px";
		}
	else{
	 document.all(textoid).style.display = "none";
		document.all("derecha_"+textoid).style.visibility="visible";
		document.all("abajo_"+textoid).style.visibility="hidden";
		document.all("derecha_"+textoid).style.width="5px";
		document.all("derecha_"+textoid).style.height="5px";
		document.all("abajo_"+textoid).style.width="0px";
		document.all("abajo_"+textoid).style.height="0px";
	}
	alertSize();
}

function isdefined(variable)
{
    return (typeof(window[variable]) == "undefined")?  true: false;
} 


function alertSize() {
  var myHeight = 0;
	var alturaImg = 0;
	var alturaDest = 0;
	var nueva_altura=0;
	var val=0;
  if( typeof( window.document.height ) == "number" ) {
    //Non-IE
      myHeight = document.body.scrollHeight;
      alturaImg = document.getElementById("img").offsetHeight;
      alturaDest = document.getElementById("dest").offsetHeight;
      val=205;
      nueva_altura= myHeight-alturaImg-val;
      //alert(myHeight +'-'+alturaImg+'-'+val+'-'+alturaDest+'='+nueva_altura);
      if (nueva_altura > 0) {
      	document.getElementById("dest").height = nueva_altura;
      	//alert(document.getElementById("dest").height);
      	//alert('Fet');
      }
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight;
      document.getElementById('dest').height=myHeight-585;
      document.getElementById('dest').bgColor="#E0D5B4";
  }else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    myHeight = document.body.scrollHeight;
		alturaImg = document.getElementById('img').offsetHeight;
		alturaDest = document.getElementById('Destacamos').offsetHeight;
		val=205;
		nueva_altura= myHeight-alturaImg-val-alturaDest;
		//alert(myHeight +'-'+alturaImg+'-'+val+'-'+alturaDest+'='+nueva_altura);
  	if (nueva_altura > 0) {
			 document.getElementById('dest').height=nueva_altura;
	}
  }
}

// Esta función abre un popup con una imagen y se dimensiona adaptandose a la misma
function Abrir_ventana(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');
writeln('if (isIE){');writeln('window.resizeTo(1,1);');
writeln('width=100-(document.body.clientWidth-document.images[0].width)+13;');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}




