img1= new Image(1,23); 

img1.src="imagens/tblHtopoM.png"; 

img2= new Image(20,23); 

img2.src="imagens/tblHtopoD.png"; 

img3= new Image(29,23); 

img3.src="imagens/tblHlateralE.png"; 

img3= new Image(21,1); 

img3.src="imagens/tblHlateralD.png"; 

img4= new Image(27,21); 

img4.src="imagens/tblHrodapeE.png"; 

img5= new Image(1,21); 

img5.src="imagens/tblHrodapeM.png"; 

img6= new Image(30,21); 

img6.src="imagens/tblHrodapeD.png"; 

img7= new Image(60,61); 

img7.src="imagens/tblHicone.png"; 

img8= new Image(31,30); 

img8.src="imagens/btHelpPress.png"; 

img9= new Image(14,13); 

img9.src="imagens/bMenor.png"; 

img10= new Image(20,20); 

img10.src="imagens/bMedia.png"; 

img11= new Image(27,26); 

img11.src="imagens/bMaior.png"; 

img12= new Image(60,61); 

img12.src="imagens/tblHiconeErro.png"; 

img13= new Image(10,18); 

img13.src="imagens/txtFundo2.jpg"; 

img14= new Image(60,61); 

img14.src="imagens/tblHiconePass.png"; 



	var bola1timer = '';

	var bola2timer = '';

	var bola3timer = '';

	var tblhelptimer = '';

	var cntbola1 = 1;

	var cntbola2 = 1;

	var cntbola3 = 1;

	var cnttblhelp = 1;

	var fadeplay = 1;

	var ie = 0;

	var msF = '\x44\x58\x49\x6D\x61\x67\x65\x54\x72\x61\x6E\x73\x66\x6F\x72\x6D\x2E\x4D\x69\x63\x72\x6F\x73\x6F\x66\x74\x2E\x41\x6C\x70\x68\x61\x49\x6D\x61\x67\x65\x4C\x6F\x61\x64\x65\x72';



	if(/msie/i.test(navigator.userAgent)) ie = 1;

	

	function bola1(){

		cntbola1++;

	    $('divBola1').style.opacity = cntbola1 / parseInt(10);

		$('divBola1').style.filter = 'alpha(opacity=' + parseInt(cntbola1) / parseInt(10) * parseInt(100) + ')';

		

		if(cntbola1 === 5) bola2timer = setInterval('bola2()',30);

		if(cntbola1 === 10) clearInterval(bola1timer);

		if(fadeplay === 0) clearInterval(bola1timer);

	}

	

	function bola2(){

		cntbola2++;	

	    $('divBola2').style.opacity = cntbola2 / parseInt(10);

		$('divBola2').style.filter = 'alpha(opacity=' + parseInt(cntbola2) / parseInt(10) * parseInt(100) + ')';

		

		if(cntbola2 === 5) bola3timer = setInterval('bola3()',30);

		if(cntbola2 === 10) clearInterval(bola2timer);

		if(fadeplay === 0) clearInterval(bola2timer);

	}	

	

	

	function bola3(){

		cntbola3++;	

	    $('divBola3').style.opacity = cntbola3 / parseInt(10);

		$('divBola3').style.filter = 'alpha(opacity=' + parseInt(cntbola3) / parseInt(10) * parseInt(100) + ')';

		

		if(cntbola3 === 5) tblhelptimer = setInterval('tblhelp()',30);

		if(cntbola3 === 10) clearInterval(bola3timer);

		if(fadeplay === 0) clearInterval(bola3timer);

	}

	

	function tblhelp(){

		cnttblhelp++;	

	    $('tblLegenda').style.opacity = cnttblhelp / parseInt(10);

		$('tblLegenda').style.filter = 'alpha(opacity=' + parseInt(cnttblhelp)  / parseInt(10) * parseInt(100) + ')';	

		if(erro === 1){

			$('divLegendaIconeErro').style.opacity = cnttblhelp / parseInt(10);

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + parseInt(cnttblhelp)  / parseInt(10) * parseInt(100) + ')';				

		}else if(erro === 2){

			$('divLegendaIconePass').style.opacity = cnttblhelp / parseInt(10);

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + parseInt(cnttblhelp)  / parseInt(10) * parseInt(100) + ')';

		}else{

			$('divLegendaIcone').style.opacity = cnttblhelp / parseInt(10);

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + parseInt(cnttblhelp)  / parseInt(10) * parseInt(100) + ')';				

		}

	

		if(cnttblhelp === 10) clearInterval(tblhelptimer);

		if(fadeplay === 0) clearInterval(tblhelptimer);

	}

	



var erro = '0';

function help(titulo,indicador){



	cntbola1 = 1;

	cntbola2 = 1;

	cntbola3 = 1;

	cnttblhelp = 1;	

	clearInterval(bola1timer);

	clearInterval(bola2timer);

	clearInterval(bola3timer);

	clearInterval(tblhelptimer);

	

	$('divLegendaIcone').style.display = 'none';

	$('divLegendaIconeErro').style.display = 'none';

	$('divLegendaIconePass').style.display = 'none';

	$('ConteudoLegenda').style.width = '';



	$('divFundoLegenda').style.width = $('divFormulario').offsetWidth + 'px';

	$('divFundoLegenda').style.height = $('divFormulario').offsetHeight + 'px';	

	$('divFundoLegenda').style.top = $('divFormulario').offsetTop + 'px';

	$('divFundoLegenda').style.left = $('divFormulario').offsetLeft + 'px';	

	$('divFundoLegenda').style.opacity = '0';

	$('divFundoLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

	

	if(titulo === 'senha'){

		erro = 0;

		

		if(ie === 0)  {

			$('btHelpSenha').style.background = 'url(imagens/btHelpPress.png) no-repeat';

		}else{

			 $('btHelpSenha').style.background = 'none';

			 $('btHelpSenha').style.filter = 'progid:'+msF+'(src="imagens/btHelpPress.png", sizingMethod="scale");';				

		}	

		



		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A senha é composta de no mínimo 6 e<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; máximo de 10 caracteres.';

		$('tblbolas').style.marginLeft = 220 + 'px';

		$('ConteudoLegenda').style.width = 280 + 'px';

		$('ConteudoLegenda').style.height = 50 + 'px';		
		

		$('tblLegenda').style.top = parseInt($('btHelpSenha').offsetTop) - parseInt(155) + 'px';

		$('tblLegenda').style.left = parseInt($('btHelpSenha').offsetLeft) - parseInt(190) + 'px';		

		



		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIcone').style.display = 'block';		

		$('divFundoLegenda').style.display = 'block';



		$('divLegendaIcone').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIcone').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';

/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

		

	}else if(titulo === 'username'){

		erro = 0;

		

		if(ie === 0)  {

			$('btHelpUsername').style.background = 'url(imagens/btHelpPress.png) no-repeat';

		}else{

			 $('btHelpUsername').style.background = 'none';

			 $('btHelpUsername').style.filter = 'progid:'+msF+'(src="imagens/btHelpPress.png", sizingMethod="scale");';				

		}	

		



		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Crie um username (Nome de usuário)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;que você usará para se conectar em nosso sistema.';

		$('tblbolas').style.marginLeft = 220 + 'px';

		$('ConteudoLegenda').style.width = 280 + 'px';

		$('ConteudoLegenda').style.height = 60 + 'px';		
		

		$('tblLegenda').style.top = parseInt($('btHelpUsername').offsetTop) - parseInt(115) + 'px';

		$('tblLegenda').style.left = parseInt($('btHelpUsername').offsetLeft) - parseInt(190) + 'px';		

		



		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIcone').style.display = 'block';		

		$('divFundoLegenda').style.display = 'block';



		$('divLegendaIcone').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIcone').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';
		

	}else if(titulo === 'passemail'){



		erro = 2;

		

		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '18';

			ieleft = '0';

		}

				

		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O e-mail informado já está cadastrado. Se você<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; concluir o cadastro este usuário será anexado a ele.';

		

		$('tblbolas').style.marginLeft = 290 + 'px';

		$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(-100) + parseInt(ietop)) + 'px';

		$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(160) + parseInt(ieleft)) + 'px';			

		



		$('ConteudoLegenda').style.width = 350 + 'px';		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIconePass').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';

		

		$('divLegendaIconePass').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconePass').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';

		$('txtIndicador').className = 'txt';

		





		$('txtEmail').className='txt';

		$('txtEmailC').className='txt';		

		

