window.thumbnails = {};
															thumbnails[9103359] = clik.newPhoto({"id":9103359,"src":"web0001_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103359.html","width":160,"caption":"","height":240});
															thumbnails[9103360] = clik.newPhoto({"id":9103360,"src":"web0002_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103360.html","width":160,"caption":"","height":107});
															thumbnails[9103373] = clik.newPhoto({"id":9103373,"src":"web0006_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103373.html","width":160,"caption":"","height":117});
															thumbnails[9103376] = clik.newPhoto({"id":9103376,"src":"web0007_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103376.html","width":160,"caption":"","height":128});
															thumbnails[9103379] = clik.newPhoto({"id":9103379,"src":"web0009_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103379.html","width":160,"caption":"","height":107});
															thumbnails[9103383] = clik.newPhoto({"id":9103383,"src":"web0010_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103383.html","width":160,"caption":"","height":107});
															thumbnails[9103385] = clik.newPhoto({"id":9103385,"src":"web0011_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103385.html","width":160,"caption":"","height":94});
															thumbnails[9103393] = clik.newPhoto({"id":9103393,"src":"web0012_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103393.html","width":160,"caption":"","height":247});
															thumbnails[9103395] = clik.newPhoto({"id":9103395,"src":"web0015_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103395.html","width":160,"caption":"","height":240});
															thumbnails[9103397] = clik.newPhoto({"id":9103397,"src":"web0019_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103397.html","width":160,"caption":"","height":118});
															thumbnails[9103404] = clik.newPhoto({"id":9103404,"src":"web0020_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103404.html","width":160,"caption":"","height":170});
															thumbnails[9103406] = clik.newPhoto({"id":9103406,"src":"web0026_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103406.html","width":160,"caption":"","height":97});
															thumbnails[9103409] = clik.newPhoto({"id":9103409,"src":"web0028_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103409.html","width":160,"caption":"","height":85});
															thumbnails[9103416] = clik.newPhoto({"id":9103416,"src":"web0030_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103416.html","width":160,"caption":"","height":100});
															thumbnails[9103419] = clik.newPhoto({"id":9103419,"src":"web0034_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103419.html","width":160,"caption":"","height":107});
															thumbnails[9103423] = clik.newPhoto({"id":9103423,"src":"web0039_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103423.html","width":160,"caption":"","height":240});
															thumbnails[9103428] = clik.newPhoto({"id":9103428,"src":"web0050_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103428.html","width":160,"caption":"","height":107});
															thumbnails[9103434] = clik.newPhoto({"id":9103434,"src":"web0051_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103434.html","width":160,"caption":"","height":107});
															thumbnails[9103442] = clik.newPhoto({"id":9103442,"src":"web0053_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103442.html","width":160,"caption":"","height":107});
															thumbnails[9103459] = clik.newPhoto({"id":9103459,"src":"web0054_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103459.html","width":160,"caption":"","height":111});
															thumbnails[9103461] = clik.newPhoto({"id":9103461,"src":"web0057_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103461.html","width":160,"caption":"","height":51});
															thumbnails[9103463] = clik.newPhoto({"id":9103463,"src":"web0061_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103463.html","width":160,"caption":"","height":252});
															thumbnails[9103469] = clik.newPhoto({"id":9103469,"src":"web0091_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103469.html","width":160,"caption":"","height":107});
															thumbnails[9103476] = clik.newPhoto({"id":9103476,"src":"web0092_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103476.html","width":160,"caption":"","height":175});
															thumbnails[9103480] = clik.newPhoto({"id":9103480,"src":"web0096_1_thumb1_2.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103480.html","width":160,"caption":"","height":149});
															thumbnails[9103489] = clik.newPhoto({"id":9103489,"src":"web0097_1_thumb1_1.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103489.html","width":160,"caption":"","height":148});
															thumbnails[9103656] = clik.newPhoto({"id":9103656,"src":"web0098_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103656.html","width":160,"caption":"","height":225});
															thumbnails[9103659] = clik.newPhoto({"id":9103659,"src":"web0100_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103659.html","width":160,"caption":"","height":107});
															thumbnails[9103704] = clik.newPhoto({"id":9103704,"src":"web0101_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103704.html","width":160,"caption":"","height":187});
															thumbnails[9103707] = clik.newPhoto({"id":9103707,"src":"web0102_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103707.html","width":160,"caption":"","height":240});
															thumbnails[9103717] = clik.newPhoto({"id":9103717,"src":"web0104_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103717.html","width":160,"caption":"","height":106});
															thumbnails[9103743] = clik.newPhoto({"id":9103743,"src":"web0105_1_thumb.JPG","galleries_id":122474,"server_id":1,"link":"photo_9103743.html","width":160,"caption":"","height":125});
															thumbnails[9103753] = clik.newPhoto({"id":9103753,"src":"web0027_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103753.html","width":160,"caption":"","height":224});
															thumbnails[9103758] = clik.newPhoto({"id":9103758,"src":"web0031_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103758.html","width":160,"caption":"","height":240});
															thumbnails[9103759] = clik.newPhoto({"id":9103759,"src":"web0032_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103759.html","width":160,"caption":"","height":240});
															thumbnails[9103762] = clik.newPhoto({"id":9103762,"src":"web0033_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103762.html","width":160,"caption":"","height":240});
															thumbnails[9103770] = clik.newPhoto({"id":9103770,"src":"web0035_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103770.html","width":160,"caption":"","height":227});
															thumbnails[9103773] = clik.newPhoto({"id":9103773,"src":"web0036_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103773.html","width":160,"caption":"","height":227});
															thumbnails[9103775] = clik.newPhoto({"id":9103775,"src":"web0037_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103775.html","width":160,"caption":"","height":240});
															thumbnails[9103790] = clik.newPhoto({"id":9103790,"src":"web0038_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103790.html","width":160,"caption":"","height":240});
															thumbnails[9103793] = clik.newPhoto({"id":9103793,"src":"web0049_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103793.html","width":160,"caption":"","height":240});
															thumbnails[9103798] = clik.newPhoto({"id":9103798,"src":"web0052_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103798.html","width":160,"caption":"","height":107});
															thumbnails[9103805] = clik.newPhoto({"id":9103805,"src":"web0062_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103805.html","width":160,"caption":"","height":240});
															thumbnails[9103809] = clik.newPhoto({"id":9103809,"src":"web0063_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103809.html","width":160,"caption":"","height":240});
															thumbnails[9103811] = clik.newPhoto({"id":9103811,"src":"web0064_1_thumb1_1.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103811.html","width":160,"caption":"","height":162});
															thumbnails[9103835] = clik.newPhoto({"id":9103835,"src":"web0058_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9103835.html","width":160,"caption":"","height":107});
															thumbnails[9104521] = clik.newPhoto({"id":9104521,"src":"web0024_1_thumb.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104521.html","width":160,"caption":"","height":241});
															thumbnails[9104522] = clik.newPhoto({"id":9104522,"src":"web0029_1_thumb.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104522.html","width":160,"caption":"","height":107});
															thumbnails[9104523] = clik.newPhoto({"id":9104523,"src":"web0041_1_thumb1_1.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104523.html","width":160,"caption":"","height":153});
															thumbnails[9104524] = clik.newPhoto({"id":9104524,"src":"web0042_1_thumb1_1.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104524.html","width":160,"caption":"","height":152});
															thumbnails[9104527] = clik.newPhoto({"id":9104527,"src":"web0043_1_thumb.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104527.html","width":160,"caption":"","height":107});
															thumbnails[9104529] = clik.newPhoto({"id":9104529,"src":"web0044_1_thumb1_1.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104529.html","width":160,"caption":"","height":147});
															thumbnails[9104531] = clik.newPhoto({"id":9104531,"src":"web0045_1_thumb1_1.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104531.html","width":160,"caption":"","height":122});
															thumbnails[9104533] = clik.newPhoto({"id":9104533,"src":"web0046_1_thumb.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104533.html","width":160,"caption":"","height":142});
															thumbnails[9104534] = clik.newPhoto({"id":9104534,"src":"web0047_1_thumb1_1.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104534.html","width":160,"caption":"","height":128});
															thumbnails[9104535] = clik.newPhoto({"id":9104535,"src":"web0048_1_thumb1_1.JPG","galleries_id":460658,"server_id":1,"link":"photo_9104535.html","width":160,"caption":"","height":158});
															thumbnails[9104537] = clik.newPhoto({"id":9104537,"src":"web0014_1_thumb.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104537.html","width":160,"caption":"","height":107});
															thumbnails[9104539] = clik.newPhoto({"id":9104539,"src":"web0013_1_thumb.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104539.html","width":160,"caption":"","height":107});
															thumbnails[9104540] = clik.newPhoto({"id":9104540,"src":"web0017_1_thumb.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104540.html","width":160,"caption":"","height":107});
															thumbnails[9104548] = clik.newPhoto({"id":9104548,"src":"web0066_1_thumb.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104548.html","width":160,"caption":"","height":240});
															thumbnails[9104565] = clik.newPhoto({"id":9104565,"src":"web0055_1_thumb1_1.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104565.html","width":160,"caption":"","height":107});
															thumbnails[9104567] = clik.newPhoto({"id":9104567,"src":"web0056_1_thumb.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104567.html","width":160,"caption":"","height":107});
															thumbnails[9104571] = clik.newPhoto({"id":9104571,"src":"web0022_1_thumb.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104571.html","width":160,"caption":"","height":107});
															thumbnails[9104581] = clik.newPhoto({"id":9104581,"src":"web0021_1_thumb.JPG","galleries_id":390455,"server_id":1,"link":"photo_9104581.html","width":160,"caption":"","height":107});
															thumbnails[9104622] = clik.newPhoto({"id":9104622,"src":"web0068_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9104622.html","width":160,"caption":"","height":240});
															thumbnails[9104628] = clik.newPhoto({"id":9104628,"src":"web0072_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9104628.html","width":160,"caption":"","height":240});
															thumbnails[9104632] = clik.newPhoto({"id":9104632,"src":"web0073_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9104632.html","width":160,"caption":"","height":240});
															thumbnails[9104635] = clik.newPhoto({"id":9104635,"src":"web0075_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9104635.html","width":160,"caption":"","height":240});
															thumbnails[9104639] = clik.newPhoto({"id":9104639,"src":"web0076_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9104639.html","width":160,"caption":"","height":240});
															thumbnails[9104641] = clik.newPhoto({"id":9104641,"src":"web0079_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9104641.html","width":160,"caption":"","height":240});
															thumbnails[9104647] = clik.newPhoto({"id":9104647,"src":"web0081_1_thumb.JPG","galleries_id":390447,"server_id":1,"link":"photo_9104647.html","width":160,"caption":"","height":240});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[122474] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes and Nature","link":"gallery_122474.html","maxRecords":0.0,"photoIDs":[9103359.0,9103360.0,9103373.0,9103376.0,9103379.0,9103383.0,9103385.0,9103393.0,9103395.0,9103397.0,9103404.0,9103406.0,9103409.0,9103416.0,9103419.0,9103423.0,9103428.0,9103434.0,9103442.0,9103459.0,9103461.0,9103463.0,9103469.0,9103476.0,9103480.0,9103489.0,9103656.0,9103659.0,9103704.0,9103707.0,9103717.0,9103743.0],"skipIndex":0,"section_code":"gallery","featured_images":"9103743,9103717,9103707,9103704,9103659,9103656,9103489,9103480,9103476,9103469","id":122474,"singleSection":false});				  						galleries[390447] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits and People Shots","link":"gallery_390447.html","maxRecords":0.0,"photoIDs":[9103753.0,9103758.0,9103759.0,9103762.0,9103770.0,9103773.0,9103775.0,9103790.0,9103793.0,9103798.0,9103805.0,9103809.0,9103811.0,9103835.0,9104622.0,9104628.0,9104632.0,9104635.0,9104639.0,9104641.0,9104647.0],"skipIndex":0,"section_code":"gallery","featured_images":"9104647,9104641,9104639,9104635,9104632,9104628,9104622,9103835,9103811,9103809","id":390447,"singleSection":false});				  						galleries[390455] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Product Photography","link":"gallery_390455.html","maxRecords":0.0,"photoIDs":[9104537.0,9104539.0,9104540.0,9104548.0,9104565.0,9104567.0,9104571.0,9104581.0],"skipIndex":0,"section_code":"gallery","featured_images":"9104581,9104571,9104567,9104565,9104548,9104540,9104539,9104537","id":390455,"singleSection":false});				  						galleries[460658] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Interiors","link":"gallery_460658.html","maxRecords":0.0,"photoIDs":[9104521.0,9104522.0,9104523.0,9104524.0,9104527.0,9104529.0,9104531.0,9104533.0,9104534.0,9104535.0],"skipIndex":0,"section_code":"gallery","featured_images":"9104535,9104534,9104533,9104531,9104529,9104527,9104524,9104523,9104522,9104521","id":460658,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9104647,9104641,9104639,9104635,9104632,9104628,9104622,9104581,9104571,9104567,9104565,9104548,9104540,9104539,9104537,9104535,9104534,9104533,9104531,9104529,9104527,9104524,9104523,9104522,9104521,9103835,9103811,9103809,9103805,9103798,9103793,9103790,9103775,9103773,9103770,9103762,9103759,9103758,9103753,9103743,9103717,9103707,9103704,9103659,9103656,9103489,9103480,9103476,9103469,9103463';
imageSets[3] = '9104647,9104641,9104639,9104635,9104632,9104628,9104622,9104581,9104571,9104567,9104565,9104548,9104540,9104539,9104537,9104535,9104534,9104533,9104531,9104529,9104527,9104524,9104523,9104522,9104521,9103835,9103811,9103809,9103805,9103798,9103793,9103790,9103775,9103773,9103770,9103762,9103759,9103758,9103753,9103743,9103717,9103707,9103704,9103659,9103656,9103489,9103480,9103476,9103469,9103463';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/andybyars/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/andybyars/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/andybyars/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/andybyars/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/andybyars/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/andybyars/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/andybyars/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/andybyars/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 = 'andy byars 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.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> &pound;' + (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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="andrewjbyars@gmail.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="andrewjbyars@gmail.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

