<?php ob_start(); ?>
<?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($pdescri)){$pdescri="";}?>
<?php if(empty($pwrap)){$pwrap=0;}?>
<?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">
  <div
         id="<?php echo $pidtxt ?>"
         class="btn1 <?php echo ($pclass) ?>" 
	       onClick="
							 		<?php if (!mb_stristr($pclass,'mnu') and !mb_stristr($pclass,'menu') and !mb_stristr($pclass,'onoff')){ ?>
 									{document.getElementById('<?php echo $pidtxt ?>').setAttribute('disabled','disabled');} 
				 					<?php } ?>
		 							_clickbtn('<?php echo $pidtxt ?>'); 
									<?php echo $ponclick;?>;
									<?php if(mb_stristr(strtoupper($pcaption),'GRABA')){ ?> 
									{document.getElementById('<?php echo $pidtxt ?>').innerHTML='Grabando';}
									{document.getElementById('<?php echo $pidtxt ?>').style.color='black';}
				 					<?php } ?>
									<?php if(mb_stristr(strtoupper($pcaption),'AGREGA')){ ?> 
									{document.getElementById('<?php echo $pidtxt ?>').innerHTML='Agregando';}
									{document.getElementById('<?php echo $pidtxt ?>').style.color='black';}
				 					<?php } ?>
							 		<?php if (!mb_stristr($pclass,'mnu') and  !mb_stristr($pclass,'menu') and !mb_stristr($pclass,'onoff')){ ?>
									    {setTimeout(function rd()
                        {
                          if(document.getElementById('<?php echo $pidtxt ?>'))
                          {
                            document.getElementById('<?php echo $pidtxt ?>').removeAttribute('disabled');
                            document.getElementById('<?php echo $pidtxt ?>').innerHTML='<?php if($pabrev==''){echo $pcaption;}else{echo $pabrev;}  ?>';
                          }
                        },3000);
                      } 
				 					<?php } ?>
									"	
				 onmouseover="
											{document.getElementById('<?php echo $pidtxt ?>').innerHTML='<?php if($pabrev==''){echo $pcaption;}else{echo $pabrev;} ?>';}
											<?php if(mb_stristr(strtoupper($pcaption),'GRABA')){ ?>
											{document.getElementById('<?php echo $pidtxt ?>').innerHTML='<?php echo $pcaption;?>';}
											{document.getElementById('<?php echo $pidtxt ?>').style.color='white';}
											{document.getElementById('<?php echo $pidtxt ?>').style.backgroundColor='green';}
											<?php } ?>
											<?php if(mb_stristr(strtoupper($pcaption),'AGREGA')){ ?>
											{document.getElementById('<?php echo $pidtxt ?>').innerHTML='<?php echo $pcaption;?>';}
											{document.getElementById('<?php echo $pidtxt ?>').style.color='white';}
											{document.getElementById('<?php echo $pidtxt ?>').style.backgroundColor='green';}
											<?php } ?>
											<?php if(mb_stristr(strtoupper($pcaption),'ACEPTAR')){ ?>
											{document.getElementById('<?php echo $pidtxt ?>').style.color='white';}
											{document.getElementById('<?php echo $pidtxt ?>').style.backgroundColor='green';}
											<?php } ?>
											"
				 <?php
				 		if($mobile=='false')
							{
								if (!mb_stristr($pclass,'mnu') and !mb_stristr($pclass,'menu'))
								{echo 'tabIndex="-1"';}
							}
				 ?>
         style="
                <?php if($phide==1){echo 'display:none;';} ?>
								<?php if($pabrev==""){echo 'border-style:outset;';}else{echo 'border-style:solid;';} ?>
								<?php if($pabrev==""){echo 'border-width:3px;';}else{'border-width:2px;';} ?>
								<?php if($ponclick=='' or $pabrev!=""){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=="")
                    {echo 'font-size:'.$psize.'px;';}
                    else
                    {
                      if($mobile=='true'){echo 'font-size:'.($psize*0.8).'px;';}
                      else{echo 'font-size:'.($psize*1.25).'px;';}
                    } 
                ?>
								<?php if($pabrev==""){echo 'padding:2px;';}else{echo 'padding:0px;';} ?>
								<?php if($pabrev==''){echo 'width:100%';}else{echo 'width:'.($psize*2).'px';}?>;
								<?php if($pabrev==''){echo 'height:100%';}else{echo 'height:'.($psize*1.4).'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:white;background-color:#0B0B60;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'CERRAR'))   {echo 'color:white;background-color:#B40404;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'SALIR'))		{echo 'color:white;background-color:red;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'REMOVER'))	{echo 'color:red;background-color:white;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'ELIMINA'))	{echo 'color:white;background-color:red;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'ANULA'))		{echo 'color:red;background-color:white;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'ACEPTA'))   {echo 'color:white;background-color:green;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'CONSULTA')) {echo 'color:white;background-color:green;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'GRABA'))		{echo 'color:white;background-color:green;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'AGREGA'))		{echo 'color:white;background-color:green;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'XFIRMA'))		{echo 'color:white;background-color:#76A4CC;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'MODIFICA')) {echo 'color:white;background-color:blue;';} ?>
								<?php if(mb_stristr(strtoupper($pcaption),'IMPRIM'))   {echo 'color:black;background-color:yellow;';} ?>
								<?php if(strtoupper($pcaption)=='X'){echo 'color:white;background-color:red;';} ?>
								<?php if(strtoupper($pcaption)=='O'){echo 'color:red;background-color:white;';} ?>
								<?php if(strtoupper($pcaption)=='OK'){echo 'color:white;background-color:green;';} ?>
								" 
         title="<?php echo ($ptitle) ?>" 
         abrev="<?php echo ($pabrev) ?>" 
         value="<?php if($pabrev==''){echo ($pcaption);}else{echo $pabrev;} ?>" 
         href="<?php echo ($phref) ?>" 
       ><?php if($pabrev==''){echo ($pcaption);}else{echo $pabrev;} ?></div>
    </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 $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=0;?>

<?php $obstart = ob_get_clean(); ?>
<?php //$obstart=limpiahtml($obstart); ?>
<?php echo $obstart; ?>