/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'indicadorinfo'){

		erro = 0;

		

		if(ie === 0)  {

			$('btHelpIndicador').style.background = 'url(imagens/btHelpPress.png) no-repeat';

		}else{

			 $('btHelpIndicador').style.background = 'none';

			 $('btHelpIndicador').style.filter = 'progid:'+msF+'(src="imagens/btHelpPress.png", sizingMethod="scale");';				

		}	

		



		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Deixe esse campo em branco, caso você<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;não tenha recebido nenhum código de nosso representante.';

		$('tblbolas').style.marginLeft = 220 + 'px';

		$('ConteudoLegenda').style.width = 280 + 'px';

		$('ConteudoLegenda').style.height = 60 + 'px';		
		

		$('tblLegenda').style.top = parseInt($('btHelpIndicador').offsetTop) - parseInt(115) + 'px';

		$('tblLegenda').style.left = parseInt($('btHelpIndicador').offsetLeft) - parseInt(190) + 'px';		

		



		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIcone').style.display = 'block';		

		$('divFundoLegenda').style.display = 'block';



		$('divLegendaIcone').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIcone').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';
		

	}else if(titulo === 'passemail'){



		erro = 2;

		

		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '18';

			ieleft = '0';

		}

				

		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O e-mail informado já está cadastrado. Se você<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; concluir o cadastro este usuário será anexado a ele.';

		

		$('tblbolas').style.marginLeft = 290 + 'px';

		$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(-100) + parseInt(ietop)) + 'px';

		$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(160) + parseInt(ieleft)) + 'px';			

		



		$('ConteudoLegenda').style.width = 350 + 'px';		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIconePass').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';

		

		$('divLegendaIconePass').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconePass').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';

		$('txtIndicador').className = 'txt';

		





		$('txtEmail').className='txt';

		$('txtEmailC').className='txt';		

		

/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'erromail'){



		erro = 1;

		

		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '5';

			ieleft = '0';

		}		

		

		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O e-mail informado está incorreto. Você deve<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; corrigi-lo antes de continuar.';

		$('divTotalLegenda').style.display = 'block';	

		

		$('tblbolas').style.marginLeft = 290 + 'px';

		$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(-100) + parseInt(ietop)) + 'px';

		$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(160) + parseInt(ieleft)) + 'px';		

		

		$('divLegendaIconeErro').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';

		

		$('divLegendaIconeErro').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconeErro').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';	

		

		$('txtEmail').className = 'txtErro';

		$('txtEmailC').className = 'txtErro';











/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';					



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'errosenha'){



		erro = 1;

		

		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '18';

		}	

		

		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A senha informada está incorreta. Você deve<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; corrigi-la antes de continuar.';

		$('tblbolas').style.marginLeft = 290 + 'px';

		$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(140) + parseInt(ietop)) + 'px';

		$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(40) + parseInt(ieleft)) + 'px';		

		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIconeErro').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';

	

		$('divLegendaIconeErro').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconeErro').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';		

	

		$('txtSenha').className = 'txtErro';

		$('txtSenhaC').className = 'txtErro';

		



		





/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';					



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'errousername'){



		erro = 1;

		

		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '18';

			ieleft = '0';

		}	

		

		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O nome de usuário já existe. Por favor,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; escolha um outro username.';

		$('tblbolas').style.marginLeft = 220 + 'px';

		$('ConteudoLegenda').style.width = 300 + 'px';

		$('ConteudoLegenda').style.height = 40 + 'px';		

		//$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(67) + parseInt(ietop)) + 'px';

		//$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(170) + parseInt(ieleft)) + 'px';			

		$('tblLegenda').style.left = (parseInt($('divLegposusr').offsetLeft)-parseInt(220))+'px';
		
		$('tblLegenda').style.top = (parseInt($('divLegposusr').offsetTop)-parseInt(100))+'px';		
		
		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIconeErro').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';



		$('divLegendaIconeErro').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconeErro').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';



		$('txtUsername').className = 'txtErro';

		







/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';					



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'passindicador'){



		erro = 2;

		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '43';

			ieleft = '0';

		}		

		

		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Usuário encontrado. Você foi indicado por:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + indicador;

		$('tblbolas').style.marginLeft = 290 + 'px';

		$('ConteudoLegenda').style.width = 310 + 'px';

		$('ConteudoLegenda').style.height = 60 + 'px';

		$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(147) + parseInt(ietop)) + 'px';

		//$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(100) + parseInt(ieleft)) + 'px';				

		$('tblLegenda').style.left = (parseInt($('divLegposind').offsetLeft)-parseInt(280)-parseInt($('tblLegenda').offsetWidth))+'px';
		
		//$('tblLegenda').style.top = (parseInt($('divLegposind').offsetTop)-parseInt($('tblLegenda').offsetHeight))+'px';	


		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIconePass').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';

		

		$('divLegendaIconePass').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconePass').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';		

		

		$('txtIndicador').className = 'txt';

		



		

		

