function click () 
{
	var msg = "";
	msg = "Workspace - Copyright 2003 - Todos os direitos reservados!";
	if (event.button == 2) 
		window.alert(msg);
	return 1;	
}

//document.onmousedown = click;

function logout (ScriptName,UrlLogout,TipoLogout,FlagSair) 
{
	var sURL = "";
	var msg = "";
	sURL = ScriptName;
	
	if (TipoLogout == 0)
	{
		if (FlagSair != 1)
		{
			msg = "Seu tempo de conexão se esgotou!";
			msg = msg + "\n\nFaça o login novamente para entrar no sistema!";	
			window.alert(msg);
		}
		parent.document.location.href = UrlLogout;
		parent.parent.document.location.href = UrlLogout;	
		parent.parent.parent.document.location.href = UrlLogout;	
	}
	else
	{
		if (FlagSair != 1)
		{
			msg = "Seu tempo de conexão se esgotou. Esta janela será fechada.";
			msg = msg + "\n\nFaça o login novamente para entrar no sistema!";	
			window.alert(msg);
		}	
		parent.parent.parent.close();	
		parent.parent.close();	
		parent.close();	
	}	
	return 1;
}

function confirma_saida_sistema (ScriptName,UrlLogout,TipoLogout)
{
	var msg = "";
	msg = "Você tem certeza que deseja sair?";	
	
	if (window.confirm(msg))
		document.location.href = ScriptName + "?hidAcao=2";
	return 1;		
}

function ativa_barra_inferior ()
{
	var msg = "";
	var sURL = "";
	
	msg = "Você tem certeza que deseja ativar a barra rápida de acesso?";
	sURL = "../index.cfm?VisualizaBarraInferior=1";
	
	if (window.confirm(msg))
		parent.document.location.href = sURL;
		
	return 1;	
}


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_swapImgRestore2() { //v3.0
  var i,x,a=parent.TopFrame.Header.document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}	

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; ia.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&&id.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_findObj2(n, d) { //v4.0
  var p,i,x;  if(!d) d=parent.TopFrame.Header.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&&id.layers.length;i++) x=MM_findObj2(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];}
}

function MM_swapImage2() { //v3.0
  var i,j=0,x,a=MM_swapImage2.arguments; parent.TopFrame.Header.document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj2(a[i]))!=null){parent.TopFrame.Header.document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}	


function disp1(){
	var mymonth=document.calendarform.month.options[document.calendarform.month.selectedIndex].value;
	var myyear=document.calendarform.year.options[document.calendarform.year.selectedIndex].value;
	window.location="agenda_diaria.cfm?year="+myyear+"&month="+mymonth;
	return 1;
}

function disp2(){
	var mymonth=document.calendarform.month.options[document.calendarform.month.selectedIndex].value;
	var myyear=document.calendarform.year.options[document.calendarform.year.selectedIndex].value;	
	window.location="agenda_diaria.cfm?year="+myyear+"&month="+mymonth;
	return 1;		
}	

function three_minute_alert () 
{ 
	var msg = "";
	msg = "Atenção: Sua sessão de trabalho será encerrada em aproximadamente 3 minutos!";
	window.alert (msg); 
	return 1;
}

function one_minute_alert () 
{ 
	var msg = "";
	msg = "Atenção: Sua sessão de trabalho será encerrada em aproximadamente 1 minuto!";	
	msg = msg + "\n\nPedimos que você salve ou termine o trabalho em andamento, caso contrário ele será perdido!";
	window.alert (msg); 
	return 1;
}	

function lembrete_evento_agenda (EventoId, Evento, Antecedencia, UnidadeAntecedencia)
{
	var msg = "";
	var msgUnidadeAntecedencia = "";
	
	if (UnidadeAntecedencia == 5)
		msgUnidadeAntecedencia = "minuto(s)";
	else if (UnidadeAntecedencia == 4)
		msgUnidadeAntecedencia = "hora(s)";			
	else
		msgUnidadeAntecedencia = "minuto(s)";				
		
	msg = "*** LEMBRETE ***\n\nO seu compromisso '" + Evento + "' irá começar em cerca de " + Antecedencia + " " + msgUnidadeAntecedencia + ".";
	
	window.alert(msg);
	return 1;
}

