

function addToFavorites()
{ 
if (window.sidebar) {alert("Sorry! Your browser doesn't support this function.\nPress Ctrl+D to add site to bookmark list."); return;}
if (window.external) { window.external.AddFavorite(document.location.href + "?WT.cg_n=bookmarkreturn",document.title); return;}
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)
{ 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><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) ); } }
};
function do_year()
{ var tdate = new Date();  var curyr = tdate.getFullYear();
  for (var jj=1; jj<3; jj++) { document.write('<option value=' + (curyr+jj) + '>' + (curyr+jj) + '</option>'); } 
  //for (var jj=0; jj<3; jj++) { document.write('<option value=' + (curyr+jj) + '>' + (curyr+jj) + '</option>'); } 
  };

if(document.location.href) 
	hrefString = document.location.href;
else
	hrefString = document.location;

var pagename = extractPageName(hrefString);

function extractPageName(hrefString)
{
	var arr = hrefString.split('.');
	if(arr.length >= 2) {
		arr = arr[arr.length-2].split('/');
		return arr[arr.length-1].toLowerCase();
	} else {
		return "x";
	}
}

function setActiveMenu(arr)
{
  for(var i=0; i < arr.length; i++)
  {
	  if(extractPageName(arr[i].href) == pagename)
	  {
		addClass(arr[i],'current');
		addClass(arr[i].parentNode,'current');
	  }
	  
	  var relarr = arr[i].rel.split(",");
	  for(var x=0; x < relarr.length; x++)
	  {
		  if(relarr[x].toLowerCase() == pagename)
		  {
			addClass(arr[i],'current');
			addClass(arr[i].parentNode,'current');
		  }
	  }
  }
}

<!-- call this method from your page-->
function highlightPages(classname)
{
	var lists = getElementsByClass(classname, null,"ul");
    for (var i=0; i < lists.length; i++)
		setActiveMenu(lists[i].getElementsByTagName('a'));
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function addClass(element, value) {
	if (!element.className) {
		element.className = value;
	} else {
		var newClassName = element.className;
		newClassName += " ";
		newClassName += value;
		element.className = newClassName;
	}
}

var rfpLoaded = false;
function rfpFormScroll()
{
	if (rfpLoaded == false)
		rfpLoaded = true;
	else
		javascript:scroll(0,0);
}



function backtoTop()
{
	window.scrollTo(0,0);
	return false;
}

currentdiv = 'div1'

function dtoggle(newdiv)
{ document.getElementById(currentdiv).style.display = "none";  
  document.getElementById(newdiv).style.display = "block";
  document.getElementById(currentdiv + "_b").className = "classoff"
  document.getElementById(newdiv + "_b").className = "classon"
  currentdiv = newdiv; }







//drop down code for IE
startList = function(id) {
if (document.all&&document.getElementById) {
navRoot = document.getElementById(id);
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", "");
   }
   }
  }
 }
}
function addEvent(elm, evType, fn, useCapture)
{
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;	}
	else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		return r;	}
	else {	elm['on' + evType] = fn;	}
}
function RunStartList()
{
            startList('nav');
}


addEvent(window,'load',RunStartList,false);



/*
	parseUri 1.2.1
	(c) 2007 Steven Levithan <stevenlevithan.com>
	MIT License
*/
function parseUri (str) {
	var	o   = parseUri.options,
		m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
		uri = {},
		i   = 14;
	while (i--) uri[o.key[i]] = m[i] || "";
	uri[o.q.name] = {};
	uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
		if ($1) uri[o.q.name][$1] = $2;
	});
	return uri;
};
parseUri.options = {
	strictMode: false,
	key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
	q:   {
		name:   "queryKey",
		parser: /(?:^|&)([^&=]*)=?([^&]*)/g
	},
	parser: {
		strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
		loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
	}

};


function RedirectMobileDevicesToMobileSite(VisitorInformation)
{
  //get visitor information
  if(VisitorInformation.isMobileDevice == true)
  {
    //don't redirect if the override querystring is present
    var uri = parseUri(window.location);
    if (typeof(uri.queryKey["mobileRedirect"]) == "undefined")
    {
      var url = "http://mobile.royaleparcsuitesorlando.com";
      var qsConcatSymbol = "?";

      //pass original querystring information if it existed

      var qs = window.location.search.substring(1);
      if (qs != "")
      {
        url += "?" + qs;
        qsConcatSymbol = "&";
      }
      //pass referrer information so webtrends can maintain tracking
      var referrer = document.referrer;
      if (referrer != "")
      {
        url += qsConcatSymbol + "referrer="+encodeURIComponent(referrer);
      }
      document.location = url;

    }

  }

}



//-----------------------------------------------------------------------------
// COOKIES (http://www.quirksmode.org/js/cookies.html)
//----------------------------------------------------------------------------- 
 
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 var 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 "";
}