/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'erroindicador'){



		erro = 1;



		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '18';

			ieleft = '0';

		}

		



		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Usuário não encontrado.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>*Se você não foi indicado por nenhum representante, deixe esse campo em branco.<br>*Se você não se lembra o código correto, poderá inseri-lo depois, dentro do seu painel de usuário.';

				$('ConteudoLegenda').style.height = 120 + 'px';

		//$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(86) + parseInt(ietop)) + 'px';

		//$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(100) + parseInt(ieleft)) + 'px';

		$('tblLegenda').style.left = (parseInt($('divLegposind').offsetLeft)-parseInt(280))+'px';
		
		$('tblLegenda').style.top = (parseInt($('divLegposind').offsetTop)-parseInt(180))+'px';	
		

		$('tblbolas').style.marginLeft = 290 + 'px';		



		$('ConteudoLegenda').style.width = 330 + 'px';

		

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIconeErro').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';



		$('divLegendaIconeErro').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconeErro').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';



		$('txtIndicador').className = 'txtErro';		

		





		

/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'passusername'){



		erro = 2;

		

		ietop = '0';

		ieleft = '0';		

		if(ie === 1)  {

			ietop = '18';

			ieleft = '0';

		}		

		

		$('ConteudoLegenda').innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O nome de usuário informado está disponível. Com ele você<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acessará o painel de controle de sua conta voip.';

		//$('tblLegenda').style.top = parseInt($('tblformulario').offsetTop) + (parseInt(69) + parseInt(ietop)) + 'px';

		//$('tblLegenda').style.left = parseInt($('tblformulario').offsetLeft) + (parseInt(100) + parseInt(ieleft)) + 'px';	
		
		$('ConteudoLegenda').style.width = 400 + 'px';

		$('ConteudoLegenda').style.height = 40 + 'px';		

		

		$('tblLegenda').style.left = (parseInt($('divLegposusr').offsetLeft)-parseInt(280))+'px';
		
		$('tblLegenda').style.top = (parseInt($('divLegposusr').offsetTop)-parseInt(100))+'px';				

		$('divTotalLegenda').style.display = 'block';			

		$('divLegendaIconePass').style.display = 'block';

		$('divFundoLegenda').style.display = 'block';

		

		$('divLegendaIconePass').style.top = parseInt($('tblLegenda').offsetTop) + 'px';

		$('divLegendaIconePass').style.left = parseInt($('tblLegenda').offsetLeft) + 'px';

		

		$('tblbolas').style.marginLeft = 290 + 'px';

		$('txtUsername').className = 'txt';

		



		





/*		if(ie === 0)  {

			fadeplay = 1;

			$('divLegendaIcone').style.opacity = '0';

			$('divLegendaIcone').style.filter = 'alpha(opacity=' + 0 + ')';		

			

			$('divLegendaIconeErro').style.opacity = '0';

			$('divLegendaIconeErro').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('divLegendaIconePass').style.opacity = '0';

			$('divLegendaIconePass').style.filter = 'alpha(opacity=' + 0 + ')';		



			$('tblLegenda').style.opacity = '0';

			$('tblLegenda').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola1').style.opacity = '0';

			$('divBola1').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola2').style.opacity = '0';

			$('divBola2').style.filter = 'alpha(opacity=' + 0 + ')';	

			

			$('divBola3').style.opacity = '0';

			$('divBola3').style.filter = 'alpha(opacity=' + 0 + ')';			

			bola1timer = setInterval('bola1()',30);

		}*/

	

	}else if(titulo === 'out'){

		$('divTotalLegenda').style.display = 'none';

		$('divFundoLegenda').style.display = 'none';

		fadeplay = 0;

		if(ie === 0){

			$('btHelpSenha').style.background = 'url(imagens/btHelp.png) no-repeat';
			
			$('btHelpUsername').style.background = 'url(imagens/btHelp.png) no-repeat';
			
			$('btHelpIndicador').style.background = 'url(imagens/btHelp.png) no-repeat';
			
		}else{

			

         	$('btHelpSenha').style.background = 'none';

         	$('btHelpSenha').style.filter = 'progid:'+msF+'(src="imagens/btHelp.png", sizingMethod="scale");';	
			
         	$('btHelpUsername').style.background = 'none';

         	$('btHelpUsername').style.filter = 'progid:'+msF+'(src="imagens/btHelp.png", sizingMethod="scale");';
			
         	$('btHelpIndicador').style.background = 'none';

         	$('btHelpIndicador').style.filter = 'progid:'+msF+'(src="imagens/btHelp.png", sizingMethod="scale");';			
			

		}

	}







}

function FormataCpf(campo, teclapres){
	var tecla = teclapres.keyCode;
	var vr = new String(campo.value);
	vr = vr.replace(".", "");
	vr = vr.replace("/", "");
	vr = vr.replace("-", "");
	tam = vr.length + 1;
	if (tecla != 14){
		if (tam == 4)
			campo.value = vr.substr(0, 3) + '.';
		if (tam == 7)
			campo.value = vr.substr(0, 3) + '.' + vr.substr(3, 6) + '.';
		if (tam == 11)
			campo.value = vr.substr(0, 3) + '.' + vr.substr(3, 3) + '.' + vr.substr(7, 3) + '-' + vr.substr(11, 2);
		}
}

function mascara_cnpj(){
		nCaract = document.getElementById("txtCNPJ");
		
		switch(nCaract.value.length)
		{
			case 2: nCaract.value += ".";
			break;
			
			case 6: nCaract.value += ".";
			break;
			
			case 10: nCaract.value += "/";
			break;
			
			case 15: nCaract.value += "-";
			break;
		}
	}

window.onload = function(){



	pessoatipo();

	ietop = '0';

	ieleft = '0';

		

     if(ie === 1)  {

         $('divLegendaIcone').style.background = 'none';

         $('divLegendaIcone').style.filter = 'progid:'+msF+'(src="imagens/tblHicone.png", sizingMethod="scale");';

		 

         $('divLegendaIconeErro').style.background = 'none';

         $('divLegendaIconeErro').style.filter = 'progid:'+msF+'(src="imagens/tblHiconeErro.png", sizingMethod="scale");';	

		 
         $('divLegendaIconePass').style.background = 'none';

         $('divLegendaIconePass').style.filter = 'progid:'+msF+'(src="imagens/tblHiconePass.png", sizingMethod="scale");';	
		 

         $('divBola1').style.background = 'none';

         $('divBola1').style.filter = 'progid:'+msF+'(src="imagens/bMenor.png");';	

         $('divBola2').style.background = 'none';

         $('divBola2').style.filter = 'progid:'+msF+'(src="imagens/bMedia.png");';	

         $('divBola3').style.background = 'none';

         $('divBola3').style.filter = 'progid:'+msF+'(src="imagens/bMaior.png");';	

         $('btHelpSenha').style.background = 'none';

         $('btHelpSenha').style.filter = 'progid:'+msF+'(src="imagens/btHelp.png", sizingMethod="scale");';	
		 
         $('btHelpUsername').style.background = 'none';

         $('btHelpUsername').style.filter = 'progid:'+msF+'(src="imagens/btHelp.png", sizingMethod="scale");';	
		 
         $('btHelpIndicador').style.background = 'none';

         $('btHelpIndicador').style.filter = 'progid:'+msF+'(src="imagens/btHelp.png", sizingMethod="scale");';			 

         $('borda1').style.background = 'none';

         $('borda1').style.filter = 'progid:'+msF+'(src="imagens/tblHtopoM.png", sizingMethod="scale");';	

         $('borda2').style.background = 'none';

         $('borda2').style.filter = 'progid:'+msF+'(src="imagens/tblHtopoD.png", sizingMethod="scale");';

         $('borda3').style.background = 'none';

         $('borda3').style.filter = 'progid:'+msF+'(src="imagens/tblHlateralE.png", sizingMethod="scale");';

         $('borda4').style.background = 'none';

         $('borda4').style.filter = 'progid:'+msF+'(src="imagens/tblHlateralD.png", sizingMethod="scale");';

         $('borda5').style.background = 'none';

         $('borda5').style.filter = 'progid:'+msF+'(src="imagens/tblHrodapeE.png", sizingMethod="scale");';

         $('borda6').style.background = 'none';

         $('borda6').style.filter = 'progid:'+msF+'(src="imagens/tblHrodapeM.png", sizingMethod="scale");';

         $('borda7').style.background = 'none';

         $('borda7').style.filter = 'progid:'+msF+'(src="imagens/tblHrodapeD.png", sizingMethod="scale");';		

		 ietop = '18';

		// ieleft = '10';

      }
		
		if(infoind == 0){
			$('btHelpIndicador').style.display = 'block';
		}
		setleft = setInterval(setlefthelp,1);
		imgatualizar();

	  

}	

