// JavaScript Document





$(document).ready(
	function()
	{
		$.ImageBox.init(
			{
				loaderSRC: '/images/imagebox/loading.gif',
				closeHTML: '<img src="/images/imagebox/close.jpg" />'
			}
		);
	}
);



function validaForma_es()
{   var Alerta="Los siguientes campos son requeridos:\r\n\r\n";
    var ok=1; 
    var email = document.getElementById("Correo");
    var regex = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
//  /^[_\w\.\-]+@[\w\.-]+\.[a-z]{2,6}$/;
//    /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    
    if (document.getElementById("Nombre").value=="")
    {   Alerta=Alerta+"- Nombre\n\r";
        document.getElementById("Nombre").style.backgroundColor="#ff9";
        ok=0;
    }
    if (document.getElementById("Correo").value=="")
    {   Alerta=Alerta+"- Correo\n\r";
        document.getElementById("Correo").style.backgroundColor="#ff9";
        ok=0;
    }
    if (document.getElementById("Comentario").value=="")
    {   Alerta=Alerta+"- Comentarios";
        document.getElementById("Comentario").style.backgroundColor="#ff9";
        ok=0;
    }
    if (ok==0)
    {   alert(Alerta);
    }
    else if (ok==1)
    {   if (!regex.test(email.value))
        {   alert("Por favor, ingrese una dirección de correo válida.");
            email.focus();
        }
        else
        {   document.getElementById("Contacto").submit();
        }
    }
}
function validaForma_en()
{   var Alerta="The following fields are required:\r\n\r\n";
    var ok=1; 
    var email = document.getElementById("Correo");
    var regex = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
//  /^[_\w\.\-]+@[\w\.-]+\.[a-z]{2,6}$/;
//    /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    
    if (document.getElementById("Nombre").value=="")
    {   Alerta=Alerta+"- Name\n\r";
        document.getElementById("Nombre").style.backgroundColor="#ff9";
        ok=0;
    }
    if (document.getElementById("Correo").value=="")
    {   Alerta=Alerta+"- e-Mail\n\r";
        document.getElementById("Correo").style.backgroundColor="#ff9";
        ok=0;
    }
    if (document.getElementById("Comentario").value=="")
    {   Alerta=Alerta+"- Comment";
        document.getElementById("Comentario").style.backgroundColor="#ff9";
        ok=0;
    }
    if (ok==0)
    {   alert(Alerta);
    }
    else if (ok==1)
    {   if (!regex.test(email.value))
        {   alert("Please provide a valid email address.");
            email.focus();
        }
        else
        {   document.getElementById("Contacto").submit();
        }
    }
}


function mostrarpopup(Id, Tipo)
{
//alert("http://"+location.host+"/mensaje.php?IdAviso="+Id+"&Tipo="+Tipo);
var ventana = window.open("http://"+location.host+"/mensaje.php?IdAviso="+Id+"&Tipo="+Tipo,"Aviso","width=400,height=500,scrollbars=YES"); 
	
}


function mostrarpopup2(Id,url)
{
//alert("http://"+location.host+"/mensaje.php?IdAviso="+Id+"&Tipo="+Tipo);
var ventana = window.open("http://"+location.host+"/"+url+"?IdAviso="+Id,"Imprimir","width=600,height=700,scrollbars=YES"); 
	
}

function mostrarpopup3(url,liga)
{
//alert("http://"+location.host+"/admin/usuarios_camara/mostrarcamara.php?Camara="+liga);
var ventana = window.open("http://"+location.host+"/admin/usuarios_camaras/mostrarcamara.php?Camara="+liga,"Camara","width=700,height=550,scrollbars=YES"); 
	
}

// FUNCION PARA ENVIAR FORMULARIO CON XAJAX
function Acceso()
{
	xajax.$('submitButton').disabled=true;
	xajax.$('submitButton').value="please wait...";
	xajax.$('cargador').innerHTML ='<img src="images/loadingSmall.gif" />';
	xajax_ChecarSession(xajax.getFormValues("signupForm"));
	return false;
}

function Acceso1(idioma)
{
	xajax.$('submitButton').disabled=true;
	xajax.$('submitButton').value="please wait...";
	xajax_ChecarSession2(xajax.getFormValues("signupForm"),idioma);
	return false;
}

