
$(document).ready ( function() {

	var outImages = $("img[src$='-a.jpg']");

	if ( outImages != null ) {

		// -- Preload dinámico.
		outImages.each (
			function( image ) {
			
				var imgSrc = this.src;
				
				if ( imgSrc.indexOf("-a.jpg") > 0 ) {
					var newImg = new Image();
					newImg.src = getOverImageSrc(imgSrc);
				}			
			}		
		);
	
	}
		
	// -- Rollover para selectores de lenguaje.
	$("#icons img.header_icon").hover (
	
		function() {
			this.src = getOverImageSrc(this.src);		
		},
		
		function() {
			this.src = getOutImageSrc(this.src);	
		}
	);
	
	// -- Submenu
	$("ul#menu li").hover (
		
		function() {
			if ( !$.browser.msie ) {		
				var submenu = $( this ).addClass("hover").children("ul.submenu").show();
			}
		},
		
		function() {			
			$( this ).removeClass("hover").children("ul.submenu").hide();			
		}		
	);	
});

function getOverImageSrc ( imageSrc ) {
	return imageSrc.replace("-a.jpg", "-b.jpg");
}

function getOutImageSrc ( imageSrc ) {
	return imageSrc.replace("-b.jpg", "-a.jpg");
}