greenoftheday = {
	dayinfo: {
		01: {
			month: 'April',
			dayofweek: 'Wednesday',
			title: 'Farm Fresh',
			desc: 'Get to know a local farmer. <br> Farm-Fresh Recipes',
			link: '/photogallery/farm-fresh-recipes'
		},
		02: {
			month: 'April',
			dayofweek: 'Thursday',
			title: 'Reuse',
			desc: 'Drink from a reusable water bottle.<br>Earth-Friendly Bottles',
			link: '/article/earth-friendly-bottles'
		},
		03: {
			month: 'April',
			dayofweek: 'Friday',
			title: 'Get Outside',
			desc: 'Skip the gym and exercise outdoors.<br>Outdoor Workouts',
			link: '/photogallery/outdoor-exercises'
		},
		04: {
			month: 'April',
			dayofweek: 'Saturday',
			title: 'Unwrap',
			desc: 'Reuse your Ziploc bags.<br>Healthy Plastic Habits',
			link: '/article/plastics-unwrapped'
		},
		05: {
			month: 'April',
			dayofweek: 'Sunday',
			title: 'Go Fish',
			desc: 'Eat sustainable fish (visit blueocean.org for more info).<br>Sustainable Fish Recipes',
			link: '/photogallery/fish-and-seafood-recipes'
		},
		06: {
			month: 'April',
			dayofweek: 'Monday',
			title: 'Eco-Chic Bag',
			desc: 'Bring a reusable bag to the supermarket, grocery store, mall, and lunch stop.<br>Go-Anywhere Bags',
			link: '/article/go-anywhere-bags'
		},
		07: {
			month: 'April',
			dayofweek: 'Tuesday',
			title: 'Go Vegetarian',
			desc: 'Eat a meal -- or two or three -- without meat.<br>Tasty Meatless Recipes',
			link: '/photogallery/vegetarian-recipes'
		},
		08: {
			month: 'April',
			dayofweek: 'Wednesday',
			title: 'Save Power',
			desc: 'Unplug your electronics.<br>Money-Saving Energy Tips',
			link: '/photogallery/money-saving-home-eco-tips'
		},
		09: {
			month: 'April',
			dayofweek: 'Thursday',
			title: 'Cut Paper Use',
			desc: 'Cancel the phone-book delivery.<br> Paper-Saving Practices',
			link: '/article/eco-challenge-going-paperless'
		},
		10: {
			month: 'April',
			dayofweek: 'Friday',
			title: 'Go Digital',
			desc: 'Sign up for online banking to stop receiving paper statements.<br>Green Money Tips',
			link: '/article/spirit-of-money-buying-carbon-offsets'
		},

		11: {
			month: 'April',
			dayofweek: 'Saturday',
			title: 'Share Your Books',
			desc: 'Swap paperbacks with paperbackswap.<br>Share Your Books',
			link: '/article/share-your-books'
		},
		12: {
			month: 'April',
			dayofweek: 'Sunday',
			title: 'Power Down',
			desc: 'Shut down your computer when you leave work or home.<br>Green Office Ideas',
			link: '/article/green-etiquette-green-office'
		},
		13: {
			month: 'April',
			dayofweek: 'Monday',
			title: 'Stop Sitting',
			desc: 'Skip the elevator and take the stairs.<br> More Ways to Stop Sitting',
			link: '/article/stop-sitting'
		},
		14: {
			month: 'April',
			dayofweek: 'Tuesday',
			title: 'Switch It Off',
			desc: 'Turn off the lights.<br>Household Energy Tips',
			link: '/article/how-to-save-household-energy'
		},
		15: {
			month: 'April',
			dayofweek: 'Wednesday',
			title: 'Freezer-Friendly',
			desc: 'Fill up your freezer, since the fuller it is, the less energy it uses to keep food frozen.<br>Freezer-Friendly Recipes',
			link: '/photogallery/freezer-friendly-recipes'
		},
		16: {
			month: 'April',
			dayofweek: 'Thursday',
			title: 'Pack It Up',
			desc: 'Bring lunch to work in a reusable container.<br>Desk Lunch Recipes',
			link: '/photogallery/sandwiches'
		},
		17: {
			month: 'April',
			dayofweek: 'Friday',
			title: 'Swap Meet',
			desc: 'Swap tools, toys, clothes and the likes with your neighbor.<br>Clothing Swap Resources',
			link: '/article/clothing-swaps'
		},
		18: {
			month: 'April',
			dayofweek: 'Saturday',
			title: 'Sort It Out',
			desc: 'Go trash-free for a day.<br>Recycling Basics',
			link: '/article/sorting-it-out'
		},
		19: {
			month: 'April',
			dayofweek: 'Sunday',
			title: 'Empty-Minded',
			desc: 'Save gas by emptying your trunk.<br>Carpooling Inspiration',
			link: '/article/big-idea-carpooler-robin-chase'
		},
		20: {
			month: 'April',
			dayofweek: 'Monday',
			title: 'Spread the Word',
			desc: 'Start an eco-conversation wherever you go.<br>Get Started',
			link: '/article/start-an-eco-conversation'
		},
		21: {
			month: 'April',
			dayofweek: 'Tuesday',
			title: 'Get Involved',
			desc: 'Join a community supported agriculture (CSA) program (visitlocalharvest.org).<br> Learn More',
			link: '/article/the-small-farm-comeback'
		},
		22: {
			month: 'April',
			dayofweek: 'Wednesday',
			title: 'Be Accountable',
			desc: 'Schedule an energy audit to save energy and money.',
			link: '/photogallery/money-saving-home-eco-tips'
		},
		23: {
			month: 'April',
			dayofweek: 'Thursday',
			title: 'Plant Something',
			desc: 'Plant an organic garden.<br>Organic Gardening Tips',
			link: '/photogallery/ten-quick-organic-gardening-tips'
		},
		24: {
			month: 'April',
			dayofweek: 'Friday',
			title: 'Wallet Relief',
			desc: 'Go on a one-day buying freeze.<br>Responsible Money Tips',
			link: '/article/using-your-money-properly'
		},

		25: {
			month: 'April',
			dayofweek: 'Saturday',
			title: 'Print Smart',
			desc: 'Print on both sides of the paper.<br>More Green Living Ideas',
			link: '/article/eco-decor-with-ideal-bite'
		},
		26: {
			month: 'April',
			dayofweek: 'Sunday',
			title: 'Tote It',
			desc: 'Bring your own mug or thermos to your favorite coffee spot.<br>The World Best Diet',
			link: '/photogallery/diet-boosting-tips'
		},

		27: {
			month: 'April',
			dayofweek: 'Monday',
			title: 'Dont Flatten Out',
			desc: 'Check the air pressure in your tires since under-inflated tires reduce fuel efficiency.<br>Greener Car Ideas',
			link: '/article/how-green-is-your-car'
		},

		28: {
			month: 'April',
			dayofweek: 'Tuesday',
			title: 'Cut the Junk',
			desc: 'Get off junk mail lists by going to dmaconsumers.org/cgi/offmailinglist.<br>More Paperless Ideas',
			link: '/article/cut-the-junk-mail'
		},
		29: {
			month: 'April',
			dayofweek: 'Wednesday',
			title: 'Check It Out',
			desc: 'Get a library card.<br>Our Favorite Green Books',
			link: 'http://images.marthastewart.com/images/content/web/pdfs/wholeliving/green_book_list.pdf'
		},
		30: {
			month: 'April',
			dayofweek: 'Thursday',
			title: 'Give of Yourself',
			desc: 'Volunteer your time at a local conservation agency.<br>The Benefits of Giving',
			link: '/article/what-you-get-from-giving'
		}
		
	},
	
	init: function() {
		dadays = document.getElementsByTagName('li');
		var i = 0;
		while (i < dadays.length) {
			if (dadays[i].parentNode.id == 'tips_week') {
				mydayinfo = this; //because js is stupid with object references
				Event.observe(dadays[i], 'click', function(event) {
						var element = Event.element(event);
						mydayinfo.showday(element);
						return false;
					});
				}
			i++;
		}
	},
	
	showday: function(el) {
		//prototype doesnt pass the element that was bound
		//it passes the actual element that was clicked...
		el = this.recursiveTraceUpNodes(el, 'LI');
		// if (el.className.indexOf("outofrange") != -1) {
		//  	break;
		// }

		
		cnodes = el.childNodes;
		var i = 0;
		while (i < cnodes.length) {
			if (cnodes[i].tagName == 'H2') {
				//theres a span inside of the H2.. why?  I duno..
				daytoshow = cnodes[i].childNodes[0].innerHTML;
			}
			if (cnodes[i].tagName == 'A') {
				imgtoshow = cnodes[i].childNodes[0].src; 
			}
			i++;
		}
		daytoshow = Number(daytoshow);
		strDaytoshow = daytoshow.toString();
		if (strDaytoshow.length == 1) {
			strDaytoshow = "0"+strDaytoshow;
		}
		//finally we have an index to reference...
		
		if (el.className.indexOf('outofrange') == -1) {
			document.getElementById('tip_month').innerHTML = this.dayinfo[daytoshow]['month'];
			document.getElementById('tip_day').innerHTML = strDaytoshow;
			document.getElementById('tip_dayofweek').innerHTML = this.dayinfo[daytoshow]['dayofweek'];
			document.getElementById('tip_title').innerHTML = this.dayinfo[daytoshow]['title'];
			document.getElementById('tip_description').innerHTML = this.dayinfo[daytoshow]['desc'];
		
			document.getElementById('tip_img_large').parentNode.href = this.dayinfo[daytoshow]['link'];
			document.getElementById('tip_url').href = this.dayinfo[daytoshow]['link'];
			document.getElementById('tip_img_large').src = imgtoshow.replace('_s.jpg', '_l.jpg');

			document.getElementById('tip_url').style.display = 'block';
		}
		
		
		return false;
	},
	
	recursiveTraceUpNodes: function(el, searching) {
		if (el.parentNode.tagName == searching) {
			return el.parentNode;
		}
		else {
			return this.recursiveTraceUpNodes(el.parentNode, searching);
		}
	}

};
Event.observe(window, 'load', function() { 
	greenoftheday.init();
});

