// 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' 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")
	{
		//alert('FS chamado:' + args);
		varlogado = args;
	}
	else if (command=="cruzaLogin")
	{
		//alert('FS chamado:' + args);
		window.frames["gambLogin"].location.href= 'http://www.dubla.com.br/flash/login.asp?'+args;
		//window.frames["gambLogin"].location.href= 'http://www.dubla.com.br/flash/login.asp?'+args;
		
		//alert('http://www.dubla.com.br/flash/login.asp?'+args);
		//window.open('http://www.dubla.com.br/flash/login.asp?'+args,'gambLogin','');
	}
	//
}
// 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

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('Campo E-mail está vazio');
			document.formlogin.strEmail.focus();
			return;
		}
		if (document.formlogin.strSenha.value=="")
		{
			alert('Campo Senha está vazio');
			document.formlogin.strSenha.focus();
			return;
		}
		document.formlogin.submit();
	}
	
	function Esqueci()
	{
		if (document.formlogin.strEmail.value=="")
		{
			alert('Campo E-mail está vazio');
			document.formlogin.strEmail.focus();
			return;
		}
		document.formlogin.action="../servicos/reenviasenha.asp"
		document.formlogin.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 SeusArtigos()
{
	if (!islogado())
	{
		alert('Você precisa se logar para postar artigos.');
	}
	else
	{
		document.location.href="/portal/artigos/artigo_lst1.asp"
	}
}

function SeusDados()
{
	if (!islogado())
	{
		alert('Você precisa se logar para alterar seus dados.');
	}
	else
	{
		document.location.href="/portal/comunidade/perfil.asp?id="+varlogado;
	}
}
	
	function AlteraProfissional()
	{
		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 CriticaTrabalho()
	{
		erro=0;
		if (document.form.strTitulo.value=="")
		{
			alert('Você esqueceu de preencer o Título.');
			document.form.strTitulo.focus();
			return ;
		}
		
		if (ischeckboxvazio(document.form.intTipoID))
		{
			alert('Selecione um Tipo para o Trabalho');
			document.form.intTipoID[0].focus();
			return ;
		}
		
		if ((document.form.intOrdem.value!="") && (isNaN(document.form.intOrdem.value)))
		{
			alert('Ordem deve ser Numérico ou vazio');
			document.form.intOrdem.focus();
			return ;
		}
		
		
		document.form.submit();
	}
	
	function AlteraNivelProfissional()
	{
		erro=0;
		if (ischeckboxvazio(document.form.intNivel))
		{
			alert('Selecione um Nível de Previlégio');
			document.form.intNivel[0].focus();
			return ;
		}
		
		if (!document.form.intNivel[6].checked)
		{
			VerificaEmail('strEmail','Seu e-Mail','document.form');
		
			if (erro != 0) 
			{
				return ;
			}
		}
		document.form.submit();
	}

	function CriticaProfissional()
	{
		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 CriticaEstudio()
	{
		erro=0;
		if (document.form.strEstudio.value=="")
		{
			alert('Você esqueceu de preencer nome do Estúdio.');
			document.form.strEstudio.focus();
			return ;
		}
		
		
		document.form.submit();
	}
	
	function CriticaAtor()
	{
		erro=0;
		if (document.form.strNome.value=="")
		{
			alert('Você esqueceu de preencer seu Nome.');
			document.form.strNome.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 Ficha()
	{
		window.open ('/servicos/ficha.asp','Ficha','scrollbars=auto,width=400,height=500,topmargin=0,leftmargin=0');
	}
	
	function EscolheProfissional(fid,objvalue,objlabel)
	{
		
		janela = window.open ('/profissional/profissional_sel.asp?fid='+fid+'&objLabel='+ objlabel +'&objValor='+objvalue,'escolheProf','scrollbars=auto,width=400,height=500,topmargin=0,leftmargin=0');
		janela.focus();
	}
	
	function EscolheProducao(fid,objvalue,objlabel)
	{
		
		janela = window.open ('/producao/producao_sel.asp?fid='+fid+'&objLabel='+ objlabel +'&objValor='+objvalue,'escolheProd','scrollbars=auto,width=430,height=550,topmargin=0,leftmargin=0');
		janela.focus();
	}
	
	function EscolheAtor(objvalue,objlabel)
	{
		
		janela = window.open ('/ator/ator_sel.asp?objLabel='+ objlabel +'&objValor='+objvalue,'escolheAtor','scrollbars=auto,width=400,height=500,topmargin=0,leftmargin=0');
		janela.focus();
	}
	
	//MM_preloadImages('/portal/img/logado_sair_2.jpg','/portal/img/logado_seus_dados_2.jpg','/portal/img/logado_seus_artigos_2.jpg','/portal/img/bolinha_amarela.gif','/portal/img/bt_busca_2.jpg','/portal/img/bt_ok_verm_2.jpg');


	function enviaBusca_old()
	{
		if ((document.formbusca.strChave.value == ""))
		{
			alert('Preencha o campo Palavra-chave.');
			document.formbusca.strChave.focus();
			return ;
		}
		
		if (! document.formbusca.blnAtores.checked && ! document.formbusca.blnProfissionais.checked && ! document.formbusca.blnProducoes.checked ) 
		{
			alert('Deve ser escolhida pelo menos uma área para a Busca.');
			document.formbusca.blnProfissionais.focus();
			return ;
		}
		document.formbusca.submit();
		return true
	}
	
	function enviaBusca()
	{
		if (document.formBusca.strChave.value.length<1){
					alert('O campo Palavra-chave não pode ser vazio.');
					document.formBusca.strChave.focus();
					return;
				}
				if (ischeckboxvazio(document.formBusca.intTipoID) ){
					alert('Escolha pelo menos uma Categoria para a Busca');
					document.formBusca.intTipoID[0].focus();
					return;
				}
				
				var  jan=window.open('about:blank','busca','width=700,height=550,resizable=0,status=0,scrollbars=0,menubar=0,maximized=0,copyhistory=0,toolbar=0');
				
				document.formBusca.action="http://www.dubla.com.br/servicos/busca_hot.asp";
				document.formBusca.target="busca";
				document.formBusca.submit();		
				jan.focus();
			return true
	}
	
		
	function Exportar(pTipo,pPagina,pArgs)
	{
		window.open ('/servicos/exportar.asp?tipo='+ pTipo +'&pagina='+pPagina+'&'+ pArgs ,'print','scrollbars=auto,width=400,height=500,topmargin=0,leftmargin=0');
		
	}

	function infoProfissional(pid)
	{
		
		window.open('http://quem.dubla.com.br/profissional/profissional_hot.asp?id=' + pid,'profissional'+pid,'width=700,height=550,resizable=0,status=0,scrollbars=0,menubar=0,maximized=0,copyhistory=0,toolbar=0');
	}
	
	function infoProducao(pid)
	{
		window.open('http://quem.dubla.com.br/producao/producao_hot.asp?id=' + pid,'producao'+pid,'width=700,height=560,resizable=0,status=0,scrollbars=0,menubar=0,maximized=0,copyhistory=0,toolbar=0');
	
		//window.open('http://quem.dubla.com.br/producao/producao_info.asp?id=' + pid,'producao'+pid,'width=520,height=550,resizable=0,status=0,scrollbars=1,menubar=0,maximized=0,copyhistory=0,toolbar=0');
	}
	
	function infoAtor(pid)
	{
		window.open('http://quem.dubla.com.br/ator/ator_hot.asp?id=' + pid,'ator'+pid,'width=700,height=550,resizable=0,status=0,scrollbars=0,menubar=0,maximized=0,copyhistory=0,toolbar=0');
	}
	
	
	function menu_fazerLink(cell,strURL)
		{
			
			 window.open(strURL,'_self','');
			
		}
		
		function menu_Ativar(cell)
		{
			
			cell.style.background="#E7C234";
		}
		
		function menu_Desativar(cell)
		{
			cell.style.background="#66B766";
			
		}
	
	MM_preloadImages('/img/bt_Dubladores2.gif','/img/bt_Diretores2.gif','/img/bt_Tradutores2.gif','/img/bt_Atores2.gif','/img/bt_Personagens2.gif','/img/bt_filmes2.gif','/img/bt_series2.gif','/img/bt_novelas2.gif','/img/bt_desenhos2.gif','/img/bt_desenhos2.gif','/img/bt_cinema2.gif','/img/bt_televisao2.gif','/img/bt_tvpaga2.gif','/img/bt_vhs2.gif','/img/bt_dvd2.gif','/img/bt_aviao2.gif','/img/bt_ok_azul_2.gif','/img/bt_ok_az2.gif','/img/bt_ok_az2.gif','img/bt_senha_az2.gif','img/bt_enviar_2.gif');

	
	document.write("<script src='/includes/scripts/AC_RunActiveContent.js' language='javascript'></script>");
