var aImg = new Array(1,2,3,4,5);

$(document).ready(function(){

    geracount('_site', 'id_cont_site');    geracount('_home', 'id_cont_page');    // Possibilita uasr imagens .png com fundo transparente, também em IE5 e IE6.
	$(document).pngFix(); 
	// Desliza o nome do site até a margem direita superior	TituloOnOff(0);
    frase();
	// Menu de seleção 	$("#sel_data1 a").click(function() {
		y = $(this).attr("tag");			
        $("#div_thumb_k").html('<br /><h3 align=center>Carregando fotos da galeria...</h3>');
        $.ajax({
            type: 'POST',
            url: './rwstat.php',
            data: 'arq=fotos/'+y,
            error: function(msg){
            		$("#div_thumb_k").html('<br /><h2>Galeria não disponível!</h2>');
            },
            success: function(msg){
                    $("#div_thumb_k").hide('slow');
            		$("#div_thumb_k").load('./fotos_lista2.inc.php', {opc: y, views: msg});
                    $("#div_thumb_k").show('slow');
            }		});
        return false;
	});		// Assine o plano de hospedagem	$("#tr_assine a").click(function() {		g_id = '_contato';                geracount(g_id, 'id_cont_page');		g_id =  "#div"+g_id;        		$("#div_host").hide();		$(g_id).show('slow');	});	
	// Menu de seleção 
	$("#sel_banda a").click(function() {
//		alert('1');
		y = $(this).attr("tag");
		$("#_banda_lista").load('./bandas_lista.inc.php', {opc: y});
	});
	
	$("#menu_superior a").click(function(){		
//		alert('2');
		$("#div_home").hide();
		$("#div_host").hide();
		$("#div_galeria").hide();
		$("#div_login").hide();
		$("#div_contato").hide();
		$("#div_pedidos").hide();
		$("#div_politica").hide();
		$("#div_sobre").hide();
		$("#div_foto").hide();
		$("#div_fotografo").hide();
		
		g_texto = $(this).text();
		g_nome = $(this).attr("name");
		g_id =  $(this).attr("id");
        
        geracount(g_id, 'id_cont_page');

		g_id =  "#div"+g_id;        
		$(g_id).show('slow');
        
	});
	
	$("#menu_galeria a").click(function(){	
        y = $(this).attr("tag");	
		
        if ( y == null) {
    		$("#div_gal1").hide();
    		$("#div_gal2").hide();
    		$("#div_gal3").hide();
    		
    		g_id =  "#div"+$(this).attr("id");
    		
    		$(g_id).show('slow');
            return false;
        }
	});
	
});

function f_imagem_grande(imgID) {
var html_text, sImagem;
	
    sImagem = 'arq='+aImg[imgID][3]+'/'+aImg[imgID][1];
    
    $.ajax({
        type: 'POST',
        url: './rwstat.php',
        data: sImagem,
        error: function(msg){
            alert('ops');
        },
        success: function(msg){
            sViews = msg;            
        	html_text = "<div class='detalhes'>"+
                            "<div class='tabela_nome'>Nome: </div><div class='tabela_dados'>"+aImg[imgID][1]+"</div><br />"+
                            "<div class='tabela_nome'>Descrição: </div><div class='tabela_dados'>"+aImg[imgID][2]+"</div><br />"+
                            "<div class='tabela_nome'>Visualizada: </div><div class='tabela_dados'>"+sViews+" vez(es)</div><br />"+
                        "</div>";
        //	$("#div_imagem_detalhes").html(html_text);

            _imagem = aImg[imgID][3]+'/'+aImg[imgID][1];
        //	_imagem = '#FFF url('+_imagem+') no-repeat top center;';

            $("#div_detalhes").show('slow');	
            $("#div_imagem_grande").hide();	
            
            $("#div_imagem_grande").animate({ width: 'toggle', opacity: 'toggle'}, "fast");
            
        //	$("#div_imagem_grande").css('background', _imagem);		
            $("#div_imagem_grande").html('<img src="'+_imagem+'" style="border:1px solid #999; background:#fff; padding:2px;">'+html_text);
            
            $("#div_imagem_grande").css('top',$(this).top);
            $("#div_imagem_grande").show('slow');
        }        
    });
    
    $("#div_imagem_grande").click( function() {
        $("#div_detalhes").hide('slow');	
    })
    
        

};

