

function addToFavorites()
{ if (window.external) { window.external.AddFavorite(document.location.href,document.title); }
else  { alert("Sorry! Your browser doesn't support this function.\nPress Ctrl+D to add site to bookmark list."); } }


function popup(url, width, height, scrollable, imgTitle)
{ if(scrollable){scbars = 1;} else{scbars = 0;} var nomargin; if(scrollable == 2){ nomargin = true; scbars = 0; }
  if(url == "ecap"){ url="http://www.secure-res.com/emgr/csemail.asp?ID="+width; width=400; height = 455;}
  if(url == "srlogo"){ width = 445; height = 455; url="http://www.hotelwebsitedesign.com/secureres/srpopup/"}
  if(url == "stf"){ if(height==1){height=80;} if(!height){height=0;} url="http://www.secure-res.com/emgr/stf/sendpage.asp?id="+width+"&pg="+escape(location.href); width = 560; height += 490;   }
  var wopt = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+ scbars +",resizable=0,width="+width+",height="+height+",top="+(screen.height/2-height/2)+",left="+(screen.width/2 - width/2)  
  if(nomargin){ newwin=window.open("","",wopt);	newwin.document.write("<html><head><title>"+imgTitle+"</title><style>body{margin:0}</style></head><body><img src='"+ url +"'></body></html>");  }
  else { newwin=window.open(url,"popup",wopt); }			
  newwin.focus(); }


function generate_address( un, hn, sty, lnk, subline) 
{ var stycl = ""; var atsign = "&#64;"; var subject = "";
  var addr = un + atsign + hn;
  if(sty){stycl = " class=" + sty } if(subline){subject = "?Subject=" + subline } 
  if(!lnk){ var lnk = addr; } 
  document.write( "<" + "a " + stycl + " href='" + "mail" + "to:" + addr + subject +"'>" + lnk + "</a>");	}

var wmonths = ["Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; 

function do_opt(numopts,startnum,selnum)
{ if(!startnum && startnum != 0){startnum=1} 
  if(numopts == "mo"){ for (var xi=0; xi<wmonths.length; xi++) { document.write('<option value=' + (xi+1) + '>' + (wmonths[xi])); } }
  else { for (var xi=startnum; xi<=numopts; xi++) { sel=(selnum == xi)?" selected ":""; document.write('<option value=' + (xi) + sel + '>' + (xi) ); } }
}



//CSS Drop Down Code for IE
startList = function() {
if (document.all&&document.getElementById) {
	navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
	node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
	node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}


//map popup
function findMap(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=findMap(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function popMap() { //v6.0
  var i,p,v,obj,args=popMap.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findMap(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}




// Image rotator
var ic = 5; // Number of alternative images
var images= new Array(ic); // Array to hold filenames images[0] = "http://www.yoursite.com/graphic1.gif"; 
images[0] = "images/featured_mastersinnkiss.jpg"; 
images[1] = "images/featured_mastersinn-idrive.jpg"; 
images[2] = "images/featured_mastersinn-tampa.jpg"; 
images[3] = "images/featured_masters-maingte.jpg"; 
images[4] = "images/featured_masters-savanah.jpg"; 

var imageurl = new Array()
imageurl[0]="http://www.mastersinnorlando.com/kissimmee.htm";
imageurl[1]="http://www.mastersinnorlando.com/internationaldrive.htm";
imageurl[2]="http://www.hotelwebsitedesign.com/mastersinn/tampafairgrounds/";
imageurl[3]="http://www.mastersinnorlando.com/maingate.htm";
imageurl[4]="http://www.hotelwebsitedesign.com/mastersinn/gardencity/";

function pickRandom(range) 
{ if (Math.random) return Math.round(Math.random() * (range-1)); else { var now 
= new Date(); return (now.getTime() / 1000) % range; } } 
// Write out an IMG tag, using a randomly-chosen image name. 
var choice = pickRandom(ic); 

//validation function for reservationSearchForm fields
function validateReservationSearchForm()
{
	var bValid = true;
	
	if (document.reservationSearchForm)
	{
		if (document.reservationSearchForm.CnfNum && document.reservationSearchForm.LastName)
		{
			if (document.reservationSearchForm.CnfNum.value == "" || document.reservationSearchForm.LastName.value == "")
			{
				bValid = false;
				alert("You must provide your Confirmation # and Last Name to perform a search.");
			}
		}
	}
	
	return bValid;
}