// Written by Bryan Kwon. http://bryankwon.net
// Last modified on April 14th, 2009

$(function() {
				//-- project thumbnail fading --//	
	$('.project_thumb a').hover(function() {
		$(this).find('img').stop().animate({
			opacity: "0.3"
		}, 200);
		$(this).find('span').fadeIn(200);
	}, function() {
		$(this).find('img').stop().animate({
			opacity: "1"
		}, 200);
		$(this).find('span').fadeOut(200);
	});

				//-- IE fix - Hide the value of default submit button --//
	$('#searchform input#searchsubmit').attr('value','');
				
				//-- Image loader --//
	$('#buttonNav li:first').addClass('selected');
	var $theListTag = $('#buttonNav li');
	
	$theListTag.click(function() {
		
		var $theImage = $('#website_image img');
		var $imageName = $theImage.attr('src');
		var $numOfImages = $theListTag.size();
		var $newImgNum = $(this).text();
		
		$theListTag.each(function() {
			$(this).removeClass('selected');
		});
		
		$theImage.hide();
		$(this).addClass('selected');
		$theListTag.each(function() {
			if($(this).hasClass('selected')) {
					
				var $jpgValue = $imageName.slice(-4); // get the '.jpg'
				var $imagePath = $imageName.slice(0, $imageName.length - 5);
				var $newImage = $imagePath + $newImgNum + $jpgValue;	
				$theImage.attr('src', $newImage);	
			}
		});
		$theImage.fadeIn('slow');
	});	
	
});