/*
  This function shoes and hides the sub nav when you click onto a collapsable primary nav item
*/

function show_hide_sub_nav(n,m) {
  x = document.getElementById('subnav'+n);
  y = document.getElementById('subsubnav'+m);
  if(x.style.display == 'block') {
    x.style.display = 'none';
    y.style.display = 'none';
  } else {
    x.style.display = 'block';
  }
}



/*
  This function shoes and hides the sub nav's sub nav when you click onto a collapsable sub nav item
*/

function show_hide_sub_sub_nav(n,m) {
  x = document.getElementById('subnav'+m);
  y = document.getElementById('subsubnav'+n);
  if(y.style.display == 'block') {
    y.style.display = 'none';
  } else {
    x.style.backgroundColor = 'red';
    x.style.display = 'block';
    y.style.display = 'block';
  }
}



/*
  Check that the form has something to search for. the form submits and displays a message if JS is disables anyway
 */
 
function check_form() {
  x = document.getElementById('search_country');
  y = document.getElementById('search_price');
  z = document.getElementById('search_keywords');
  if(x.value == '' && y.value == '' && (z.value == 'Enter keyword...' || z.value == '')) {
    alert('Please select at least one option to search with');
    return false;
  }
}