<!-- funciones comunes -->



function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}

var bw=new lib_bwcheck()


function cabecera(fecha) {
	if(fecha){fecha= 'M.A.P.A. '+ fecha} else {fecha=''}
	var parte = '<table border="0"  cellpadding="0" cellspacing="0" bgcolor="#2F312C" width="100%" height="80"><tr><td rowspan="2"><img height="1" width="30" src="/comunes/img/nada.gif"></img></td><td rowspan="2" ><a href="http://www.mapa.es"><img border="0" height="70" width="396" src="/es/comunes/img/img_cabecera/escudo1.gif" alt=""></img></a></td><td colspan="7" height="64"><div class="fecha1" valign="bottom">' + fecha + '</div></td></tr><tr><form ACTION="/indexa/pag1.asp" METHOD="POST" onsubmit="return Valida(this)"><td height="16" width="16" bgcolor="#5A4D3C" valign="top"><img height="16" width="16" src="/comunes/img/img_cabecera/esqui_inf.gif"></img></td><td height="16" bgcolor="#5A4D3C" align="right"><a href="/mapaweb/pags/mapaweb.asp?lang=es" class="cabecera1">Mapa del web</a></td><td height="16" bgcolor="#5A4D3C" class="cabecera1">&nbsp;&nbsp;|&nbsp;&nbsp;</td><td height="16" bgcolor="#5A4D3C"><div class="cabecera1">Buscador</div></td><td height="16" width="65" bgcolor="#5A4D3C">'				
	ns4 = (document.layers)? true:false;
	if (ns4) 	
		{parte=parte +'<input type="text" class="caja2" name="SearchString" size="10">'}
	else 
		{parte=parte +'<input type="text" name="SearchString" size="12" class="caja1">'}
				
	parte=parte +'</td><td height="16" bgcolor="#5A4D3C"><input type="image" name="buscar" border="0" height="10" width="11" hspace="2" src="/comunes/img/img_cabecera/lupa.gif"></input></td><td height="16" bgcolor="#5A4D3C"><img height="10" width="20" src="/comunes/img/nada.gif"></img></td></form></tr></table>'
	document.write(parte);

}


function nueva(url,Id,ancho,alto) 
{ 
var opciones="left=50,top=50,width="+ancho+",height="+alto
i= 0; 
var ventanas = new Array();

ventanas[0]=0;
ventanas[1]=0;
ventanas[2]=0;

for (i=0;i<2;i++)
{
	if (ventanas[i]==1){eval('mi_ventana1'+i).close();}
	}

if(Id==0)	{
	ventanas[0] = 1;
	graf0 = window.open(url,'grafico',opciones); 
	graf0.focus();
 	}
else if(Id==1)	{
	ventanas[1] = 1; 
	graf1 = window.open(url,'grafico',opciones); 
	graf1.focus();
 	}
else if(Id==2)	{
	ventanas[2] = 1; 
	graf2 = window.open(url,'grafico',opciones); 
	graf2.focus();
 	}	
}



function Valida(formulario) 
{ var checkStrg = formulario.SearchString.value; 
  if (formulario.SearchString.value == "")  {
    alert("Escriba un valor");
    formulario.SearchString.focus();
    return (false);
  }

  if (checkStrg.length < 3)  {
    alert("La consulta debe tener mas de 2 letras.");
    formulario.SearchString.focus();
    return (false);
  }
  return (true);
}


function valida2(formulario) 
{ 
	var checkStrg = document.getElementById('SearchString').value; 
  if (document.getElementById('SearchString').value == "")  
	{
    alert("Escriba un valor");
    document.getElementById('SearchString').focus();
    return (false);
  }

  if (checkStrg.length < 3)  {
    alert("La consulta debe tener mas de 2 letras.");
     document.getElementById('SearchString').focus();
    return (false);
  }

  if (document.getElementById('SearchString').value == "buscador")
{ 
    document.getElementById('SearchString').value="";
    document.getElementById('SearchString').focus();
    return (false);
  }


  return (true);
}


function limpia_caja_texto()
{

var busca_txt =document.getElementById('SearchString').value;
if(busca_txt == 'buscador')
	{document.getElementById('SearchString').value="";}
}




function AbrirVentana() {

	ns4 = (document.layers)? true:false;
	if (ns4){
		window.open('/es/ministerio/pags/correo/correo1.htm','Sugerencias','width=850,height=423');
	}else{
		window.open('/es/ministerio/pags/correo/correo1.htm','Sugerencias','width=625,height=363');
	}

}



