function init( picID, imageIndex ) {
	// document.images[0] is transpix.gif in #title div
	var s = imageIndex || 1;
	document.images[s].className="selected";

	if( picID ) {
		setDisplay( picID );
	}
}

function setTitle( title ) {
	document.title = "Studio Nine Photography of Boston: " + title;
}

function setDisplay( picID ) {
	//var area = document.getElementById("display");
	//area.style.visibility = "hidden";

	var newPicLink = "assets/" + picID + ".jpg";
	var pic   = document.getElementById("dsp");
	var prevID = pic.src.replace(/.*assets\/(\S\S_\d\d)\.jpg/, "$1");
	if( prevID != picID ) {
		pic.src = newPicLink;
	}

    var dsp   = document.getElementById("dsp");
    var cap   = document.getElementById("cap");
    var info  = document.getElementById("info");
    var who   = document.getElementById("who");
    //var tags  = document.getElementById("tags");
    var ecard = document.getElementById("ecard-link");

    if( ecard !== null) {
        var tmp = window.location.href.match(/gallery-([^-]*)/);

//        var pg  = ( tmp===null ? "avnw1" : (tmp[1]=="id" ? "ir" : tmp[1]) );

        var pg  = ( tmp===null ? "avnw1" : (tmp[1]=="id" ? "ir" : (tmp[1]=="id2" ? "ir2" : tmp[1])) );
        var newLink = "ecard.php?pu=" + picID + "|" + pg;
        var tmp = ecard.innerHTML.replace(/ecard.php[^"]*\"/, newLink+'"');
        ecard.innerHTML = tmp;
    }

    dsp.setAttribute("alt",$pics[picID]["title"]);
    cap.innerHTML  = $pics[picID]["title"];
    info.innerHTML = $pics[picID]["info"];
    who.innerHTML  = "by " + $pics[picID]["who"];
    //tags.innerHTML = "keywords: " + $pics[picID]["tags"];

	//area.style.visibility = "visible";
}

function thumbnailPush( newID ) {
	var pic    = document.getElementById("dsp");
	var prevID = pic.src.replace(/.*assets\/(\S\S\_\d\d)\.jpg/, "$1");

	if( newID != prevID ) { 
		/* replace the picture & caption */
		setDisplay( newID );

		/* update thumbnail style */
		var selectedNew = document.getElementById( newID );
		selectedNew.className="selected";
		var selectedPrev = document.getElementById( prevID );
		selectedPrev.className="unselected";
	}
}
/*

function popUpExternal( link ) {
	window.open( link, 'offStudio9', 'scrollbars=yes,resizable=yes,menubar=yes,location=yes,width=500,height=400' );
}

function popUpAdditional( link, height, width ) {
	var h = height || 400;
	var w = width  || 800;
	window.open( link, 'additionalOffStudio9', 'scrollbars=yes,resizable=yes,toolbar=yes,location=yes,width=' + w + ',height=' + h );
}
*/
function popUpAdditional( link, height, width ) {
	var h = height || 400;
	var w = width  || 500;
	window.open( link, 'AdditionalOffStudio9', 'scrollbars=yes,resizable=yes,width=' + w + ',height=' + h );
}

function popUpExternal( link, height, width ) {
	var h = height || 400;
	var w = width  || 800;
	window.open( link, 'offStudio9', 'scrollbars=yes,resizable=yes,toolbar=yes,location=yes,width=' + w + ',height=' + h );
}

function popUpPic( file ) {
	window.open( file, 'Studio9pic', 'scrollbars=yes,resizable=yes,width=500,height=500');
}


var $pics = {

	"eu_01":{"title":"A Medieval street in Brittany","info":"Dinan, France","who":"Asako Severn","tags":"Black&amp;White"},
	"eu_02":{"title":"Red Chairs [P]","info":"Madrid, Spain","who":"Asako Severn","tags":"Color"},
	"eu_03":{"title":"Museo de Santa Cruz Courtyard","info":"Toledo, Spain","who":"Asako Severn","tags":"Color"},
	"eu_04":{"title":"Mercat de la Boqueria","info":"Barcelona, Spain","who":"Asako Severn","tags":"Color"},
	"eu_05":{"title":"On the beach","info":"Brighton, England","who":"Asako Severn","tags":"Color"},
	"eu_06":{"title":"The Royal Observatory Clock [SQ]","info":"Greenwich, England","who":"Asako Severn","tags":"Color"},
	"eu_07":{"title":"The Astronomical Clock [SQ]","info":"Praha, Czech Republic","who":"Asako Severn","tags":"Color"},
	"eu_08":{"title":"Tree Grill","info":"Praha, Czech Republic","who":"Asako Severn","tags":"Color"},

	"ir_01":{"title":"Irish Cross with Cobweb","info":"County Galway, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_02":{"title":"Church Yard Sunset","info":"Doolin, County Clare, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_03":{"title":"End of Rainbow","info":"Doolin, County Clare, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_04":{"title":"Lough Corrib [P]","info":"near Clonbur, County Galway, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_05":{"title":"Grazing Sheep [P]","info":"Achill Island, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_06":{"title":"Sheep in Road","info":"County Mayo, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_07":{"title":"Dark Sea off Cliffs of Moher","info":"County Clare, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_08":{"title":"Sky after the Storm","info":"off Cliffs of Moher, County Clare, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_09":{"title":"Poulnabrone Dolmen","info":"County Clare, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_10":{"title":"A Red Row Boat on Lough Corrib","info":"County Galway, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_11":{"title":"Carpe Diem","info":"Kilkenny, Ireland","who":"Asako Severn","tags":"Color"},
	"ir_12":{"title":"Sheep in Donegal [P]","info":"County Donegal, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_13":{"title":"Round Tower [P]","info":"Kilmacduagh, County Clare, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_14":{"title":"Cliffs of Moher","info":"County Clare, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_15":{"title":"Sunday Morning Stroll","info":"Achill Island, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_16":{"title":"Dingle traffic","info":"County Kerry, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_17":{"title":"Mount Brandon","info":"County Kerry, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_18":{"title":"O'Flaherty's","info":"Dingle, County Kerry, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_19":{"title":"Angel","info":"St.Canice's Cathedral, Kilkenny, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_20":{"title":"Graveyard","info":"Achill Island, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_21":{"title":"A Cottage near Roundstone","info":"County Galway, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_22":{"title":"Dingle Sheep","info":"County Kerry, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_23":{"title":"Christ on a Stone","info":"County Galway, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_24":{"title":"Cross on a Stone","info":"County Sligo, Ireland","who":"Kevin Brown","tags":"Color"},
	"ir_25":{"title":"Cross on Lahinch Coast","info":"County Clare, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"ir_26":{"title":"Irish Cross","info":"County Clare, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},

	"id_01":{"title":"Ha'penny Bridge","info":"Dublin, Ireland","who":"Kevin Brown","tags":"Black&amp;White;NightPhotos"},
	"id_02":{"title":"Merchants Arch","info":"Dublin, Ireland","who":"Kevin Brown","tags":"Black&amp;White;NightPhotos"},
	"id_03":{"title":"An Alley in Temple Bar","info":"Dublin, Ireland","who":"Kevin Brown","tags":"Black&amp;White;NightPhotos"},
	"id_04":{"title":"Kilmainham Gaol","info":"Dublin, Ireland","who":"Asako Severn","tags":"Color"},
	"id_05":{"title":"Four Courts [W]","info":"Dublin, Ireland","who":"Kevin Brown","tags":"Black&amp;White;NightPhotos"},
	"id_06":{"title":"St.Patrick's Cathedral","info":"Dublin, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"id_07":{"title":"Christ Church Cathedral","info":"Dublin, Ireland","who":"Asako Severn","tags":"Black&amp;White;NightPhotos"},
	"id_08":{"title":"Warped Wheels","info":"Temple Bar, Dublin, Ireland","who":"Kevin Brown","tags":"Black&amp;White"},
	"id_09":{"title":"The Palace Bar","info":"Dublin, Ireland","who":"Asako Severn","tags":"Color"},
	"id_10":{"title":"Guiness at The Long Hall","info":"Dublin, Ireland","who":"Asako Severn","tags":"Color"},
	"id_11":{"title":"The Temple Bar","info":"Dublin, Ireland","who":"Kevin Brown","tags":"Color"},
	"id_12":{"title":"O'Neill's","info":"Dublin, Ireland","who":"Kevin Brown","tags":"Color"},
	"id_13":{"title":"Pegions over a Bank Entrance","info":"Dublin, Ireland","who":"Asako Severn","tags":"Color"},
	"id_14":{"title":"Christmas Tree at Christ Church Cathedral #1","info":"Dublin, Ireland","who":"Asako Severn","tags":"Color;NightPhotos"},
	"id_15":{"title":"Christmas Tree at Christ Cathedral Church #2","info":"Dublin, Ireland","who":"Asako Severn","tags":"Color;NightPhotos"},

	"sw_01":{"title":"Adobe & Sky","info":"Taos, New Mexico","who":"Kevin Brown","tags":"Color"},
	"sw_02":{"title":"Upper Antelope Canyon Entrance #1","info":"Page, Arizona","who":"Kevin Brown","tags":"Color"},
	"sw_03":{"title":"Upper Antelope Canyon Shaft of Light #1","info":"Page, Arizona","who":"Kevin Brown","tags":"Color"},
	"sw_04":{"title":"Upper Antelope Canyon Shaft of Light #2","info":"Page, Arizona","who":"Kevin Brown","tags":"Color"},
	"sw_05":{"title":"Painted Desert","info":"Off Rt.87, Arizona","who":"Asako Severn","tags":"Color"},
	"sw_06":{"title":"Fall Sky Over Desert","info":"Tucson, Arizona","who":"Asako Severn","tags":"Color;Fall"},
	"sw_07":{"title":"Desert Sunset","info":"Tucson, Arizona","who":"Kevin Brown","tags":"Color"},
	"sw_08":{"title":"Full Moon Rising","info":"Tucson, Arizona","who":"Kevin Brown","tags":"Black&amp;White"},
	"sw_09":{"title":"White House ruins #1","info":"Canyon de Chelly, Arizona","who":"Kevin Brown","tags":"Black&amp;White"},
	"sw_10":{"title":"White House ruins #2","info":"Canyon de Chelly, Arizona","who":"Asako Severn","tags":"Black&amp;White"},
	"sw_11":{"title":"Upper Antelope Canyon Entrance #2","info":"Page, Arizona","who":"Asako Severn","tags":"Color"},
	"sw_12":{"title":"Upper Antelope Canyon Shaft of Light #3 [W]","info":"Page, Arizona","who":"Asako Severn","tags":"Color"},
	"sw_13":{"title":"Upper Antelope Canyon Wall","info":"Page, Arizona","who":"Asako Severn","tags":"Color"},
	"sw_14":{"title":"Spider Rock","info":"Canyon de Chelly, Arizona","who":"Asako Severn","tags":"Color"},

	"ne_01":{"title":"Fall Graveyard [W]","info":"Limerick, Maine","who":"Kevin Brown","tags":"Color;Autumn"},
	"ne_02":{"title":"Boston Night Skyline [P]","info":"Boston, Massachusetts","who":"Kevin Brown",
	         "tags":"Color;NightPhotos"},
	"ne_03":{"title":"Charles River Boats at Night","info":"Boston, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;NightPhotos"},
	"ne_04":{"title":"Charles River Summer Morning","info":"Cambridge, Massachusetts","who":"Asako Severn",
	         "tags":"Color;Summer"},
	"ne_05":{"title":"Rowes Wharf to Northern Ave Bridge [P]","info":"illuminale Boston 2008 (Boston, Massachusetts)","who":"Kevin Brown",
	         "tags":"Color;NightPhotos"},
	"ne_06":{"title":"Boston Harbor Hotel and Custom House","info":"illuminale Boston 2008 (Boston, Massachusetts)","who":"Asako Severn",
	         "tags":"Color;NightPhotos"},
	"ne_07":{"title":"Institute of Contemporary Art","info":"Boston, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;NightPhotos"},
	"ne_08":{"title":"Grand Stand Seats","info":"Fenway Park, Boston, Massachusetts","who":"Asako Severn",
	         "tags":"Color"},
	"ne_09":{"title":"Blue Hills Winter Morning [W]","info":"Canton, Massachusetts","who":"Asako Severn",
	         "tags":"Color;Winter"},
	"ne_10":{"title":"Blue Hills","info":"Canton, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;Winter"},
	"ne_11":{"title":"Waterfire","info":"Providence, Rhode Island","who":"Kevin Brown",
	         "tags":"Color;NightPhotos;Summer"},	
	"ne_12":{"title":"Kennedy Plaza at Night [W]","info":"Providence, Rhode Island","who":"Kevin Brown",
	         "tags":"Black&amp;White;NightPhotos"},
	"ne_13":{"title":"Swan Boats at Night [W]","info":"Boston Garden, Boston, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;NightPhotos"},
	"ne_14":{"title":"Autumn reflection on Bowens","info":"Wendell, Massachusetts","who":"Kevin Brown",
	         "tags":"Color;Autumn"},
	"ne_15":{"title":"Near Harvard Gate","info":"Cambridge, Massachusetts","who":"Asako Severn",
	         "tags":"Color;Winter;NightPhotos"},
	"ne_16":{"title":"Widner Library Entrance","info":"Harvard University, Cambridge, Massachusetts","who":"Asako Severn",
	         "tags":"Color;Winter;NightPhotos"},
	"ne_17":{"title":"Bicycle in Snow at Emerson Hall","info":"Harvard University, Cambridge, Massachusetts","who":"Asako Severn",
	         "tags":"Color;Winter;NightPhotos"},
	"ne_18":{"title":"Bicycle in Snow on Broadway","info":"Cambridge, Massachusetts","who":"Asako Severn",
	         "tags":"Color;Winter;NightPhotos"},

	"ny_01":{"title":"Brooklyn Bridge [SQ]","info":"Brooklyn, New York","who":"Asako Severn","tags":"Black&amp;White"},
	"ny_02":{"title":"Brooklyn Bridge at Dusk","info":"DUMBO, New York","who":"Asako Severn","tags":"Color"},
	"ny_03":{"title":"Brooklyn Bridge at Night","info":"DUMBO, New York","who":"Kevin Brown","tags":"Color"},
	"ny_04":{"title":"Bethesda Terrace Stairs [W]","info":"Central Park, New York","who":"Kevin Brown","tags":"Black&amp;White"},
	"ny_05":{"title":"Pine Bridge","info":"Central Park, New York","who":"Asako Severn","tags":"Black&amp;White"},
	"ny_06":{"title":"Astroland, March 2008","info":"Coney Island, Brooklyn, New York","who":"Kevin Brown","tags":"Color"},

	"bt_01":{"title":"Lobster Boat #1","info":"New Harbor, Maine","who":"Kevin Brown","tags":"Color"},
	"bt_02":{"title":"Lobster Boat #3","info":"New Harbor, Maine","who":"Kevin Brown","tags":"Color"},
	"bt_03":{"title":"A Street Pier Sunset","info":"Hull, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"bt_04":{"title":"Pemaquid Point Lighthouse","info":"Bristol, Maine","who":"Kevin Brown","tags":"Color"},
	"bt_05":{"title":"Catboats #2","info":"Hingham Harbor, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"bt_06":{"title":"Catboats #3","info":"Hingham Harbor, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"bt_07":{"title":"Autumn Reflection","info":"New Harbor, Maine","who":"Kevin Brown","tags":"Color;Autumn"},
	"bt_08":{"title":"Red Rowboat","info":"Cohasset, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"bt_09":{"title":"Seagull on Rock","info":"Hull, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"bt_10":{"title":"Number 8","info":"Hingham Harbor, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"bt_11":{"title":"Buoy","info":"New Harbor, Maine","who":"Kevin Brown","tags":"Color"},

	"cl_01":{"title":"Cabanas [W]","info":"Fishhoek, South Africa","who":"Kevin Brown","tags":"Color"},
	"cl_02":{"title":"Fisherman on Senorita","info":"Fishhoek, South Africa","who":"Kevin Brown","tags":"Color"},
	"cl_03":{"title":"Flag","info":"Hull, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"cl_04":{"title":"Set Screws","info":"Webster Lake, New Hampshire","who":"Kevin Brown","tags":"Color"},
	"cl_05":{"title":"Leaves in Snow","info":"Dorchester Park, Dorchester, Massachusetts","who":"Kevin Brown",
	         "tags":"Color;Winter"},
	"cl_06":{"title":"Wine Glass","info":"Mount Snow, Vermont","who":"Kevin Brown","tags":"Color;Autumn"},
	"cl_07":{"title":"Day Lily","info":"Dorchester, Massachusetts","who":"Kevin Brown","tags":"Color;Flowers;Summer"},
	"cl_08":{"title":"Water Lily","info":"Borderland State Park, Sharon, Massachusetts","who":"Asako Severn",
	         "tags":"Color;Flowers;Summer"},
	"cl_09":{"title":"Carousel","info":"Hull, Massachusetts","who":"Kevin Brown","tags":"Color"},
	"cl_10":{"title":"Bittersweet","info":"Blue Hills, Massachusetts","who":"Kevin Brown","tags":"Color;Winter"},
	"cl_11":{"title":"Three Chairs","info":"Schenley Plaza, Pittsburgh, Pennsylvania","who":"Asako Severn","tags":"Color"},
	"cl_12":{"title":"Cabbage","info":"Farmer's Market, Dublin, Ireland","who":"Asako Severn","tags":"Color"},
	"cl_13":{"title":"Drumlin Cheese","info":"Farmer's Market, Dublin, Ireland","who":"Asako Severn","tags":"Color"},
	"cl_14":{"title":"A Pair of Pumpkins","info":"North Andover, Massachusetts","who":"Asako Severn","tags":"Color;Autumn"},
	"cl_15":{"title":"Pumpkins #2","info":"North Andover, Massachusetts","who":"Asako Severn","tags":"Color;Autumn"},
	"cl_16":{"title":"Back of a Little Yellow Flower","info":"Nashua, New Hampshire","who":"Asako Severn","tags":"Color;Summer"},
	"cl_17":{"title":"Coneflower","info":"Dorchester, Massachusetts","who":"Kevin Brown","tags":"Color;Summer"},
	"cl_18":{"title":"An Empty Boat","info":"Fishhoek, South Africa","who":"Kevin Brown","tags":"Color"},

	"bw_01":{"title":"Dock & Tire","info":"Webster Lake, New Hampshire","who":"Kevin Brown",
	         "tags":"Black&amp;White"},
	"bw_02":{"title":"Tree Shadows","info":"Olmstead Park, Jamaica Plain, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;Winter"},
	"bw_03":{"title":"Calla Lily","info":"Dorchester, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;Flowers"},
	"bw_04":{"title":"Star Magnolia","info":"Cambridge, Massachusetts","who":"Asako Severn",
	         "tags":"Black&amp;White;Flowers;Spring"},
	"bw_05":{"title":"Gazebo in the Night [P]","info":"Norwood, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;NightPhotos"},
	"bw_06":{"title":"Playground at Night","info":"Cambridge, Massachusetts","who":"Kevin Brown",
	         "tags":"Black&amp;White;NightPhotos"}	
};
