<?php ob_start(); ?>
<?php //if(file_exists('../cfg/res.php')){include('../cfg/res.php');} ?>	
<?php //if(file_exists('../cfg/config.php')){include('../cfg/config.php');}?>	


<?php if(empty($pidtxt)){$pidtxt=$pcaption;}?>
<?php if(empty($ponblur)){$ponblur="";}?>
<?php if(empty($ponclick)){$ponclick="";}?>
<?php if(empty($pnotob)){$pnotob="";}?>
<?php if(empty($pcaption)){$caption="";} ?>
<?php if(empty($ptitle)){$ptitle="";} ?>
<?php if(empty($pobj)){$pobj=3;} ?>
<?php if(empty($psize)){$psize=12;} ?>
<?php if(empty($pdocu)){$pdocu="";}?>
<?php if(empty($pnumero)){$pnumero="";}?>
<?php if(empty($pidnum)){$pidnum="";}?>
<?php if(empty($piddet)){$piddet="";}?>
<?php if(empty($phide)){$phide=0;}?>
<?php if(empty($pdescri)){$pdescri="";}?>
<?php if($pabrev!=""){$psize=$psize-4;} ?>
<?php if($pabrev!="" and $ptitle==""){$ptitle=$pcaption;} ?>
<?php if($mobile=='true'){$ptitle="";} ?>

<?php if(empty($pclass) and substr($pidtxt,4,1)=='_'){$pclass=substr($pidtxt,0,4);}?>
<?php if(empty($pclass) and substr($pidtxt,5,1)=='_'){$pclass=substr($pidtxt,0,5);}?>
<?php if(empty($pclass)){$pclass="button1";}?>

<?php if($pobj>5){$pobj=3;} ?>
<?php //$pcaption=str_replace(' ','&#13;&#10;',$pcaption) ?>
<?php $ponclick=str_replace('"',"'",$ponclick); ?>

	<div width="100%" align="center">
        <?php //if(mb_stristr(strtoupper($pcaption),'GRABA')){echo 'accesskey="g"';} ?>
         
      <div
         id="<?php echo $pidtxt; ?>"
         class="btn1 <?php echo ($pclass); ?> <?php if($pabrev==''){echo ' noabrev ';}else{echo ' abrev ';} ?>" 
         onClick="
							 		<?php if (!mb_stristr($pclass,'mnu') and !mb_stristr($pclass,'menu') and !mb_stristr($pclass,'onoff') and $pabrev==''){ ?>
 									{this.setAttribute('disabled','disabled');} 
				 					<?php } ?>
		 							_clickbtn(this.id); 
									<?php echo $ponclick;?>;
									<?php if(mb_stristr(strtoupper($pcaption),'GRABA')){ ?> 
									{this.innerHTML='Grabando';}
									{this.style.color='black';}
				 					<?php } ?>
									<?php if(mb_stristr(strtoupper($pcaption),'AGREGA')){ ?> 
									{this.innerHTML='Agregando';}
									{this.style.color='black';}
				 					<?php } ?>
							 		<?php if (!mb_stristr($pclass,'mnu') and  !mb_stristr($pclass,'menu') and !mb_stristr($pclass,'onoff') and $pabrev==''){ ?>
									{setTimeout(function rd(){if(document.getElementById('<?php echo $pidtxt; ?>')){document.getElementById('<?php echo $pidtxt; ?>').removeAttribute('disabled');this.innerHTML='<?php echo $pcaption; ?>';}},2000);} 
				 					<?php } ?>
									"	
         <?php if(1==2){ ?>
				 onmouseover="
											{document.getElementById('<?php echo $pidtxt; ?>').value='<?php if($pabrev==''){echo $pcaption;}else{echo $pabrev;} ?>';}
											<?php if(mb_stristr(strtoupper($pcaption),'GRABA')){ ?>
											{document.getElementById('<?php echo $pidtxt; ?>').style.color='snow';}
											{document.getElementById('<?php echo $pidtxt; ?>').style.backgroundColor='darkgreen';}
											<?php } ?>
											<?php if(mb_stristr(strtoupper($pcaption),'AGREGA')){ ?>
											{document.getElementById('<?php echo $pidtxt; ?>').style.color='snow';}
											{document.getElementById('<?php echo $pidtxt; ?>').style.backgroundColor='darkgreen';}
											<?php } ?>
											<?php if(mb_stristr(strtoupper($pcaption),'ACEPTA')){ ?>
											{document.getElementById('<?php echo $pidtxt; ?>').style.color='snow';}
											{document.getElementById('<?php echo $pidtxt; ?>').style.backgroundColor='darkgreen';}
											<?php } ?>
											"
          <?php } ?>
         <?php //if($pabrev=='' and !mb_stristr($pclass,'onoff')){ ?>
			   <?php if (!mb_stristr($pclass,'mnu') and  !mb_stristr($pclass,'menu') and !mb_stristr($pclass,'onoff') and $pabrev==''){ ?>
				 onmouseover="
											{this.innerHTML='<?php if($pabrev==''){echo $pcaption;}else{echo $pabrev;} ?>';}
											<?php if(mb_stristr(strtoupper($pcaption),'GRABA')){ ?>
											{this.style.color='snow';}
											{this.style.backgroundColor='darkgreen';}
											<?php } ?>
											<?php if(mb_stristr(strtoupper($pcaption),'AGREGA')){ ?>
											{this.style.color='snow';}
											{this.style.backgroundColor='darkgreen';}
											<?php } ?>
											<?php if(mb_stristr(strtoupper($pcaption),'ACEPTA')){ ?>
											{this.style.color='snow';}
											{this.style.backgroundColor='darkgreen';}
											<?php } ?>
											"
          <?php } ?>

         <?php
				 		if($mobile=='false')
							{
// 								if (!mb_stristr($pclass,'mnu') and !mb_stristr($pclass,'menu') and !mb_stristr($pclass,'action'))
// 								{echo 'tabIndex="-1"';}
//                         else
                        if(mb_stristr(strtoupper($pcaption),'GRABA'))
                        {
                           echo 'tabIndex="0"';
                        }
                     
                     
							}
				 ?>
         style="
                <?php echo $pstyle; ?>
                <?php if($phide==1){echo 'display:none;';} ?>
								<?php if($ponclick==''){echo 'border-radius:2px;border-color:black;border-width:thin;';}
