var dailyActions = 
[
"<p><strong><a href=\"http://www.energystar.gov/index.cfm?c=cfls.pr_cfls\" target=\"_parent\">Change the World&mdash;Start With ENERGY STAR</a></strong></p>\n<p>Encourage your parents to replace your light bulbs with ones that have the ENERGY STAR label. If every American home replaced one light with an ENERGY STAR light bulb, the reduction in greenhouse gases would be the same as taking 800,000 cars off the road.</p>",
"<p><strong><a href=\"http://www.bikewalk.org/aboutus.php\" target=\"_parent\">Hop on 2 Wheels Instead of 4</a></strong></p>\n<p>Instead of driving, hop on your bike or skateboard or just use your 2 legs to get where you need to go. Not only is it good exercise, but you will save gas and reduce your greenhouse gas emissions.</p>", 
"<p><strong><a href=\"http://www.walktoschool-usa.org/\" target=\"_parent\">Walk to School</a></strong></p>\n<p>Join millions of walkers throughout the world while doing something good for the environment and your health&mdash;walk, bike, carpool, or ride school buses to get to school safely.</p>", 
"<p><strong><a href=\"http://www.publictransportation.org/\" target=\"_parent\">Use Public Transportation </a></strong></p>\n<p>Can&rsquo;t get somewhere on foot or with a bike? Try public transportation like a bus, subway, or tram.</p>", 
"<p><strong><a href=\"http://www.fueleconomy.gov/FEG/drive.shtml\" target=\"_parent\">Carpooling is Key</a></strong></p>\n<p>Still need a car to get around? Ask your friends and neighbors to carpool with you, particularly if you are driving to school or activities such as sport or band practices. Why drive separately when you are all going to the same place? Also, remember to combine your trips wherever possible.</p>", 
"<p><strong><a href=\"http://www1.eere.energy.gov/consumer/tips/home_office.html\" target=\"_parent\">Turn It OFF!</a></strong></p>\n<p>Make sure to switch off your electronics and lights when they are not in use. Even better, unplug them. Electronics still use a small amount of energy when they are plugged in, even when they are turned off. Plugging electronics into a surge-protector with an on/off switch is an easy way to do this!</p>", 
"<p><strong><a href=\"http://www.fws.gov/children/\" target=\"_parent\">Enjoy the Great Outdoors</a></strong></p>\n<p>Turn off the computer, video games, or TV and go outdoors! Get out there and collect fall leaves, ride your bike, play sports…none of these activities emit greenhouse gases. Stay active and healthy! You&rsquo;ll be doing your part for the environment and getting exercise at the same time.</p>", 
"<p><strong><a href=\"http://www.epa.gov/watersense/kids/index.htm\" target=\"_parent\">Be an H2O Hero</a></strong></p>\n<p>Conserving water saves energy and reduces greenhouse gases. To do your part:\n<ul>\n<li>Take a shower instead of a bath and save about 50 gallons of water!</li>\n<li>Inspect your house for leaky faucets or toilets.</li>\n<li>Use a watering can instead of a hose in the garden.</li>\n<ul>\n</p>", 
"<p><strong><a href=\"http://www.epa.gov/heatisland/mitigation/trees.htm\" target=\"_parent\">Plant a Tree</a></strong></p>\n<p>Trees and plants decrease surface and air temperature, save energy, improve air quality, and reduce carbon dioxide emissions. Not only do they spruce up your yard or neighborhood, but they also help reduce greenhouse gases!</p>", 
"<p><strong><a href=\"http://www.epa.gov/osw/conserve/rrr/composting/index.htm\" target=\"_parent\">Put it in the Compost</a></strong></p>\n<p>Start a compost pile using food scraps and yard trimmings. Compost can later be used as a nutrient-rich soil in your flower or vegetable garden. Compost reduces the amount of trash you produce, saves energy, and provides you with free, natural fertilizer for your yard!</p>", 
"<p><strong><a href=\"http://www.epa.gov/osw/inforesources/news/2004news/12-holiday.htm\" target=\"_parent\">Green your Holidays!</a></strong></p>\n<p>Go green this holiday season! Instead of buying a brand new Halloween costume, make your own using clothes you no longer wear. Buy locally grown food for Thanksgiving dinner, and use recycled wrapping paper!</p>", 
"<p><strong><a href=\"http://www.epa.gov/climatechange/kids/calc/index.html\" target=\"_parent\">Calculate Your Carbon Footprint</a></strong></p>\n<p>Get started by calculating your carbon footprint to figure out the amount of greenhouse gases you emit into the atmosphere. This can help you find ways to reduce your contribution to climate change.</p>", 
"<p><strong><a href=\"http://www.epa.gov/epahome/acting.htm\" target=\"_parent\">Get Involved</a></strong></p>\n<p>Take action to reduce climate change and its impacts&mdash;&mdash;volunteer for a local environmental or conservation organization. You can help create a healthier environment while doing your part for your community. If your community does not already have an environmental or conservation organization, gather your friends and create your own!</p>", 
"<p><strong><a href=\"http://www.epa.gov/epawaste/education/lunch.htm\" target=\"_parent\">Pack a Waste-Free Lunch</a></strong></p>\n<p>Use reusable containers, water bottles, and lunchboxes instead of paper bags and disposable water bottles. Refilling your water bottle at the tap or water fountain uses less plastic, saves energy, and saves you lots of money!</p>", 
"<p><strong><a href=\"http://www.epa.gov/epawaste/conserve/rrr/reduce.htm\" target=\"_parent\">Save Trees&mdash;Conserve Paper!</a></strong></p>\n<p>Here are some tips:\n<ul>\n<li>Print double-sided and write on both sides of paper</li>\n<li>Cut up old blank paper for notes instead of buying new notepads</li>\n<li>Buy recycled paper products such as notebooks, computer paper</li>\n</ul></p>", 
"<p><strong><a href=\"http://extension.unh.edu/news/new11604.htm\" target=\"_parent\">Grow a Green Thumb</a></strong></p>\n<p>Save energy and money by starting your own vegetable garden. Ask friends and family to shop for locally grown produce to save energy and reduce greenhouse gases.</p>", 
"<p><strong><a href=\"http://www.epa.gov/epawaste/wycd/index.htm\" target=\"_parent\">Reduce, Recycle and Reuse and Make Some Quick Cash Too!</a></strong></p>\n<p>Have a garage sale! Gather your old clothes, toys, books, etc. and set up a yard sale with friends and neighbors. This is a great way to turn your trash into someone else&rsquo;s treasure while making a few extra bucks along the way. Donate whatever is not sold to a local charity or secondhand store.</p>", 
"<p><strong><a href=\"http://tipnut.com/35-reusable-grocery-bags-totes-free-patterns/\" target=\"_parent\">Get Crafty</a></strong></p>\n<p>Design your own reusable bag to use or give away as a holiday or birthday gift. Buy a canvas bag at a local craft store and add your own flair to it or make your own from scratch. Use this for groceries, at the mall, or at school.</p>", 
"<p><strong><a href=\"http://www.epa.gov/osw/conserve/tools/localgov/sectors/school.htm\" target=\"_parent\">Make Your School Part of the Solution</a></strong></p>\n<p>Recycle at school! Schools all over the United States have recycling programs. Recycling your paper, bottles, cans, and food at school will reduce greenhouse gas emissions.</p>", 
"<p><strong><a href=\"http://www.epa.gov/osw/wycd/catbook/index.htm\" target=\"_parent\">Reduce and Recycle</a></strong></p>\n<p>Reduce your trash. Recycle aluminum, paper, and plastics and put your food scraps in the compost. Making products out of recycled materials takes less energy and releases fewer greenhouse gases.</p>", 
"<p><strong><a href=\"http://www.epa.gov/osw/conserve/materials/ecycling/basic.htm\" target=\"_parent\">E-Cycle Your Electronics</a></strong></p>\n<p>Do you always have the latest version of electronic gadgets like cell phones and mp3 players? These days, it seems like electronics become old-fashioned in the blink of an eye. Dispose of your old electronics properly or donate them to charity. Browse the web to find local recycling depots or charity organizations that accept old electronics.</p>", 
"<p><strong><a href=\"http://www.energystar.gov/index.cfm?c=thermostats.pr_thermostats\" target=\"_parent\">Turn it Up, Turn it Down&mdash;Use the Rule of 2</a></strong></p>\n<p>Encourage your parents to go 2 up, 2 down! Turn up the thermostat by 2 degrees in the summer and down 2 degrees in the winter. About half of the energy used in homes goes to heating and cooling systems. Making this simple adjustment can save hundreds of pounds of carbon dioxide each year and save your family money.</p>", 
"<p><strong><a href=\"http://www.savetherainforest.org/savetherainforest_002.htm\" target=\"_parent\">Get Involved&mdash;Save a Rainforest!</a></strong></p>\n<p>When forests are cut down, animals lose their habitat and carbon dioxide is released into the atmosphere. Learn about deforestation and what you can do about it.</p>", 
"<p><strong><a href=\"http://blog.epa.gov/blog/category/studentsforclimateaction/\" target=\"_parent\">Become an Environmental Blogger</a></strong></p>\n<p>Contribute to EPA&rsquo;s &ldquo;Students for Action&rdquo; blog - share your ideas to create a new climate for action.</p>", 
"<p><strong><a href=\"http://www.energystar.gov/index.cfm?c=k12_schools.bus_schoolsk12\" target=\"_parent\">Get Your School to Take the ENERGY STAR Challenge</a></strong></p>\n<p>Encourage your school to improve energy efficiency by 10% by taking the ENERGY STAR Challenge. U.S. schools spend $6 billion each year on energy&mdash;more than on textbooks and computers combined. You and your friends can inspire your principal and teachers to make a big difference.</p>", 
"<p><strong><a href=\"http://www.epa.gov/region09/psa/psa-usecups.html\" target=\"_parent\">Revamp Your Java Fix</a></strong></p>\n<p>Meeting friends at the cafe or grabbing breakfast before school? Reduce waste and bring a reusable mug. Many coffee shops offer a discount if you have your own cup. Reducing waste can help reduce climate change impacts.</p>", 
"<p><strong><a href=\"http://www.epa.gov/osw/wycd/funfacts/school.htm\" target=\"_parent\">Borrow Instead of Buy</a></strong></p>\n<p>Borrow a book from the library; rent movies from a mail service or local video store; do a trade-off with friends using old books and movies that you have already seen or no longer want. If you need to purchase something instead of borrowing it, check out thrift stores or websites offering used products.</p>", 
"<p><strong><a href=\"http://www.epa.gov/osw/partnerships/wastewise/wrr/buyq&a.htm\" target=\"_parent\">Buy Products Made from Recycled Materials</a></strong></p>\n<p>Buy products made from recycled materials whenever they are available. There are currently over 4,500 products that are made from recycled materials. Everything from paper to toothbrushes to shoes can be bought recycled!</p>", 
"<p><strong><a href=\"http://www.epa.gov/climateforaction/lead/become.htm\" target=\"_parent\">Become a Climate Ambassador</a></strong></p>\n<p>Join your peers and become a Climate Ambassador. Motivate your friends to use less energy and save the planet!</p>", 
"<p><strong><a href=\"http://yosemite.epa.gov/ochp/ochpweb.nsf/content/climate.htm\" target=\"_parent\">Teach Others about the Connection between Climate Change and Children&rsquo;s Health</a></strong></p>\n<p>Climate change is already affecting glacier melting, sea level rise, and many other environmental conditions. Climate change may also affect the health of children. Get the facts and share them with your friends and family.</p>", 
"<p><strong><a href=\"http://www.epa.gov/climatechange/kids/difference.html\" target=\"_parent\">Do Your Part</a></strong></p>\n<p>Educate your peers about the importance of doing their part to save the environment. Create a skit or presentation to educate your classmates and friends about climate change, greenhouse gases, and how we can reduce our carbon footprint.</p>"
];

