var rootdomain="http://"+window.location.hostname

/***********************************************
* Ajax Includes script - (www.dynamicdrive.com)
* Modified By Adam Scott, Scotty Media Works
***********************************************/
//To include a page, invoke ajaxinclude("afile.htm") in the BODY of page
//Included file MUST be from the same domain as the page displaying it.
function ajaxinclude(url) {

  var page_request = false

  if (window.XMLHttpRequest){ // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()

  }else if (window.ActiveXObject){ // if IE

    try {
      page_request = new ActiveXObject("Msxml2.XMLHTTP")
    }catch (e){

      try{
        page_request = new ActiveXObject("Microsoft.XMLHTTP")
      }catch (e){}

    }
  }
  else
    return false
  page_request.open('GET', url, false) //get page synchronously 
  page_request.send(null)
  return (writecontent(page_request));
}

function writecontent(page_request){

  if (window.location.href.indexOf("http")==-1 || page_request.status==200){
    return page_request.responseText;
  }else{
    return "Loading...";
  }
}

window.onload=function(){
  <!-- Activate cloaking device
  var randnum = Math.random();
  var inum = 6; // change for mutiple images
  // Change this number to the number of images you are using.
  var rand1 = Math.round(randnum * (inum-1)) + 1;
  images = new Array;
  images[1] = "http://www.airbornathletics.com/db_img/background/bg1_home.jpg";
  images[2] = "http://www.airbornathletics.com/db_img/background/bg2_home.jpg"
  images[3] = "http://www.airbornathletics.com/db_img/background/bg3_home.jpg"
  images[4] = "http://www.airbornathletics.com/db_img/background/bg4_home.jpg"
  images[5] = "http://www.airbornathletics.com/db_img/background/bg5_home.jpg"
  images[6] = "http://www.airbornathletics.com/db_img/background/bg6_home.jpg"
  // Ensure you have an array item for every image you are using.
  var image = images[rand1]

  document.body.background = image; // change the background
  
}

function checkretailform(){

  var name = document.getElementById('name').value;
  var email = document.getElementById('email').value;
  var shirtcolor = document.getElementById('shirtcolor').value;
  var shirtsize = document.getElementById('shirtsize').value;
  var comments = document.getElementById('comments').value;

  if( name == '' || email == '' || shirtcolor == '' || shirtsize == '' || comments == '' ){
    alert('Please complete the entire form before submission');
  }else{
    document.getElementById('loading').style.display = "inline";
    document.getElementById('retailform').style.display = "none";
    if( ajaxinclude(rootdomain+"/include/submitretailform.php?name="+name+"&email="+email+"&shirtcolor="+shirtcolor+"&shirtsize="+shirtsize+"&comments="+comments) == "ok" ){ // good
      document.getElementById('loading').style.display = "none";
      document.getElementById("airbornCMMTextLarger").innerHTML = "Thank you "+name+" for your order.<br /><br />A representitive will get back to you shortly for:<br /><br />Shirt-Color: "+shirtcolor+"<br />Shirt-Size: "+shirtsize+"<br /><br />Airborn Athletics Admins";
    }else{
      alert('Error with request...try again in a few moments');
    }

  }

}

function checkcontactform(){

  var name = document.getElementById('name').value;
  var email = document.getElementById('email').value;
  var subject = document.getElementById('subject').value;
  var comments = document.getElementById('comments').value;

  if( name == '' || email == '' || subject == '' || comments == '' ){
    alert('Please complete the entire form before submission');
  }else{
    document.getElementById('loading').style.display = "inline";
    document.getElementById('contactform').style.display = "none";
    if( ajaxinclude(rootdomain+"/include/submitcontactform.php?name="+name+"&email="+email+"&subject="+subject+"&comments="+comments) == "ok" ){ // good
      document.getElementById('loading').style.display = "none";
      document.getElementById("airbornCMMTextLarger").innerHTML = "Thank you "+name+" for your submission.<br /><br />A representitive will get back to you shortly.<br /><br />The Airborn Athletics Admins";
    }else{
      alert('Error with request...try again in a few moments');
    }

  }

}


function showElement(layer){
	var myLayer = document.getElementById(layer);
	if(myLayer.style.display=="none"){
		myLayer.style.display="block";
		myLayer.backgroundPosition="top";
	} else { 
		myLayer.style.display="none";
	}
}
// Deactivate cloaking device -->

//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
jQuery.noConflict();  
jQuery(document).ready(function()
{
  //scroll the message box to the top offset of browser's scrool bar
  jQuery(window).scroll(function()
  {
      jQuery('#message_box').animate({top:jQuery(window).scrollTop()+"px" },{queue: false, duration: 350});  
  });
    //when the close button at right corner of the message box is clicked 
  jQuery('#close_message').click(function()
  {
      //the messagebox gets scrool down with top property and gets hidden with zero opacity 
    jQuery('#message_box').animate({ top:"+=15px",opacity:0 }, "slow");
  });
});