// Flash/Activex 1.0
// Criado por Willian B. Silveira
// Data modificação: 18/04/2006
// Objetivo: Burlar a Proteção do IE

function createFlash(name, file,quality,width, height, transparency, bgcolor){
	if(transparency == "true"){
		transparency = " wmode='transparent'";
	}
	document.write('<embed src="'+file+'" quality="'+quality+'" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" '+transparency+' align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
}
// --------------------------------------------------------------------------------------

function popup_Show(address, width, height){
	window.open(address, 'popup_Show', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=' + width + ', height=' + height + ', left=' + (390 - (width / 2)) + ', top=' + (290 - (height / 2)));
}

function popup_Print(pid){
	window.open('print.php?pid=' + pid, 'popup_Print', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=520, height=400, left=50, top=50');
}

function popup_Indicate(pid){
	window.open('indicate.php?pid=' + pid, 'popup_Indicate', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=300, height=430, left=50, top=50');
}

function popup_Localizacao(iid){
	window.open('uploads/Local/id-' + iid + '.jpg', 'popup_Indicate2', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=800, height=600, left=0, top=0');
}

function popup_Localizacao2(){
	window.open('exists.php', 'popup_Indicate3', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=800, height=600, left=0, top=0');
}

function popup_Foto(fid){
	window.open('uploads/big_id-' + fid + '.jpg', 'popup_Indicate4', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=800, height=600, left=0, top=0');
}

function popup_Foto2(fid){
	window.open('uploads/id-' + fid + '.jpg', 'popup_Indicate5', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=800, height=600, left=0, top=0');
}

// --------------------------------------------------------------------------------------

function confirmSubmit()
{
	var agree = confirm("Deseja apagar este imovel?");
	if (agree)
		return true ;
	else
		return false ;
}

function confirmProp(pid)
{
	var agree = confirm("Deseja apagar este proprietário?");
	if (agree)
		window.location = "del_periodo.php?pid=" + pid;
	else
		return false ;
}

function confirmPeriodo(pid)
{
	var agree = confirm("Deseja apagar este período?");
	if (agree)
		window.location = "del_periodo.php?pid=" + pid;
	else
		return false ;
}

// --------------------------------------------------------------------------------------

function validate_Form(form, test_name, test_email, test_message){
	if(test_Fields(form, test_name, test_email, test_message))
		document.validate.submit();
}

function test_Fields(form, test_name, test_email, test_message){
	input_name = form.input_name;
	input_email = form.input_email;
	input_message = form.input_message;
	
	if(test_name && input_name.value == ""){
		alert("O campo Nome foi deixado em branco. Preenchimento obrigatório!");
		input_name.focus();
		return false;
	}
	
	if(test_email && input_email.value == ""){
		alert("O campo E-mail foi deixado em branco. Preenchimento obrigatório!");
		input_email.focus();
		return false;
	}
	
	if(test_message && input_message.value == ""){
		alert("O campo Menssagem foi deixado em branco. Preenchimento obrigatório!");
		input_message.focus();
		return false;
	}
	
	if(test_email){
		if(input_email.value.indexOf('@', 0) == -1 || input_email.value.indexOf('.', 0) == -1){
			alert("O e-mail submetido está incorreto. Por favor tente novamente!");
			input_email.focus();
			return false;
		}else
			return true;
	}else
		return true;
}

// --------------------------------------------------------------------------------------

function ApagarBairro(bid)
{
	window.location = "del_bairro.php?bid=" + bid;
}

// --------------------------------------------------------------------------------------

function LimparBusca(form)
{
	form.codigo.value = '';
}

// --------------------------------------------------------------------------------------