
	function resizeCalendar()
	{
		var days = $('calendarBox').childElements().findAll(function(e){ if(e.hasClassName('break') || e.id=='daysOfTheWeek') return false; else return true;});

		var lastDayOffset    = 0;
		var currentWeek      = -1;
		var currentHeight    = 0;
		var currentMaxHeight = 0;
		var weekHeights      = new Array();

		days.each(function(day) {
			var dayOffset = day.viewportOffset();
			if(dayOffset[1] != lastDayOffset)
			{
				weekHeights[currentWeek] = currentMaxHeight;

				currentWeek++;
				currentMaxHeight = 0;
			}

			day.immediateDescendants().each(function(session) {
				currentHeight += session.getHeight();
			});
	
			if(currentHeight > currentMaxHeight)
				currentMaxHeight = currentHeight;
		
			lastDayOffset = dayOffset[1];
			currentHeight = 0;
		});

		if(typeof(weekHeights[currentWeek]) == 'undefined')
			weekHeights[currentWeek] = currentMaxHeight;

		// console.log(weekHeights);
		currentWeek = -1;
		var weekHeightForCSS = 0;

		days.each(function(day) {
			var dayOffset = day.viewportOffset();
			if(dayOffset[1] != lastDayOffset)
			{
				currentWeek++;
				weekHeightForCSS = (weekHeights[currentWeek]+35) + 'px';
			}

			if(weekHeights[currentWeek] > 70)
				day.style.height = weekHeightForCSS;

			lastDayOffset = dayOffset[1];
		});
	}


	

	
	var Store = Class.create();

	Store.prototype = {
		initialize: function() {
			this.thumbnailUrl = sslUrl + 'content/upload/images/tiny/';
			this.fullPhotoUrl = sslUrl + 'content/upload/images/thumbnail/';
		},
		
		addToCart: function(productId) {
			if($('productForm-' + productId))
				Form.checkAndSend('productForm-' + productId);
		},
		
		updatePrices: function() {
			// console.log('');
			var basePrice = parseFloat($F('basePrice'));
			$$('.groupContainer select').each(function(e){ 
				if(e.present())
				{
					basePrice += parseFloat($F('optionCostTranslator' + $F(e)));
				}
			});
			$('productPriceString').innerHTML = '$' + basePrice.toFixed(2);
		},

		checkout: function() {
			if($('checkoutForm'))
			{
				$('checkoutForm').insert({'bottom':'<input type="hidden" name="isCheckout" value="1" />'});
				$('checkoutForm').submit();
			}
				
		},
		
		updateCartQuantities: function() {
			if($('checkoutForm'))
			{
				// $('checkoutForm').action = sslUrl + 'store/update-cart-quantities/';
				$('checkoutForm').submit();
			}
		},
		
		showRegistrationForm: function() {
			if(!$('newUserRegistrationForm').visible())
				new Effect.BlindDown('newUserRegistrationForm', {duration:0.3});
		},
		
		alsoShippingAddressChange: function() {
			if(!$('differentShippingAddressContainer').visible())
				new Effect.BlindDown('differentShippingAddressContainer', {duration:0.3});
			else
				new Effect.BlindUp('differentShippingAddressContainer', {duration:0.3});
		},
		
		updateThumbnail: function(newImage) {
			$('productImage').src = this.fullPhotoUrl + newImage;
		},
		
		userRegistrationSubmit: function(ev) {
			Event.stop(ev);
			Form.checkAndSend('userRegistrationForm');
		}
	};

	var store = new Store();

