<!--

var image_path = "images/";

image_files = new Array();
image_files[1] = "image001";
image_files[2] = "image002";
image_files[3] = "image003";
image_files[4] = "image004";
image_files[5] = "image005";
image_files[6] = "image006";
image_files[7] = "image007";
image_files[8] = "image008";
image_files[9] = "image009";
image_files[10] = "image010";
image_files[11] = "image011";
image_files[12] = "image012";
image_files[13] = "image013";
image_files[14] = "image014";
image_files[15] = "image015";
image_files[16] = "image016";
image_files[17] = "image017";
image_files[18] = "image018";
image_files[19] = "image019";
image_files[20] = "image020";
image_files[21] = "image021";
image_files[22] = "image022";
image_files[23] = "image023";
image_files[24] = "image024";
image_files[25] = "image025";
image_files[26] = "image026";
image_files[27] = "image027";

image_captions = new Array();
image_captions[1] = "logo update, brochure, product design, Gebbie Press";
image_captions[2] = "ad campaigns, Center for Advanced Dentistry";
image_captions[3] = "posters, Trauma Survivors Network";
image_captions[4] = "annual report, Rivers &amp; Trails program, National Park Service";
image_captions[5] = "trail brochure, Hyde Park Trails";
image_captions[6] = "trail kiosks, Hyde Park Trails";
image_captions[7] = "logo, business card, Absolute Laser";
image_captions[8] = "Convocation Magazine, Bryn Mwar School, Baltimore";
image_captions[9] = "logo, Provisions, etc.";
image_captions[10] = "Flood Cleanup Field Guide, Enterprise Community Partners";
image_captions[11] = "book covers, Enterprise Community Partners";
image_captions[12] = "logo, Enterprise Community Partners";
image_captions[13] = "logo, Friends of Wyman Park Dell";
image_captions[14] = "covers, Baltimore Jewish Times";
image_captions[15] = "special publication, Baltimore Jewish Times";
image_captions[16] = "annual fund campaign, St. Paul's School, Baltimore";
image_captions[17] = "Watermark, Beacon Center for Rivers &amp; Estuaries";
image_captions[18] = "program brochure, Enterprise Community Partners";
image_captions[19] = "program brochure, Bridges, Baltimore";
image_captions[20] = "scholarship fund brochure, National Italian American Foundation";
image_captions[21] = "evite, National Center for Healthy Housing";
image_captions[22] = "logo update, National Disease Clusters Alliance";
image_captions[23] = "program brochure, Neighborhood Progress, Cleveland";
image_captions[24] = "logo, Neighborhood Earth Watch";
image_captions[25] = "logo, Pasta Mamas";
image_captions[26] = "program brochure/folder, Trauma Survivors Network";
image_captions[27] = "program brochure, Enterprise Housing Financial Services";

image_sizes = new Array();
image_sizes[1] = "800x612";
image_sizes[2] = "800x800";
image_sizes[3] = "1024x458";
image_sizes[4] = "1024x800";
image_sizes[5] = "1024x968";
image_sizes[6] = "1024x800";
image_sizes[7] = "550x588";
image_sizes[8] = "1024x500";
image_sizes[9] = "654x228";
image_sizes[10] = "847x1024";
image_sizes[11] = "885x1024";
image_sizes[12] = "600x304";
image_sizes[13] = "389x600";
image_sizes[14] = "870x1009";
image_sizes[15] = "857x995";
image_sizes[16] = "1024x800";
image_sizes[17] = "1024x1009";
image_sizes[18] = "1024x481";
image_sizes[19] = "1024x565";
image_sizes[20] = "1024x552";
image_sizes[21] = "600x987";
image_sizes[22] = "748x188";
image_sizes[23] = "1024x788";
image_sizes[24] = "700x200";
image_sizes[25] = "414x513";
image_sizes[26] = "1024x635";
image_sizes[27] = "1006x996";


function preloadimgs(start,total) {
	for (var ii=start; ii<(start+total); ii++) {
		if (ii > (image_files.length -1)) {
			pl = ii - (image_files.length -1);
		}
		else if (ii < 1) {
			pl = ii + (image_files.length -1);
		}
		else {
			pl = ii;
		}

		if (image_files[pl] && !window["img_" + pl]) {
			window['img_' + pl] = new Image(), eval('img_' + pl).src = image_path + image_files[pl] + "_md.jpg";
		}
	}
}

