window.addEvent('domready', function(){ 
	/* Resizing stage */
	if($('content').getElement('.special_right')){
		var colHeight = $('content').getElement('.special_right').getCoordinates().height-22;
		new Fx.Elements($('stage')).set({
			'0': {
				'height': colHeight
			}
		});
		
		/* Preloading images */
		
		var listImg = [];
		$('myList').getElements('img').each(function(img, idximg){
			listImg[idximg] = img.getProperty('src');
		});	 
		new Asset.images(listImg, {
			onComplete: function(){
				var totIncrement = 0;
				var increment = $('myList').getElement('div').getCoordinates().height+200;
				increment = colHeight;
				var maxIncrement = 0;
				$('myList').getElements('div.pic').each(function(d,idxd){
					maxIncrement -= d.getCoordinates().height;	  
				});
				if(colHeight + maxIncrement < 0 ){
					var fx = new Fx.Morph('myList',{
						duration: 1000,
						transition: Fx.Transitions.Back.easeInOut,
						wait: true
					});
					
					/******************************************/
					/* EVENTS for the button "up"             */  
					$('up').addEvents({ 
						'click' : function(event){ 
							if(totIncrement<0){
								fx.cancel()
								fx.start({
									'margin-top': [totIncrement,totIncrement+increment]
								});
								totIncrement = totIncrement+increment;
							}
						}			  	  
					}); 
			 
					/******************************************/
					/* EVENTS for the button "down"           */  
					$('down').addEvents({ 
						'click' : function(event){ 
							if(totIncrement>(maxIncrement+increment)){
								fx.cancel()
								fx.start({
									'margin-top': [totIncrement,totIncrement-increment]
								});
								totIncrement = totIncrement-increment;
							}
						}		  		  
					});
				}
			}
		});
	}
	
});
