function AlternaForm(sValor, divNome){
	switch (sValor) {
	case "F":
		document.getElementById("formJuridica").style.display = 'none';
		document.getElementById(divNome).style.visibility = 'hidden';
		break;
	case "J":
		document.getElementById("formJuridica").style.display = 'block';
		document.getElementById(divNome).style.visibility = 'visible';
		break;
	}	
}
function alternaPais(oChk, Pais, PaisDiv, Uf, UfDiv, UfInt, UfIntDiv)
{
	
	oPais     = document.getElementById(Pais);
	oPaisDiv  = document.getElementById(PaisDiv);
	oUf       = document.getElementById(Uf);
	oUfDiv    = document.getElementById(UfDiv);
	oUfInt    = document.getElementById(UfInt);
	oUfIntDiv = document.getElementById(UfIntDiv);
	
	if ( oChk.checked )
	{
		oPaisDiv.style.visibility = "visible";
		oPais.setAttribute("fieldName", oPais.getAttribute("fieldTemp"));
		
		oUfDiv.style.display = "none";
		oUf.setAttribute("fieldTemp", oUf.getAttribute("fieldName"));
		oUf.removeAttribute("fieldName");
		
		oUfIntDiv.style.display = "block";
		oUfInt.setAttribute("fieldName", oUfInt.getAttribute("fieldTemp"));
	}
	else
	{
		oPaisDiv.style.visibility = "hidden";
		oPais.setAttribute("fieldTemp", oPais.getAttribute("fieldName"));
		oPais.removeAttribute("fieldName");
		
		oUfDiv.style.display = "block";
		oUf.setAttribute("fieldName",oUf.getAttribute("fieldTemp"));
		
		oUfIntDiv.style.display = "none";
		oUfInt.setAttribute("fieldTemp", oUfInt.getAttribute("fieldName"));
		oUfInt.removeAttribute("fieldName");
	}
}

function mask(oData,evento) {

	var e = (window.event ? event : evento);
	var str = oData.value;
	var loc = "2,5";
	var delim = "/";
	var locs = loc.split(',');
	
	for (var i = 0; i <= locs.length; i++){
		for (var k = 0; k <= str.length; k++){
			if (k == locs[i])
				if (str.substring(k, k+1) != delim)
					if (e.keyCode != 8) //backspace
						str = str.substring(0,k) + delim + str.substring(k,str.length);
	
		}
	}
	oData.value = str.substring(0,oData.maxLength);
}
