// JavaScript Document

// other infomation for pages


function openMap() {
window.open('../map/index.html','map','width=800,height=600, scrollbars=no, toolbar=no, location=no, directories=no, status=no, menubar=no, resizeable=no')
return false;	
		
	
}

function openMapI() {

window.open('map/index.html','map','width=800,height=600, scrollbars=no, toolbar=no, location=no, directories=no, status=no, menubar=no, resizeable=no')
return false;	
	
}

function validate() {
	
	alert('While the site is being tested, the name and password function is not currently being used.');
	return true;
	
}

function rollUpdate() {
	// function to roll the button image

if(!document.getElementById) {
		return false;
	} else {
		var changeButton = '../assets/images/buttonDownUPDATE.jpg';
		document.getElementById('submit').setAttribute('src',changeButton);
	}

}//end function rollupdate

function restoreUpdate() {
	// function to roll the button image
	
if(!document.getElementById) {
		return false;
	} else {
		var restoreButton = '../assets/images/buttonNewUPDATE.jpg';
		document.getElementById('submit').setAttribute('src',restoreButton);
	}
}//end function restoreupdate



function replaceMap() {
	// function to roll the map image

if(!document.getElementById) {
		return false;
	} else {
		var changeMap = 'assets/images/mapREADY.png';
		document.getElementById('map').setAttribute('src',changeMap);
	}

}//end function replaceMap

function hoverMap() {
	// function to roll the map image
	
if(!document.getElementById) {
		return false;
	} else {
		var restoreMap = 'assets/images/mapROLLED.png';
		document.getElementById('map').setAttribute('src',restoreMap);
	}
}//end function hoverMap


//--UPDATE SEASON ON BOOKINGS FORM
function updateSeason() {
  var bdate  = document.LoyaltyBookingsForm.holi_date_dep.value;
	var season = 0;
		
  if (bdate !='') {
    var d = bdate.split("-");

    /* d0 year
		 * d1 month
		 * d2 day
		 */ 

		//--between apl-dec LOW SEASON
	 if ( (d[1]>4) && (d[1]<12) ) { 
   	 season = 1;
	 } else if(d[1]==4) {
	   //--if Apl
		 if (d[2]<15) {
		   season = 0;
		 } else {
		   season = 1;
		 }	  
	 } else if(d[1]==12) {
	   //if DEC
		 if (d[2]>14) {
		   season = 0;
		 } else {
		   season = 1;
		 }
	 }
		
		document.LoyaltyBookingsForm.peak.selectedIndex = season;
		
	}
	
}