function lembrete_tarefa_agenda (TodoId, Todo, Antecedencia, UnidadeAntecedencia)
{
	var msg = "";
	var msgUnidadeAntecedencia = "";
	
	if (UnidadeAntecedencia == 5)
		msgUnidadeAntecedencia = "minuto(s)";
	else if (UnidadeAntecedencia == 4)
		msgUnidadeAntecedencia = "hora(s)";			
	else
		msgUnidadeAntecedencia = "minuto(s)";				
		
	msg = "*** LEMBRETE ***\n\nA sua tarefa '" + Todo + "' irá começar em cerca de " + Antecedencia + " " + msgUnidadeAntecedencia + ".";
	
	window.alert(msg);
	return 1;
}	


function carrega_top_frame (Modulo,URL_Submenu,URL_Modulo,Imagem_Modulo)
{
	var URL_Imagem = "";
	URL_Imagem = "imagens/" + Imagem_Modulo;
	
	parent.Submenu.location.href = URL_Submenu;
	parent.parent.MainFrame.location.href = URL_Modulo;
	MM_swapImgRestore();
	MM_swapImage(Modulo,'',URL_Imagem,2);
	
	return 1;
}

function carrega_frame_mensagens (TopFrame,MiddleFrame,BottonFrame,Profundidade)
{
	if (Profundidade == 0)
	{	
		parent.MainFrame.painel_central.document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,20' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",
			"<frame src='../email/" + MiddleFrame + "' scrolling='no' frameborder='yes' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
		parent.MainFrame.painel_central.document.location.reload();	
	}
	if (Profundidade == 1)
	{	
		parent.parent.MainFrame.painel_central.document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,20' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",
			"<frame src='../email/" + MiddleFrame + "' scrolling='no' frameborder='no' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
		parent.parent.MainFrame.painel_central.document.location.reload();	
	}
	if (Profundidade == 2)
	{	
		parent.parent.parent.MainFrame.painel_central.document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,20' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",
			"<frame src='../email/" + MiddleFrame + "' scrolling='no' frameborder='no' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
		parent.parent.parent.MainFrame.painel_central.document.location.reload();	
	}
	if (Profundidade == 3)
	{	
			document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,20' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",
			"<frame src='../email/" + MiddleFrame + "' scrolling='no' frameborder='no' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
			document.location.reload();	
	}								
	return 1;
}

function carrega_frame_mensagens2 (TopFrame,MiddleFrame,BottonFrame,Profundidade)
{
	if (Profundidade == 0)
	{	
		parent.MainFrame.painel_central.painel_email_top.document.location.href=TopFrame;
		parent.MainFrame.painel_central.painel_email_botton.document.location.href=BottonFrame;
		parent.MainFrame.painel_central.painel_email_middle.document.location.href=MiddleFrame;
	}
	if (Profundidade == 1)
	{	
		parent.parent.MainFrame.painel_central.painel_email_top.document.location.href=TopFrame;
		parent.parent.MainFrame.painel_central.painel_email_botton.document.location.href=BottonFrame;
		parent.parent.MainFrame.painel_central.painel_email_middle.document.location.href=MiddleFrame;
	}
	if (Profundidade == 2)
	{	
		parent.parent.parent.MainFrame.painel_central.painel_email_top.document.location.href=TopFrame;
		parent.parent.parent.MainFrame.painel_central.painel_email_botton.document.location.href=BottonFrame;
		parent.parent.parent.MainFrame.painel_central.painel_email_middle.document.location.href=MiddleFrame;
	}
	if (Profundidade == 3)
	{	
		document.location.href=TopFrame;
		document.location.href=BottonFrame;
		document.location.href=MiddleFrame;
	}								
	return 1;
}	

