function alertResponseDiv(req) {
	alert(req.xhRequest.responseText);
	document.location.reload()
};
function updateResponseDiv(req){
	document.getElementById(responseDiv).innerHTML=req.xhRequest.responseText;
	document.location.reload();
};
function postaComentario(form){
	if (Spry.Widget.Form.validate(form) == true) {
		incluirLoading('enviarComentario');
		Spry.Utils.submitForm('postComment',alertResponseDiv);
	};
};

function recomendaProjeto(form) {
	if (Spry.Widget.Form.validate(form) == true) {
		responseDiv='recomendarProjeto';
		Spry.Utils.submitForm('recomendarProjeto',updateResponseDiv);
		incluirLoading('recomendarProjeto');
	};
};
function postaRecado(form) {
	if (Spry.Widget.Form.validate(form) == true) {
		incluirLoading('enviarRecado');
		Spry.Utils.submitForm('postComment',alertResponseDiv);
	};
};
function mostraProximoProjeto(){
	document.getElementById('proximoProjeto').style.display='block';
};
function escondeProximoProjeto(){
	document.getElementById('proximoProjeto').style.display='none';
};
function listaCidades(cidade){
	if(cidade==""){
		cidade=0; 
	};
	incluirLoading('cidades');
	var estado=document.getElementById('estado');
	Spry.Utils.updateContent('cidades','listaCidades.php?c='+estado.value+'&cidade='+cidade);
	return false;
};
function verificaGaleriaSelecionada(tipo){
	if(tipo=="votacao"){
		galeria=document.getElementById('galeriaVotacao');
	}else{
		galeria=document.getElementById('galeriaPortfolio');
	};
	alert(galeria.value);
};

function SetDestaque(t, id) {
	Spry.Utils.updateContent('destResult',"destaques_setar.php?c="+id+"&t="+t);
}

function setaGaleria(tipo){
	incluirLoading('galeriaTD');
	Spry.Utils.updateContent('galeriaTD','http://galeria.promob.com.br/listaGalerias.php?t='+tipo);
	Spry.Utils.updateContent('subGaleriasTD','blank.html');
	return false;
};
function incluirLoading(div){
	document.getElementById(div).innerHTML="<img src='http://galeria.promob.com.br/_images/loading_blu.gif' /> Carregando...";
};
function removerLoading(div){
	document.getElementById(div).innerHTML="";
};
function setaSubGaleria(cod,tipo){
	var divLoad='subGaleriasTD'+tipo;
	incluirLoading(divLoad);
	Spry.Utils.updateContent(divLoad,'http://galeria.promob.com.br/_ajax/listGallery.php?s=1&c='+cod);
	return false;
};
function setaBlank(div){
	if(div==""){
		div='subGaleriasTD';
	};
	Spry.Utils.updateContent(div,'blank.html');
	return false;
};
function copyToClipboard(meintext){
	if(window.clipboardData){
		CopiedTxt=document.selection.createRange();
		CopiedTxt.execCommand("Copy");
	}else{
		alert('Selecione o texto na caixa ao lado e pressione CTRL+C para copiar.')
	};
	return false;
};
function copiarTextoDe(div){
	var divL=document.getElementById(div);
	if(divL){
		divL.focus();
		divL.select();
		alert('Pressione CTRL+C para copiar o link deste projeto.');
	};
};
function mostraNomeNota(num, lang){
	var notaImg = document.getElementById('nomeNota');
	var nomeIMG="nota_nomes_"+num+lang+".png";
	notaImg.src = '_images/'+nomeIMG;
};
function escondeNomeNota(){
	var notaImg = document.getElementById('nomeNota');
	notaImg.src = '_images/pixel_trans.gif';
};
function trocaPais(){
	var pais=document.getElementById('pais').value;
	if(pais!=30){
		document.getElementById('estado').style.display='none';
		document.getElementById('estado2').style.display='block';
		document.getElementById('cidades').style.display='none';
		document.getElementById('cidades2').style.display='block';
		document.getElementById('codPais').style.display='inline';
	}else{
		document.getElementById('estado').style.display='block';
		document.getElementById('estado2').style.display='none';
		document.getElementById('cidades').style.display='block';
		document.getElementById('cidades2').style.display='none';
		document.getElementById('codPais').style.display='none';
	};
};
function validateonsubmit(form){
	if (Spry.Widget.Form.validate(form) == true) {
		document.forms[form.name].submit();
	};
	return false;
}