/*
 ****************************************************************************
 * File : prototype.effect.js
 * Copyright (C) 2005-2008 http://bizcaz.com/ All rights reserved.
 ****************************************************************************
*/
Event.observe(window, 'load', function() {
	$$('a[href^=#]:not([href=#])').each(function(element) {
		element.observe('click', function(event) {
			new Effect.ScrollTo(this.hash.substr(1));
			Event.stop(event);
		}.bindAsEventListener(element))
	})
})

Event.observe(window, 'load', function() {
	$$('#navibar ul').each(function(element) {
		var location    = encodeURI(document.location.href).replace(/#.*/,'');
		var descendants = element.descendants();

		descendants = descendants.map(function (descendant) {
			return $(descendant);
		});

		for (var i = 0, length = descendants.length;length > i;i++) {
			var elem = descendants[i];

			if (elem.tagName.match('A')) {
				if (location == elem.href) {
					Element.addClassName(elem, 'current');
					elem.href = 'javascript:void(0);';
					break;
				}
			}
		}
	})
})

function updated_today() {
	var date = new Date();
	var yy   = date.getYear();      if (yy < 1900) { yy += 1900;     }
	var mm   = date.getMonth() + 1; if (mm <   10) { mm  = '0' + mm; }
	var dd   = date.getDate();      if (dd <   10) { dd  = '0' + dd; }

	var today    = yy+'/'+mm+'/'+dd;
	var updated  = '2010/03/02';

	if (updated == today) {

		var today_link = 'javascript:void(0);';

		var $out = '<div id="updated_today"><a href="'+today_link+'" title="Updated Today:'+today+'">&nbsp;</a></div>';

		document.write($out);
		new Effect.Appear('updated_today', {from:0.1, to:1.0, duration:1.0})
	}
}
