<? session_start(); 

include("../header_subnivel1_agente_aduanal.php");
require_once("../comun/conex_ver.php");
require_once("../comun/conexion3.php");
require_once("../comun/funciones.php");
$link_impo=con_impo();$link=con_ver();

?>
<? $booking = $_GET[booking]; 
if(trim($_POST[booking_search])!='') $booking = trim($_POST[booking_search]);
//echo 'bok '.$booking;
?>
<div id="dhtmltooltip"></div>
	
<? include("../comun/tooltip.php");?>
<style>
td {font-family:Verdana, Geneva, sans-serif; font-size:10px;}
.sty{font-family:Verdana, Geneva, sans-serif; font-size:10px;}
</style>
<script>
function deshabilitar_hbl(param){
	document.getElementById('h_correo_agente_aduanal').disabled=param
	document.getElementById('h_marks').disabled=param
    document.getElementById('h_quantity').disabled=param
    document.getElementById('h_type_of_bulks').disabled=param
	document.getElementById('h_tratamiento_madera').disabled=param
    document.getElementById('h_description').disabled=param
    document.getElementById('h_no_piezas').disabled=param
    document.getElementById('h_gross_weight').disabled=param
    document.getElementById('h_net_weight').disabled=param
    document.getElementById('h_volume').disabled=param
    document.getElementById('h_harmonized_code').disabled=param
	
	
	document.getElementById('h_no_piezas_imo').disabled=param
    document.getElementById('h_gross_weight_imo').disabled=param
    document.getElementById('h_volume_imo').disabled=param
    document.getElementById('h_un_imo').disabled=param
    document.getElementById('h_imo').disabled=param
	
	
	document.getElementById('h_correcciones').disabled=param
    document.getElementById('h_ams').disabled=param
    document.getElementById('h_id').disabled=param
	
    document.getElementById('h_final_destination').disabled=param
	document.getElementById('h_export_reference').disabled=param
	
	document.getElementById('hdescripcion_espanol_articulo_23').disabled=param
    document.getElementById('htipo_mercancia_articulo_23').disabled=param
    document.getElementById('hregimen_articulo_23').disabled=param
    document.getElementById('hfactura_articulo_23').disabled=param
    document.getElementById('himo_articulo_23').disabled=param
    document.getElementById('hun_articulo_23').disabled=param
    document.getElementById('htransportista_articulo_23').disabled=param
    document.getElementById('hnombre_del_chofer_articulo_23').disabled=param
    document.getElementById('hno_licencia_articulo_23').disabled=param
    document.getElementById('hplacas_articulo_23').disabled=param
    document.getElementById('heconomico_articulo_23').disabled=param

    document.getElementById('hmarcas_articulo_23').disabled=param
    document.getElementById('hlinea_articulo_23').disabled=param
    document.getElementById('hcantidad_articulo_23').disabled=param
    document.getElementById('htipo_embalaje_articulo_23').disabled=param
    document.getElementById('hsello_articulo_23').disabled=param
    document.getElementById('hpeso_neto_articulo_23').disabled=param
    document.getElementById('hpeso_bruto_articulo_23').disabled=param
    document.getElementById('hexportador_articulo_23').disabled=param
    document.getElementById('hdireccion_exportador_articulo_23').disabled=param
    document.getElementById('hciudad_exportador_articulo_23').disabled=param
    document.getElementById('hrfc_exportador_articulo_23').disabled=param
	document.getElementById('hdomicilio_agencia_aduanal_articulo_23').disabled=param
	
	document.getElementById('h_status').disabled=param
		

    document.getElementById('h_shipper1').disabled=param
    document.getElementById('h_shipper2').disabled=param
    document.getElementById('h_shipper3').disabled=param
    document.getElementById('h_shipper4').disabled=param
    document.getElementById('h_shipper5').disabled=param
    document.getElementById('h_shipper6').disabled=param
    
    document.getElementById('h_consignee1').disabled=param
    document.getElementById('h_consignee2').disabled=param
    document.getElementById('h_consignee3').disabled=param
    document.getElementById('h_consignee4').disabled=param
    document.getElementById('h_consignee5').disabled=param
    document.getElementById('h_consignee6').disabled=param
    
    document.getElementById('h_notify1').disabled=param
    document.getElementById('h_notify2').disabled=param
    document.getElementById('h_notify3').disabled=param
    document.getElementById('h_notify4').disabled=param
    document.getElementById('h_notify5').disabled=param
    document.getElementById('h_notify6').disabled=param
}
function deshabilitar_mbl(param){
	document.getElementById('correo_agente_aduanal').disabled=param
	document.getElementById('marks').disabled=param
    document.getElementById('quantity').disabled=param
	document.getElementById('type_of_bulks').disabled=param
	document.getElementById('tratamiento_madera').disabled=param
    document.getElementById('description').disabled=param
    document.getElementById('no_piezas').disabled=param
    document.getElementById('gross_weight').disabled=param
    document.getElementById('net_weight').disabled=param
    document.getElementById('volume').disabled=param
    document.getElementById('harmonized_code').disabled=param
    document.getElementById('ams').disabled=param
	
	// aqu
	document.getElementById('correcciones').disabled=param
	
	document.getElementById('final_destination').disabled=param
	document.getElementById('export_reference').disabled=param
	
	document.getElementById('descripcion_espanol_articulo_23').disabled=param
    document.getElementById('tipo_mercancia_articulo_23').disabled=param
    document.getElementById('regimen_articulo_23').disabled=param
    document.getElementById('factura_articulo_23').disabled=param
    document.getElementById('imo_articulo_23').disabled=param
    document.getElementById('un_articulo_23').disabled=param
    document.getElementById('transportista_articulo_23').disabled=param
    document.getElementById('nombre_del_chofer_articulo_23').disabled=param
    document.getElementById('no_licencia_articulo_23').disabled=param
    document.getElementById('placas_articulo_23').disabled=param
    document.getElementById('economico_articulo_23').disabled=param
	
	document.getElementById('marcas_articulo_23').disabled=param
    document.getElementById('linea_articulo_23').disabled=param
    document.getElementById('cantidad_articulo_23').disabled=param
    document.getElementById('tipo_embalaje_articulo_23').disabled=param
    document.getElementById('sello_articulo_23').disabled=param
    document.getElementById('peso_neto_articulo_23').disabled=param
    document.getElementById('peso_bruto_articulo_23').disabled=param
    document.getElementById('exportador_articulo_23').disabled=param
    document.getElementById('direccion_exportador_articulo_23').disabled=param
    document.getElementById('ciudad_exportador_articulo_23').disabled=param
    document.getElementById('rfc_exportador_articulo_23').disabled=param
	document.getElementById('domicilio_agencia_aduanal_articulo_23').disabled=param
	
    document.getElementById('idE').disabled=param  

	 document.getElementById('status').disabled=param
	// document.getElementById('registrado_por').disabled=param
	 
	document.getElementById('shipper1').disabled=param;
    document.getElementById('shipper2').disabled=param
    document.getElementById('shipper3').disabled=param
    document.getElementById('shipper4').disabled=param
    document.getElementById('shipper5').disabled=param
    document.getElementById('shipper6').disabled=param
    
    document.getElementById('consignee1').disabled=param
    document.getElementById('consignee2').disabled=param
    document.getElementById('consignee3').disabled=param
    document.getElementById('consignee4').disabled=param
    document.getElementById('consignee5').disabled=param
    document.getElementById('consignee6').disabled=param
    
    document.getElementById('notify1').disabled=param
    document.getElementById('notify2').disabled=param
    document.getElementById('notify3').disabled=param
    document.getElementById('notify4').disabled=param
    document.getElementById('notify5').disabled=param
    document.getElementById('notify6').disabled=param
}

function borrar_hbl(idbl,booking,idpater){
		$.post( "borra_hbl.php?idbl="+idbl+"&txtbooking="+booking+"&idpater="+idpater,
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});
 
}

function borrar_mbl(idbl,booking,idpater){
		$.post( "borra_mbl.php?idbl="+idbl+"&txtbooking="+booking+"&idpater="+idpater,
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});
 
}