preloadimgs(-4,9);


var fade_duration = 1; // in seconds
var loop = true; // slideshow loops through beginning and end

var pic1div = "imgdiv1";
var pic2div = "imgdiv2";
var pic1divcap = "capdiv1";
var pic2divcap = "capdiv2";
var navback = "imgback";
var navfwd = "imgfwd";
var navtxt = "imgnavtext";
var zoombg = "zoombg";
var zoomdiv = "zoomshell";
var zoom100link = "resize100link";
var zoomfitlink = "resizefitlink";
var zoompic = "zoomimg";

var sscounter = 0;
var swappic1;
var swappic2;

function slideshow(change){
	if (swappic1 != null || swappic2 != null) {
		return;
	}

	if (change == "random") {
		var nextimg = Math.floor(image_files.length /* ~total images + 1~ */ * Math.random());
		preloadimgs((nextimg-3),7);
	}
	else {
		var nextimg = sscounter + change;
		/*if ((nextimg/5) == Math.ceil(nextimg/5)) { // nextimg is a multiple of 5
			preloadimgs((nextimg+6),5);
		}*/

		if ((nextimg/3) == Math.ceil(nextimg/3)) { // nextimg is a multiple of 3
			preloadimgs((nextimg-6),3);
			preloadimgs((nextimg+4),3);
		}
	}

	if (loop == true) {
		if (nextimg == 0) {
			nextimg = (image_files.length -1);
		}
		else if (nextimg == image_files.length) {
			nextimg = 1;
		}

		document.getElementById(navtxt).innerHTML = (nextimg < 10 ? "&nbsp;" : "") + nextimg + " of " + (image_files.length -1);
	}
	else {
		if (!image_files[nextimg]) {
			return;
		}
		else {
			document.getElementById(navtxt).innerHTML = nextimg + " of " + (image_files.length -1);

			if (!image_files[nextimg+1]) {
				document.getElementById(navfwd).className = "arrow disabled";
			}
			else {
				document.getElementById(navfwd).className = "arrow";
			}

			if (!image_files[nextimg-1]) {
				document.getElementById(navback).className = "arrow disabled";
			}
			else {
				document.getElementById(navback).className = "arrow";
			}
		}
	}

	var picdur = Math.round(fade_duration * 1000);
	swappic1 = setTimeout("changepic('" + nextimg + "')", 0);
	swappic2 = setTimeout("changepic()", (picdur * 1.1));
	clearswap = setTimeout("clearchangepic()", (picdur * 1.2));
	sscounter = nextimg;
}

function changepic(img) {
	pic1z = document.getElementById(pic1div).style.zIndex;
	pic2z = document.getElementById(pic2div).style.zIndex;
	if (pic1z > pic2z) {
		pictop = pic1div;
		picbot = pic2div;
		captop = pic1divcap;
		capbot = pic2divcap;
	}
	else {
		pictop = pic2div;
		picbot = pic1div;
		captop = pic2divcap;
		capbot = pic1divcap;
	}

	if (img) {
		document.getElementById(picbot).style.background = "url("+image_path+image_files[img]+"_md.jpg)";
		document.getElementById(picbot).style.backgroundRepeat = "no-repeat";
		document.getElementById(picbot).style.backgroundPosition = "center -20px";
		document.getElementById(capbot).innerHTML = image_captions[img];
		setopacity(picbot,100);
		fade(pictop,100,0);
	}
	else {
		document.getElementById(pic1div).style.zIndex = pic2z;
		document.getElementById(pic2div).style.zIndex = pic1z;
	}
}

function clearchangepic() {
	//clearTimeout(swappic1);
	//clearTimeout(swappic2);
	swappic1 = null;
	swappic2 = null;
}

function setopacity(thisdiv,percent,ignore) {
	thefadediv = document.getElementById(thisdiv);
	if (thefadediv) {
		thefadediv.style.opacity = (percent/101);
		thefadediv.style.MozOpacity = (percent/101);
		thefadediv.style.KhtmlOpacity = (percent/100);
		if (ignore != 'ignore_ie') thefadediv.style.filter = "alpha(opacity=" + percent + ")";
	}
}

