﻿/* --------- MENU JS ------------ */YAHOO.util.Event.onContentReady("menubar", function () {    var oMenuBar = new YAHOO.widget.MenuBar("menubar", {         autosubmenudisplay: true,         hidedelay: 750,         lazyload: true });    oMenuBar.render();});/* --------- PHOTO JS ------------ */function ShowPopup(elemID){hp = document.getElementById("hoverpopup" + elemID);hposition = document.getElementById("hover-position" + elemID);hp.style.display = "block";hposition.style.position = "relative";hposition.style.display = "block";}function HidePopup(elemID){hp = document.getElementById("hoverpopup" + elemID);hp.style.display = "none";hposition.style.display = "none";}/* --------- BOOKMARK JS ------------ */function bookmark(){    var title="Massanutten Resort"    var url=window.location    if (window.sidebar) window.sidebar.addPanel(title, url,"");    else if( window.opera && window.print )    {    var mbm = document.createElement('a');    mbm.setAttribute('rel','sidebar');    mbm.setAttribute('href',url);    mbm.setAttribute('title',title);    mbm.click();    }    else if( document.all ) window.external.AddFavorite( url, title);}/* --------- FONT SIZE JS ------------ */function fontsizeup() {  active = getActiveStyleSheet();  switch (active) {    case 'A-' :       setActiveStyleSheet('A');      break;    case 'A' :       setActiveStyleSheet('A+');      break;    case 'A+' :       setActiveStyleSheet('A++');      break;    case 'A++' :      break;    default :      setActiveStyleSheet('A+');      break;  }}function fontsizedown() {  active = getActiveStyleSheet();  switch (active) {    case 'A++' :       setActiveStyleSheet('A+');      break;    case 'A+' :       setActiveStyleSheet('A');      break;    case 'A' :       setActiveStyleSheet('A-');      break;    case 'A-' :       break;    default :      setActiveStyleSheet('A-');      break;  }}function setActiveStyleSheet(title) {  var i, a, main;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {      a.disabled = true;      if(a.getAttribute("title") == title) a.disabled = false;    }  }}function getActiveStyleSheet() {  var i, a;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");  }  return null;}function getPreferredStyleSheet() {  return ('A');}function createCookie(name,value,days) {  if (days) {    var date = new Date();    date.setTime(date.getTime()+(days*24*60*60*1000));    var expires = "; expires="+date.toGMTString();  }  else expires = "";  document.cookie = name+"="+value+expires+"; path=/";}function readCookie(name) {  var nameEQ = name + "=";  var ca = document.cookie.split(';');  for(var i=0;i < ca.length;i++) {    var c = ca[i];    while (c.charAt(0)==' ') c = c.substring(1,c.length);    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);  }  return null;}window.onload = function(e) {  var cookie = readCookie("style");  var title = cookie ? cookie : getPreferredStyleSheet();  setActiveStyleSheet(title);}window.onunload = function(e) {  var title = getActiveStyleSheet();  createCookie("style", title, 365);}var cookie = readCookie("style");var title = cookie ? cookie : getPreferredStyleSheet();if (title == 'null') {  title = getPreferredStyleSheet();}setActiveStyleSheet(title);/* ----------- RESERVATION FORM VALIDATION ------------ */function ValidateAll(){	if(CheckLastName(document.dForm.last_name.value) == false) return false;	if(CheckFirstName(document.dForm.first_name.value) == false) return false;	if(CheckAddress(document.dForm.address.value) == false) return false;	if(CheckCity(document.dForm.city.value) == false) return false;	if(CheckState(document.dForm.state.value) == false) return false;	if(CheckZip(document.dForm.zip.value) == false) return false;	if(CheckPhoneHome(document.dForm.phone_home.value) == false) return false;	if(CheckPhoneWork(document.dForm.phone_work.value) == false) return false;	if(CheckAgreesign(document.dForm.agreesign.value) == false) return false;	return true;}function StripSpacesFromEnds(s){	// developed by willmaster.com	while((s.indexOf(' ',0) == 0) && (s.length > 1))	{		s = s.substring(1,s.length);	}	while((s.lastIndexOf(' ') == (s.length - 1) && (s.length > 1)))	{		s = s.substring(0,(s.length - 1));	}	if((s.indexOf(' ',0) == 0) && (s.length == 1)) s = '';	return s;}function IsItPresent(s,explanation){	// developed by willmaster.com	s = StripSpacesFromEnds(s);	if(s.length) return s;	alert('Please enter ' + explanation + '.');	return '';}function CheckLastName(s_lastname){	// developed by willmaster.com	s_lastname = IsItPresent(s_lastname,'your last name');	if(! s_lastname) return false;	var i = s_lastname.indexOf('  ',0);	while(i > -1)	{		s_lastname = s_lastname.substring(0,(i + 1)) + 			s_lastname.substring((i + 2),s_lastname.length);		i = s_lastname.indexOf('  ',0);	}	s_lastname = s_lastname.toLowerCase();	var s = new String(s_lastname.substring(0,1));	s = s.toUpperCase();	s_lastname = s + s_lastname.substring(1,s_lastname.length);	i = s_lastname.indexOf(' ',0);	if(i == (s_lastname.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_lastname.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_lastname.substring(0,i);		s_lastname = ts + s + s_lastname.substring(j,s_lastname.length);		i = s_lastname.indexOf(' ',j);		if(i == (s_lastname.length - 1)) i = -1;	}	document.dForm.last_name.value = s_lastname;	return true;}function CheckFirstName(s_firstname){	// developed by willmaster.com	s_firstname = IsItPresent(s_firstname,'your first name');	if(! s_firstname) return false;	var i = s_firstname.indexOf('  ',0);	while(i > -1)	{		s_firstname = s_firstname.substring(0,(i + 1)) + 			s_firstname.substring((i + 2),s_firstname.length);		i = s_firstname.indexOf('  ',0);	}	s_firstname = s_firstname.toLowerCase();	var s = new String(s_firstname.substring(0,1));	s = s.toUpperCase();	s_firstname = s + s_firstname.substring(1,s_firstname.length);	i = s_firstname.indexOf(' ',0);	if(i == (s_firstname.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_firstname.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_firstname.substring(0,i);		s_firstname = ts + s + s_firstname.substring(j,s_firstname.length);		i = s_firstname.indexOf(' ',j);		if(i == (s_firstname.length - 1)) i = -1;	}	document.dForm.first_name.value = s_firstname;	return true;}function CheckAddress(s_address){	// developed by willmaster.com	s_address = IsItPresent(s_address,'your address');	if(! s_address) return false;	var i = s_address.indexOf('  ',0);	while(i > -1)	{		s_address = s_address.substring(0,(i + 1)) + 			s_address.substring((i + 2),s_address.length);		i = s_address.indexOf('  ',0);	}	s_address = s_address.toLowerCase();	var s = new String(s_address.substring(0,1));	s = s.toUpperCase();	s_address = s + s_address.substring(1,s_address.length);	i = s_address.indexOf(' ',0);	if(i == (s_address.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_address.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_address.substring(0,i);		s_address = ts + s + s_address.substring(j,s_address.length);		i = s_address.indexOf(' ',j);		if(i == (s_address.length - 1)) i = -1;	}	document.dForm.address.value = s_address;	return true;}function CheckCity(s_city){	// developed by willmaster.com	s_city = IsItPresent(s_city,'your city');	if(! s_city) return false;	var i = s_city.indexOf('  ',0);	while(i > -1)	{		s_city = s_city.substring(0,(i + 1)) + 			s_city.substring((i + 2),s_city.length);		i = s_city.indexOf('  ',0);	}	s_city = s_city.toLowerCase();	var s = new String(s_city.substring(0,1));	s = s.toUpperCase();	s_city = s + s_city.substring(1,s_city.length);	i = s_city.indexOf(' ',0);	if(i == (s_city.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_city.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_city.substring(0,i);		s_city = ts + s + s_city.substring(j,s_city.length);		i = s_city.indexOf(' ',j);		if(i == (s_city.length - 1)) i = -1;	}	document.dForm.city.value = s_city;	return true;}function CheckState(s_state){	// developed by willmaster.com	s_state = IsItPresent(s_state,'your state/province');	if(! s_state) return false;	var i = s_state.indexOf('  ',0);	while(i > -1)	{		s_state = s_state.substring(0,(i + 1)) + 			s_state.substring((i + 2),s_state.length);		i = s_state.indexOf('  ',0);	}	s_state = s_state.toLowerCase();	var s = new String(s_state.substring(0,1));	s = s.toUpperCase();	s_state = s + s_state.substring(1,s_state.length);	i = s_state.indexOf(' ',0);	if(i == (s_state.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_state.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_state.substring(0,i);		s_state = ts + s + s_state.substring(j,s_state.length);		i = s_state.indexOf(' ',j);		if(i == (s_state.length - 1)) i = -1;	}	document.dForm.state.value = s_state;	return true;}function CheckZip(s_zip){	// developed by willmaster.com	s_zip = IsItPresent(s_zip,'your zip/postal code');	if(! s_zip) return false;	var i = s_zip.indexOf('  ',0);	while(i > -1)	{		s_zip = s_zip.substring(0,(i + 1)) + 			s_zip.substring((i + 2),s_zip.length);		i = s_zip.indexOf('  ',0);	}	s_zip = s_zip.toLowerCase();	var s = new String(s_zip.substring(0,1));	s = s.toUpperCase();	s_zip = s + s_zip.substring(1,s_zip.length);	i = s_zip.indexOf(' ',0);	if(i == (s_zip.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_zip.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_zip.substring(0,i);		s_zip = ts + s + s_zip.substring(j,s_zip.length);		i = s_zip.indexOf(' ',j);		if(i == (s_zip.length - 1)) i = -1;	}	document.dForm.zip.value = s_zip;	return true;}function CheckPhoneHome(s_phonehome){	// developed by willmaster.com	s_phonehome = IsItPresent(s_phonehome,'your home phone number');	if(! s_phonehome) return false;	var i = s_phonehome.indexOf('  ',0);	while(i > -1)	{		s_phonehome = s_phonehome.substring(0,(i + 1)) + 			s_phonehome.substring((i + 2),s_phonehome.length);		i = s_phonehome.indexOf('  ',0);	}	s_phonehome = s_phonehome.toLowerCase();	var s = new String(s_phonehome.substring(0,1));	s = s.toUpperCase();	s_phonehome = s + s_phonehome.substring(1,s_phonehome.length);	i = s_phonehome.indexOf(' ',0);	if(i == (s_phonehome.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_phonehome.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_phonehome.substring(0,i);		s_phonehome = ts + s + s_phonehome.substring(j,s_phonehome.length);		i = s_phonehome.indexOf(' ',j);		if(i == (s_phonehome.length - 1)) i = -1;	}	document.dForm.phone_home.value = s_phonehome;	return true;}function CheckPhoneWork(s_phonework){	// developed by willmaster.com	s_phonework = IsItPresent(s_phonework,'your work phone number');	if(! s_phonework) return false;	var i = s_phonework.indexOf('  ',0);	while(i > -1)	{		s_phonework = s_phonework.substring(0,(i + 1)) + 			s_phonework.substring((i + 2),s_phonework.length);		i = s_phonework.indexOf('  ',0);	}	s_phonework = s_phonework.toLowerCase();	var s = new String(s_phonework.substring(0,1));	s = s.toUpperCase();	s_phonework = s + s_phonework.substring(1,s_phonework.length);	i = s_phonework.indexOf(' ',0);	if(i == (s_phonework.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_phonework.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_phonework.substring(0,i);		s_phonework = ts + s + s_phonework.substring(j,s_phonework.length);		i = s_phonework.indexOf(' ',j);		if(i == (s_phonework.length - 1)) i = -1;	}	document.dForm.phone_work.value = s_phonework;	return true;}function CheckAgreesign(s_agreesign){	// developed by willmaster.com	s_agreesign = IsItPresent(s_agreesign,'your initials');	if(! s_agreesign) return false;	var i = s_agreesign.indexOf('  ',0);	while(i > -1)	{		s_agreesign = s_agreesign.substring(0,(i + 1)) + 			s_agreesign.substring((i + 2),s_agreesign.length);		i = s_agreesign.indexOf('  ',0);	}	s_agreesign = s_agreesign.toLowerCase();	var s = new String(s_agreesign.substring(0,1));	s = s.toUpperCase();	s_agreesign = s + s_agreesign.substring(1,s_agreesign.length);	i = s_agreesign.indexOf(' ',0);	if(i == (s_agreesign.length - 1)) i = -1;	var ts = new String("");	var j = 0;	while(i > -1)	{		i++;		j = i + 1;		s = s_agreesign.substring(i,j);		s = s.toUpperCase();		ts = '';		if(i > 0) ts = s_agreesign.substring(0,i);		s_agreesign = ts + s + s_agreesign.substring(j,s_agreesign.length);		i = s_agreesign.indexOf(' ',j);		if(i == (s_agreesign.length - 1)) i = -1;	}	document.dForm.agreesign.value = s_agreesign;	return true;}function CheckEmail(s_email){	// developed by willmaster.com	s_email = IsItPresent(s_email,'your email address');	if(! s_email) return false;	var i = s_email.indexOf(' ',0);	while(i > -1)	{		s_email = s_email.substring(0,i) + 			s_email.substring((i + 1),s_email.length);		i = s_email.indexOf(' ',0);	}	document.dForm.Email.value = s_email;	if((s_email.length < 6) ||	   (s_email.indexOf('@',0) < 1) ||	   (s_email.lastIndexOf('@') != s_email.indexOf('@',0)) ||	   (s_email.lastIndexOf('@') > (s_email.length - 5)) ||	   (s_email.lastIndexOf('.') > (s_email.length - 3)) ||	   (s_email.lastIndexOf('.') < (s_email.length - 4)) ||	   (s_email.indexOf('..',0) > -1) ||	   (s_email.indexOf('@.',0) > -1) ||	   (s_email.indexOf('.@',0) > -1) ||	   (s_email.indexOf(',',0) > -1))	{		alert('The email address "' + s_email + '" is not valid.');		return false;	}	return true;}