botecos = {

    petiscoAtual : 1,
    
    petiscoAleatorio: function(){
        this.petiscoAtual = parseInt(1 + Math.random() * 3);
        var box = 'boxPetisco' + this.petiscoAtual;
	    document.getElementById(box).style.display = '';
	    
    },
    
    mudaPetisco: function(acao){
        var box = 'boxPetisco' + this.petiscoAtual;
	    document.getElementById(box).style.display = 'none';

        if(acao==-1)
			this.petiscoAtual--;
		if(this.petiscoAtual==0)
			this.petiscoAtual = 3;
		if(acao==1)
			this.petiscoAtual++;
		if(this.petiscoAtual==4)
			this.petiscoAtual = 1;

		var box = 'boxPetisco' + this.petiscoAtual;
	    document.getElementById(box).style.display = '';
    },
    

	dsPetiscos : null,
	barAtual : 0,
	inicia : function(){
		this.dsPetiscos = classBares.Seleciona(0,1).value;
		botecos.iniciaBar();
	},
	
	iniciaBar : function(){
	   	var total = botecos.dsPetiscos.Tables[0].Rows.length;
		var rand_no = Math.random();
		rand_no = Math.ceil(rand_no * total)-1;
		botecos.barAtual = rand_no;
		botecos.carregaDetalheBar();
	},
	
	carregaDetalheBar : function(){
		var row = botecos.dsPetiscos.Tables[0].Rows[botecos.barAtual];
		document.getElementById('divImgBarFoto').style.backgroundImage = 'url(_IMG/BotecosHome/' + row.imagem + ')';
		document.getElementById('hBoteco').innerHTML = row.nome;
		document.getElementById('hPetisco').innerHTML = row.petisco;
		document.getElementById('pHarmoniza').innerHTML = 'Harmoniza com: ' + row.harmoniza;
		document.getElementById('aSaibaMais').href = 'botecos_participantes.aspx?boteco=' + row.idBar;
	},
	
	controlaPgDetalheBar : function(acao){
		if(acao==-1)
			this.barAtual--;
		if(this.barAtual==-1)
			this.barAtual = this.dsPetiscos.Tables[0].Rows.length-1;
			
		if(acao==1)
			this.barAtual++;
		if(this.barAtual==this.dsPetiscos.Tables[0].Rows.length)
			this.barAtual = 0;
			
		this.carregaDetalheBar();
	},
	
	dsBotecos : null,
	botecoAtual : 0,
	detalheBoteco : function(idBoteco){
		this.dsBotecos = classBares.Seleciona(0,1).value;
		botecos.botecoAtual = idBoteco - 1;
		botecos.carregaDetalheBoteco();
	},
	
	carregaDetalheBoteco : function(){
		var rowBoteco = botecos.dsBotecos.Tables[0].Rows[botecos.botecoAtual];
		var imagemPng = rowBoteco.imagem.replace('.jpg','.gif');
		document.getElementById('divImgBarFoto').style.backgroundImage = 'url(_IMG/Zoom/' + rowBoteco.imagem + ')';
		document.getElementById('imgNomeBar').style.backgroundImage = 'url(_IMG/_BARES_NOMES/_BARES_NOMES_ZOOM/' + imagemPng + ')';
		document.getElementById('imgNomeBar').innerHTML = rowBoteco.nome;
		document.getElementById('pDecricaoBar').innerHTML = rowBoteco.descricao;
		document.getElementById('pAtracao').innerHTML = '<b>Atra&ccedil;&atilde;o: </b>' + rowBoteco.descricaoAtracao + ' - ' + rowBoteco.dataAtracao;
		document.getElementById('pPetisco').innerHTML = '<b>Petisco: </b>' + rowBoteco.descricaoPetisco;
		document.getElementById('pHarmoniza').innerHTML = '<b>Harmoniza com: </b>' + rowBoteco.harmoniza + ' - ' + rowBoteco.descricaoHarmoniza;
		document.getElementById('pPreco').innerHTML = '<b>Pre&ccedil;o petisco: </b>' + rowBoteco.precoPetisco;
		document.getElementById('pEndereco').innerHTML = '<b>Endere&ccedil;o: </b>' + rowBoteco.endereco + ' - Tel. ' + rowBoteco.telefone;
		document.getElementById('pHorario').innerHTML = '<b>Hor&aacute;rio: </b>' + rowBoteco.horarioFunc;
	},
	
	controlaPgDetalheBoteco : function(acao){
		if(acao==-1)
			this.botecoAtual--;
		if(this.botecoAtual==-1)
			this.botecoAtual = this.dsBotecos.Tables[0].Rows.length-1;
			
		if(acao==1)
			this.botecoAtual++;
		if(this.botecoAtual==this.dsBotecos.Tables[0].Rows.length)
			this.botecoAtual = 0;
			
		this.carregaDetalheBoteco();
	}
}