
	/******************************************
	*         Banner con temporizador         *
	******************************************/
	var speed = 200 
	var pause = 2000
	var timerID = null
	var bannerRunning = false
	var ar = new Array()
	ar[0] = ".:: Bienvenido a lagunamensual.es  ::."
	ar[1] = ".:: PERIÓDICO INFORMATIVO MENSUAL ::." 
	ar[2] = ".:: DEL MUNICIPIO DE SAN CRISTÓBAL DE LA LAGUNA. ::."
	var currentMessage = 0
	var offset = 0

	function stopBanner() {
		if (bannerRunning)
		clearTimeout(timerID)
		bannerRunning = false
	}

	function startBanner() {
		stopBanner()
		showBanner()
	}
	
	function showBanner() {
		var text = ar[currentMessage]
		if (offset < text.length) {
			if (text.charAt(offset) == " ")
				offset++ 
			var partialMessage = text.substring(0, offset + 1) 
			window.status = partialMessage
			offset++ // IE sometimes has trouble with "++offset"
			timerID = setTimeout("showBanner()", speed)
			bannerRunning = true
		} else {
			offset = 0
			currentMessage++
			if (currentMessage == ar.length)
			currentMessage = 0
			timerID = setTimeout("showBanner()", pause)
			bannerRunning = true
		}
	}
	startBanner();


function PopWindow($id,$Ruta)
	{
	window.open('ampliar.php?id=' + $id + '&Ruta=' + $Ruta +'&x=600&y=450',"Ampliar",		'width=600,height=450,menubar=no,scrollbars=si,toolbar=no,location=no,directories=no,resizable=no,top	=100,left=100');
	}


function Portada($id,$Ruta)
	{
	window.open('ampliar.php?id=' + $id + '&Ruta=' + $Ruta +'&x=431&y=600',"Ampliar",'width=431,height=600,menubar=no,scrollbars=si,toolbar=no,location=no,directories=no,resizable=no,top=50,left=200');
	}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function edicion(valor){
  var pagina=valor;
  setTimeout("location.href='" + pagina + "'", 0);
}


/* Funcion creada por el dreamweaver para validar formularios */
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;
}

/* Funcion creada por el dreamweaver para validar formularios */
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+' debe ser una dirección de e-mail.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe ser un número.\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+' debe ser un numero entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es obligatorio.\n'; }
  } if (errors) alert('Se encontraron errore(s):\n'+errors);
  document.MM_returnValue = (errors == '');
}


/* Funciones propias para validar campos en tiempo real */
var nav4 = window.Event ? true : false;


/* COMPRUEBA SI EL CODIGO ASCII CORRESPONDE SOLO A UN NUMERO */
function SoloNumeros(key){
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	return (key <= 13 || (key >= 48 && key <= 57));
}

/* COMPRUEBA SI EL CODIGO ASCII CORRESPONDE SOLO A UN NUMERO
	Y SOLO PERMITE UNA COMA O UN PUNTO */
function SoloFloat(numero,key){
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57, ',' = 44, '.' = 46

	return (
			(key <= 13 || (key >= 48 && key <= 57)) 
			|| ((key == 44 || key == 46)
				&& ((numero.lastIndexOf(",") == -1) && (numero.lastIndexOf(".") == -1))
				)
			); 
}
//
/* COMPRUEBA SI EL CODIGO ASCII CORRESPONDE SOLO A UNA LETRA */
function SoloLetras(key){
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	return (key <= 13 || (key >= 65 && key <= 90) || (key >= 97 && key <= 122));
}

/* COMPRUEBA SI EL CODIGO ASCII CORRESPONDE SOLO A UN NUMERO O LETRA*/
function SoloAlfaNumerico(key){
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	// Borrar || [A-Z] || [a-z] || [0-9]
	return (key <= 13 || (key >= 65 && key <= 90) || (key >= 97 && key <= 122) || 
				(key >= 48 && key <= 57) ); 
}
	

