	var flag = 0;
	var basePath = "images/gallery/";
	
	var imagePath = basePath + projectPath;
	function switchImage(i,caption) {
		
	
		$('#project_image_box').css("background","url('images/gallery/gallery_loading.gif') no-repeat center center");
	
		$('.project_image_index_active').each(function() {
			var activeSrc = '';
			if ( $(this).attr('id') == "project_image_index_" + i ) {
			flag = 1;
			return;
			}
			
			activeSrc = $('.project_image_index_active img').attr("src");
			activeSrc = activeSrc.replace("_on","_off");
			$('.project_image_index_active img').attr("src",activeSrc);
			$(this).removeClass('project_image_index_active');
			$(this).addClass('project_image_index');
			
		});
		
		if(flag == 1) {
			flag = 0;
			return;
		}
		
		$('#project_image_index_' + i).addClass('project_image_index_active');
		activeSrc = $('#project_image_index_' + i + ' img').attr("src");
		activeSrc = activeSrc.replace("_off","_on");
		$('#project_image_index_' + i + ' img').attr("src",activeSrc);
		$('#project_image_index_' + i).removeClass('project_image_index');
		
		$("#project_image_file").fadeOut("slow",function() {loadImage(i,caption);});
		
	}
	
	function loadImage(i,caption) {
		$('.image_caption').html(caption);
		$('#project_image_file').attr("src",imagePath + i + ".jpg");
		document.getElementById('project_image_file').onload = function() {
			$("#project_image_file").fadeIn("slow");
		}	
	}


