/* MAIN NAV ROLLOVERS */
	if (document.images) 
	{            
	<!-- wax on -->
	img01on = new Image();   img01on.src = "images/l_people_on.gif";
	img02on = new Image();   img02on.src = "images/l_personal_on.gif";
	img03on = new Image();   img03on.src = "images/l_places_on.gif";
	img04on = new Image();   img04on.src = "images/l_portraits_on.gif";
	img05on = new Image();   img05on.src = "images/l_stillife_on.gif";
	
	img06on = new Image();   img06on.src = "images/l_advertising_on.gif";
	img07on = new Image();   img07on.src = "images/l_editorial_on.gif";
	img08on = new Image();   img08on.src = "images/l_stillife_on.gif";
	img19on = new Image();   img19on.src = "images/l_fashion_on.gif";
	
	img09on = new Image();   img09on.src = "images/l_people_on.gif";
	img10on = new Image();   img10on.src = "images/l_personal_on.gif";
	img11on = new Image();   img11on.src = "images/l_places_on.gif";
	img12on = new Image();   img12on.src = "images/l_fashion_on.gif";
	img13on = new Image();   img13on.src = "images/l_stillife_on.gif";
	img18on = new Image();   img18on.src = "images/l_interiors_on.gif";
	
	img14on = new Image();   img14on.src = "../images/s_josh_on.gif";
	img15on = new Image();   img15on.src = "../images/s_ben_on.gif";
	img16on = new Image();   img16on.src = "../images/s_karen_on.gif";
	img17on = new Image();   img17on.src = "../images/s_about_on.gif";
	 
	 <!-- wax off -->
	img01off = new Image();   img01off.src = "images/l_people_off.gif";
	img02off = new Image();   img02off.src = "images/l_personal_off.gif";
	img03off = new Image();   img03off.src = "images/l_places_off.gif";
	img04off = new Image();   img04off.src = "images/l_portraits_off.gif";
	img05off = new Image();   img05off.src = "images/l_stillife_off.gif";
	
	img06off = new Image();   img06off.src = "images/l_advertising_off.gif";
	img07off = new Image();   img07off.src = "images/l_editorial_off.gif";
	img08off = new Image();   img08off.src = "images/l_stillife_off.gif";
	img19off = new Image();   img19off.src = "images/l_fashion_off.gif";	
	
	img09off = new Image();   img09off.src = "images/l_people_off.gif";
	img10off = new Image();   img10off.src = "images/l_personal_off.gif";
	img11off = new Image();   img11off.src = "images/l_places_off.gif";
	img12off = new Image();   img12off.src = "images/l_fashion_off.gif";
	img13off = new Image();   img13off.src = "images/l_stillife_off.gif";
	img18off = new Image();   img18off.src = "images/l_interiors_off.gif";
	
	img14off = new Image();   img14off.src = "../images/s_josh_off.gif";
	img15off = new Image();   img15off.src = "../images/s_ben_off.gif";
	img16off = new Image();   img16off.src = "../images/s_karen_off.gif";
	img17off = new Image();   img17off.src = "../images/s_about_off.gif";
	}
	
	function imgOn(sImgName)
	{
	   if (document.images) 
	   {
	   document[sImgName].src = eval(sImgName + "on.src");       
	   }
	}
	
	function imgOff(sImgName)
	{
	   if (document.images) 
	   {
	   document[sImgName].src = eval(sImgName + "off.src");        
	   }
	}
/* MAIN NAV ROLLOVERS */

/* RANDOM IMAGES */

NumberOfImagesToRotate = 58;
FirstPart = '<img src="images/home/ph_home_';
LastPart = '.jpg" width="983" height="331" border="0">';

function printImage() {
var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
document.write(FirstPart + r + LastPart);
}

/*SCROLLER*/
new Asset.images([
		'../images/menu-tab-l.gif',
		'../images/menu-tab-r.gif',
		'../images/scroll-left.gif',
		'../images/scroll-right.gif',
		'../images/scrollBar.gif',
		'../images/scrollButton-l.gif',
		'../images/scrollButton-r.gif',
		'../images/menu-button-close.gif',
		'../images/menu-button-open.gif'
 ]);
	

