// JavaScript Document
//HEADER ROTATION
var header0 = "<img src=\"images/LBVRH.jpg\" alt=\"Lake Buena Vista Resort Hotel\" width=\"728\" />";
var header1 = "<img src=\"images/HIMGE.jpg\" alt=\"Holiday Inn Main Gate East\" width=\"728\" />";
var header2 = "<img src=\"images/ABIMGE.jpg\" alt=\"America's Best Inn Main Gate East\" width=\"728\" />";

	var next_n = 0;
  	function RotateHeader()
  		{
  		var n = next_n % 3;	
		switch(n)
		 	{
 			case 0:
 			document.getElementById('header').innerHTML = header0;
   			break;
 			case 1:
			document.getElementById('header').innerHTML = header1;
   			break;
 			case 2:
			document.getElementById('header').innerHTML = header2;
   			break;
			 }

	next_n++;
  	t=setTimeout("RotateHeader()",5000);
	}

//TILE ROTATION
  var pic0 = "<a href=\"http://www.myorlandowedding.net/\" target=\"_blank\"><img src=\"images/myorlandoweddingtile.jpg\" alt=\"MyOrlandoWedding.net\" width=\"150\" height=\"300\" border=\"0\" /></a>";
  var pic1 = "<a href=\"http://funspotshotels.com/sportsteams\" target=\"_blank\"><img src=\"images/sportsteamsScoreboardTile.jpg\" alt=\"FunSpotsHotels.com\" width=\"150\" height=\"300\" border=\"0\" /></a>";
  var pic2 = "<a href=\"http://www.funspotshotels.com/packageroom.php?pcode=LONGTERM&amp;property=funhotel_funspotshotel\" target=\"_blank\"><img src=\"images/extendedstaytile.jpg\" alt=\"America's Best Inn Main Gate East\" width=\"150\" height=\"300\" border=\"0\" /></a>";
  var pic3 = "<a href=\"http://myorlandomeeting.net\" target=\"_blank\"><img src=\"images/myorlandomeetingtile.jpg\" alt=\"MyOrlandoMeeting.net\" width=\"150\" height=\"300\" border=\"0\" /></a>";
  var next_num = 0;
  function RotateImages()
  	{
  	var num0 = next_num % 4;
  	var num1 = (next_num + 1) % 4;
  	var num2 = (next_num + 2) % 4;
  	var num3 = (next_num + 3) % 4;
	document.getElementById('pic' + num0).innerHTML = pic0;
	document.getElementById('pic' + num1).innerHTML = pic1;
	document.getElementById('pic' + num2).innerHTML = pic2;
	document.getElementById('pic' + num3).innerHTML = pic3;
	next_num++;
  	t=setTimeout("RotateImages()",10000);
	}
//CHARACTER WHITE LIST
function whiteList(string) {
string = string.replace(/[^0-9 /]+/g,'');
//string = string.replace("/",'');
string = string.split(' ').join('');
return string;
}
//CHARACTER WHITE LIST
function guests(){ 
var clear = 'yes';
var message = '';
var children=document.form.children.options[document.form.children.selectedIndex].value 
var adults=document.form.adults.options[document.form.adults.selectedIndex].value
var rooms=document.form.rms.options[document.form.rms.selectedIndex].value
var arr = document.getElementById('hid_arr').value;
var dep = document.getElementById('hid_dep').value;
people=parseInt(children) + parseInt(adults);
var splitarrival = arr.split("/");
var month_arr = splitarrival[0];
var day_arr = splitarrival[1];
var year_arr = splitarrival[2];
var splitdeparture = dep.split("/");
var month_dep = splitdeparture[0];
var day_dep = splitdeparture[1];
var year_dep = splitdeparture[2];

var userdate = new Date(arr) 
var currdate = new Date() 
var currdate = new Date(currdate.getMonth()+1+'/'+currdate.getDate()+'/'+currdate.getFullYear()) 
if (userdate < currdate){
{message += "Arrival date is in the past.\n\r";clear = 'no';}
} 

var depdate = new Date(dep) 
var arrdate = new Date(arr) 
var arrdate = new Date(arrdate.getMonth()+1+'/'+arrdate.getDate()+'/'+arrdate.getFullYear()) 
var depdate = new Date(depdate.getMonth()+1+'/'+depdate.getDate()+'/'+depdate.getFullYear()) 
if (depdate <= arrdate){
{message += "Departure date is same day or before arrival date.\n\r";clear = 'no';}
} 



if (!arr){message += "Enter arraival date.\n\r";clear = 'no';}else{
	if(splitarrival.length != 3){message += "Check your arrival date.  Format mm/dd/yyyy\n\r";clear = 'no';}else{
	if(splitarrival[2].length != 4){message += "Arrival year must be yyyy format.\n\r";clear = 'no';}}
	}
if (dep){
	if(splitdeparture.length != 3){message += "Check your departure date.  Format mm/dd/yyyy\n\r";clear = 'no';}else{
	if(splitdeparture[2].length != 4){message += "Departure year must be yyyy format.\n\r";clear = 'no';}}
	}
if (people/rooms > 5){message += "No more than five people to a room.\n\r";clear = 'no';} 

if(clear == 'yes'){return true;}else{alert(message);return false;}
} 

