window.addEvent('domready', function(){
	$$('#nav a').addClass('nohover');
	
	$$('div#news .title').each(function(title){
		title.setStyle('opacity', 0.8);
	});
	
	$$('#nav li').each(function(item){
		var fxn = new Fx.Style(item, 'background-color', {duration: 400, wait: false});
		item.addEvent('mouseenter', function(){
			if (!item.hasClass('active')) {
				fxn.start('#1E1E1E', '#3E3E3E');
			}
		}).addEvent('mouseleave', function(){
			if (!item.hasClass('active')) {
				fxn.start('#3E3E3E', '#1E1E1E');
			}
		});
	});
	
	$$('body#news .article', 'body#event .article', 'body#photos .album, body#event .event').each(function(article){
		var el = article.getElement('a');
		var fxa = new Fx.Style(el, 'color', {duration: 0, wait: false});
		var fxb = new Fx.Style(article, 'background-color', {duration: 800, wait: false});
		var fxc = new Fx.Style(article, 'border-color', {duration: 800, wait: false});
		article.setStyle('cursor', 'pointer').addEvent('mouseenter', function(){
			fxa.start('#CFCFCF', '#FCBC31');
			fxb.start('#0F0F0F', '#1E1E1E');
			fxc.start('#0F0F0F', '#595959');
		}).addEvent('mouseleave', function(){
			fxa.start('#FCBC31', '#CFCFCF');
			fxb.start('#1E1E1E', '#0F0F0F');
			fxc.start('#595959', '#0F0F0F');
		}).addEvent('click', function(){
			window.location = el;
		});
	});
	
	if ($('photostream')) {
		$('photostream').setStyle('overflow', 'hidden');
		$$('#photostream li').setStyle('display', 'list-item');
		$$('#photostream ul').setStyle('width', ($$('#photostream li').length * 85) + 'px');
		$$('.streamnav span').setStyle('cursor', 'pointer');
	
		var lis = $$('#photostream li');
		var lic = 0;
		var url = String(document.location).split('/');
		var scroll = new Fx.Scroll('photostream', {
			wait: false,
			duration: 400
		});
		if (url[8]) {
			if (url[8] > 4) { lic = (url[8] - 4); scroll.toElement(lis[lic]) }
		}
	
		$$('.streamnav .navleft').addEvent('click', function(event) {
			event = new Event(event).stop();
			if (lic -2 < 0) { lic = 0; }
			else { lic = lic -2; }
			scroll.toElement(lis[lic]);
		});
	
		$$('.streamnav .navright').addEvent('click', function(event) {
			event = new Event(event).stop();
			if (lic + 2 > lic.length) { lic = lic.length -1; }
			else { lic = lic +2; }
			scroll.toElement(lis[lic]);
		});
	}
});


