Event.observe(window,"load", function(evt){ 
	var imgs = $$('div.popout img');
	var arrImg = [];
	var links = $$('div.prdLive .prdLink');
	
	var linksProducts = $$('#pop_menu ol li a');
	
	imgs.each(function(x){
		var ii = x.id;
		var iii = x.src;
		arrImg.push({ 'id':x.id,'src':x.src });
	});

	links.each(function(x){
		Event.observe(x,'click',function(evt) { 
			x.next('div.prdList').toggleClassName('hide');
			return false;
		});
		Event.observe(x,'mouseover',function(evt) { 
			if(x.next('div.hide'))
			x.next('div.hide').removeClassName('hide');
		});
		

	});

	//Display all products images in left column
	linksProducts.each(function(x){
		Event.observe(x,'mouseover',function(evt) { 
			//x.next('ol').toggle();
                        //alert($(x.className).src);
			$(x.className).src = x.next().src;
                        //alert($(x.className).src);
		});
		Event.observe(x,'mouseout',function(evt) { 
			
			for(var i=0;i<arrImg.length;i++){
			  if(arrImg[i].id == x.className) { 
			  	$(x.className).src = arrImg[i].src;
			  	break;
			  }
			}
			
		});		

	});
        
        //Display all products
	Event.observe($('listAllProducts'),'click',function(evt){
		var showProducts = $$('#pop_menu div.hide');
		for(var y=0;y<showProducts.length;y++){ 
			//showProducts[y].setStyle( {'display':'block'} ); 
			//showProducts[y].toggle();
			showProducts[y].toggleClassName("hide");
			//alert(showProducts[y].getStyle('display'));
		}
		return false;
	});

});

function productChosen(productId) {
  document.refinishForm.productId.value = productId;
  document.refinishForm.submit();
}