var itemNumber = 0;
var duration = 5;

function writeDailyAction()
{
	// for a self running display (for debugging) comment out the line below
 	// cycleDailyActions(); return;
	
	// set according to day
	var startDate = new Date();
	startDate.setFullYear(2008,9,6); // Note: month is zero-based (0 through 11)
	
	var todaysDate = new Date();
	// The commented out line below can change what "today" is for testing
    //todaysDate.setFullYear(2008, 9, 13);
	
	// Set the itemNumber is equal to the number of days that have elapsed since startDate.
	// days = milliseconds / 86400000 (24 hours * 60 mins * 60 secs * 1000 milisecs)
	itemNumber = Math.floor((todaysDate.getTime() - startDate.getTime()) / 86400000);
	
	// If item number is > items, then we are past the specific dates for which we wanted
	// to show the items in order, so just show a random item
	if (itemNumber >= dailyActions.length) 
	{
		itemNumber = Math.floor((100 * Math.random()) % dailyActions.length);
	}
	
	// alert(itemNumber);
	writeToDocument();
}

function cycleDailyActions()
{
	writeToDocument();
	itemNumber += 1;
	// Show a new one every <duration> seconds
	self.setTimeout("cycleDailyActions()", duration * 1000)
}

function writeToDocument()
{
	elem = document.getElementById("widget");
	elem.innerHTML = "<h3>Daily Actions</h3>\n" + dailyActions[itemNumber];
}