$(document).ready(function(){

	$('a#imaEva1-link').hover(function () {
		    $('#imaEva1').addClass('imaEva1_hover');
                    $('#subtitleEva1').addClass('link_eval_rec_color');
		  }, 
		  function () {
		    $('#imaEva1').removeClass('imaEva1_hover');
                    $('#subtitleEva1').removeClass('link_eval_rec_color');
		  }
        );
   
        $('a#imaEva2-link').hover(function () {
		    $('#imaEva2').addClass('imaEva2_hover');
                    $('#subtitleEva2').addClass('link_eval_rec_color');
		  }, 
		  function () {
		    $('#imaEva2').removeClass('imaEva2_hover');
                    $('#subtitleEva2').removeClass('link_eval_rec_color');
		  }
        );

        $('a#imaEva3-link').hover(function () {
		    $('#imaEva3').addClass('imaEva3_hover');
                    $('#subtitleEva4').addClass('link_eval_rec_color');
		  }, 
		  function () {
		    $('#imaEva3').removeClass('imaEva3_hover');
                    $('#subtitleEva4').removeClass('link_eval_rec_color');
		  }
        );




        $('#imaRe1').hover(function () {
		    $(this).addClass('imaRe1_hover');
                    $('#subRe1').addClass('link_eval_rec_color');
		  }, 
		  function () {
		    $(this).removeClass('imaRe1_hover');
                    $('#subRe1').removeClass('link_eval_rec_color');
		  }
         );

         $('#imaRe2').hover(function () {
		    $(this).addClass('imaRe2_hover');
                    $('#subRe2').addClass('link_eval_rec_color');
		  }, 
		  function () {
		    $(this).removeClass('imaRe2_hover');
                    $('#subRe2').removeClass('link_eval_rec_color');
		  }
         );

	 $('#imaRe3').hover(function () {
		    $(this).addClass('imaRe3_hover');
                    $('#subRe3').addClass('link_eval_rec_color');
		  }, 
		  function () {
		    $(this).removeClass('imaRe3_hover');
                    $('#subRe3').removeClass('link_eval_rec_color');
		  }
         );

	 $('#imaRe4').hover(function () {
		    $(this).addClass('imaRe4_hover');
                    $('#subRe4').addClass('link_eval_rec_color');
		  }, 
		  function () {
		    $(this).removeClass('imaRe4_hover');
                    $('#subRe4').removeClass('link_eval_rec_color');
		  }
         );



});

//Del home


