/*
 * Gallery for DHg product images...
 * By Rob Nelson
 * Copyright (c) 2008 Data Harvest LTD
*/
	
	
$(document).ready(function()
{
	// make all thumbs appear ghosted at start...
	$('.makeThumbs').fadeTo("fast", 0.4);
	// setup the inital image...
	var isObj = document.getElementById("selectedImage");
	var initImage = "";
	// check if the object exists, when no images are set up the page could throw a javascript error...
	if (isObj)
	{
		initImage = $('#selectedImage').get(0).getAttribute('src');
	}
	
		
	$('.productImageRolloversx1').replaceWith('<div class="productImageRolloversx1"><img src="' + initImage + '"></div>');
	
	// fade in and out when mouse is rolled over...
	$('.makeThumbs').mouseout(function() 
	{
	  	$(this).fadeTo("fast", 0.4);
	}), 
	
	$('.makeThumbs').mouseover(function() 
	{
		$(this).fadeTo("fast", 1);
		//change the content of the preview div
		var imageToShow = $(this).attr('src');
		$('.productImageRolloversx1').replaceWith('<div class="productImageRolloversx1"><img src="' + imageToShow + '"></div>');
	}); 
	
	
	return false;

});
