window.addEvent('domready', function() {
	
	$$('.contact').each(function(item){
		item.addEvent('focus', function(){
			item.style.borderColor = '#666';
		});
		item.addEvent('blur', function(){
			item.style.borderColor = '#aaa';
		});
	});
	
	$$('.menuitem a').each(function(item) {
		//fx
		var menu_fx = new Fx.Morph(item,{
			duration: 200,
			link: 'cancel'
		});
	
		item.addEvents({
			'mouseenter': function(e) {
				e.stop();
				menu_fx.start({'background-position': '0 0', 'color': '#ffffff'});
				
			},
			'mouseleave': function(e) {
				e.stop();
				menu_fx.start({'background-position': '0 -25', 'color': '#232323'});
			}
		});
	});
	
	
	
	var currentCol = 0;
	var folioChange = new Fx.Tween('folio', {duration:600});
	var columns = $$('div.col');
	var max = columns.length;
	$('prev').addEvent('click', function(){
		$('next').style.backgroundImage = 'url(siteimages/next.png)';
		$('next').style.cursor = 'pointer';
		if (currentCol > 0) {
			currentCol -= 1;
			var x = (currentCol * -496);
			folioChange.start('left',x);
			if (currentCol <= 0) {
				$('prev').style.backgroundImage = 'none';
				$('prev').style.cursor = 'default';
			}
		}
	});
	$('prev').addEvent('mouseenter', function(){
		if (currentCol > 0) {
			$('prev').style.backgroundImage = 'url(siteimages/prev_over.png)';
		}
	});
	$('prev').addEvent('mouseleave', function(){
		if (currentCol > 0) {
			$('prev').style.backgroundImage = 'url(siteimages/prev.png)';
		}
		else{
			$('prev').style.backgroundImage = 'none';
			$('prev').style.cursor = 'default';
		}
	});
	
	$('next').style.backgroundImage = 'url(siteimages/next.png)';
	$('next').addEvent('click', function(){
		$('prev').style.backgroundImage = 'url(siteimages/prev.png)';
		$('prev').style.cursor = 'pointer';
		if (currentCol < columns.length - 1) {
			currentCol += 1;
			var x = (currentCol * -496);
			folioChange.start('left',x);
			if (currentCol >= columns.length - 1) {
				$('next').style.backgroundImage = 'none';
				$('next').style.cursor = 'default';
			}
		}
	});
	$('next').addEvent('mouseenter', function(){
		if (currentCol < columns.length - 1) {
			$('next').style.backgroundImage = 'url(siteimages/next_over.png)';
		}
	});
	$('next').addEvent('mouseleave', function(){
		if (currentCol < columns.length - 1) {
			$('next').style.backgroundImage = 'url(siteimages/next.png)';
		}
		else{
			$('next').style.backgroundImage = 'none';
			$('next').style.cursor = 'default';
		}
	});
		
});
