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

          $$('a[href^="http"]').each(function(a) {
            var href = a.get('href');
            if (!href.contains(window.location.host)) {
              a.setProperty('target', '_blank');
              a.addClass('external');
            }
          });

          
          var galleryEl = $$('.imagegallery li');
          
          if (galleryEl) {
	          galleryEl.each(function(el) { 
	        	  el.addEvents({
	        		    'mouseover': function(){
	        		       this.addClass('hover');
	        		    },
	        		    'mouseout': function(){
	        		    	this.removeClass('hover');
	        		    }
	        		    ,
	        		    'click': function() {
	        		    	
	        		    	var rel = this.getElement('a').get('rel');
	        		    
	        		    	milkbox.showGallery({ gallery:rel });
	        		    }
	        		});
	          });
          }
          
          SyntaxHighlighter.config.clipboardSwf = '${docroot}/syntaxhl/scripts/clipboard.swf';
          SyntaxHighlighter.all();
        });

