function parseGetVars()
{
  var sPath = window.location.pathname;
  var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
  var page = sPage.split(/\./);
  currentpagetag = page[0].replace(/-/g,"_");
  var currentpagebutton = "side_nav_" + currentpagetag;
  if (document.getElementById(currentpagebutton) !== null){
  document.getElementById(currentpagebutton).style.backgroundImage = 'url("images/subnav_background_over.jpg")';
  document.getElementById(currentpagebutton).firstChild.firstChild.style.color='#fff';
  document.getElementById(currentpagebutton).onmouseout = '';
  document.getElementById(currentpagebutton).onmouseover = '';
  }
}

function showdiv(d) {
    if(d.length < 1) { return; }
    if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
    else { document.getElementById(d).style.display = "none"; }
  }
  
function over(id) {
  id.firstChild.firstChild.style.color = '#fff';
}
function out(id) {
  id.firstChild.firstChild.style.color = '#000';
}

function checkForm() {
  var err = 0;
  //Populate the array with all the page tags
  var allPageTags=document.getElementsByTagName("*");
  //Cycle through the tags using a for loop
  for (i=0; i<allPageTags.length; i++) {
    //Pick out the tags with our class name
    if (allPageTags[i].className=='required') {
    	//Manipulate this in whatever way you want
    	err = checkText(allPageTags[i].id, err);
    }
  }
  if (err == 1 || err == null){
    alert("Please fill in all required fields!")
    return false;
  }else{
    return true;
  }
} 

function checkPhone(){
  re = /[A-Za-z]/
  if(re.test(document.getElementById('phone').value)){
    if(err == 0){err = 1;}
    document.getElementById(entry).style.border="2px solid #FF0000";
    return err;
  }
}


function checkText(entry, err){
  var str = document.getElementById(entry).value;
  str = str.replace(/\s+/g,'');
  if(str == ''){
    if(err == 0){err = 1;}
    document.getElementById(entry).style.border="2px solid #FF0000";
    return err;
  }
  return err;
}
