/*
 * @sintaxe1 	: showModal('pagina1.cfm', '_top|_self|_blank|_parent') 
 * @sintaxe2 	: showModal('pagina2.cfm', 'target_customizado', 1, 1, 0, 580, 420 )
 */					
function showModal( p_pagina, p_target, p_resize, p_scroll, p_status, p_width, p_height )
{ 
 var path     = p_pagina.split('/');
 var pagina   = path[ path.length -1 ].split('?');
	 resize	  = ( p_resize != null || p_resize != 0 ) ? p_resize : false;
	 scrol 	  = ( p_scroll != null || p_scroll != 0 ) ? p_scroll : false;
	 status   = ( p_status != null || p_status != 0 ) ? p_status : '';
	 width	  = ( p_width  != null || p_width  != 0 ) ? p_width  : 0;
	 height	  = ( p_height != null || p_height != 0 ) ? p_height : 0; 
	 
	 esquerda = ( screen.width  ) ? ( screen.width  - parseInt( width )  ) / 2 : 0;
	 vtopo	  = ( screen.height ) ? ( screen.height - parseInt( height ) ) / 2 : 0; 

	win 	  = window.open( p_pagina, p_target ,'height='+ height +', width='+ width +', left='+ esquerda + ', top=' + vtopo + ', toolbar=0, location=0,directories=0,status='+ status +',menuBar=0,scrollBars='+ scrol +',resizable=' + resize + '');
	 
	if (!win)
	{
	  alert("Bloqueador de pop-ups detectado! Por favor adicione perrmissão que as popups dejam abertas para esse site.!");
	  return;
	}
	 
	 win.focus(); 
} 

function fnc_fecha_dialog()
{
  var janela = ( window.opener )?window.opener:window.dialogArguments; 

	  janela.location.reload();
	  window.close();
}

fnc_fecha_banner_suspenso = function ()
{
  document.getElementById('banner_suspenso').style.visibility = "hidden";
}

function fnc_download( p_arquivo )
{
  showModal( p_arquivo , 'visualizador');
}

function fnc_preview_pdf( p_arquivo )
{
  //estava _visualizar_pdf ao inves de _blank alterado por Bruno de Brito Soares em 28-09-2006 15:19			
  win = window.open( '' ,'_blank','toolbar=0, location=0,directories=0,menuBar=0,status=0');
  
  if (!win)
  {
    alert("Bloqueador de pop-ups detectado! Por favor adicione perrmissão que as popups dejam abertas para esse site.!");
    return; 
  }
  
  win.window.moveTo(0,0);
  
  if( document.all )
  {
    win.window.resizeTo( screen.availWidth, screen.availHeight );
  } else if ( document.layers||document.getElementById ) {
	if ( win.window.outerHeight < screen.availHeight || win.window.outerWidth < screen.availWidth )
    {
		win.window.outerHeight = screen.availHeight;
		win.window.outerWidth = screen.availWidth;
     }
  }

 if( win.location.href.length == 11 )
   tempo =  setInterval( function() { clearInterval( tempo );  win.location.href = p_arquivo; } , 1000 );
}

function fnc_lista_servidores_servernet()
{
 showModal('/_includes/formularios/servidores.cfm', 'listar_servidores', 0, 0, 0, 580, 280 );
}


function fnc_mostra_alterar_senha()
{
 showModal('/_includes/formularios/altera_senha.cfm', 'alterar_senha', 0, 0, 0, 580, 180 );
}

function fnc_mostra_alterar_email()
{
 showModal('/_includes/formularios/altera_email.cfm', 'dados_email', 0, 0, 0, 580, 110 );
}

function fnc_mostra_dados_usuario()
{
 showModal('/_includes/formularios/altera_dados_usuario.cfm', 'dados_usuario', 0, 0, 0, 580, 245 );
}
