/*
 * ------------------------------------------------------------------------
 * JA Category SLWI module for Joomla 1.5
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * 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);
}

