// JavaScript Document
function mandarcorreo(){
	var Alerta="Los siguientes campos son requeridos:\r\n\r\n";
    var ok=1; 
    var email = document.getElementById("campoEmail");
    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("campoNombre").value=="")
    {   Alerta=Alerta+"- Nombre\n\r";
//        document.getElementById("Nombre").style.backgroundColor="#ff9";
        ok=0;
    }
    if (document.getElementById("campoEmail").value=="")
    {   Alerta=Alerta+"- Correo\n\r";
//        document.getElementById("Correo").style.backgroundColor="#ff9";
        ok=0;
    }

	if (document.getElementById("campoFechaEvento").value=="")
    {   Alerta=Alerta+"- Fecha del Evento\n\r";
//        document.getElementById("Correo").style.backgroundColor="#ff9";
        ok=0;
    }

    if (ok==0)
    {   alert(Alerta);
    }
    else if (ok==1)
    {   if (!regex.test(email.value))
        {   alert("Por favor proporcione una direcciÃ³n de correo vÃ¡lida.");
            email.focus();
        }
        else
        {   
		document.contacto.submit();
        }
    }
	
}
function mandarcorreoen()
{   var Alerta="The following fields are required:\r\n\r\n";
    var ok=1; 
    var email = document.getElementById("campoEmail");
    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("campoNombre").value=="")
    {   Alerta=Alerta+"- Name\n\r";
//        document.getElementById("Nombre").style.backgroundColor="#ff9";
        ok=0;
    }
    if (document.getElementById("campoEmail").value=="")
    {   Alerta=Alerta+"- e-Mail\n\r";
//        document.getElementById("Correo").style.backgroundColor="#ff9";
        ok=0;
    }
    if (document.getElementById("campoFechaEvento").value=="")
    {   Alerta=Alerta+"- Event date\n\r";
//        document.getElementById("Correo").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.contacto.submit();
        }
    }
}




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




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 CambiarImagen(FotoMediana,FotoGrande,Titulo)
{
var	imagen='<a href="http://'+location.host+FotoGrande+'" title="'+Titulo+'" rel="imagebox-bw" ><img src="http://'+location.host+FotoMediana+'" id="imagentn3"  style="float:right; margin:12px 5px 0 0;" align="bottom"  /></a>';


var x=$("#imgprincipal");


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

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



}

function CambiarGaleria2(FotoMediana,Titulo,IdGaleria)
{
var	imagen='<a href="'+Titulo+'/'+IdGaleria+'.html"><img src="http://'+location.host+FotoMediana+'" alt=""  style="margin:10px;"   id="imagentn3" /></a><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" ><tr ><td width="67%" height="51"><h1 align="center" style="padding:5px; color:#EB0721; font-size:18px;">'+Titulo+'</h1></td><td width="33%"><a href="'+Titulo+'/'+IdGaleria+'.html"><img src="http://'+location.host+'/img/ver_mas_fotos.jpg" /></a></td></tr></table>';





var x=$("#Galeria");

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


}


function CambiarGaleria3(FotoMediana,Titulo,FotoGrande)
{
var	imagen='<a href="http://'+location.host+FotoGrande+'" title="'+Titulo+'" rel="imagebox-bw" ><img src="http://'+location.host+FotoMediana+'" alt="" w style="margin:10px;" id="imagentn3" /></a><p style="background-color:#fff;color:#B40014;padding:10px;  font-size:18px;">'+Titulo+'</p>';


var x=$("#Galeria");

document.getElementById('Galeria').innerHTML=imagen;
$(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(Imagen);

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 CambiarGaleria(Id, Imagen, Nombre, Fecha,Inicial,IdPar,status)
{
	//alert(Imagen);
	setTimeout("parent.RemplazarModificarGaleria("+Id+",'"+Imagen+"','"+Nombre+"','"+Fecha+"','"+Inicial+"',"+IdPar+",'"+status+"')",500);
}




function RemplazarModificarGaleria(IdGaleria, Imagen, Nombre, Fecha,Inicial,IdPar,status){
	if(status=="activo")
	{
		disponible= "status1.gif";
		mas = 'alt="Disponible" title="Disponible" ';
	}else{ 
	disponible= "status0.gif"; 
	mas = 'alt="No Disponible"  title="No Disponible" ';
	}
	if(Inicial=="true")
	{
	chexbox='<input name="Verificar['+IdGaleria+']" type="radio" id="Verificar['+IdGaleria+']" value="true" checked="checked"  disabled="disabled" />';
	}else{ chexbox='<input name="Verificar['+IdGaleria+']" type="radio" id="Verificar['+IdGaleria+']" value="true"  disabled="disabled" />'; }
	//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="3%"><input name="'+IdGaleria+'" type="checkbox" id="'+IdGaleria+'" value="'+IdGaleria+'"></td><td width="27%"><div align="left"><img src="http://'+location.host+'/'+Imagen+'" width="70" height="60" /></div></td><td width="31%">'+Nombre+'</td><td width="15%">'+Fecha+'</td><td width="11%" >'+chexbox+'</td><td width="13%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdPar+')"onmouseover="this.style.cursor=\'pointer\'" />&nbsp;&nbsp;&nbsp;<img src="../images/'+disponible+'" '+mas+' width="18" height="19"  /></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 ModificarCategoria(IdPar,Nombre)
{
	setTimeout("parent.RemplazarCategoria("+IdPar+",'"+Nombre+"')",500);
}
	


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

remplazar='<div id="fila_'+IdPar+'" 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="4%"><input name="'+IdPar+'" type="checkbox" id="'+IdPar+'" value="'+IdPar+'"></td><td width="82%"><div align="left">'+Nombre+'</div></td><td width="14%" ><div align="center"><img src="../images/icono_modificar.gif" alt="Modificar" title="Modificar" onclick="VentanaModificar('+IdPar+')"onmouseover="this.style.cursor=\'pointer\'" />&nbsp;&nbsp;&nbsp;</div></td></tr></table></div>';
		document.getElementById('fila_'+IdPar).innerHTML='';
	document.getElementById('fila_'+IdPar).innerHTML = remplazar;

}		

/* Calendario en pÃ¡gina de contacto */


/* Más información en la página de contacto */
$(document).ready(	
	function()
	{
		/* Fix para IE 6 */
		if($.browser.version == '6.0') {
			return;	// FUCK YOU IE 6
		}
		
		// Usabilidad
		$('#moreInformation').addClass('contraido');
		$('#eventInformation').hide();
				
		// Evento
		$('#moreInformation').click(
			function()
			{				
				$('#eventInformation').toggle();
				$('.expandido').switchClass('expandido', 'contraido');
				$('.contraido').switchClass('contraido', 'expandido');
				return false;
			}
		);		
	}
);

