var Site = 
{
  start: function()
  {
	  Site.initMenuEffects();
	  Site.initSidebarEffects();
	  Site.initSlideshow();
	  if ($$('gallery')) Site.initGallery();
	  
	  if ($('supressSiteMap')) $('sitemap').setStyle('display', 'none');
  },
	
  initMenuEffects: function()
  {
	  $$('#menu a').each(function(el, i)
	  {
	    if (el.className != 'menu-item-selected')
	    {
		    var fx = new Fx.Styles(el, {'duration': 200, 'wait': false});
        el.addEvent('mouseover', function(){ fx.start({ 'margin-top': 10 }) });
        el.addEvent('mouseout', function(){ fx.start({ 'margin-top': 0, 'opacity': 1.0 }) });
        el.addEvent('mousedown', function(){ fx.start({ 'opacity': 0.8}) });
        el.addEvent('mouseup', function(){ fx.start({ 'opacity': 1.0}) });
      }
    });
  },
  
  initGallery: function(){
    var items = $$("div.gallery .gallery-item");

    items.each(function(el, i) {
      var fx = new Fx.Styles(el, {'duration': 0, 'wait': false});
      
      el.setStyle('opacity', 0.9);
      
//      var a = el.getFirst()
//      new Element('div').injectAfter(a).setHTML(a.title);

	    el.addEvent("mouseenter", function(event) {
	      fx.start({ 'opacity': 1.0, 'border-color': '#06c' });
	    });

	    el.addEvent("mouseleave", function(event) {
	      fx.start({ 'opacity': 0.9, 'border-color': '#ccc' })
	    });

    });
  },  

  initSidebarEffects: function()
  {
	  $$('#sidebar a').each(function(el, i) 
	  {
		  var fx = new Fx.Styles(el, {'duration': 250, 'wait': false});
		  
		  if (el.className != 'gogallery')
		  {
		    if (el.className == 'hl1')
		    {
          el.addEvent('mouseover', function(){ fx.start({ 'padding-left': 18, 'color': '000000' }) });
          el.addEvent('mouseout', function(){ fx.start({ 'padding-left': 8, 'opacity': 1.0, 'color': 'ffffff' }) });
        }
        else if(el.getProperty('enabled') != 'false')
        {
          el.addEvent('mouseover', function(){ fx.start({ 'padding-left': 18, 'color': 'ff0000' }) });
          el.addEvent('mouseout', function(){ fx.start({ 'padding-left': 8, 'opacity': 1.0, 'color': 'ffffff' }) });
        }
        
        if(el.getProperty('enabled') != 'false')
        {
          el.addEvent('mousedown', function(){ fx.start({ 'opacity': 0.8 }) });
          el.addEvent('mouseup', function(){ fx.start({ 'opacity': 1.0}) });
        }
      }
    });
  },
  
  initSlideshow: function()
  {
    $$('div.slideshow').each(function(el, i)
    {
			new gallery(el, 
			{
				timed: true,
				showArrows: false,
				showInfopane: false,
				showCarousel: false,
				embedLinks: false,
				fadeDuration: 1500,
				slideInfoZoneOpacity: 0.9,
				delay: 6000
			});
		});
  }
  
};
	
window.addEvent('domready', Site.start);