//when the dom is ready
window.addEvent('domready', function() {
	
	
	//store titles and text
	$$('a.tipz').each(function(element,index) {
		var content = element.get('title').split('::');
		element.store('tip:title', content[0]);
		element.store('tip:text', content[1]);
	});
	
	//create the tooltips
	var tipz = new Tips('.tipz',{
		className: 'tipz',
		fixed: true,
		hideDelay: 50,
		showDelay: 50
	});
tipz.addEvents({
	'show': function(tip) {
		tip.fade('in');
	},
	'hide': function(tip) {
		tip.fade('out');
	}
});
	
});

	/*
		smooth scroll
	*/
	
	window.addEvent("domready", function() {
		if (!window.attachEvent) {
			var location = window.location;
			var winHash = location.hash.replace("#", "");
			if (winHash != "") {
				var fx = new Fx.Scroll($$('body')[0], { wheelStops: false, duration: 1500 });
				fx.set(0, 0);	
				var winAnchor = $$('[id=' + winHash + ']');
				if (winAnchor.length > 0) {
					winAnchor = winAnchor[0];
					window.setTimeout(function() {
						fx.start(0, winAnchor.getPosition().y);
					}, 200);
				}
			}
		}
		var links = $$('a');
		for (var i = 0; i < links.length; i++) {
			if (links[i].hash != "") {
				links[i].addEvent("click", function() {
					var link = this;
					var hash = this.hash.replace("#", "");
					var anchor = $$('[id=' + hash + ']');
					if (anchor.length > 0) {
						var y = anchor[0].getPosition().y;
						var scroll = new Fx.Scroll($$('body')[0], { wheelStops: false, duration: 1500 });
						scroll.start(0, y).chain(function() {
							window.location = link.href;
						});
					} else
						window.location = link.href;
					return false;
				});
			}
		}
	});