function setlefthelp(){
		
		$('btHelpSenha').style.left = (parseInt($('divLegpossenha').offsetLeft)-parseInt($('btHelpSenha').offsetWidth)-parseInt(ieleft))+'px';
		
		$('btHelpSenha').style.top = (parseInt($('divLegpossenha').offsetTop))+'px';
		
		$('btHelpSenha').style.display = 'block';
		
		$('btHelpUsername').style.left = (parseInt($('divLegposusername').offsetLeft)-parseInt($('btHelpUsername').offsetWidth)-parseInt(ieleft))+'px';
		
		$('btHelpUsername').style.top = (parseInt($('divLegposusername').offsetTop)-parseInt(3))+'px';
		
		$('btHelpUsername').style.display = 'block';		
		
		$('btHelpIndicador').style.left = (parseInt($('divLegposind').offsetLeft)-parseInt($('btHelpIndicador').offsetWidth)-parseInt(ieleft)+parseInt(13))+'px';
		
		$('btHelpIndicador').style.top = (parseInt($('divLegposind').offsetTop)-parseInt(3))+'px';		
		
		$('btHelpUsername').style.left = (parseInt($('divLegposusername').offsetLeft)-parseInt($('btHelpUsername').offsetWidth)-parseInt(ieleft)+parseInt(33))+'px';
		
		$('btHelpIndicador').style.left = (parseInt($('divLegposind').offsetLeft)-parseInt($('btHelpIndicador').offsetWidth)-parseInt(ieleft)+parseInt(43))+'px';
		
		$('btHelpSenha').style.left = (parseInt($('divLegpossenha').offsetLeft)-parseInt($('btHelpSenha').offsetWidth)-parseInt(ieleft)+parseInt(23))+'px';
	
}

var textoemail = '';

var textosenha = '';

var textocelular = '';

var textotelefone = '';

var textocpf = '';

var textocnpj = '';



function bloq(txtnome){



	if(txtnome == 'email'){

		totalchrvar = textoemail.length;

		totalchrtxt = $("txtEmail").value.length;

		

		teste1 = totalchrvar;

		teste1+=2;

		if(totalchrtxt <= teste1){

			textoemail = $("txtEmail").value;

			$("txtEmail").value = textoemail;

		}else if(totalchrtxt < totalchrvar){

			textoemail = $("txtEmail").value;

			$("txtEmail").value = textoemail;

		}else{

			$("txtEmail").value = textoemail;

		}

	}else if(txtnome == 'senha'){

		totalchrvar = textosenha.length;

		totalchrtxt = $("txtSenha").value.length;

		

		teste1 = totalchrvar;

		teste1+=2;

		if(totalchrtxt <= teste1){

			textosenha = $("txtSenha").value;

			$("txtSenha").value = textosenha;

		}else if(totalchrtxt < totalchrvar){

			textosenha = $("txtSenha").value;

			$("txtSenha").value = textosenha;

		}else{

			$("txtSenha").value = textosenha;

		}

	}else if(txtnome == 'telefone'){

		totalchrvar = textotelefone.length;

		totalchrtxt = $("txtTelefone").value.length;

		

		teste1 = totalchrvar;

		teste1+=2;

		if(totalchrtxt <= teste1){

			textotelefone = $("txtTelefone").value;

			$("txtTelefone").value = textotelefone;

		}else if(totalchrtxt < totalchrvar){

			textotelefone = $("txtTelefone").value;

			$("txtTelefone").value = textotelefone;

		}else{

			$("txtTelefone").value = textotelefone;

		}

	}else if(txtnome == 'celular'){

		totalchrvar = textocelular.length;

		totalchrtxt = $("txtCelular").value.length;

		

		teste1 = totalchrvar;

		teste1+=2;

		if(totalchrtxt <= teste1){

			textocelular = $("txtCelular").value;

			$("txtCelular").value = textocelular;

		}else if(totalchrtxt < totalchrvar){

			textocelular = $("txtCelular").value;

			$("txtCelular").value = textocelular;

		}else{

			$("txtCelular").value = textocelular;

		}

	}else if(txtnome == 'cpf'){

		totalchrvar = textocpf.length;

		totalchrtxt = $("txtCPF").value.length;

		

		teste1 = totalchrvar;

		teste1+=2;

		if(totalchrtxt <= teste1){

			textocpf = $("txtCPF").value;

			$("txtCPF").value = textocpf;

		}else if(totalchrtxt < totalchrvar){

			textocpf = $("txtCPF").value;

			$("txtCPF").value = textocpf;

		}else{

			$("txtCPF").value = textocpf;

		}

	}else if(txtnome == 'cnpj'){

		totalchrvar = textocnpj.length;

		totalchrtxt = $("txtCNPJ").value.length;

		

		teste1 = totalchrvar;

		teste1+=2;

		if(totalchrtxt <= teste1){

			textocnpj = $("txtCNPJ").value;

			$("txtCNPJ").value = textocnpj;

		}else if(totalchrtxt < totalchrvar){

			textocnpj = $("txtCNPJ").value;

			$("txtCNPJ").value = textocnpj;

		}else{

			$("txtCNPJ").value = textocnpj;

		}

	}

	

	

}





function SomenteNumero(e){



    var tecla=(window.event)?event.keyCode:e.which;

	if(tecla == 8 || tecla == 0) return true;

    if((tecla > 47 && tecla < 58)) return true;



    else{




    if (tecla != 8) return false;



    else return true;



    }



}