function Guardar_hbl() {
	//alert(document.getElementById('mensaje').innerHTML)
		 
		
		if($('#h_booking').val()==''){
			alert('Ingrese el booking');
			document.getElementById('h_booking').focus();
			return;
		}
		
		if($('#h_final_destination').val()==''){
			alert('Ingrese el destino final');
			document.getElementById('h_final_destination').focus();
			return;
		}
		/*
		
		 
		
		/*if($('#h_shipper_file').val()==''){
			alert('Ingrese el valor de shipper file o referencia unica');
			document.getElementById('h_shipper_file').focus();
			return;
		}*/
	
	// si la paloma cargo_vacio no fue checada
	//alert(document.getElementById('cargo_vacio').checked)
	//if(!document.getElementById('cargo_vacio').checked){
				 
				if($('#h_shipper1').val()==''){
					alert('Ingrese el nombre de Shipper');
					document.getElementById('h_shipper1').focus();
					return;
				}
			
				if($('#h_shipper2').val()==''){
					alert('Ingrese la dirección de Shipper');
					document.getElementById('h_shipper2').focus();
					return;
				}
			
				if($('#h_shipper3').val()==''){
					alert('Ingrese PO Box/City & Country de Shipper');
					document.getElementById('h_shipper3').focus();
					return;
				}
				
				if($('#h_shipper4').val()==''){
					alert('Ingrese el RFC de Shipper');
					document.getElementById('h_shipper4').focus();
					return;
				}
			
				if($('#h_shipper5').val()==''){
					alert('Ingrese CTC de Shipper');
					document.getElementById('h_shipper5').focus();
					return;
				}
				
				if($('#h_shipper6').val()==''){
					alert('Ingrese el teléfono de Shipper');
					document.getElementById('h_shipper6').focus();
					return;
				}
			 
				if($('#h_consignee1').val()==''){
					alert('Ingrese el nombre de Consignee');
					document.getElementById('h_consignee1').focus();
					return;
				}
			
				if($('#h_consignee2').val()==''){
					alert('Ingrese la dirección de Consignee');
					document.getElementById('h_consignee2').focus();
					return;
				}
				
				if($('#h_consignee3').val()==''){
					alert('Ingrese PO Box/City & Country de Consignee');
					document.getElementById('h_consignee3').focus();
					return;
				}
				
				if($('#h_consignee4').val()==''){
					alert('Ingrese el RFC de Consignee');
					document.getElementById('h_consignee4').focus();
					
					return;
				}
				if($('#h_consignee5').val()==''){
					alert('Ingrese CTC de Consignee');
					document.getElementById('h_consignee5').focus();
					
					return;
				}
				if($('#h_consignee6').val()==''){
					alert('Ingrese el teléfono de Consignee');
					document.getElementById('h_consignee6').focus();
						
					return;
				}
			
			 
			
				if($('#h_notify1').val()==''){
					alert('Ingrese el nombre de Notify');
					document.getElementById('h_notify1').focus();
						
					return;
				}
				
				if($('#h_notify2').val()==''){
					alert('Ingrese la dirección de Notify');
					document.getElementById('h_notify2').focus();
						
					return;
				}
				if($('#h_notify3').val()==''){
					alert('Ingrese PO Box/City & Country de Notify');
					document.getElementById('h_notify3').focus();
						
					return;
				}
				if($('#h_notify4').val()==''){
					alert('Ingrese el RFC de Notify');
					document.getElementById('h_notify4').focus();
						
					return;
				}
				if($('#h_notify5').val()==''){
					alert('Ingrese CTC de Notify');
					document.getElementById('h_notify5').focus();
						
					return;
				}
				if($('#h_notify6').val()==''){
					alert('Ingrese el teléfono de Notify');
					document.getElementById('h_notify6').focus();
					return;
				}

	//}
	
	if($('#h_marks').val()==''){
		alert('Ingrese Marks');$err=1;
		document.getElementById('h_marks').focus();
	}

	if($('#h_quantity').val()==''){
		alert('Ingrese Quantity');
		document.getElementById('h_quantity').focus();
		return;
	}
	/*....................*/
	if(document.getElementById('h_quantity').value.indexOf(',')!=-1){
		alert('CANTIDAD no puede contener coma, por favor corregir');
		document.getElementById('h_quantity').focus();
		return;
	}
	if(isNaN(document.getElementById('h_quantity').value)){
		alert('CANTIDAD admite solo numeros, por favor corregir');
		document.getElementById('h_quantity').focus();
		return;
	}
	/*....................*/
	
	if($('#h_type_of_bulks').val()==''){
		alert('Ingrese Type of bulks');
		document.getElementById('h_type_of_bulks').focus();
		return;
	}
	 
	if($('#h_description').val()==''){
		alert('Ingrese La descripcion del cargo, en inglés');
		document.getElementById('h_description').focus();
		return;
	}
	if($('#h_no_piezas').val()==''){
		alert('Ingrese el número de piezas');
		document.getElementById('h_no_piezas').focus();
		return;
	}
	if($('#h_gross_weight').val()==''){
		alert('Ingrese el peso bruto');
		document.getElementById('h_gross_weight').focus();
		return;
	}

	if($('#h_volume').val()==''){
		alert('Ingrese el volumen');
		document.getElementById('h_volume').focus();
		return;
	}

	/*...................*/
 
	if(document.getElementById('h_gross_weight').value.indexOf(',')!=-1){
		alert('PESO BRUTO KGS. no puede contener coma, por favor corregir');
		document.getElementById('h_gross_weight').focus();
		return;
	}
	if(document.getElementById('h_volume').value.indexOf(',')!=-1){
		alert('VOLUMEN no puede contener coma, por favor corregir');
		document.getElementById('h_volume').focus();
		return;
	}
	if(isNaN(document.getElementById('h_gross_weight').value)){
		alert('PESO BRUTO KGS. admite solo numeros, por favor corregir');
		document.getElementById('h_gross_weight').focus();
		return;
	}
	if(isNaN(document.getElementById('h_volume').value)){
		alert('VOLUMEN admite solo numeros, por favor corregir');
		document.getElementById('h_volume').focus();
		return;
	}
	
	/* 14.11.22 ....................*/
 
    if(document.getElementById('h_gross_weight_imo').value.indexOf(',')!=-1){
		alert('PESO BRUTO IMO KGS. no puede contener coma, por favor corregir');
		document.getElementById('h_gross_weight_imo').focus();
		return;
	}
	if(isNaN(document.getElementById('h_gross_weight_imo').value)){
		alert('PESO BRUTO IMO KGS. admite solo numeros, por favor corregir');
		document.getElementById('h_gross_weight_imo').focus();
		return;
	}
	if(document.getElementById('h_volume_imo').value.indexOf(',')!=-1){
		alert('VOLUMEN IMO no puede contener coma, por favor corregir');
		document.getElementById('h_volume_imo').focus();
		return;
	}
	if(isNaN(document.getElementById('h_volume_imo').value)){
		alert('VOLUMEN IMO admite solo numeros, por favor corregir');
		document.getElementById('h_volume_imo').focus();
		return;
	}
	
	if($('#h_un_imo').val()==''){
		alert('Ingrese UN');
		document.getElementById('h_un_imo').focus();
		return;
	}
	
	if($('#h_imo').val()==''){
		alert('Ingrese IMO');
		document.getElementById('h_imo').focus();
		return;
	}
	
	
	
	/*....................*/
	
		
	if($('#h_harmonized_code').val()==''){
		alert('Ingrese el harmonized code');
		document.getElementById('h_harmonized_code').focus();
		return;
	}
	if(document.getElementById('h_id').value*1!=0){
	if($('#h_correcciones').val()==''){
		alert('POR FAVOR INDICAR EN HBL CORRECCIONES EN CASO DE EXISTIR');
		document.getElementById('h_correcciones').focus();
		return;
	}
	}

document.getElementById('forma_2').action='guarda_house_bl.php?REFERENCIA='+$("#referencia").val()+'&h_id='+$('#h_id').val()+'&email=<?=$_SESSION[email]?>';

document.getElementById('forma_2').submit()

	//+"&email=<? //=$_SESSION[email]?>"
	/*var laDatos = valores_forma(document.forma_2);
		if(confirm('Confirma el registro de este HOUSE BL?')) {
		loadin_('','saving_hbl','Saving HBL','../images/loading.gif' )
		$.post( "guarda_house_bl.php?h_id="+$('#h_id').val(),
				$(laDatos),
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});
		
		

		}*/
		
		//LstAjax('divPartidas','partidas_bl.php?booking='+document.getElementById('h_booking').value);

}
function limpiar_hbl(){
		document.getElementById('h_bandera_de_consolidado').value='';
	document.getElementById('h_marks').value='';
    document.getElementById('h_quantity').value='';
    document.getElementById('h_type_of_bulks').value=''; 
	document.getElementById('h_tratamiento_madera').value='';
    document.getElementById('h_description').value='';
    document.getElementById('h_no_piezas').value='';
    document.getElementById('h_gross_weight').value='';
    document.getElementById('h_net_weight').value='';
    document.getElementById('h_volume').value='';
    document.getElementById('h_harmonized_code').value='';
    document.getElementById('h_ams').value='';
    document.getElementById('h_id').value='';

		document.getElementById('h_no_piezas_imo').value='';
    document.getElementById('h_gross_weight_imo').value='';
    document.getElementById('h_volume_imo').value='';
    document.getElementById('h_un_imo').value='';
    document.getElementById('h_imo').value='';
	
	document.getElementById('h_correcciones').value='';
	
	document.getElementById('hdescripcion_espanol_articulo_23').value='';
    document.getElementById('htipo_mercancia_articulo_23').value='';
    document.getElementById('hregimen_articulo_23').value='';
    document.getElementById('hfactura_articulo_23').value='';
    document.getElementById('himo_articulo_23').value='';
    document.getElementById('hun_articulo_23').value='';
    document.getElementById('htransportista_articulo_23').value='';
    document.getElementById('hnombre_del_chofer_articulo_23').value='';
    document.getElementById('hno_licencia_articulo_23').value='';
    document.getElementById('hplacas_articulo_23').value='';
    document.getElementById('heconomico_articulo_23').value='';

    document.getElementById('hmarcas_articulo_23').value='';
    document.getElementById('hlinea_articulo_23').value='';
    document.getElementById('hcantidad_articulo_23').value='';
    document.getElementById('htipo_embalaje_articulo_23').value='';
    document.getElementById('hsello_articulo_23').value='';
    document.getElementById('hpeso_neto_articulo_23').value='';
    document.getElementById('hpeso_bruto_articulo_23').value='';
    document.getElementById('hexportador_articulo_23').value='';
    document.getElementById('hdireccion_exportador_articulo_23').value='';
    document.getElementById('hciudad_exportador_articulo_23').value='';
    document.getElementById('hrfc_exportador_articulo_23').value='';
	document.getElementById('hdomicilio_agencia_aduanal_articulo_23').value='';
	
	document.getElementById('h_status').value='';
		

    document.getElementById('h_shipper1').value='';
    document.getElementById('h_shipper2').value='';
    document.getElementById('h_shipper3').value='';
    document.getElementById('h_shipper4').value='';
    document.getElementById('h_shipper5').value='';
    document.getElementById('h_shipper6').value='';
    
    document.getElementById('h_consignee1').value='';
    document.getElementById('h_consignee2').value='';
    document.getElementById('h_consignee3').value='';
    document.getElementById('h_consignee4').value='';
    document.getElementById('h_consignee5').value='';
    document.getElementById('h_consignee6').value='';
    
    document.getElementById('h_notify1').value='';
    document.getElementById('h_notify2').value='';
    document.getElementById('h_notify3').value='';
    document.getElementById('h_notify4').value='';
    document.getElementById('h_notify5').value='';
    document.getElementById('h_notify6').value='';
}

function limpiar_mbl(){
		// aqu
	document.getElementById('bandera_de_consolidado').value='';
	document.getElementById('correcciones').value='';
	
	document.getElementById('marks').value='';
    document.getElementById('quantity').value='';
	document.getElementById('type_of_bulks').value='';
	document.getElementById('tratamiento_madera').value='';
    document.getElementById('description').value='';
    document.getElementById('no_piezas').value='';
    document.getElementById('gross_weight').value='';
    document.getElementById('net_weight').value='';
    document.getElementById('volume').value='';
    document.getElementById('harmonized_code').value='';
    document.getElementById('ams').value='';
	
	document.getElementById('descripcion_espanol_articulo_23').value='';
    document.getElementById('tipo_mercancia_articulo_23').value='';
    document.getElementById('regimen_articulo_23').value='';
    document.getElementById('factura_articulo_23').value='';
    document.getElementById('imo_articulo_23').value='';
    document.getElementById('un_articulo_23').value='';
    document.getElementById('transportista_articulo_23').value='';
    document.getElementById('nombre_del_chofer_articulo_23').value='';
    document.getElementById('no_licencia_articulo_23').value='';
    document.getElementById('placas_articulo_23').value='';
    document.getElementById('economico_articulo_23').value='';
	
	document.getElementById('marcas_articulo_23').value='';
    document.getElementById('linea_articulo_23').value='';
    document.getElementById('cantidad_articulo_23').value='';
    document.getElementById('tipo_embalaje_articulo_23').value='';
    document.getElementById('sello_articulo_23').value='';
    document.getElementById('peso_neto_articulo_23').value='';
    document.getElementById('peso_bruto_articulo_23').value='';
    document.getElementById('exportador_articulo_23').value='';
    document.getElementById('direccion_exportador_articulo_23').value='';
    document.getElementById('ciudad_exportador_articulo_23').value='';
    document.getElementById('rfc_exportador_articulo_23').value='';
	document.getElementById('domicilio_agencia_aduanal_articulo_23').value='';
	
    document.getElementById('idE').value='';  

	 document.getElementById('status').value='';
	// document.getElementById('registrado_por').value='';
	 
	document.getElementById('shipper1').value='';
    document.getElementById('shipper2').value='';
    document.getElementById('shipper3').value='';
    document.getElementById('shipper4').value='';
    document.getElementById('shipper5').value='';
    document.getElementById('shipper6').value='';
    
    document.getElementById('consignee1').value='';
    document.getElementById('consignee2').value='';
    document.getElementById('consignee3').value='';
    document.getElementById('consignee4').value='';
    document.getElementById('consignee5').value='';
    document.getElementById('consignee6').value='';
    
    document.getElementById('notify1').value='';
    document.getElementById('notify2').value='';
    document.getElementById('notify3').value='';
    document.getElementById('notify4').value='';
    document.getElementById('notify5').value='';
    document.getElementById('notify6').value='';
}

