	window.addEvent('domready', function() {
		if ($defined($$('.belowImgBlogMenuBox'))){
			$$('.belowImgBlogMenuBox').addEvents({
				mouseenter: function() {
					this.removeClass('small');
				},
				mouseleave: function() {
					this.addClass('small');
				}
			});
			
			//alert($$('.belowImgBlogMenuBox .edge').getSize().x);
		}
		
		if ($defined($('topImages')) && $('topImages').hasClass('gallery')) {
			var current = 0;
			var images  = $('topImages').getElements('.img');
			var locked  = false;
			
			$('lftCtrl').setStyle('display', 'none');
			
			if (images.length < 2) {
				$('rgtCtrl').setStyle('display', 'none');
			}
			
			images.setStyle('opacity', 0);
			images[0].setStyle('opacity', 1);
			
			$('rgtCtrl').addEvent('click', function(e) {
				if (!locked) {
					locked = true;
					current++;
					
					images[current - 1].set('morph', {
						onComplete: function() {}
					});
					images[current - 1].morph({
						'opacity': 0
					});
					
					if (current >= images.length)
						current = 0;
					
					images[current].set('morph', {
						onComplete: function() {
							locked = false;
						}
					});
					images[current].morph({
						'opacity': 1
					});
					
					if (images.length > 1 && $('lftCtrl').getStyle('display') == 'none') {
						$('lftCtrl').setStyle('display', 'block');
					}
					
					/*
					
					images[current - 1].setStyle('zIndex', 0);
					images[current].setStyle('zIndex', 1);
					images[current].set('morph', {
						onComplete: function() {
							images[current - 1].setStyle('left', '-980px');
							
							locked = false;
						}
					});
					images[current].morph({
						'left': '0'
					});
					
					if (current == images.length - 1) {
						$('rgtCtrl').setStyle('display', 'none');
					} else if ($('lftCtrl').getStyle('display') == 'none') {
						$('lftCtrl').setStyle('display', 'block');
					}*/
				}
			});
			$('lftCtrl').addEvent('click', function(e) {
				if (!locked) {
					locked = true;
					current--;
					
					images[current + 1].set('morph', {
						onComplete: function() {}
					});
					images[current + 1].morph({
						'opacity': 0
					});
					
					if (current < 0) {
						current = images.length - 1;
					}
					
					images[current].set('morph', {
						onComplete: function() {
							locked = false;
						}
					});
					images[current].morph({
						'opacity': 1
					});
					
					/*
					images[current + 1].setStyle('zIndex', 0);
					images[current].setStyle('zIndex', 1);
					images[current].set('morph', {
						onComplete: function() {
							images[current + 1].setStyle('left', '980px');
							
							locked = false;
						}
					});
					images[current].morph({
						'left': '0'
					});
					
					if (current == 0) {
						$('lftCtrl').setStyle('display', 'none');
					} else if ($('rgtCtrl').getStyle('display') == 'none') {
						$('rgtCtrl').setStyle('display', 'block');
					}*/
				}
			});
		}
	});
