function checkCompatible() {
	 if  (!((navigator.appName == 'Netscape' && parseFloat(navigator.appVersion) >= 3) || (parseFloat(navigator.appVersion) >=4)))
    top.location.href="http://www.cmi.com.br/old_browser.html"
}

function setCookie(name, value, expire) {
document.cookie = name + "=" + escape(value)+';path=/'+((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function getCookie(Name) 
    {
    var search = Name + "="
    if (document.cookie.length > 0)
        { 
        offset = document.cookie.indexOf(search) 
        if (offset != -1)
            { 
            offset += search.length 
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset) 
            // set index of end of cookie value
            if (end == -1) 
                end = document.cookie.length
            return unescape(document.cookie.substring(offset, end))
            }
        }
    }

function canLoad(){
return (getCookie("pwok") == "pass")
}

function checkLoad(){
if (canLoad() != true)
{
document.close()
document.open()
document.write("Voce precisa digitar seu login e sua senha na pagina apropriada para ter acesso a esta pagina.")
}
}

var myForms = new Array(29)
myForms[0] = "help"
myForms[1] = "apto_cobertura"
myForms[2] = "apto_cobertura"
myForms[3] = "apto_cobertura"
myForms[12] = "apto_cobertura"
myForms[13] = "apto_cobertura"
myForms[14] = "apto_cobertura"

myForms[20] = "predio"

myForms[6] = "barracao"

myForms[8] = "casa"
myForms[9] = "casa"
myForms[10] = "casa"
myForms[11] = "casa"
myForms[7] = "casa"

myForms[5] = "andar"

myForms[19] = "lote"

myForms[16] = "galpao"

myForms[17]= "loja"
myForms[18] = "loja"

myForms[21] = "sala"

myForms[4] = "completo"
myForms[15] = "completo"

myForms[22] = "completo"
myForms[23] = "completo"
myForms[24] = "completo"
myForms[25] = "completo"
myForms[26] = "completo"
myForms[27] = "completo"
myForms[28] = "completo"
myForms[29] = "completo"


function changed(theFrame, theObj,path){

var endereco = "http://www.cmi.com.br/cmi.new/exclusivos/imovel_cadastro/aluguel/completo.html"
//checkCompatible()

//var i = theObj.Id_Tipo_Imovel[theObj.Id_Tipo_Imovel.selectedIndex].value
//var i2 = theObj.tipo_transacao[theObj.tipo_transacao.selectedIndex].value

////alert(path + (i > 0 ?( (i2 == 1)?"aluguel/":"venda/" ):("")) + myForms[i] + ".html")

//theFrame.location.href = path + (i > 0 ?( (i2 == 1)?"aluguel/":"venda/" ):("")) + myForms[i] + ".html"

return endereco
}

function canEdit(obj)
{
var cond = ((obj.id_imovel.value.length > 0) && (!isNaN(obj.id_imovel.value)) )
if (!cond) alert('Digite o ID do imovel que deseja editar.')
return cond

}

function isNaN_BR(theField){
var theNumStr = theField.value
var valid = true
var tempN = ''

for (var i=0 ; i < theNumStr.length; i ++){
 	tempN += ( !isNaN(theNumStr.charAt(i)) ) ? theNumStr.charAt(i):''
 	if (isNaN(theNumStr.charAt(i)) && (theNumStr.charAt(i) != '.' ) ){
 		valid = false
 		break
 	}
}
if (valid) theField.value = tempN
return !valid

}