function Guardar_Master_bl() {
	aa = '<?=$_SESSION[email]?>';
		if(aa==''){
			alert('Se perdio la sesion, se cerrara el sistema');
			document.location='login.php';
			return;
		}
	
	if($('#booking').val()==''){
			alert('Ingrese el booking');
			document.getElementById('booking').focus();
			return;
		}
	
	if($('#final_destination').val()==''){
			alert('Ingrese el destino final');
			document.getElementById('final_destination').focus();
			return;
	}
		
	if($('#shipper1').val()==''){
		alert('Ingrese el nombre de Shipper');
		document.getElementById('shipper1').focus();
		return;
	}

	if($('#shipper2').val()==''){
		alert('Ingrese la dirección de Shipper');
		document.getElementById('shipper2').focus();
		return;
	}

	if($('#shipper3').val()==''){
		alert('Ingrese PO Box/City & Country de Shipper');
		document.getElementById('shipper3').focus();
		return;
	}
	
	if($('#shipper4').val()==''){
		alert('Ingrese el RFC de Shipper');
		document.getElementById('shipper4').focus();
		return;
	}

	if($('#shipper5').val()==''){
		alert('Ingrese CTC de Shipper');
		document.getElementById('shipper5').focus();
		return;
	}
	
	if($('#shipper6').val()==''){
		alert('Ingrese el teléfono de Shipper');
		document.getElementById('shipper6').focus();
		return;
	}
 
	if($('#consignee1').val()==''){
		alert('Ingrese el nombre de Consignee');
		document.getElementById('consignee1').focus();
		return;
	}

	if($('#consignee2').val()==''){
		alert('Ingrese la dirección de Consignee');
		document.getElementById('consignee2').focus();
		return;
	}
	
	if($('#consignee3').val()==''){
		alert('Ingrese PO Box/City & Country de Consignee');
		document.getElementById('consignee3').focus();
		return;
	}
	
	if($('#consignee4').val()==''){
		alert('Ingrese el RFC de Consignee');
		document.getElementById('consignee4').focus();
		
		return;
	}
	if($('#consignee5').val()==''){
		alert('Ingrese CTC de Consignee');
		document.getElementById('consignee5').focus();
		
		return;
	}
	if($('#consignee6').val()==''){
		alert('Ingrese el teléfono de Consignee');
		document.getElementById('consignee6').focus();
			
		return;
	}

 

	if($('#notify1').val()==''){
		alert('Ingrese el nombre de Notify');
		document.getElementById('notify1').focus();
			
		return;
	}
	
	if($('#notify2').val()==''){
		alert('Ingrese la dirección de Notify');
		document.getElementById('notify2').focus();
			
		return;
	}
	if($('#notify3').val()==''){
		alert('Ingrese PO Box/City & Country de Notify');
		document.getElementById('notify3').focus();
			
		return;
	}
	if($('#notify4').val()==''){
		alert('Ingrese el RFC de Notify');
		document.getElementById('notify4').focus();
			
		return;
	}
	if($('#notify5').val()==''){
		alert('Ingrese CTC de Notify');
		document.getElementById('notify5').focus();
			
		return;
	}
	if($('#notify6').val()==''){
		alert('Ingrese el teléfono de Notify');
		document.getElementById('notify6').focus();
		return;
	}

if(document.getElementById('cargo_vacio').checked==false){
	if($('#marks').val()==''){
		alert('Ingrese Marks');$err=1;
		document.getElementById('marks').focus();
	}

	if($('#quantity').val()==''){
		alert('Ingrese Quantity');
		document.getElementById('quantity').focus();
		return;
	}
	
	/*....................*/
	if(document.getElementById('quantity').value.indexOf(',')!=-1){
		alert('CANTIDAD no puede contener coma, por favor corregir');
		document.getElementById('quantity').focus();
		return;
	}
	if(isNaN(document.getElementById('quantity').value)){
		alert('CANTIDAD admite solo numeros, por favor corregir');
		document.getElementById('quantity').focus();
		return;
	}
	/*....................*/
	if($('#type_of_bulks').val()==''){
		alert('Ingrese type of bulks');
		document.getElementById('type_of_bulks').focus();
		return;
	}
	 
	if($('#description').val()==''){
		alert('Ingrese La descripcion del cargo, en inglés');
		document.getElementById('description').focus();
		return;
	}
	if($('#no_piezas').val()==''){
		alert('Ingrese el número de piezas');
		document.getElementById('no_piezas').focus();
		return;
	}
	if($('#gross_weight').val()==''){
		alert('Ingrese el peso bruto');
		document.getElementById('gross_weight').focus();
		return;
	}

	if($('#volume').val()==''){
		alert('Ingrese el volumen');
		document.getElementById('volume').focus();
		return;
	}
	/*...................*/
	 
	if(document.getElementById('gross_weight').value.indexOf(',')!=-1){
		alert('PESO BRUTO KGS. no puede contener coma, por favor corregir');
		document.getElementById('gross_weight').focus();
		return;
	}
	if(document.getElementById('volume').value.indexOf(',')!=-1){
		alert('VOLUMEN no puede contener coma, por favor corregir');
		document.getElementById('volume').focus();
		return;
	}
	if(isNaN(document.getElementById('gross_weight').value)){
		alert('PESO BRUTO KGS. admite solo numeros, por favor corregir');
		document.getElementById('gross_weight').focus();
		return;
	}
	if(isNaN(document.getElementById('volume').value)){
		alert('VOLUMEN admite solo numeros, por favor corregir');
		document.getElementById('volume').focus();
		return;
	}
	
	
	/* 14.11.22 ....................*/
 
    if(document.getElementById('gross_weight_imo').value.indexOf(',')!=-1){
		alert('PESO BRUTO IMO KGS. no puede contener coma, por favor corregir');
		document.getElementById('gross_weight_imo').focus();
		return;
	}
	if(isNaN(document.getElementById('gross_weight_imo').value)){
		alert('PESO BRUTO IMO KGS. admite solo numeros, por favor corregir');
		document.getElementById('gross_weight_imo').focus();
		return;
	}
	if(document.getElementById('volume_imo').value.indexOf(',')!=-1){
		alert('VOLUMEN IMO no puede contener coma, por favor corregir');
		document.getElementById('volume_imo').focus();
		return;
	}
	if(isNaN(document.getElementById('volume_imo').value)){
		alert('VOLUMEN IMO admite solo numeros, por favor corregir');
		document.getElementById('volume_imo').focus();
		return;
	}
	if($('#un_imo').val()==''){
		alert('Ingrese UN');
		document.getElementById('un_imo').focus();
		return;
	}
	
	if($('#imo').val()==''){
		alert('Ingrese IMO');
		document.getElementById('imo').focus();
		return;
	}
	
	
	/*....................*/
	
	if($('#harmonized_code').val()==''){
		alert('Ingrese el harmonized code');
		document.getElementById('harmonized_code').focus();
		return;

	}
	if(document.getElementById('idE').value*1!=0){
	if($('#correcciones').val()==''){
		alert('POR FAVOR INDICAR EN MBL CORRECCIONES EN CASO DE EXISTIR');
		document.getElementById('correcciones').focus();
		return;
	}
	}
}
	document.getElementById('formaA').action = "guarda_bl.php?REFERENCIA="+$('#referencia').val()+"&id="+$('#idE').val()+"&email=<?=$_SESSION[email]?>";
	
	document.getElementById('formaA').submit()
}

function buscar_booking(TBOOKING) {
		var laDatos = valores_forma(document.forma);
		
		aa = '<?=$_SESSION[email]?>';
		if(aa==''){
			alert('Se perdio la sesion, se cerrara el sistema');
			document.location='login.php';
			return;
		}
 
loadin_('','mensaje','Buscando','../images/loading.gif' )
		$.post( "buscar_booking.php?email=<?=$_SESSION[email]?>&booking="+TBOOKING+"&rol=<?=$_SESSION[rol]?>&user=<?=$_SESSION[user]?>",
				$(laDatos),
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});
LstAjax('divPartidas','partidas_bl.php?booking='+TBOOKING+'&registrado_por=<?=$_SESSION[email]?>');
}

function buscar_booking_master(TBOOKING) {
		var laDatos = valores_forma(document.forma);
		
		aa = '<?=$_SESSION[email]?>';
		if(aa==''){
			alert('Se perdio la sesion, se cerrara el sistema');
			document.location='login.php';
			return;
		}
 
loadin_('','mensaje','Buscando','../images/loading.gif' )
		$.post( "buscar_booking_master.php?email=<?=$_SESSION[email]?>&booking="+TBOOKING+"&rol=<?=$_SESSION[rol]?>&user=<?=$_SESSION[user]?>",
				$(laDatos),
				function FuncionRecepcion(respuesta) {
					var laRespuesta = eval('(' + respuesta + ')');
					if ( laRespuesta != null ) {
						var laActions = laRespuesta["actions"];
						var liIdx;
						for ( liIdx=0 ; liIdx<laActions.length ; liIdx++ )
							eval( laActions[liIdx] );
					}
				});
LstAjax('divPartidas','partidas_bl.php?booking='+TBOOKING+'&registrado_por=<?=$_SESSION[email]?>');
}

function Nuevo(forma) {
	disable_campos(false);
	//limpia_forma();
	$('#menu_editar').hide();
  	$('#menu_guardar').show();
	$('#menu_eliminar').hide();
	$('#menu_cancelar').show();

	//limpia_forma();
	$('#operacion').val('ALTA');
	$('#fecha').val();
	$('#nombre_ejecutivo').val('<?=$_SESSION['user']?>');
	$('#idejecutivo').val('<?=$_SESSION['idusuario']?>');
  }

  function disable_campos(valor) {
	$('#hora').attr('disabled', valor);
	//$('#alias').attr('disabled', valor);
	$('#comentarios').attr('disabled', valor);
  }

 function limpia_forma() {
	$('#hora').val('');
	$('#fecha').val('');
	$('#alias').val('');
	$('#comentarios').attr('checked', false);
	$('#idalias').val('');
  }

function Cancelar(forma){
	limpia_forma(forma);
	disable_campos(true);
	$('#menu_crear').show();
	$('#menu_guardar').hide();
	$('#menu_editar').show();
	$('#menu_eliminar').hide();
}

function Editar(forma) {
    if ( $('#idcita').val() == "" ) {
    	alert("Por favor seleccione la cita a editar.");
    	return;
    } else {
  		disable_campos(false);
  		$('#menu_editar').hide();
  		$('#menu_guardar').show();
		$('#menu_eliminar').show();
		forma.operacion.value = 'CAMBIO';
  	}
}
$(document).ready( function() {
	/*disable_campos(true);
	$('#menu_guardar').hide();
	$('#menu_eliminar').hide();*/
	//$('#fecha').datepicker({dateFormat:"dd-mm-yy", yearRange:'-50:+5'});
  });

