

window.addEvent('domready', function() { 

var Tips1 = new Tips($$('.rollover') , {
	
 
    initialize: function() { this.tip.fade('hide'); },
    onShow: function(tip) { tip.fade('in'); tip.fade(0.85); },
    onHide: function(tip) { tip.fade('out'); }
});

});



//Javascript image gallery

window.addEvent('domready', function() {

        // Check if image nav exists before trying to set it up...
        if(!$$('.imageNav')[0]) return;
		
		var pos = 0;
		var offset = 462;	// HOW MUCH TO SLIDE WITH EACH CLICK
		var currentslide = 1;	// CURRENT SLIDE IS THE FIRST SLIDE
		var inspector = $('fullimg');	// large image holder
		var fx = new Fx.Morph(inspector, {duration: 300, transition: Fx.Transitions.Sine.easeOut}).set({
			
		});
 		var fx2 = new Fx.Morph(inspector, {duration: 200, transition: Fx.Transitions.Sine.easeOut}).set({
		
		});

		
		/* WHEN AN ITEM IS CLICKED, IT INSERTS THE IMAGE INTO THE FULL VIEW DIV */
		$$('.item').each(function(item){ 
			item.addEvent('click', function(e) { 
				e = new Event(e).stop();
				fx2.start({ 
					'opacity' : 0									
				}).chain(function(){
					
					inspector.empty();		// Empty Stage
					
					var loadimg = '/x/img/static/ajax-loader.gif';	   // Reference to load gif
					var load = new Element('img', { 'src': loadimg, 'class': 'loading' }).inject(inspector); 
					fx2.start({ 'opacity' : 1 });
					var largeImage = new Element('img', { 'src': item.href }); // create large image
					
					/* When the large image is loaded, fade out, fade in with new image */
					//largeImage.onload = function(){  // While this line of code causes the images to load/transition in smoothly, it cause IE to stop working
						fx.start({ 
							'opacity' : 0													
						}).chain(function(){
							inspector.empty();	
							   // empty stage
							var description = item.getElement('span');	// see if there is a description
							
							if(description)					   
								var des = new Element('p').set('text', description.get('text')).inject(inspector);
									
							largeImage.inject(inspector); // insert new image
							
							fx.start({'opacity': 1});	 // then bring opacity of elements back to visible				
						});
					//};
					
				});
			});
		});

		// Use first image
        inspector.empty();
		
		
		var description = $('number00').getElement('span');
		if(description) 				   
				var des = new Element('p').set('text', description.get('text')).inject(inspector);
		var largeImage = new Element('img', {'src': $('number00').href}).inject(inspector);
	
});