/*
********************************
**	(c)2008 R3 WEBMOTION	  **
**	contact: info@r3.com.br	  **
********************************
*/

jQuery.fn.extend({
	changeImg: function(){
		if($(this)){
			$(this).not(":only-child").each(function(){
				$(this).animate({ opacity: 1 },5000).fadeOut(1000,function(){
					if($(this).is(":last-child")){
						$(this).removeClass("view");
						$(this).parent().children().filter(":first-child").addClass("view").fadeIn(1000).changeImg();
					} else {
						$(this).removeClass("view").next().addClass("view").fadeIn(1000).changeImg();
					}
				});
			});
		}
	},
	changepatroc: function(){
		var sel = this.selector;
		if(this.length > 0){
			$("ul li.patroc_view:not(:only-child)",this).fadeOut(500, function(){
				if($(this).not(":last-child")){
					$(this).removeClass("patroc_view").next().addClass("patroc_view").fadeIn(500);
				}
				if($(this).is(":last-child")){
					$(this).removeClass("patroc_view");
					$(this).parent().find(":first-child").addClass("patroc_view").fadeIn(500);
				}
			});
			
			//alert(sel);
			setTimeout("$('"+sel+"').changepatroc()",3000);
		}
	}
});

$(document).ready(function () {
	
	//$("#aviso").click(function(){ $(this).hide(); });
	
	if($('#sponsors').length > 0)
	{
		$("ul li:first","#sponsors ul li").addClass('patroc_view');
		$("ul li:not(.patroc_view)","#sponsors ul li").hide();
		setTimeout("$('#sponsors ul li').changepatroc()",3000);
	}
	
	$("#nav ul li").mouseover(function(){ $(this).addClass("over"); }).mouseout(function(){ $(this).removeClass("over"); });
	
});