function usrchars(e){

    var tecla=(window.event)?event.keyCode:e.which;
	
	if(tecla == 8 || tecla == 0) return true;
	
	var texto = $('txtUsername').value;
	var pdcode = texto.charCodeAt(0);

	if(texto.length == 0){
		if((tecla > 47 && tecla < 58)){
			
			alert("O primeiro dígito do username não pode ser número");	
			return false;
		}
	}else{
		if((pdcode > 47 && pdcode < 58)){
				
				alert("O primeiro dígito do username não pode ser número");	
				return false;
		}		
	}
	
	if(tecla == 46 || tecla == 44 || tecla == 32 || tecla == 33 || tecla == 34 || tecla == 35 || tecla == 36 || tecla == 37 || tecla == 38 || tecla == 39 || tecla == 40 || tecla == 41 || tecla == 42 || tecla == 43 || tecla == 47 || tecla == 58 || tecla == 59 || tecla == 60 || tecla == 61 || tecla == 62 || tecla == 63 || tecla == 64 || tecla == 91 || tecla == 92 || tecla == 93 || tecla == 94 || tecla == 96 || tecla == 123 || tecla == 124 || tecla == 125 || tecla == 126 || tecla == 168 || tecla == 185 || tecla == 178 || tecla == 179 || tecla == 163 || tecla == 162 || tecla == 172 || tecla == 167 || tecla == 186 || tecla == 170 || tecla == 176 || tecla == 8354 || tecla == 45 || tecla == 95){

		return false;

	}else{

		return true;

	}



}


function snchars(e,obj){

	if(e != 'blur'){
		var tecla=(window.event)?event.keyCode:e.which;
	
		if(tecla == 8 || tecla == 0) return true;
	}
			var senha = obj.value;
			var usrname = $('txtUsername').value;
			if(senha.indexOf(usrname) >= 0){
	
				alert('A senha não pode conter o nome de usuário');
	
				return false;					
			}else{
				
				var s = new Array();
			
				 s[1] = '000';	
				 s[2] = '111';
				 s[3] = '222';
				 s[4] = '333';	
				 s[5] = '444';	
				 s[6] = '555';	
				 s[7] = '666';	
				 s[8] = '777';	
				 s[9] = '888';
				 s[10] = '012';
				 s[11] = '123';
				 s[12] = '234';
				 s[13] = '345';
				 s[14] = '456';
				 s[15] = '567';
				 s[16] = '678';
				 s[17] = '789';
				 s[18] = '987';
				 s[19] = '876';
				 s[20] = '765';
				 s[21] = '654';
				 s[22] = '543';
				 s[23] = '432';
				 s[24] = '321';
				 s[25] = '210';	
				 s[26] = '999';	 
													
				var cnt = 1;
				var seq = 0;
				
				while(cnt <= 26){
					var pro = s[cnt];
					if(senha.indexOf(pro) >= 0){
						seq = 1;
						break;
					}
					
					cnt++;
				}				
				
				if(seq == 1){

					alert('A senha não pode conter números sequenciais.');
		
					return false;					
				}else{
				
				}	
			}
	if(e != 'blur'){
		if(tecla == 46 || tecla == 44 || tecla == 32 || tecla == 33 || tecla == 34 || tecla == 35 || tecla == 36 || tecla == 37 || tecla == 38 || tecla == 39 || tecla == 40 || tecla == 41 || tecla == 42 || tecla == 43 || tecla == 47 || tecla == 58 || tecla == 59 || tecla == 60 || tecla == 61 || tecla == 62 || tecla == 63 || tecla == 64 || tecla == 91 || tecla == 92 || tecla == 93 || tecla == 94 || tecla == 96 || tecla == 123 || tecla == 124 || tecla == 125 || tecla == 126 || tecla == 168 || tecla == 185 || tecla == 178 || tecla == 179 || tecla == 163 || tecla == 162 || tecla == 172 || tecla == 167 || tecla == 186 || tecla == 170 || tecla == 176 || tecla == 8354 || tecla == 45 || tecla == 95){
	
			return false;
	
		}else{
	
			return true;
	
		}
	}


}


function pessoatipo(){

	if($('sltfisica').checked == true){

		$('divFisica').style.display = 'block';
		$('divFisica2').style.display = 'block';
		$('divJuridica').style.display = 'none';
		$('divJuridica2').style.display = 'none';

	}else{

		$('divFisica').style.display = 'none';
		$('divFisica2').style.display = 'none';
		$('divJuridica').style.display = 'block';
		$('divJuridica2').style.display = 'block';

	}

	ietop = 0;

	ieleft = 0;

	if(ie === 1)  {
		
		ietop = '18';

	}

		//$('btHelpSenha').style.left = (parseInt($('divLegpossenha').offsetLeft)-parseInt($('btHelpSenha').offsetWidth)-parseInt(ieleft))+'px';
		
		$('btHelpSenha').style.top = (parseInt($('divLegpossenha').offsetTop))+'px';
		
		$('btHelpUsername').style.top = (parseInt($('divLegposusername').offsetTop)-parseInt(3))+'px';		
		
		$('btHelpIndicador').style.left = (parseInt($('divLegposind').offsetLeft)-parseInt($('btHelpIndicador').offsetWidth)-parseInt(ieleft)+parseInt(13))+'px';
		
		//$('btHelpSenha').style.display = 'block';		

}



function vsenha(){

	if($('txtSenha').value.length >= 6){

		if($('txtSenha').value != $('txtSenhaC').value){

			help('errosenha');

		}else{

			$('txtSenha').className = 'txt';

			$('txtSenhaC').className = 'txt';

		}

	}else{

		help('errosenha');

	}

}



function vusr(par){
	if(par == 1){
		$('frmpost').src = 'cadastro.php?usrvrf='+$('txtUsername').value;
	}else{
		$('frmpost').src = 'cadastro.php?pass=1&usrvrf='+$('txtUsername').value;
	}

}




function vind(par){

	$('frmpost').src = 'cadastro.php?indvrf='+$('txtIndicador').value;

}



function vmail(par){

		if($('txtEmail').value.length < '5'){

			help('erromail');

		}else{



				var reEmail = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;				var reEmail3 = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;

				if($('txtEmail').value != $('txtEmailC').value){

					help('erromail');

				}else{



					eval("reEmail = reEmail" + 3);

					if (reEmail.test($('txtEmail').value)) {

						$('frmpost').src = 'cadastro.php?mailvrf='+$('txtEmail').value;

					} else if ($('txtEmail').value != null && $('txtEmail').value != "") {

						help('erromail');

					}

		

				}

		}	

	

}



var tf = 0;

function imgatualizar(){

		tf++;

		$('divImgseg').innerHTML = '';

		$('divImgseg').innerHTML = '<img src="img.php?i='+tf+'" />';		

}



