<?php use_helper('UrlFunctions'); ?>
<?php use_helper('UtilFunctions'); 

//echo $idbanco."-----------";


$o_ArBancoFN = new ArBancoFN();
$o_ArBancoFN->setIdbanco($idbanco);
$o_ArBancoBN = $o_ArBancoFN->selectByPK();
?>
<script>

acutalizarEspecialidad = function(destino,elm){
  $(destino).options.length = 1;
  var url = '<?=buildUrl('ajax/request')?>';
  var pars = 'type=getEspecialidad&nombreElm='+destino+'&value='+elm.value;
  
	var myAjax = new Ajax.Request(
                            		url, 
                            		{
                            			method: 'get', 
                            			parameters: pars, 
                            			onComplete: actualizaJSON
                            		});
}

</script>
<script>
actualizaJSON = function(request, json){
  var numeroElementos = json.length;
  for (var i = 0; i < numeroElementos; i++){
    if($(json[i][0])){
  	  switch ($(json[i][0]).tagName){
  	    case 'TD'      : Element.update(json[i][0], json[i][1]); break;
  	    case 'INPUT'   : $(json[i][0]).value=json[i][1]; break;
  	    case 'SELECT'  : 
  	      var objDDL = $(json[i][0]);
  	      if(typeof(cont) == 'undefined'){
  	        var cont = 0;
  	        objDDL.options.length = 1;
  	      }
  	      var a_contentValues = json[i][1].split("_;_");
      		var value	= a_contentValues[0];
      		var text	= a_contentValues[1];
  	      var option	= new Option(text,value);
      		try{
      			objDDL.add(option,null);
      		}catch (e){
      			objDDL.add(option,-1);
      		}
  	      cont++;
  	    break;
  	  }
    }else{
      if(json[i][0].indexOf("function") > -1){
        eval("scriptEval = "+json[i][0]);
        scriptEval();
      }
    }
  }
}
</script>
<?php
function eliminar_acento ( $cadena )
{
    $originales  = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ';
    $modificadas = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr';
    $cadena = utf8_decode($cadena);
    $cadena = strtr($cadena, utf8_decode($originales), $modificadas);
    $cadena = strtolower($cadena);
    return utf8_encode( stripAccents( $cadena ) );
}
function stripAccents( $string )
{
    return strtr($string,'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ','aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
}
$s_User = myUser::getUser()->getUserId();
if(isset($control)){
	
 //SE GUARA EL ARCHIVO
	
 	
    $o_ArBancoDP = new ArBancoDP();

    
    $o_ArBancoDP->setDescripcion($Descripcion);
    $o_ArBancoDP->setEstado( $cboEstado );
    $o_ArBancoDP->setFecharegistro( date( "Y-m-d H:i:s" ) );
    $o_ArBancoDP->setUsuarioregistro( $s_User );
    $b_Result = $o_ArBancoDP->save();
  	$bResult = 1;
	if($bResult){
		
				?>
			    <script language="JavaScript">
			    //parent.recargarApp();
			    parent.objMainTab.reqBody('<?=buildUrl('bancocta/list','')?>','&block=001&insert=1&id=<?=$idbanco?>');
				parent.objMainTab.windowsCloseAll();
			    </script>
			    <?php
			
		
	}
}
    


?>
<img src="/images/common/spacer.gif" width="10">
<table class="cuerpo" width="98%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="0">
		  <table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
			  <td class="titleBody">
				<li>Nuevo Banco</li>
				</td>
			  <td align="right" valign="baseline">&nbsp;</td>
			</tr>
		  </table>
		</td>
	</tr> 
	<tr>
		<td valign="top">
			<form id="form1" name="form1" method="POST"  enctype="multipart/form-data">
				<input type="hidden" name="control" value="1">
				<table hspace="5px" class="marco" width="99%">
					<tr>
						<td valign="top">
							<table hspace="1px"  width="100%" style="border:1px solid #d3d3d3; min-height:220px">
								<tr>
									<td height="0">
								 
										<table width="100%" cellpadding="5" border="0">
                                                      
                                            <tr>
                                                <td width="12%"><label class="label">Descripcion </label></td>
                                                <td><input class="text required" id="Descripcion" name="Descripcion" size="40" type="text" class="text" value=""/></td>
                                            </tr>
                                            
                                            <tr>
                                                <td><label class="label" >Estado</label></td>
                                                <td>
                                                    <select name="cboEstado" id="cboEstado" type="text" class="combo"/> 
                                                       
                                                        <option value="A" >Activo</option>
                                                        <option value="I" >Inactivo</option>
                                                    </select>
                                                </td>
                                            </tr>
										</table>
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
										  <tr>
											 <td><img src="/images/common/spacer.gif" width="10"></td>
										  </tr>
										  <tr>
											<td align="center">
											  <input type="hidden" name="typeSubmit" id="typeSubmit">
											  <input class="button" type="submit" name="submit" id="submit" value="Grabar" onclick="$('typeSubmit').value='list';">
											  <input class="button" type="button" value="Cancelar" onclick="parent.objMainTab.windowsCloseAll();"/>
											</td>
										  </tr>
										  <tr>
											<td height="10">&nbsp;</td>
										  </tr>
										</table>
										
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
				
				
				 
			</form>
			
				<script type="text/javascript">
			
					
					
					Validation.add('file_pdf', 'Debe de ingresar formato pdf.', function (v) {
					     return Validation.get('IsEmpty').test(v) ||  /^(.*[.](?:pdf)$).*/i.test(v)
					});
					
					 var valid = new Validation( 'form1', { immediate : true } );
		               
		         
       
				</script>
		</td>
	</tr>
</table>