function fade(thisdiv,start,end,dur,fps,ignore) {
	if (!fps) {
		fps = 15;
	}

	if (!ignore) {
		ignore = null;
	}

	if (!dur && fade_duration != null) {
		dur = fade_duration;
	}
	var fadesteps = (dur * fps);
	var fadestepdur = Math.round((dur * 1000) / fadesteps);

	fadeopac = start;
	if (start < end) {
		var opacstep = ((end - start) / fadesteps);
		for(i=0; i<=fadesteps; i++) {
			setTimeout("setopacity('" + thisdiv + "'," + fadeopac + ",'" + ignore + "')",(i * fadestepdur));
			fadeopac = (i==(fadesteps-1)) ? end : (fadeopac + opacstep);
		}
	}
	else if (start > end) {
		var opacstep = ((start - end) / fadesteps);
		for(i=0; i<=fadesteps; i++) {
			setTimeout("setopacity('" + thisdiv + "'," + fadeopac + ",'" + ignore + "')",(i * fadestepdur));
			fadeopac = (i==(fadesteps-1)) ? end : (fadeopac - opacstep);
		}
	}
}


function viewimg(action,size) {
	var thezoombg = document.getElementById(zoombg);
	var thezoomdiv = document.getElementById(zoomdiv);
	var thezoomimg = document.getElementById(zoompic);
	var thezoom100link = document.getElementById(zoom100link);
	var thezoomfitlink = document.getElementById(zoomfitlink);
	var picdur = Math.round(fade_duration * 1000);
	var thisimg = sscounter;

	if (!image_files[thisimg]) {
		return;
	}

	if (action == "open" || action == "resize") {
		var thissize = image_sizes[thisimg].split("x");
		var thezoomw = thissize[0];
		var thezoomh = thissize[1];
		var thisperc;

		var thiswinsize = window.winsize();

		if (size != null) {
			var displaysize = size;
			thezoomw = thezoomw * (eval(displaysize)/100);
			thezoomh = thezoomh * (eval(displaysize)/100);
		}
		else {
			if ((eval(thezoomw)+100) > thiswinsize.w) {
				thisperc = thezoomh/thezoomw;
				thezoomw = thiswinsize.w - 100;
				thezoomh = thezoomw * thisperc;
			}
			if ((eval(thezoomh)+100) > thiswinsize.h) {
				thisperc = thezoomw/thezoomh;
				thezoomh = thiswinsize.h - 100;
				thezoomw = thezoomh * thisperc;
			}

			if (eval(thezoomw) < thissize[0]) {
				var displaysize = Math.round((eval(thezoomw)/thissize[0]) * 100);
			}
			else {
				var displaysize = 100;
			}
		}

		thezoomimg.style.width = thezoomw + "px";
		thezoomimg.style.height = thezoomh + "px";
		thezoomimg.src = image_path+image_files[thisimg]+"_lg.jpg";

		thezoomh = eval(thezoomh) + 30;
		var thezoompos = window.wincenter({w:thezoomw,h:thezoomh});

		thezoomdiv.style.width = thezoomw + "px";
		thezoomdiv.style.height = thezoomh + "px";
		thezoomdiv.style.left = thezoompos.x + "px";
		thezoomdiv.style.top = thezoompos.y + "px";
		if (size != null) {
			if ((eval(thezoomw)+100) > thiswinsize.w) {
				thezoomdiv.style.left = "30px";
			}

			if ((eval(thezoomh)+100) > thiswinsize.h) {
				thezoomdiv.style.top = "30px";
			}
		}

/*		var thebgw = thiswinsize.w + 200;
		var thebgh = thiswinsize.h + 200;
		var thebgpos = window.wincenter({w:thebgw,h:thebgh});

		thezoombg.style.width = thebgw + "px";
		thezoombg.style.height = thebgh + "px";
		thezoombg.style.left = thebgpos.x + "px";
		thezoombg.style.top = thebgpos.y + "px";*/

		var thebgw = document.body.offsetWidth;
		if (thiswinsize.h > document.body.offsetHeight) {
			var thebgh = thiswinsize.h;
		}
		else {
			var thebgh = document.body.offsetHeight;
		}

		if ((eval(thezoomw)+100) > eval(thebgw)) {
			thebgw = (eval(thezoomw)+100);
		}

		if ((eval(thezoomh)+100) > eval(thebgh)) {
			thebgh = (eval(thezoomh)+100);
		}

		thebgh = eval(thebgh) * 1.01;

		thezoombg.style.width = thebgw + "px";
		thezoombg.style.height = thebgh + "px";

		thezoombg.style.display = "block";
		thezoomdiv.style.display = "block";

		if (thezoom100link && thezoomfitlink) {
			if (size == 100) {
				//thezoom100link.style.textDecoration = "underline";
				//thezoomfitlink.style.textDecoration = "none";
				thezoom100link.innerHTML = "<span class=\"selected\">100%</span>";
				thezoomfitlink.innerHTML = "<a href=\"javascript:viewimg('resize');\">fit to screen</a>";
			}
			else {
				//thezoom100link.style.textDecoration = "none";
				//thezoomfitlink.style.textDecoration = "underline";
				thezoom100link.innerHTML = "<a href=\"javascript:viewimg('resize',100);\">100%</a>";
				thezoomfitlink.innerHTML = "<span class=\"selected\">" + displaysize + "%</span>";
			}
		}

		if (action == "open") {
			zoomin1 = setTimeout("viewimg('in')", 0);
		}
		return;
	}
	else if (action == "close") {
		zoomout1 = setTimeout("viewimg('out')", 0);
		return;
	}
	else if (action == "in") {
		fade(zoombg,0,80,.2,30);
		zoomin2 = setTimeout("fade(zoomdiv,0,100)", (200 * 1.1));
		//fade(zoomdiv,0,100);
		return;
	}
	else if (action == "out") {
		//fade(zoombg,80,0);
		fade(zoomdiv,100,0,.2,30);
		zoomout2 = setTimeout("fade(zoombg,80,0,.2)", (200 * 1.1));
		//zoomout2 = setTimeout("fade(zoombg,80,0,.2)", 0);
		zoomout3 = setTimeout("viewimg()", (500 * 1.2));
		return;
	}
	else {
		thezoombg.style.display = "none";
		thezoomdiv.style.display = "none";
		setopacity(thezoombg,0);
		setopacity(thezoomdiv,0);
		thezoomimg.src = image_path+"blank.gif";
		return;
	}
}


