<?php use_helper('UrlFunctions'); 
$s_Param = '';
if( isset( $id ) )
{
    $s_Param2 = 'id='.$id;
}?>
<script>
findControl = function(){
  
  concatValueStr();
  
}

exportFindControl = function(action){
  strFormSerialize = returnQueryStringForm();
  executeFind(strFormSerialize, action);
}

executeFind = function(str, action){
  if(typeof(action) == 'undefined'){
	  url = "<?=buildUrl('empresa/gridcol', "block=".$block)?>";
	}else{
	  switch (action){
	    case 'excel': parent.objMainTab.reqBody('<?=buildUrl('empresa/excel')?>','001&'+str); break;
	    case 'pdf': parent.objMainTab.reqBody('<?=buildUrl('empresa/pdf')?>','001&'+str); break;	    
	  }
	  
	  return;
	}
  //str = str + '&block=001';
  url = "<?=buildUrl('empresa/gridcol', "block=".$block)?>";
	var myAjax  = new Ajax.Updater(
                                	"resultGrtid",
                                	url,
                                	{
                                		asynchronous:	true,
                                		method			: 'get',
                                		parameters	: str,
                                		evalScripts	: true,
                                		onLoading   : cargandoImagenSerch(),
                                		onComplete	: function(){
                                			//objMainTab.showMenu();
                                		}
                                	});
}

concatValueStr = function(){
  strFormSerialize = returnQueryStringForm();
  if(arguments[0]){
    strFormSerialize += '&'+arguments[0];
  }
  executeFind(strFormSerialize);
}

function returnQueryStringForm(){
  cadenaFormulario = $('form1').serialize();
             var posicion = new Array();
             var a_pars = new Array();
             var miArray = new Array();
             posicion=[];
             a_pars=[];
             miArray=[];
             miArray = cadenaFormulario.split('&');
             x=0;
             for (i = 0; i < miArray.length; i++){
            	   posicion[i] = miArray[i].indexOf('=');
            	   if(typeof(miArray[i-1])!='undefined'){
            				if(miArray[i].substring(posicion[i],0)== miArray[i-1].substring(posicion[i-1],0) ){
           					 porcion = miArray[i].substring((1+posicion[i]));
           					 a_pars[x-1]+='@'+porcion;
           				}else{
          					 a_pars[x]= miArray[i];
         					 x++;
          				}
          		}else{
          			 a_pars[x]= miArray[i];
          			  x++;
          		}
           }
  cadenaFormulario = a_pars.join('&');
  cadenaFormulario += '&id_form=frmFindFedu';
  return(cadenaFormulario);
}

function cargandoImagenSerch(){
	//disabledWin.setPathImage('/images/common/progress.gif');
	disabledWin.show(true,true,'resultGrtid');
}

</script>
<script>
findControl = function(){
  
  var pars = $('form1').serialize();
  
	disabledWin.setPathImage('/images/common/progress.gif');
	disabledWin.show(true,true,'resultGrtid');
  
	url = "<?=buildUrl('empresa/gridcol', "block=".$block)?>";
	var myAjax  = new Ajax.Updater(
	"resultGrtid",
	url,
	{
		asynchronous:	true,
		method			: 'get',
		parameters	: pars,
		evalScripts	: true,
		onLoading		: function(){
			//$('contentMenu').innerHTML = $('messageLoadMenu').innerHTML;
		},
		onComplete	: function(){
			//objMainTab.showMenu();
		}
	});
  
}

deleteRegistro = function(id,numero){
  //buildUrl('empresa/delete/id/'block=001'
  if(confirm("Esta seguro de eliminar el Telefono con : "+numero+ " ?")){
      //objMainTab.reqBody('<? //=buildUrl('empresa/add')?>','block=001&delete=1&id='+id);   
      parent.objMainTab.reqBody('<?=buildUrl('empresa/deleteDocEquifax')?>','&delete=1&cod=jj&id='+id+'&idCliente=<?php echo $id;?>');
  }
  
}

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();
      }
    }
  }
}
abrirVentanaVer = function( i_idempresacolaborador, i_idcolaborador)
{

    parent.objMainTab.modalDialog( '<?php echo buildUrl('empresa/delete', $s_Param) ?>idempresacolaborador/' + i_idempresacolaborador+'/idcolaborador/'+i_idcolaborador , { width:500, height:150 } );
};
abrirVentanaEditar = function( i_IdTipoFile, i_Tipo )
{

    parent.objMainTab.modalDialog( '<?php echo buildUrl('empresa/editcta', $s_Param) ?>idcta/' + i_IdTipoFile , { width:500, height:250 } );
};
recargarApp = function()
{
    location.href = "<?php echo buildUrl( 'empresa/listEquifax', $s_Param2 ) ?>";
};
</script>
<?php