function TelefonoValido(numero,tecla){
	var boo = false;
	/* SI EXISTE TEXTO DEJAMOS SEGUIR ESCRIBIENDO */
	if (numero.length > 0) { 
		boo = true;
	} else {
		/* SI NO EXISTE TEXTO SOLO DEJAMOS INTRODUCIR UN 9 O UN 6 */
		if ((tecla == 9) || (tecla == 8) || (tecla == 6)) { boo = true; }
	 }

	return boo;

}


function DNI(numero,key){
	var boo = false;
	
	if ( (key <= 13) || (key >= 48 && key <= 57) ) { boo = true; }
	
	/* SOLO SE PERMITE METER UNA LETRA SI NO EXISTE TEXTO X=88 x=120*/
	if (numero.length < 1) {
		if ( (key == '120') || (key == '88') ) { boo = true; }
	}

	return boo;

}


/* Recibe la tecla pulsada evt, el texto que hay escrito inputString y los criterios a realizar*/ 
function ValidarFormulario(evt, inputString, Criterios) {
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	var texto = inputString.value;
	// Con esto sacamos el Codigo Ascii de la tecla pulsada
	var key = nav4 ? evt.which : evt.keyCode;
	
	//Pasamos el codigo Ascii a la tecla en si
	var tecla = String.fromCharCode(key);
	var boo = true;

	// Aqui empiezan las condiciones del formulario.

	if (Criterios.indexOf("isNum",0) > -1) {
		if (boo) { boo = SoloNumeros(key); }
	}
	if (Criterios.indexOf("isFlo",0) > -1) {
		if (boo) { boo = SoloFloat(texto,key); }
	}
	if (Criterios.indexOf("isLet",0) > -1) {
		if (boo) { boo = SoloLetras(key); }
	}
	if (Criterios.indexOf("isDni",0) > -1) {
		if (boo) { boo = DNI(texto,key); }
	}
	if (Criterios.indexOf("isTel",0) > -1) {
		if (boo) { boo = TelefonoValido(texto,tecla); }
	}
	if (Criterios.indexOf("isAlfa") > -1) {
		if (boo) { boo = SoloAlfaNumerico(key); }
	}
	
	if ((key <= 13)) { boo = true; }
	
	//alert(key + " " + tecla + " " + texto + " " + boo);	
	if (mouseDown(evt)) { boo = true; }
	return boo;
}

/* <-- Funciones propias para validar campos en tiempo real */

function mouseDown(e) {
 var ctrlPressed=0;
 var altPressed=0;
 var shiftPressed=0;

 if (parseInt(navigator.appVersion)>3) {

  var evt = navigator.appName=="Netscape" ? e:event;

  if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
   // NETSCAPE 4 CODE
   var mString =(e.modifiers+32).toString(2).substring(3,6);
   shiftPressed=(mString.charAt(0)=="1");
   ctrlPressed =(mString.charAt(1)=="1");
   altPressed  =(mString.charAt(2)=="1");
   self.status="modifiers="+e.modifiers+" ("+mString+")"
  }
  else {
   // NEWER BROWSERS [CROSS-PLATFORM]
   shiftPressed=evt.shiftKey;
   altPressed  =evt.altKey;
   ctrlPressed =evt.ctrlKey;
   self.status=""
    +  "shiftKey="+shiftPressed 
    +", altKey="  +altPressed 
    +", ctrlKey=" +ctrlPressed 
  }
  if (shiftPressed || altPressed || ctrlPressed) 

return true;
	/*alert ("Mouse clicked with the following keys:\n"
    + (shiftPressed ? "Shift ":"")
    + (altPressed   ? "Alt "  :"")
    + (ctrlPressed  ? "Ctrl " :"")
   )
*/	

 }
// return true;
}

if (parseInt(navigator.appVersion)>3) {
 document.onmousedown = mouseDown;
 if (navigator.appName=="Netscape") 
  document.captureEvents(Event.MOUSEDOWN);
}
