function hide(idLayer) { 
  try {
    if(typeof(idLayer) != "object")
    {
      try
      {
        document.getElementById(idLayer).style.display='none'; 
      }
      catch(error){}
    }
    else
    { 
      idLayer.style.display='none'; 
    }
  }
  catch(e){};
}

// used to hide and show elements. 
function show(idLayer) {
  try{
    if(typeof(idLayer) != "object")
      document.getElementById(idLayer).style.display='block';  
    else
      idLayer.style.display='block';  
  }
  catch(e){alert(1)};
}

function showInline(idLayer) { 
  try{
    if(typeof(idLayer) != "object")
      document.getElementById(idLayer).style.display='inline'; 
    else
      idLayer.style.display='inline'; 
  } 
  catch(e){alert(2)};
}

function displayages(childobj,suffix)
{ 
if (childobj.options[0].selected){
  hide("children_box"+suffix); 
  hide("minorsAge1"+suffix); 
  hide("minorsAge2"+suffix); 
  hide("minorsAge3"+suffix); 
  hide("minorsAge4"+suffix);}
if (childobj.options[1].selected){
  show("children_box"+suffix); 
  showInline("minorsAge1"+suffix); 
  hide("minorsAge2"+suffix); 
  hide("minorsAge3"+suffix); 
  hide("minorsAge4"+suffix);}
if (childobj.options[2].selected){
  show("children_box"+suffix); 
  showInline("minorsAge1"+suffix); 
  showInline("minorsAge2"+suffix); 
  hide("minorsAge3"+suffix); 
  hide("minorsAge4"+suffix);}
if (childobj.options[3].selected){
  show("children_box"+suffix); 
  showInline("minorsAge1"+suffix); 
  showInline("minorsAge2"+suffix); 
  showInline("minorsAge3"+suffix); 
  hide("minorsAge4"+suffix);}
if (childobj.options[4].selected){ 
  show("children_box"+suffix); 
  showInline("minorsAge1"+suffix); 
  showInline("minorsAge2"+suffix); 
  showInline("minorsAge3"+suffix); 
  showInline("minorsAge4"+suffix);}
}

function dateCheck(dateEl,yy,mm,dd){
  var inputDateArray = dateEl.value.split("/");
  if(inputDateArray.length != 3) {
      dateEl.style.background = "#fff url(http://images.wctravel.com/images-general/warningBG.gif) 100% 50% no-repeat";
      return false;   
  }
  if (isNaN(parseInt(inputDateArray[0])) || isNaN(parseInt(inputDateArray[1])) || isNaN(parseInt(inputDateArray[2])))
  {
    dateEl.style.background = "#fff url(http://images.wctravel.com/images-general/warningBG.gif) 100% 50% no-repeat";
    return false;   
  }

  dateEl.style.background = "";
  if (yy != "")
    document.getElementById(yy).value = inputDateArray[2];
  if (mm != "")
    document.getElementById(mm).value = inputDateArray[0];
  if (dd != "")
    document.getElementById(dd).value = inputDateArray[1];

  return true;
}
