jQuery(function($){
	$(".leftImage").each(function(i) {///for home page
		id = $(this).attr('id');
		$(this).html('<img src="'+id+'" alt="alex" style="display:none;"/>');
			$(".leftImage img").load(function(){
				//$(".leftImage img").hide("fast");
				$(".leftImage img").delay(200).fadeIn(1000);
				
			});
	});
	$(".rightColumn").each(function(i) {///for contact page
		id = $(this).attr('id');
		$(this).html('<img src="'+id+'" alt="contact" style="display:none;" />');
			$(".rightColumn img").load(function(){
				//$(".leftImage img").hide("fast");
				$(".rightColumn img").delay(200).fadeIn(1000);
				
			});
	});
	var hover = false;
	$(".img_holder").each(function(i) {///for large thumbs
		id = $(this).attr('id');
		idAr = id.split(",");
		$(this).html('<img src="'+ idAr[0] +'" style="display:none;" class="ajaxLoad_'+ i +'" title="View '+ idAr[1] +'" width="172" height="114" />');
		$(".ajaxLoad_"+i+"").load(function () {
				$(".ajaxLoad_"+i+"").delay(200).fadeIn(1000);	
		});
		
		$(this).mouseover(function () {
			$(this).fadeTo(100,0.4).fadeTo(300,1);
			$(this).closest(".imageHolder").find(".thumbTitle a").css("color","#333333");
			
		});
		$(this).mouseout(function () {
			$(this).closest(".imageHolder").find(".thumbTitle a").css("color","#999999");
			
		});
		
	});
	
	$(".smallThumb").each(function(i) {///for small thumbs
			id = $(this).attr('id');
			$(this).html('<img src="'+ id +'" style="display:none;" class="ajaxLoad_'+ i +'" title="View this project" width="150" height="99" />');
			$(".ajaxLoad_"+i+"").load(function () {
					$(".ajaxLoad_"+i+"").delay(100).fadeIn(1000);
			});
			$(".ajaxLoad_"+i+"").mouseover(function () {
				$(".ajaxLoad_"+i+"").fadeTo(100,0.4).fadeTo(300,1);
			});
			if(i==12)
			return false;
	});
	
	$(".big_image").each(function(i) {///for large images 
			id = $(this).attr('id');
			idAr = id.split(",");
			$(this).html('<a href="#" class="featured_link" ></a><img alt="'+idAr[1]+'" src="'+idAr[0]+'" class="ajaxLoadBig_'+ i +'" style="display:none;z-index:10;"/><div class="png"></div>');
			$(".ajaxLoadBig_"+i+"").load(function () {
				if(i==0)
				{
					$(".ajaxLoadBig_"+i+"").fadeIn(1000);
				}
				else
				{
					$(".ajaxLoadBig_"+i+"").delay(200).fadeIn(1000);	
				}
			});
			if(i==9)
			return false;
	});
	$(".smallThumb").each(function(i) {///for small thumbs
		if(i>9)
		{
			id = $(this).attr('id');
			$(this).html('<img src="'+ id +'" style="display:none;" class="ajaxLoad_'+ i +'" title="View this project" width="150" height="99" />');
			$(".ajaxLoad_"+i+"").load(function () {
					$(".ajaxLoad_"+i+"").delay(100).fadeIn(1000);
			});
			$(".ajaxLoad_"+i+"").mouseover(function () {
				$(".ajaxLoad_"+i+"").fadeTo(100,0.4).fadeTo(300,1);
			});
		}
		
	});
	
	$(".big_image").each(function(i) {///for large images
		if(i>9)
		{
			id = $(this).attr('id');
			idAr = id.split(",");
			$(this).html('<a href="#" class="featured_link" ></a><img alt="'+idAr[1]+'" src="'+idAr[0]+'" class="ajaxLoadBig_'+ i +'" style="display:none; z-index:10;"/><div class="png"></div>');
			$(".ajaxLoadBig_"+i+"").load(function () {
					$(".ajaxLoadBig_"+i+"").delay(200).fadeIn(1000);	
			});
		}
		
		
	});
	
}); 
