function restore_highlighted(fieldname){

	document.getElementById(fieldname).className = "form";

}

function highlight_field(elemento_id){

	if(elemento = document.getElementById(elemento_id)){

		elemento.className="form_erro";

		if(elemento.tagName.toLowerCase() == "input"){

			if(elemento.type != "hidden"){

				//elemento.focus();

			}

		}else{

			//elemento.focus();

		}

		if(elemento.tagName.toLowerCase() != "select"){

			elemento.onkeypress = new Function("restore_highlighted('"+elemento.id+"')");

		}else{

			elemento.onchange = new Function("restore_highlighted('"+elemento.id+"');");

		}

	}

}

function abre_janela(url,largura,altura){

	esquerda = 0;
	topo = 0;

	if(screen.width){

		esquerda = parseInt(screen.width/2) - parseInt(largura/2);
		topo = parseInt(screen.height/2) - parseInt(altura/2);

	}

	window.open(url,"teste","width="+largura+",height="+altura+",left="+esquerda+",top="+topo+"screenX="+esquerda+",screenY="+topo);

}

function abre_plantas(iid,nid,largura,altura){

	abre_janela("planta.php?iid="+iid+"&nid="+nid,largura,altura);

}

function abre_fotos(iid,nid,largura,altura){

	abre_janela("foto.php?iid="+iid+"&nid="+nid,largura,altura);

}

function abre_mapa(iid,largura,altura){

	abre_janela("mapa.php?iid="+iid,largura,altura);

}

function abre_obra(iid,largura,altura){

	abre_janela("obra.php?iid="+iid,largura,altura);

}

function abre_exibicao(iid,largura,altura){

	abre_janela("exibicao.php?iid="+iid,largura,altura);

}

function abre_album(iid){

	abre_janela("album.php?iid="+iid,700,550);

}

function abre_video(iid){

	abre_janela("video.php?iid="+iid,400,400);

}

function abre_indicar(iid){

	abre_janela("indicar.php?iid="+iid,550,550);

}

function abre_coberturas(){

	abre_janela("coberturas/index.htm",750,555);

}

function trocar_ordem(elemento){

	if(elemento.value != ""){

		window.location = "./?"+busca_retorno+"&ord="+elemento.value;

	}

}

function videoFlash(nome) {

	if(navigator.appName.indexOf("Microsoft") != -1){

		return window[nome];

	}else{

		return document[nome];

	}

}

function aumenta_pre(altura){

	videoFlash("video_pre").height = altura;

}

function aumenta_lancamentos(altura){

	videoFlash("video_lancamentos").height = altura;

}

function hpt_inicio(){

	if(campos.length > 0){

		for(i = 0; i < campos.length; i++){

			highlight_field(campos[i]);

		}

	}

}
