// JavaScript Document
<!--
function fecha() {
		var mydate=new Date()
		var year=mydate.getYear()
		if (year<1000)
		year+= 1900
		var day=mydate.getDay()
		var month=mydate.getMonth()
		var daym=mydate.getDate()
		if (daym<10)
		daym="0"+daym
		var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
		var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
		document.write (dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year)
		}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

///////-------------galeria de fotos-----------------
function ver_galeria_noticia(id_imagen)
{
var url="galeria_noticia.php?id="+id_imagen;
sList = window.open(url, "mywindow", "status=1 ,scrollbars=yes , top =0  , left = 150 , width=600, height=450");
}
///--------------------------------------------------
function mostrar_formulario()
  	{
    sList = window.open("contacto/contacto.php", "mywindow", "status=1 ,scrollbars=NO , top =0  , left = 250 , width=520, height=600");
  	}

function aumentar(id)
	{
	document.getElementById(id).style.fontSize='12pt';
	}

function disminuir(id)
	{
	document.getElementById(id).style.fontSize='8pt';
	}

function normalizar(id)
	{
	document.getElementById(id).style.fontSize='10pt';
	}
	
function mostrar_tapa(URL)
	{
	sListradio = window.open(URL, "foto", "status=1 ,scrollbars=yes , top =0  , left = 250 , width=450, height=750");
	}

function mostrar_foto(URL)
	{
	sListradio = window.open(URL, "foto", "status=1 ,scrollbars=NO , top =0  , left = 250 , width=450, height=450");
	}
function mostrar_video()
	{
	sListradio = window.open("video/video.htm", "foto", "status=1 ,scrollbars=NO , top =0  , left = 250 , width=450, height=450");
	}

function mostrar_aviso(url)
  	{
	sList = window.open(url, "mywindow", "status=1 ,scrollbars=NO , top =0  , left = 0 , width=400 , height=350");
  	}
	
function cerrar()
	{
	this.window.close();
	}

function disableRightClick(e)
{
  var message = "Todos los derechos reservados -- Revista Campo para todos";
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    alert(message);
    return false;
  }
}

function imprSelec(nombre)
{
	var ficha = document.getElementById(nombre);
  	var ventimp = window.open(' ', 'popimpr');
  	ventimp.document.write( ficha.innerHTML );
  	ventimp.document.close();
  	ventimp.print( );
  	ventimp.close();
} 

function Enviar_amigo()
	{
	sListradio = window.open("amigo.php", "foto", "status=1 ,scrollbars=NO , top =0  , left = 250 , width=450, height=300");
	}
function mostrar_galeria(url,alto,ancho)
  	{
    sList = window.open(url, "mywindow", "scrollbars=yes , top =0  , left = 150 , width="+ancho+", height="+alto+"");
	}

function mostrar_delvalle()
	{
	sListradio = window.open("delvalle.htm", "foto", "status=1 ,scrollbars=yes , top =0  , left = 250 , width=737, height=560");
	}
function mostrar_algodon()
	{
	sListradio = window.open("algodon.htm", "foto", "status=1 ,scrollbars=yes , top =0  , left = 250 , width=560, height=737");
	}	
function mostrar_ferti()
	{
	sListradio = window.open("ferti.htm", "foto", "status=1 ,scrollbars=yes , top =0  , left = 250 , width=560, height=737");
	}	
function mostrar_lachola()
	{
	sListradio = window.open("lachola.htm", "foto", "status=1 ,scrollbars=yes , top =0  , left = 250 , width=575, height=500");
	}
function mostrar_kioskos()
	{
	sListradio = window.open("kioskos.htm", "foto", "status=1 ,scrollbars=yes , top =0  , left = 250 , width=365, height=700");
	}
function publicar_aviso()
  	{
    sList = window.open("alta_aviso.php", "mywindow", "scrollbars=yes , top =0  , left = 150 , width=600, height=400");
	}

//-----------------------------------------------------

