jQuery(document).ready(function() {
	$('#open-about').click(function () {
    	$('#about').slideDown();
    	$(this).hide();
    	$('#close-about').fadeIn();
	});
	$('#close-about').click(function () {
    	$('#about').slideUp();
    	$(this).hide();
    	$('#open-about').fadeIn();
	});
    $('.slideshow').cycle({ 
		fx:     'fade', 
		speed:  'slow',
		timeout: '5000',
		pager:  '#nav'
	});
	$("a[rel=other_images]").fancybox({
		'titleShow'		: false
	});
	$("#carousel").jcarousel();
	$('.zoom').fancybox({
		'titleShow': false,
		'hideOnOverlayClick': false,
		'scrolling': 'no',
		'transitionIn': 'none',
		'transitionOut': 'none',
		'overlayOpacity': '0.35',
		'overlayColor': '#000'
	});
    $('.projectimages').each(function() {
    	var $nav = $('<div class="navigation"></div>').insertAfter(this);
    	$(this).cycle({
    		fx: 'scrollHorz', 
		    speed: 'normal',
	        pager: $nav,
	        timeout: 0,
	        next: '.projectimages img'
    	});
    });
	$(".project").hover(function() {
		var thumbOver = $(this).find("img").attr("src");
		$(this).find("a.teaser").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		$(this).find("a.teaser span").stop().fadeTo('fast', 0 , function() {
			$(this).hide()
		});
	} , function() {
		$(this).find("a.teaser span").stop().fadeTo('fast', 1).show();
	});
	$(".column img").lazyload({
         placeholder : "images/grey.gif",
         effect      : "fadeIn",
         threshold   :"-50"
      });
	
	$('#cuwrapper li').each(function (i) {
		var imgpath = $(this).find('strong').text();
		$('<img>').attr('src', imgpath);
	});

	$('#cuwrapper li').css('opacity','0.6');
	var crnt = $('.link1').attr('class');
	$('.'+crnt).fadeTo(500, 1.0);
	
	$('#cuwrapper li').hover(
		function (){
			var tmpcrnt = $(this).attr('class');

			if(crnt!=tmpcrnt){
				crnt = $(this).attr('class');
				$('#cuwrapper li').fadeTo(150, 0.6);
				
				var newimgpath =$(this).find('strong').text();
				$(this).fadeTo(300, 1.0);
				
				$('#cuimage').attr('src', newimgpath).stop().hide().fadeTo(800, 1.0);
			}
		}
	);
});
