/* Data: 02/05/2010 */
/* Designer: Flavio Henrique */
/* Email: flaviohlemes@ciclonetidc.com.br */

/* (c) 2010 Ciclonet Soluções em Internet */
/* URL: http://www.ciclonet.com.br */
/* E-Mail: ciclonet@ciclonetidc.com.br */

/* -- rotina ajax -- */
var requip1;
function loadXMLDocNews(div, url, loadd){
	divs = div;
	//divs2 = div2;
	//params = params0;
	url = url;
	divload = loadd;
	requip1 = null;
	//document.getElementById(divs2).style.display = "inline";
	if (window.XMLHttpRequest) {
		requip1= new XMLHttpRequest();
		requip1.onreadystatechange = ProcessEquip1; // o req.  foi alterado para requip1
		requip1.open("POST", url, true); // o req.  foi alterado para requip1			
		requip1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		requip1.setRequestHeader("Content-length", url.length =+ 1000);
		requip1.setRequestHeader("Connection", "close");
		requip1.send(''); // o req.  foi alterado para requip1

	} else if (window.ActiveXObject) {
		try {
			requip1= new ActiveXObject("Msxml2.XMLHTTP.4.0");
		} catch(e) {
			try {
				requip1= new ActiveXObject("Msxml2.XMLHTTP.3.0");
			} catch(e) {
				try {
					requip1= new ActiveXObject("Msxml2.XMLHTTP");
				} catch(e) {
					try {
						requip1= new ActiveXObject("Microsoft.XMLHTTP");
					} catch(e) {
						requip1= false;
					}
				}
			}
		}
		if (requip1) {
			requip1.onreadystatechange = ProcessEquip1;
			requip1.open("POST", url, true);
			requip1.setRequestHeader("Content-length", url.length =+ 1000);
			requip1.setRequestHeader("Connection", "close");
			requip1.send('');
		}
	}
}

function ProcessEquip1(){
		
	if (requip1.readyState == 4) {
		document.getElementById(divload).style.display = "inline";
		if (requip1.status == 200) {
			document.getElementById(divload).style.display = "inline";
			document.getElementById(divs).innerHTML = requip1.responseText;
			document.getElementById(divload).style.display = "none";
			document.getElementById(divs).innerHTML = document.getElementById(divs).innerHTML;
			
		} else {
			alert("Houve um problema ao obter os dados:\nConteudo não encontrado");
		}
	}
}
	
	function ajax(div, url, loading){
		
		divz = div;
		url = url;
		loading = loading;
		
		if ((loading==undefined) || (loading==null)){
			var loading = "loading"
		}
		//alert(loading);
		document.getElementById(loading).style.display = "inline";
		onLoad = loadXMLDocNews(divz, url + Math.ceil ( Math.random() * 100000000 ), loading)
	}

/* -- mascara padrão -- */
jQuery(function($)
{   
	$("#cnpj, .cnpj").mask("99.999.999/9999-99");   
	
	$("#cpf, .cpf").mask("999.999.999-99");   
	
	$("#telefone, .telefone").mask("(99) 9999-9999");   
	$("#tel, .tel").mask("(99) 9999-9999");   
	$("#fone, .fone").mask("(99) 9999-9999");

	$("#celular, .celular").mask("(99) 9999-9999");
	$("#cel, .cel").mask("(99) 9999-9999");
	$("#fone1, .fone1").mask("(99) 9999-9999");
	
	$("#cep, .cep").mask("99999 - 999");




});
