window.thumbnails = {};
															thumbnails[2204003] = clik.newPhoto({"id":2204003,"src":"0861_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4011325] = clik.newPhoto({"id":4011325,"src":"Please_thumb.jpg","galleries_id":242335,"server_id":5,"link":"photo_4011325.html","width":130,"caption":"","height":130});
															thumbnails[2203822] = clik.newPhoto({"id":2203822,"src":"DH_322bb_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203822.html","width":130,"caption":"","height":130});
															thumbnails[3729862] = clik.newPhoto({"id":3729862,"src":"Charlotte_134bb_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_3729862.html","width":130,"caption":"","height":130});
															thumbnails[2203975] = clik.newPhoto({"id":2203975,"src":"CBPW_231_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203975.html","width":130,"caption":"","height":130});
															thumbnails[2204006] = clik.newPhoto({"id":2204006,"src":"0251_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_2204006.html","width":130,"caption":"","height":130});
															thumbnails[4011470] = clik.newPhoto({"id":4011470,"src":"bump_054_thumb.jpg","galleries_id":242335,"server_id":5,"link":"photo_4011470.html","width":130,"caption":"","height":130});
															thumbnails[2203823] = clik.newPhoto({"id":2203823,"src":"Elliot19b_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203823.html","width":130,"caption":"","height":130});
															thumbnails[2203985] = clik.newPhoto({"id":2203985,"src":"SA+HT_451_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203985.html","width":130,"caption":"","height":130});
															thumbnails[4010887] = clik.newPhoto({"id":4010887,"src":"Jake4_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_4010887.html","width":130,"caption":"","height":130});
															thumbnails[4011335] = clik.newPhoto({"id":4011335,"src":"33weeks1_thumb.jpg","galleries_id":242335,"server_id":5,"link":"photo_4011335.html","width":130,"caption":"","height":130});
															thumbnails[2203818] = clik.newPhoto({"id":2203818,"src":"DH_069bb_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203818.html","width":130,"caption":"","height":130});
															thumbnails[2203979] = clik.newPhoto({"id":2203979,"src":"HTL_PW_047_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203979.html","width":130,"caption":"","height":130});
															thumbnails[2204008] = clik.newPhoto({"id":2204008,"src":"00311_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_2204008.html","width":130,"caption":"","height":130});
															thumbnails[4011364] = clik.newPhoto({"id":4011364,"src":"Protection_thumb.jpg","galleries_id":242335,"server_id":5,"link":"photo_4011364.html","width":130,"caption":"","height":130});
															thumbnails[2203813] = clik.newPhoto({"id":2203813,"src":"CGO_163b_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203813.html","width":130,"caption":"","height":130});
															thumbnails[2203849] = clik.newPhoto({"id":2203849,"src":"CGO_207b_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203849.html","width":130,"caption":"","height":130});
															thumbnails[2203976] = clik.newPhoto({"id":2203976,"src":"CBPW0192_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203976.html","width":130,"caption":"","height":130});
															thumbnails[2204013] = clik.newPhoto({"id":2204013,"src":"CC_0883_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2204013.html","width":130,"caption":"","height":130});
															thumbnails[2203817] = clik.newPhoto({"id":2203817,"src":"CGO_090b_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203817.html","width":130,"caption":"","height":130});
															thumbnails[2203983] = clik.newPhoto({"id":2203983,"src":"S+B_433_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203983.html","width":130,"caption":"","height":130});
															thumbnails[2204015] = clik.newPhoto({"id":2204015,"src":"CC_1451_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2204015.html","width":130,"caption":"","height":130});
															thumbnails[2203982] = clik.newPhoto({"id":2203982,"src":"S+B_372_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203982.html","width":130,"caption":"","height":130});
															thumbnails[2204017] = clik.newPhoto({"id":2204017,"src":"CC_1101_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2204017.html","width":130,"caption":"","height":130});
															thumbnails[2427258] = clik.newPhoto({"id":2427258,"src":"Kate_Anderson02b2_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2427258.html","width":130,"caption":"","height":130});
															thumbnails[3729809] = clik.newPhoto({"id":3729809,"src":"DOZ_012_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_3729809.html","width":130,"caption":"","height":130});
															thumbnails[3729817] = clik.newPhoto({"id":3729817,"src":"Dylan_19b_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_3729817.html","width":130,"caption":"","height":130});
															thumbnails[2203869] = clik.newPhoto({"id":2203869,"src":"TW_0971_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203869.html","width":130,"caption":"","height":130});
															thumbnails[2203978] = clik.newPhoto({"id":2203978,"src":"ER_180_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203978.html","width":130,"caption":"","height":130});
															thumbnails[2204048] = clik.newPhoto({"id":2204048,"src":"Shhb_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_2204048.html","width":130,"caption":"","height":130});
															thumbnails[2427263] = clik.newPhoto({"id":2427263,"src":"Maz_0681_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2427263.html","width":130,"caption":"","height":130});
															thumbnails[2203820] = clik.newPhoto({"id":2203820,"src":"DH_239bb_thumb.jpg","galleries_id":144808,"server_id":5,"link":"photo_2203820.html","width":130,"caption":"","height":130});
															thumbnails[2203984] = clik.newPhoto({"id":2203984,"src":"S+B_464_thumb.jpg","galleries_id":144780,"server_id":5,"link":"photo_2203984.html","width":130,"caption":"","height":130});
															thumbnails[2204062] = clik.newPhoto({"id":2204062,"src":"AlisonB2_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_2204062.html","width":130,"caption":"","height":130});
															thumbnails[2427092] = clik.newPhoto({"id":2427092,"src":"Maz_114_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2427092.html","width":130,"caption":"","height":130});
															thumbnails[2427237] = clik.newPhoto({"id":2427237,"src":"Kate_Anderson012_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2427237.html","width":130,"caption":"","height":130});
															thumbnails[2204065] = clik.newPhoto({"id":2204065,"src":"hannah1_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_2204065.html","width":130,"caption":"","height":130});
															thumbnails[2204067] = clik.newPhoto({"id":2204067,"src":"ICE71_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_2204067.html","width":130,"caption":"","height":130});
															thumbnails[2427247] = clik.newPhoto({"id":2427247,"src":"Maz_1642_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_2427247.html","width":130,"caption":"","height":130});
															thumbnails[2204068] = clik.newPhoto({"id":2204068,"src":"Brick_301_thumb.jpg","galleries_id":156839,"server_id":5,"link":"photo_2204068.html","width":130,"caption":"","height":130});
															thumbnails[3729874] = clik.newPhoto({"id":3729874,"src":"Mirror_thumb.jpg","galleries_id":156840,"server_id":5,"link":"photo_3729874.html","width":130,"caption":"","height":130});
															thumbnails[2386461] = clik.newPhoto({"id":2386461,"src":"CBM_1541_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_2386461.html","width":130,"caption":"","height":130});
															thumbnails[2386442] = clik.newPhoto({"id":2386442,"src":"RLS_WD_119_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_2386442.html","width":130,"caption":"","height":130});
															thumbnails[3287834] = clik.newPhoto({"id":3287834,"src":"DOB_244_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_3287834.html","width":130,"caption":"","height":130});
															thumbnails[2386468] = clik.newPhoto({"id":2386468,"src":"MAS_WD_230_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_2386468.html","width":130,"caption":"","height":130});
															thumbnails[2386444] = clik.newPhoto({"id":2386444,"src":"BJH_WD_092_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_2386444.html","width":130,"caption":"","height":130});
															thumbnails[3287835] = clik.newPhoto({"id":3287835,"src":"KMJ_140_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_3287835.html","width":130,"caption":"","height":130});
															thumbnails[2386471] = clik.newPhoto({"id":2386471,"src":"JR_0149_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_2386471.html","width":130,"caption":"","height":130});
															thumbnails[2386451] = clik.newPhoto({"id":2386451,"src":"DKD_011_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_2386451.html","width":130,"caption":"","height":130});
															thumbnails[3287838] = clik.newPhoto({"id":3287838,"src":"MMW_226_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_3287838.html","width":130,"caption":"","height":130});
															thumbnails[3287829] = clik.newPhoto({"id":3287829,"src":"SBL_179_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_3287829.html","width":130,"caption":"","height":130});
															thumbnails[2386476] = clik.newPhoto({"id":2386476,"src":"SAHT_WD_485_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_2386476.html","width":130,"caption":"","height":130});
															thumbnails[3287818] = clik.newPhoto({"id":3287818,"src":"SBL_075_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_3287818.html","width":130,"caption":"","height":130});
															thumbnails[2386474] = clik.newPhoto({"id":2386474,"src":"MJ_198_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_2386474.html","width":130,"caption":"","height":130});
															thumbnails[2386455] = clik.newPhoto({"id":2386455,"src":"MJ_067_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_2386455.html","width":130,"caption":"","height":130});
															thumbnails[2386480] = clik.newPhoto({"id":2386480,"src":"MAS_WD_404_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_2386480.html","width":130,"caption":"","height":130});
															thumbnails[2386485] = clik.newPhoto({"id":2386485,"src":"SMS_WD_317_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_2386485.html","width":130,"caption":"","height":130});
															thumbnails[2386457] = clik.newPhoto({"id":2386457,"src":"RLS_WD_184_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_2386457.html","width":130,"caption":"","height":130});
															thumbnails[2386483] = clik.newPhoto({"id":2386483,"src":"CBM_438_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_2386483.html","width":130,"caption":"","height":130});
															thumbnails[2386459] = clik.newPhoto({"id":2386459,"src":"MAS_WD_1802_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_2386459.html","width":130,"caption":"","height":130});
															thumbnails[3287844] = clik.newPhoto({"id":3287844,"src":"MMW_291_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_3287844.html","width":130,"caption":"","height":130});
															thumbnails[2386488] = clik.newPhoto({"id":2386488,"src":"RLS_WD_423_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_2386488.html","width":130,"caption":"","height":130});
															thumbnails[3287823] = clik.newPhoto({"id":3287823,"src":"DOB_113_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_3287823.html","width":130,"caption":"","height":130});
															thumbnails[3287831] = clik.newPhoto({"id":3287831,"src":"KMJ_146_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_3287831.html","width":130,"caption":"","height":130});
															thumbnails[3287896] = clik.newPhoto({"id":3287896,"src":"SBL_321_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_3287896.html","width":130,"caption":"","height":130});
															thumbnails[2386475] = clik.newPhoto({"id":2386475,"src":"MDG_WD_240_thumb.jpg","galleries_id":154831,"server_id":5,"link":"photo_2386475.html","width":130,"caption":"","height":130});
															thumbnails[2386489] = clik.newPhoto({"id":2386489,"src":"SAHT_WD_572_thumb.jpg","galleries_id":200436,"server_id":5,"link":"photo_2386489.html","width":130,"caption":"","height":130});
															thumbnails[3287824] = clik.newPhoto({"id":3287824,"src":"MMW_158_thumb.jpg","galleries_id":154829,"server_id":5,"link":"photo_3287824.html","width":130,"caption":"","height":130});
															thumbnails[3921514] = clik.newPhoto({"id":3921514,"src":"34-Weeks2_thumb.jpg","galleries_id":270565,"server_id":5,"link":"photo_3921514.html","width":130,"caption":"","height":130});
															thumbnails[4704447] = clik.newPhoto({"id":4704447,"src":"butterflies_thumb.jpg","galleries_id":270564,"server_id":5,"link":"photo_4704447.html","width":130,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[270564] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Contact","link":"section187167.html","maxRecords":0.0,"photoIDs":[4704447.0],"skipIndex":0,"section_code":"section187167","featured_images":4704447.0,"id":270564,"singleSection":false});				  						galleries[154829] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 1","link":"section197160_154829.html","maxRecords":0.0,"photoIDs":[2386442.0,2386444.0,2386451.0,3287818.0,2386455.0,2386457.0,2386459.0,3287823.0,3287824.0],"skipIndex":0,"section_code":"section197160","featured_images":2386442.0,"id":154829,"singleSection":false});				  						galleries[154831] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2","link":"section197160_154831.html","maxRecords":0.0,"photoIDs":[2386461.0,2386468.0,2386471.0,3287829.0,2386474.0,2386480.0,2386488.0,3287831.0,2386475.0],"skipIndex":0,"section_code":"section197160","featured_images":3287829.0,"id":154831,"singleSection":false});				  						galleries[200436] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 3","link":"section197160_200436.html","maxRecords":0.0,"photoIDs":[3287834.0,3287835.0,3287838.0,2386476.0,2386485.0,2386483.0,3287844.0,3287896.0,2386489.0],"skipIndex":0,"section_code":"section197160","featured_images":2386489.0,"id":200436,"singleSection":false});				  						galleries[156840] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Inspire","link":"section186213_156840.html","maxRecords":0.0,"photoIDs":[2204013.0,2204015.0,2204017.0,2427258.0,2427263.0,2427092.0,2427237.0,2427247.0,3729874.0],"skipIndex":0,"section_code":"section186213","featured_images":2427092.0,"id":156840,"singleSection":false});				  						galleries[270565] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"ME","link":"section325357.html","maxRecords":0.0,"photoIDs":[3921514.0],"skipIndex":0,"section_code":"section325357","featured_images":3921514.0,"id":270565,"singleSection":false});				  						galleries[156839] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Style","link":"section186213_156839.html","maxRecords":0.0,"photoIDs":[3729862.0,2204006.0,4010887.0,2204008.0,2204048.0,2204062.0,2204065.0,2204067.0,2204068.0],"skipIndex":0,"section_code":"section186213","featured_images":2204062.0,"id":156839,"singleSection":false});				  						galleries[144780] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Life","link":"section186213_144780.html","maxRecords":0.0,"photoIDs":[2203975.0,2203985.0,2203979.0,2203976.0,2203983.0,2203982.0,3729809.0,2203978.0,2203984.0],"skipIndex":0,"section_code":"section186213","featured_images":2203978.0,"id":144780,"singleSection":false});				  						galleries[144808] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Pure","link":"section186213_144808.html","maxRecords":0.0,"photoIDs":[2203822.0,2203823.0,2203818.0,2203813.0,2203849.0,2203817.0,3729817.0,2203869.0,2203820.0],"skipIndex":0,"section_code":"section186213","featured_images":2203823.0,"id":144808,"singleSection":false});				  						galleries[242335] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"CHERISH","link":"section186213_242335.html","maxRecords":0.0,"photoIDs":[4011325.0,4011470.0,4011335.0,4011364.0],"skipIndex":0,"section_code":"section186213","featured_images":4011325.0,"id":242335,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3729862';
imageSets[2] = '4011325,3287829,2427092,2386489,2386442,2204062,2203978,2203823';
imageSets[3] = '4704447,4011470,4011364,4011335,4011325,4010887,3921514,3729874,3729862,3729817,3729809,3287896,3287844,3287838,3287835,3287834,3287831,3287829,3287824,3287823,3287818,2427263,2427258,2427247,2427237,2427092,2386489,2386488,2386485,2386483,2386480,2386476,2386475,2386474,2386471,2386468,2386461,2386459,2386457,2386455,2386451,2386444,2386442,2204068,2204067,2204065,2204062,2204048,2204017,2204015';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/kateanderson/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/kateanderson/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 && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'section186213.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 && 'section186213' != '') {
					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 = 'Kate Anderson Photography: ' + 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.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.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="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		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 += '<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({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* 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;
	}
}

			

