function abreJanelaSuspender(){

	if(document.getElementById('suspender').style['display'] == 'none'){
    	document.getElementById('suspender').style['display'] = 'block';
    }
    else{
    	document.getElementById('suspender').style['display'] = 'none';
    }
}

function buscaFotos(id){
    req.open('GET', urlBuscaFotos+'/id/'+id, true);
    req.onreadystatechange = esperaFotos;
    req.send(null);
}

function esperaFotos() {
    if(req.readyState == 4) {
        if (req.status == 200) {
            var jsonData = JSON.parse(req.responseText);
            document.getElementById('imagens').innerHTML = jsonData[1];
            //alert(jsonData[1]);
        }
    }
}

function mostraTelefone(url,id,idA,tipo){
    document.getElementById('aTelefone').style['display'] = 'none';
    req.open('GET', url+'/id/'+id+'/anuncio/'+idA+'/tipo/'+tipo, true);
    req.onreadystatechange = esperaTelefone;
    req.send(null);
}

function esperaTelefone(){
    if(req.readyState == 4) {
        if (req.status == 200) {
            var jsonData = JSON.parse(req.responseText);
            document.getElementById('pTelefone').style['display'] = 'block';
            document.getElementById('pTelefone').innerHTML = jsonData[0];
        }
    }
}

var emailAnunciante = 0;
function abreEnviaEmailParaAnunciante(){
	if(emailAnunciante == 0){
		emailAnunciante = 1;
		document.getElementById('formulario').style['display'] = 'block';
	}else{
		emailAnunciante = 0;
		document.getElementById('formulario').style['display'] = 'none';
	}
}

function abreEnviaEmailParaAmigo(url){
	window.open(url+'/amigo','Pedido','width=440,height=515,directories=0,location=0,menubar=0,resizable=1,scrollbars=yes,status=0,toolbar=0,marginleft=0,margintop=0');
	//alert(url);
}