(function($) {
    jQuery.scrollToElement = function( $element, speed ) {

        speed = speed || 950;

        $("html, body").animate({
            scrollTop: $element.offset().top,
            scrollLeft: $element.offset().left
        }, speed);
        return $element;
    };

    jQuery.fn.scrollTo = function( speed ) {
        speed = speed || "normal";
        return $.scrollToElement( this, speed );
    };
})(jQuery);
jQuery(document).ready(function(){
	jQuery.ajaxSetup({cache:false});
	jQuery("#lista a").hover(function(){
		var post_id = jQuery(this).attr("rel")
		jQuery('#bends .inner').fadeOut(500);
		jQuery('#bends .inner').fadeIn(1);
		jQuery("#bends .inner").html("loading...");
		jQuery("#bends .inner").load("http://www.op-barufe.com/ajax/", {id:post_id});
return false;
	});
});
jQuery(document).ready(function(){
	jQuery.ajaxSetup({cache:false});
	jQuery("#stages li").live('click', function(e){
		var post_id = jQuery(this).attr("rel")
		jQuery('#change .inner').fadeOut(500);
		jQuery('#change .inner').fadeIn(1);
		jQuery("#change .inner").html('<img class="loader-gif" src="ajax-loader.gif" />');
		jQuery("#change .inner").load("http://www.op-barufe.com/ajax/", {id:post_id});
		 jQuery("#change a").fancybox();
return false;
	});
});
jQuery("#change a").live("click",function(ev){
	ev.preventDefault();
	jQuery.fancybox({
		'autoDimensions'	: false,
			'width'         	: 350,
			'height'        	: 350,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'showNavArrows'		: false,
			'href'			: jQuery(this).attr('href')
	})
});
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({auto: 2,
        wrap: 'last', animation: 'slow'});
});





jQuery(document).ready(function(){
	
	jQuery('.ps').click(function() {
	  jQuery('#post-55').scrollTo();
});
	jQuery('.wc').click(function() {
	  jQuery('#post-57').scrollTo();
});
	jQuery('.rs').click(function() {
	  jQuery('#post-59').scrollTo();
});
	jQuery('.ms').click(function() {
	  jQuery('#post-61').scrollTo();
});
	jQuery('.vs').click(function() {
	  jQuery('#post-63').scrollTo();
});
});
jQuery(document).ready(function(){
	jQuery("#lista td a").hover(
		function(){
			var iconName = jQuery(this).find("img").attr("src");
			var origen = iconName.split("x.")[0];
			jQuery(this).find("img").attr({src: "" + origen + "o.gif"});
			jQuery(this).find("span").attr({
				"style": 'display:inline'
			});
			jQuery(this).find("span").animate({opacity: 1, top: "-60"}, {queue:false, duration:400});
		}, 
		function(){
			var iconName = jQuery(this).find("img").attr("src");
			var origen = iconName.split("o.")[0];
			jQuery(this).find("img").attr({src: "" + origen + "x.gif"});
			jQuery(this).find("span").animate({opacity: 0, top: "-50"}, {queue:false, duration:400}, "linear",
				function(){
					jQuery(this).find("span").attr({"style": 'display:none'});			
				}
			);
		});
});
jQuery(document).ready(function(jQuery){
		var select = jQuery('a[href$=".bmp"],a[href$=".gif"],a[href$=".jpg"],a[href$=".jpeg"],a[href$=".png"],a[href$=".BMP"],a[href$=".GIF"],a[href$=".JPG"],a[href$=".JPEG"],a[href$=".PNG"]');
		select.attr('rel', 'fancybox');
		select.fancybox();
jQuery("#lista a, .fancy3, #post-63 a, #post-61 a, #post-59 a, #post-57 a, #post-55 a, #post-613 a, #change a").fancybox({
			'autoDimensions'	: false,
			'width'         	: 350,
			'height'        	: 350,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'showNavArrows'		: false
			});

jQuery(".fancy").fancybox({
			'autoDimensions'	: false,
			'width'         	: 800,
			'height'        	: 'auto',
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titleShow'		: false

			});
jQuery(".fancy2").fancybox({
			'autoDimensions'	: false,
			'width'         	: 720,
			'height'        	: 480,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titleShow'		: false,
			'type'				: 'iframe'

			});



jQuery(".youtube").click(function() {
	jQuery.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});


	});

jQuery(function () {
	jQuery('#counter').countdown({until: new Date(2010+1,4,26,18), layout: '...jo&scaron; 	<span>{dn}</span> {dl} &middot; <span>{hn}</span> {hl} &middot; <span>{mn}</span> {ml} &middot; <span>{sn}</span> {sl} do Barufa!'});
	
});
