// selector rules above - see examples of how to use at http://encytemedia.com/event-selectors
// complex functions are part of msgs, below

var Rules = {

	// Show us stuff that we've hidden from non-JS users
	'.show' : function(element) {
		Element.show(element);
	}
,
	// Hide stuff that non-JS users will always see
	'#second, #third, #fourth, #fifth' : function(element) {
		Element.hide(element);
	}
,
	// Change all HREFs of links with these classes to '#'
	'.js a' : function(element){
		element.href= '#';
		return false;
	}
,
	'a#first-link:loaded, a#first-link:click': function(element) {
		msgs.first.show()
		msgs.second.hide()
		msgs.third.hide()
		msgs.fourth.hide()
		msgs.fifth.hide();
		return false;
	}
,
	'a#second-link:click': function(element) {
		msgs.first.hide()
		msgs.second.show()
		msgs.third.hide()
		msgs.fourth.hide()
		msgs.fifth.hide();
		return false;
	}
,
	'a#third-link:click': function(element) {
		msgs.first.hide()
		msgs.second.hide()
		msgs.third.show()
		msgs.fourth.hide()
		msgs.fifth.hide();
		return false;
	}
,
	'a#fourth-link:click': function(element) {
		msgs.first.hide()
		msgs.second.hide()
		msgs.third.hide()
		msgs.fourth.show()
		msgs.fifth.hide();
		return false;
	}
,
	'a#fifth-link:click': function(element) {
		msgs.first.hide()
		msgs.second.hide()
		msgs.third.hide()
		msgs.fourth.hide()
		msgs.fifth.show();
		return false;
	}
}

var msgs = {
	first: {
		visible: function() {
			return Element.visible('first')
		},

		show: function() {
			visible = this.visible()

			new Element.show('first')
			Element.addClassName('first-link', 'focused');

			return visible
		},

		hide: function() {
			visible = this.visible()

			new Element.hide('first')
			Element.removeClassName('first-link', 'focused');

			return visible
		}
	}
,
	second: {
		visible: function() {
			return Element.visible('second')
		},

		show: function() {
			visible = this.visible()

			new Element.show('second')
			Element.addClassName('second-link', 'focused');

			return visible
		},

		hide: function() {
			visible = this.visible()

			new Element.hide('second')
			Element.removeClassName('second-link', 'focused');

			return visible
		}
	}
,
	third: {
		visible: function() {
			return Element.visible('third')
		},

		show: function() {
			visible = this.visible()

			new Element.show('third')
			Element.addClassName('third-link', 'focused');

			return visible
		},

		hide: function() {
			visible = this.visible()

			new Element.hide('third')
			Element.removeClassName('third-link', 'focused');

			return visible
		}
	}
,
	fourth: {
		visible: function() {
			return Element.visible('fourth')
		},

		show: function() {
			visible = this.visible()

			new Element.show('fourth')
			Element.addClassName('fourth-link', 'focused');

			return visible
		},

		hide: function() {
			visible = this.visible()

			new Element.hide('fourth')
			Element.removeClassName('fourth-link', 'focused');

			return visible
		}
	}
,
	fifth: {
		visible: function() {
			return Element.visible('fifth')
		},

		show: function() {
			visible = this.visible()

			new Element.show('fifth')
			Element.addClassName('fifth-link', 'focused');

			return visible
		},

		hide: function() {
			visible = this.visible()

			new Element.hide('fifth')
			Element.removeClassName('fifth-link', 'focused');

			return visible
		}
	}
}