/**
 * Array global de selects a serem ocultados
 */
var arrSelectsOcult = new Array();

/**
 * Mostra caixa de espera com mensagem passada por parametro
 */
function openWaitDialog( strMensagem , intWidth , intHeight , strClassName ) 
{
	if ( intWidth == undefined ) intWidth = 300;
	if ( intHeight == undefined ) intHeight = 100;
	if ( strClassName == undefined ) strClassName = 'alphacube';
	
	Dialog.info
	( 
		strMensagem , 
		{
			windowParameters: {width:intWidth, height:intHeight, className:strClassName, zIndex:100}, 
			showProgress: true 
		}
	);
}

/**
 * Esconde caixa de espera
 */
function closeWaitDialog()
{
	Dialog.closeInfo();
}

/**
 * Cria uma janela de loading enquanto o conteudo da pagina esta carregando
 *
 * @param STRING strMensagem
 * @param INTEGER intWidth
 * @param INTEGER intHeight
 * @param STRING strClassName
 * @return VOID
 */
function openLoadingDialog( strMensagem , intWidth , intHeight , strClassName ) 
{
	// Valores padronizados caso nao sejam informados na chamada da funcao
	if ( strMensagem == undefined ) strMensagem = "Carregando...";
	if ( intWidth == undefined ) intWidth = 300;
	if ( intHeight == undefined ) intHeight = 100;
	if ( strClassName == undefined ) strClassName = 'alphacube';
	
	// Abre a janela com a mensagem ao usuario
	openWaitDialog( strMensagem , intWidth , intHeight , strClassName );
	
	// Fecha a janela( Dialog ) depois que o conteudo e carregado
	execFunctionOnLoadEvent( "closeWaitDialog();" );
}

function confirmDialog( strMensagem , okAction , intWidth , intHeight , strButtonOKLabel , strButtonCancelLabel , strClassName )
{
	if ( intWidth == undefined ) intWidth = 400;
	if ( intHeight == undefined ) intHeight = 100;
	if ( strButtonOKLabel == undefined ) strButtonOKLabel = "OK";
	if ( strButtonCancelLabel == undefined ) strButtonCancelLabel = "CANCELAR";
	if ( strClassName == undefined ) strClassName = 'alphacube';
	
	Dialog.confirm
	(
		strMensagem ,
		{
			windowParameters: {width:intWidth, height:intHeight, className:strClassName, zIndex:100},
			okLabel: strButtonOKLabel,
			cancelLabel: strButtonCancelLabel,
			cancel:function( win ) 
			{
				return( false );
			},
			ok:function( win ) 
			{
				eval( okAction );
				return( true );
			}
		}
	);
}

function yesNoDialog( strMensagem , yesAction , noAction , intWidth , intHeight , strButtonYesLabel , strButtonNoLabel , strClassName )
{
	if ( intWidth == undefined ) intWidth = 400;
	if ( intHeight == undefined ) intHeight = 100;
	if ( strButtonYesLabel == undefined ) strButtonYesLabel = "SIM";
	if ( strButtonNoLabel == undefined ) strButtonNoLabel = "NÃO";
	if ( strClassName == undefined ) strClassName = 'alphacube';
	
	Dialog.confirm
	(
		strMensagem ,
		{
			windowParameters: {width:intWidth, height:intHeight, className:strClassName, zIndex:100},
			okLabel: strButtonYesLabel,
			cancelLabel: strButtonNoLabel,
			cancel:function( win ) 
			{
				if( noAction != undefined )
				{
					eval( noAction );
				}
				return( false );
			},
			ok:function( win )
			{
				if( yesAction != undefined )
				{
					eval( yesAction );
				}
				return( true );
			}
		}
	);
}

function clearDialog( strMensagem , intWidth , intHeight , strClassName )
{
	if ( intWidth == undefined ) intWidth = 300;
	if ( intHeight == undefined ) intHeight = 100;
	if ( strClassName == undefined ) strClassName = 'alphacube';
	
	Dialog.clearDiv
	(
		strMensagem ,
		{
			windowParameters: {width:intWidth, height:intHeight, className:strClassName, zIndex:100}
		}
	);
}

function alerta( strMensagem , intWidth , intHeight , strButtonLabel , strClassName , buttonAction )
{
	if ( intWidth == undefined ) intWidth = 400;
	if ( intHeight == undefined ) intHeight = 100;
	if ( strButtonLabel == undefined ) strButtonLabel = "OK";
	if ( strClassName == undefined ) strClassName = 'alphacube';
	
	Dialog.alert
	( 
		strMensagem , 
		{
			windowParameters: {width:intWidth, height:intHeight, className:strClassName, zIndex:100}, 
			okLabel: strButtonLabel, 
			ok:function( win ) 
			{
				if( buttonAction != undefined )
				{
					eval( buttonAction );
				}
				return( true );
			}
		}
	);
}

function openBackground( strClassName )
{
	if ( strClassName == undefined ) strClassName = 'clear';
	Dialog.info
	( 
		'' , 
		{
			windowParameters: {width:1, height:1, className:strClassName, zIndex:100}
		}
	);
}

function closeBackground()
{
	Dialog.closeInfo();
}