<?php

$sNomeIdJConsulta = 'iJan_LstCadSms';
$sNomeIdJEdt_Cad  = 'iJan_EdtCadSms';

$nTmpFrmEnv = 300;
$sCorBarraInf = '#E8E3CE';
//

If ( $sSubModulo=="EDT" ) {
	
} ElseIf ( $sAcao=="FECHAR" ) {	
"parent.document.getElementById('".$sNomeIdJ_Ant."_Travar').style.visibility='hidden';".
	  "parent.Disabled_In_Elems('".$sNomeIdJ_Ant."',false);".
	  $sJavaExePos.
	  'parent.document.getElementById("'.$sNomeIdCampo.'").focus();'.
      "parent.RmElem('".$oJanelaPrinc->sIdObj."');";	
    

//
//

//
//
//  ** CONSULTA **
} Else {
    // Criar objeto Janela
    $oJanelaPrinc = New R_Janela();
    $oJanelaPrinc->sIdObj  = $sNomeIdJConsulta; 
    $oJanelaPrinc->nTop    = 40;
    $oJanelaPrinc->nLeft   = 25;
    $oJanelaPrinc->nWidth  = 1200;   // Largura
    $oJanelaPrinc->nHeight = 0;     // Altura
  	$oJanelaPrinc->nLeft  += ($nTela_W/2)-($oJanelaPrinc->nWidth/2);
    $oJanelaPrinc->sTitulo = 'Envio de SMS';
	//$oJanelaPrinc->sJavOnClick = "document.getElementById('iCadSms_PChave').focus();";
	$oJanelaPrinc->sJavKeyDown = "return Car_".$sNomeAcesso."2.Teclas_F(this,event);";
    //
	$sJavaTravarJ = "parent.document.getElementById('".$oJanelaPrinc->sIdObj."_Travar').style.visibility='visible'; parent.Disabled_In_Elems('".$oJanelaPrinc->sIdObj."',true);";
	$oJanelaPrinc->sJavOnClickF = 
	    $sJavaTravarJ.
		"document.forms.fmPCadSms.acao.value='FECHAR'; ".
		"document.forms.fmPCadSms.submod.value=''; ".
		"document.forms.fmPCadSms.submit();".
		"";
	//
	
    
		
	  // Montagem bairro para a combobox
      $sHTML_Combo_CadBai = '<option value="0">* Bairro/Todos *</option>';
      $Rows = MYSQL_QUERY("SELECT BAI_CODIGOI, BAI_DESCRI FROM cad_bairro ORDER BY BAI_DESCRI ASC;") or die(MYSQL_ERROR());
      While ($Row = MYSQL_FETCH_OBJECT($Rows)) {
         $sHTML_Combo_CadBai .=
	        '<option value="'.$Row->BAI_CODIGOI.'">'.$Row->BAI_DESCRI.'</option>';
      }	
		
		
		
		
	   
       // Tela HTML
       $sRet_TelaJ_HTML =
    	  $oJanelaPrinc->MontaJanHTML(True).
		  '<form name="fmPCadSms" accept-charset="utf-8" method="post" action="./car_js.php" target="car_'.$sNomeAcesso.'4">'.
             '<input name="mod" type="hidden" value="'.$sModulo.'">'.
             '<input name="submod" type="hidden" value="'.$sSubModulo.'">'.
             '<input name="acao" type="hidden" value="">'.
	         '<input name="nomeacs" type="hidden" value="'.$sNomeAcesso.'">'.
	   	  '</form>'.
          '<table width="100%">'.
		     '<tr>'.
   	            '<td width="4px" height="10px" align="left">&nbsp;</td>'.
   	            '<td align="right" width="145px">'.
   	               'Bairro:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '.
   	            '</td>'.
   	            '<td align="left">'.
   	               '<select id="i_Cli_Bairro" style="width:400px;" onchange="Car_'.$sNomeAcesso.'2.P_Atu();">'.
			          $sHTML_Combo_CadBai.
		           '</select>'.
		        '</td>'.
   	          '</tr>'.
		  '</table>'.
          '<table border="0">'.
	            '<tr>'.
                   '<td width="160px" height="26px" valign="middle" align="right">'.
		              'Período que não comprou:'.
				         '&nbsp;&nbsp;'.
		   	      '</td>'.				   
		           '<td valign="middle" align="left">'.
		   	          '<input id="i_Cli_DtNCp" name="Cli_DtNCp" value="" type="text" maxlength="10" style="width:100px;" onchange="Car_'.$sNomeAcesso.'2.P_AtuSms();">'.
		   	          '&nbsp;&nbsp;'.
						  '<img src="images/bimg_calendario.png" border="0" id="bt_Cli_DtNCp" style="cursor:pointer;">'.					   
					   '</td>'.
                '</tr>'.
				'<tr>'.
                   '<td width="160px" height="26px" valign="middle" align="right">'.
		              'Período que comprou:'.
				      '&nbsp;&nbsp;'.
		   	       '</td>'.				   
		           '<td valign="middle" align="left">'.
		   	          '<input id="i_Cli_DtCop"  name="Cli_DtCop" value="" type="text" maxlength="10" style="width:100px;" onchange="Car_'.$sNomeAcesso.'2.P_AtuSms();">'.
		   	          '&nbsp;&nbsp;'.
					  '<img src="images/bimg_calendario.png" border="0" id="bt_Cli_DtCop" style="cursor:pointer;">'.					   
				   '</td>'.
                '</tr>'.
				'<tr>'.
				   '<td>'.
				      '&nbsp;&nbsp;'.
				   '</td>'.
				'</tr>'.
				'<tr>'.
                   '<td width="160px" height="25px" align="right" style="font-size: 12px;">'.
		              'Mensagem:'.
					  '&nbsp;&nbsp;'.
					  '<br>'.
					  '<span style="color:#FF0000;">'.
					     'Máximo 150 caracteres'.
					     '&nbsp;&nbsp;'.
					  '</span>'.
                   '</td>'.
				   '<td height="" align="left" style="font-size: 12px;">'.
				      '<textarea id="SMS_Mensagem" name="SMS_Mensagem" cols="110" rows="10" style="width:100%; height:60px; background:#FFFBEC; border-width:1px; border-style:solid; border-color:#0099FF;">'.
				      '</textarea>'.
		              '<br>'.
				      '<br>'.
				   '</td>'.
			    '</tr>'.
				'<tr>'.
                   '<td>'.
				      '<div id="dvQdrLis_SMS">'.
			          '</div>'.
			       '</td>'.
       	        '</tr>'.
			 '</table>'.
		  '</form>'.
	      //
		  '<div id="Qdr_LisSms_Agd" style="width:100%; height:410px;" align="center">'.
             '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">'.
                '<tr>'.
			       '<td align="center" valign="middle" style="color:#555555;">'.
                      'Aguarde um momento...<br>'.
                      '<img src="images/img_load1.gif" border="0">'.
                   '</td>'.
				'</tr>'.
             '</table>'.
		  '</div>'.
		  '<table width="100%" style="background-color:'.$sCorBarraInf.';">'.
		     '<tr>'.
       	        '<td width="4px" height="40px" align="left">&nbsp;</td>'.
       	      	'<td>'.
       	        '</td>'.
       	        '<td width="120px" align="left">'.
       	           HTML_Botao( 3, 'CadCSms_BT_Fch', $oJanelaPrinc->sJavOnClickF
                               , 'Sair' ,'images/btimg_fechar.png').
       	        '</td>'.
       	     '</tr>'.
		  '</table>'.
		  $oJanelaPrinc->MontaJanHTML(False);
       
	   
	   //
       // Javascript anterior
       $sRet_Javs .=
	      "";
	  
       $sRet_JavsPos .=
	      "var Fm  = parent.document.forms.fmPCadSms;".
	      "var Fm2 = parent.document.forms.fmPCadSms2;".
		  "function Puxar_Sms() {".
		     "Fm.acao.value = 'PUXAR_SMS';".
			 "Fm.submit();".
		     "Fm.acao.value = '';".
		  "}".
          "Puxar_Sms();".
		  'parent.Calendar.setup({ '.
            'inputField : "i_Cli_DtNCp", '.
            'trigger    : "bt_Cli_DtNCp", '.
            'onSelect   : function() { this.hide();  }, '.
            'showTime   : 0, '.
            'dateFormat : "%d/%m/%Y" '.
          '});'.
	     'parent.Calendar.setup({ '.
            'inputField : "i_Cli_DtCop", '.
            'trigger    : "bt_Cli_DtCop", '.
            'onSelect   : function() { this.hide();  }, '.
            'showTime   : 0, '.
            'dateFormat : "%d/%m/%Y" '.
          '});'.
	     
		  "";		  

	      //
		  '<table width="100%" style="background-color:'.$sCorBarraInf.';">'.
		     '<tr>'.
       	        '<td width="4px" height="40px" align="left">&nbsp;</td>'.
       	   	    '<td>'.
       	        '</td>'.
       	        '<td width="120px" align="left">'.
       	           HTML_Botao( 3, 'CadCSms_BT_Fch', $oJanelaPrinc->sJavOnClickF
                                , 'Sair (ESC)' ,'images/btimg_fechar.png').
       	        '</td>'.
       	     '</tr>'.
		  '</table>'.
    	  $oJanelaPrinc->MontaJanHTML(False);
       //
       $sRet_Javs .=
	      "function P_Atu() {".
		     "parent.document.forms.fmPCadSms.acao.value='LISTAR'; ".
			 "setTimeout( function() { parent.document.forms.fmPCadSms.submit(); }, 100);".
		  "}".
		  'parent.document.getElementById("dv_MenuL_Barra").style.visibility="hidden";'.
	      '';
       // Java posterior
       $sRet_JavsPos .=
	      "function P_Atu() {".
		     "parent.document.forms.fmPCadSms.acao.value='LISTAR'; ".
			 "setTimeout( function() { parent.document.forms.fmPCadSms.submit(); }, 100);".
		  "}".
		  
		  
		  "P_Atu();".
		  //
		  "function Teclas_F( Objeto, Evento ) {".
             "vNumTecla = parent.Tecla_Apertada(Evento);".
             "if ( vNumTecla==117) { ".        //  ** [F6] **          // (Novo)
                 
		     "} else if ( vNumTecla==116) { ".  // ** [F5] **         Não atualizar
                 //
		     "} else if ( vNumTecla==118) { ". //  ** [F7] **          // (Editar)
                 
		     "} else if ( vNumTecla==119) { ". //  ** [F8] **          // (Inativar)
                 
		     "} else if ( vNumTecla==122) { ". //  ** [F11] **         // (Ferramenta de correção de bairros)
              
		     "} else if ( vNumTecla==27) { ".  //  ** [ESC] **         // (SAIR)
                  "setTimeout( parent.document.getElementById('CadCSms_BT_Fch').onclick , 100);".
			 "} else {".
		          "P_TeclasPress_fm(Evento);".
			      "return true;".
			 "}".
			 "return false;".
		  '}'.
		  //
    	  "";
    
}

?>