function carrega_frame_email (TopFrame,MiddleFrame,BottonFrame,Profundidade)
{
	if (Profundidade == 0)
	{	
		parent.MainFrame.painel_central.document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,30' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",
			"<frame src='../email/" + MiddleFrame + "' noresize scrolling='no' frameborder='yes' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
		parent.MainFrame.painel_central.document.location.reload();	
	}
	if (Profundidade == 1)
	{	
		parent.parent.MainFrame.painel_central.document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,30' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",
			"<frame src='../email/" + MiddleFrame + "' noresize scrolling='no' frameborder='no' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
		parent.parent.MainFrame.painel_central.document.location.reload();	
	}
	if (Profundidade == 2)
	{	
		parent.parent.parent.MainFrame.painel_central.document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,30' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",			
			"<frame src='../email/" + MiddleFrame + "' noresize scrolling='no' frameborder='no' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
		parent.parent.parent.MainFrame.painel_central.document.location.reload();	
	}
	if (Profundidade == 3)
	{	
			document.write("<html><head><title></title></head>",
			"<frameset rows='180,*,30' frameborder='YES' border='1'>",
			"<frame src='../email/"  + TopFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_top'>",
			"<frame src='../email/" + BottonFrame + "' scrolling='yes' frameborder='YES' border='1' framespacing='0' spacing='0' marginwidth='0' marginheight='0'  name='painel_email_botton'>",
			"<frame src='../email/" + MiddleFrame + "' noresize scrolling='no' frameborder='no' border='0' framespacing='0' spacing='0' marginwidth='0' marginheight='0' name='painel_email_middle'>",
			"</frameset><noframes><body></body></noframes></html>");
			document.location.reload();	
	}								
	return 1;
}


function nova_janela (myurl,WindowName,scrollbars,resizable,toolbar,menubar,location,directories,width,height) 
{
	var newWindow;
	var props = 'screenX=0,screenY=0,top=0,left=0,scrollBars=' + scrollbars + ',resizable=' + resizable + ',toolbar=' + toolbar + ',menubar=' + menubar + ',location=' + location + ',directories=' + directories + ',width=' + width + ',height=' + height;
	newWindow = window.open(myurl,WindowName, props);
}	

function encaminha_pagina_erro (CodErro, MsgErro, Profundidade)
{
	var strUrl = "";
	strUrl = "../erro.cfm?CodErro=" + CodErro + "&MsgErro=" + MsgErro; 
	
	if (Profundidade == 0)
		parent.MainFrame.document.location.href = strUrl;
	if (Profundidade == 1)
		parent.parent.MainFrame.document.location.href = strUrl;
	if (Profundidade == 2)
		parent.parent.parent.MainFrame.document.location.href = strUrl;						
	if (Profundidade == 3)
		document.location.href = strUrl;									
		
	return 1;
}			
		
function nova_mensagem_destinatario (Nome, Email, Profundidade)
{		
	var strUrl = "";
	strUrl = "nova_mensagem.cfm?Para=" + Email; 
	
	if (Profundidade == 0)
		parent.MainFrame.painel_central.document.location.href = strUrl;
	if (Profundidade == 1)
		parent.parent.MainFrame.painel_central.document.location.href = strUrl;
	if (Profundidade == 2)
		parent.parent.parent.MainFrame.painel_central.document.location.href = strUrl;						
		
	return 1;
}

function alerta_permissao_modulo (ModuloId, strURL)
{
	var msg = "";
	
	if (ModuloId == 1)
		msg = "Você não tem permissão para acessar o módulo 'Meu Workspace'!";
	if (ModuloId == 2)
		msg = "Você não tem permissão para acessar o módulo 'Email'!";
	if (ModuloId == 3)
		msg = "Você não tem permissão para acessar o módulo 'Agenda'!";
	if (ModuloId == 4)
		msg = "Você não tem permissão para acessar o módulo 'Contatos'!";
	if (ModuloId == 5)
		msg = "Você não tem permissão para acessar o módulo 'Documentos'!";
	if (ModuloId == 6)
		msg = "Você não tem permissão para acessar o módulo 'Notícias'!";
	if (ModuloId == 7)
		msg = "Você não tem permissão para acessar o módulo 'Debates'!";
	if (ModuloId == 8)
		msg = "Você não tem permissão para acessar o módulo 'Admin'!";
	if (ModuloId == 9)
		msg = "Você não tem permissão para acessar o módulo 'Boletim'!";			
	if (ModuloId == 10)
		msg = "Você não tem permissão para acessar o módulo 'Relacionamento'!";			
	if (ModuloId == 11)
		msg = "Você não tem permissão para acessar o módulo 'Painel de dúvidas'!";			
	if (ModuloId == 12)
		msg = "Você não tem permissão para acessar o módulo 'Testes'!";
	if (ModuloId == 13)
		msg = "Você não tem permissão para acessar o módulo 'Blog'!";			
	if (ModuloId == 14)
		msg = "Você não tem permissão para acessar o módulo 'Chat'!";																		

	if (ModuloId == 30)
		msg = "Você não tem permissão para acessar o módulo 'Clientes'!";
	if (ModuloId == 31)
		msg = "Você não tem permissão para acessar o módulo 'Marketing'!";
	if (ModuloId == 32)
		msg = "Você não tem permissão para acessar o módulo 'Parceiros'!";
	if (ModuloId == 33)
		msg = "Você não tem permissão para acessar o módulo 'Relatórios'!";

	msg = msg + "\n\nCaso deseje acessar esse módulo, entre em contato com o administrador do sistema.";
	window.alert(msg);
	document.location.href = strURL;

	return 1;
}			

	

