// funcoes 

$(function(){
	$('#acessarGalerias').bind('click',function(event) {
		location = 'index.php?id=4';
	});
    
	$('#acessarProdutos').bind('click',function(event) { 
		location = 'index.php?id=1';
	});
	
	if($('#scrollImg')){
		$("#scrollImg").scrollable({circular: false, mousewheel: true}).navigator();		
	}
	
	$('#banners').cycle({
    	speedIn: 2000,
        speedOut: 1500
    });
});

function filtraProdutos(categoria){
	if(categoria != ""){
		location = (categoria == 0) ? 'index.php?id=1' : 'index.php?id=1&c=' + categoria;
	}
}


//alterar foto garanhões
function alteraFoto(id,foto){ 
	$(document).ready(function() {
		$("#img"+id).click(function() {
			$("#mostrarGaranhao").html("<img src='"+foto+"'/>");
		});
	});

}
//fim alterar foto

function carregaFoto(id,foto) {
	
	$("#mostrarGaranho").html("<img src='" + foto + "' width='320' />");
	
//	$.ajax({
//		type: "GET",
//		url: "php/ajax.php",
//		data: "op=ALTFT&ft="+foto+"&idc="+id,
//		dataType: "html",
//		success: function(retorno){
//			$('#mostrarGaranhao').html(retorno);
//		}
//	});
}


function mostraFoto(id,foto){
	$("#mostrarGaranho").ajaxStart(function(){
		$(this).show();
	});
	$.ajax({
		type: "GET",
		url: "php/ajax.php",
		data: "op=ALTFT&ft="+foto+"&idc="+id,
		dataType: "html",
		success: function(retorno){
			$('#mostrarGaranhao').html(retorno);
		}
	});	
	
}

function zoomParceiro(descricao, imagem, link, largura, altura){
	Shadowbox.init({
	    // let's skip the automatic setup because we don't have any
	    // properly configured link elements on the page
	    skipSetup: true
	});
	
	Shadowbox.open({
		content: "<a href='"+link+"'><img src='"+imagem+"' border='0'/></a>",
		player: 'html',
		title: descricao,
		width: largura,
		height: altura
	});
}