var Site = { // Site
	
	Init: function() { 
	
			// preload interface graphics

		if($('scroller'))	{ 
			Site.mscroll();  
			Site.menuFadeInit();
			}
			
		if($('main-menu'))	Site.menuFx();
		if($('site-menu'))	Site.siteMenuFx();
		if($('sub-menu'))	Site.subMenuFx();
		
		// smooth scrolling to anchors '#'
		new SmoothScroll({transition: Fx.Transitions.quadOut,fps: 60,duration: 1200});


},
	
	
	subMenuFx: function() {
		
		$$('#sub-menu li').each(function(el){
										 
		if (el.getProperty('class') !== 'current') {
	
		var overfxs = new Fx.Style(el, 'opacity', {'duration': 260, 'wait': false});
		
		overfxs.set(0.67);
		
		// safari has a opacity flicker bug. using opacity of .99 rather than 1.0 avoids the bug
		// see: http://www.quirksmode.org/bugreports/archives/2007/03/Webkit_hover_opacity_bug.html
		// tested: 7.11.07 safari winXP 3.03 - fix still required
		var onOpacity = 1;
		if (window.webkit) {onOpacity = 0.99;}
		
		el.addEvent('mouseenter', function(){
				
				overfxs.start(onOpacity);
				
		});
		
		el.addEvent('mouseleave', function(){								   
				
				overfxs.start(0.67);
				
			});
		}
	});
		
},
	
	//site menu at top right of window hover fx
	siteMenuFx: function() {
	
		$$('#site-menu a').each(function(el) { 
										 
		el.addEvent('mouseenter',function(){
										  
			el.effect('marginRight', {duration: 100,transition: Fx.Transitions.Sine.easeIn, wait: false}).start(5);
			
		})
		
		el.addEvent('mouseleave',function(){
										  
			el.effect('marginRight', {duration: 300,transition: Fx.Transitions.Sine.easeOut, wait: false}).start(0);
			
			});
		
		});
		
		
		var buttonLink = $ES('p.button-link');
		
		buttonLink.each(function(el) {
								 
		var buttonLinkFx = new Fx.Styles(el, {duration: 220,transition: Fx.Transitions.Sine.easeOut});
		
		el.setStyle('opacity',0.78);
		
		var onOpacity = 1;
		if (window.webkit) {onOpacity = 0.99;}
		
		el.addEvent('mouseenter', function(){
			
				buttonLinkFx.start({	 
								 'opacity': onOpacity
								 });
			
			})
			
		el.addEvent('mouseleave', function(){
			
				buttonLinkFx.start({
								 'opacity': 0.78
								 });
			
			})
		
		})
},
	 
	 
	 // for portfolio pages, init the menu fade function
	menuFadeInit: function(){
		
		
		// menu fade fx
		menuFader = new Fx.Style($('main-menu'), 'opacity', {duration: 490,transition: Fx.Transitions.Sine.easeIn, onComplete: 
								  
								  function(){
									  
									   menuSwitch.setText(newHTML);
									   menuLinkAnchor.toggleClass('close')
									   
									   }
								});
	// set menu opacity 0 to start
		menuFader.set(0);
		
	
	// toggle the menu on click
		menuLinkAnchor.addEvent('click', function(e){
												  
				e = new Event(e).stop();	
			//	e = new Event(e);
				Site.menuFadeToggle();
			//	e.stop();											
			});
		
	// grab the scrollbar
		var scrollVar = $$('#scrollKnobContainer','#scrollBar');
	
	// scrollbar fade fx
		menuFx = new Fx.Elements(scrollVar,{duration: 500, transition: Fx.Transitions.sineOut});
	
		
},
	
	
	// do the menu fade in / out
	menuFadeToggle: function() {
		
		newHTML = menuSwitch.innerHTML == 'Open' ? 'Close' : 'Open';
	
		
		if ($('main-menu').getStyle('opacity') >= 0.85) {
				
				
				menuFader.start(0).chain(function(){
					$$('div.videoContent').setStyle('display', 'inline');
												  });
				menuFx.start({
							 
								 '0': {'opacity': 1},
								 '1': {'opacity': 1}
								 
							 });
				} else {

				$('main-menu').setStyle('display','block');
				$$('div.videoContent').setStyle('display', 'none');
				menuFader.start(0.85);
				menuFx.start({
							 
								 '0': {'opacity': 0},
								 '1': {'opacity': 0}
								 
							 });
				}	
},
	 
	// main menu hover fx
	menuFx: function() {
	
			$$('#main-menu li a').each(function(el) { 
				
			var hoverFx = new Fx.Styles(el, {duration: 100, transition: Fx.Transitions.Sine.easeOut, fps: 60, wait: false});
		 
			el.addEvents({
						 
				'mouseenter': function(){
					
					hoverFx.start({'paddingLeft': '6px','color': '#fff'})
					
			},
			
			'mouseleave': function(){
				
					hoverFx.start({'paddingLeft': '0px','color': '#ccc'})
			
			}
			
			});
		});
	
},
	
	
	// fx for portfolio pages
	mscroll: function() {
		
			// init scroller
			MooScroll = new MooScroller('scroller', 'scrollKnob', { mode: 'horizontal', scrollSteps: 6 });
			
			// run mooscroll method: update(), when window resizes
			window.addEvent('resize',function(){MooScroll.update();});
					
			// scroller opacity fx on hover
			if ($('scrollBar')) {
				
			var skc = $('scrollKnobContainer');
			
			skc.setStyle('opacity',0.7).setStyle('background','url(../images/scrollBar.gif) 0 0 no-repeat');
			
			var scrollFadeIn = new Fx.Style(skc, 'opacity', {duration: 150, transition: Fx.Transitions.sineIn});
			var scrollFadeOut = new Fx.Style(skc, 'opacity', {duration: 750, transition: Fx.Transitions.sineOut});
			
			skc.addEvents({
						  
					'mouseenter': function(){
						
						scrollFadeOut.stop();
						scrollFadeIn.start(1)
						
						},
						
					'mouseleave': function(){
						
						scrollFadeIn.stop();
						scrollFadeOut.start(0.7)
						
						}
			});
			};
			
			
			// main menu link for portfolio pages
			if ($('menuLink')) {
			
			menuLinkAnchor = $E('a', 'menuLink');
			menuSwitch = $E('span', 'menuLink');
			var menuTrigger = new Fx.Styles(menuLinkAnchor, {duration: 200, transition: Fx.Transitions.sineOut});
			
			menuLinkAnchor.setStyle('opacity',0.75);
				
				$('menuLink').addEvents({
										 
					'mouseenter': function(){
						
						menuTrigger.start({'height': 23, 'paddingTop': 7,'opacity': 1});
						
						},
						
					'mouseleave': function(){
						
						menuTrigger.start({'height': 23, 'paddingTop': 4,'opacity': 0.75});
						
						}
	
				});
			};
				
	} //  mscroll
							
}; 


// Init Site...

window.addEvent('domready', Site.Init);