function saveMSG(sd){
   board_author = document.getElementById('board_author').value;
   board_message = document.getElementById('board_message').value;
   
   var error = false;
   
   if(board_author == ''){ error = true; }
   if(board_author == 'Your Name'){ error = true; }
   if(board_message == ''){ error = true; }
   if(board_message == 'Comments Here...'){ error = true; }
   
   if(error == true){
      alert('Please fill out the comment box before submitting.');
   }else{
      x_save_msg(board_author,board_message, saveMSGCB);
   }
}

function saveMSGCB(str){
   //alert(str);
   alert("Your message has been saved!");
   loadPage('board');
}

function buildNav(str){
   document.getElementById('navContainer').innerHTML = str;
}

function buildPage(str){
   document.getElementById('content').innerHTML = str;
   initLightbox();
}

function loadPage(page){
   document.getElementById('content').innerHTML = "<div id='loading'>LOADING PAGE</div>";
   x_build_nav(page, buildNav);
   x_build_page(page, buildPage);
}

function asdfasdfsd(str){
   alert(str);
}

function getV(id){
   if(document.getElementById(id)){
      return document.getElementById(id).value;
   }else{
      return '';
   }
}

function signUp(){
   email = getV('email_signup');
   phone = getV('phone_signup');
   
   if(email == 'Your Email' && phone == 'Your CellPhone #'){
      alert('Please enter either email or cellphone.');
   }else{
			   document.getElementById('stayUpdated').innerHTML = '';
			   x_sign_up(email,phone,signUpCB);
   }
}

function signUpCB(str){
   document.getElementById('stayUpdated').innerHTML = str;
}

function savePhoto(id){
   img = document.forms['calform_'+id].img.value;
   x_save_photo(img, id, savePhotoCB);
}

function savePhotoCB(str){

   alert(str);
   if(str == 'error1'){
      alert('Image was not sized correctly, please try again.');
   }
   if(str == 'success'){
      alert('Your image has been submitted, please allow 24-48 hours of approval. THANKS!');
   }
}

function photoInstructions(){
   str = '';
   str += 'You must upload photos that are saved as JPG files.\n\n';
   str += 'Photos must have a width of 500 pixels or larger.';
   alert(str);
}

function showSubmit(id){
   //Effect.BlindDown(id, {duration: 1,});
   $(id).style.display='block';
}

function hideSubmit(id){
   $(id).style.display='none';
}
