// JavaScript Document

	var myMooFlowPage = {	
		
		start: function(){
			
				var mf = new MooFlow($('MooFlow'), {
					useSlider: true,
					useCaption: true,
					useMouseWheel: true,
					useKeyInput: true,
					useViewer: true,
					onClickView: function(obj){
						var img = new Element('img',{src:obj.src, title:obj.title, alt:obj.alt, styles:obj.coords}).setStyles({'position':'absolute','border':'none'});
						var link = new Element('a',{'class':'remooz-element','href':obj.href,'title':obj.title + ' - '+ obj.alt, styles:{'border':'none'}});
						document.body.appendChild(link.adopt(img));
						var remooz = new ReMooz(link, {
							centered: true,
							resizeFactor: 0.9,
							origin: link.getElement('img'),
							onCloseEnd: function(){link.destroy()}
						});
						remooz.open();
					}
				});

			}

		
	};


//function write_subnav(){
//	if($('gal_subnav')) {	
	
//	}
//}


var delayslide = function () {
this.toggle(); 	
}

var sliderThis = function(){
	var sliders = $$('.sl');
	var triggers = $$('.st');
 
/* sliders and triggers are arrays!! */
 
/* For each instance of .slide_trigger triggers[x] (note the anonymous function)*/ 
	triggers.each(function( o, x ){ 	
 
		var sl = new Fx.Slide( sliders[x], { } );	/* Instantiate a new slider effect on the matching .slide element */
 
			$(triggers[x]).addEvents({
			click : function(e){  /* Add a click event to the [x]th trigger */
								e = new Event(e);			  /* the event */
								sl.toggle();				  /* Toggle the slider condition */
								e.stop(); 				  /* Stop the event from bubbling */
			},
			mouseenter : function(a){ a.stop; this.setStyle('background-color', '#FFFFFF'); this.setStyle('color', '#000036');},
			mouseleave : function(a){ a.stop; this.setStyle('background-color', '#000035'); this.setStyle('color', '#FFFFFF');}
		});								  
		delayslide.delay(800, sl);		  /* Hide the slider */
	});	// end of triggers.each
 
}   // end of fnction
	
var navCool = function(){
	$$('.thumb').each(function(x){			  
		x.addEvents({

				mouseenter : function(a){
//					a.stop();
					this.set('morph', {duration: 'long'});
					this.morph({'background-color': '#FFFFFF',
							   'color' : '#000035'
							   });

				},
				mouseleave : function(a){ 
					this.set('morph', {duration: 'short'});
					this.morph({'background-color': '#000035',
   							   'color' : '#FFFFFF'
							   });
				}

		});
	});		
	
	$('mainnav').getElements('a').each(function(x){			  
		x.addEvents({

				mouseenter : function(a){
//					a.stop();
					this.set('morph', {duration: 'long'});
					this.morph({'background-color': '#FFFFFF',
							   'color' : '#000035'
							   });

				},
				mouseleave : function(a){ 
					this.set('morph', {duration: 'short'});
					this.morph({'background-color': '#000035',
   							   'color' : '#FFFFFF'
							   });
				}

		});
	});		
	
}


var remooziate = function(){
	ReMooz.assign('#galone a', {
		'origin': 'img',
		'shadow': 'fx', // fx is faster because shadow appears after resize animation
		'resizeFactor': 0.9, // resize to maximum 80% of screen size
		'cutOut': false, // don't hide the original
		'opacityResize': 0.4, // opaque resize
		'dragging': true, // disable dragging
		'centered': true // resize to center of the screen, not relative to the source element
	});

 
}
	
window.addEvent('domready',function(){
//mooflow
	
	if ($('MooFlow')) myMooFlowPage.start();
	
	sliderThis();	
	navCool();
	remooziate();
	
	
});