function desabilita_botao_direito_mouse ()
{
	var i = 0;
	if (event.button != 1)
		//window.alert("Copyright 2003 - Workspace - Todos os direitos reservados");
		
	return 1; 
}

function popup_composicao_mensagem (OpcaoMensagem,Remetente,Destinatario)
{
	var To = "";
	var From = "";
	var strURL = "";

	To = Destinatario;
	From = Remetente;
	strURL = "../email/popup_nova_mensagem.cfm?Para=" + To;

	nova_janela (strURL,'Mensagem','yes','yes','no','no','no','no',720,540);
	
	return 1;
}	

function popup_novo_contato (Email,Contato)
{
	var strURL = "";
	strURL = "../contatos/popup_novo_contato.cfm?Email=" + Email + "&Contato=" + Contato;

	nova_janela (strURL,'NovoContato','yes','yes','no','no','no','no',690,540);
	
	return 1;
}	

function confirma_visualizacao_barra_inferior (Visualizacao)
{
	var sURL = "";
	var msg = "";
	sURL = "index.cfm?VisualizaBarraInferior=" + Visualizacao;
	msg = "Você tem certeza que deseja ocultar a barra de acesso rápido?";
	
	if (window.confirm(msg))
		top.location.href = sURL;
		
	return 1;
}

function altera_modulo (ModuloId,Modulo,URL_Submenu,URL_Modulo,Imagem_Modulo)
{
	var URL_Imagem = "";
	URL_Imagem = "imagens/" + Imagem_Modulo;
	
	parent.TopFrame.Submenu.location.href = URL_Submenu;
	window.location.href = URL_Modulo;
	MM_swapImgRestore2();
	MM_swapImage2(Modulo,'',URL_Imagem,2);
	
	return 1;
}

function altera_modulo_from_email (ModuloId,Modulo,URL_Submenu,URL_Modulo,Imagem_Modulo)
{
	var URL_Imagem = "";
	URL_Imagem = "imagens/" + Imagem_Modulo;
	
	parent.parent.parent.TopFrame.Submenu.location.href = URL_Submenu;
	parent.parent.location.href = URL_Modulo;
	MM_swapImgRestore2();
	MM_swapImage2(Modulo,'',URL_Imagem,2);
	
	return 1;
}

function confirma_busca ()
{
	var msg = "";
	msg = "Você tem certeza que deseja realizar a busca no Workspace?";
	msg = msg + "\n\nDependendo do volume de informações e da palavra-chave a ser localizada, o sistema pode demorar";
	msg = msg + " alguns segundos."; 
		
	if (window.confirm(msg))
	{
		MM_swapImgRestore();
		MM_swapImage('My.Workspace','','imagens/bt_meu_portal_click.gif',2);	
		parent.Submenu.document.location.href = 'myworkspace/submenu_myworkspace.cfm';
		frmBusca.submit();
	}			
	
	return 1;
}	


function altera_status_painel (Status,ModuloId)
{
	var msg = "";
	var sURL = "";
	if (ModuloId == 2)
	{
		ParametroId = 71;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Email'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Email'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Email'?";								
	}
	if (ModuloId == 3)
	{
		ParametroId = 72;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Agenda'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Agenda'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Agenda'?";								
	}		
	if (ModuloId == 4)
	{
		ParametroId = 73;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Contatos'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Contatos'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Contatos'?";								
	}		
	if (ModuloId == 5)
	{
		ParametroId = 74;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Documentos'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Documentod'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Documentos'?";								
	}		
	if (ModuloId == 6)
	{
		ParametroId = 77;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Notícias e enquetes'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Notícias e enquetes'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Notícias e enquetes'?";								
	}		
	if (ModuloId == 7)
	{
		ParametroId = 76;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Debates'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Debates'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Debates'?";								
	}				
	if (ModuloId == 9)
	{
		ParametroId = 79;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Boletim'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Boletim'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Boletim'?";								
	}	
	if (ModuloId == 10)
	{
		ParametroId = 81;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Relacionamento'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Relacionamento'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Relacionamento'?";								
	}						
	if (ModuloId == 11)
	{
		ParametroId = 82;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Painel de dúvidas'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Painel de dúvidas'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Painel de dúvidas'?";								
	}
	if (ModuloId == 13)
	{
		ParametroId = 80;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Blogs populares'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Blogs populares'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Blogs populares'?";								
	}							
	if (ModuloId == 15)
	{
		ParametroId = 78;
		if (Status == 1)
			msg = "Você tem certeza que deseja minimizar o painel 'Grade horária'?";
		if (Status == 2)
			msg = "Você tem certeza que deseja maximizar o painel 'Grade horária'?";
		if (Status == 3)
			msg = "Você tem certeza que deseja fechar o painel 'Grade horária'?";								
	}		
	
	sURL = "index.cfm?ParametroId=" + ParametroId + "&ModuloId=" + ModuloId + "&Status=" + Status;
	
	if (window.confirm(msg))
		document.location.href = sURL;
		
	return 1;	
}



