function on_load() {
	$(document).ready(function() {
		$('.showhide img').click(function() {
			if ($('.diafaneia').css('backgroundImage') != 'none') {
				if ($('.diafaneia-wrapper').css('top').replace(/px/g, '') < -14)
					$('.diafaneia-wrapper').animate({ 'top': '+=155' }, 1000, 'swing', function() { $('.showhide img').attr('src', 'images/show.gif'); });
				else
					$('.diafaneia-wrapper').animate({ 'top': '-=155' }, 1000, 'swing', function() { $('.showhide img').attr('src', 'images/hide.gif'); });
				}
			else {
				if ($('.diafaneia-wrapper').css('height').replace(/px/g, '') == 190)
					$('.diafaneia-wrapper').animate({ 'height': '-=155', 'top': '+=155' }, 1250, 'swing', function() { $('.diafaneia2').css('height', 0); $('.showhide img').attr('src', 'images/show.gif'); });
				else
					$('.diafaneia-wrapper').animate({ 'height': '+=155', 'top': '-=155' }, 1250, 'swing', function() { $('.diafaneia2').css('height', 155); $('.showhide img').attr('src', 'images/hide.gif'); });
			}
		});
	});
	if ($('.thumbsdivinner img').length > 1) {
		$('.medias_subpage').attr('selected', 1);
		$('.medias_subpage').attr('whatisnext', 'img');
		$('.medias_subpage').attr('timeoutID', setTimeout(function() { rotatePics();}, 9000));
	}
	function rotatePics() {
		var numberOfPhotos = $('.thumbsdivinner img').length;
		var selected = $('.medias_subpage').attr('selected');
		var nextphoto = Number(selected) + 1;
		if (nextphoto >= numberOfPhotos) nextphoto = 0;
		var whatisnext = $('.medias_subpage').attr('whatisnext');
		if (whatisnext == 'img')  {
			$('.medias_subpage img').animate({ 'opacity': 1 }, 'fast', function(){
				$('.medias_subpage').css({ 'backgroundImage': 'url(' + $('.thumbsdivinner img:eq(' + nextphoto + ')').attr('photosrc') + ')' });
				$('.medias_subpage').attr('whatisnext', '');
				$('.medias_subpage').attr('selected', nextphoto);
				$('.medias_subpage').attr('timeoutID', setTimeout(function() { rotatePics();}, 9000));
			});
		}
		else {
			$('.medias_subpage img').animate({ 'opacity': 0 }, 'fast', function(){
				$('.medias_subpage').attr('whatisnext', 'img');
				$('.medias_subpage').attr('selected', nextphoto);
				$('.medias_subpage img').attr('src', $('.thumbsdivinner img:eq(' + nextphoto + ')').attr('photosrc'));
				$('.medias_subpage').attr('timeoutID', setTimeout(function() { rotatePics();}, 9000));
			});
		}
	}
}