$o_PlaEmpresaFN = new PlaEmpresaFN();
$o_PlaEmpresaFN->setIdempresa($id);
$a_o_PlaEmpresaFN = $o_PlaEmpresaFN->select();




if(is_array($a_o_PlaEmpresaFN)){
  while(list($key,$o_ObjectBean) = each($a_o_PlaEmpresaFN)){
?>

<table class="cuerpo" width="100%" border="0" cellpadding="0" cellspacing="0">
 
  <tr>
    <td valign="top">
     <form id="form1" name="form1" method="POST">
      <input type="hidden" value="<?php echo $id;?>" name="id" />
      <input type="hidden" name="control" value="1">
      	<?php
	    $s_Param = '';
	    if( isset( $id ) )
	    {
	        $s_Param = 'id='.$id;
	    }
	    ?>
	    <table id="tabShowScan" cellpadding="0" cellspacing="0" class="" style="margin-top: 5px;">
            <tr>
              <td class="mnuInactivoIzq" type='maintTabguiaGeneral'><img src="/images/common/spacer.gif" width="7"></td>
              <td class="mnuInactivoTxt" type='maintTabguiaGeneral' nowrap onclick="location.href='<?php echo buildUrl('empresa/editempresa', $s_Param) ?>';">Empresa</td>
              <td class="mnuInactivoDer" type='maintTabguiaGeneral'><img src="/images/common/spacer.gif" width="10"></td>
			  
              <?php if( isset( $id ) && $id != "" ){ ?>
              <td class="mnuActivoIzq" type='maintTabguiaGeneral'><img src="/images/common/spacer.gif" width="7"></td>
              <td class="mnuActivoTxt" type='maintTabguiaGeneral' nowrap onclick="location.href='<?php echo buildUrl('empresa/listcol', $s_Param) ?>';">Colaboradores</td>
              <td class="mnuActivoDer" type='maintTabguiaGeneral'><img src="/images/common/spacer.gif" width="10"></td>
              <td class="mnuSep"><img src="/images/common/spacer.gif"></td>
        <?php } ?>
            </tr>
        </table>
	    
        <table 
	     class="marco" width="96%">
          <tr>
            <td valign="top">
	
              <table width="100%" border="0" cellpadding="5" cellspacing="0" style="background: #E3E9E2">
          		<tr>
    				  <td height="0">
    				  
    					 <table width="100%" border="0" cellspacing="6" cellpadding="0">
    					 	<tr>
	    					 	<td colspan="2">
	    					 			
    									
				    					 	<table cellpadding="2" cellspacing="0">
				    					 		  <tr>
													<td nowrap="nowrap" width="10%" class="cabecera"><label class="label1 req" for="txtDniCliente" >Empresa </label></td>
													<td colspan="5" nowrap="nowrap"><label class="label1"><?php echo $o_ObjectBean->getDescripcion();?></label></td>
													 
													 
												   </tr>
												  
											  
											  </table>
										
    									
										<fieldset  style="background:#ffffff">
    										<legend class="fielsettex"><I></I></legend>
    										<table border="0" cellpadding="0" cellspacing="0" width="100%" >
									        <tr>
									          <td class="titleBody" background="#FFFFFF" ><li>&nbsp;&nbsp;Lista de Colaboradores </li></td>
									          <td align="right" valign="baseline">
									          	<input type="button" class="button"  value="Nuevo colaborador" src="/images/common/buttons/btnAdd.gif" onClick="parent.objMainTab.modalDialog('<?=buildUrl('empresa/addcol',"idempresa=".$id)?>',{ width:800, height:350 })" style="cursor:pointer">
									          </td>
									        </tr>
									      </table>
				    					 	
										</fieldset> 
								  </td>
							  </tr>
							  
							  <tr>
	    					 	<td colspan="2" style="background:#ffffff">
	    					 		 <div id="resultGrtid">
      								</div>
								  </td>
							  </tr>
						</table>
    							
    				</td>
                </tr>
    			<tr>
    			
  				  <td height="0" width="100%">
				   
    			 	 
  				   <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="button" value="Anterior" onclick="location.href='<?=buildUrl('empresa/editempresa', $s_Param)?>'"/>
						   <input class="button" type="button" value="Cancelar" onclick="location.href='<?=buildUrl('empresa/list','&block=002')?>'"/>
						  </td>
						</tr>
						<tr>
					<td height="10">&nbsp;</td>
				 </tr>
			    </table>
			    </td>
			   </tr>
        		</tr>
				<tr>
      			</table>
     		</form>
			
			</td>
  		  </tr>
		</table>
    </td>
  </tr>
</table>
<?php
  }
}
?>
<script>
	
	findControl();
</script>

