
var pictures = {
	init: function()
	{
		pictures.firefoxFix();
		if (document.getElementById("thumbnails"))
		{
			var thumbLinks = document.getElementById("thumbnails").getElementsByTagName("a");
			// Change all the thumbnail links
			if (thumbLinks)
			{
				for (i=0; i < thumbLinks.length; i++)
				{
					thumbLinks[i].onclick = function() { pictures.showThumb(this); return false; };	
					// We need to preload the images as well;
					pictures.preloadFullImage(thumbLinks[i].href);
				} // for
			} // if
		} // if
	}, // init
	
	showThumb: function(full_image)
	{
		// Now show the full size image in the 'mainimage' location
		blowUp = document.getElementById('blowUp');
		blowUp.src = full_image;
	}, // showThumb
	
	preloadFullImage: function(image)
	{
		var preload = new Image();
		preload.src = image;
	},
	
	firefoxFix: function()
	{

		if (window.navigator 
		&& window.navigator.userAgent.toString().indexOf('Firefox') != -1 
		&& window.navigator.userAgent.toString().indexOf('1.8.1.8') != -1){
		document.getElementById('caravanImages').className =
		document.getElementById('caravanImages').className + ' clearfix';}	
	
	}	
}
if (/WebKit/i.test(navigator.userAgent)) { // sniff
    var _timer = setInterval(function() {
        if (/loaded|complete/.test(document.readyState)) {
            clearInterval(_timer);
           pictures.init(); // call the onload handler
        }
    }, 10);
}
if (document.addEventListener)
    document.addEventListener("DOMContentLoaded", pictures.init, false);
else
	Event.addEvent(this, "load", pictures.init, true);
