window.onload = window_onLoad;

function window_onLoad()
{
   //Captura de Eventos
   document.all['DDLPais'].onchange = DDLPais_onChange;
   document.all['BPUDireccionCerrar'].onclick = BPUDireccionCerrar_onClick;
   document.all['BPUDNICerrar'].onclick = BPUDNICerrar_onClick;
   document.all['LinkDireccion'].onclick = LinkDireccion_onClick;
   document.all['LinkDNI'].onclick = LinkDNI_onClick;
   /*document.all['CBLBuscando_6'].onclick = CBLBuscando6_onClick;
   document.all['CBLBuscando_7'].onclick = CBLBuscando7_onClick;
   document.all['CBLBuscando_8'].onclick = CBLBuscando8_onClick;
   document.all['CBLBuscando_9'].onclick = CBLBuscando9_onClick;
   document.all['CBLOfrecer_6'].onclick = CBLOfrecer6_onClick;
   document.all['CBLOfrecer_7'].onclick = CBLOfrecer7_onClick;
   document.all['CBLOfrecer_8'].onclick = CBLOfrecer8_onClick;
   document.all['CBLOfrecer_9'].onclick = CBLOfrecer9_onClick;*/
}

function DDLPais_onChange()
{
   var comboPais = document.all['DDLPais'];
   var comboProvincia = document.all['DDLProvincia'];
   var textPovincia = document.all['TBProvincia'];
   
   if (comboPais[comboPais.selectedIndex].value == 1)
   {
      comboProvincia.className = "";
      comboProvincia.disabled = false;
      textPovincia.className = "disabled";
      textPovincia.disabled = true;
   }
   else
   {
      comboProvincia.className = "disabled";
      comboProvincia.disabled = true;
      textPovincia.className = "";
      textPovincia.disabled = false;
   }
}

function LinkDireccion_onClick()
{
   var divDireccion = document.all['PUDireccion'];
     
   divDireccion.style.top = mouseY(event);
   divDireccion.style.left = mouseX(event);
   divDireccion.style.zorder = 0;
   if (divDireccion.style.visibility == 'visible')
   {
      divDireccion.style.visibility = 'hidden';  
   }
   else
   {
      divDireccion.style.visibility = 'visible';
   }
}

function LinkDNI_onClick()
{
   var divDNI = document.all['PUDNI'];
     
   divDNI.style.top = mouseY(event)-100;
   divDNI.style.left = mouseX(event);
   divDNI.style.zorder = -10;
   if (divDNI.style.visibility == 'visible')
   {
      divDNI.style.visibility = 'hidden';  
   }
   else
   {
      divDNI.style.visibility = 'visible';
   }
}

function BPUDireccionCerrar_onClick()
{
   var divDireccion = document.all['PUDireccion'];
   
   divDireccion.style.visibility = 'hidden';
}

function BPUDNICerrar_onClick()
{
   var divDNI = document.all['PUDNI'];
   
   divDNI.style.visibility = 'hidden';
}

function CBLBuscando6_onClick()
{
   var checkCBLBuscando_6 = document.all['CBLBuscando_6'];
   var textBusKeyAsesoramiento = document.all['TBBusKey7'];
   
   if (checkCBLBuscando_6.checked)
   {
      textBusKeyAsesoramiento.className = "";
      textBusKeyAsesoramiento.disabled = false;
   }
   else
   {
      textBusKeyAsesoramiento.className = "disabled";
      textBusKeyAsesoramiento.disabled = true;
   }
}

function CBLBuscando7_onClick()
{
   var checkCBLBuscando_7 = document.all['CBLBuscando_7'];
   var textBusKeyCapacitacion = document.all['TBBusKey8'];
   
   if (checkCBLBuscando_7.checked)
   {
      textBusKeyCapacitacion.className = "";
      textBusKeyCapacitacion.disabled = false;
   }
   else
   {
      textBusKeyCapacitacion.className = "disabled";
      textBusKeyCapacitacion.disabled = true;
   }
}

function CBLBuscando8_onClick()
{
   var checkCBLBuscando_8 = document.all['CBLBuscando_8'];
   var textBusKeyInformacion = document.all['TBBusKey9'];
   
   if (checkCBLBuscando_8.checked)
   {
      textBusKeyInformacion.className = "";
      textBusKeyInformacion.disabled = false;
   }
   else
   {
      textBusKeyInformacion.className = "disabled";
      textBusKeyInformacion.disabled = true;
   }
}

function CBLBuscando9_onClick()
{
   var checkCBLBuscando_9 = document.all['CBLBuscando_9'];
   var textBusKeyOtros = document.all['TBBusKey10'];
   
   if (checkCBLBuscando_9.checked)
   {
      textBusKeyOtros.className = "";
      textBusKeyOtros.disabled = false;
   }
   else
   {
      textBusKeyOtros.className = "disabled";
      textBusKeyOtros.disabled = true;
   }
}

function CBLOfrecer6_onClick()
{
   var checkCBLOfrecer_6 = document.all['CBLOfrecer_6'];
   var textOfrKeyAsesoramiento = document.all['TBOfrKey7'];
   
   if (checkCBLOfrecer_6.checked)
   {
      textOfrKeyAsesoramiento.className = "";
      textOfrKeyAsesoramiento.disabled = false;
   }
   else
   {
      textOfrKeyAsesoramiento.className = "disabled";
      textOfrKeyAsesoramiento.disabled = true;
   }
}

function CBLOfrecer7_onClick()
{
   var checkCBLOfrecer_7 = document.all['CBLOfrecer_7'];
   var textOfrKeyCapacitacion = document.all['TBOfrKey8'];
   
   if (checkCBLOfrecer_7.checked)
   {
      textOfrKeyCapacitacion.className = "";
      textOfrKeyCapacitacion.disabled = false;
   }
   else
   {
      textOfrKeyCapacitacion.className = "disabled";
      textOfrKeyCapacitacion.disabled = true;
   }
}

function CBLOfrecer8_onClick()
{
   var checkCBLOfrecer_8 = document.all['CBLOfrecer_8'];
   var textOfrKeyInformacion = document.all['TBOfrKey9'];
   
   if (checkCBLOfrecer_8.checked)
   {
      textOfrKeyInformacion.className = "";
      textOfrKeyInformacion.disabled = false;
   }
   else
   {
      textOfrKeyInformacion.className = "disabled";
      textOfrKeyInformacion.disabled = true;
   }
}

function CBLOfrecer9_onClick()
{
   var checkCBLOfrecer_9 = document.all['CBLOfrecer_9'];
   var textOfrKeyOtros = document.all['TBOfrKey10'];
   
   if (checkCBLOfrecer_9.checked)
   {
      textOfrKeyOtros.className = "";
      textOfrKeyOtros.disabled = false;
   }
   else
   {
      textOfrKeyOtros.className = "disabled";
      textOfrKeyOtros.disabled = true;
   }
}

function SugerirUsuario()
{
   if (document.all['TBUsuario'].value == null || document.all['TBUsuario'].value == "")
   {
      if (document.all['TBApellido'].value != null && document.all['TBApellido'].value != "")
      {
         document.all['TBUsuario'].value = document.all['TBNombre'].value.toLowerCase().charAt(0);
         document.all['TBUsuario'].value += document.all['TBApellido'].value.toLowerCase();
      }
   }
}


