function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function the_funk(){
  return confirm("hmm?");
}

function validate_admin_add(){
/*	x = document.admin_reservation_form;
  error = false;
  if(x.arrive.value==""){alert("You must select an arrival date");x.arrive.focus();error=true;}
  if(x.depart.value==""){alert("You must select a departure date");x.depart.focus();error=true;}
	if(x.arrive.value>=x.depart.value){alert("Your Arrival Date must be a date before the Departure Date");x.arrive.focus();error=true;}
	if(x.arrive.value<=new Date()){alert( "Your Arrival Date cannot be before Today's date.");x.arrive.focus();error=true;}
	if(!x.firstname.value){alert("Please enter first name");x.firstname.focus();error=true;}
  if(!x.lastname.value){alert("Please enter last name");x.lastname.focus();error=true;}
  if(!x.address.value){alert("Please enter address");x.address.focus();error=true;}
  if(!x.city.value){alert("Please enter city name");x.city.focus();error=true;}
  if(!x.state.value){alert("Please enter state name");x.state.focus();error=true;}
  if(!x.zip.value){alert("Please enter zip code");x.zip.focus();error=true;}
  if(!x.phone.value){alert("Please enter phone");x.phone.focus();error=true;}
  if(!x.email.value){alert("Please enter an email");x.email.focus();error=true;}
  if(!checkEmail(x.email.value)){alert("Please enter a valid email");x.email.focus();error=true;}
  if(!x.ccnumber.value){alert("Please enter a credit card number");x.ccnumber.focus();error=true;}
	if(!validatecc(x.ccnumber.value)){alert("Please enter a valid credit card number");x.ccnumber.focus();error=true;}
  return !error;
*/
  alert("adding");
  return false;
}		  
  

function validate_search_form(){
	//Get Dates from Form
	dateStart = document.search_form.arrive.value;
	dateEnd = document.search_form.depart.value;
	today = new Date();
	//Validate Start Date
	if ( dateStart == "" ){
		alert( "You must select an arrival date" );
		return false;
	}
	//Validate End  Date
	if ( dateEnd == "" ){
		alert( "You must select a departure date" );
		return false;
	}
  // Check to see if Dates make sense
	if (dateStart >= dateEnd){
		alert( "Your Arrival Date must be a date before the Departure Date" );
		return false;
	}
	if (dateStart <= today){
		alert( "Your Arrival Date cannot be before Today's date." );
		return false;
	}
	document.search_form.submit();
}



function validate_personal_form()
{
	x = document.personal_form;
  error = false;
	if(!x.firstname.value){ alert("Please enter first name"); x.firstname.focus(); error=true; return;}
  if(!x.lastname.value){ alert("Please enter last name");  x.lastname.focus(); error=true; return; }
  if(!x.address.value){ alert("Please enter address");  x.address.focus(); error=true;  return;}
  if(!x.city.value){ alert("Please enter city name");  x.city.focus(); error=true; return; }
  if(!x.state.value){ alert("Please enter state name");  x.state.focus(); error=true; return; }
  if(!x.zip.value){ alert("Please enter zip code");  x.zip.focus(); error=true; return; }
  if(!x.phone.value){ alert("Please enter phone");  x.phone.focus(); error=true; return; }
  if(!x.email.value){ alert("Please enter an email");  x.email.focus(); error=true; return; }
  if(!checkEmail(x.email.value)){alert("Please enter a valid email");  x.email.focus(); error=true; return; }
  if(!x.ccnumber.value){ alert("Please enter a credit card number");  x.ccnumber.focus(); error=true; return; }
	if(!validatecc(x.ccnumber.value)){alert("Please enter a valid credit card number");  x.ccnumber.focus(); error=true; return; }
  if(!error) x.submit();
}

function validate_confirmation_form()
{
	x = document.confirmation_form;
	if(!x.the_terms.checked)
  {
  	alert("Please read the terms and conditions");
  }
  else
  {
  	x.confirmed.value = "true";
  	x.submit();
  }
}

// This script and many more are available free online at
// The JavaScript Source!! http://javascript.internet.com 
function checkEmail(address){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(address)){return (true)}
	return (false)
}

/* Credit card LUHN number checker - coded '05 shaman - www.planzero.org *
 * This code has been released into the public domain, however please    *
 * give credit to the original author wherever possible.                 */
function validatecc(x) {
  var ccnumber=x.replace(/\D/g, '');
  var cclength=ccnumber.length;
  var parity=cclength % 2;
  var sum=0;
  for (i=0; i < cclength; i++) {
    var ccdigit=ccnumber.charAt(i);
    if (i % 2 == parity) ccdigit=ccdigit * 2;
    if (ccdigit > 9) ccdigit=ccdigit - 9;
    sum = sum + parseInt(ccdigit);
  }
  var valid=(sum % 10 == 0);
  if (valid) return true; else return false;
}

function get_month_number(month){
	switch(month){
		case "January": return 1;
		case "February": return 2;
		case "March": return 3;
		case "April": return 4;
		case "May": return 5;
		case "June": return 6;
		case "July": return 7;
		case "August": return 8;
		case "September": return 9;
		case "October": return 10;
		case "November": return 11;
		case "December": return 12;
		default: return 0;
	}
}

function MM_preloadImages() { //v3.0
/*  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
*/
}

function MM_swapImgRestore() { //v3.0
/*
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
*/
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popup(popupLink) {
  agent = navigator.userAgent;
  windowName = "hccabinspopup";
  params  = "";
  params += "toolbar=0,";
  params += "location=0,";
  params += "directories=0,";
  params += "status=0,";
  params += "menubar=0,";
  params += "scrollbars=0,";
  params += "resizable=0,";
  params += "width=455,";
  params += "height=400";
  win = window.open(popupLink, windowName , params);
}

