MiniProfileClassDetail = new Class({
		initialize: function (name, node) {
			this.name = name;
			this.node = $(node);

			this.hide();
		},

		hide: function () {
			this.node.setStyle('display', 'none');
		},

		show: function () {
			this.node.setStyle('display', '');
		},

		toggle: function () {
		}
	});

MiniProfile = new Class({
		initialize: function (id) {
			this.id = id;
			this.node = $("contentMiniProfile_"+ id);
			this.classes = [];

			var nodes = this.node.getElementsBySelector(".miniProfileClass");
			for (var i = 0, I = nodes.length; i < I; i++)
			{
				var node = nodes[i];
				var name = node.getProperty("rel");
				this.classes.push(new MiniProfileClassDetail(name, node));
			}

			var nodes = this.node.getElementsBySelector(".miniProfileClassImage");
			for (var i = nodes.length; i--;)
				nodes[i].addEvent('mouseover', this.showClass.bindAsEventListener(this));

			this.classes[0].show();
		},

		showClass: function (evt) {
			var evt = new Event(evt)
			evt.stop();
			var className = evt.target.getProperty("rel");
			for (var i = this.classes.length; i--;)
				this.classes[i].name == className ? this.classes[i].show() : this.classes[i].hide();
		}
	});

MiniProfileParser = new Class({
		initialize: function () {
			window.addEvent('domready', this.loadEvent.bindAsEventListener(this));
		},

		loadEvent: function () {
			var nodes = $$(".contentMiniProfile");
			var rxp_id = /^contentMiniProfile_(.*)$/;
			for (var i = nodes.length; i--;)
			{
				var node = nodes[i];
				if (rxp_id.test(node.id))
				{
					var id = RegExp.$1;
					new MiniProfile(id);
				}
			}
		}
	});

new MiniProfileParser();