function mostrarimagen(Foto,Titulo,Texto,IdGaleria,Link,Fotogrande,Idioma)
{
	//alert(Idioma);
	if(!Fotogrande){ Fotogrande=Foto;}
	
	if(Idioma==1){

if(Titulo){
titulo2='title="'+Titulo+'"';
}else {titulo2="";}
imagen='<div align="center" ><div id="fotomostrar" style="display:block; " class="imgBorde"><a href="http://'+location.host+Fotogrande+'" '+titulo2+' rel="imagebox-bw"><img src="http://'+location.host+Foto+'"  height="276px" width="371px"/></a></div><a href="http://'+location.host+Fotogrande+'"  '+titulo2+' rel="imagebox-bw"><img src="http://'+location.host+'/img/btn-full.jpg"/></a></div>';
	}else{
		if(Titulo){
titulo2='title="'+Titulo+'"';
}else {titulo2="";}
imagen='<div align="center"><div id="fotomostrar" style="display:block; " class="imgBorde"><a href="http://'+location.host+Fotogrande+'" '+titulo2+' rel="imagebox-bw"><img src="http://'+location.host+Foto+'"  height="276px" width="371px"/></a></div><a href="http://'+location.host+Fotogrande+'"  '+titulo2+' rel="imagebox-bw"><img src="http://'+location.host+'/img/btn-full2.jpg"/></a></div>';	
	
}


var x=$("#Foto");
//document.getElementById('Foto').style.display='block';
//document.getElementById('Foto').style.display='none';
x.hide();

document.getElementById('Foto').innerHTML=imagen;

ocultar=x.show("slow");
if(ocultar){
	
}

//setTimeout('document.getElementById("Foto").innerHTML=imagen;',500);

if(Titulo){
document.getElementById('titulo').innerHTML= '<h2>'+Titulo+'</h2>';
//Texto.value = Texto.value.replace('\n', '<br />');
Texto = Texto.replace('\n', '<br />');
document.getElementById('descripcion').innerHTML= '<p align=\"justify\">'+Texto+'</p>';

//alert(Texto);
//alert(unescape(Texto));
//document.getElementById('descripcion').innerHTML= '<p>'+unescape(Texto)+'</p>';
}

if(Link){
	//alert(Link);
	document.getElementById('link22').innerHTML= Link;

}
if(IdGaleria)
{
//alert(IdGaleria);
$Resultado=xajax_Prefotos(IdGaleria);

}

$(document).ready(
	function()
	{
		$.ImageBox.init(
			{
				loaderSRC: '/images/imagebox/loading.gif',
				closeHTML: '<img src="/images/imagebox/close.jpg" />'
			}
		);
	}
);

}





//REDIRECCIONARME A OTRA  PAGINA
function Avanzar(url)
{
window.location=url;
}

//funciones de Noticia
function cancelarmodificar2()
{
		
	document.getElementById('ver_modificar').innerHTML='';
	
	var x=$("#ver_modificar");
  x.toggle("slow");

  


}

function RemplazarModificar(IdArticulo, Titulo, Fecha, Autor){
	//alert(IdArticulo);

document.getElementById('ver_modificar').innerHTML='';

remplazar='<div id="fila_'+IdArticulo+'" style="width:100%;"><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#F5F5F5" ><tr  bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor=\'#EFEFEF\'" onMouseOut="this.style.backgroundColor=\'#FFFFFF\'" ><td width="7%"><input name="'+IdArticulo+'" type="checkbox" id="'+IdArticulo+'" value="'+IdArticulo+'"></td><td width="58%"><div align="left">'+Titulo+'</div></td><td width="15%" ><div align="center">'+Fecha+'</div></td><td width="20%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdArticulo+')" />&nbsp;&nbsp;&nbsp;</div></td></tr></table></div>';
		document.getElementById('fila_'+IdArticulo).innerHTML='';
	document.getElementById('fila_'+IdArticulo).innerHTML = remplazar;

}		


function RemplazarModificarFotos(IdFoto, Imagen, Pertenece, Tipo){
//alert(Tipo);

document.getElementById('ver_modificar').innerHTML='';

remplazar='<div id="fila_'+IdFoto+'" style="width:100%;"><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#F5F5F5" ><tr  bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor=\'#EFEFEF\'" onMouseOut="this.style.backgroundColor=\'#FFFFFF\'" ><td width="7%"><input name="'+IdFoto+'" type="checkbox" id="'+IdFoto+'" value="'+IdFoto+'"></td><td width="29%"><div align="left"><img src="http://'+location.host+'/'+Imagen+'" height="60" width="80"/></div></td><td width="29%">'+Pertenece+'</td><td width="15%"><div align="center"> '+Tipo+'</td><td width="20%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdFoto+')"onmouseover="this.style.cursor=\'pointer\'" />&nbsp;&nbsp;&nbsp;</div></td></tr></table></div>';
		document.getElementById('fila_'+IdFoto).innerHTML='';
	document.getElementById('fila_'+IdFoto).innerHTML = remplazar;

}		


