function resetcolor(){
		var children = document.getElementById('thumbs').getElementsByTagName('a');		
		var total=children.length;
		for (var i=0;i<total;i++){			
			children[i].style.background='#000';
		}
	}
function resetcolor600(){
		var children = document.getElementById('thumbs600').getElementsByTagName('a');		
		var total=children.length;
		for (var i=0;i<total;i++){			
			children[i].style.background='#000';
		}
	}
$(document).ready(function() {
			// Save  the jQuery objects for later use.
			var outer		= $("#preview_outer");			
			var thumbs		= $("#thumbs a");

			var preview_pos;
			var preview_els	= $("#preview_inner div");
			//var image_width	= preview_els.eq(0).width(); // Get width of imaages
			var image_width	= 280;
			// Hook up the click event
			thumbs.click(function() {
				// Get position of current image
				resetcolor();
				(this).style.background='#bfb500';
				preview_pos = preview_els.eq( thumbs.index( this) ).position();		
				// Animate them!
				outer.stop().animate( {'scrollLeft' : preview_pos.left},	500 );
			$("#preview_inner").css('width', preview_els.length * image_width);
			});

			// Reset positions on load
			outer.animate( {'scrollLeft' : 0}, 0 );

			// Set initial width

		});
		$(document).ready(function() {
			// Save  the jQuery objects for later use.
			var outer		= $("#preview_outer600");			
			var thumbs		= $("#thumbs600 a");
			var preview_pos;
			var preview_els	= $("#preview_inner600 div");
			var image_width	= preview_els.eq(0).width(); // Get width of imaages
			
			// Hook up the click event
			thumbs.click(function() {
				/**/
				resetcolor600();
				(this).style.background='#bfb500';				
				// Get position of current image
				preview_pos = preview_els.eq( thumbs.index( this) ).position();					
				// Animate them!
				outer.stop().animate( {'scrollLeft' : preview_pos.left},	500 );
			$("#preview_inner600").css('width', preview_els.length * image_width);
			});

			// Reset positions on load
			outer.animate( {'scrollLeft' : 0}, 0 );
						
			// Set initial width

		});
	function CorreoNewsLetter(txt){  
		  
		//expresion regular  
			var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/  
			  
			if (!b.test(txt)){ 
				alert("El email introducido no es correcto.")  
			} else {
				window.open('newletter.php','popup','width=800,height=425,left=110,top=180,scrollbars=YES,resizable=no');
				document.grilla.submit();		
			}
			//devuelve verdadero si validacion OK, y falso en caso contrario  
			return b.test(txt)  
	}  
	
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-20797453-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
