var topeElementos=14;
HtmlAMostrar="";
TitulosCatalogos=new Array(14)
TitulosCatalogos[1]='Torre del Agua<br />“Agua para la vida”';
TitulosCatalogos[2]='“Ciudades de agua”';
TitulosCatalogos[3]='Pabellón Puente<br />“Agua recurso único”';
TitulosCatalogos[4]='“Agua Extrema”';
TitulosCatalogos[5]='Pabellón de África<br />“Estepas, praderas y sabanas”';
TitulosCatalogos[6]='“Sed”';
TitulosCatalogos[7]='Pabellón de América Latina<br />“Bosques templados y selvas”';
TitulosCatalogos[8]='El mundo del hielo';
TitulosCatalogos[9]='Acuario Fluvial<br />“Los paisajes del agua”';
TitulosCatalogos[10]='“Agua compartida”';
TitulosCatalogos[11]='El Faro<br />“Iniciativas Ciudadanas”';
TitulosCatalogos[12]='Comunidad del Caribe<br />“Islas y costas”';
TitulosCatalogos[13]='“Oikos, agua y energía”';
TitulosCatalogos[14]='“Guía Oficial Expo Zaragoza 2008”';


function DibujarListadoCatalogos() {
	if (inicial>(topeElementos-3)) {
		inicial=10;
	}
	HtmlAMostrar="";
	primerElemento=inicial;
	if (inicial>1) {
		HtmlAMostrar=HtmlAMostrar+'<a href="#" onclick="menos(); return false;" id="Menos"><img src="/img/menos.png" width="20" height="214" alt="" /></a>'
	}else{
		HtmlAMostrar=HtmlAMostrar+'<div id="SustitutoBoton"></div>';
	}
	for (j=1; j<5; j++) {
		HtmlAMostrar = HtmlAMostrar + '<div id="Cat1" class="PortadaCatalogo"><a href="/catalogos/catalogo'+primerElemento+'.php"><img src="/portadas/'+primerElemento+'.jpg" id="Cat1" width="110" hight="140" />'+TitulosCatalogos[primerElemento]+'</a></div>';
		primerElemento++;
	}
	if (inicial!=(topeElementos-3)) {
		HtmlAMostrar=HtmlAMostrar+'<a href="#" id="Mas" onclick="mas(); return false;"><img src="/img/mas.png" width="20" height="214" alt="" /></a>'
	}else{
		HtmlAMostrar=HtmlAMostrar+'<div id="SustitutoBoton"></div>';
	}
	document.getElementById('CajaListaCatalogo').innerHTML=HtmlAMostrar;
	if (detect('opera')) {
		 
	 } else if (detect('firefox')){
		 
	} else if (detect('msie')){
		 correctPNG();	
	}	

}


function VerCatalogos() {
	if (document.getElementById('OpcionesMenuPrincipal').style.display!="block") {
		document.getElementById('OpcionesMenuPrincipal').style.display="block";
		document.getElementById('VerCatalogos').style.backgroundImage="url(/img/fondo_vercatalogos_on.gif)";
		document.getElementById('VerCatalogos').style.border= "1px solid #6e6e6e";
		document.getElementById('VerCatalogos').style.borderBottom = "1px solid #6E6E6E";
		document.getElementById('VerCatalogos').style.backgroundColor = "#6E6E6E";
		
	}else{
		document.getElementById('OpcionesMenuPrincipal').style.display="none";	
		document.getElementById('VerCatalogos').style.backgroundImage="url(/img/fondo_vercatalogos_off.gif)";
		document.getElementById('VerCatalogos').style.border= "1px solid #cf9700";
		document.getElementById('VerCatalogos').style.backgroundColor = "#202020";
	}
}

function mas() {
	inicial++;
	DibujarListadoCatalogos();
}

function menos() {
	inicial--;
	DibujarListadoCatalogos();
	if (detect('opera')) {
		 
	 } else if (detect('firefox')){
		 
	} else if (detect('msie')){
		 window.attachEvent("onload", correctPNG);	
	}		
}


function masPagina() {
	PunteroPagina++;
	if (PunteroPagina<=NumeroPaginas) {
		document.getElementById('PaginaGrande').src = 'cat'+NumeroCatalogo+'/pag'+PunteroPagina+'_g.jpg';
	}else{
		document.getElementById('PaginaGrande').src = 'cat'+NumeroCatalogo+'/pag1_g.jpg';
		PunteroPagina=1;
	}
}

function menosPagina() {
	PunteroPagina--;
	if (PunteroPagina>0) {
		document.getElementById('PaginaGrande').src = 'cat'+NumeroCatalogo+'/pag'+PunteroPagina+'_g.jpg';
	}else{
		document.getElementById('PaginaGrande').src = 'cat'+NumeroCatalogo+'/pag'+NumeroPaginas+'_g.jpg';
		PunteroPagina=NumeroPaginas;
	}
}

function VerPagina(PaginaNumero) {
	document.getElementById('PaginaGrande').src = 'cat'+NumeroCatalogo+'/pag'+PaginaNumero+'_g.jpg';
	PunteroPagina=PaginaNumero;
}

function MensajeInternacional() {
	if (document.getElementById('AvisoInternacional').style.display == "block") {
		document.getElementById('AvisoInternacional').style.display = "none";
	}else{
		document.getElementById('AvisoInternacional').style.display = "block";
	}
}

function charactermax(id,idreturn){
	var longit = document.getElementById(id).value.length;
	if(!longit) {longit = '0';}
	document.getElementById(idreturn).innerHTML = longit;

	if (longit>2500) {
		document.getElementById('Contador').style.color= '#990000';
		document.getElementById('Contador').style.fontWeight= 'bold';
	}else{
		if (longit>2200 && longit<2500) {
			document.getElementById('Contador').style.color= '#ff6000';
		}else{
			document.getElementById('Contador').style.color= '#999999';
		}
		document.getElementById('Contador').style.fontWeight= 'normal';
	}
}


// Corrector de Bug PNG para Explorer. Opera y Mozilla funcionan correctamente sin este JS
function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }

   }
var ua = navigator.userAgent.toLowerCase();
function detect(text) {
   stringposition = ua.indexOf(text) + 1;
   data = text;
   return stringposition;
}

if (detect('opera')) {
	 
 } else if (detect('firefox')){
	 
} else if (detect('msie')){
	 window.attachEvent("onload", correctPNG);	
}	
// 