function RemplazarModificarGaleria(IdGaleria, Nombre, Tipo, Fecha){
	//alert(IdGaleria);
var x=$("#ver_modificar");
  x.toggle("slow");
document.getElementById('ver_modificar').innerHTML='';

//remplazar='<div id="fila_'+IdGaleria+'" style="width:100%;"><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#F5F5F5" ><tr  bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor=\'#EFEFEF\'" onMouseOut="this.style.backgroundColor=\'#FFFFFF\'" ><td width="5%"><input name="'+IdGaleria+'" type="checkbox" id="'+IdGaleria+'" value="'+IdGaleria+'"></td><td width="32%"><div align="left">'+Nombre+'</div></td><td width="36%">'+Tipo+'</td><td width="14%">'+Fecha+'</td><td width="13%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdGaleria+')"onmouseover="this.style.cursor=\'pointer\'" />&nbsp;&nbsp;&nbsp;</div></td></tr></table></div>';

remplazar='<div id="fila_'+IdGaleria+'" style="width:100%;"><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#F5F5F5" ><tr  bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor=\'#EFEFEF\'" onMouseOut="this.style.backgroundColor=\'#FFFFFF\'" ><td width="5%"><input name="'+IdGaleria+'" type="checkbox" id="'+IdGaleria+'" value="'+IdGaleria+'"></td><td width="14%"><img src=\''+Fecha+'\' height=\'60\' width=\'80\'/></td><td width="32%"><div align="left">'+Nombre+'</div></td><td width="36%">'+Tipo+'</td><td width="13%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdGaleria+')"onmouseover="this.style.cursor=\'pointer\'" />&nbsp;&nbsp;&nbsp;</div></td></tr></table></div>';

		document.getElementById('fila_'+IdGaleria).innerHTML='';
	document.getElementById('fila_'+IdGaleria).innerHTML = remplazar;

}		



function RemplazarModificarCalendario(IdCalendario, Titulo, FechaInicio, FechaFinal){
	//alert(IdArticulo);

document.getElementById('ver_modificar').innerHTML='';

remplazar='<div id="fila_'+IdCalendario+'" style="width:100%;"><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#F5F5F5" ><tr  bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor=\'#EFEFEF\'" onMouseOut="this.style.backgroundColor=\'#FFFFFF\'" ><td width="7%"><input name="'+IdCalendario+'" type="checkbox" id="'+IdCalendario+'" value="'+IdCalendario+'"></td><td width="28%">'+Titulo+'</td><td width="31%" ><div align="center">'+FechaInicio+'</div></td><td width="14%" ><div align="center">'+FechaFinal+'</div></td><td width="20%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdCalendario+')" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></div></td></tr></table></div>';
		document.getElementById('fila_'+IdCalendario).innerHTML='';
	document.getElementById('fila_'+IdCalendario).innerHTML = remplazar;

}	


function RemplazarModificarBanner(IdBanner, Nombre, Imagen){
	//alert(IdArticulo);
//alert("http://"+location.host+"/"+Imagen);
document.getElementById('ver_modificar').innerHTML='';

remplazar='<div id="fila_'+IdBanner+'"  style="width:100%;	cursor:move;"><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#F5F5F5" ><tr  bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor=\'#EFEFEF\'" onMouseOut="this.style.backgroundColor=\'#FFFFFF\'" ><td width="7%"><input name="'+IdBanner+'" type="checkbox" id="'+IdBanner+'" value="'+IdBanner+'"></td><td width="30%"><div align="left"><img src="http://'+location.host+'/'+Imagen+'"  width="100px" height="70px;"/></div></td><td width="43%%" ><div align="center">'+Nombre+'</div></td><td width="20%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdBanner+')" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></div></td></tr></table></div>';
		document.getElementById('fila_'+IdBanner).innerHTML='';
	document.getElementById('fila_'+IdBanner).innerHTML = remplazar;

}	


<!--
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es requerido.\n'; }
  } if (errors) alert('Ocurrieron los siguientes errores:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function EliminarBotonFoto(IdFoto){
         document.form1.EliminarFoto.value = IdFoto;
         document.form1.submit();
}

//-->
function mostrarVentana(contenido, nombreVentana)
{        var propiedades=""
        if (nombreVentana=="vImagenes")
        {        propiedades="scrollbars=yes,width=600,height=350";
        }
        else
        {        if        (nombreVentana=="vEmail")
                {        propiedades="scrollbars=yes,width=550,height=500";
                }
                else
                {        if (nombreVentana=="vImprimir")
                        {        propiedades="scrollbars=yes,width=778,height=550,menubar=yes,status=yes";
                        }
                        else
                        {        if (nombreVentana=="vXpress")
                                {        propiedades="scrollbars=yes,width=778,height=600,menubar=yes,status=yes,toolbar=yes";
                                }
                        }
                }
        }
        Ventana=window.open(contenido,nombreVentana,propiedades);
        Ventana.focus()
}
  function MM_openBrWindow(theURL,winName,features) { //v2.0
  	window.open(theURL,winName,features);
  }  
  
function InfoDiv(que,mensaje)
{
	if(que==true){
	
	document.getElementById('divinfo').className='divinfoActivo';
	document.getElementById('divinfo').innerHTML=mensaje;
	

	//document.getElementById('rentar_'+id).innerHTML=' ';
	}
	else
	{
		
		document.getElementById('divinfo').className='divinfoInactivo';		
		document.getElementById('divinfo').innerHTML='';
		}
	
	}
	  


function mandarcorreo ()
{
	alert($F('nombre'));
	xajax_EnvioContacto(xajax.getFormValues("signupForm"));
	
	
}