
// menu control
function over(item) {
  document.getElementById('menuImage').src = "/menu/" + item + ".jpg";
  document.getElementById(item).src = "/menu/on.gif";
}
function out(item) {
  document.getElementById('menuImage').src = "/menu/default.jpg"
  document.getElementById(item).src = "/menu/off.gif";
}
function menu(link) {
  if (link == "home") link = "";
  window.location.href = "/" + link;
}

// popups - used for announcement
function displayMe(popup) {
document.getElementById('page').style.opacity = '0.5';
document.getElementById('page').style.filter = 'alpha(opacity=50)';
document.getElementById(popup).style.display = 'block';
window.scrollTo(0,0);
}
function closeMe(popup) {
document.getElementById('page').style.opacity = '1.0';
document.getElementById('page').style.filter = '100';
document.getElementById(popup).style.display = 'none';
}

// ajax contact form
function sending() {
  var http = false;
  try {
    http = new XMLHttpRequest();
  } catch (e) {
    try {
      http = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
      document.getElementById('message').innerHTML = "This contact form will not work in your browser";
      return;
    }
  }
  document.getElementById('message').innerHTML = "Processing . . . please wait &nbsp; <img src='/ajax-loading.gif' alt='' />";
  name1 = escape(document.getElementById('name').value);
  phone1 = escape(document.getElementById('phone').value);
  email1 = escape(document.getElementById('email').value);
  content1 = escape(document.getElementById('content').value);
  trip1 = document.getElementById('trip').value;
  donation1 = document.getElementById('donation').value;
  mailing1 = document.getElementById('mailing').value;
  var params = "name="+name1+"&phone="+phone1+"&email="+email1+"&content="+content1+"&trip="+trip1+"&donation="+donation1+"&mailing="+mailing1
  http.open("POST","/scripts/mail.php",true);
  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      document.getElementById('message').innerHTML = http.responseText;
      document.getElementById('captcha').value = "";
      document.getElementById('capImage').src='/shared/captcha.php?'+Math.random();
    }
  }
  http.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  http.send(params);
}

// ajax blog post
function blogPost() {
  var http = false;
  try {
    http = new XMLHttpRequest();
    } catch (e) {
      try {
        http = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
          return;
        }
    }

  http.abort();
  var params = "";
  http.open("POST","/scripts/blog.php",true);
  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      document.getElementById('blogEntry').innerHTML = http.responseText;
    }
  }
  http.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  http.send(params);
}
window.onload = function() { blogPost(); }

