$(document).ready(function(){
$('#layLogin div').hide();
$('#layLogin div:first').show();
$('#layLogin ul li:first').addClass('ativo');
$('#layLogin ul li a').click(function(){ 
$('#layLogin ul li').removeClass('ativo');
$(this).parent().addClass('ativo'); 
var currentTab = $(this).attr('href'); 
$('#layLogin div').hide();
$(currentTab).show();
return false;
});
});

$(document).ready(function(){
	
//Set default open/close settings
$('.acc_container').hide(); //Hide/close all containers
$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

//On Click
$('.acc_trigger').click(function(){
	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
		$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
		$(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
	}
	return false; //Prevent the browser jump to the link anchor
});

});

$(document).ready(function(){
	
//Set default open/close settings
$('.ac_container').hide(); //Hide/close all containers
$('.ac_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

//On Click
$('.ac_trigger').click(function(){
	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
		$('.ac_trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
		$(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
	}
	return false; //Prevent the browser jump to the link anchor
});

});

function checkCheckBox(f){
 if (f.agree.checked == false )
 {
 alert('Vocę deve clicar na caixa EU ACEITO O TERMO para continuar');
 return false;
 }else
 return true;
 }
function openPopup(src){		
var x = (screen.width-0);
var y = (screen.height-0);
var Admin = window.open(src, "","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,channelmode=yes,resizable=yes,copyhistory=no,height="+y+",width="+x+",top=0,left=0");
}
//valida login produtor

function ValidaLogin() {
	varForm = document.formLogin
	if (varForm.login.value == '')
	{
	alert('Favor digitar o Login de Usuário');
	document.formLogin.login.focus();
	return;
	}
	if (varForm.senha.value == '')
	{
	alert('Favor digitar a Senha de Usuário');
	document.formLogin.senha.focus();
	return;
	}
	varForm.submit();
}
var currentImage;
    var currentIndex = -1;
    var interval;
    function showImage(index){
        if(index < $('#bigPic img').length){
        	var indexImage = $('#bigPic img')[index]
            if(currentImage){   
            	if(currentImage != indexImage ){
                    $(currentImage).css('z-index',2);
                    clearTimeout(myTimer);
                    $(currentImage).fadeOut(250, function() {
					    myTimer = setTimeout("showNext()", 3000);
					    $(this).css({'display':'none','z-index':1})
					});
                }
            }
            $(indexImage).css({'display':'block', 'opacity':1});
            currentImage = indexImage;
            currentIndex = index;
            $('#thumbs li').removeClass('active');
            $($('#thumbs li')[index]).addClass('active');
        }
    }
    
    function showNext(){
        var len = $('#bigPic img').length;
        var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
        showImage(next);
    }
    
    var myTimer;
    
    $(document).ready(function() {
	    myTimer = setTimeout("showNext()", 3000);
		showNext(); //loads first image
        $('#thumbs li').bind('click',function(e){
        	var count = $(this).attr('rel');
        	showImage(parseInt(count)-1);
        });
	});
