window.thumbnails = {};
thumbnails[8063868] = clik.newPhoto({"link":"#","caption":"","height":130,"id":8063868,"server_id":31,"src":"Fiona_Tim6154_thumb.jpg","galleries_id":"","width":130});
thumbnails[8063875] = clik.newPhoto({"link":"#","caption":"","height":173,"id":8063875,"server_id":31,"src":"greg_profile_photo_07_thumb.jpg","galleries_id":"","width":130});
thumbnails[8063888] = clik.newPhoto({"link":"#","caption":"","height":130,"id":8063888,"server_id":31,"src":"Home_page_portrait_thumb.jpg","galleries_id":"","width":130});
thumbnails[7931332] = clik.newPhoto({"link":"photo_7931332.html","caption":"","height":94,"id":7931332,"server_id":31,"src":"01_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7667573] = clik.newPhoto({"link":"photo_7667573.html","caption":"","height":87,"id":7667573,"server_id":31,"src":"Melissa_Beau255Hero1_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931333] = clik.newPhoto({"link":"photo_7931333.html","caption":"","height":90,"id":7931333,"server_id":31,"src":"02_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7963110] = clik.newPhoto({"link":"photo_7963110.html","caption":"","height":158,"id":7963110,"server_id":31,"src":"img0162_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931338] = clik.newPhoto({"link":"photo_7931338.html","caption":"","height":130,"id":7931338,"server_id":31,"src":"04_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931337] = clik.newPhoto({"link":"photo_7931337.html","caption":"","height":87,"id":7931337,"server_id":31,"src":"03_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672888] = clik.newPhoto({"link":"photo_7672888.html","caption":"Courtney&Steven","height":87,"id":7672888,"server_id":31,"src":"Courtney_Steven224BW_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7963109] = clik.newPhoto({"link":"photo_7963109.html","caption":"","height":182,"id":7963109,"server_id":31,"src":"Corsair_Bup2_333_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672889] = clik.newPhoto({"link":"photo_7672889.html","caption":"Florence&David","height":87,"id":7672889,"server_id":31,"src":"Florence_David283_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931339] = clik.newPhoto({"link":"photo_7931339.html","caption":"","height":83,"id":7931339,"server_id":31,"src":"05_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672910] = clik.newPhoto({"link":"photo_7672910.html","caption":"Melissa&Beau","height":87,"id":7672910,"server_id":31,"src":"Melissa_Beau265_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672890] = clik.newPhoto({"link":"photo_7672890.html","caption":"Florence&David","height":87,"id":7672890,"server_id":31,"src":"Florence_David060S_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931342] = clik.newPhoto({"link":"photo_7931342.html","caption":"","height":87,"id":7931342,"server_id":31,"src":"08_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931341] = clik.newPhoto({"link":"photo_7931341.html","caption":"","height":87,"id":7931341,"server_id":31,"src":"06_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7963104] = clik.newPhoto({"link":"photo_7963104.html","caption":"","height":88,"id":7963104,"server_id":31,"src":"OCT3rd10_B_7401_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672894] = clik.newPhoto({"link":"photo_7672894.html","caption":"Melissa&Beau","height":87,"id":7672894,"server_id":31,"src":"Melissa_Beau232_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7963113] = clik.newPhoto({"link":"photo_7963113.html","caption":"","height":87,"id":7963113,"server_id":31,"src":"SEP20th09B_040_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672896] = clik.newPhoto({"link":"photo_7672896.html","caption":"Courtney&Steven","height":87,"id":7672896,"server_id":31,"src":"Courtney_Steven208S_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672898] = clik.newPhoto({"link":"photo_7672898.html","caption":"Jessica&Rebel","height":87,"id":7672898,"server_id":31,"src":"Jessica_Rebel276_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672899] = clik.newPhoto({"link":"photo_7672899.html","caption":"Rachael&Mark","height":87,"id":7672899,"server_id":31,"src":"Rachael_Mark244BW_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931348] = clik.newPhoto({"link":"photo_7931348.html","caption":"","height":99,"id":7931348,"server_id":31,"src":"12_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7963111] = clik.newPhoto({"link":"photo_7963111.html","caption":"","height":189,"id":7963111,"server_id":31,"src":"APR10th10_A_4411_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672903] = clik.newPhoto({"link":"photo_7672903.html","caption":"Courtney&Steven","height":87,"id":7672903,"server_id":31,"src":"Courtney_Steven244_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931349] = clik.newPhoto({"link":"photo_7931349.html","caption":"","height":130,"id":7931349,"server_id":31,"src":"13_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931354] = clik.newPhoto({"link":"photo_7931354.html","caption":"","height":91,"id":7931354,"server_id":31,"src":"071_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672904] = clik.newPhoto({"link":"photo_7672904.html","caption":"Nonie&Brendan","height":87,"id":7672904,"server_id":31,"src":"Nonie_Brendan186_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931344] = clik.newPhoto({"link":"photo_7931344.html","caption":"","height":99,"id":7931344,"server_id":31,"src":"10_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931345] = clik.newPhoto({"link":"photo_7931345.html","caption":"","height":87,"id":7931345,"server_id":31,"src":"09_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672907] = clik.newPhoto({"link":"photo_7672907.html","caption":"Sarah&Trent","height":87,"id":7672907,"server_id":31,"src":"Sarah_Trent244_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931346] = clik.newPhoto({"link":"photo_7931346.html","caption":"","height":130,"id":7931346,"server_id":31,"src":"11_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672908] = clik.newPhoto({"link":"photo_7672908.html","caption":"Jessica&Rebel","height":70,"id":7672908,"server_id":31,"src":"Jessica_Rebel273_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931350] = clik.newPhoto({"link":"photo_7931350.html","caption":"","height":87,"id":7931350,"server_id":31,"src":"15_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7672909] = clik.newPhoto({"link":"photo_7672909.html","caption":"Rachael&Mark","height":87,"id":7672909,"server_id":31,"src":"Rachael_Mark019_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7963112] = clik.newPhoto({"link":"photo_7963112.html","caption":"","height":87,"id":7963112,"server_id":31,"src":"NOV14TH09B_553_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931351] = clik.newPhoto({"link":"photo_7931351.html","caption":"","height":96,"id":7931351,"server_id":31,"src":"16_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7931352] = clik.newPhoto({"link":"photo_7931352.html","caption":"","height":93,"id":7931352,"server_id":31,"src":"17_thumb.jpg","galleries_id":415410,"width":130});
thumbnails[7937218] = clik.newPhoto({"link":"photo_7937218.html","caption":"","height":87,"id":7937218,"server_id":31,"src":"Irene_Minh20_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7963124] = clik.newPhoto({"link":"photo_7963124.html","caption":"","height":127,"id":7963124,"server_id":31,"src":"img019_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937207] = clik.newPhoto({"link":"photo_7937207.html","caption":"","height":87,"id":7937207,"server_id":31,"src":"Candice_Simon04_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937787] = clik.newPhoto({"link":"photo_7937787.html","caption":"","height":87,"id":7937787,"server_id":31,"src":"Daniela_Vincent14_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937788] = clik.newPhoto({"link":"photo_7937788.html","caption":"","height":87,"id":7937788,"server_id":31,"src":"Julie_Min04_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7963116] = clik.newPhoto({"link":"photo_7963116.html","caption":"","height":160,"id":7963116,"server_id":31,"src":"az-1_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937792] = clik.newPhoto({"link":"photo_7937792.html","caption":"","height":87,"id":7937792,"server_id":31,"src":"Ruth_Family14_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937810] = clik.newPhoto({"link":"photo_7937810.html","caption":"","height":91,"id":7937810,"server_id":31,"src":"Paige_Steven201_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7963118] = clik.newPhoto({"link":"photo_7963118.html","caption":"","height":172,"id":7963118,"server_id":31,"src":"BOYS_DISPLAY08_005_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937799] = clik.newPhoto({"link":"photo_7937799.html","caption":"","height":87,"id":7937799,"server_id":31,"src":"Candice_Taylor09_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7963121] = clik.newPhoto({"link":"photo_7963121.html","caption":"","height":101,"id":7963121,"server_id":31,"src":"img017_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937800] = clik.newPhoto({"link":"photo_7937800.html","caption":"","height":87,"id":7937800,"server_id":31,"src":"Sophia_Sean18_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7963126] = clik.newPhoto({"link":"photo_7963126.html","caption":"","height":88,"id":7963126,"server_id":31,"src":"May28th11_A_787_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937801] = clik.newPhoto({"link":"photo_7937801.html","caption":"","height":87,"id":7937801,"server_id":31,"src":"Seakanyo_Andrew20_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937802] = clik.newPhoto({"link":"photo_7937802.html","caption":"","height":87,"id":7937802,"server_id":31,"src":"Vittoria_Nardia03_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937803] = clik.newPhoto({"link":"photo_7937803.html","caption":"","height":87,"id":7937803,"server_id":31,"src":"Ruth_Family31_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7963125] = clik.newPhoto({"link":"photo_7963125.html","caption":"","height":167,"id":7963125,"server_id":31,"src":"img020_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937804] = clik.newPhoto({"link":"photo_7937804.html","caption":"","height":87,"id":7937804,"server_id":31,"src":"Kylie_Joe27_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937805] = clik.newPhoto({"link":"photo_7937805.html","caption":"","height":87,"id":7937805,"server_id":31,"src":"Paige_Steven27_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[7937806] = clik.newPhoto({"link":"photo_7937806.html","caption":"","height":87,"id":7937806,"server_id":31,"src":"Natalie_Brad24_thumb.jpg","galleries_id":415411,"width":130});
thumbnails[8056629] = clik.newPhoto({"link":"photo_8056629.html","caption":"","height":93,"id":8056629,"server_id":31,"src":"Shot0501_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[8056628] = clik.newPhoto({"link":"photo_8056628.html","caption":"","height":182,"id":8056628,"server_id":31,"src":"Agostini_Family15_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[8056630] = clik.newPhoto({"link":"photo_8056630.html","caption":"","height":93,"id":8056630,"server_id":31,"src":"Agostini_Family26_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[8056631] = clik.newPhoto({"link":"photo_8056631.html","caption":"","height":93,"id":8056631,"server_id":31,"src":"Agostini_Family25_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[8056632] = clik.newPhoto({"link":"photo_8056632.html","caption":"","height":182,"id":8056632,"server_id":31,"src":"Agostini_Family12_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[8056634] = clik.newPhoto({"link":"photo_8056634.html","caption":"","height":93,"id":8056634,"server_id":31,"src":"Shot124_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[8056635] = clik.newPhoto({"link":"photo_8056635.html","caption":"","height":93,"id":8056635,"server_id":31,"src":"Agostini_Family33_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[8056636] = clik.newPhoto({"link":"photo_8056636.html","caption":"","height":182,"id":8056636,"server_id":31,"src":"Agostini_Family17_thumb.jpg","galleries_id":427595,"width":130});
thumbnails[7937821] = clik.newPhoto({"link":"photo_7937821.html","caption":"","height":104,"id":7937821,"server_id":31,"src":"Kids_in_a_box_sample_8x10_thumb.jpg","galleries_id":427593,"width":130});
thumbnails[8056639] = clik.newPhoto({"link":"photo_8056639.html","caption":"","height":195,"id":8056639,"server_id":31,"src":"Sample_Child_8x12W_thumb.jpg","galleries_id":427593,"width":130});
thumbnails[8056641] = clik.newPhoto({"link":"photo_8056641.html","caption":"","height":104,"id":8056641,"server_id":31,"src":"Sample_Group_8x10_thumb.jpg","galleries_id":427593,"width":130});
thumbnails[8063901] = clik.newPhoto({"link":"photo_8063901.html","caption":"","height":105,"id":8063901,"server_id":31,"src":"Fundraiser_Box_Package_thumb.jpg","galleries_id":427593,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[415410] = clik.newGallery({"photoIDs":[7931332,7667573,7931333,7963110,7931338,7931337,7672888,7963109,7672889,7931339,7672910,7672890,7931342,7931341,7963104,7672894,7963113,7672896,7672898,7672899,7931348,7963111,7672903,7931349,7931354,7672904,7931344,7931345,7672907,7931346,7672908,7931350,7672909,7963112,7931351,7931352],"link":"gallery.html","skipIndex":0,"section_code":"gallery","id":415410,"parentGallery":"","featured_images":"7963113,7963112,7963111,7963110,7963109,7963104,7931354,7931352,7931351,7931350","maxRecords":0,"usePopups":false,"singleSection":true,"title":"Weddings"});galleries[415411] = clik.newGallery({"photoIDs":[7937218,7963124,7937207,7937787,7937788,7963116,7937792,7937810,7963118,7937799,7963121,7937800,7963126,7937801,7937802,7937803,7963125,7937804,7937805,7937806],"link":"section497240.html","skipIndex":0,"section_code":"section497240","id":415411,"parentGallery":"","featured_images":"7963126,7963125,7963124,7963121,7963118,7963116,7937810,7937806,7937805,7937804","maxRecords":0,"usePopups":false,"singleSection":true,"title":"Portraits"});galleries[427595] = clik.newGallery({"photoIDs":[8056629,8056628,8056630,8056631,8056632,8056634,8056635,8056636],"link":"section513116.html","skipIndex":0,"section_code":"section513116","id":427595,"parentGallery":"","featured_images":"8056636,8056635,8056634,8056632,8056631,8056630,8056629,8056628","maxRecords":0,"usePopups":false,"singleSection":true,"title":"School Fundraisers"});galleries[427593] = clik.newGallery({"photoIDs":[7937821,8056639,8056641,8063901],"link":"section513117.html","skipIndex":0,"section_code":"section513117","id":427593,"parentGallery":"","featured_images":"8063901,8056641,8056639,7937821","maxRecords":0,"usePopups":false,"singleSection":true,"title":"Kids in a Box"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '8063901,8063888,8063875,8063868,8056641,8056639,8056636,8056635,8056634,8056632,8056631,8056630,8056629,8056628,7963126,7963125,7963124,7963121,7963118,7963116,7963113,7963112,7963111,7963110,7963109,7963104,7937821,7937810,7937806,7937805,7937804,7937803,7937802,7937801,7937800,7937799,7937792,7937788,7937787,7937218,7937207,7931354,7931352,7931351,7931350,7931349,7931348,7931346,7931345,7931344';
imageSets[1] = '7931332,7667573';
imageSets[243253] = '8063888';
imageSets[243252] = '8063875';
imageSets[243251] = '8063868';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/markrode/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/markrode/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/markrode/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/markrode/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/markrode/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/markrode/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/markrode/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/markrode/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 = 'Studio Expressions: ' + 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>';
	}
			
				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>Order this print:</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.item_price !== '') {
			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;
	}
}

		