// 										else{echo 'border-radius:0px;';} 
                ?>
								<?php if (mb_stristr($pclass,'mnu') or mb_stristr($pclass,'menu')){?>
                  text-transform:uppercase;
                  border-style:outset;
                  border-width:3px;
                  border-radius:10px;
								<?php } ?>
                <?php //if($pwrap==0){echo 'white-space:nowrap;';} ?>
								<?php if($pabrev=="")
                    {
                      if($pwrap==0 and mb_stristr($pcaption,' ')){echo 'white-space:nowrap;';}                    
//                       echo 'border-width:3px;';
//                       echo 'border-style:outset;';
//                       echo 'padding:2px;';
//                       echo 'width:90%;';
//                       echo 'height:100%;';
											echo 'font-size:'.$psize.'px;';
                    }
                  else
                    {
                      echo 'width:'.($psize*2).'px;';
                      echo 'height:'.($psize*1.4).'px;';
                      if($mobile=='true'){echo 'font-size:'.($psize*0.8).'px;';}
                      else{echo 'font-size:'.($psize*1.25).'px;';}
                    } 
                ?>
								<?php if ($ppict!='') {echo 'width:'.($psize*strlen($pcaption)*.70).'px;';}?>
								<?php if ($ppict!='') {echo 'height:'.($psize*strlen($pcaption)*.70).'px;';}?>
								<?php echo 'max-width:'.($psize*10).'px;'; ?>
								<?php if(mb_stristr(strtoupper($pcaption),'INICIAR'))	{echo 'color:snow;background-color:#0B0B60;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'CERRAR'))	  {echo 'color:snow;background-color:#B40404;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'SALIR'))		{echo 'color:snow;background-color:darkred;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'ANULA'))		{echo 'color:darkred;background-color:snow;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'ELIMINA'))	{echo 'color:snow;background-color:darkred;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'REMOVER'))	{echo 'color:darkred;background-color:snow;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'ACEPTA'))	  {echo 'color:snow;background-color:darkgreen;';} ?>
								<?php //if(mb_stristr(strtoupper($pcaption),'CONSULTA')) {echo 'color:snow;background-color:seagreen;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'GRABA'))		{echo 'color:snow;background-color:darkgreen;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'AGREGA'))		{echo 'color:snow;background-color:darkgreen;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'XFIRMA'))		{echo 'color:snow;background-color:#76A4CC;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'EDITA'))    {echo 'color:snow;background-color:steelblue;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'MODIFICA')) {echo 'color:snow;background-color:steelblue;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'IMPRIM'))   {echo 'color:black;background-color:gold;';} ?>
								<?php if(strtoupper($pcaption)=='O'){echo 'color:snow;background-color:darkred;';} ?>
								<?php if(strtoupper($pcaption)=='X'){echo 'color:snow;background-color:darkred;';} ?>
								<?php if(strtoupper($pcaption)=='OK'){echo 'color:snow;background-color:darkgreen;';} ?>
								" 
         title="<?php echo ($ptitle) ?>" 
         <?php if(1==2){ ?>
         abrev="<?php //echo ($pabrev) ?>" 
         value="<?php //if($pabrev==''){echo ($pcaption);}else{echo $pabrev;} ?>" 
         <?php } ?>
         >
     <?php if($pabrev==''){echo $pcaption;}else{echo $pabrev;}?>
   </div>
		<?php if ($pcaptcha==1 and 1==1){ ?>
		<?php	//$captcha=captcha(); ?>
<!-- 		<img src="lib/<?php //echo $captcha;?>" width="160" height="50"> -->
		<?php } ?>
  </div>

	<div>
		<span id="<?php echo $pidtxt; ?>_error" class="txt_error" style="color:red;"></span>
	</div>

	<?php if (mb_stristr($pclass,'mnu') or  mb_stristr($pclass,'menu')) { ?>
	<div id="<?php echo $pidtxt; ?>_contenido" style="display:none;">
	</div>
	<?php } ?>

<?php if($mobile=='true'){ ?><div class="" style="height:50px;"></div><?php } ?>


<?php $ponclick='';?>
<?php $pcaption='';?>
<?php $pcaptcha=0;?>
<?php $ptabla='';?>
<?php $pclass='';?>
<?php $pidtxt='';?>
<?php $plong='';?>
<?php $pobj=0;?>
<?php $ponblur='';?>
<?php $pnotob='';?>
<?php $pdefa='';?>
<?php $psize=0;?>
<?php $ppict='';?>
<?php $pdocu='';?>
<?php $pidnum='';?>
<?php $piddet='';?>
<?php $pdescri='';?>
<?php $pabrev='';?>
<?php $ptitle='';?>
<?php $phide='';?>
<?php $pstyle='';?>

<?php $obstart = ob_get_clean(); ?>
<?php //echo $pcaption; ?>
<?php if(function_exists('limpiahtml')){?> 
<?php $obstart=limpiahtml($obstart); ?>
<?php } ?>
<?php echo $obstart; ?>
