function winPopup(site) {
	var newWindow = window.open(site,"ejemplo","height=300,width=400,location=no,scrollbars=no, menubars=no,toolbars=no,resizable=yes");
}

function winPopup2(site) {
	var newWindow = window.open(site,"ejemplo","height=600,width=810,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes");
}

function mostrar(num1){
	var obj=document.getElementById(num1);
	obj.style.display='block';
}
function ocultar(num){
		var obj=document.getElementById(num);
		obj.style.display='none';
}
function Cambia_seccion(num1, pagina){
	for (k=0;k<a.length;k++) { 
		num=a[k];
		var obj=document.getElementById(num);
		obj.className='seccion';
	}
	var obj=document.getElementById('seccion_'+num1);
	obj.className='seccion_1';
	cargarFragmento('/caza/inc/contenido_'+pagina+'_'+num1+'.asp','CONTENIDO_CENTRAL');
}

function cambio2(_select){     
    oSelect=eval("document.fform."+_select);
	sNombreFicha=oSelect.options[oSelect.selectedIndex].value;           
    //if(((sNombreFicha>="000")&&(sNombreFicha<="038"))||((sNombreFicha>="170")&&(sNombreFicha<="208")))
	cargarFragmento('ficha.asp?ficha='+sNombreFicha,'ficha_111');
}

function Cambia_pagina(num1, pagina){
	cargarFragmento('inc/contenido_'+pagina+'_'+num1+'.asp','CONTENIDO_CENTRAL');
	var obj=document.getElementById('seccion_'+num1);
	obj.className='seccion_1';
}

function ocultar_todo(){
	var c = new Array("enlace1","enlace2","enlace3","enlace4"); 
	var b = new Array("div_enlace1","div_enlace2","div_enlace3","div_enlace4");
	for (k=0;k<b.length;k++) { 
		num=b[k];
		num2=c[k];
		var obj=document.getElementById(num);
		var obj2=document.getElementById(num2);
		obj.style.display='none';
		obj2.className='actual2';
	} 
}

var peticion = false;
  try {  
  peticion = new XMLHttpRequest();
  } catch (trymicrosoft) { 
  try {
			peticion = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
  try {		
  			peticion = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (failed) {
  			peticion = false;
}
}
}
if (!peticion)
	alert("ERROR AL INICIALIZAR!");
	function cargarFragmento(fragment_url, element_id) {
	var element = document.getElementById(element_id);
	element.innerHTML = '<p><img src="/caza/img/ajax_load.gif" /></p>';
	peticion.open("GET", fragment_url);
	peticion.onreadystatechange = function() {
	if (peticion.readyState == 4) {
	result = unescape(peticion.responseText);
	result =result.replace(/\+/gi," ");

	element.innerHTML = result; 
	} 
	} 
	peticion.send(null); 
}

function Filtrar_Busqueda(){
	var id=0;
	var valores;
	if ((document.f1.c1.value != '')&&(document.f1.c1.value != '0')) {
		valores = valores + '&c1=' + document.f1.c1.value;
		id=1;
	}
	if ((document.f1.c2.value != '')&&(document.f1.c2.value != '0')) {
		valores = valores + '&c2=' + document.f1.c2.value;
		id=1;
	}
	if (id==1) {
		cargarFragmento('listado.asp?id=0'+ valores,'listado');
	}else{
		cargarFragmento('listado.asp','listado');
	}
}
function Filtrar_Busqueda2(){
	var id=0;
	var valores;
	if ((document.f1.c1.value != '')&&(document.f1.c1.value != '0')) {
		valores = valores + '&c1=' + document.f1.c1.value;
		id=1;
	}
	if ((document.f1.c2.value != '')&&(document.f1.c2.value != '0')) {
		valores = valores + '&c2=' + document.f1.c2.value;
		id=1;
	}
	if (id==1) {
		cargarFragmento('listado2.asp?id=0'+ valores,'listado');
	}else{
		cargarFragmento('listado2.asp','listado');
	}
}
