function resizeBrowser()
{
    var largura = 0;
    var altura = 0;
    var cont;
	for(cont = 1; cont<=totalimgsbg;cont++){
		if(document.getElementById('bg_site'+cont)){
		    if (parseInt(navigator.appVersion)>3) {
		        if (navigator.appName=="Netscape") {
		            largura = window.innerWidth;
		            altura = window.innerHeight;
		        }
		        if (navigator.appName.indexOf("Microsoft")!=-1) {
		            largura = document.body.offsetWidth;
		            altura = document.body.offsetHeight;
		        }
		    }
		
		    if( largura / altura > larguraImagem / alturaImagem )
		    {
		        document.getElementById( 'bg_site'+cont ).width = largura;
		        document.getElementById( 'bg_site'+cont ).height = alturaImagem * largura / larguraImagem;
		    }
		    else
		    {
		        document.getElementById( 'bg_site'+cont ).width = larguraImagem * altura / alturaImagem;
		        document.getElementById( 'bg_site'+cont ).height = altura;
		    }
		
		    larguraImagem = document.getElementById( 'bg_site'+cont ).width;
		    alturaImagem = document.getElementById( 'bg_site'+cont ).height;
		}
	}
	
	$("#img").show();
	
}
function atualizaDimensoesDaImagem()
{
	$("#img").hide();
	var cont;
	for(cont = 1; cont<=totalimgsbg;cont++){
		if(document.getElementById('bg_site'+cont)){
		    larguraImagem = document.getElementById( 'bg_site'+cont ).width;
		    alturaImagem = document.getElementById( 'bg_site'+cont ).height;
		}
	}
    resizeBrowser();
}
function selectImage(img)
{
	//$(document).ready(function(){
		$('.imagens').cycle('pause');
	//});
   // $.post('action/getImage.php', {img : img}, function(data){
        $('#loading').hide();
        $(".imagens").hide();
		for(i=1; i <= totalimgsbg; i++) {
        	$("#bg_site"+i).attr("src", "imagens/uploads/eventos/"+img);
		}
		//$(".imagens").fadeIn(3000);
		$(".imagens").fadeIn(1500);
		//$('.imagens').cycle('pause');
    //},'html');
}
function selectMovie(movie)
{
    $.post('action/getMovie.php', {movie : movie}, function(data){
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
        $('#mask').css({'width':maskWidth,'height':maskHeight});
        $('#mask').fadeIn(1000);
        $('#mask').fadeTo("slow" ,0.7);
        $("#movie").html(data).fadeIn(2000);
    },'html');
}
$(document).ready(function(){
	$("#img").hide();
	//window.setInterval(changeImage,20000);
	
    $("#mask").click(function(){
        $('#movie').hide();
        $(this).hide();
    });

    $("#acessar").click(function(){
        var login = $("#login").val();
        var senha = $("#password").val();
        $.post('action/login.php', {login : login,senha : senha}, function(data){
            if(data==true){
                location.href="/site/";
            }else{
                alert(data);
            }
        },'html');
    });
    
    $("#ablog").click(function(){
    	$("#fundo-blog").fadeIn();
    	$('#fundo-blog').fadeTo("slow" ,0.7);
    	$("#blog").fadeIn();
    });
	
	 $("#ablogf").click(function(){
    	$("#fundo-blog").fadeOut();
    	$('#fundo-blog').fadeTo("slow" ,0.7);
    	$("#blog").fadeOut();
    });
    
    $("#fundo-blog, #fblog").click(function(){
    	$("#fundo-blog").fadeOut();
    	$("#blog").fadeOut();
    });
    
    //$(document).ready(function(){
        var passa = function(){
    		$("#img").fadeOut(1000);
    		//var img = function(){$("#img").load("action/listImg.php");};
    		//self.setTimeout(img, 780);
    		$("#img").fadeIn();
        };
    	self.setInterval(passa, 60000);
    //});

});
