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?pg="+location.href+"&id="+width; 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 year(offset)
{
	var tdate = new Date()
	var curyr = tdate.getFullYear();
if(!offset) {
document.write(curyr);
}
else{
document.write((curyr+offset));
}
}

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=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 getDateString(y_obj,m_obj,d_obj) {
	var y = y_obj.options[y_obj.selectedIndex].value;
	var m = m_obj.options[m_obj.selectedIndex].value;
	var d = d_obj.options[d_obj.selectedIndex].value;
	if (y=="" || m=="") { return null; }
	if (d=="") { d=1; }
	return str= y+'-'+m+'-'+d;
	}
		
var advancedDay = 2;

function isLeapYear(yrVal)
{
	var leapYear=false;
	var year = parseInt(yrVal, 10);

	if (year%4 == 0)
		{
		leapYear=true;
		}
	return leapYear;
}

function getDaysInMonth(monthVal, YrVal)
{
	var maxDays=31
	if (monthVal==1)
	{
		if (isLeapYear(YrVal))
			{
			maxDays=29;
			}
		else
			{
			maxDays=28;
			}
	}
	if (monthVal==3 || monthVal==5 || monthVal==8 || monthVal==10)
		{
		maxDays=30;
		}
	return maxDays;
}

function init() {
		var dt = new Date();

	var yr = dt.getFullYear();
	var curYr = dt.getFullYear();
	var mo = dt.getMonth();
	var da = dt.getDate();

	var daysInCurrent = getDaysInMonth(mo, yr);

	if (da + advancedDay > daysInCurrent)
	{	da = ((da+advancedDay) % daysInCurrent);
		if (mo == 11)
		{	mo = 0;
			yr++;	}
		else
		{	mo++;	}	}
	else
	{	da = da + advancedDay;	}
	da--;
	yr-=curYr;
	document.res.a_month.selectedIndex = mo;
	document.res.a_day.selectedIndex = da;
	document.res.a_year.selectedIndex = yr;
	return;}