function validar(){

	

	erro = 0;

	msgerro = 'Para concluir seu cadastro você deve corrigir os seguintes erros:\n\n';


	if($('sltfisica').checked == true){

		if($('txtNome').value.length < 5){

			$('txtNome').className = 'txtErro';

			msgerro += '* Nome completo - mínimo de 5 dígitos\n';

			erro = 1;

		}else{

			$('txtNome').className = 'txt';	

		}

		if($('txtRG').value.length < 9){

			$('txtRG').className = 'txtErro';

			msgerro += '* RG - minimo de 9 digitos\n';

			erro = 1;

		}else{

			$('txtRG').className = 'txt';	

		}	

		if($('txtCPF').value.length < 11){

			$('txtCPF').className = 'txtErro';

			msgerro += '* CPF - minimo de 11 digitos\n';

			erro = 1;

		}else{

/*			if(isCpf($('txtCPF').value) == false){
				$('txtCPF').className = 'txtErro';
	
				msgerro += '* CPF - o número de cpf é inválido\n';
	
				erro = 1;			
			}else{
				$('txtCPF').className = 'txt';	
			}*/
			
			$('txtCPF').className = 'txt';
		}			

	}else{

		if($('txtNR').value.length < 5){

			$('txtNR').className = 'txtErro';

			msgerro += '* Nome do Responsável - mínimo de 5 dígitos\n';

			erro = 1;

		}else{

			$('txtNR').className = 'txt';	

		}

		if($('txtRS').value.length < 5){

			$('txtRS').className = 'txtErro';

			msgerro += '* Razão Social - mínimo de 5 dígitos\n';

			erro = 1;

		}else{

			$('txtRS').className = 'txt';	

		}

		

		if($('txtIE').value.length < 3){

			$('txtIE').className = 'txtErro';

			msgerro += '* Inscrição Estadual - minimo de 3 digitos\n';

			erro = 1;

		}else{

			$('txtIE').className = 'txt';	

		}		

		if($('txtCNPJ').value.length < 4){

			$('txtCNPJ').className = 'txtErro';

			msgerro += '* CNPJ - minimo de 14 digitos\n';

			erro = 1;

		}else{
/*			if(isCnpj($('txtCNPJ').value) == false){
				$('txtCNPJ').className = 'txtErro';
	
				msgerro += '* CNPJ - o número de cnpj é inválido\n';
	
				erro = 1;			
			}else{
				$('txtCNPJ').className = 'txt';	
			}*/
			$('txtCNPJ').className = 'txt';	

		}	

	}

	if($('txtDTnascimento').value.length < 10){

		$('txtDTnascimento').className = 'txtErro';

		msgerro += '* Data de Nascimento - 10 dígitos ( dd/mm/aaa )\n';

		erro = 1;

	}else{

		$('txtDTnascimento').className = 'txt';

	}	

	if($('txtEmail').value.length < 5){

		$('txtEmail').className = 'txtErro';

		$('txtEmailC').className = 'txtErro';

		msgerro += '* E-mail - mínimo de 5 dígitos\n';

		erro = 1;

	}else{



		var reEmail = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;				

		var reEmail3 = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;

		if($('txtEmail').value != $('txtEmailC').value){

			$('txtEmail').className = 'txtErro';

			$('txtEmailC').className = 'txtErro';

			msgerro += '* Confirmação de E-mail incorreta. (Você deve inserir emails idênticos no campo "email" e "Confirme seu email")\n';

			erro = 1;

		}else{



			eval("reEmail = reEmail" + 3);

			if (reEmail.test($('txtEmail').value)) {

				$('txtEmail').className = 'txt';

				$('txtEmailC').className = 'txt';

			} else if ($('txtEmail').value != null && $('txtEmail').value != "") {

				$('txtEmail').className = 'txtErro';

				$('txtEmailC').className = 'txtErro';

				msgerro += '* Formato de E-mail inválido\n';

				erro = 1;

			}

		

		}

	}

	if($('txtDDD').value.length < 2){

		$('txtDDD').className = 'txtErro';

		msgerro += '* DDD - mínimo de 2 dígitos\n';

		erro = 1;

	}else{

		$('txtDDD').className = 'txt';

	}
	

	if($('txtTelefone').value.length < 8){

		$('txtTelefone').className = 'txtErro';

		msgerro += '* Telefone - mínimo de 8 dígitos\n';

		erro = 1;

	}else{

		$('txtTelefone').className = 'txt';

	}

	if($('txtDDDcel').value.length < 2 && $('txtDDDcel').value.length > 0){

		$('txtDDDcel').className = 'txtErro';

		msgerro += '* DDD Celular - mínimo de 2 dígitos\n';

		erro = 1;

	}else{

		$('txtDDDcel').className = 'txt';

	}

	if($('txtCelular').value.length < 8 && $('txtDDDcel').value.length > 0){

		$('txtCelular').className = 'txtErro';

		msgerro += '* Celular - mínimo de 8 dígitos\n';

		erro = 1;

	}else{

		$('txtCelular').className = 'txt';

	}

	if($('txtNumero').value.length < 1){

		$('txtNumero').className = 'txtErro';

		msgerro += '* Numero - minimo de 1 digito\n';

		erro = 1;

	}else{

		$('txtNumero').className = 'txt';

	}

	if($('txtCEP').value.length < 8){
		
		$('txtCEP').className = 'txtErro';

		msgerro += '* CEP - minimo de 8 digitos\n';

		erro = 1;

	}else{

		var numtst = document.getElementsByName('optEnd');
		var endsel = 'nulo';
		for(var i=0; i < numtst.length; i++) {
			if(numtst[i].checked === true){
				endsel = numtst[i].value;
			}
		}		
	
		if(endsel == 0){
	
			if($('txtCidade').value.length < 3){
		
				$('txtCidade').className = 'txtErro';
		
				msgerro += '* Cidade - minimo de 3 digitos\n';
		
				erro = 1;
		
			}else{
		
				$('txtCidade').className = 'txt';
		
			}
		
			
		
			if($('txtEstado').value.length < 2){
		
				$('txtEstado').className = 'txtErro';
		
				msgerro += '* Estado - minimo de 2 digitos\n';
		
				erro = 1;
		
			}else{
		
				$('txtEstado').className = 'txt';
		
			}	
		
		
			if($('txtBairro').value.length < 3){
		
				$('txtBairro').className = 'txtErro';
		
				msgerro += '* Bairro - minimo de 3 digitos\n';
		
				erro = 1;
		
			}else{
		
				$('txtBairro').className = 'txt';
		
			}
		
			if($('txtEstado').value.length < 2){
		
				$('txtEstado').className = 'txtErro';
		
				msgerro += '* Estado - Estado não informado\n';
		
				erro = 1;
		
			}else{
		
				$('txtEstado').className = 'txt';
		
			}
		
			if($('txtEndereco').value.length < 5){
		
				$('txtEndereco').className = 'txtErro';
		
				msgerro += '* Endereço - minimo de 5 digitos\n';
		
				erro = 1;
		
			}else{
		
				$('txtEndereco').className = 'txt';
		
			}
	
		}else if(endsel == 'nulo'){
			msgerro += '* Não foi informado ou selecionado os dados de endereço.\n';
		}

		$('txtCEP').className = 'txt';

	}

	$('txtUsername').value = $('txtUsername').value.toLowerCase();

	if($('txtUsername').value.length < 3){

		$('txtUsername').className = 'txtErro';

		msgerro += '* Nome de Usuário - mínimo de 3 dígitos\n';

		erro = 1;

	}else{		

		/*if(!isNaN($('txtUsername').value.charAt(0))){
			$('txtUsername').className = 'txtErro';
	
			msgerro += '* Nome de Usuário - Primeiro digito deve ser letra\n';
	
			erro = 1;
		}else{
			
			
			var textousr = $('txtUsername').value;
		
			for (var i=0;i<textousr.length;i++){
		
				var tecla = textousr.charCodeAt(i);
		
				if(tecla == 46 || tecla == 44 || tecla == 32 || tecla == 33 || tecla == 34 || tecla == 35 || tecla == 36 || tecla == 37 || tecla == 38 || tecla == 39 || tecla == 40 || tecla == 41 || tecla == 42 || tecla == 43 || tecla == 47 || tecla == 58 || tecla == 59 || tecla == 60 || tecla == 61 || tecla == 62 || tecla == 63 || tecla == 64 || tecla == 91 || tecla == 92 || tecla == 93 || tecla == 94 || tecla == 96 || tecla == 123 || tecla == 124 || tecla == 125 || tecla == 126 || tecla == 168 || tecla == 185 || tecla == 178 || tecla == 179 || tecla == 163 || tecla == 162 || tecla == 172 || tecla == 167 || tecla == 186 || tecla == 170 || tecla == 176 || tecla == 8354 || tecla == 180 || tecla >= 192 && tecla <= 255 || tecla == 81 || tecla == 87 || tecla == 81 || tecla == 69 || tecla == 82 || tecla == 84 || tecla == 89 || tecla == 85 || tecla == 73 || tecla == 79 || tecla == 80 || tecla == 65 || tecla == 83 || tecla == 68 || tecla == 70 || tecla == 71 || tecla == 72 || tecla == 74 || tecla == 75 || tecla == 76 || tecla == 199 || tecla == 90 || tecla == 88 || tecla == 67 || tecla == 86 || tecla == 66 || tecla == 78 || tecla == 77 || tecla == 45 || tecla == 95){
		
					$('txtUsername').className = 'txtErro';
		
					msgerro += '* Nome de Usuário - Contém caractere inválido\n';
		
					erro = 1;
		
					break;
		
				}else{*/
					$('txtUsername').className = 'txt';
				//}
		
			//}			
			
			
			
		//}

	}
		

	if($('txtSenha').value.length >= 6){

		if($('txtSenha').value != $('txtSenhaC').value){

			$('txtSenha').className = 'txtErro';

			$('txtSenhaC').className = 'txtErro';

			msgerro += '* Confirmação de senha inválida.\n';

			erro = 1;			

		}else{
			/*var senha = $('txtSenha').value;
			var usrname = $('txtUsername').value;
			if(senha.indexOf(usrname) >= 0){
				$('txtSenha').className = 'txtErro';
	
				$('txtSenhaC').className = 'txtErro';
	
				msgerro += '* A senha não pode conter o nome de usuário.\n';
	
				erro = 1;					
			}else{
				
				var s = new Array();
			
				 s[1] = '000';	
				 s[2] = '111';
				 s[3] = '222';
				 s[4] = '333';	
				 s[5] = '444';	
				 s[6] = '555';	
				 s[7] = '666';	
				 s[8] = '777';	
				 s[9] = '888';
				 s[10] = '012';
				 s[11] = '123';
				 s[12] = '234';
				 s[13] = '345';
				 s[14] = '456';
				 s[15] = '567';
				 s[16] = '678';
				 s[17] = '789';
				 s[18] = '987';
				 s[19] = '876';
				 s[20] = '765';
				 s[21] = '654';
				 s[22] = '543';
				 s[23] = '432';
				 s[24] = '321';
				 s[25] = '210';	
				 s[26] = '999';	 
													
				var cnt = 1;
				var seq = 0;
				
				while(cnt <= 26){
					var pro = s[cnt];
					if(senha.indexOf(pro) >= 0){
						seq = 1;
						break;
					}
					
					cnt++;
				}				
				
				if(seq == 1){
					$('txtSenha').className = 'txtErro';
		
					$('txtSenhaC').className = 'txtErro';
		
					msgerro += '* A senha não pode conter números sequenciais.\n';
		
					erro = 1;					
				}else{*/
					$('txtSenha').className = 'txt';
		
					$('txtSenhaC').className = 'txt';					
				//}
				
			//}


		}

	}else{

		$('txtSenha').className = 'txtErro';

		$('txtSenhaC').className = 'txtErro';

		msgerro += '* Senha - mínimo de 6 dígitos\n';

		erro = 1;		

	}	

	

	if($('txtCodigo').value.length < 5){

		$('txtCodigo').className = 'txtErro';

		msgerro += '* Código da imagem de segurança - 5 dígitos\n';

		erro = 1;

	}else{

		$('txtCodigo').className = 'txt';

	}

	

	if(erro == 1){

		alert(msgerro);

		return false;

	}else{

		if($('chkContrato').checked != true){
			alert('Para continuar, leia o contrato e depois marque a caixa reconhecendo ter lido e que concorda com as condições de uso do sistema VoIP.');	
		}else{
			return true;
		}
			

	}

	

}




