var corpo_h = 0;

init = function(area)
{
	posiciona(area);
	
	if(area == 'galeria') {
		gera_imagens()
		init_slider(0,14);
	} else if(area == 'historia') {
		init_slider(0,5);
	}
}

posiciona = function(area)
{
	//*
	var win = $(window).height();
	var corpo = $("body").height();
	
	if(area!="programacao") { 
		if(area=="galeria") {
			$("#wrap").height("1200px");
			//$("#wrap").height(win);
		} else {
			$("#wrap").height(win);
		}
	}
	//*/
}

function init_slider(_cod,count)
{
	var cod = _cod;
	var desloc = 378;
	var pos = (-desloc)*cod;
	var tempo = 400;
	
	$('.seta_dir').click(function(){
		if(cod < count-1) {
			$('#lista_images').animate({
				left: '-='+(desloc)
			}, tempo);

			pos -= desloc;
			cod += 1;
		}
	})
	
	$('.seta_esq').click(function(){
		if(cod > 0) {
			$('#lista_images').animate({
				left: '+='+(desloc)
			}, tempo);
			pos += desloc;
			cod -= 1;
		}
	})
}


gera_imagens = function()
{
	var lista_img = '';
	var larg = '';
	
	for(var i=1;i<41;i++) {
		lista_img +='<li class="item_images"><a href="javascript:abre_imagem(this,\''+i+'.jpg\')"><img src="images/thumb/'+i+'.jpg"></a></li>';
		larg = 125*41+'px';
	}
	$("#lista_images").width(larg);
	$("#lista_images").html(lista_img);
}


abre_imagem = function(src,img)
{
	//alert('images/'+img)
	$("#foto_gnd").html('<img src="images/'+img+'" alt="job 1"/>');
}