function enciende(obj){
	if(bw.ns4!=1){

var obj1= obj + obj ;
	document.getElementById(obj).style.backgroundColor="#F0F9EF";
<!--	document.getElementById(obj).style.backgroundColor="#DEE2DE"; -->
<!--	document.getElementById(obj1).style.backgroundColor="#075353"; -->
	document.getElementById(obj).style.cursor="hand";

}
}


function apaga(obj){
	if(bw.ns4!=1){

var obj1= obj + obj ;
	document.getElementById(obj).style.backgroundColor="#EAF3E9";
<!--	document.getElementById(obj1).style.backgroundColor="#FFFFFF"; -->
	document.getElementById(obj).style.cursor="hand";

}
}

function superior() {
document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td ><a href="/es/pesca/infopesca.htm"><img border="0" src="/es/comunes/img_ministerio/pestana/pesca.gif" width="55" height="18" alt=""></a></td><td><img border="0" src="/comunes/img/nada.gif" width="2" height="2"></td><td align="center"><a href="/es/agricultura/agricultura.htm"><img border="0" src="/es/comunes/img_ministerio/pestana/agri.gif" width="89" height="18"></a></td><td><img border="0" src="/comunes/img/nada.gif" width="2" height="2"></td><td align="center"><a href="/es/ganaderia/ganaderia.htm"><img border="0" src="/es/comunes/img_ministerio/pestana/ganad.gif" width="67" height="18"></a></td><td><img border="0" src="/comunes/img/nada.gif" width="2" height="2"></td><td align="center"><a href="/es/desarrollo/desarrollo.htm"><img border="0" src="/es/comunes/img_ministerio/pestana/desa.gif" width="96" height="18"></a></td>	<td><img border="0" src="/comunes/img/nada.gif" width="2" height="2"></td><td align="center"><a href="/es/alimentacion/alimentacion.htm"><img border="0" src="/es/comunes/img_ministerio/pestana/alim.gif" width="89" height="18"></a></td><td><img border="0" src="/comunes/img/nada.gif" width="2" height="2"></td> <td align="center"><a href="/es/sig/sig1.htm"><img border="0" src="/es/comunes/img_ministerio/pestana/sig.gif" width="119" height="18"></a></td>	<td><img border="0" src="/comunes/img/nada.gif" width="2" height="2"></td>  <td align="right"><a href="/es/estadistica/infoestad.html"><img border="0" src="/es/comunes/img_ministerio/pestana/estadi.gif" width="79" height="18"></a></td> 	</tr><tr>          <td align="left" valign="bottom" bgcolor="#FFFFFF" colspan="15"><img border="0" src="/comunes/img/nada.gif" width="2" height="2"></td>        </tr>      </table>');

}
	

function pie() {
document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr height="20"><td width="20"></td><td height="20"><img height="2" width="2" src="/comunes/img/separador.gif"></td><td width="6" height="20"><img height="2" width="2" src="/comunes/img/separador.gif"></td><td height="20"><img height="2" width="2" src="/comunes/img/separador.gif"></td><td height="20"><img height="2" width="2" src="/comunes/img/separador.gif"></td></tr><tr><td width="0"></td><td valign="middle"><img src="/comunes/img/escudo.gif" width="39" height="31" border="0"></td><td class="fondoceldas" width="6"><img height="2" width="2" src="/comunes/img/separador.gif"></td><td><img src="/comunes/img/separador.gif" width="5" height="2" border="0"></td> <td class="cuerpo8"><span class="cuerpo8"><a href="http://www.mapa.es" class="cuerpo8">P&aacute;gina principal | </a><a href="http://enesa.mapa.es" class="cuerpo8"> ENESA |</a><a href="http://from.mapa.es/" class="cuerpo8"> FROM |</a><a href="http://feganet.mapa.es" class="cuerpo8"> FEGA |</a><a href="http://aao.mapa.es" class="cuerpo8"> AAO |</a><a href="/es/ministerio/pags/faq/atencion_ciudadano.htm" class="cuerpo8">  Informaci&oacute;n y Atenci&oacute;n al Ciudadano |</a><a href="https://tienda.mapa.es"  target="_blank" class="cuerpo8"> Tienda virtual de publicaciones</a></span></td></tr></table><p align="center"><font face="Verdana" size="1"><span class="cuerpo8">&#169 Ministerio de Medio Ambiente y Medio Rural y Marino 2010</span></font></p><p></p></td></tr>');
}


function copy() {document.write('&#169 Ministerio de Medio Ambiente y Medio Rural y Marino 2010');}
function anyo() {document.write('2010');}




