function formata_tel1(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.tel1.value = tel_final;
}

function formata_tel2(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.tel2.value = tel_final;
}

function formata_tel3(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.tel3.value = tel_final;
}

function formata_fax(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.fax.value = tel_final;
}


function formata_tel_cob(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.tel_cob.value = tel_final;
}

function formata_tel_ref1(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.tel_ref1.value = tel_final;
}

function formata_tel_ref2(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.tel_ref2.value = tel_final;
}

function formata_tel_ref3(field){
	tel = eval("document.frm_cadastro_corp."+field+".value");
	while (tel.indexOf("-") > 0)
		tel = tel.replace("-","");
	tel_final = tel;
	if (tel.length >= 8){
		tel_final = tel.substring(0,4) + "-" + tel.substring(4,8);
	}
	document.frm_cadastro_corp.tel_ref3.value = tel_final;
}
