window.addEvent('domready', function() {			

	var menuLinks = new MooFont({ 
		selector:'#nav a, #sideNav a',
		size:12,
		bgColor:"#F7F7F9"
	});
	
	var headings = new MooFont({ 
		selector:'h1, h2, h3, h4, h5, h6',
		bgColor:"#F7F7F9"
	});
	
	var topMenu = new MenuMatic({center:false , matchWidthMode:true, opacity:99});
	
	if(Browser.Engine.trident && Browser.Engine.version == 4 && !$('aside')){
		$('content').setStyle('width','90%');
	}
	
	if($('sideNav')){
		var sideMenu = new MenuMatic({id:'sideNav',orientation:'vertical',direction: {	x: 'left'}, opacity:99});
	}
	
	
	new SmoothScroll({ duration: 1800 });
	
	 var myElement = $(document.body);
	 if(getHash() && $(getHash())){
	 	var myFx = new Fx.Scroll(myElement).start(0, $(getHash()).getCoordinates().top);
	 }
	 
	 
	
	 
	
	
	insertHomePageFlash();
	
	$$('#map a, #map2 a').each(function(item,index){
		item.store('tip:title', item.get('html'));
		item.store('tip:text', item.get('title'));
	});
	
	var myTips = new Tips('#map2 a.blue',{
		className:'tipWrapper',
		fixed:true
	}).addEvent('show', function(tip, el){
	    tip.setStyle('opacity',0.95);
	});
	
	var myTips = new Tips('#map a.red',{
		className:'tipWrapper2',
		fixed:true
	}).addEvent('show', function(tip, el){
	    tip.setStyle('opacity',0.95);
	});
	
	$$('#mapNav a, #mapNav2 a').each(function(item,index){
		item.addEvents({
			'mouseenter':function(e){
				$('pin-'+item.get('id')).getParent('ul').getElements('a').setStyles({'opacity':0.3});
				$('pin-'+item.get('id')).setStyles({'opacity':1});
				$('pin-'+item.get('id')).fireEvent('mouseenter');
			},
			'mouseleave':function(e){
				$('pin-'+item.get('id')).getParent('ul').getElements('a').setStyles({'opacity':1});
				$('pin-'+item.get('id')).fireEvent('mouseleave');
			}
		})
	});
	
	$$('#map a, #map2 a').each(function(item,index){
		item.addEvents({
			'mouseenter':function(e){
				this.getParent('ul').getElements('a').setStyles({'opacity':0.3});
				this.setStyles({'opacity':1});
				$(item.get('id').replace(/pin-/, "")).focus();
			},
			'mouseleave':function(e){
				this.getParent('ul').getElements('a').setStyles({'opacity':1});
				$(item.get('id').replace(/pin-/, "")).blur();
			}
		})
	});
	
	
	
});	

function insertHomePageFlash(){
	if(Browser.Plugins.Flash.version <9 || !$('imageFade')){return;}
	var obj = new Swiff('flash/imagefade2.swf', {
	    id: 'homePageFlash',
		container:'imageFade',
	    width:380,
	    height:235,
	    params: {
	        wmode: 'transparent',
	        bgcolor: '#2C4470'
	    }
	
	});
}

function getHash() {
  var hash = window.location.hash;
  hash = hash.substring(1); 
  if(hash.length > 0){
  	return hash;
  }else{
  	return false;
  }
}