function RGBtoHEX(str)
{
	if (str.substring(0, 3) == 'rgb') {
		var arr = str.split(",");
		var r = arr[0].replace('rgb(','').trim(), g = arr[1].trim(), b = arr[2].replace(')','').trim();
		var hex = [
			toHex(r),
			toHex(g),
			toHex(b)
		];
		return "#" + hex.join('');				
	}
	else{
		return str;
	}
}
//Helper function to convert a digit to a two column Hex representation
function toHex(N) {
	if (N==null) return "00";
	N=parseInt(N); if (N==0 || isNaN(N)) return "00";
	N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
	return "0123456789abcdef".charAt((N-N%16)/16) + "0123456789abcdef".charAt(N%16);
}
function over(i,j){
	var what = j;
	if(j == 'in'){
	var backColor = document.getElementById(i).style.backgroundColor;
    var color = RGBtoHEX(backColor)
	if(color == '#cccccc'){
		document.getElementById(i).style.backgroundColor = '#cccccc';
		}else{
		document.getElementById(i).style.backgroundColor = '#FFFF99';			
		}
	}else{
	var backColor = document.getElementById(i).style.backgroundColor;
    var color = RGBtoHEX(backColor)
	if(color == '#cccccc'){
		document.getElementById(i).style.backgroundColor = '#cccccc';
		}else{
		document.getElementById(i).style.backgroundColor = '#FFFFFF';			
		}
	}
}
function sdate2(i){
var xxx = new Date(Date.parse("Dec 31, 2005") + parseInt(i * 24 * 60 * 60 * 1000));
var month = xxx.getMonth() + 1
var day = xxx.getDate()
var year = xxx.getFullYear()
return(month + "/" + day + "/" + year)
}
<!--
//here you place the ids of every element you want.
var ids=new Array('a1','a2','a3','a4','a5');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
<!--
//here you place the ids of every element you want.
var ids2=new Array('b1','b2','b3','b4','b5');

function switchid2(id){	
	hideallids2();
	showdiv2(id);
}

function hideallids2(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids2.length;i++){
		hidediv2(ids2[i]);
	}		  
}

function hidediv2(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv2(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
<!--
//here you place the ids of every element you want.
var ids3=new Array('c1','c2','c3');

function switchid3(id){	
	hideallids3();
	showdiv3(id);
}

function hideallids3(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids3.length;i++){
		hidediv3(ids3[i]);
	}		  
}

function hidediv3(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv3(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
function openadr(){
	var adrwindow;
	url = "https://server1.sslpage.com/~funhotel/adr-info.htm";
	adrwindow = window.open(url,"thewindow","toolbar=no,LEFT=300,TOP=250,WIDTH=400,HEIGHT=100,status=no,scrollbars=yes,resize=yes,menubar=no");
	adrwindow.focus();
}
