$(document).ready(function(){
	$('td#colors img').hover(
		function() {
			$('#MediumZoomImg').attr('src', '/content/colors/'+$(this).attr('name')+'_l.jpg');
		}
	);
	$('td#colors img').click(
		function(){
			ShowZoomImg($(this).attr('name'), 'colors');
		}
	);
	/*
	$('table#sizes img').click(
		function(){
			ShowZoomImg($(this).attr('name'), 'sizes');
		}
	);
	$('table#decors img').click(
		function(){
			ShowZoomImg($(this).attr('name'), 'decors');
		}
	);
	*/
	$('table#objects img').click(
		function(){
			window.location.href='/objects.php?object='+$(this).attr('name');
		}
	);
	$('table#photos img').click(
		function(){
			ShowZoomImg($(this).attr('name'), 'photos');
		}
	);
	$('#CloseZoomImg').click(
		function(){
			$('#ZoomImgDiv').fadeOut('fast');
			$('#ZoomImgBackground').fadeOut('fast');
			$(document).css('overflow','auto');
		}
	);
	$('#ZoomImg').click(
		function(){
			$('#ZoomImgDiv').fadeOut('fast');
			$('#ZoomImgBackground').fadeOut('fast');
			$(document).css('overflow','auto');
		}
	);
});

function ShowZoomImg(id, mode){
	$('#ZoomImg').attr('src', '/content/'+mode+'/'+id+'_l.jpg');
	$('#ZoomImg').attr('alt', $('#'+mode+id).attr('alt'));
	$('#ZoomImgName').html($('#'+mode+id).attr('alt'));
	$('#ZoomImgBackground').width($(document).width()).height($(document).height()).css('opacity',0.5).fadeIn('fast');
	$('#ZoomImgDiv').css('left',(($(window).width()-500)/2)+$(window).scrollLeft()).css('top',$(window).scrollTop()+10);
	$('#ZoomImgDiv').fadeIn('slow');
}

