function jsCambiaCapaDisplay(eleId){
  var cual = document.getElementById(eleId);
  cual.style.display = (cual.style.display == "none") ? ("block") : ("none");
  return false;
}
function jsEnviarValor(){
  var eid;
  var ele = document.getElementById('ele').value;
  var mod = document.getElementById('mod').value;
  
  eid = document.getElementById('valnom');
  var nom = (eid) ? (eid.value) : ('');
  eid = document.getElementById('valmai');
  var mai = (eid) ? (eid.value) : ('');
  eid = document.getElementById('valurl');
  var url = (eid) ? (eid.value) : ('');
  eid = document.getElementById('valtxt');
  var txt = (eid) ? (eid.value) : ('');
  eid = document.getElementById('valval');
  var val = (eid) ? (eid.value) : (0);
  if(chkValor()) {
    axEnviarValor(ele, mod, nom, mai, url, txt, val);
  }
  return false;
}
function jsMarcar(pCual, pValor) {
  var aIdi = new Array("es", "en", "fr", "de", "pt", "it", "nl");
  var i;
  var nom;
  var ele;

  for (i in aIdi) {
    nom = 'chk' + pCual + '_' + aIdi[i];
    ele = document.getElementById(nom);
    if (ele) {
      ele.checked = (pValor) ? (true) : (false);
    }
  }
}

function jsCompletarCallback(i, d) {
  return d + '&mod=buscar&pai=' + $F('pai');
}

function jsCompletarCallbackHotel(i, d) {
  //alert(d);
  return d + '&mod=buscar_ayu&pai=' + $F('pai');
}

function getSelectionId(text, li) {
  $('tip').value = li.id;
}
function jsCambiaIdioma() {
  window.location = PPATH + 'index.php?lang=' + $F('flang');
}
function jsReload() {
  //alert('hola');
  window.location.reload();
  //location.reload();
}

function jsChequearAltaCliente() {
  var r = false;
  if (!$F('fclinom')) {
    alert(txtA[31]);
  } else if (!$F('fcliusu')) {
    alert(txtA[32]);
  } else if (!$F('fclicla')) {
    alert(txtA[33]);
  } else if (!$F('fclicla2')) {
    alert(txtA[34]);
  } else if ($F('fclicla') != $F('fclicla2')) {
    alert(txtA[35]);
  } else if (!$F('fclivalida')) {
    alert(txtA[36]);
  } else if (!$F('fcliace')) {
    alert(txtA[37]);
  } else {
    r = true;
  }
  return r;
}
function feeAct (cal) {
  var date = cal.date;
  var time = date.getTime();
  time += Date.DAY;
  var masundia = new Date(time);
  if ($F('fes') == '') {
    $('fes').value = masundia.print('%d-%m-%Y');
  } else {
    var arrFes = $F('fes').split('-');
    var fesa = parseInt(arrFes[2], 10);
    var fesm = parseInt(arrFes[1], 10);
    var fesd = parseInt(arrFes[0], 10);
    fesm -= 1;
    var dateFes = new Date(fesa, fesm, fesd);
    if (dateFes <= date) {
      $('fes').value = masundia.print('%d-%m-%Y');
    }
  }
}
function fesAct (cal) {
  var date = cal.date;
  var time = date.getTime();
  time -= Date.DAY;
  var menosundia = new Date(time);
  if ($F('fee') == '') {
    $('fee').value = menosundia.print('%d-%m-%Y');
  } else {
    var arrFee = $F('fee').split('-');
    var feea = parseInt(arrFee[2], 10);
    var feem = parseInt(arrFee[1], 10);
    var feed = parseInt(arrFee[0], 10);
    feem -= 1;
    var dateFee = new Date(feea, feem, feed);
    if (dateFee >= date) {
      $('fee').value = menosundia.print('%d-%m-%Y');
    }
  }
}

/***
* Expande - comprime la Ayuda en la parte derecha
****/
function abrirCerrar(id_obj){
  if(!$(id_obj).visible())
    Effect.SlideDown(id_obj, { duration: 0.5 });
  else Effect.SlideUp(id_obj, { duration: 0.5 });
  return false;
}
