//The Mother’s Day sale runs from May 1 - May 7, 2011var MOTHERS_DAY_START = new Date("May 1, 2011");var MOTHERS_DAY_END = new Date("May 7, 2011");//The Valentine’s Day sale runs from Feb 6 - Feb 13, 2011var VALENTINES_DAY_START = new Date("February 6, 2011");var VALENTINES_DAY_END = new Date("February 13, 2011");function updateSpecials() { var today = new Date(); var site = SitesApp.getSite("example.com", "giftshop"); // Get all the web pages in the Site var pages = site.getWebPages(); // Loop through the web pages to find the specials page for (var i = 0; i < pages.length; i++) { if (pages[i].getPageName() == "specials") { var page = pages[i]; } } // Set up the default wording for the specials page var pageText = "There are no specials at this time."; // If today’s date is within the Mother’s Day sale range if (today >= MOTHERS_DAY_START && today <= MOTHERS_DAY_END) { // Find the sale text that’s stored in the file mom.txt pageText = DocsList.find("mom.txt")[0].getContentAsString(); } // If today’s date is within the Valentine’s Day sale range else if (today >= VALENTINES_START && today <= VALENTINES_END ) { // Find the sale text that’s stored in the file valentines.txt var pageText = DocsList.find("valentines.txt")[0].getContentAsString() } // Set the content of the specials page page.setContent(pageText); }