$(document).ready
(
	function()
	{
		$(window).bind
		(
			'load resize',
			function()
			{
				var ah = $('#hp, #home').height();
				var ph = $(window).height();
				var mh = (ph - ah) / 2;
				$('#hp, #home').css('margin-top', mh);
			}
		);
		
		$('.but_prev, .but_next').click
		(
			function ()
			{
				$('#img').attr('src', '/images/design/ajax-loader.gif');
				var move = 'prev';
				if ($(this).hasClass('but_next'))
				{
					move = 'next';
				}
				
				$.ajax
				(
					{
						type: 'GET',
						url: '/scripts/ajax/image.ajax.php',
						data: 'move=' + move + '&image=' + $('#img').attr('alt') + '&uri=' + $('#req_uri').html(),
						
						success: function(req)
						{
							var image = req.getElementsByTagName('image')[0].childNodes[0].nodeValue;
							var img_id = req.getElementsByTagName('img_id')[0].childNodes[0].nodeValue;
							$('#img').attr('src', image);
							$('#img').attr('alt', img_id);
							$('#img_nr').html((img_id * 1 + 1));
						}
					}
				);
			}
		);
	}
);
