(function ($) {
$(window).load(function () {
	var orig_content=$(".blk.t03").html();
        $(".view-how-tos li ").mouseenter( function(e){
		var item=this;
		$(".view-right-side .views-field-field-page-right-content").fadeOut(200,function(){
			$(".view-right-side .views-field-field-page-right-content").html( '<section class="blk t03">'+$(item).find(".how-to-content").html()+'</section>').fadeIn(200);
		});
	}).mouseleave(function(e){
            //  $(".blk.t03").html( orig_content  ).show();
	});
	$("noway.blk.t05").mouseleave(function(e){
                $(".blk.t03").fadeOut(200,function(){
                        $(".blk.t03").html( orig_content).fadeIn(200);
                });
        });

	//$(".blk.t03").html(  $(".view-how-tos li:first ").find(".how-to-content").html() );


        $(".staff_item img, .staff_item h1 ").mouseenter( function(e){
                var item=$(this).parent();
                $(".view-right-side .views-field-field-page-right-content").fadeOut(200,function(){
			var ct=jQuery.trim( $(item).find(".staffo-content").html());
			if (ct!=""){
	                        $(".view-right-side .views-field-field-page-right-content").html( '<section class="blk t03">'+ct+'</section>').fadeIn(200);
			}
			else{
	                        $(".view-right-side .views-field-field-page-right-content").html('').fadeIn(200);
			}
                });
        }).mouseleave(function(e){
            //  $(".blk.t03").html( orig_content  ).show();
        });





});

$(document).ready(function(){
	homeBind();

	hFix();
	followBox();
	$(window).resize(

		function(){

			hFix();

		});
                });

function followBox(){

	var el = $('.views-field-field-page-right-content');

	var elpos = el.offset().top;

	$(window).scroll(function (){

		var y=$(this).scrollTop();

		if(y<elpos){

			el.stop().animate({'top':'15px'},500);

			}

		else{

			el.stop().animate({'top':20+y-elpos},500);

			}

	});

}



function homeBind(){

	$('#pgPagina .wrap h1 a').hover(function(){

		$('nav .it04').addClass('active');

	},function(){

		$('nav .it04').removeClass('active');

	});

}



function hFix(){

	wH = '';

	hFixer = $(window).height()-( $('body').height() - $('#central').height()); 

	cFixer = $('#central').height();
		if(hFixer > cFixer){

			wH = hFixer + 'px'
			$('#central').css('height',wH);
			}

		else{

			wH = cFixer + 'px'

			}

		//$('#central').css('height',wH);
}

})(jQuery);


;

