// JavaScript Document
function Atualiza_target()
{
    document.cad_imo.action = "index.php"    // First target
    //document.cad_imo.target = "";    // Open in a iframe
    document.cad_imo.submit();        // Submit the page
    //document.Form1.action = "page3.php"    // Second target
    //document.Form1.target = "iframe2";    // Open in a iframe
    //document.Form1.submit();        // Submit the page
    return true;
}

function sendurl(URL){	
	window.opener.location=URL
}
function abrirr(URL){
	window.open(URL)
}
function ValidaCheckBox() //verifica checkbox
{
	if (document.cad_imo.foto.checked == true) 
	{
		document.cad_imo.action = "index.php?opt=Mg==&optm=Y2FkX2ZvdG8="  ;
	}
}

function campObrigatorio()//verifica se os campos marcados com * estao preenchidos
{		
	inputs = document.getElementsByTagName("input")

	for (i = 0; i < inputs.length; i++)
	{
		if (inputs[i].name == "pro_nom")
		{
    		if (inputs[i].value == "")
			{
	  			alert('É Obrigatorio informar o Nome do Proprietário.')
      			inputs[i].focus()
      			return false
     	 		break;
	 		}    
		}
	}
}

function BloqueiaEnter()
{
	document.onkeydown=function(e){
	var e = e || event;
	var k = e.keyCode || e.which;
	if (k==13) { return false }
	}
}

function abrir(URL) 
{
  // var width = 790; width='+width+'
   //var height = 500;, height='+height+',

   var left = 99;
   var top = 99;

   window.open(URL,'fotos','top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=yes, location=no, directories=no, menubar=no, resizable=yes, fullscreen=no');
}

function Contar(Campo){
	if((200-Campo.value.length)<0){
		total = Campo.value;
		Campo.value = total.substring(0,200);
	}
	/*else{
		document.getElementById("Qtd").innerText = 200-Campo.value.length	
	}*/
} 

function ChecaTxtVazio() //checa campo vazio
{
  inputs = document.getElementsByTagName("input")
  
  for (i = 0; i < inputs.length; i++)
  {
    if ((inputs[i].name == "imo_end" || inputs[i].name == "imo_bai" || inputs[i].name == "imo_num" || inputs[i].name == "imo_des" || inputs[i].name == "imo_val" || inputs[i].name == "pro_nom" || inputs[i].name == "pro_tel") && inputs[i].value == ""){
		/*if (inputs[i].value == "")
		{*/
		  alert('Os campos marcados com (*)são Obrigatórios!')
		  inputs[i].focus()
		  return false
		  break;
		//}
	}
  }
}

