function preparePhotoDivs() {
	// Code for the Photos moving left and right
	var sizeSmall = 0;
	var sizeFull = 650;
	
	var links = $$(".photoLink")
	var photoGroups = $$(".photoGroup");
	var fx = new Fx.Elements(photoGroups, {wait: false, duration: 700, transition: Fx.Transitions.Quad.easeIn});
	links.each(function(lnk, i){
		lnk.addEvent("click", function(event) {
			var o = {};
			o[i] = {width: [photoGroups[i].getStyle("width").toInt(), sizeFull]};
			photoGroups.each(function(other, j) {
				if(i != j) {
					var w = other.getStyle("width").toInt();
					if(w != sizeSmall) {
						o[j] = {width: [w, sizeSmall]};
					}
				}
			});
			fx.start(o);
			lnk.className = "photoLink boy";
			links.each(function(other, j) {
				if(i != j) {
					other.className = "photoLink";
				}
			});
		});
	});
}

function preparePopups() {
	var popupBkgrd = document.createElement('DIV');
	popupBkgrd.id = "popupBkgrd";
	popupBkgrd.className = "popupBkgrd";
	popupBkgrd.style.height = getDocHeight();
	
	var popupImg = document.createElement("img");
	popupImg.src = "images/kacyn_headshot.jpg";
	popupImg.style.display = "none";
	
	var popup = document.createElement('div');
	popup.id = "popup";
	popup.className = "popup";
	popup.appendChild(popupImg);
	
	$('main').appendChild(popupBkgrd);
	$('main').appendChild(popup);
	
	var popups = [popup, popupBkgrd];
	var popupEffects = new Fx.Elements(popups, {wait: false, duration: 700, transition: Fx.Transitions.Quad.easeIn});
	
	var allPhotos = $$('.photoImg');
	
	
	allPhotos.each(function(img, i) {
		img.addEvent("click", function(event){
			popupImg.src = img.alt;

			popupImg.onload = function() {
				popup.style.zIndex = 1010;
				popupBkgrd.style.zIndex = 1000;
				popupImg.style.display = "";

				popup.style.top  = document.body.scrollTop + (document.body.clientHeight/2) - (popupImg.height/2);
				popup.style.left  = (document.body.clientWidth/2) - (popupImg.width/2);

				var o = {};
				o[0] = { opacity: 1 };
				o[1] = { opacity: 0.70 };

				popupEffects.start(o);
			}
		});
	});
	
	popup.addEvent("click", function(event) {
		var o = {};
		o[0] = { opacity: 0 };
		o[1] = { opacity: 0 };

		popupEffects.start(o);
		
		setTimeout(function() {
			popup.style.zIndex = -100;
			popupBkgrd.style.zIndex = -100;
			
		}, 800);
	});
}

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}