		//PHOTO GALLERY
		var openFlag = 0;
		var currentPhoto = 0;
		var transFlag = 0;
		var transTimer;

		function openPhotos() {
			if (transFlag == 0 && openFlag == 0) {
				transFlag = 1;
				openFlag = 1;
				$("table.photo_box").eq(0).show(); $("#photos").fadeIn(500);
				transTimer = setTimeout(function() { transFlag = 0; }, 500);
			};
		};

		function closePhotos() {
			if (transFlag == 0) {
				transFlag = 1;
				$("#photos").fadeOut(500);
				transTimer = setTimeout(function() { $("table.photo_box").eq(currentPhoto).hide(); currentPhoto = 0; transFlag = 0; openFlag = 0; }, 500);
			};
		};

		function swapWithNext() {

			var nextPhotoNumber = 0;

			if (currentPhoto == $("#number_of_photos").html()) { nextPhotoNumber = 0; } else { nextPhotoNumber = currentPhoto + 1; };

			swapPhoto(nextPhotoNumber);
		};


		function swapWithPrev() {

			var nextPhotoNumber = 0;

			if (currentPhoto == 0) { nextPhotoNumber = $("#number_of_photos").html(); } else { nextPhotoNumber = currentPhoto - 1; };

			swapPhoto(nextPhotoNumber);
		};

		function swapPhoto(photoNumber) {

			if (transFlag == 0) {
				transFlag = 1;
				$("table.photo_box").eq(currentPhoto).fadeOut(200);

				$("table.photo_thumb").eq(currentPhoto).removeClass("thumb_active");

				var photoTimer = setTimeout(function() {
					$("table.photo_thumb").eq(photoNumber).addClass("thumb_active");
					$("table.photo_box").eq(photoNumber).fadeIn(300);
					currentPhoto = photoNumber;
					transTimer = setTimeout(function() { transFlag = 0; }, 300);

				}, 300);
			};
		};