window.onload = function () {

var szNormal = 160, szSmall  = 160, szFull   = 415;
var products = $$("#products .product");
var descriptions = $$("#products .product .text");

var productsSlider = new Fx.Elements(products, {wait: false, duration: 300, transition: Fx.Transitions.Back.easeOut});


descriptions.each(function(description, i) {
	description.setStyle('display','block');
	description.setStyle('opacity',0);	
});



var descriptionToggler = new Fx.Elements(descriptions, {wait: 0, duration: 100});


products.each(function(product, i) {
	product.addEvent("mouseenter", function(event) {
		var o = {};
		var t = {};
		
		o[i] = {width: [product.getStyle("width").toInt(), szFull]}
		t[i] = {'opacity': [0, 1]}
		
		
		products.each(function(other, j) {
			if(i != j) {
				var w = other.getStyle("width").toInt();
							
				if(w != szSmall)	o[j] = {width: [w, szSmall]};
			}
		});
		
		productsSlider.start(o);		
		descriptionToggler.start(t);
	});
	
	if(i==0)
	{
		product.fireEvent('mouseenter',0);
	}
});}

function InsertImage(imageId, imageDescription)
{
	var path = '../../images/';
	
	if(imageId)
		document.write('<img src="'+path+imageId+'" alt="'+imageDescription+'" />');
	else
		return;
}