//      3index_B.js
//      
//      Copyright 2007 jesus <jesus@JMF>
//      
//      This program is free software; you can redistribute it and/or modify
//      it under the terms of the GNU General Public License as published by
//      the Free Software Foundation; either version 2 of the License, or
//      (at your option) any later version.
//      
//      This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
//      
//      You should have received a copy of the GNU General Public License
//      along with this program; if not, write to the Free Software
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//      MA 02110-1301, USA.



//<%
//nombre=request.servervariables("HTTP_REFERER")
//if nombre <> "http://localhost/web/peralvillo/peralvillo2/2index.php" then
//response.end
//end if
//%>

var lastzIndex=1;
var myShow;
/*window.addEvent('unload',function(){
						//if($type(GUnload)=='function') {GUnload();alert('no')}
						GUnload();
						})
*/
//*******************************************************
//CON:
//<script type="text/javascript" src="slideshow/js/slideshow.js"></script>
//<link type="text/css" rel="stylesheet" href="slideshow/css/slideshow.css" />
window.addEvent('domready', function(){
	    /*var data = {
	      '16005.jpg': { caption: 'Hace tiempo...' }, 
	      '31008.jpg': { caption: 'pintura' }, 
          '31007.jpg': { caption: 'pintura' }, 
	      '31016.jpg': { caption: '' }
	    };*/
        loadImages();
        //console.log(Document.getSize())
 })
      //transition: 'elastic:out' | 'back:in:out' | back:in |bounce:out
//*********************************************************************  

function loadImages(){  
    var json = new Request({url: "images.txt", 
                                           onComplete: function(){
                                                var data= this.response.text;
                                                data= JSON.decode(data);
                                                //alert(data)
                                                myShow = new Slideshow('picasaSlideshow', data, { captions: false, controller: false, height: 120, 
                                                                        hu: 'fotos/' ,overlap:true, loader:false,
                                                                        /*transition: 'back:in',*/width: 160 });
                                            }
     }).get();
     
}

//----------------------------------------------------------------------------
var Event1 = {
	add: function(obj,type,fn,args) {
		obj.addEvent(type, fn); //mootools
	},
	remove: function(obj,type,fn) {
		obj.removeEvent(type, fn); //mootools
	},
	fix: function(e,dat) {
       e = e || window.event
       if (! e.target) {e.target= e.srcElement};
       if (! e.currentTarget) {e.currentTarget=e.target.parentNode;} //estaba bien
       if(e.fromElement){ e.relatedTarget = e.fromElement; }
       if(e.toElement){ e.relatedTarget = e.toElement; }
       if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
       if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
       if (typeof e.clientX == 'undefined') e.clientX = e.pageX;
       if (typeof e.clientY == 'undefined') e.clientY = e.pageY;
       if (! e.stopPropagation) {e.stopPropagation=function(){this.cancelBubble = true}}
       if (! e.preventDefault) {e.preventDefault=function(){this.returnValue = false}}
   
       e.otra='nada'//dat;
       e.fixEvent=true;
       return e
	},
	cancel: function(e) {
		e= new Event(e).stop(); //mootools
		/*if (! e.fixEvent) this.fix(e);
        e.stopPropagation();
        e.preventDefault();*/
	}
}//Event


//==================================================================0

//==========================================================
Number.prototype.toColorPart = function() {
  var digits = this.toString(16);
  if (this < 16) return '0' + digits;
  return digits;
}
/*--------------------------------------------------------------------------*/
 // Get elements by class by Dustin Diaz.
function getElementsByClass(searchClass,node,tag) {
 var classElements = new Array();
 if ( node == null )
  node = document;
 if ( tag == null )
  tag = '*';
 var els = node.getElementsByTagName(tag);
 var elsLen = els.length;
 var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
 for (i = 0, j = 0; i < elsLen; i++) {
  if ( pattern.test(els[i].className) ) {
   classElements[j] = els[i];
   j++;
  }
 }
 return classElements;
}

//------------------------------------------------------------------------
function vacio(form){
  //new Event(e).stop();
  //Event1.cancel(e);
  var palabra=form['au'].value + form.ti.value + form.te.value + form.ape.value;

  if ((palabra== " ")||(palabra.length <4)) {
     alert(' > 3 caracteres');
     form['te'].value="zzzz";
//    document.forms["buscaa"].palabra.focus();
	 //Event1.cancel(e);
     //return false;
  }else {
	//Util.ver(document.forms['buscaa'])
	
	//Util.ver(e.currentTarget)
     AjaxB.general2({elFich:'Busca.php?act=97',elDest:'resultados',elForm:form})
	 //return true;
  }
}
function buscaSencilla(){
	//var aaa=new Effect.Highlight('searchweb');
	$('resultados').innerHTML='<h4 style="margin-top:40px;">Utilize el buscador del menú de-Leon (a la derecha y abajo).</h4>';
}
//***********************************************************************************

function alINE(municipio){
	if  (municipio.length <4) return false;
	$('formAlINE').submit(); 
	//console.log($('formAlINE'))
	return true
}
//************************************************