$().ready(function() {
	$("#shipper1").autocomplete("lista_de_shippers.php", {
	extraParams: { 
    email: function() { 
    return '<?=$_SESSION[email]?>'; }  
    },
		cacheLength:0, 
		delay:100,
		width: 620,
		matchContains: true,
		selectFirst: false,
		max:150
	});
	
	  
	$("#h_shipper1").autocomplete("lista_de_shippers.php", {
								  extraParams: { 
    email: function() { 
    return '<?=$_SESSION[email]?>'; }  
    },
		cacheLength:0, 
		delay:100,
		width: 620,
		matchContains: true,
		selectFirst: false,
		max:150
	});
	
	$("#notify1").autocomplete("lista_de_notify.php", {
							   extraParams: { 
    email: function() { 
    return '<?=$_SESSION[email]?>'; }  
    },
		cacheLength:0, 
		delay:100,
		width: 220,
		matchContains: true,
		selectFirst: false,
		max:150
	});
	
	$("#h_notify1").autocomplete("lista_de_notify.php", {
								 extraParams: { 
    email: function() { 
    return '<?=$_SESSION[email]?>'; }  
    },
		cacheLength:0, 
		delay:100,
		width: 220,
		matchContains: true,
		selectFirst: false,
		max:150
	});
	
	$("#consignee1").autocomplete("lista_de_consignees.php", {
								  extraParams: { 
    email: function() { 
    return '<?=$_SESSION[email]?>'; }  
    },
		cacheLength:0, 
		delay:100,
		width: 220,
		matchContains: true,
		selectFirst: false,
		max:150
	});
	
	$("#h_consignee1").autocomplete("lista_de_consignees.php", {
									extraParams: { 
    email: function() { 
    return '<?=$_SESSION[email]?>'; }  
    },
		cacheLength:0, 
		delay:100,
		width: 220,
		matchContains: true,
		selectFirst: false,
		max:150
	});
	
	
	$("#shipper1").result(function(event, data, formatted) {
		
		$("#shipper1").val(data[1]);
		$("#shipper2").val(data[2]);
		$("#shipper3").val(data[3]);
		$("#shipper4").val(data[4]);
		$("#shipper5").val(data[5]);
		$("#shipper6").val(data[6]);
	});
	
	$("#h_shipper1").result(function(event, data, formatted) {
		$("#h_shipper1").val(data[1]);
		$("#h_shipper2").val(data[2]);
		$("#h_shipper3").val(data[3]);
		$("#h_shipper4").val(data[4]);
		$("#h_shipper5").val(data[5]);
		$("#h_shipper6").val(data[6]);
	});
	
	$("#consignee1").result(function(event, data, formatted) {
		$("#consignee1").val(data[0]);
		$("#consignee2").val(data[1]);
		$("#consignee3").val(data[2]);
		$("#consignee4").val(data[3]);
		$("#consignee5").val(data[4]);
		$("#consignee6").val(data[5]);
	});
	
	$("#h_consignee1").result(function(event, data, formatted) {
		$("#h_consignee1").val(data[0]);
		$("#h_consignee2").val(data[1]);
		$("#h_consignee3").val(data[2]);
		$("#h_consignee4").val(data[3]);
		$("#h_consignee5").val(data[4]);
		$("#h_consignee6").val(data[5]);
	});
	
	$("#notify1").result(function(event, data, formatted) {
		$("#notify1").val(data[0]);
		$("#notify2").val(data[1]);
		$("#notify3").val(data[2]);
		$("#notify4").val(data[3]);
		$("#notify5").val(data[4]);
		$("#notify6").val(data[5]);
	});
	
	$("#h_notify1").result(function(event, data, formatted) {
		$("#h_notify1").val(data[0]);
		$("#h_notify2").val(data[1]);
		$("#h_notify3").val(data[2]);
		$("#h_notify4").val(data[3]);
		$("#h_notify5").val(data[4]);
		$("#h_notify6").val(data[5]);
	});
	
	 
		
	$("#marks").result(function(event, data, formatted) {
		$("#marks").val(data[0]);
	});
	
	$("#h_marks").result(function(event, data, formatted) {
		$("#h_marks").val(data[0]);
		
		
	});	
	
	
});

</script>   
<div align="justify" style="line-height:18px;margin-top:-20px; position:absolute;width: 960px; height:100% ">
<span style="color:#00AF4B">REGISTRO DE BL &raquo;</span><BR />  

<!--
<span style="color:#00AF4B; text-decoration:underline">Interteam</span>&nbsp;&nbsp;&nbsp;&nbsp;

<span style="color:#00AF4B; text-decoration:underline">Shenker</span>&nbsp;&nbsp;&nbsp;&nbsp;

<span style="color:#00AF4B; text-decoration:underline">Kuehne & Nagel</span><BR /> -->

