//Random flash loader
function randomFlash() {
 
var ran_unrounded=Math.random()*3; //Set the number of flash files, starting at "0"
var ran_number=Math.round(ran_unrounded); 
var myflash = "";
var html = " ";

if (ran_number == 0){
   myflash = "flash/intro1.swf" ;
  }
 
if (ran_number == 1){
   myflash = "flash/intro2.swf" ;
  }
  
if (ran_number == 2){
   myflash = "flash/intro3.swf" ;
  }  

if (ran_number == 3){
   myflash = "flash/intro4.swf" ;
  }
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="593" height="288" align="middle">';
html += '<param name="allowScriptAccess" value="sameDomain" />';
html += '<param name="movie" value="'+myflash+'" />';
html += '<param name="loop" value="false" />';
html += '<param name="quality" value="high" />';
html += '<param name="wmode" value="transparent" />';
html += '<param name="bgcolor" value="#ffffff" />';
html += '<embed src="'+myflash+'" loop="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="593" height="288" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
html += '</object>';

document.write(html);
}


//Validate contact form
function validateContactForm(){
   if(document.forms['contact'].elements['first_name'].value == ""){
     document.getElementById('first_name_img').src = "images/required_field.gif";
      }
  else if(document.forms['contact'].elements['last_name'].value == ""){
     document.getElementById('last_name_img').src = "images/required_field.gif";
     }
  else if(document.forms['contact'].elements['email_address'].value.indexOf('@',0) < 0  || document.forms['contact'].elements['email_address'].value == '' ){
    document.getElementById('email_address_img').src = "images/required_field.gif";
    }
  else if(document.forms['contact'].elements['subject'].value == ""){
     document.getElementById('subject_img').src = "images/required_field.gif";
    }
  else if(document.forms['contact'].elements['message'].value == '' ){
    document.getElementById('message_img').src = "images/required_field.gif";
    } 
  else if (document.forms['contact'].elements['business_address'].value == '' ){
    document.getElementById('business_address_img').src = "images/required_field.gif";
    }
 else
 document.forms['contact'].submit();
}


//Open Camp flash pop up
function detailMapPopup(mapName){
// define function vars
var top  = "";
var left = "";
var id = "mapDetail";
var URL = "mapDetail.php?mapName="+mapName;

// set window width
var width = "660";
// set window height
var height = "415";

// set window top position (center)
var top  = (screen.Height - eval(height) )/2;  
// set window left position (center)
var left = (screen.Width - eval(width) )/2;

//combine properties to open window with window.open 
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "');");
}
