$(document).ready(function(){
	
		var preLoadImageSet = new Array();
	
		/*jQuery("img.thumb").each(function(){
				var tanchor = jQuery(this).parent();
				var imgHref = jQuery(this).attr("src").replace("img_s", "img_m");
				tanchor.attr("href", imgHref);
				});*/
		
		/*$("img.img_s").wrap(function(){
								var imgHref = $(this).attr("src").replace("img_s", "img_l");
								preLoadImageSet.push(imgHref);
								imgHref = $(this).attr("src").replace("img_s", "img_full");
							
								
								 return '<a href="'+imgHref+'" rel="lightbox" />';
										  });*/
		
		$('.portfolio .features img').each(function(){
			var imgHref = $(this).attr('src').replace('thumb', 'display');
			preLoadImageSet.push(imgHref);									
		});
		
		
	
		$('.portfolio .features img').click(function(){
		var newSrc = $(this).attr('src').replace('thumb', 'display');
		var newText = $(this).next().text();
		//alert(newText);
		var portfolio = $(this).parent().parent().parent();
		var display = portfolio.children('.display');
		var targetImg = display.children('img');
		var targetText = display.children('p');
		/*
		targetImg.attr('src', newSrc);
		targetText.html(newText);
		*/
		targetText.slideUp('fast', function(){
			targetImg.fadeOut('fast', function() {					  
				targetImg.attr('src', newSrc);
					 targetText.html(newText);
						targetImg.load(function(){
							targetImg.slideDown('fast', function() {
								targetText.slideDown('fast', function(){ });
							});
						});
				});
			});
		});
		//$('.img_s_set a').lightBox();
		
		
jQuery.preLoadImages(preLoadImageSet);

							
	});







