/*
********************************
**	(c)2008 R3 WEBMOTION	  **
**	contact: info@r3.com.br	  **
********************************
*/
jQuery.fn.extend({
	changeImgAnim: function(){
		if($(this)){
			$(this).animate({ marginLeft: "-120px" }, 6000, "linear", function(){
				$(this).fadeOut(1500,function(){
					$(this).css("marginLeft","0").removeClass("view");
					if($(this).is(":last-child")){
						$(this).parent().children().filter(":first-child").addClass("view").fadeIn().changeImgAnim();
					} else {
						$(this).next().addClass("view").fadeIn().changeImgAnim();
					}
				});
			});
		}
	},
	changeImgAnimTwoDir: function(dir){
		if($(this)){
			if(dir=="right"){
				$(this).animate({ marginLeft: "-120px" }, 6000, "linear", function(){
					$(this).fadeOut(1500,function(){
						$(this).css("marginLeft","0").removeClass("view");
						if($(this).is(":last-child")){
							$(this).parent().children().filter(":first-child").addClass("view").fadeIn().changeImgAnimTwoDir("left");
						} else {
							$(this).next().addClass("view").fadeIn().changeImgAnimTwoDir("left");
						}
					});
				});
			} else if(dir=="left"){
				$(this).css("marginLeft","-120px").animate({ marginLeft: "0px" }, 6000, "linear", function(){
					$(this).fadeOut(1500,function(){
						$(this).removeClass("view");
						if($(this).is(":last-child")){
							$(this).parent().children().filter(":first-child").addClass("view").fadeIn().changeImgAnimTwoDir("right");
						} else {
							$(this).next().addClass("view").fadeIn().changeImgAnimTwoDir("right");
						}
					});
				});
			}
		}
	},
	changeImg: function(){
		if($(this)){
			$(this).not(":only-child").each(function(){
				$(this).animate({ opacity: 1 },5000).fadeOut(function(){
					if($(this).is(":last-child")){
						$(this).removeClass("view");
						$(this).parent().children().filter(":first-child").addClass("view").fadeIn().changeImg();
					} else {
						$(this).removeClass("view").next().addClass("view").fadeIn().changeImg();
					}
				});
			});
		}
	}
});

$(document).ready(function () {
	$.Lightbox.construct({
		baseurl: 'http://www.bucalo.com.br/js/jquery_lightbox/',
		show_info: true,
		show_extended_info: true,
		opacity: 0.2,
		speed: 200,
		download_link: false,
		show_linkback: false,
		text: {
			close: 'fechar'
		}
	});
	
	/*$(".dicafoto img").each(function(){
		//alert($(this).height());
		if($(this).height()<=255)
		{
			$(this).css('marginTop','90px');
		}
	});*/
	
	$("#travel ul li:not(.view)").hide();
	$("#travel ul li.view").changeImg();
	
	$("#prod_col_img ul li:not(.view)").hide();
	$("#prod_col_img ul li.view").changeImg();

});