//Função de expansão de itens ocultos
function Expande(ch) {	
	TituloOff();
	sStatus = $("#"+ch).css("display");
	if (sStatus=='none')
		$("#"+ch).show('slow')	
	else
		$("#"+ch).hide('slow');
}
//-->


function TituloOnOff(iSentido) {
  if (iSentido==1) { // on
		$("#titulo").animate({left: -55}, "slow");
		$("#titulo").animate({top: -50}, "slow");
		$("#titulo p").css({ color: '#E6B715' });
		$("#titulo h1").css({ color: '#E6B715' });
	} else { // 1 = off
		$("#titulo").animate({top: 100}, "slow");
		$("#titulo").animate({left: 480}, "slow");
		$("#titulo").animate({top: -215}, "slow");
		$("#titulo p").css({ color: '#FFF' });
		$("#titulo h1").css({ color: '#FFF' });
		$("#titulo a").css({ color: '#FFF' });
	}
}
/*
			<div style="display: none; float: right; left: 450; width: 250px; height: 491px; background: url(./images/portfolio1b.png)"></div>
*/

function frase() {
var frases = [
'"As únicas desgraças completas são as desgraças com as quais nada aprendemos." <br />-- William Ernest Hocking',
'"Não possuir algumas das coisas que desejamos é parte indispensável da felicidade."<br />-- Bertrand Russel',
'"Abandonei o estudo pelos livros dos homens e passei a ler o livro do mundo."<br />-- Paracelsus',
'"Não é suficiente entender. É preciso aprender. E aprender é repetir até ser capaz de fazer por si mesmo."<br />-- Roberto Lopes',
'"Algumas coisas são verdadeiras, acredite você nelas ou não."<br />-- Anjo Seth Prata (Cidade dos Anjos)',
'"Certa noite perguntei ao Fábio Elias (Banda Rélespública) se me daria um cd de presente de aniversário. Sua resposta: <br />Sou igual a puta. Dou... mas cobro!"<br />-- reiwolf',
'"UMA VEZ PERGUNTARAM A CONFÚCIO:<br>- O que mais o surpreende na humanidade?<br>E ele respondeu:<br>'+
"- Os homens que perdem a saúde para juntar dinheiro e depois <br />"+
'perdem o dinheiro para recuperar a saúde.<br>Por pensarem ansiosamente no futuro, esquecem o presente, <br />de tal forma que acabam por nem viver no presente nem no futuro.<br>Vivem como se nunca fossem morrer e morrem como se nunca tivessem vivido."<br />-- Confúsio',
'"Eu acredito que \'incurável\' quer dizer \'CURA INTERIOR\'".<br />-- A Lei da Atração'
 ];

var autores = [
"William Ernest Hocking",
"Bertrand Russel",
"Paracelsus",
"Roberto Lopes",
"Anjo Seth Prata (Cidade dos Anjos)",
"reiwolf",
"Confúsio",
"A Lei da Atração" ];

index = Math.floor(Math.random() * frases.length);
//document.write("<DL>");
//document.write("<DT><I>" + "\"" + frases[index] + "\"</I>");
//document.write("<DD>" + "-- " + autores[index]);
//document.write("</DL>");

var sFrase = "<p style='none'><I>" + frases[index] + "</I></p>";
    //sFrase = sFrase + "<BR>" + "-- " + autores[index];

$("#rw-frase").html( sFrase );
}

function geracount(sArq, sOnde) {
     $.ajax({
        type: 'POST',
        url: './rwstat.php',
        data: 'arq=fotos/'+sArq,
        error: function(msg){
            $("#"+sOnde).html( 'indefinidas' );
        },
        success: function(msg){            
            $("#"+sOnde).html( msg );
        }        
    });   
}