<!--
window.action = {
		init: function() {
			this.opensign();
			this.initmenu();
			this.gallery();	
		},
		
		gallery_offset_bottom: function() {
			var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
			var toTop = 0;
			var obj = $('gallery');
			while(obj.nodeName.toLowerCase() != "body") {
				toTop += obj.offsetTop;
				obj = obj.offsetParent;
			}
			
			toBottom = toTop + $('gallery').offsetHeight - windowHeight;

			return (toBottom < toTop ) ? toBottom : false; // Don't scroll if window too small for gallery
		},
		
		gallery_onload: function(e) {
			//var gallery_obj = window.document.photo_gallery;
			var toBottomofGallery;
			if(toBottomofGallery = window.action.gallery_offset_bottom()) {
				//var toSubMenu = $$('div.submenu[class~=selected]')[0].offsetTop;
			
				// If small window, scroll to align with bottom of gallery
				var myFx = new Fx.Scroll(window).start(0, toBottomofGallery);
				// Otherwise scroll to the submenu if needed (if window is big enough, for whole page, this will have no effect)
				//var myFx = new Fx.Scroll(window).start(0, Math.max(toBottomofGallery, toSubMenu));
			}
		},
		
		gallery: function() {
			if($('gallery') && typeof(swfobject) != "undefined") {
//				swfobject.registerObject('photo_gallery', '7.0.0', null, this.gallery_onload); // Doesn't work in IE when here --> moved to gallery.php
			/*
				var gallery = new Swiff('/photo_gallery.swf', {
					id: 'photo_gallery',
					container: 'gallery',
					width: 750,
					height: 500,
					params: {
						wmode: 'transparent',
						bgcolor: '#ff3300'
					},
					vars: {
						album: album_id,
					}
				});
				*/
				/*
				var flashvars = {};
				flashvars.album = album_id;
				var params = {};
				params.menu = "false";
				params.wmode = "transparent";
				var attributes = {};
				attributes.id = "photo_gallery";
				swfobject.embedSWF("photo_gallery.swf", "gallery", "750", "500", "7.0.0", false, flashvars, params, attributes);
				*/
				//window.addEvent( 'load', function() {
					//window.document.photo_gallery.focus();	// Give gallery keyboard focus
				//	var myFx = new Fx.Scroll(window).toElement($$('div.submenu')[0]);
					//gallery
				//});
			}
		},
		
		opensign: function() {
		return;
			// Header Open/Closed Sign
			var openhours = [
				null,			// Sunday: 	Closed (Appt only)
				null,			// Monday: 	Closed (Appt only) 
				[1000, 1730], 	// Tues: 	10:00am - 5:30pm
				[1000, 1730], 	// Wed: 	10:00am - 5:30pm
				[1000, 1730], 	// Thurs: 	10:00am - 5:30pm
				[1000, 1730], 	// Fri: 	10:00am - 5:30pm
				[1000, 1600] 	// Sat: 	10:00am - 4:00pm
			]
			
			// Check to see if studio is open
			var now = new Date(now);
			var	time = (now.getHours() * 100) + now.getMinutes();
			var hourstoday = openhours[now.getDay()];
			if( hourstoday && time >= hourstoday[0] && time < hourstoday[1] ) {
				$('openlink').innerHTML = "We're OPEN! Call Us!";
			} else {	// Nope, closed
				/*
				$('opensign').setProperty('class', 'closed');
				$('openlink').innerHTML = "We're Closed. Leave a message?";
				// Can put more information here e.g. closed 34 minutes ago, not open today, open in 2 hours
				*/
			}
		},
		
		initmenu: function() {	// Drop Down Menu [categories > albums]
			$$('#menu div.submenu span.subsubmenu').each( function(item) {
				var parent = $(item.parentNode); // Fx adds parent div, which item.parentNode refers to below
				var fx = new Fx.Slide(item, {
					duration: 500,
					fps: 30,
					link: 'cancel',
					transition: Fx.Transitions.Sine.easeInOut
				}).hide();
				var fxDiv = $(item.parentNode);
				var timeout = null;
				var entertime = null;
				/*fxDiv.style.position = "absolute";*/
				item.style.position = "static"; // To allow slide in/out effect
				item.style.display = "block"; // otherwise slide out doesn't work (css instantly changes to hidden), also IE doesn't understand span:hover

				// For IE (can't figure it out on its own):
				fxDiv.style.width = item.offsetWidth;
				fxDiv.style.top = parent.offsetHeight;
				fxDiv.style.left = 0;
				
				parent.addEvents({
					'mouseenter': function() {
						if(timeout) {	// Mouse reentered before submenu closed
							$clear(timeout);	// Cancel delayed submenu close
						} else {
							entertime = new Date();
						}
						timeout = fx.slideIn.delay(150, fx);
					},
					
					'mouseleave': function() {
						if(timeout)
							$clear(timeout);	// Cancel opening menu if brushed by
						if((new Date() - entertime) < 400) {	// Short hover time, probably accidental (so close immediately)
							fx.slideOut.delay(100, fx);
						} else {
							timeout = fx.slideOut.delay(300, fx);	// Don't close the submenu right away
						}
					}
				});
			})
		}
	}

window.addEvent( 'domready', function() {
	window.action.init();

	
} );
-->
