<!-- Background
function bgOver(thing) {
	thing.style.background = '#99BBAA';
	//thing.style.color = '#333333';
}
function bgOut(thing) {
	thing.style.background = '#AACCBB';
	//thing.style.color = '#FFFFFF';
}
function bgOver2(thing) {
	thing.style.background = '#DDDDDD';
	//thing.style.color = '#333333';
}
function bgOut2(thing) {
	thing.style.background = '#EEEEEE';
	//thing.style.color = '#FFFFFF';
}
function bgOverTal(thing) {
	thing.style.background = '#446584';
	//thing.style.color = '#333333';
}
//  End -->

<!--- funcao para janela das buscas de cliente e cidade
function janela1(URLStr, width, height)
{
	jan_x = ((screen.width - width) / 2);
	jan_y = ((screen.height - height) / 2) - 30;
	jan = window.open(URLStr,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+jan_x+',top='+jan_y+',screenX='+jan_x+',screenY='+jan_y);
}
//  End -->
<!--- função para validação de cpf
function valida_cpf(pcpf)
{
	pcpf = pcpf.replace(".","");
	pcpf = pcpf.replace(".","");
	pcpf = pcpf.replace("-","");
	
	if (pcpf.length != 11)
		{sim=false}
	else {sim=true} 	//verifica se os numeros digitados são iguais
	if (sim)
	{
		i = 1;
		while(pcpf.charAt(i) == pcpf.charAt(i -1) && i < 10)
		{
			i++;
		}
		if(i == 10) sim=false
		else sim=true
	}
	if (sim)
	{
		for (i=0; i<=(pcpf.length-1) && sim; i++)
		{
			val = pcpf.charAt(i)
	
			if((val!="9")&&(val!="0")&&(val!="1")&&(val!="2")&&(val!="3")&&(val!="4")&&(val!="5")&&(val!="6")&&(val!="7")&&(val!="8")) {sim=false}
		}
		if (sim)
		{
			soma = 0
			for (i=0;i<=8;i++)
			{
				val = eval(pcpf.charAt(i))
				soma = soma + (val*(i+1))
			}
			resto = soma % 11
			if (resto>9) dig = resto -10
			else dig = resto
			if (dig != eval(pcpf.charAt(9))) { sim=false }
			else
			{
				soma = 0
				for (i=0;i<=7;i++)
				{
					val = eval(pcpf.charAt(i+1))
					soma = soma + (val*(i+1))
				}
				soma = soma + (dig * 9)
				resto = soma % 11
				if (resto>9) dig = resto -10
				else dig = resto
				if (dig != eval(pcpf.charAt(10))) { sim = false }
				else sim = true
			}
		}
	}
	if (sim) {
		return true
	}
	else {
		alert("O CPF é inválido.")
		return false
	}
}
//  End -->
