/* bw.js source code */

function writeAmenities() {
document.write("<table cellspacing=\"0\" cellpadding=\"0\" id=\"amenities\">")
document.write("<tr><td valign=top class=\"head\">")
document.write("<h5>Amenities</h5>")
document.write("<table id=\"amenities\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>")
document.write("<p><a href=\"amenities.html\"><img src=\"images/pool5.jpg\" width=\"139\" height=\"94\" border=\"0\" alt=\"\" hspace=\"2\" vspace=\"2\" align=\"left\"></a>")
document.write("Corporate travelers will find all the <a href=\"amenities.html\">amenities</a> they expect including business center, High Speed Wireless Internet and more...</p>")
document.write("</td></tr></table>")
document.write("</td></tr></table>")
}
function writeDining() {
document.write("<table cellspacing=\"0\" cellpadding=\"0\" id=\"dining\">")
document.write("<tr><td valign=top class=\"head\">")
document.write("<h5>Dining</h5>")
document.write("<table id=\"dining\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>")
document.write("<p><a href=\"dining.html\"><img src=\"images/bbc_food.jpg\" width=\"139\" height=\"95\" border=\"0\" alt=\"\" hspace=\"2\" vspace=\"2\" align=\"left\"></a>")
document.write("Come visit our new exciting pub-styled restaurant, the <font color=\"#000066\"><a href=\"dining.html\">Framingham BBC</a></font>, offering live entertainment.</p>")
document.write("</td></tr></table>")
document.write("</td></tr></table>")
}
function writeMeeting() {
document.write("<table cellspacing=\"0\" cellpadding=\"0\" id=\"meeting\">")
document.write("<tr><td valign=top class=\"head\">")
document.write("<h5>Meeting Rooms</h5>")
document.write("<table id=\"meeting\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>")
document.write("<p><a href=\"meetingrooms.html\"><img src=\"images/meetingroom_th.jpg\" width=\"139\" height=\"78\" border=\"0\" alt=\"\" hspace=\"2\" vspace=\"2\" align=\"left\"></a>")
document.write("Our specialty is hosting business <a href=\"meetingrooms.html\">meetings</a> and training classes. We would love to accommodate your company anytime.</p>")
document.write("</td></tr></table>")
document.write("</td></tr></table>")
}
function writeVirtualTour() {
document.write("<table cellspacing=\"0\" cellpadding=\"0\" id=\"tour\">")
document.write("<tr><td valign=top class=\"head\">")
document.write("<h5>Virtual Tour</h5>")
document.write("<table id=\"tour\" cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\" height=\"160\">")
document.write("<p><a href=\"http://www.vfmii.com/exc/aspquery?command=invoke&ipid=BW22047&ids=42470\" target=\"_blank\"><img src=\"images/vtour.jpg\" width=\"139\" height=\"115\" border=\"0\" alt=\"\" hspace=\"4\" vspace=\"4\" align=\"left\"></a>")
document.write("Take a <a href=\"http://www.vfmii.com/exc/aspquery?command=invoke&ipid=BW22047&ids=42470\" target=\"_blank\">Virtual Tour of the Best Western Framingham</a>. We have 184 beautiful guest rooms equipped with all standard Best Western <a href=\"amenities.html\">amenities</a>.</p>")
document.write("</td></tr></table>")
document.write("</td></tr></table>")
}
function writeBottomCenter() {
document.write("<table cellspacing=\"0\" cellpadding=\"0\" id=\"bottom_center\">")
document.write("<tr><td valign=top class=\"head\">")
document.write("<h5>Fresh Coffee</h5>")
document.write("<table id=\"bottom_center\" cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\" height=\"160\">")
document.write("<p><img src=\"images/coffee_pour.jpg\" width=\"119\" height=\"126\" hspace=\"4\" vspace=\"4\" border=\"0\" alt=\"\" align=\"left\">")
document.write("From 6am-8pm there is always plenty of fresh complimentary coffee in our lobby.</p>")
document.write("</td></tr></table>")
document.write("</td></tr></table>")
}
function writeBottomRight() {
document.write("<table cellspacing=\"0\" cellpadding=\"0\" id=\"bottom_right\">")
document.write("<tr><td valign=top class=\"head\">")
document.write("<h5>Directions</h5>")
document.write("<table id=\"bottom_right\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>")
document.write("<p><a href=\"directions.html\"><img src=\"images/directions.jpg\" width=\"200\" height=\"153\" border=\"0\" alt=\"\"></a>")
document.write("</p>")
document.write("</td></tr></table>")
document.write("</td></tr></table>")
}
var now = new Date();
var thisDate = now.getDate(); // day of month
//thisDate = 28; // for test

var thisMonth = now.getMonth();
//thisMonth = 1; // for test

var thisYear = now.getYear(); 
	if(thisYear < 1900){
	thisYear += 1900;
	}

//calculate departure day and month based on current day and month
var departureMonthYear = 0;
var departureDay = 0;
var nextMonth = thisMonth + 1;

if ( thisMonth == (8 || 3 || 5 || 10) && thisDate == 30 ) { // months with 30 days
	departureDay = 1;
	departureDay = formatDate(departureDay);
	departureMonthYear = thisYear + formatMonth(nextMonth);
} else if (thisMonth == 1 && thisDate == 28) { // months with 28 days (ignore leap years)
	departureDay = 1;
	departureDay = formatDate(departureDay);
	departureMonthYear = thisYear + formatMonth(nextMonth);
} else {
	departureDay = thisDate + 1; // all other months
	departureDay = formatDate(departureDay);
	departureMonthYear = thisYear + formatMonth(thisMonth);
}

// format arrival times
var arrivalMonthYear = thisYear + formatMonth(thisMonth);
var arrivalDay = formatDate(thisDate);

// format numbers
function formatDate(date){
	if(date < 10){
	date = "0" + date;
	} else { 
	date = date;
	}
	return date;
}
function formatMonth(month){
	if(month < 10){
	month = "0" + month;
	} else { 
	month = month;
	}
	return month;
}

function writeFindRoom() {
document.write("<a href=\"http://book.bestwestern.com/bestwestern/priceAvail.do?propertyCode=22047&arrivalDay=" + arrivalDay + "&arrivalMonthYear=" + arrivalMonthYear + "&departureDay=" + departureDay + "&departureMonthYear=" + departureMonthYear + "&numRooms=1&disablenav=true\" target=\"_blank\"><img src=\"images/btn-findaroom.gif\" width=\"106\" height=\"24\" border=\"0\" alt=\"\" align=\"middle\"></a>")
}
