$(document).ready(function() {
/* Início jQuery */
	
/******* Abrir links com o rel="external" em outra janela *******/
	$("a[rel~=external]").attr("target","_blank");
	

	//Alterna cor de fundo das listas
	$("#mais-noticias li:even").addClass("alt");
		
	//Lista de resultados
	$("#paginacao-prints .proximo a").click(function() {
		var tela = $("#print-projeto").attr("src");
		for (var n=1;n<7;n++){
			var src = tela.replace("1",n);
		}
		$("#print-projeto").attr({src: src});
		//alert(src);
	});
	
	//Efeito de transição das imagens (interna de resultados)
	$("#paginacao-prints li .pagina").click(function() {
		var caminho = $(this).attr("href");
		$("#print-projeto").fadeTo("normal", 0.00,
			function() {
				$("#loading").removeClass("escondido");
				$(this).attr({src: caminho});
				$(this).addClass("escondido");
				$(this).load(function() { 
					$("#loading").addClass("escondido");
					$(this).removeClass("escondido");
					$(this).fadeTo("normal",1.00);
				});
			}
		);
		return false;
	});
	
	/*var src = $("#print-projeto").attr("src");
	var ext = src.substring(src.lastIndexOf('.'), src.length);
	src = src.split(ext)[0].split("_1")[0];
	var i = 1;
	$("#paginacao-prints li .proximo a").click(function() {
		for (var i=1;i<8;i++){
			//?
		}
	});
	$("#print-projeto").attr({src: src+"_"+i+ext});*/
	
	$(".lista-clientes li a").click(function() {
		//
	});

/* Fim jQuery */
});

//Paginação - Capa de Resultados
function proxima2() {
	if(atual < total){
		document.getElementById("lista-projetos_"+atual).style.display = "none";
		document.getElementById("page-"+atual).className="laranja";
		atual++;
		document.getElementById("lista-projetos_"+atual).style.display = "block";
		document.getElementById("page-"+atual).className="";
	}
}
function anterior2() {
	if(atual > 1){
		document.getElementById("lista-projetos_"+atual).style.display = "none";
		document.getElementById("page-"+atual).className="laranja";
		atual--;
		document.getElementById("lista-projetos_"+atual).style.display = "block";
		document.getElementById("page-"+atual).className="";
	}
}
function muda2(num) {
	for(var i=1;i<=total;i++){
		document.getElementById("page-"+i).className="laranja";
		document.getElementById("lista-projetos_"+i).style.display = "none";
	}
	document.getElementById("page-"+num).className="";
	document.getElementById("lista-projetos_"+num).style.display = "block";
	atual = num;
}

//Paginação - Notícias
function proxima() {
	if(atual < total){
		document.getElementById("lista-noticias_"+atual).style.display = "none";
		document.getElementById("page-"+atual).className="laranja";
		atual++;
		document.getElementById("lista-noticias_"+atual).style.display = "block";
		document.getElementById("page-"+atual).className="";
	}
}
function anterior() {
	if(atual > 1){
		document.getElementById("lista-noticias_"+atual).style.display = "none";
		document.getElementById("page-"+atual).className="laranja";
		atual--;
		document.getElementById("lista-noticias_"+atual).style.display = "block";
		document.getElementById("page-"+atual).className="";
	}
}
function muda(num) {
	for(var i=1;i<=total;i++){
		document.getElementById("page-"+i).className="laranja";
		document.getElementById("lista-noticias_"+i).style.display = "none";
	}
	document.getElementById("page-"+num).className="";
	document.getElementById("lista-noticias_"+num).style.display = "block";
	atual = num;
}