function confirma_alteracao_workspace ()
{
	var msg = "";
	msg = "Você tem certeza que deseja visualizar o workspace selecionado?";	
	
	if (window.confirm(msg))
		frmAlteraWorkspace.submit();

	return 1;
}

function confirma_exclusao_workspace (WorkspaceId)
{
	var msg = "";
	var sURL = "";
	
	msg = "Você tem certeza que deseja excluir o workspace selecionado?";	
	sURL = "lista_workspace.cfm?WorkspaceId=" + WorkspaceId + "&Acao=1";
	
	if (window.confirm(msg))
		document.location.href = sURL;
		
	return 1;
}

function atualiza_janela_popup (JanelaId, Param1, Param2, Param3, Param4, Param5)
{
	var sOpenerWindow;	
	var CurrentLength;
	
	sOpenerWindow = self.opener.document.location.href;
	
	if (JanelaId == 1)
	{
		if (sOpenerWindow.indexOf("popup_topico.cfm") != -1)
			self.opener.document.location.href = "popup_topico.cfm?ForumId=" + Param1 + "&ThreadId=" + Param2;	
	}	
	
	if (JanelaId == 2)
	{
		if (sOpenerWindow.indexOf("popup_topico.cfm") != -1)
			self.opener.document.location.href = "popup_topico.cfm?ForumId=" + Param1 + "&ThreadId=" + Param2;
	}		
	
	if (JanelaId == 3)
	{
		if (sOpenerWindow.indexOf("popup_topico.cfm") != -1)
			self.opener.document.location.href = "popup_topico.cfm?ForumId=" + Param1 + "&ThreadId=" + Param2;
	}
	
	if (JanelaId == 4)
	{
		if (sOpenerWindow.indexOf("forum.cfm") != -1)
			self.opener.document.location.href = "forum.cfm?ForumId=" + Param1;
	}
	
	if (JanelaId == 5)
	{
		if (sOpenerWindow.indexOf("lista_tarefas.cfm") != -1)
			self.opener.document.location.href = "lista_tarefas.cfm";	
			
		if (sOpenerWindow.indexOf("agenda_semanal.cfm") != -1)
			self.opener.document.location.href = "lista_tarefas.cfm";
			
		if (sOpenerWindow.indexOf("agenda_diaria.cfm") != -1)
			self.opener.document.location.href = "lista_tarefas.cfm";			
			
		if (sOpenerWindow.indexOf("agenda_mensal.cfm") != -1)
			self.opener.document.location.href = "lista_tarefas.cfm";			
			
		if (sOpenerWindow.indexOf("config_agenda.cfm") != -1)
			self.opener.document.location.href = "lista_tarefas.cfm";
			
		if (sOpenerWindow.indexOf("compartilhamento.cfm") != -1)
			self.opener.document.location.href = "lista_tarefas.cfm";						
	}
	
	if (JanelaId == 6)
	{
		if (sOpenerWindow.indexOf("agenda_diaria.cfm") != -1)
			self.opener.document.location.href = "agenda_diaria.cfm?day=" + Param1 + "&month=" + Param2 + "&year=" + Param3;
			
		if (sOpenerWindow.indexOf("agenda_semanal.cfm") != -1)
			self.opener.document.location.href = "agenda_semanal.cfm?day=" + Param1 + "&month=" + Param2 + "&year=" + Param3;
	}
	
	if (JanelaId == 7)
	{
		if (sOpenerWindow.indexOf("lista_contatos.cfm") != -1)
			self.opener.document.location.href = "lista_contatos.cfm?GrupoId=" + Param1;
	}
	
	if (JanelaId == 8)
	{
		if (sOpenerWindow.indexOf("lista_noticias.cfm") != -1)
			self.opener.document.location.href = "lista_noticias.cfm";	
	}
	
	if (JanelaId == 9)
	{
		if (sOpenerWindow.indexOf("lista_noticias.cfm") != -1)
			self.opener.document.location.href = "lista_noticias.cfm";
			
		if (sOpenerWindow.indexOf("noticia.cfm") != -1)
			self.opener.document.location.href = "noticia.cfm?NoticiaId=" + Param1;
	}				
	
	if (JanelaId == 10)
	{
		if (sOpenerWindow.indexOf("lista_noticias.cfm") != -1)
			self.opener.document.location.href = "lista_noticias.cfm";			
	}
	
	if (JanelaId == 11)
	{
		if (sOpenerWindow.indexOf("lista_noticias.cfm") != -1)
			self.opener.document.location.href = "lista_noticias.cfm";
	}
	
	if (JanelaId == 12)
	{
		if (sOpenerWindow.indexOf("lista_noticias.cfm") != -1)
			self.opener.document.location.href = "lista_noticias.cfm";
	}
	
	if (JanelaId == 13)
	{
		if (sOpenerWindow.indexOf("blog.cfm") != -1)
			self.opener.document.location.href = "blog.cfm?BlogId=" + Param1;	
	}
	
	if (JanelaId == 14)
	{
		if (sOpenerWindow.indexOf("blog.cfm") != -1)
			self.opener.document.location.href = "blog.cfm?BlogId=" + Param1;
	}		
	
	if (JanelaId == 15)
	{
		if (sOpenerWindow.indexOf("blog.cfm") != -1)
			self.opener.document.location.href = "blog.cfm?BlogId=" + Param1;
	}
	
	if (JanelaId == 16)
	{
		if (sOpenerWindow.indexOf("blog.cfm") != -1)
			self.opener.document.location.href = "blog.cfm?BlogId=" + Param1;
	}
	
	if (JanelaId == 17)
	{
		if (sOpenerWindow.indexOf("blog.cfm") != -1)
			self.opener.document.location.href = "blog.cfm?BlogId=" + Param1;
	}											
	
	if (JanelaId == 18)
	{
		if (sOpenerWindow.indexOf("aviso.cfm") != -1)
			self.opener.document.location.href = "aviso.cfm?AvisoId=" + Param1 + "&Flag=" + Param2;
	}
	
	if (JanelaId == 19)
	{
		if (sOpenerWindow.indexOf("lista_avisos.cfm") != -1)
			self.opener.document.location.href = "lista_avisos.cfm";
	}
	
	if (JanelaId == 20)
	{
		if (sOpenerWindow.indexOf("lista_avisos.cfm") != -1)
			self.opener.document.location.href = "lista_avisos.cfm";
	}
	
	if (JanelaId == 21)
	{
		if (sOpenerWindow.indexOf("testes_admin.cfm") != -1)
			self.opener.document.location.href = "testes_admin.cfm?DisciplinaId=" + Param1;
	}
	
	if (JanelaId == 22)
	{
		if (sOpenerWindow.indexOf("submenu_duvidas.cfm") != -1)
			self.opener.parent.MainFrame.painel_central.document.location.href = "lista_duvidas.cfm?DisciplinaId=" + Param1;
	}
	
	if (JanelaId == 23)
	{
		if (sOpenerWindow.indexOf("noticia.cfm") != -1)
			self.opener.document.location.href = "noticia.cfm?NoticiaId=" + Param1;
	}						
	
	if (JanelaId == 24)
	{
		if (sOpenerWindow.indexOf("lista_noticias.cfm") != -1)
			self.opener.document.location.href = "lista_noticias.cfm?EnqueteId=" + Param1;
	}
	
	if (JanelaId == 25)
	{
		if (sOpenerWindow.indexOf("agenda_diaria.cfm") != -1)
			self.opener.document.location.href = "agenda_diaria.cfm?day=" + Param1 + "&month=" + Param2 + "&year=" + Param3;

		if (sOpenerWindow.indexOf("agenda_mensal.cfm") != -1)
			self.opener.document.location.href = "agenda_mensal.cfm?month=" + Param2 + "&year=" + Param3;
			
		if (sOpenerWindow.indexOf("agenda_semanal.cfm") != -1)
			self.opener.document.location.href = "agenda_semanal.cfm?day=" + Param1 + "&month=" + Param2 + "&year=" + Param3;
	}
	
	if (JanelaId == 26)
	{
		if (sOpenerWindow.indexOf("lista_tarefas.cfm") != -1)
			self.opener.document.location.href = "lista_tarefas.cfm";
	}
	
	if (JanelaId == 27)
	{
		if (sOpenerWindow.indexOf("lista_contatos.cfm") != -1)
			self.opener.document.location.href = "lista_contatos.cfm";
	}
	
	if (JanelaId == 28)
	{
		if (sOpenerWindow.indexOf("blog.cfm") != -1)
			self.opener.document.location.href = "blog.cfm?BlogId=" + Param1;
	}
	
	if (JanelaId == 29)
	{
		if (sOpenerWindow.indexOf("frame_perguntas.cfm") != -1)
			self.opener.document.location.href = "frame_perguntas.cfm?PerguntaId=" + Param1;
	}
	
	if (JanelaId == 30)
	{
		if (sOpenerWindow.indexOf("forum.cfm") != -1)
			self.opener.document.location.href = "forum.cfm?ForumId=" + Param1;
	}
	
	if (JanelaId == 31)
	{
		if (sOpenerWindow.indexOf("lista_foruns.cfm") != -1)
			self.opener.document.location.href = "lista_foruns.cfm";
	}														

	if (JanelaId == 32)
	{
		if (sOpenerWindow.indexOf("frame_ocorrencias.cfm") != -1)
			self.opener.document.location.href = "frame_ocorrencias.cfm?TipoOcorrencia=" + Param2 + "&ClienteId=" + Param1;
		if (sOpenerWindow.indexOf("popup_novo_pgto.cfm") != -1)
		{
			NewOpt = new Option;
			NewOpt.value = Param3;
			NewOpt.text = Param4;
			
			CurrentLength = self.opener.document.frmNoItens.cboOcorrencia.length;
			self.opener.document.frmNoItens.cboOcorrencia.length = CurrentLength + 1;
			self.opener.document.frmNoItens.cboOcorrencia[CurrentLength].value = Param3;
			self.opener.document.frmNoItens.cboOcorrencia[CurrentLength].text = Param4;
			self.opener.document.frmNoItens.cboOcorrencia[CurrentLength].selected = true;
		}
	}														

	if (JanelaId == 33)
	{
		if (sOpenerWindow.indexOf("frame_cliente.cfm") != -1)
			self.opener.document.location.href = "frame_cliente.cfm?ClienteId=" + Param1;
		if (sOpenerWindow.indexOf("frame_funcoes_clientes.cfm") != -1)
			self.opener.document.location.href = "frame_funcoes_clientes.cfm";
	}														

	if (JanelaId == 34)
	{
		if (sOpenerWindow.indexOf("frame_produtos.cfm") != -1)
			self.opener.document.location.href = "frame_produtos.cfm?ProdutoId=" + Param1;
	}														

	if (JanelaId == 35)
	{
		if (sOpenerWindow.indexOf("frame_funcoes_ocorrencia.cfm") != -1)
			self.opener.document.location.href = "frame_funcoes_ocorrencia.cfm?Painel=" + Param1 + "&ClienteId=" + Param2 + "&OcorrenciaId=" + Param3;
	}														

	if (JanelaId == 36)
	{
		if (sOpenerWindow.indexOf("frame_funcoes_ocorrencia.cfm") != -1)
			self.opener.document.location.href = "frame_funcoes_ocorrencia.cfm?Painel=" + Param1 + "&ClienteId=" + Param2 + "&OcorrenciaId=" + Param3;
	}														

	if (JanelaId == 37)
	{
		if (sOpenerWindow.indexOf("frame_pesquisas.cfm") != -1)
			self.opener.document.location.href = "frame_pesquisas.cfm";
	}														

	if (JanelaId == 38)
	{
		if (sOpenerWindow.indexOf("frame_ocorrencias.cfm") != -1)
			self.opener.document.location.href = "frame_ocorrencias.cfm?ClienteId=" + Param1 + "&Pesquisa=1";
	}														

	if (JanelaId == 39)
	{
		if (sOpenerWindow.indexOf("hosting.cfm") != -1)
			self.opener.document.location.href = "hosting.cfm";
	}
	
	if (JanelaId == 40)
	{
		if (sOpenerWindow.indexOf("teste.cfm") != -1)
			self.opener.document.location.href = "teste.cfm?TesteId=" + Param1;
	}															

	if (JanelaId == 41)
	{
		if (sOpenerWindow.indexOf("popup_produto.cfm") != -1)
			self.opener.document.location.href = "popup_produto.cfm?ProdutoId=" + Param1 + "&ArtigoId=" + Param2;
	}															

	if (JanelaId == 42)
	{
		if (sOpenerWindow.indexOf("frame_template.cfm") != -1)
			self.opener.document.location.href = "frame_template.cfm?TemplateId=" + Param1;
	}															

	if (JanelaId == 43)
	{
		if (sOpenerWindow.indexOf("popup_contatos_cliente.cfm") != -1)
			self.opener.document.location.href = "../crm/popup_contatos_cliente.cfm?ClienteId=" + Param1;
	}															

	if (JanelaId == 44)
	{
		if (sOpenerWindow.indexOf("frame_ocorrencias.cfm") != -1)
			self.opener.document.location.href = "../crm/frame_ocorrencias.cfm?TipoOcorrencia=0&Pesquisa=0&Pagamento=1&ClienteId=" + Param1;
	}															

	if (JanelaId != 28 && JanelaId != 40)				
		window.close();
	else if (JanelaId == 40)
		parent.close();
					
	return 1;
}


