	function calcParallax(tileheight, speedratio, scrollposition) {
			  return ((tileheight) - (Math.floor(scrollposition / speedratio) % (tileheight+1)));
			}
			jQuery(function() {				
				window.onscroll = function() {
					var posX = (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : window.pageXOffset;
					var posY = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : window.pageYOffset;				
					var clouds = document.getElementById('clouds');
					var cloudsparallax = calcParallax(500, .4, posY);
					clouds.style.backgroundPosition = "0 " + cloudsparallax + "px"; 
				}
				jQuery('.nav, .folio, .welcome, #baselinks').localScroll( {
					duration: 2000,					
					onBefore: function(e, anchor, jQuerytarget) {
					    jQuery('.outer').removeClass('important');
					},
					onAfter: function(e, anchor, jQuerytarget) {
					    jQuery(e).addClass('important');
					}
				} );									
				jQuery('.outer').each(function() {
					var wrapper = this.id;
					jQuery('.subnav', this).localScroll( {
						target: jQuery('.content', this), 
						duration: 1500,
						hash: false,
						axis: 'xy',
						queue: true,
						onBefore: function(e, anchor, jQuerytarget, jQuerywrapper){ 
							jQuery('.' + wrapper + 'scrolling').removeClass(wrapper + 'scrolling');
							jQuery(this).addClass(wrapper + 'scrolling');
							this.blur();
						}
					} );
					jQuery('li.sub p, li.sub li', this).localScroll( {
						target: jQuery('.content', this), 
						axis: 'xy',
						queue: true,
						hash: false,
						duration: 1500
					} );					
				} );				
				jQuery('ul.photography,ul.identity').hide();
				jQuery('a.web').click(function() {
					if (jQuery("ul.photography").is(":visible")) 
						jQuery("ul.photography").slideUp();
					if (jQuery("ul.identity").is(":visible")) 
						jQuery("ul.identity").slideUp();
					if (jQuery("ul.web").is(":hidden"))
						jQuery("ul.web").slideDown();
				} );
				jQuery('a.photography').click(function() {
					if (jQuery("ul.web").is(":visible")) 
						jQuery("ul.web").slideUp();
					if (jQuery("ul.identity").is(":visible")) 
						jQuery("ul.identity").slideUp();
					if (jQuery("ul.photography").is(":hidden"))
						jQuery("ul.photography").slideDown();
				} );
				jQuery('a.identity').click(function() {
					if (jQuery("ul.photography").is(":visible")) 
						jQuery("ul.photography").slideUp();
					if (jQuery("ul.web").is(":visible")) 
						jQuery("ul.web").slideUp();
					if (jQuery("ul.identity").is(":hidden"))
						jQuery("ul.identity").slideDown();
				} );				
				setupZoom();				
				jQuery('#foliothumbs').cycle();		
			} );	