	
	$(document).ready(function() {
		
		$.setToSameHeight($('.rss_updates_container .rss_updates .rss_updates_body'));
		
		$.setToSameHeight($('.scontact_contacts'));
		
		// Store Navigation
		$("#subNav > ul").jsddm();
		
		// Store categories list
		$('.itemList').padList(4);
		
		// Admin notices bar.
		$('#upcomingEventsBarCloseLink').showToggle({
			'showSelector' 	: '#upcomingEventsContainer',
			'speed'			: 'fast',
			'onHide' 		: function() {
								$("#upcomingEventsBarCloseLink").html("Show Notices");
								// Save a session var to keep notices hidden.
								$.ajax({
									type: "GET",
									url: "/ajax/hide_notices.php",
									cache: false
								});
							},
			'onShow' 		: function() {
								$("#upcomingEventsBarCloseLink").html("Close Notices");
								// Save a session var to keep notices shown.
								$.ajax({
									type: "GET",
									url: "/ajax/show_notices.php",
									cache: false
								});
							}
		});
		
		// Some page billboard
		$("#homeBlock1").slidingBillboard(4500);
		
		// Sorting the distributors list into vertically alphabetized columns.
		$("#distributorList").sortList(3);
		
		// Make Our TV videos swappable.
		// $('#our_tv_video').swappableSwf('/flash/our_tv/Reflection_pause.swf');
		$('#our_tv_video').swappableSwf('/flash/our_tv/simple_pause.swf');
		
		// Checkbox to set checkout billing address to same as shipping.
		$("#billing_same_as_shipping").sameAsShipping();
		
		// Show hide wallpaper size links on click.
		$('.show_wallpaper_size_links').showToggle({
			'showSelector' 	: '.wallpaper_links .wallpaper_size_links',
			'startHidden' 	: true,
			'oneAtATime' 	: true
		});
		
		// Show hide ringtone type links on click.
		$('#ringtones_links .download').showToggle({
			'showSelector' 	: '#ringtones_links .ringtone_type_links',
			'startHidden' 	: true,
			'oneAtATime' 	: true
		});
		
		// Turn a link into a popup link.
		$('.ringtone_type_links a').popupWindow({
			height	: 350,
			width	: 400,
			top		: 50,
			left	: 50
		});
		
		// Turn a link into a popup link.
		$('.brewery_details a').popupWindow({
			height	: 600,
			width	: 525,
			top		: 50,
			left	: 50,
			scrollbars : 1,
			resizable : 1
		});
		
		$('.bock_billboard a').colorbox({
			'transition': 'none',
			'cbox_open': function() {
				$('#cboxOverlay, #colorbox').addClass('yuengling_colorbox').addClass('bock_popup_colorbox');
			}
		});
		
		$('#quality_concern_link').colorbox({
			'transition': 'none',
			'iframe': true,
			'width': '850px',
			'height': '1100px',
			'href': '/quality_concern_form.php',
			'cbox_open': function() {
				$('#cboxOverlay, #colorbox').addClass('yuengling_colorbox').addClass('form_popup_colorbox');
			}
		});
		
		// Events that need to be postponed until all resources have been fully loaded.
		$(window).load(function() {
			// Sliding lists need postponed until window.load is triggered
			// so that all the images have finished loading and we can get their true dimensions.
			// $("#tv_spot_thumbs").slidingList(4);
			$("#tv_spot_thumbs").slidingList(3);
		});
		
	});
