/*  Prototype JavaScript framework, version 1.7
 *  (c) 2005-2010 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
 *
 *--------------------------------------------------------------------------*/

$(function () {
	$('div.swap li a').mouseover(function (e) {
		e.preventDefault();
		var imagePath = $(this).attr('href');
		var mainImage = $(this).parents('div.swap').find('p img');
		var selectedNo = $(this).parents('div.swap').find('li a');
		$(selectedNo).removeClass('selected');
		$(this).addClass('selected');
		if (imagePath == mainImage.attr('src')) {
			return;
		} else {
			$(mainImage).fadeOut('fast', function () {
				$(this).fadeIn().attr('src', imagePath);
			});
		}
	});
});


$(function () {
	$('div.swap li a').click(function (e) {
		e.preventDefault();
		var imagePath = $(this).attr('href');
		var mainImage = $(this).parents('div.swap').find('p img');
		var selectedNo = $(this).parents('div.swap').find('li a');
		$(selectedNo).removeClass('selected');
		$(this).addClass('selected');
		if (imagePath == mainImage.attr('src')) {
			return;
		} else {
			$(mainImage).fadeOut('fast', function () {
				$(this).fadeIn().attr('src', imagePath);
			});
		}
	});
});
