var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
	var pageTracker = _gat._getTracker("UA-2933244-11");
	pageTracker._trackPageview();
} catch(err) {}

function fnSubmitContact(){
	if ( document.all.txt_contacto_nombre.value == '' || document.all.txt_contacto_nombre.value == '' ){
		alert("Los campos Nombre e Email, son obligatorios.");
	} else {
		document.forma.action="contactop.php";
		document.forma.submit();
	}
}
function fnStats(){
	var ancho 	= 700;
	var alto 	= 500;
	var x 		= (screen.width - ancho) / 2;
	var y 		= (screen.height - alto) / 2;		
	window.open("../stats.php", "Stats", "width=" + ancho + ",height=" + alto + ",top=" + y + ",left=" + x + ",toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
}
function fnfocus(vType){
	if ( vType == 1 ){
		if ( document.all.txtMail.value == "Ingresa tu email" ){
			document.all.txtMail.value = "";
		}
	} else {
		if ( document.all.txtMail.value == "" ){
			document.all.txtMail.value = "Ingresa tu email";
		}
	}
}
function fnDo(vTipo,vLiga,vPopup){
	switch(vTipo){
		case "1":
			document.location.href = "index.php?new="+vLiga;
		break;
		case "2":
			if ( vPopup == 1 ){
				var ancho 	= 700;
				var alto 	= 500;
				var x 		= (screen.width - ancho) / 2;
				var y 		= (screen.height - alto) / 2;		
				window.open(vLiga, "Liga", "width=" + ancho + ",height=" + alto + ",top=" + y + ",left=" + x + ",toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
			} else {
				document.location.href = vLiga;
			}
		break;
		case "3":
			document.location.href = "index.php?gal="+vLiga;
		break;
		case "4":
			document.location.href = "index.php?new=0&cat="+vLiga;
		break;
		case "5":
			document.location.href = "index.php?cal="+vLiga;
		break;
		case "6":
			if ( vLiga == "" ){ vLiga = "0"; }
			document.location.href = "index.php?doc="+vLiga;
		break;
	}
}
function fnViewImage(vImage,vGal){
	if ( vGal == 0 ){
		document.location.href = "index.php?gal="+vImage;
	} else {
		var ancho 	= 500;
		var alto 	= 480;
		var x 		= (screen.width - ancho) / 2;
		var y 		= (screen.height - alto) / 2;		
		var vUrl	= "imagen.php?img="+vImage;
		window.open(vUrl, "Image", "width=" + ancho + ",height=" + alto + ",top=" + y + ",left=" + x + ",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
	}
}
function fnSubmit(vControl,vMsg,vType){
	if ( document.all[vControl].value == '' ){
		alert(vMsg);
		document.all[vControl].focus();
	} else {
		if ( vType == 1 ){
			if ( isEmailAddress(document.all[vControl]) ){
				document.forma.action="index.php";
				document.forma.submit();
			}
		} else {
			document.forma.action="index.php";
			document.forma.submit();
		}
	}
}
function fnOnKeyPress(){
	if(document.all){
		if(event.keyCode == 13){
			event.returnValue	= false;
   			event.cancel 		= true;
   			fnSubmit('txtSearch','Favor de capturar una búsqueda válida.',2);
  		}
 	}
}
function isEmailAddress(theElement){
	var s = theElement.value;
	var filter=/^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if (s.length == 0 ) return true;
	if (filter.test(s))
		return true;
	else
		alert("Ingrese una dirección de correo válida");
		theElement.focus();
	return false;
}