//-----------------





NUM_DIGITOS_CPF  = 11;
NUM_DIGITOS_CNPJ = 14;
NUM_DGT_CNPJ_BASE = 8;


String.prototype.lpad = function(pSize, pCharPad){
	var str = this;
	var dif = pSize - str.length;
	var ch = String(pCharPad).charAt(0);
	for (; dif>0; dif--) str = ch + str;
	return (str);
} 

String.prototype.trim = function(){
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
} 

function unformatNumber(pNum){
	return String(pNum).replace(/\D/g, "").replace(/^0+/, "");
} 

function formatCpfCnpj(pCpfCnpj, pUseSepar, pIsCnpj){
	
	if (pIsCnpj==null) pIsCnpj = false;
	if (pUseSepar==null) pUseSepar = true;
	var maxDigitos = pIsCnpj? NUM_DIGITOS_CNPJ: NUM_DIGITOS_CPF;
	var numero = unformatNumber(pCpfCnpj);

	numero = numero.lpad(maxDigitos, '0');

	if (!pUseSepar) return numero;

	if (pIsCnpj)
	{
		reCnpj = /(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/;
		numero = numero.replace(reCnpj, "$1.$2.$3/$4-$5");
	}
	else
	{
		reCpf  = /(\d{3})(\d{3})(\d{3})(\d{2})$/;
		numero = numero.replace(reCpf, "$1.$2.$3-$4");
	}
	return numero;
} 

function dvCpfCnpj(pEfetivo, pIsCnpj){
	
	if (pIsCnpj==null) pIsCnpj = false;
	var i, j, k, soma, dv;
	var cicloPeso = pIsCnpj? NUM_DGT_CNPJ_BASE: NUM_DIGITOS_CPF;
	var maxDigitos = pIsCnpj? NUM_DIGITOS_CNPJ: NUM_DIGITOS_CPF;
	var calculado = formatCpfCnpj(pEfetivo + "00", false, pIsCnpj);
	calculado = calculado.substring(0, maxDigitos-2);
	var result = "";

	for (j = 1; j <= 2; j++)
	{
		k = 2;
		soma = 0;
		for (i = calculado.length-1; i >= 0; i--)
		{
			soma += (calculado.charAt(i) - '0') * k;
			k = (k-1) % cicloPeso + 2;
		}
		dv = 11 - soma % 11;
		if (dv > 9) dv = 0;
		calculado += dv;
		result += dv
	}

	return result;
} 


function isCpf(pCpf){
	var numero = formatCpfCnpj(pCpf, false, false);
	if (numero.length > NUM_DIGITOS_CPF) return false;

	var base = numero.substring(0, numero.length - 2);
	var digitos = dvCpfCnpj(base, false);
	var algUnico, i;

	if (numero != "" + base + digitos) return false;

	algUnico = true;
	for (i=1; algUnico && i<NUM_DIGITOS_CPF; i++)
	{
		algUnico = (numero.charAt(i-1) == numero.charAt(i));
	}
	return (!algUnico);
} 

function isCnpj(pCnpj){
	
	var numero = formatCpfCnpj(pCnpj, false, true);
	if (numero.length > NUM_DIGITOS_CNPJ) return false;

	var base = numero.substring(0, NUM_DGT_CNPJ_BASE);
	var ordem = numero.substring(NUM_DGT_CNPJ_BASE, 12);
	var digitos = dvCpfCnpj(base + ordem, true);
	var algUnico;

	if (numero != "" + base + ordem + digitos) return false;

	algUnico = numero.charAt(0) != '0';
	for (i=1; algUnico && i<NUM_DGT_CNPJ_BASE; i++)
	{
		algUnico = (numero.charAt(i-1) == numero.charAt(i));
	}
	if (algUnico) return false;

	if (ordem == "0000") return false;
	return (base == "00000000"
		|| parseInt(ordem, 10) <= 300 || base.substring(0, 3) != "000");
}

function isCpfCnpj(pCpfCnpj)
{
	var numero = pCpfCnpj.replace(/\D/g, "");
	if (numero.length > NUM_DIGITOS_CPF)
		return isCnpj(pCpfCnpj)
	else
		return isCpf(pCpfCnpj);
}


//-----------------







function $() {

  var elements = new Array();



  for (var i = 0; i < arguments.length; i++) {

    var element = arguments[i];

    if (typeof element == 'string')

      element = document.getElementById(element);



    if (arguments.length == 1)

      return element;



    elements.push(element);

  }



  return elements;

}



/*function formatar(src, mask){
  var i = src.value.length;
  var saida = mask.substring(0,1);
  var texto = mask.substring(i);
if (texto.substring(0,1) != saida)
  {
    src.value += texto.substring(0,1);
  }
}
*/

function optendsel(id){
	var opts = document.getElementsByName('optEnd');
	
    for(var i=0; i < opts.length; i++) {
		if(opts[i].value == id){
			opts[i].checked = true;
		}else{
			opts[i].checked = false;
		}
	}	
}



function endereco(outro){

	var cep = document.getElementById("txtCEP").value;
	$('frmpost').src = 'cadastro.php?vrfend='+cep+'&optoutro='+outro;
}


function formatar_mascara(src, mascara) {
	var campo = src.value.length;
	var saida = mascara.substring(0,1);
	var texto = mascara.substring(campo);
	if(texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}

function formatar(obj,mask,e){
	var teclad = '';
	if(e === 'blur'){
		teclad = 'no';
	}else{
		teclad = (window.event)?event.keyCode:e.which;
	}
	
	if(teclad != 8 && teclad != 0){
	
		var tf = obj.value;
		var cnt2 = 0;
		var txtnumeros = '';
		
		while(cnt2 <= tf.length){
			if(tf.charCodeAt(cnt2) > 47 && tf.charCodeAt(cnt2) < 58){
				txtnumeros += tf.substr(cnt2,1);
			}
			cnt2++;
		}	

	  var i = txtnumeros.length;
	  var cnt = 0;
	  var retorno = '';
	  var adds = 0;
		while(cnt <= i){
			if(mask.substr(cnt,1) === '#'){
				retorno += txtnumeros.substr(adds,1);
				adds++;
			}else{
				retorno += mask.substr(cnt,1);
				  
			}
			cnt++;
		}
		obj.value = retorno;
	
	}
}

function selend(botao){
	if(botao.id == 0){
		$('txtEndereco').value = '';
		$('txtCidade').value = '';
		$('txtEstado').value = '';
		$('txtBairro').value = '';
		$('txtCidade').value = $('txtCidade0').value;
		$('txtEstado').value = $('txtEstado0').value;	
		$('dvCidade').innerHTML = $('txtCidade0').value;
		$('dvEstado').innerHTML = $('txtEstado0').value;			
		$('dvEnderecotxt').style.display = '';
		$('dvBairrotxt').style.display = '';
		$('dvBairro').style.display = 'none';
		$('dvCidadetxt').style.display = 'none';
		$('dvCidade').style.display = '';
		$('dvEstadotxt').style.display = 'none';
		$('dvEstado').style.display = '';		
	}else{
		$('txtEndereco').value = botao.value;
		$('txtCidade').value = $('txtCidade'+botao.id).value;
		$('txtEstado').value = $('txtEstado'+botao.id).value;
		$('txtBairro').value = $('txtBairro'+botao.id).value;		
		
		$('dvCidade').innerHTML = $('txtCidade'+botao.id).value;
		$('dvEstado').innerHTML = $('txtEstado'+botao.id).value;
		$('dvBairro').innerHTML = $('txtBairro'+botao.id).value;		
		
		$('dvEnderecotxt').style.display = 'none';
		$('dvBairrotxt').style.display = 'none';
		$('dvBairro').style.display = '';
		$('dvCidadetxt').style.display = 'none';
		$('dvCidade').style.display = '';
		$('dvEstadotxt').style.display = 'none';
		$('dvEstado').style.display = '';	
	}
}

function vrfcpfcadastrado(){
	$('frmpost').src = 'cadastro.php?cpf='+$('txtCPF').value;
}

function vrfcnpjcadastrado(){
	$('frmpost').src = 'cadastro.php?cnpj='+$('txtCNPJ').value;
}
function vrfemailcadastrado(){
	$('frmpost').src = 'cadastro.php?vrfemail='+$('txtEmailC').value;
}