function alerta_ano_letivo (Ano)
{
	var msg = "";
	msg = "ATENÇÃO: Sua matrícula para este ano letivo ainda não foi efetivada no sistema!";
	msg = msg + "\n\nDessa forma, você estará acessando o Portal utilizando as credenciais do ano " + Ano + ".";
	msg = msg + "\n\nTão logo o sistema seja atualizado você poderá visualizar os dados referentes ao ano letivo atual."
	
	window.alert(msg);
	return 1;
}	

function ativa_wizard_configuracao ()
{
	var sURL = "frameset_wizard.cfm";
	nova_janela (sURL,'Wizard','no','no','no','no','no','no',550,450);
	return 1; 	
}

function avanca_wizard ()
{
	var Acao;
	Acao = parent.Wizard.document.frmAcao.hidAcao.value;
	parent.Wizard.document.frmAcao.submit();
	return 1; 	
}

function volta_wizard ()
{
	var Acao;
	var msg = "";
	Acao = parent.Wizard.document.frmAcao.hidAcao.value;
	
	if (Acao == 1)
	{
		msg = "Você está na página inicial do configurador do sistema!";
		window.alert(msg);
	}
	else
		parent.Wizard.document.frmAcao.submit();
		
	return 1; 	
}

function popup_senha (ClienteId,OcorrenciaId)
{
	var temp;	
	var sURL;
	var Janela;
	sURL = "../crm/popup_chave.cfm?OcorrenciaId=" + OcorrenciaId + "&ClienteId=" + ClienteId;
	Janela = ClienteId + "Chave" + OcorrenciaId;
	temp = nova_janela(sURL,Janela,'yes','yes','no','no','no','no',250,90);
	return 1;
}

function mostra_conteudo (ClienteId,OcorrenciaId,Autorizacao)
{
	var temp;	
	var sURL;
	var Janela;
	
	if (Autorizacao == 1)
	{
		if (OcorrenciaId != 0)
		{
			temp = mostra_ocorrencia_crm (ClienteId, OcorrenciaId);
		}
		else
		{
			self.opener.document.frmSelecaoCliente.submit();
		}
	}
	else
	{
		window.alert("Você não tem permissão de acesso para o conteúdo selecionado!");
		if (OcorrenciaId == 0)
			self.opener.document.frmSelecaoCliente.cboCliente.options[0].selected = true;
	}
	window.close();
	return 1;
}

function mostra_ocorrencia_crm(ClienteId,OcorrenciaId)
{
	var temp;	
	var sURL;
	var Janela;
	sURL = "../crm/frameset_ocorrencia.cfm?OcorrenciaId=" + OcorrenciaId + "&ClienteId=" + ClienteId;
	Janela = "Ocorrencia" + OcorrenciaId;
	temp = nova_janela(sURL,Janela,'yes','yes','no','no','no','no',750,550);
	return 1;
}
