		$(document).ready(function(){
			$(".nav")
			.superfish({
				animation : { opacity:"show",height:"show"}
			});

			$(".bottom").removeClass("bottom").addClass("bottom_fixed");

			$('#gallery a').lightBox();

			initImageSwapr();




		});



function initImageSwapr() {

// 	alert('test');

	if(!document.getElementById('picSwap'))
		return;

	el = document.getElementById('picSwap');
	preLoadImgs();

			$('.preload').bind('click', function() {
				var tmp_txt = this.id.split("_");
				var txt = document.getElementById('text_'+tmp_txt[1]).innerHTML;
// 				alert(tmp_txt[1]);
				var tmp = this.src.split("_thumb.jpg");
// 				$("#picSwap").hide();
				el.src = tmp[0]+'_mid.jpg';
// 				$("#picSwap").show();
				$("#picSwap").fadeTo(0, 0).fadeTo("slow", 1);
				$("#textSwap").fadeTo(0, 0);
				document.getElementById('textSwap').innerHTML = txt;
				$("#textSwap").fadeTo("slow", 1);
				window.location.hash = "#breadcrumb";
				return false;
			});

}


function preLoadImgs() {


	if (!document.getElementsByTagName){ return; }
	var imgs = document.getElementsByTagName("img");

	// loop through all img tags
	for (var i=0; i<imgs.length; i++){
		var img = imgs[i];

// 		if (allElements[i].className.indexOf('thumbnail') !=-1)
		if (img.className.indexOf('preload') != -1){
			var tmp = img.src.split("_thumb.jpg");
			var midPic = tmp[0]+'_mid.jpg';
			$.preloadImages(midPic);
		}



	}

}


		jQuery.preloadImages = function() {
			for(var i = 0; i<arguments.length; i++) {
				jQuery("<img>").attr("src", arguments[i]);
			}
		}