// JavaScript Document
//Rollover de imagenes del menu de destinos lateral
$(document).ready( function()
{
   IMGB.rollllover.init();
   $("#selazul").hide();
   $("#selrosa").hide();
   $("#selamarillo").hide();
});

IMGB = {};

IMGB.rollllover =
{
   init: function()
   {
      this.preload();
     
      $(".roll").hover(
         function () { $(this).attr( 'src', IMGB.rollllover.newimage($(this).attr('src')) ); },
         function () { $(this).attr( 'src', IMGB.rollllover.oldimage($(this).attr('src')) ); }
      );
   },

   preload: function()
   {
      $(window).bind('load', function() {
         $('.roll').each( function( key, elm ) { $('<img>').attr( 'src', IMGB.rollllover.newimage( $(this).attr('src') ) ); });
      });
   },
   
   newimage: function( src )
   {
      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + 'b' + src.match(/(\.[a-z]+)$/)[0];
   },

   oldimage: function( src )
   {
      return src.replace(/b\./, '.');
   }
};


$(function() {
	//blog
	$('#ablog').hover(function(){
		$("#selazul").show();
	}, function(){
		$("#selazul").hide();
	});
	//proyectos
	$('#aproyectos').hover(function(){
		$("#selamarillo").show();
	}, function(){
		$("#selamarillo").hide();
	});
	//portfolio
	$('#aportfolio').hover(function(){
		$("#selrosa").show();
	}, function(){
		$("#selrosa").hide();
	});
});