﻿	function selectImage(thumbnailDiv, largeImage) {
		$('additionalImages').getElementsBySelector("div.selected").each(function(element) {
			element.removeClassName("selected");
		});

		$("Master_Content_imgLargeImage").src = largeImage;
		thumbnailDiv.addClassName("selected");			
	}

	document.observe("dom:loaded", function() {
		var PurchaseContent = $('purchase');
		var QuoteContent = $('quote');
		var RentContent = $('rent');
		var LeaseContent = $('lease');

		// Show the tabs and content (we hide some of the content for users who have JS disabled).
		$('purchase-tabs').show();
		QuoteContent.show();
		if (RentContent) RentContent.show();
		if (LeaseContent) LeaseContent.show();

		// Set the minimum height of all content boxes to the maximum box height.
		var MaxHeight = PurchaseContent.getHeight();
		if (QuoteContent.getHeight() > MaxHeight) MaxHeight = QuoteContent.getHeight();
		if (RentContent && RentContent.getHeight() > MaxHeight) MaxHeight = RentContent.getHeight();
		if (LeaseContent && LeaseContent.getHeight() > MaxHeight) MaxHeight = LeaseContent.getHeight();

		MaxHeight -= 30;	// Remove padding and border.

		PurchaseContent.setStyle({ minHeight: MaxHeight + 'px' });
		QuoteContent.setStyle({ minHeight: MaxHeight + 'px' });
		if (RentContent) RentContent.setStyle({ minHeight: MaxHeight + 'px' });
		if (LeaseContent) LeaseContent.setStyle({ minHeight: MaxHeight + 'px' });

		// Initialize the tab control.
		new Control.Tabs('purchase-tabs');

		// Track clicks for pdf's, exe's, etc.
		if (_gaq) {
			$$('a.internal-file').each(function(elem) {
				elem.observe('click', function(event) {
					_gaq.push(['_trackPageview', Event.element(event).pathname]);
				});
			});
		}

		// Zebra stripe the simple tables.
		$$('table.simple tbody > tr:nth-child(even)').each(function(elem) {
			elem.addClassName('alternate');
		});

		// Add USD for non Canadian customers.
		if (Cookies.get('CountryCode', 'US') == 'CA') {
			$('free-shipping').hide();
		}
	});
