/*
# ------------------------------------------------------------------------
# JA Category SLWI module for Joomla 1.5
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license - PHP files are GNU/GPL V2. CSS / JS are Copyrighted Commercial,
# bound by Proprietary License of JoomlArt. For details on licensing, 
# Please Read Terms of Use at http://www.joomlart.com/terms_of_use.html.
# Author: JoomlArt.com
# Websites:  http://www.joomlart.com -  http://www.joomlancers.com
# Redistribution, Modification or Re-licensing of this file in part of full, 
# is bound by the License applied. 
# ------------------------------------------------------------------------
*/

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);
}

