window.thumbnails = {};
															thumbnails[963847] = clik.newPhoto({"id":963847,"src":"Angel at train station_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_963847.html","width":130,"caption":"Angel at 30th Street Station","height":210});
															thumbnails[963855] = clik.newPhoto({"id":963855,"src":"Sky Rider_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_963855.html","width":130,"caption":"Sky Rider","height":164});
															thumbnails[963858] = clik.newPhoto({"id":963858,"src":"873062958_cf8138b22b_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_963858.html","width":130,"caption":"Swann Fountain gold","height":87});
															thumbnails[963859] = clik.newPhoto({"id":963859,"src":"Wanamaker eagle & organ_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_963859.html","width":130,"caption":"Wanamaker Eagle & Organ","height":173});
															thumbnails[970013] = clik.newPhoto({"id":970013,"src":"dream garden_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_970013.html","width":130,"caption":"The Dream Garden","height":98});
															thumbnails[970928] = clik.newPhoto({"id":970928,"src":"The Gates of Hell_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_970928.html","width":130,"caption":"The Gates of Hell","height":194});
															thumbnails[971080] = clik.newPhoto({"id":971080,"src":"sounds of phila-genos_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_971080.html","width":130,"caption":"Sounds of Philadelphia\/Geno's Steaks","height":83});
															thumbnails[971098] = clik.newPhoto({"id":971098,"src":"Civil War memorial_thumb.jpg","galleries_id":72659,"server_id":1,"link":"photo_971098.html","width":130,"caption":"Civil War Memorial","height":114});
															thumbnails[1658174] = clik.newPhoto({"id":1658174,"src":"2081803010_ba773b0779_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_1658174.html","width":130,"caption":"Kimmel Center and Sky Fire","height":86});
															thumbnails[2628081] = clik.newPhoto({"id":2628081,"src":"elfreths_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_2628081.html","width":130,"caption":"Elfreth's Alley","height":87});
															thumbnails[3104971] = clik.newPhoto({"id":3104971,"src":"eveningcolors_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_3104971.html","width":130,"caption":"Philadelphia evening colors ","height":87});
															thumbnails[3104989] = clik.newPhoto({"id":3104989,"src":"firstsnowfall_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_3104989.html","width":130,"caption":"First Snowfall","height":173});
															thumbnails[3104993] = clik.newPhoto({"id":3104993,"src":"gargoyledragon_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_3104993.html","width":130,"caption":"Gargoyle dragon","height":182});
															thumbnails[3104996] = clik.newPhoto({"id":3104996,"src":"rittenhousereflection_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_3104996.html","width":130,"caption":"Rittenhouse Reflection","height":98});
															thumbnails[3104997] = clik.newPhoto({"id":3104997,"src":"sunshower_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_3104997.html","width":130,"caption":"Sun Shower","height":104});
															thumbnails[4916519] = clik.newPhoto({"id":4916519,"src":"magnoliasandwindow_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_4916519.html","width":130,"caption":"Magnolia Garden","height":87});
															thumbnails[4916766] = clik.newPhoto({"id":4916766,"src":"Philadelphia_alley_with_skyscrapers_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_4916766.html","width":130,"caption":"Philadelphia alley with skyscrapers","height":87});
															thumbnails[6242479] = clik.newPhoto({"id":6242479,"src":"crossing_broad_in_snow_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242479.html","width":130,"caption":"Crossing Broad in Snow","height":195});
															thumbnails[6242569] = clik.newPhoto({"id":6242569,"src":"alone_in_paris_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242569.html","width":130,"caption":"Alone in Paris","height":104});
															thumbnails[6242570] = clik.newPhoto({"id":6242570,"src":"grace_tavern_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242570.html","width":130,"caption":"Grace Tavern, Philadelphia","height":104});
															thumbnails[6242598] = clik.newPhoto({"id":6242598,"src":"A_couple_at_Naghsh-e_Jahan_Square_at_night_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242598.html","width":130,"caption":"A  couple at Naghsh-e Jahan Square","height":87});
															thumbnails[6242599] = clik.newPhoto({"id":6242599,"src":"jellyfish_silk_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242599.html","width":130,"caption":"Jellyfish Silk","height":87});
															thumbnails[6242601] = clik.newPhoto({"id":6242601,"src":"boathouse_row_silhouettes_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242601.html","width":130,"caption":"Boathouse Row silhouettes","height":87});
															thumbnails[6242602] = clik.newPhoto({"id":6242602,"src":"savannah_gothic_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242602.html","width":130,"caption":"Savannah Gothic","height":104});
															thumbnails[6242603] = clik.newPhoto({"id":6242603,"src":"time_for_a_swim_in_the_fountain_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242603.html","width":130,"caption":"Time for a swim in the fountain","height":104});
															thumbnails[6242604] = clik.newPhoto({"id":6242604,"src":"St_Etienne_du_Mont_interior_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242604.html","width":130,"caption":"St. Etienne du Mont interior","height":195});
															thumbnails[6242605] = clik.newPhoto({"id":6242605,"src":"stallion_shadow_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242605.html","width":130,"caption":"Stallion Shadow","height":87});
															thumbnails[6242606] = clik.newPhoto({"id":6242606,"src":"when_the_aliens_landed_in_Philadelphia_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242606.html","width":130,"caption":"When the aliens landed in Philadelphia","height":163});
															thumbnails[6242607] = clik.newPhoto({"id":6242607,"src":"trick_of_the_tail_thumb.jpg","galleries_id":347423,"server_id":1,"link":"photo_6242607.html","width":130,"caption":"Trick of the Tail","height":104});
															thumbnails[6242815] = clik.newPhoto({"id":6242815,"src":"snow_in_rittenhouse_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_6242815.html","width":130,"caption":"Rittenhouse Snow","height":87});
															thumbnails[4916524] = clik.newPhoto({"id":4916524,"src":"time_for_a_swim_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_4916524.html","width":130,"caption":"Time for a swim in the fountain","height":107});
															thumbnails[963848] = clik.newPhoto({"id":963848,"src":"gingkos_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_963848.html","width":130,"caption":"Ginkos on Quince Street","height":173});
															thumbnails[963851] = clik.newPhoto({"id":963851,"src":"Philadelphia Old and New_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_963851.html","width":130,"caption":"Philadelphia: Old and New","height":87});
															thumbnails[1658176] = clik.newPhoto({"id":1658176,"src":"2074937948_74c27ed18f_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_1658176.html","width":130,"caption":"The Red Door","height":198});
															thumbnails[963852] = clik.newPhoto({"id":963852,"src":"Philadelphia sunset_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_963852.html","width":130,"caption":"Sunset over Philadelphia","height":87});
															thumbnails[970913] = clik.newPhoto({"id":970913,"src":"night in colonial Philadelphia_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_970913.html","width":130,"caption":"Night in colonial Philadelphia","height":87});
															thumbnails[963856] = clik.newPhoto({"id":963856,"src":"sun shower_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_963856.html","width":130,"caption":"Sun Shower","height":164});
															thumbnails[969904] = clik.newPhoto({"id":969904,"src":"526931466_ade396ba1f_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_969904.html","width":130,"caption":"Boathouse Row at Sunset","height":90});
															thumbnails[969908] = clik.newPhoto({"id":969908,"src":"Italian Market_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_969908.html","width":130,"caption":"The Italian Market","height":152});
															thumbnails[969926] = clik.newPhoto({"id":969926,"src":"Scullers on the Schuylkill_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_969926.html","width":130,"caption":"Scullers on the Schuylkill River","height":101});
															thumbnails[969946] = clik.newPhoto({"id":969946,"src":"twilight in Philadelphia_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_969946.html","width":130,"caption":"Twilight in Philadelphia","height":103});
															thumbnails[963853] = clik.newPhoto({"id":963853,"src":"Quince Street in snow1_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_963853.html","width":130,"caption":"Colonial alley with snow","height":135});
															thumbnails[970935] = clik.newPhoto({"id":970935,"src":"washington square_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_970935.html","width":130,"caption":"Washington Square","height":102});
															thumbnails[1035375] = clik.newPhoto({"id":1035375,"src":"waterworks moon skyline small_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_1035375.html","width":130,"caption":"Moon over Philadelphia","height":76});
															thumbnails[971096] = clik.newPhoto({"id":971096,"src":"Rittenhouse Christmas_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_971096.html","width":130,"caption":"Rittenhouse Square Christmas","height":121});
															thumbnails[1035373] = clik.newPhoto({"id":1035373,"src":"waterwork & boathouses night small_thumb.jpg","galleries_id":72655,"server_id":1,"link":"photo_1035373.html","width":130,"caption":"The Waterworks","height":92});
															thumbnails[971100] = clik.newPhoto({"id":971100,"src":"robt morris_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_971100.html","width":130,"caption":"The Rob't Morris Building","height":98});
															thumbnails[968443] = clik.newPhoto({"id":968443,"src":"stable house1_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_968443.html","width":130,"caption":"Stable House","height":122});
															thumbnails[969941] = clik.newPhoto({"id":969941,"src":"Misty trees and railings_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_969941.html","width":130,"caption":"Misty trees and railings","height":150});
															thumbnails[970917] = clik.newPhoto({"id":970917,"src":"odd angel_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_970917.html","width":130,"caption":"Odd angel","height":202});
															thumbnails[963849] = clik.newPhoto({"id":963849,"src":"Liberty and birches_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_963849.html","width":130,"caption":"Liberty Place through birches","height":147});
															thumbnails[970920] = clik.newPhoto({"id":970920,"src":"ram power_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_970920.html","width":130,"caption":"Ram power","height":163});
															thumbnails[969937] = clik.newPhoto({"id":969937,"src":"Kate's Place_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_969937.html","width":130,"caption":"Kate's Place","height":174});
															thumbnails[970924] = clik.newPhoto({"id":970924,"src":"Striped Bass Beastie_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_970924.html","width":130,"caption":"Stone beastie","height":173});
															thumbnails[963850] = clik.newPhoto({"id":963850,"src":"Little blue house_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_963850.html","width":130,"caption":"Little blue house","height":157});
															thumbnails[968442] = clik.newPhoto({"id":968442,"src":"2303 Waverly1_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_968442.html","width":130,"caption":"2303 Waverly Street","height":144});
															thumbnails[971097] = clik.newPhoto({"id":971097,"src":"iron studio bunnies_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_971097.html","width":130,"caption":"Iron Studio bunnies, apocalypse","height":86});
															thumbnails[968439] = clik.newPhoto({"id":968439,"src":"most beautiful fire escape_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_968439.html","width":130,"caption":"The most beautiful fire escape","height":187});
															thumbnails[969891] = clik.newPhoto({"id":969891,"src":"arch street church_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_969891.html","width":130,"caption":"Masonic Temple and Arch Street Church","height":98});
															thumbnails[969906] = clik.newPhoto({"id":969906,"src":"City Hall swallows_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_969906.html","width":130,"caption":"Swallows at City Hall","height":108});
															thumbnails[971101] = clik.newPhoto({"id":971101,"src":"bird plaque_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_971101.html","width":130,"caption":"Bird plaque, City Hall","height":208});
															thumbnails[968438] = clik.newPhoto({"id":968438,"src":"Firehouse gargoyle_thumb.jpg","galleries_id":72657,"server_id":1,"link":"photo_968438.html","width":130,"caption":"Firehouse gargoyle","height":113});
															thumbnails[969899] = clik.newPhoto({"id":969899,"src":"bird at Kimmel Center_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_969899.html","width":130,"caption":"Bird at Kimmel Center","height":98});
															thumbnails[970922] = clik.newPhoto({"id":970922,"src":"Reading Terminal headhouse_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_970922.html","width":130,"caption":"Reading Terminal Headhouse","height":87});
															thumbnails[971092] = clik.newPhoto({"id":971092,"src":"magnolias on waverly_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_971092.html","width":130,"caption":"Magnolias in spring","height":173});
															thumbnails[970931] = clik.newPhoto({"id":970931,"src":"tree shadows_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_970931.html","width":130,"caption":"Tree shadows","height":173});
															thumbnails[971099] = clik.newPhoto({"id":971099,"src":"Rowhouse reflection_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_971099.html","width":130,"caption":"Rowhouse reflection","height":196});
															thumbnails[971091] = clik.newPhoto({"id":971091,"src":"Eastern state gargoyles_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_971091.html","width":130,"caption":"Eastern State Penitentiary, with gargoyles","height":91});
															thumbnails[973546] = clik.newPhoto({"id":973546,"src":"japanese house_thumb.jpg","galleries_id":72656,"server_id":1,"link":"photo_973546.html","width":130,"caption":"Japanese House","height":84});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[347423] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Dark and Light exhibit","link":"gallery_347423.html","maxRecords":0.0,"photoIDs":[6242479.0,6242569.0,6242570.0,6242598.0,6242599.0,6242601.0,6242602.0,6242603.0,6242604.0,6242605.0,6242606.0,6242607.0],"skipIndex":0,"section_code":"gallery","featured_images":6242479.0,"id":347423,"singleSection":false});				  						galleries[72655] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Cityscapes","link":"gallery_72655.html","maxRecords":0.0,"photoIDs":[1658174.0,2628081.0,3104971.0,3104989.0,3104996.0,3104997.0,4916766.0,6242815.0,4916524.0,963848.0,963851.0,1658176.0,963852.0,970913.0,963856.0,969904.0,969908.0,969926.0,969946.0,963853.0,970935.0,1035375.0,971096.0,1035373.0],"skipIndex":0,"section_code":"gallery","featured_images":963856.0,"id":72655,"singleSection":false});				  						galleries[72657] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Architectural details","link":"gallery_72657.html","maxRecords":0.0,"photoIDs":[3104993.0,4916519.0,971100.0,968443.0,969941.0,970917.0,970920.0,970924.0,971097.0,968439.0,971101.0,968438.0],"skipIndex":0,"section_code":"gallery","featured_images":968438.0,"id":72657,"singleSection":false});				  						galleries[72659] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Public Art","link":"gallery_72659.html","maxRecords":0.0,"photoIDs":[963847.0,963855.0,963858.0,963859.0,970013.0,970928.0,971080.0,971098.0],"skipIndex":0,"section_code":"gallery","featured_images":970013.0,"id":72659,"singleSection":false});				  						galleries[72656] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Buildings","link":"gallery_72656.html","maxRecords":0.0,"photoIDs":[963849.0,969937.0,963850.0,968442.0,969891.0,969906.0,969899.0,970922.0,971092.0,970931.0,971099.0,971091.0,973546.0],"skipIndex":0,"section_code":"gallery","featured_images":963850.0,"id":72656,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6242815,4916766,3104997,1658174,963858,4916524,1658176,963853';
imageSets[2] = '6242479,970013,963856,963850,968438';
imageSets[3] = '6242815,6242607,6242606,6242605,6242604,6242603,6242602,6242601,6242599,6242598,6242570,6242569,6242479,4916766,4916524,4916519,3104997,3104996,3104993,3104989,3104971,2628081,1658176,1658174,1035375,1035373,973546,971101,971100,971099,971098,971097,971096,971092,971091,971080,970935,970931,970928,970924,970922,970920,970917,970913,970013,969946,969941,969937,969926,969908';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/moocatmoocat/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/moocatmoocat/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Photos of Philadelphia: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> $' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
		else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="MOOCATMOOCAT">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

