
// Cambio de Barrio

	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}

// Rollover _ro

	$(document).ready( function()
	{
	   PEPS.rollover.init();
	});
	
	PEPS = {};
	
	PEPS.rollover = 
	{
	   init: function()
	   {
		  this.preload();
		  
		  $(".ro").hover(
			 function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); }, 
			 function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
		  );
	   },
	
	   preload: function()
	   {
		  $(window).bind('load', function() {
			 $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
		  });
	   },
	   
	   newimage: function( src )
	   { 
		  return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_o' + src.match(/(\.[a-z]+)$/)[0]; 
	   },
	
	   oldimage: function( src )
	   { 
		  return src.replace(/_o\./, '.'); 
	   }
	};
	
	//Image changer
	
	$(document).ready(function() {	
	
		//Click and Hover events for thumbnail list
		$(".image_thumb ul li:first").addClass('active'); 
		$(".image_thumb ul li").click(function(){ 
			//Set Variables
			var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
			var imgTitle = 'http://www.lomejordelbarrio.com/assets/pic_comercio.php?id='+$(this).find('img').attr("alt"); //Get Main Image URL
			
			if ($(this).is(".active")) {  //If it's already active, then...
				return false; // Don't click through
			} else {
				//Animate the Teaser				
					$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
			}
			
			$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
			$(this).addClass('active');  //add class of 'active' on this list only
			return false;
			
		}) .hover(function(){
			$(this).addClass('hover');
			}, function() {
			$(this).removeClass('hover');
		});
		
	});

// CHAR counter

	function contador (campo, cuentacampo, limite) { 
	if (campo.value.length > limite) campo.value = campo.value.substring(0, limite); 
	else cuentacampo.value = limite - campo.value.length; 
	} 
