// FSCommand
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.

document.write ("<iframe style='width:1;height:1;display:none;' name='gambLogin' src='about:blank'></iframe>");
function login_DoFSCommand(command, args) {
	var loginObj = isInternetExplorer ? document.all.login : document.login;
	//
	// Place your code here.

	if (command=="fazLogin")
	{
		
		varlogado = args;
	}
	
	
	//
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub login_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call login_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
// Fim do FSCommand

// inicio fs command FLOAT

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.
function float_DoFSCommand(command, args) {
	var floatObj = isInternetExplorer ? document.all.float : document.float;
	//
	// Place your code here.
	
	if (command=="mostrafloat")
	{
		floatlayer.style.visibility=args;
	}
	//
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub float_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call float_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

// fim fs command

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
	window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
	var p,i,x;	if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

meses = new Array(12);
meses = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var varlogado = "";

// Funcções de verificação dos campos do form
function VerificaEmail(pname,plabel,pthis) 
{
	var achou_ponto=false;
	var achou_arroba=false;
	var achou_caracter=false;
	var achou_plic=false;
	var achou_min = false
	
	d = eval(pthis + "." + pname);
	email = d.value.split(" ");
	email = email.join("");
	if (email == "")
	{
		alert("O campo " + plabel + " não pode estar vazio.\nVerifique.");
		d.focus();
		erro=1;
	}else{
		d = eval(pthis + "." + pname);
		email = d.value;
		for (var i=0;i<email.length;i++) {
			if (email.charAt(i)=="@" && achou_arroba==true){
				achou_arroba=false;
			}else{
				if (email.charAt(i)=="@"){
					achou_arroba=true;
				}else{
					if (email.charAt(i)=="."){
						achou_ponto=true;
					}else{
						if (email.charAt(i)=="'"){
							achou_plic=true;
						}else{
							if (email.charAt(i)==" "){
								achou_caracter=true;
							}
						}
					}
				}
			}
		}
		if (email.slice(0,email.indexOf("@")).length>=1 && email.slice(email.indexOf("@")+1).length>=5){
			if (achou_plic==false){
				if(achou_ponto!=true || achou_arroba!=true || achou_caracter!=false){
					alert("O campo " + plabel + " não está correto.\nVerifique.");
					d = eval(pthis + "." + pname);
					d.focus();
					erro=1;
				}
			}else{
				alert("O campo " + plabel + " não está correto.\nVerifique.");
				d = eval(pthis + "." + pname);
				d.focus();
				erro=1;
			}
		}else{
			alert("O campo " + plabel + " não está correto.\nVerifique.");
			d = eval(pthis + "." + pname);
			d.focus();
			erro=1;
		}
	}
}

function AlterarSenha() {
	
	if(document.form.strSenha.value =="")
	{
		alert("Por favor digite a senha.");
		document.form.strSenha.focus();
		return;
	}
	if(document.form.strSenhaNova.value =="")
	{
		alert("Por favor digite a nova senha.");
		document.form.strSenhaNova.focus();
		return;
	}
	if(document.form.strSenhaNova.value == document.form.strSenha.value)
	{
		alert("Por favor digite uma nova senha, diferente da anterior.");
		document.form.strSenhaNova.focus();
		return;
	}
	if(document.form.strConfSenhaNova.value ==0)
	{
		alert("Por favor preencha a nova senha.");
		document.form.strConfSenhaNova.focus();
		return;
	}
	else
	{
		if((document.form.strSenhaNova.value)!=(document.form.strConfSenhaNova.value))
		{
			alert("A senha tem que ser igual à senha de verificação.");
			document.form.strConfSenhaNova.focus();
			return;
		}
	}
	document.form.submit();
}

	function Logar()
	{
		if (document.formlogin.strEmail.value=="")
		{
			alert('Escreva seu e-mail');
			document.formlogin.strEmail.focus();
			return;
		}
		if (document.formlogin.strSenha.value=="")
		{
			alert('Escreva sua senha');
			document.formlogin.strSenha.focus();
			return;
		}
		document.formlogin.submit();
	}
	
	function Esqueci()
	{
		if (document.formsenha.strEmail.value=="")
		{
			alert('Preencha o e-mail que você usou ao se cadastrar');
			document.formsenha.strEmail.focus();
			return;
		}
		document.formsenha.action="../cadastro/reenviasenha.asp"
		document.formsenha.submit();
	}
	
	

function ischeckboxvazio(obj)
{
	
	if (obj.value!=undefined && obj.value!="")
	{
		
		if (obj.checked)
			return false;
	}
	for (i=0;i<=obj.length-1;i++)
	{	
		
		if (obj[i].checked)
			{
				return false;
			}
		
	}
	return true;
}

function EnviaForum()
{
	if (! islogado())
	{
		alert('Você deve estar logado para postar mensagens.')
	}
	else
	{
		
		if (document.formforum.strMensagem.value == "")
		{
			alert('Preencha a Mensagem.');
			document.formforum.strMensagem.focus();
			return;
		}
		
		document.formforum.submit();
	}
}



function logado(pstrlogado)
{
	varlogado = pstrlogado;
}

function islogado()
{
	if (varlogado != "")
	{
		return true;
	}
	else
	{
		return false;
	}
}

function verificaLoginForum(obj)
{
	if (!islogado())
	{
		alert('Você precisa se logar para postar mensagens.');
		obj.value = "";
		obj.blur();
	}
	
}

function Cadastro()
{
	
		document.location.href="../cadastro/cadastro_inc1.asp"
	
}
function SeusArtigos()
{
	
	document.location.href="/artigos/artigo_lst1.asp"
	
}

function SeusDados()
{
	if (!islogado())
	{
		alert('Você precisa se logar para alterar seus dados.');
	}
	else
	{
		document.location.href="../comunidade/perfil.asp?id="+varlogado;
	}
}
	
	function AlteraCadastro()
	{
		erro=0;
		if (document.form.strNome.value=="")
		{
			alert('Você esqueceu de preencer seu Nome.');
			document.form.strNome.focus();
			return ;
		}
		
		VerificaEmail('strEmail','Seu e-Mail','document.form');
		
		if (erro != 0) 
		{
			return ;
		}
		
		
		if (!document.form.strSexo[0].checked && !document.form.strSexo[1].checked )
		{
			alert('Você esqueceu de preencer seu Sexo.');
			document.form.strSexo[0].focus();
			return ;
		}
		document.form.submit();
	}
	

	function CriticaCadastro()
	{
		erro=0;
		if (document.form.strNome.value=="")
		{
			alert('Você esqueceu de preencer seu Nome.');
			document.form.strNome.focus();
			return ;
		}
		
		VerificaEmail('strEmail','Seu e-Mail','document.form');
		
		if (erro != 0) 
		{
			return ;
		}
		
		if(document.form.strSenha.value =="")
		{
			alert("Por favor digite a senha.");
			document.form.strSenha.focus();
			return;
		}
		
		if(document.form.strConfSenha.value ==0)
		{
			alert("Por favor repita a senha.");
			document.form.strConfSenha.focus();
			return;
		}
		
		if(document.form.strSenha.value != document.form.strConfSenha.value)
		{
			alert("A senha e sua confirmação estão diferentes.");
			document.form.strSenha.focus();
			return;
		}
		
		if (!document.form.strSexo[0].checked && !document.form.strSexo[1].checked )
		{
			alert('Você esqueceu de preencer seu Sexo.');
			document.form.strSexo[0].focus();
			return ;
		}
		document.form.submit();
	}
	
	function EscolheFoto()
	{
		if (document.form1.intAssuntoID.value=="")
		{
			alert('Escolha um assunto');
		}
		else
		{
			window.open ('/fotos/escolhefoto.asp?aid='+document.form1.intAssuntoID.value,'escolhefoto','scrollbars=auto,width=400,height=500,topmargin=0,leftmargin=0');
		}
	}
	
	function videoPlayer(vid)
	{
		window.open ('/videos/video_player.asp?id='+vid,'video','scrollbars=no,width=356,height=465,topmargin=0,leftmargin=0');
	}
	
	function menu_fazerLink(strURL)
		{
			
			document.location.href=strURL;
			
		}
		
		function menu_Ativar(cell)
		{
			
			cell.style.background="#F9B006"; //"#D9D9F1";
		}
		
		function menu_Desativar(cell)
		{
			cell.style.background="#DDDDDD";
			
		}


var ns6,ns4,ie4;

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
ns6 = false;

if (ns4 == ie4) {
	ns6 = true;
	ie4 = false;
	ns4 = false;
}
	
function show(id) {
		if (document.layers){
				if (document.layers[id]){
						if (ns4) document.layers[id].visibility = "show"
				}
		}
		else if (ie4){
			if (document.all[id]){
				document.all[id].style.visibility = "visible";
				document.all[id].style.display = "";
			}
		}
		else if (ns6){
			if (document.getElementById(id)){ 
				document.getElementById(id).style.visibility = "visible";
	 		}
		}
}
function hide(id) {
		if (document.layers){
				if (document.layers[id]){;
						if (ns4) document.layers[id].visibility = "hide"
				}
		}
		else if (ie4) {
			if (document.all[id]){
				document.all[id].style.visibility = "hidden";
				document.all[id].style.display = "none";
	 		}
 	}
		else if (ns6) {
			if (document.getElementById(id)){
				document.getElementById(id).style.visibility = "hidden";
	 		}
 	}
}



	
	
	
