
$(document).ready(function(){

  $("p.thumb").append("<span id=lupe></span>");


	var img	  = $("p.thumb img");
	imgwidth  = $(img).attr('width');
	imgheight = $(img).attr('height');
	
	img.attr("width",imgwidth / 2);
	img.attr("height",imgheight / 2);




//Larger thumbnail preview

$("p.thumb").hover(function() {
	//alert($(this).attr('src', $(this).attr('width')));

	$(this).css({'z-index' : '10'});
	$(this).find('img').addClass("hover").stop()
		.animate({
			width: imgwidth,
			height: imgheight
		}, 200);

	} , function() {
	$(this).css({'z-index' : '0'});
	$(this).find('img').removeClass("hover").stop()
		.animate({
			width: imgwidth / 2,
			height: imgheight / 2
		}, 400);
});

//Swap Image on Click
	$("p.thumb a").click(function() {

		var mainImage = $(this).attr("href"); //Find Image Name
		$("#main_view img").attr({ src: mainImage });
		return false;
	});

});