$(function() {
//the loading image
var $loader		= $('#st_loading');
//the ul element 
var $list		= $('#st_nav1').add('#st_nav2').add('#st_nav3').add('#st_nav4');
//the current image being shown
var $currImage 	= $('.st_main').children('img:first');

//let's load the current image 
//and just then display the navigation menu
$('<img>').load(function(){
$loader.hide();
$currImage.fadeIn(3000);
//slide out the menu
setTimeout(function(){
$list.animate({'left':'0px'},500);
},
1000);
}).attr('src',$currImage.attr('src'));

//calculates the width of the div element 
//where the thumbs are going to be displayed
buildThumbs();

function buildThumbs(){
$list.children('li.album').each(function(){
var $elem 			= $(this);
var $thumbs_wrapper = $elem.find('.st_thumbs_wrapper');
var $thumbs 		= $thumbs_wrapper.children(':first');
//each thumb has 180px and we add 3 of margin
var finalW 			= $thumbs.find('img').length * 125;
$thumbs.css('width',finalW + 'px');
//make this element scrollable
makeScrollable($thumbs_wrapper,$thumbs);
});
}

//clicking on the menu items (up and down arrow)
//makes the thumbs div appear, and hides the current 
//opened menu (if any)
$list.find('.st_arrow_down').live('click',function(){
var $this = $(this);
hideThumbs();
$this.addClass('st_arrow_up').removeClass('st_arrow_down');
var $elem = $this.closest('li');
$elem.addClass('current').animate({'height':'170px'},200);
var $thumbs_wrapper = $this.parent().next();
$thumbs_wrapper.show(200);
});
$list.find('.st_arrow_up').live('click',function(){
var $this = $(this);
$this.addClass('st_arrow_down').removeClass('st_arrow_up');
hideThumbs();
});

//clicking on a thumb, replaces the large image
$list.find('.st_thumbs .st_slide').bind('click',function(){
var $this = $(this);
$loader.show();
$('<img class="st_preview"/>').load(function(){
	var $this = $(this);
	var $currImage = $('.st_main').children('img:first');
	$this.insertBefore($currImage);
	$loader.hide();
	$currImage.fadeOut(2000,function(){
	$(this).remove();
	});
	}).attr('src',$this.attr('alt'));
	}).bind('mouseleave',function(){
	$(this).children("p.st_text").hide();
	$(this).children("img").stop().animate({'opacity':'1'});
	}).bind('mouseenter',function(){
	var textoRecetaCintillo = $(this).children("p.st_text");
	$(this).children("img").stop().animate({'opacity':'0'}, function(){textoRecetaCintillo.show();});
});

//function to hide the current opened menu
function hideThumbs(){
	$list.find('li.current')
	.animate({'height':'170px'},400,function(){
	$(this).removeClass('current');
})
.find('.st_thumbs_wrapper')
.hide(200)
.andSelf()
.find('.st_link span')
.addClass('st_arrow_down')
.removeClass('st_arrow_up');
}

//makes the thumbs div scrollable
//on mouse move the div scrolls automatically
function makeScrollable($outer, $inner){
var extra 			= 800;
//Get menu width
var divWidth = $outer.width();
//Remove scrollbars
$outer.css({
overflow: 'hidden'
});
//Find last image in container
var lastElem = $inner.find('div:last');
$outer.scrollLeft(0);
//When user move mouse over menu
$outer.unbind('mousemove').bind('mousemove',function(e){
var containerWidth = lastElem[0].offsetLeft + lastElem.outerWidth() + 2*extra;
var left = (e.pageX - $outer.offset().left) * (containerWidth-divWidth) / divWidth - extra;
$outer.scrollLeft(left);
});
}
});


$(document).ready(function(){
prepararBg();

if( !jQuery.featureCarousel ) {
$("div#carousel-container").css('display','block');
$.getScript( 'assets/js/jquery.featureCarousel.js', function() {
$("#carousel").featureCarousel();
} );

}

});

//$("#recetasContainer1").add('#recetasContainer2').add('#recetasContainer3').add('#recetasContainer4').hide("0");




var resizeBG = function(xWidth, xHeight, xImage){
var wHeight = $(window).height();
var wWidth = $(window).width();
var escalaW = (wWidth/xWidth);
var escalaH = (wHeight/xHeight);
var escala = escalaW > escalaH?  escalaW : escalaH;
xImage.width(xWidth*escala);
xImage.height(xHeight*escala);
xImage.css({marginLeft : (wWidth - xImage.width())/2});
xImage.css({marginTop : (wHeight - xImage.height())/2});
}

$(window).resize(function() {
  resizeBG(1900,1209,$('#bg1'));
});


//Enlaces
$('#logoNutrinotas').click(function(){
    window.location='bibiloteca-nutrinotas.html';
});

$('#suscribe').click(function(){
    window.location='suscripcion.html';
});

$('#fbIcon').click(function(){
  //  window.location='http://www.facebook.com/pages/Bimbo-Nutrici%C3%B3n/232990120048914?ref=ts';
window.open('http://www.facebook.com/pages/Bimbo-Nutrici%C3%B3n/232990120048914?ref=ts','_blank');
});
$('#twIcon').click(function(){
    //window.location='http://twitter.com/nutricionbimbo';
window.open('http://twitter.com/nutricionbimbo','_blank');
});
$('#ybIcon').click(function(){
 //    window.location='http://www.youtube.com/NutricionGrupoBimbo';
window.open('http://www.youtube.com/NutricionGrupoBimbo','_blank');
});
$('#rsIcon').click(function(){
  //  window.location='[~397~]';
window.open('http://www.nutriciongrupobimbo.com/rss.html','_blank');
});



if(document.location.protocol!='https:')
  document.write(unescape("%3Cscript%20src='http://s.clicktale.net/WRc5.js'%20type='text/javascript'%3E%3C/script%3E"));

if(typeof ClickTale=='function') ClickTale(535,0.15,"www09");

<!-- ClickTale end of Bottom part -->

