<!--

window.onerror = avisaErro;

/* VÍDEO PÁSCOA */
//checkVideo();

/* POPUP INICIAL */
popUp();

/* contador de visitas */
//(new Ajax({page:'/pool/test.php', method:'post', displayServerErrors:true})).send('request=http://snt-brasil.myminicity.com/');

addEvent(window, 'load', function(){
	
	/* LOOP EM TODOS OS LINKS */
	iniciaLinks(document);
	
	/* RÁDIO E TV AO VIVO */
	if (valido (getE('radioTV')))
	{
		var imgLink = getEs2('radioTV', 'img');
		w3Opacity.set('icoRadio',10);
		w3Opacity.set('icoTV',10);
		addEvent(imgLink[0], 'mouseover', function(){
			w3Opacity.fading('icoRadio',10,100,1000);
			getE('s1').className = 'mostra';
			getE('s3').className = 'esconde';
		});
		addEvent(imgLink[0], 'mouseout', function(){
			w3Opacity.fading('icoRadio',100,10,1000);
			getE('s1').className = 'esconde';
			getE('s3').className = 'mostra';
		});
		addEvent(imgLink[1], 'mouseover', function(){
			w3Opacity.fading('icoTV',10,100,1000);
			getE('s2').className = 'mostra';
			getE('s3').className = 'esconde';
		});
		addEvent(imgLink[1], 'mouseout', function(){
			w3Opacity.fading('icoTV',100,10,1000);
			getE('s2').className = 'esconde';
			getE('s3').className = 'mostra';
		});
	}
	
	/* MENU LATERAL */
	if (valido(getE('menuLateral'))) InitAll();
	
	/* IMAGENS DO SLIDE */
	if (valido(getE('n1') && getE('n2') && getE('n3') && getE('n4')))
	{
		getE('slide_1').className = 'mostra';
		getE('slide_2').className = 'mostra';
		getE('slide_3').className = 'mostra';
		getE('slide_4').className = 'mostra';
		w3Opacity.set('n1',100);
		w3Opacity.set('n2',40);
		w3Opacity.set('n3',40);
		w3Opacity.set('n4',40);
	}
	
	/* ÍCONES DAS MATÉRIAS */
	if (valido(getE('icones')))
	{
		getE('icones').style.display = 'block';
	}
	
	/* LINKS DO RODAPÉ */
	if (valido(getE('linksRodape')))
	{
		getE('linksRodape').style.display = 'block';
	}
	
	/* FORMULÁRIOS */
	if (valido(getE('enviar')))
	{
		getE('enviar').onsubmit = function(){
			CheckForm();
			return false;
		};
	}
	
	if (valido(getE('formPromo')))
	{
		getE('lnkRegulamento').onclick = function(){
			toogleCss('regulamento', 'mostra', 'esconde');
		}
		getE('formPromo').onsubmit = function(){
			var post = (new formValidator({returnData:true,inputs:{'nome':{rule:'req'},'email':{rule:['req','email']},'igreja':{rule:'req'},'lider':{rule:'req'},'telefone':{rule:['req','phone']}}})).validate();
			if(valido(post)) (new Ajax()).send(post);
			return false;
		};
		getE('rstPromo').onclick = function(){
			resetFrm('formPromo');
			getE('nCaracteres').innerText = '500 caracteres restantes';
		};
		setMascara('telefone', '00-0000 0000');
		toogleText('texto');
		contaCaracteres('texto', 'nCaracteres', 500);
	}
	
	if (valido(getE('formSaraSpace')))
	{
		getE('lnkRegulamento').onclick = function(){
			toogleCss('regulamento', 'mostra', 'esconde');
		}
		getE('formSaraSpace').onsubmit = function(){
			var post = (new formValidator({returnData:true,inputs:{'email':{rule:['req','email']}}})).validate();
			if(valido(post)) (new Ajax()).send(post);
			return false;
		};
		getE('rstSaraSpace').onclick = function(){
			resetFrm('formSaraSpace');
			//getE('nCaracteres').innerText = '100 caracteres restantes';
		};
		//setMascara('telefone', '00-0000 0000');
		//toogleText('texto');
		//contaCaracteres('texto', 'nCaracteres', 100);
	}
	
	if (valido(getE('formMaes')))
	{				
		getE('lnkRegulamento').onclick = function(){
			toogleCss('regulamento', 'mostra', 'esconde');
		}
		getE('formMaes').onsubmit = function(){
			var post = (new formValidator({returnData:true,inputs:{'nome':{rule:'req'},'texto':{rule:'req'}}})).validate();
			if(valido(post)) (new Ajax()).send(post);
			return false;
		};
						
		getE('rstMaes').onclick = function(){
			resetFrm('formMaes');			
			getE('nCaracteres').innerText='140 caracteres restantes';
		};
		toogleText('texto');
		contaCaracteres('texto', 'nCaracteres', 140);
	}
	
	/* ENQUETE */
	if(valido(getE('enq_mid')))
	{
		(new Ajax({process:true,target:'enq_mid',parentTarget:getE('content'),processFade:true})).send('montaEnquete=sim');
	}
	
	/* DOWNLOAD DE IMAGENS */
	if(valido(getE('formLogin')))
	{
		ativaDownLinks('downPublicImgs', false);
		getE('btLimpa').onclick = function(){
			resetFrm('formLogin');
			return false;
		}
		getE('btLogin').onclick = function(){
			var post = (new formValidator({returnData:true,inputs:{'login':{rule:['req','num']},'senha':{rule:['req','valide']}}})).validate();
			if (valido(post))
			{
				(new Ajax({process:true,viewer:'processLogin'})).send('downLogin=sim&' + post);
			}
			return false;
		}
		if(/mostra/.test(getE('downLoggedin').className))
		{
			ativaDownLinks('downLoggedin', true);
			contRegress('timeCount',5);
		}
	}
	
	/* PALAVRAS NA ÍNTEGRA */
	if(valido(getE('formLoginPalavras')))
	{
		getE('btLimpa').onclick = function(){
			resetFrm('formLoginPalavras');
			return false;
		}
		getE('btLogin').onclick = function(){
			var post = (new formValidator({returnData:true,inputs:{'login':{rule:['req','num']},'senha':{rule:['req','valide']}}})).validate();
			if (valido(post))
			{
				(new Ajax({process:true,viewer:'processLogin'})).send('downLogin=sim');
			}
			return false;
		}
	}
	
	pageLoaded = true;
});


//-->