function vacio_aviso(formulario)
{
if (formulario.nom_ape.value == "")
	{
	alert("ingrese el nombre / apellido");
	formulario.nom_ape.focus();
	return  false;
	}
if (formulario.titulo.value == 0)
	{
	alert("Selecione un tipo de titulo");
	formulario.titulo.focus();
	return  false;
	}
if (formulario.especialidad.value == "")
	{
	alert("ingrese la especialidad EJ: Ingeniero Agronomo, Licenciado en Cooperativismo, etc...");
	formulario.especialidad.focus();
	return  false;
	}
if (formulario.domicilio.value == "")
	{
	alert("ingrese su domicilio");
	formulario.domicilio.focus();
	return  false;
	}
if (formulario.provincia.value == "")
	{
	alert("ingrese la provincia");
	formulario.provincia.focus();
	return  false;
	}
if (formulario.localidad.value == "")
	{
	alert("ingrese la localidad");
	formulario.localidad.focus();
	return  false;
	}
if (formulario.cod_postal.value == "")
	{
	alert("ingrese el Codigo Postal");
	formulario.cod_postal.focus();
	return  false;
	}
if (formulario.telefono.value == "" && formulario.celular.value == "")
	{
	alert("Debe ingresar al menos un numero telefonico");
	formulario.telefono.focus();
	return  false;
	}
if (formulario.correo.value !== "")
	{
	var email = formulario.correo.value;
	var formato = /^([\w-\.])+@([\w-]+\.)+([a-z]){2,4}$/;
	var comparacion = formato.test(email);
	if(comparacion == false)
		{
         alert("El correo ingresado no es válido");
         formulario.correo.focus();
		 return false;
     	}
	}

return true;
}
//-----------------------------------------------------

//--------------------------------------------------------------------
//----------------------------AJAX------------------------------------
function getXMLHTTPRequest(){
	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!");
		  }
return peticion;
}

//------------------siguiente imagen Galeria--------------------------------

var imagen_siguiente_galeria = getXMLHTTPRequest();
function sig_imagen_galeria(id,nombre,texto,ancho,alto) 
{
//alert(id);	
aleatorio = parseInt(Math.random()*9999999);
var url = "imprime_imagen_galeria.php?nombre="+nombre+"&idg="+id+"&texto="+texto+"&ancho="+ancho+"&alto="+alto+"&"+aleatorio;
//alert(url); //ok
imagen_siguiente_galeria.open("GET",url,true);
imagen_siguiente_galeria.onreadystatechange  = function()  {
		//alert("argumento recibido="+arguments[0]);
		if (imagen_siguiente_galeria.readyState==4)
			{
			//alert("ingresa por ready=2");	
			if (imagen_siguiente_galeria.status==200)
				{
				//var iddiv = 1;
				//alert ("variable iddiv="+id);
				document.getElementById(id).innerHTML = imagen_siguiente_galeria.responseText;
				//alert (document.getElementById(id).innerHTML);
				}
				else
				{
				alert("Error al recibir la información!");
				}
			}
		}
imagen_siguiente_galeria.send(null);    
}

//------------------siguiente imagen Noticia--------------------------------

var imagen_siguiente = getXMLHTTPRequest();
function sig_imagen(id_foto,id,nombre,texto,ancho,alto) 
{
//alert(id);	//recibe ejemplo imagen_285
aleatorio = parseInt(Math.random()*9999999);
var url = "imprime_imagen.php?id_foto="+id_foto+"&nombre="+nombre+"&texto="+texto+"&ancho="+ancho+"&alto="+alto+"&"+aleatorio;
//alert(url); //ok
imagen_siguiente.open("GET",url,true);
imagen_siguiente.onreadystatechange  = function()  {
		//alert("argumento recibido="+arguments[0]);
		if (imagen_siguiente.readyState==4)
			{
			//alert("ingresa por ready=2");	
			if (imagen_siguiente.status==200)
				{
				//alert("aqui debe imprimir");	
				//alert ("variable iddiv="+id);
				document.getElementById(id).innerHTML = imagen_siguiente.responseText;
				}
				else
				{
				alert("Error al recibir la información!");
				}
			}
		}
imagen_siguiente.send(null);    
}
//------------------------------------------------------------------------------

//-->