window.winsize = function() {
	var winw = 0;
	var winh = 0;

	if (!window.innerWidth) { // IE

		if (!(document.documentElement.clientWidth == 0)) { // strict mode
			winw = document.documentElement.clientWidth;
			winh = document.documentElement.clientHeight;
		}
		
		else {// quirks mode
			winw = document.body.clientWidth;
			winh = document.body.clientHeight;
		}
	}
	else { // W3C
		winw = window.innerWidth;
		winh = window.innerHeight;
	}

	return {w:winw,h:winh};
}

window.wincenter = function() {
	var whdiff = (arguments[0] != null) ? arguments[0] : {w:0,h:0};
	var winx = 0;
	var winy = 0;
	var offsetx = 0;
	var offsety = 0;

	var thisw = this.winsize().w - whdiff.w;
	if (thisw == 0) thisw = eval(thisw) + .001;
	var thish = this.winsize().h - whdiff.h;
	if (thish == 0) thish = eval(thish) + .001;

	if(!window.pageYOffset) {// IE
		if (!(document.documentElement.scrollTop == 0)) { // strict mode
			offsetx = document.documentElement.scrollLeft;
			offsety = document.documentElement.scrollTop;
		}
		else { // quirks mode
			offsetx = document.body.scrollLeft;
			offsety = document.body.scrollTop;
		}
	}
	else { // W3C
		offsetx = window.pageXOffset;
		offsety = window.pageYOffset;
	}

	winx = (thisw / 2) + offsetx;
	winy = (thish / 2) + offsety;
	return {x:winx,y:winy};
}



function closeimg() {
	viewimg('close');
}


window.onload=function() {
	var initzoombg = document.getElementById(zoombg);
	
	if (initzoombg.addEventListener) {
		initzoombg.addEventListener("click", closeimg, true);
	}
	else if (initzoombg.attachEvent) {
		initzoombg.attachEvent("onclick", closeimg);
	}
}


// -->

