//FECHA ACTUAL
function fecha(){
	var now = new Date();
	var monthNames = new Array( "enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre");
	thisYear = now.getYear();
	if(thisYear < 1900) {thisYear += 1900};
	document.write("Lima, "  + now.getDate() + " de " + monthNames[now.getMonth()] + " de " + thisYear);
}
//CLIC DERECHO
var message="Copyright 2005 by - MI BARRUNTO.COM";
function click(e) {
	if (document.all) {
		if (event.button==2||event.button==3) {
			alert(message);
			return false;
		}
	}
	if (document.layers) {
		if (e.which == 3) {
			alert(message);
			return false;
		}
	}
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
//STATUS
var current = 0
var x = 0
var speed = 100
var speed2 = 2000
function initArray(n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
		this[i] = ' '
  }
}
typ = new initArray(3)
typ[0]="Cevicheria MI BARRUNTO..."
typ[1]="Siempre MEJOR que la última vez..."
typ[2]="Reservaciones: reservaciones@mibarrunto.com..."
function typewrite() {
var m = typ[current]
window.status = m.substring(0, x++) + "_"
if (x == m.length + 1) {
	x = 0
	current++
	if (current > typ.length - 1) {
		current = 0
	}
		setTimeout("typewrite()", speed2)
	}else {
		setTimeout("typewrite()", speed)
	}
}
typewrite()
//cebiche
function ayuda(){
	herramientas1 = "'titlebar=no,directories=no,hotkeys=no,menubar=no,location=no,personalbar=no,";
	herramientas2 = "personalbar=no,scrollbars=no,status=no,toolbar=no,resizable=no,width=418,height=400'";
	window.open("../archivos/img/contenido/imagen/imagen.htm","newWin",herramientas1 + herramientas2);
}
//dream
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//
function imprime(){
	herramientas1 = "'titlebar=no,directories=no,hotkeys=no,menubar=no,location=no,personalbar=no,";
	herramientas2 = "personalbar=no,scrollbars=no,status=no,toolbar=no,resizable=no,width=465,height=345'";
	window.open("../archivos/img/contenido/ubicacion/impresion.htm","newWin",herramientas1 + herramientas2);
}
//MOSTRAR VIDEOS
function mostrarV(video, titulo, fecha){
	tool1 = "'titlebar=no,directories=no,hotkeys=no,menubar=no,location=no,personalbar=no,";
	tool2 = "personalbar=no,scrollbars=no,status=no,toolbar=no,resizable=no,width=330,height=390'";
	window.open("viewVideo.php?strTitle=" + titulo + "&strFecha=" + fecha + "&strFileFLV=" + video,"newWin",tool1 + tool2);
}
//MOSTRAR VIDEOS 2010
function mostrarV2010(video, titulo, fecha){
	var newLeft = parseInt(screen.availWidth/2 - 330/2);
	var newTop = parseInt(screen.availHeight/2 - 390/2);
	var strPath = "paginas/viewVideo.php?strTitle=" + titulo + "&strFecha=" + fecha + "&strFileFLV=" + video;
	var tool1 = "'titlebar=no,directories=no,hotkeys=no,menubar=no,location=no,personalbar=no,";
	var tool2 = "personalbar=no,scrollbars=no,status=no,toolbar=no,resizable=no,width=330,height=390";
	var tool3 = ",left=" + newLeft + ",top=" + newTop + "'";
	window.open(strPath,"newWin",tool1 + tool2 + tool3);
}
//funcion para validar el paso del formulario
function checkFormu(isReserva){
	var nombre = $('nombre').value;
	var correo = $('correo').value;
	var mensaje = $('mensaje').value;
	
    if(nombre!=''){ 
		if(!correo.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig)){  
			if(mensaje!=''){
				if(isReserva){
					var telefono = $('telefono').value;
					xajax_regReserva(nombre, correo, mensaje, telefono);
				}else{
					xajax_sendSugerencia(nombre, correo, mensaje, telefono);
				}
			}else{
				alert('Ingrese el texto mensaje.');
				$('mensaje').focus();
			}
		}else{
			alert('Ingrese un correo valido.');	
			$('correo').focus();
		}
	}else{
		alert('Ingrese su nombre.');	
		$('nombre').focus();
	}
}
function clearForm(isReserva){
	$('nombre').value = '';
	$('correo').value = '';
	$('mensaje').value = '';
	$('telefono').value = '';
}
function valida(){
	var nombre = document.form1.nombre.value;
	var correo = document.form1.correo.value;
	var mensaje = document.form1.mensaje.value;
    if (nombre =="" || correo =="" || mensaje==""){ 
		alert("CAMPOS OBLIGATORIOS: Nombre - Correo - Mensaje"); 
	}else {
		if(correo.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig)){  
			alert("Correo NO VALIDO.");     
		}else{
			form1.submit();
		}
	}
}
function openMagazine(idMagazine){
	window.open('http://www.mibarrunto.com/Files/Magazines/index.php?idc=' + idMagazine);	
}