//------------------------------------------------------------------------------
// Inicia os dialogos disponibilizados por este script
//------------------------------------------------------------------------------
YAHOO.namespace("example.container");
//------------------------------------------------------------------------------   
YAHOO.example.container.IniciaDialogos = function() 
{
   //---------------------------------------------------------------------------
   // Confirmação
   //---------------------------------------------------------------------------
   var handleConfirmar  = function() { this.hide(); fnConf(agConf); };
   var handleCancelar   = function() { this.hide(); fnCanc(agCanc); };       
   //---------------------------------------------------------------------------
   YAHOO.example.container.sdComfirma = 
   	new YAHOO.widget.SimpleDialog("sdComfirma", 
   			 { width: "300px",
   			   fixedcenter: true,
   			   visible: false,
   			   draggable: true,
   			   close: false,
   			   modal: true,
   			   text: "O registro que você selecionou é de um evento recorrente. Isto significa que é bem provável que haja outros registros como este em outras datas.<br><br>Selecione abaixo o que você realmente deseja fazer.",
   			   icon: YAHOO.widget.SimpleDialog.ICON_INFO,
   			   effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5},
   			   constraintoviewport: true,
   			   buttons: [ { text:"Confirmar",   handler:handleConfirmar   },                             
                          { text:"Cancelar",    handler:handleCancelar , isDefault:true   } ]      			   
   			 } );       		
   //---------------------------------------------------------------------------
   YAHOO.example.container.sdComfirma.setHeader("Exclusão de registro recorrente");
   YAHOO.example.container.sdComfirma.render("BodyMeusGastos");
   //---------------------------------------------------------------------------
   
   //---------------------------------------------------------------------------
   // Alerta
   //---------------------------------------------------------------------------
   var handleOK  = function() { this.hide(); fnOK(agOK); };       
   //---------------------------------------------------------------------------
   YAHOO.example.container.sdAlerta = 
   	new YAHOO.widget.SimpleDialog("sdAlerta", 
   			 { width: "300px",
   			   fixedcenter: true,
   			   visible: false,
   			   draggable: true,
   			   close: false,
   			   modal: true,
   			   text: "O registro que você selecionou é de um evento recorrente. Isto significa que é bem provável que haja outros registros como este em outras datas.<br><br>Selecione abaixo o que você realmente deseja fazer.",
   			   icon: YAHOO.widget.SimpleDialog.ICON_INFO,
   			   effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5},
   			   constraintoviewport: true,
   			   buttons: [ { text:"Ok",        handler:handleOK  , isDefault:true   } ]      			   
   			 } );       		
   //---------------------------------------------------------------------------
   YAHOO.example.container.sdAlerta.setHeader("Exclusão de registro recorrente");
   YAHOO.example.container.sdAlerta.render("BodyMeusGastos");
   //---------------------------------------------------------------------------        
}
//------------------------------------------------------------------------------
function IniciaDialogos() 
{ 
   YAHOO.example.container.IniciaDialogos();            
}
//------------------------------------------------------------------------------


//------------------------------------------------------------------------------
// Objeto do Yahoo, pronto para exibir tela de confirmação. Pode-se setar
//   * Cabecalho
//   * Corpo
//   * Função ao clicar confirma
//   * Função ao clicar cancela 
//------------------------------------------------------------------------------
var fnConf = '';
var agConf = '';
var fnCanc = '';
var agCanc = '';
//------------------------------------------------------------------------------
function QuestionShow()
{
   YAHOO.example.container.sdComfirma.show();
}
//------------------------------------------------------------------------------
function SetQuestionMsg(titulo, msg)
{
   YAHOO.example.container.sdComfirma.setHeader(titulo);
   html = "   <div style='font-family: verdana; font-size: 11pt; width: 100%;'>      <div style='float:left; width: 36px; height: 36px;'>         <img align=texttop src=\"../../img/questionmark_blue.jpg\" height=\"36\" width=\"36\">      </div>" + msg + "</div>";
   YAHOO.example.container.sdComfirma.setBody(html);   
}
//------------------------------------------------------------------------------
function SetCallbackComfirma(fn, ag)
{
   fnConf = fn;
   agConf = ag;   
}
//------------------------------------------------------------------------------
function SetCallbackCancela(fn, ag)
{
   fnCanc = fn;
   agCanc = ag;
}
//------------------------------------------------------------------------------


//------------------------------------------------------------------------------
// Objeto do Yahoo, pronto para exibir tela de Alerta. Pode-se setar
//   * Cabecalho
//   * Corpo
//   * Função ao clicar OK 
//------------------------------------------------------------------------------
var fnOK = "";
var agOK = "";
//------------------------------------------------------------------------------
function WarningShow()
{
   YAHOO.example.container.sdAlerta.show();
}
//------------------------------------------------------------------------------
function SetWarningMsg(titulo, msg)
{
   YAHOO.example.container.sdAlerta.setHeader(titulo);
   html = "   <div style='font-family: verdana; font-size: 11pt; width: 100%;'>      <div style='float:left; width: 25px; height: 25px;'>         <img align=texttop src=\"../../img/warning.jpg\" height=\"25\" width=\"25\">      </div>" + msg + "</div>";
   YAHOO.example.container.sdAlerta.setBody(html);   
}
//------------------------------------------------------------------------------
function SetCallbackOK(fn, ag)
{
   fnOK = fn;
   agOK = ag;   
}
//------------------------------------------------------------------------------

