/*
# ------------------------------------------------------------------------
# JA Category SLWI module for Joomla 1.5
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

if (!self.jaSLWI) {
	var jaSLWI = {
		jaSLWIInit: function() {
			jaSLWI.modules = $$(".ja-catslwi");
			jaSLWI.modulesText = $$(".ja-catslwi-text");
			var x = new Fx.Elements(jaSLWI.modulesText, { wait: false, duration: 250 });

		var obj = {};
			jaSLWI.modules.each(function(module, i) {
				jaSLWI.modulesText[i].collapseH = jaSLWI.modulesText[i].offsetHeight;
				obj[i] = { 'height': [jaSLWI.modulesText[i].getStyle('height').toInt(), jaSLWI.modulesText[i].collapseH]};
				module.addEvent('mouseenter', function(e) {
					var obj = {};
					obj[i] = { 'height': [jaSLWI.modulesText[i].getStyle('height').toInt(), jaSLWI.expandH]};
					jaSLWI.modules.each(function(other, j) {
						if (other != module) {
							var h = jaSLWI.modulesText[j].getStyle('height').toInt();
							if (h != jaSLWI.modulesText[j].collapseH) obj[j] = { 'height': [h, jaSLWI.modulesText[j].collapseH] };
						}
					});
					x.start(obj);
				});

				module.addEvent('mouseleave', function(e) {
					var obj = {};
					jaSLWI.modules.each(function(other, j) {
						obj[j] = { 'height': [jaSLWI.modulesText[j].getStyle('height').toInt(), jaSLWI.modulesText[j].collapseH]};
					});
					x.start(obj);
				});
			});
			x.start(obj);
		}
	}

	window.addEvent('load', jaSLWI.jaSLWIInit);
}

