
	window.addEvent('domready', function()
		{
			
			$$('a.external').each(function(link){
				link.target = "_blank";
			});
			
			
			var galleries = $$('.gallery');
			var num_gals = galleries.length;
			
			if(num_gals > 0)
				{
					galleries.each(function(gal) {
					
						var gal_name = gal.get('id');
						var gal_items = gal.getElements('a');
						
						gal_items.each(function(gal_item){
						
							var gal_item_img = gal_item.getElement('img');
							var gal_item_img_title = gal_item_img.get('alt');
							
							if(gal_item_img_title.length > 0)
								{							
									gal_item.set('title',gal_item_img.get('alt'));
								}
								
							gal_item.set('rel','['+gal_name+']');
							gal_item.addClass('gmb');
						
						});
					
					});	
					
					
					// Init multibox
					
					var initMultiBox = new multiBox({
						mbClass: '.gmb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
						container: $(document.body),//where to inject multiBox
						path: './js/multibox/',//path to mp3 and flv players
						useOverlay: false,//use a semi-transparent background. default: false;
						maxSize: {w:600, h:400},//max dimensions (width,height) - set to null to disable resizing
						addDownload: false,//do you want the files to be downloadable?
						addRollover: false,//add rollover fade to each multibox link
						addOverlayIcon: false,//adds overlay icons to images within multibox links
						addChain: false,//cycle through all images fading them out then in
						recalcTop: true,//subtract the height of controls panel from top position
						addTips: false,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
						autoOpen: 0//to auto open a multiBox element on page load change to (1, 2, or 3 etc)
					});
					
							
				}
				
				
			// Get and count elements with .mb class name and init multibox if any found
			
			var mb_classes = $$('.mb');
			
			if(mb_classes.length > 0)
				{
					var defMultiBox = new multiBox({
						mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
						container: $(document.body),//where to inject multiBox
						path: './js/multibox/',//path to mp3 and flv players
						useOverlay: false,//use a semi-transparent background. default: false;
						addDownload: false,//do you want the files to be downloadable?
						addRollover: false,//add rollover fade to each multibox link
						addOverlayIcon: false,//adds overlay icons to images within multibox links
						addChain: false,//cycle through all images fading them out then in
						recalcTop: true,//subtract the height of controls panel from top position
						addTips: false,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
						autoOpen: 0//to auto open a multiBox element on page load change to (1, 2, or 3 etc)
					});
				}
			
			
		});
		
		
		
Element.Events.outerClick = { 
  base : 'click', 
  condition : function(event){ 
    event.stopPropagation(); 
    return false; 
  }, 
  onAdd : function(fn){ 
    this.getDocument().addEvent('click', fn); 
  }, 
  onRemove : function(fn){ 
    this.getDocument().removeEvent('click', fn); 
  } 
};
		
	

		