<BR />

 <? 
 // imagen del agente aduanal
				 
				$datos_aa = data($link_impo,"SELECT A.*,C.nombre_contacto,C.telefono_contacto FROM `agentes_aduanales` A 
				INNER JOIN contactos_agentes_aduanales C
				on A.id=C.idaa and A.registro = 'VERACRUZ' and C.email_contacto LIKE '%".trim($_SESSION[email])."%' ");
		 
				$imagen  = $datos_aa[imagen]; // AA
				 
         
 ?>

  <span style="color:#00AF4B" >BIENVENIDO A VERACRUZ</span><BR /><BR />
  
 <? if(trim($imagen)!='') { ?>
 <img src="<?="https://".$_SERVER["SERVER_NAME"]?>/VER/agenteaduanal1/<?=$imagen?>" /><br /><BR /><? } ?>

<span style="color:#00AF4B" >* POR FAVOR REGISTRE MBL SI REGISTRA MAS DE UN HBL</span>
 <BR />  
 <BR /> 
<?
 $q1 =mysqli_query($link,"select distinct booking,pago_mei from hblexpint where registrado_por = '".$_SESSION[email]."' and registrado_por<>'' order by idhbl desc,booking limit 10");
if(mysqli_num_rows($q1)>0){ ?>
<table>


<?  
 while($rq1=mysqli_fetch_array($q1)){
?>
<TR>
<td><a  style="color:#00AF4B; text-decoration:underline; cursor:pointer" href="registro_bl.php?booking=<?=$rq1[booking]?>"><?=$rq1[booking]?></a></td>
<? if( strtoupper(trim($_SESSION[email]))=='RUBEN.VALERIO@LPVER.COM'){?>
<TD>&nbsp;&nbsp;</TD>
<td style="color:white; font-weight:bold"  <?=$rq1[pago_mei]=='PAGADO' ? ' bgcolor="green" ' : ' bgcolor="red" ' ?>><?=$rq1[pago_mei]=='' ? 'PENDIENTE' : $rq1[pago_mei]?></td>

<? } ?>
</TR>
<? }  ?>


</table>
<? } ?>
 
<!--<span style="color:#060">ATENCION AA: SE AGREGO EL CAMPO ***** EXPORT REFERENCE **** que relaciona su bl con una referencia de exportacion </span>-->
 <style>
 .bot{
	 background-color:#bdd0e6;
	 /*color: #bdd0e6;*/
 }
 .bot:hover{
	  background-color:white;
 }
 </style>
<br /> 
 <?
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%% esta es la busqueda del booking %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 if(trim($_POST[booking_search])!='' or $_GET[booking]!=''){
 
	  
			$q=data($link_impo,"select * from bookingexpint where booking_interteam like '".($_GET[booking]!='' ? $_GET[booking] : trim($_POST[booking_search]))."' ");
			
			if(count($q)<1){
				 
				$qZ=data($link ,"select * from booking_ssl where booking_ssl like 
				'".($_GET[booking]!='' ? $_GET[booking] : trim($_POST[booking_search]))."' ");
			if(count($qZ)>0){
					$booking_tmp=$qZ[booking_ssl];//echo 'a '.$booking_tmp;
					$referencia_cliente=trim($qZ[referencia_cliente]);
					$referencia_veracruz=trim($qZ[referencia_veracruz]);
					$carga_imo=trim($qZ[carga_imo]);
				}
			}else{
				$booking_tmp=$q[booking_interteam];//echo 'b '.$booking_tmp;
				$q_referencia=data($link_impo,"select referencia_interteam from datosexpint where files='".$q[files]."'");
				$referencia_cliente=trim($q_referencia[referencia_interteam]);
			}
			
			
			if($q[files]=='' and $qZ[booking_ssl]==''){
			 echo 'BOOKING inexistente, asegúrese de haberlo escrito correctamente o contacte al administrador.';
			 return;
			}
			 
			 con_ver();
			 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			 /* BUSQUEDA DEL BOOKING: MBL */
			 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			  $Q2=mysqli_query($link,"select *  from hblexpint where booking 
			  like '".($_GET[booking]!='' ? $_GET[booking] : trim($_POST[booking_search]))."' 
			  and registrado_por<>''  and registrado_por='".trim(strtolower($_SESSION[email]))."' and tipo = 'MBL' order by idhbl desc,booking limit 10");
			
			if(mysqli_num_rows($Q2)>0){
			
			  $bl=mysqli_fetch_array($Q2);  
			  $fd=$bl[finaldestination];
			 
			  $Q3=mysqli_query($link,"select *  from detailcargaexpint where id_bl = '".$bl[idhbl]."' ");
			 
			  $partida=mysqli_fetch_array($Q3);
			 
			  $referencia = trim($bl[referencia]);
			}else{
			/* BUSCO HBL SI NO REGISTRO MBL */
					  $Q4=mysqli_query($link,"select *  from hblexpint where booking 
					  like '".($_GET[booking]!='' ? $_GET[booking] : trim($_POST[booking_search]))."' 
					  and registrado_por<>'' and registrado_por='".trim(strtolower($_SESSION[email]))."' and tipo = 'HBL' order by idhbl desc,booking limit 10");
					if(mysqli_num_rows($Q4)>0){
						 
					  $bl4=mysqli_fetch_array($Q4);
					  $fd=$bl4[finaldestination];
					  $referencia = $bl4[referencia];
					}
			}
			//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

			
			
			$viaje=data($link ,"select * from datosbooking where referencia_cliente = '".$referencia_cliente."' and referencia_cliente<>''");
			
			 
			if(count($viaje)<1){
			$viaje=data($link ,"select * from datosbooking where referencia_cliente = '".$referencia."' and referencia_cliente<>''");	
			}
			if(count($viaje)<1){
 
				$bl1 = data($link_impo ,"SELECT D.referencia_interteam, D.pod, D.pod_country, D.vessel, D.voyage,D.pol
				FROM datosexpint D
				INNER JOIN bookingexpint B ON D.files = B.files
				AND B.booking_interteam LIKE '".($_GET[booking]!='' ? $_GET[booking] : trim($_POST[booking_search]))."' AND B.booking_interteam<>''
				LIMIT 10");
				 
			if(trim($bl1[referencia_interteam])!='') {
				$referencia = $bl1[referencia_interteam];
			};
			
			}

			con_ver();
			
	 
			if(strpos($bl1[pol],'VERACRUZ')===false and strpos(trim($viaje[pol]),'VERACRUZ')===false){
				 echo 'El BOOKING que esta intentando documentar no puede ser documentado por VERACRUZ o no pertenece a VERACRUZ. Documente el BOOKING en su link correspondiente o contacte al administrador.';
			 	return;	
			}
 
			//echo $referencia_cliente.' '.$referencia;
			if(trim($referencia_cliente)=='' and trim($referencia)==''){
			 echo 'BOOKING SIN REFERENCIA AUN, contacte al administrador.';
			 return;
			}
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end o busqueda del booking %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 ?>
<form action="registro_bl.php" method="post">
<span class="sty">INGRESAR EL  BOOKING A DOCUMENTAR</span>
<input type="text" class="bot" name="booking_search"  />
<input type="submit" class="bot" value="Buscar"  />
</form>
<BR />
<span class="sty">INGRESE EL  BOOKING A DOCUMENTAR Y PRESIONE ENTER, POR FAVOR ESPERE MIENTRAS SE REALIZA LA BUSQUEDA. <BR />
SE COMPLETARAN AUTOMATICAMENTE VAPOR Y VIAJE, POL Y POD. </span>
<? if(trim($_POST[booking_search])!='' or $_GET[booking]!=''){?>
<br />
 <input type="button" class="bot" value="Registrar Master" onclick="document.location='#mbl'" /> <input type="button" class="bot" value="Registrar House" onclick="document.location='#hbl'"/>&nbsp;&nbsp;
 
 
 <div id="divPartidas">
	   <? include("partidas_bl.php");?>
  </div> 
 
 
<!-- 
 
<span style="color:#00AF4B; text-decoration:underline; cursor:pointer;" onclick='if($("#booking").val()!="" && document.getElementById("mensaje").innerHTML=="<br>"){dhtmlwindow.open("mblBox","iframe","mbl.php", "MBL", 
"width=950px,height=600px,resize=1,scrolling=1,center=1", "recal");}'>MBL</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-->
<!--<span style="color:#00AF4B; text-decoration:underline; cursor:pointer;" title="Exportar a PDF" id="pdf" onClick="if($('#booking').val()!='' && document.getElementById('mensaje').innerHTML=='<br>'){window.open('../pdf/mbl.php?booking='+$('#booking').val());}">MBL</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<span style="color:#00AF4B; text-decoration:underline; cursor:pointer;" title="Exportar a PDF" id="pdf" onClick="if($('#booking').val()!='' && document.getElementById('mensaje').innerHTML=='<br>'){window.open('../pdf/hbl.php?booking='+$('#booking').val());}">HBL</span>-->

   
<!--"-->


<br />
<?
	$condicion=0;
if(($bl[status]=='OK' or $bl[status]=='FUERA DE TIEMPO') and (strlen(trim($bl[pedimento]))>=6 or strlen(trim($bl[pedimento]))!=0) ){
	$condicion=1;
	echo 'EL BOOKING NO PUEDE EDITARSE O BORRARSE PORQUE TIENE PEDIMENTO Y SU STATUS ES '.($bl[status]=='OK' ? 'Aceptado' : $bl[status]).'<br /><br />';
}

?>


<table width="921" style="line-height:22px"  >
  <tr>
       <td width="232" >
       
       <div id="mbl"><span style="font-size:22PX;color:#00AF4B"><B>MBL</B></span></div>
       
       <!--<a href="#mbl" style="color:#00AF4B; text-decoration:underline">Ir a MBL</a>&nbsp;&nbsp;<a href="#hbl" style="color:#00AF4B; text-decoration:underline">Ir a HBL</a>&nbsp;&nbsp;<a href="#lista" style="color:#00AF4B; text-decoration:underline">Lista de BLs</a>-->
       </td>
       <td>&nbsp;</td>
    </tr>
</table>

<form id="formaZ" name="formaZ" method="post">
<input type="hidden" id="operacion" name="operacion" />
 <input type="hidden" id="idE" name="idE" readonly="readonly"/>
<input type="hidden" id="email_2" name="email_2" value="<?=$_SESSION[email]?>" />
<input type="hidden" class="aa" name="shipper_file" id="shipper_file" size="40" 
 value="<?=$bl[shipper_file]=='' ? $bl4[shipper_file] : $bl[shipper_file]?>" />
 <input type="hidden" class="aa" name="escondido" id="escondido" size="40" />
 <div id="divdescription" align="left" ></div>
 
</form>
<div id="divBuscar" align="left" ></div>



<form id="formaA" name="formaA" method="post">
<table width="1329">	
    <tr>
    <td width="294"  >BOOKING 
	</td><!--onblur="if($('#booking').val()!=''){buscar_booking_master($('#booking').val())}"-->
    <td width="1023"><input type="text" class="aa" name="booking" id="booking" size="40" value="<?=$bl[booking]=='' ? ($booking_tmp!='' ? $booking_tmp : $bl4[booking]) : $bl[booking] ?>"  readonly="readonly" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>   /></td>
    </tr>

<!--
<tr id="bloq">
    <td colspan="2" style="color:#00F;" width="948"><strong><i>*** A TIEMPO ***</i></strong></td>
   </tr>-->
   
   <tr>
    <td colspan="2" style="color:#F00"><strong><i>Teclee el Booking tal cual lo hubiera recibido</i></strong></td>
   </tr>
    
    <tr style="display:none">
   <td >STATUS hidden</td>
   <td ><input type="text" class="aa" name="status" id="status" size="40" disabled="disabled" /></td>
 </tr>
    <tr>
      <td>VAPOR/VIAJE</td>
      <td><input type="text" class="aa" name="vessel" id="vessel" size="40" disabled="disabled" value="<?=trim($bl1[vessel])=='' ? trim($viaje[vessel]).' '. trim($viaje[voyage]) : trim($bl1[vessel]).' '.trim($bl1[voyage])  ?>"/></td>
    </tr>
    <tr>
      <td>BANDERA DE BUQUE</td>
      <td><input type="text" class="aa" name="bandera_de_consolidado" id="bandera_de_consolidado" size="40" disabled="disabled" value="<?=trim($viaje[bandera_de_consolidado]) ?>"/></td>
    </tr>
    <tr>
    <td>PUERTO DE CARGA (POL)</td>
    <td><input type="text" class="aa" name="pol" id="pol" size="40" disabled="disabled" value="VERACRUZ, VERACRUZ"/></td>
  </tr>
  <tr>
    <td>PUERTO DE DESCARGA (POD)</td>
    <td><input type="text" class="aa" name="pod" id="pod" size="40" disabled="disabled" value="<?=$viaje[pod]=='' ? $bl1[pod].', '.$bl1[pod_country] : $viaje[pod]?>"/></td>
  </tr>
  <tr>
    <td> DESTINO FINAL</td>
    <td><input type="text" class="aa" name="final_destination" id="final_destination"   size="40" value="<?=$fd?>" <?= $condicion==1 ? 'disabled="disabled" ' : ''?> /></td>
  </tr>
   
  <tr>
    <td>REFERENCIA DE EXPORTACION</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="export_reference" id="export_reference" size="40" value="<?=$bl[export_reference]=='' ? $bl4[export_reference] : $bl[export_reference]?>" /></td>
  </tr>
  <tr>
    <td id="t_nombre7">REFERENCIA INTERNA</td>
     <? $rcliente=$bl[referencia]=='' ? $bl4[referencia] : $bl[referencia];
	$rcliente = $rcliente=='' ? $referencia_cliente : $rcliente;
	?>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="referencia" id="referencia" size="40" value="<?=$rcliente?>"  readonly="readonly" /></td>
  </tr>
  <tr>
    <td id="t_nombre12">ALMACEN DE CONSOLIDACION</td>
    <td><input type="text" class="aa" disabled="disabled"  size="40" value="<?=$viaje[almacen_consolidacion]?>" /></td>
  </tr>
  <tr>
    <td>CORREO AGENTE ADUANAL</td>
    <td><input type="text" class="aa" name="correo_agente_aduanal" id="correo_agente_aduanal" size="40" value="<?=$bl[correo_agente_aduanal]?>" />
      &nbsp;<span style="color:#F00"><strong><em>Si quien documenta es Freight Forwarder mencionar el correo de la AG AD para dar seguimiento a la entrega de despacho y notificar número de contenedor</em></strong></span></td>
  </tr>
  <tr>
    <td id="t_nombre6">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td id="t_nombre"><b>SHIPPER</b><br /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>NOMBRE</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>   name="shipper1" id="shipper1" size="40" style="background-color:#AFCDB8" value="<?= $bl[shipper] ?>" /></td>
  </tr>
  <tr>
    <td colspan="2" style="color:#F00"><strong><i>Teclee el nombre de Shipper</i></strong></td>
  </tr>
  <tr>
    <td>DIRECCION</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="shipper2" id="shipper2" size="40"  value="<?=  $bl[shipper2]  ?>"/></td>
  </tr>
  <tr>
    <td>PO BOX, CIUDAD &amp; PAIS</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="shipper3" id="shipper3" size="40" value="<?= $bl[shipper3]  ?>" /></td>
  </tr>
  <tr>
    <td>RFC</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="shipper4" id="shipper4" size="40" value="<?= $bl[shipper4]  ?>" /></td>
  </tr>
  <tr>
    <td>CTC</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="shipper5" id="shipper5" size="40" value="<?= $bl[shipper5] ?>" /></td>
  </tr>
  <tr>
    <td>TELEFONO</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="shipper6" id="shipper6" size="40" value="<?= $bl[shipper6]  ?>" /></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" id="t_nombre9"><b>CONSIGNEE</b> <br /></td>
  </tr>
  <tr>
    <td>NOMBRE </td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>   name="consignee1" id="consignee1" size="40"  style="background-color:#AFCDB8" value="<?= $bl[consignee]  ?>"/></td>
  </tr>
  <tr>
    <td colspan="2" style="color:#F00"><strong><i>Teclee el nombre de Consignee</i></strong></td>
  </tr>
  <tr>
    <td>DIRECCION</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="consignee2" id="consignee2" size="40" value="<?= $bl[consignee2]  ?>" /></td>
  </tr>
  <tr>
    <td>PO BOX, CIUDAD &amp; PAIS</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="consignee3" id="consignee3" size="40" value="<?= $bl[consignee3]  ?>" /></td>
  </tr>
  <tr>
    <td>RFC</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="consignee4" id="consignee4" size="40"  value="<?= $bl[consignee4]  ?>"/></td>
  </tr>
  <tr>
    <td>CTC</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="consignee5" id="consignee5" size="40" value="<?= $bl[consignee5]  ?>" /></td>
  </tr>
  <tr>
    <td>TELEFONO</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="consignee6" id="consignee6" size="40" value="<?= $bl[consignee6]  ?>" /></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" id="t_nombre10"><b>NOTIFY </b>
      <input name="chk_copy3" id="chk_copy3" type="checkbox" <?= $condicion==1 ? 'disabled="disabled" ' : ''?> title="Copy from consignee"  
      onclick="if(this.checked){
      $('#notify1').val($('#consignee1').val());
      $('#notify2').val($('#consignee2').val());
      $('#notify3').val($('#consignee3').val());
      $('#notify4').val($('#consignee4').val());
      $('#notify5').val($('#consignee5').val());
      $('#notify6').val($('#consignee6').val());
      }else{
      $('#notify1').val('');
      $('#notify2').val('');
      $('#notify3').val('');
      $('#notify4').val('');
      $('#notify5').val('');
      $('#notify6').val('');
      }" />
      <br /></td>
  </tr>
  <tr>
    <td>NOMBRE</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>   name="notify1" id="notify1" size="40"  style="background-color:#AFCDB8" value="<?= $bl[notify]  ?>"/></td>
  </tr>
  <tr>
    <td colspan="2" style="color:#F00"><strong><i>Teclee el nombre de Notify</i></strong></td>
  </tr>
  <tr>
    <td>DIRECCION</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="notify2" id="notify2" size="40"  value="<?= $bl[notify2]  ?>"/></td>
  </tr>
  <tr>
    <td>PO BOX, CIUDAD &amp; PAIS</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="notify3" id="notify3" size="40"  value="<?= $bl[notify3]  ?>"/></td>
  </tr>
  <tr>
    <td>RFC</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="notify4" id="notify4" size="40" value="<?= $bl[notify4]  ?>" /></td>
  </tr>
  <tr>
    <td>CTC</td>
    <td><input type="text" class="aa" name="notify5" id="notify5" size="40"  value="<?= $bl[notify5]  ?>" <?= $condicion==1 ? 'disabled="disabled" ' : ''?> /></td>
  </tr>
  <tr>
    <td>TELEFONO</td>
    <td><input type="text" class="aa" name="notify6" id="notify6" size="40" value="<?=$bl[notify6]  ?>" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  /></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td><b>CARGO</b></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>MBL SIN CARGO</span>
       
      <input <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  type="checkbox" id="cargo_vacio" name="cargo_vacio" title="Haga click en esta paloma si su Master BL no tiene cargo y contiene mas de un HBL."
      onclick="
      $('#marks').val(''); $('#quantity').val('');$('#type_of_bulks').val('');$('#description').val('');$('#tratamiento_madera').val('');
      $('#no_piezas').val('');$('#gross_weight').val('');$('#net_weight').val('');$('#volume').val('');$('#harmonized_code').val('');
      $('#ams').val('');$('#largo').val('');$('#ancho').val('');$('#alto').val('');" />
      </td>
    <td>&nbsp;</td>
  </tr>
  
  <tr>
    <td>COPIAR CARGO DE MBL A HBL</span>
      <input <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  type="checkbox" title="Haga click en esta paloma para copiar el cargo del MBL en el HBL."
      onclick="
      if(this.checked){
      $('#h_marks').val($('#marks').val());$('#h_quantity').val($('#quantity').val());
      
      $('#h_type_of_bulks').val($('#type_of_bulks').val());   $('#h_tratamiento_madera').val($('#tratamiento_madera').val());$('#h_description').val($('#description').val());
      $('#h_no_piezas').val($('#no_piezas').val());$('#h_gross_weight').val($('#gross_weight').val());
      
      $('#h_net_weight').val($('#net_weight').val());$('#h_volume').val($('#volume').val());
      $('#h_harmonized_code').val($('#harmonized_code').val());
      document.getElementById('h_correcciones').value= document.getElementById('correcciones').value;
      
      $('#h_no_piezas_imo').val($('#no_piezas_imo').val());
      $('#h_gross_weight_imo').val($('#gross_weight_imo').val());
      $('#h_volume_imo').val($('#volume_imo').val());
      $('#h_un_imo').val($('#un_imo').val());
      $('#h_imo').val($('#imo').val());
      
      $('#h_ams').val($('#ams').val());$('#h_largo').val($('#largo').val());$('#h_ancho').val($('#ancho').val());$('#h_alto').val($('#alto').val());
      }else{
      
      $('#h_no_piezas_imo').val('');
      $('#h_gross_weight_imo').val('');
      $('#h_volume_imo').val('');
      $('#h_un_imo').val('');
      $('#h_imo').val('');
      
      
      $('#h_marks').val(''); $('#h_quantity').val('');$('#h_type_of_bulks').val('');$('#h_tratamiento_madera').val('');$('#h_description').val('');
      $('#h_no_piezas').val('');$('#h_gross_weight').val('');$('#h_net_weight').val('');$('#h_volume').val('');$('#h_harmonized_code').val('');
      $('#h_ams').val('');$('#h_largo').val('');$('#h_ancho').val('');$('#h_alto').val('');
      }
  
      " /></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>MARCA</td>
    <td><input type="text" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  class="aa" name="marks" id="marks" size="40"  style="background-color:#AFCDB8" value="<?=$partida[markandnos]?>" />
      <span style="color:#F00"><strong><em>Teclee la marca, no se acepta S/M S/N</em></strong></span></td>
  </tr>
  <tr>
    <td>CANTIDAD</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="quantity" id="quantity" size="40" value="<?=$partida[tipo_bl]=='MBL' ? $partida[bulk] : '' ?>" />
      <span style="color:#F00"><strong><em>Sólo la cantidad (número). Ejemplo: 8</em></strong></span></td>
  </tr>
  <tr>
    <td valign="top">TIPO DE EMBALAJE</td>
    <td>   
    
     <? $q_embalajes = mysqli_query($link,"select * from embalajes order by nombre_embalaje");
	   ?>
       <select class="aa" name="type_of_bulks" id="type_of_bulks" <?= $condicion==1 ? 'disabled="disabled" ' : ''?> />
       <option value=""></option>
       <?
	   while($rq_embalajes=mysqli_fetch_array($q_embalajes)){
	   ?>
       <option value="<?=$rq_embalajes[nombre_embalaje]?>"><?=$rq_embalajes[nombre_embalaje]?></option>
       
       <? } ?>
       <option value="<?=$partida[tipo_bl]=='MBL' ? $partida[type_of_bulks] : '' ?>" selected="selected"></option>
       </select></td>
  </tr>
  <tr style="display:none">
    <td valign="top">SELECCIONE  TRATAMIENTO DE LA MADERA</td>
    <td><select class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="tratamiento_madera" id="tratamiento_madera" />
      
     </select>
    </td>
  </tr>
 
  <tr>
    <td valign="top">DESCRIPCION DE LA MERCANCIA DECLARADA POR EL EMBARCADOR (SHIPPER)</td>
    
    <td>
    
    <textarea class="aa" name="description" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  id="description" rows="5" cols="31"><?=$partida[tipo_bl]=='MBL' ? $partida[cargo] : '' ?></textarea>
    
  
       <span style="color:#F00"><strong><em>Descripción de la carga (en inglés)</em></strong></span></td>
  </tr>
  <tr>
    <td align="left">NUMERO DE PIEZAS</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="no_piezas" id="no_piezas" size="40"   value="<?=$partida[tipo_bl]=='MBL' ? $partida[number_of_pieces] : ''?>" />
      <span style="color:#F00"><strong><em>Bultos y/o piezas. Ej: 1534 pieces // 23 boxes with 12365 pieces</em></strong></span></td>
  </tr>
  <tr>
    <td>PESO BRUTO KGS.</td>
    <td><input type="text" class="aa" name="gross_weight" id="gross_weight" size="40" value="<?=$partida[weight]?>" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>   />
      <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma. Ejemplo: 2538.24</em></strong></span></td>
  </tr>
  <tr style="display:none">
    <td>NET WEIGHT KGS. hidden</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="net_weight" id="net_weight" size="40" value="0"  />
      <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma. Ejemplo: 2426.24</em></strong></span></td>
  </tr>
  <tr>
    <td>VOLUMEN</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="volume" id="volume" size="40"  value="<?=$partida[measurement]?>"/>
      <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma. Ejemplo: 3.54</em></strong></span></td>
  </tr>
  
 
  <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
    <td>* NUMERO DE PIEZAS IMO</td>
    <td><input type="text" class="aa" name="no_piezas_imo" id="no_piezas_imo" size="40" value="<?=$partida4[number_of_pieces_imo]?>"  />
      <span style="color:#F00"><strong><em>Bultos y/o piezas de la carga IMO. Ej: 1534 pieces // 23 boxes with 12365 pieces</em></strong></span></td>
  </tr>
  <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
    <td>* PESO BRUTO IMO KGS.</td>
    <td><input type="text" class="aa" name="gross_weight_imo" id="gross_weight_imo" size="40" value="<?=$partida4[gross_weight_imo]?>"   />
      <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma, de la carga IMO. Ejemplo: 2538.24</em></strong></span></td>
  </tr>
  <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
    <td>* VOLUMEN IMO</td>
    <td><input type="text" class="aa" name="volume_imo" id="volume_imo" size="40" value="<?=$partida4[volume_imo]?>"   />
      <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma, de la carga IMO. Ejemplo: 3.54</em></strong></span></td>
  </tr>
  <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
    <td>* UN</td>
    <td><input type="text" class="aa" name="un_imo" id="un_imo" size="40" value="<?=$partida4[un_imo]?>"   />
      <span style="color:#F00"><strong><em>Sólo indicar el número de UN</em></strong></span></td>
  </tr>
  <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
    <td>* IMO</td>
    <td><input type="text" class="aa" name="imo" id="imo" size="40" value="<?=$partida4[imo_imo]?>"   />
      <span style="color:#F00"><strong><em>Sólo indicar el número de IMO</em></strong></span></td>
  </tr>
   
  <tr>
    <td>FRACCION ARANCELARIA</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="harmonized_code" id="harmonized_code" size="40" value="<?=$partida[harmonized_code]?>" />
      <span style="color:#F00"><strong><em>Sólo la cantidad y separar con coma y espacio si es más de una</em></strong></span></td>
  </tr>
  <tr style="display:none">
    <td>CUSTOMER OWN AMS hidden</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="ams" id="ams" size="40"  />
      <span style="color:#F00"><strong><em>Indicar  código de cliente si hará transmisión a la aduana americana</em></strong></span></td>
  </tr>
  <tr>
    <td colspan="2"><b>INDICAR CORRECCIONES EN CASO DE EXISTIR</b></td>
    </tr>
  <tr>
    <td colspan="2"><textarea <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  class="aa" name="correcciones" id="correcciones"   cols="45" rows="5"><?=$partida[correcciones]?></textarea></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr style="display:none">
    <td><b>DATOS DEL ARTICULO 23</b></td>
    <td>&nbsp;</td>
  </tr>
  <tr style="display:none">
    <td colspan="2" style="color:#F00"><strong><em>Complete los siguientes datos si desea imprimir el artículo 23</em></strong></td>
    </tr>
  <tr style="display:none">
    <td>MARCAS</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="marcas_articulo_23" id="marcas_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>DESCRIPCION (en español) DE LA MERCANCIA</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="descripcion_espanol_articulo_23" id="descripcion_espanol_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>TIPO DE MERCANCIA</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="tipo_mercancia_articulo_23" id="tipo_mercancia_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>REGIMEN</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="regimen_articulo_23" id="regimen_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>FACTURA O LISTA DE EMPAQUE No.</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="factura_articulo_23" id="factura_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>LINEA</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="linea_articulo_23" id="linea_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>CANTIDAD</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="cantidad_articulo_23" id="cantidad_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>TIPO DE EMBALAJE</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="tipo_embalaje_articulo_23" id="tipo_embalaje_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>SELLO</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="sello_articulo_23" id="sello_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>PESO NETO</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="peso_neto_articulo_23" id="peso_neto_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>PESO BRUTO</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="peso_bruto_articulo_23" id="peso_bruto_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>IMO</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="imo_articulo_23" id="imo_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>UN</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="un_articulo_23" id="un_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>TRANSPORTISTA</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="transportista_articulo_23" id="transportista_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>NOMBRE DEL CHOFER</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="nombre_del_chofer_articulo_23" id="nombre_del_chofer_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>No LICENCIA</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="no_licencia_articulo_23" id="no_licencia_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>PLACAS</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="placas_articulo_23" id="placas_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>ECONOMICO</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="economico_articulo_23" id="economico_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>EXPORTADOR</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="exportador_articulo_23" id="exportador_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>DIRECCION EXPORTADOR</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="direccion_exportador_articulo_23" id="direccion_exportador_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>CIUDAD EXPORTADOR</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="ciudad_exportador_articulo_23" id="ciudad_exportador_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>RFC EXPORTADOR</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="rfc_exportador_articulo_23" id="rfc_exportador_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>DOMICILIO AGENCIA ADUANAL</td>
    <td><input type="text" class="aa" <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  name="domicilio_agencia_aduanal_articulo_23" id="domicilio_agencia_aduanal_articulo_23" size="40"  /></td>
  </tr>
  <tr style="display:none">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">
    <? //if($cancelado==0){?>
    <input <?= $condicion==1 ? 'disabled="disabled" ' : ''?>  type="button" id="submit2" value="Guardar Master BL"  
    onclick="Guardar_Master_bl();"/>
    <? //} ?>
      &nbsp;<span id="saving_bl" style="color:#F00"></span></td>
  </tr>
  
  </table>
</form>
     

<form id="forma_2" name="forma_2" method="post">
  
   <table style="line-height:22px"  >
     <tr>
       <td id="t_nombre8">&nbsp;</td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td id="t_nombre5">
       <div id="hbl">
       <span style="font-size:22PX;color:#00AF4B" ><B>HBL</B></span>
       </div> 
       <!--<a href="#mbl" style="color:#00AF4B; text-decoration:underline">Ir a MBL</a>&nbsp;&nbsp;<a href="#hbl" style="color:#00AF4B; text-decoration:underline">Ir a HBL</a>&nbsp;&nbsp;<a href="#lista" style="color:#00AF4B; text-decoration:underline">Lista de BLs</a>-->
       
       <br /><input type="hidden" id="h_id" name="h_id" readonly="readonly" />
       <input type="hidden" id="email" name="email" value="<?=$_SESSION[email]?>" />
       </td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td id="t_nombre3">BOOKING 
        </td><!--onBlur="if($('#h_booking').val()!=''){buscar_booking(document.getElementById('h_booking').value)}"-->
       <td><input type="text" class="aa" name="h_booking" id="h_booking" size="40" value="<?=$bl[booking]=='' ? ($booking_tmp!='' ? $booking_tmp : $bl4[booking]) : $bl[booking] ?>"  readonly="readonly"    /></td>
     </tr>
 
     
     <tr style="display:none">
       <td id="t_nombre3">SHIPPER FILE <img src="../images/info_gray.png" alt="" align="baseline" title="Ingrese el valor de SHIPPER FILE (o referencia única), esta referencia identifica unívocamente a su Master BL / carga" onMouseOver="ddrivetip('Ingrese el valor de SHIPPER FILE (o referencia única), esta referencia identifica unívocamente a su Master BL / carga','yellow', 300)"
onmouseout="hideddrivetip()" /></td>
       <td><input type="text" class="aa" name="h_shipper_file" id="h_shipper_file" size="40" 
       value="<?=$bl[shipper_file]=='' ? $bl4[shipper_file] : $bl[shipper_file]?>" /></td>
     </tr>
     
    
     
     <tr style="display:none">
       <td>STATUS hidden</td>
       <td><input type="text" name="h_status" id="h_status" size="40" disabled="disabled" >
       </td>
     </tr>
     

     <tr>
       <td>VAPOR/VIAJE</td>
       <td><input type="text" class="aa" name="h_vessel" id="h_vessel" size="40" disabled="disabled" value="<?=trim($bl1[vessel])=='' ? trim($viaje[vessel]).' '. trim($viaje[voyage]) : trim($bl1[vessel]).' '.trim($bl1[voyage])  ?>" /></td>
     </tr>
    <tr>
      <td>BANDERA DE BUQUE</td>
      <td><input type="text" class="aa" name="h_bandera_de_consolidado" id="h_bandera_de_consolidado" size="40" disabled="disabled" value="<?=trim($viaje[bandera_de_consolidado]) ?>" /></td>
    </tr>
     <tr>
       <td>PUERTO DE CARGA (POL)</td>
       <td><input type="text" class="aa" name="h_pol" id="h_pol" size="40" disabled="disabled" value="VERACRUZ, VERACRUZ"/></td>
     </tr>
     <tr>
       <td>PUERTO DE DESCARGA (POD)</td>
       <td><input type="text" class="aa" name="h_pod" id="h_pod" size="40" disabled="disabled" value="<?=$viaje[pod]=='' ? $bl1[pod].', '.$bl1[pod_country] : $viaje[pod]?>"/></td>
     </tr>
    
     <tr>
       <td id="t_nombre4">DESTINO FINAL</td>
       <td><input type="text" class="aa"   name="h_final_destination" id="h_final_destination" size="40" value="<?=$fd?>"/></td>
     </tr>
    <tr>
    <td>REFERENCIA DE EXPORTACION</td>
    <td><input type="text" class="aa"   name="h_export_reference" id="h_export_reference" size="40" value="<?=$bl[export_reference]=='' ? $bl4[export_reference] : $bl[export_reference]?>" /></td>
  </tr>
     <tr>
       <td id="t_nombre2">REFERENCIA INTERNA</td>
       <? $rcliente=$bl[referencia]=='' ? $bl4[referencia] : $bl[referencia];
	$rcliente = $rcliente=='' ? $referencia_cliente : $rcliente;
	?>
       <td><input type="text" class="aa"   name="h_referencia" id="h_referencia" size="40" value="<?=$rcliente?>" readonly="readonly" /></td>
     </tr>
     <tr>
       <td id="t_nombre14">ALMACEN DE CONSOLIDACION</td>
       <td><input type="text" class="aa" disabled="disabled"  size="40" value="<?=$viaje[almacen_consolidacion]?>" /></td>
     </tr>
     <tr>
       <td>CORREO AGENTE ADUANAL</td>
       <td><input type="text" class="aa" name="h_correo_agente_aduanal" id="h_correo_agente_aduanal" size="40" value="<? //=$bl[correo_agente_aduanal]?>" />
         &nbsp;<span style="color:#F00"><strong><em>Si quien documenta es Freight Forwarder mencionar el correo de la AG AD para dar seguimiento a la entrega de despacho y notificar número de contenedor</em></strong></span></td>
     </tr>
     <tr>
       <td id="t_nombre11">&nbsp;</td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td id="t_nombre3"><b>SHIPPER</b>
        <br /></td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td>NOMBRE</td>
       <td><input type="text" class="aa"    name="h_shipper1" id="h_shipper1" size="40"  style="background-color:#AFCDB8" value="<? //= $bl4[shipper]  ?>"/></td>
     </tr>
     <tr>
       <td colspan="2" style="color:#F00"><strong><i>Teclee el nombre de Shipper</i></strong></td>
      </tr>
     <tr>
       <td>DIRECCION</td>
       <td><input type="text" class="aa" name="h_shipper2" id="h_shipper2" size="40" value="<? //= $bl4[shipper2]  ?>" /></td>
     </tr>
     <tr>
       <td>PO BOX, CIUDAD &amp; PAIS</td>
       <td><input type="text" class="aa" name="h_shipper3" id="h_shipper3" size="40" value="<? //= $bl4[shipper3]  ?>" /></td>
     </tr>
     <tr>
       <td>RFC</td>
       <td><input type="text" class="aa" name="h_shipper4" id="h_shipper4" size="40"  value="<? //= $bl4[shipper4]  ?>"/></td>
     </tr>
     <tr>
       <td>CTC</td>
       <td><input type="text" class="aa" name="h_shipper5" id="h_shipper5" size="40" value="<? //= $bl4[shipper5]  ?>" /></td>
     </tr>
     <tr>
       <td>TELEFONO</td>
       <td><input type="text" class="aa" name="h_shipper6" id="h_shipper6" size="40" value="<? //= $bl4[shipper6]  ?>"  /></td>
     </tr>
     <tr>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td id="t_nombre3"><b>CONSIGNEE</b>
       <br /></td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td>NOMBRE </td>
       <td><input type="text" class="aa" name="h_consignee1" id="h_consignee1" size="40"  style="background-color:#AFCDB8" value="<? //= $bl4[consignee]  ?>"/></td>
     </tr>
     <tr>
       <td colspan="2" style="color:#F00"><strong><i>Teclee el nombre de Consignee</i></strong></td>
      </tr>
     <tr>
       <td>DIRECCION</td>
       <td><input type="text" class="aa" name="h_consignee2" id="h_consignee2" size="40" value="<? //= $bl4[consignee2]  ?>" /></td>
     </tr>
     <tr>
       <td>PO BOX, CIUDAD &amp; PAIS</td>
       <td><input type="text" class="aa"  name="h_consignee3" id="h_consignee3" size="40"  value="<? //= $bl4[consignee3]  ?>"/></td>
     </tr>
     <tr>
       <td>RFC</td>
       <td><input type="text" class="aa" name="h_consignee4" id="h_consignee4" size="40"  value="<? //= $bl4[consignee4]  ?>"/></td>
     </tr>
     <tr>
       <td>CTC</td>
       <td><input type="text" class="aa" name="h_consignee5" id="h_consignee5" size="40" value="<? //= $bl4[consignee5]  ?>" /></td>
     </tr>
     <tr>
       <td>TELEFONO</td>
       <td><input type="text" class="aa" name="h_consignee6" id="h_consignee6" size="40" value="<? //= $bl4[consignee6]  ?>"  /></td>
     </tr>
     <tr>
       <td colspan="2" >&nbsp;</td>
     </tr>
     <tr>
       <td colspan="2" id="t_nombre3"><b>NOTIFY </b>
         <input name="chk_copy2"  id="chk_copy2" type="checkbox" title="Copy from consignee"  
      onclick="if(this.checked){
      $('#h_notify1').val($('#h_consignee1').val());
      $('#h_notify2').val($('#h_consignee2').val());
      $('#h_notify3').val($('#h_consignee3').val());
      $('#h_notify4').val($('#h_consignee4').val());
      $('#h_notify5').val($('#h_consignee5').val());
      $('#h_notify6').val($('#h_consignee6').val());
      }else{
      $('#h_notify1').val('');
      $('#h_notify2').val('');
      $('#h_notify3').val('');
      $('#h_notify4').val('');
      $('#h_notify5').val('');
      $('#h_notify6').val('');
      }" />
         <br /></td>
      </tr>
     <tr>
       <td>NOMBRE</td>
       <td><input type="text" class="aa" name="h_notify1" id="h_notify1" size="40"  style="background-color:#AFCDB8" value="<? //= $bl4[notify]  ?>"/></td>
     </tr>
     <tr>
       <td colspan="2" style="color:#F00"><strong><i>Teclee el nombre de Notify</i></strong></td>
      </tr>
     <tr>
       <td>DIRECCION</td>
       <td><input type="text" class="aa" name="h_notify2" id="h_notify2" size="40"  value="<? //= $bl4[notify2]  ?>"/></td>
     </tr>
     <tr>
       <td>PO BOX, CIUDAD &amp; PAIS</td>
       <td><input type="text" class="aa" name="h_notify3" id="h_notify3" size="40" value="<? //= $bl4[notify3]  ?>" /></td>
     </tr>
     <tr>
       <td>RFC</td>
       <td><input type="text" class="aa" name="h_notify4" id="h_notify4" size="40" value="<? //= $bl4[notify4]  ?>" /></td>
     </tr>
     <tr>
       <td>CTC</td>
       <td><input type="text" class="aa" name="h_notify5" id="h_notify5" size="40" value="<? //= $bl4[notify5]  ?>"  /></td>
     </tr>
     <tr>
       <td>TELEFONO</td>
       <td><input type="text" class="aa" name="h_notify6" id="h_notify6" size="40" value="<? //=$bl4[notify6]  ?>"  /></td>
     </tr>
     <tr>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td><b>CARGO</b></td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td>MARCAS</td>
       <td><input type="text" class="aa" name="h_marks" id="h_marks" size="40"  style="background-color:#AFCDB8" value="<?=$partida4[markandnos]?>" />
        <span style="color:#F00"><strong><em>Teclee la marca, no se acepta S/M S/N</em></strong></span></td>
     </tr>
     <tr>
       <td>CANTIDAD</td>
       <td><input type="text" class="aa" name="h_quantity" id="h_quantity" size="40" value="<?= $partida4[bulk]  ?>"  />
        <span style="color:#F00"><strong><em>Sólo la cantidad (número). Ejemplo: 8</em></strong></span></td>
     </tr>
     <tr>
       <td valign="top"> TIPO DE EMBALAJE</td>
       <td>
       <? $q_embalajes = mysqli_query($link,"select * from embalajes order by nombre_embalaje");
	   ?>
       <select class="aa" name="h_type_of_bulks" id="h_type_of_bulks"  />
       <option value=""></option>
       <?
	   while($rq_embalajes=mysqli_fetch_array($q_embalajes)){
	   ?>
       <option value="<?=$rq_embalajes[nombre_embalaje]?>"><?=$rq_embalajes[nombre_embalaje]?></option>
       
       <? } ?>
       <option value="<?=  $partida4[type_of_bulks] ?>" selected="selected"></option>
       </select></td>
     </tr>
     <tr  style="display:none">
       <td valign="top">SELECCIONE  TRATAMIENTO DE LA MADERA</td>
       <td><select class="aa" name="h_tratamiento_madera" id="h_tratamiento_madera" />
  		  
         </select></td>
     </tr>
     <tr>
       <td valign="top" align="left">DESCRIPCION DE LA MERCANCIA DECLARADA POR EL EMBARCADOR (SHIPPER)</td>
       <td><textarea class="aa" name="h_description" id="h_description"  rows="5" cols="31"><?=$partida4[cargo]?></textarea>
        <span style="color:#F00"><strong><em>Descripción de la carga (en inglés)</em></strong></span></td>
     </tr>
     <tr>
       <td align="left">NUMERO DE PIEZAS </td>
       <td><input type="text" class="aa" name="h_no_piezas" id="h_no_piezas" size="40" value="<?=$partida4[number_of_pieces]?>"  />
        <span style="color:#F00"><strong><em>Bultos y/o piezas. Ej: 1534 pieces // 23 boxes with 12365 pieces</em></strong></span></td>
     </tr>
     <tr>
       <td>PESO BRUTO KGS.</td>
       <td><input type="text" class="aa" name="h_gross_weight" id="h_gross_weight" size="40" value="<?=$partida4[weight]?>"   />
        <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma. Ejemplo: 2538.24</em></strong></span></td>
     </tr>
     <tr style="display:none">
       <td>NET WEIGHT KGS. hidden</td>
       <td><input type="text" class="aa" name="h_net_weight" id="h_net_weight" size="40" value="0"  />
        <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma. Ejemplo: 2426.24</em></strong></span></td>
     </tr>
     <tr>
       <td>VOLUMEN</td>
       <td><input type="text" class="aa" name="h_volume" id="h_volume" size="40" value="<?=$partida4[measurement]?>" />
        <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma. Ejemplo: 3.54</em></strong></span></td>
     </tr>
     <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
       <td>* NUMERO DE PIEZAS IMO</td>
       <td><input type="text" class="aa" name="h_no_piezas_imo" id="h_no_piezas_imo" size="40" value="<?=$partida4[h_no_piezas_imo]?>"  /><span style="color:#F00"><strong><em>Bultos y/o piezas de la carga IMO. Ej: 1534 pieces // 23 boxes with 12365 pieces</em></strong></span></td>
     </tr>
     <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
       <td>* PESO BRUTO IMO KGS.</td>
        <td><input type="text" class="aa" name="h_gross_weight_imo" id="h_gross_weight_imo" size="40" value="<?=$partida4[h_gross_weight_imo]?>"   />
        <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma, de la carga IMO. Ejemplo: 2538.24</em></strong></span></td>
     </tr>
     <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
       <td>* VOLUMEN IMO</td>
        <td><input type="text" class="aa" name="h_volume_imo" id="h_volume_imo" size="40" value="<?=$partida4[h_volume_imo]?>"   />
        <span style="color:#F00"><strong><em>Sólo la cantidad, sin letras ni coma, de la carga IMO. Ejemplo: 3.54</em></strong></span></td>
     </tr>
     <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
       <td>* UN</td>
        <td><input type="text" class="aa" name="h_un_imo" id="h_un_imo" size="40" value="<?=$partida4[h_un_imo]?>"   />
        <span style="color:#F00"><strong><em>Sólo indicar el número de UN</em></strong></span></td>
     </tr>
     <tr <?=$carga_imo=='0' ? ' style="display:none" ' : ' style="display:block" '?>>
       <td>* IMO</td>
        <td><input type="text" class="aa" name="h_imo" id="h_imo" size="40" value="<?=$partida4[h_imo]?>"   />
        <span style="color:#F00"><strong><em>Sólo indicar el número de IMO</em></strong></span></td>
     </tr>
     <tr>
       <td>FRACCION ARANCELARIA</td>
       <td><input type="text" class="aa" name="h_harmonized_code" id="h_harmonized_code" size="40" value="<?=$partida4[harmonized_code]?>" />
        <span style="color:#F00"><strong><em>Sólo la cantidad y separar con coma y espacio si es más de una</em></strong></span></td>
     </tr>
     <tr style="display:none">
       <td>CUSTOMER OWN AMS hidden</td>
       <td><input type="text" class="aa" name="h_ams" id="h_ams" size="40"  />
        <span style="color:#F00"><strong><em>Indicar código de cliente si hará transmisión a la aduana americana</em></strong></span></td>
     </tr>
     <tr>
       <td colspan="2"><b>INDICAR CORRECCIONES EN CASO DE EXISTIR</b></td>
     </tr>
     <tr>
       <td colspan="2"><textarea class="aa" name="h_correcciones" id="h_correcciones"   cols="45" rows="5"></textarea></td>
     </tr>
     <tr>
       <td colspan="2">&nbsp;</td>
     </tr>
     <tr style="display:none">
       <td><b>DATOS DEL ARTICULO 23</b></td>
       <td>&nbsp;</td>
     </tr>
     <tr style="display:none">
       <td colspan="2" style="color:#F00"><strong><em>Complete los siguientes datos si desea imprimir el artículo 23</em></strong></td>
     </tr>
     <tr style="display:none">
       <td>MARCAS</td>
       <td><input type="text" class="aa" name="hmarcas_articulo_23" id="hmarcas_articulo_23" size="40"  /></td>
     </tr>
 
     <tr style="display:none">
       <td>DESCRIPCION (en español) DE LA MERCANCIA</td>
       <td><input type="text" class="aa" name="hdescripcion_espanol_articulo_23" id="hdescripcion_espanol_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>TIPO DE MERCANCIA</td>
       <td><input type="text" class="aa" name="htipo_mercancia_articulo_23" id="htipo_mercancia_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>REGIMEN</td>
       <td><input type="text" class="aa" name="hregimen_articulo_23" id="hregimen_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>FACTURA O LISTA DE EMPAQUE No.</td>
       <td><input type="text" class="aa" name="hfactura_articulo_23" id="hfactura_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>LINEA</td>
       <td><input type="text" class="aa" name="hlinea_articulo_23" id="hlinea_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>CANTIDAD</td>
       <td><input type="text" class="aa" name="hcantidad_articulo_23" id="hcantidad_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>TIPO DE EMBALAJE</td>
       <td><input type="text" class="aa" name="htipo_embalaje_articulo_23" id="htipo_embalaje_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>SELLO</td>
       <td><input type="text" class="aa" name="hsello_articulo_23" id="hsello_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>PESO NETO</td>
       <td><input type="text" class="aa" name="hpeso_neto_articulo_23" id="hpeso_neto_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>PESO BRUTO</td>
       <td><input type="text" class="aa" name="hpeso_bruto_articulo_23" id="hpeso_bruto_articulo_23" size="40"  /></td>
     </tr>
      
     <tr style="display:none">
       <td>IMO</td>
       <td><input type="text" class="aa" name="himo_articulo_23" id="himo_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>UN</td>
       <td><input type="text" class="aa" name="hun_articulo_23" id="hun_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>TRANSPORTISTA</td>
       <td><input type="text" class="aa" name="htransportista_articulo_23" id="htransportista_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>NOMBRE DEL CHOFER</td>
       <td><input type="text" class="aa" name="hnombre_del_chofer_articulo_23" id="hnombre_del_chofer_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>No LICENCIA</td>
       <td><input type="text" class="aa" name="hno_licencia_articulo_23" id="hno_licencia_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>PLACAS</td>
       <td><input type="text" class="aa" name="hplacas_articulo_23" id="hplacas_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>ECONOMICO</td>
       <td><input type="text" class="aa" name="heconomico_articulo_23" id="heconomico_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>EXPORTADOR</td>
       <td><input type="text" class="aa" name="hexportador_articulo_23" id="hexportador_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>DIRECCION EXPORTADOR</td>
       <td><input type="text" class="aa" name="hdireccion_exportador_articulo_23" id="hdireccion_exportador_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>CIUDAD EXPORTADOR</td>
       <td><input type="text" class="aa" name="hciudad_exportador_articulo_23" id="hciudad_exportador_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>RFC EXPORTADOR</td>
       <td><input type="text" class="aa" name="hrfc_exportador_articulo_23" id="hrfc_exportador_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td>DOMICILIO AGENCIA ADUANAL</td>
       <td><input type="text" class="aa" name="hdomicilio_agencia_aduanal_articulo_23" id="hdomicilio_agencia_aduanal_articulo_23" size="40"  /></td>
     </tr>
     <tr style="display:none">
       <td colspan="2">&nbsp;</td>
     </tr>
     <tr>
       <td colspan="2">
       <? //if($cancelado==0){?>
       <input type="button"  id="submit1" value="Guardar House BL"  onclick="Guardar_hbl()"/>
       <? //} ?>
       </td><!--disabled="disabled"-->
     </tr> 
     
     <tr>
       <td colspan="2">
        &nbsp;&nbsp;
       </td>
     </tr>
    </table>
     
     <table>
     <tr>
       <td colspan="2">
          
       <!--<div id="lista">
       <span style="font-size:22PX;color:#00AF4B"><B>Lista de BLs</B></span><BR />
       <a href="#mbl" style="color:#00AF4B; text-decoration:underline">Ir a MBL</a>&nbsp;&nbsp;<a href="#hbl" style="color:#00AF4B; text-decoration:underline">Ir a HBL</a>&nbsp;&nbsp;<a href="#lista" style="color:#00AF4B; text-decoration:underline">Lista de BLs</a>
       </div>-->
       </td>
     </tr>
  
     <!--<tr>
       <td colspan="2"><label>
         <input type="checkbox" name="checkbox5" id="checkbox5" />
         Documentado</label></td>
     </tr>
     <tr>
       <td colspan="2"><input type="checkbox" name="checkbox5" id="checkbox6" />
         Pedimento entregado </td>
     </tr>
     <tr>
       <td colspan="2"><input type="checkbox" name="checkbox5" id="checkbox7" />
         Roll over</td>
     </tr>
     <tr>
       <td colspan="2"><input type="checkbox" name="checkbox5" id="checkbox8" />
         Cancelado </td>
     </tr>-->
   
     
      <tr>
       <td colspan="2">
       
       </td>
     </tr>
       
  
     <tr>
       <td colspan="2">&nbsp;<span id="saving_hbl" style="color:#F00"></span></td>
     </tr>
   </table>
</form>
   <? include("../pie1.php");?> 

<script>
if($('#h_booking').val()!=''){
	//buscar_booking(document.getElementById('h_booking').value);
}else{
	if($('#booking').val()!=''){ //buscar_booking_master(document.getElementById('booking').value)}
}
</script>
<? if(trim($_POST[booking_search])!=''){?>
<script>
//$('#booking').val('<?=trim($_POST[booking_search])?>')
//document.getElementById('description').value='<?=$rQ3[tipo_bl]=='MBL' ? $rQ3[cargo] : '' ?>'
//buscar_booking_master('<?=trim($_POST[booking_search])?>')

</script>
<? } ?>

<script>
 LstAjax('divPartidas','partidas_bl.php?booking='+$('#booking').val()+'&registrado_por=<?=$_SESSION[email]?>');
 </script>
 <? } ?>