window.thumbnails = {};
thumbnails[8685402] = clik.newPhoto({"link":"photo_8685402.html","caption":"","height":87,"id":8685402,"server_id":31,"src":"_DSC0525_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685403] = clik.newPhoto({"link":"photo_8685403.html","caption":"","height":87,"id":8685403,"server_id":31,"src":"_DSC2721_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685404] = clik.newPhoto({"link":"photo_8685404.html","caption":"","height":87,"id":8685404,"server_id":31,"src":"_DSC2773_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685405] = clik.newPhoto({"link":"photo_8685405.html","caption":"","height":87,"id":8685405,"server_id":31,"src":"DSC_0605_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685406] = clik.newPhoto({"link":"photo_8685406.html","caption":"","height":87,"id":8685406,"server_id":31,"src":"DSC_0945_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685407] = clik.newPhoto({"link":"photo_8685407.html","caption":"","height":87,"id":8685407,"server_id":31,"src":"DSC_1082_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685408] = clik.newPhoto({"link":"photo_8685408.html","caption":"","height":87,"id":8685408,"server_id":31,"src":"_DSC1027_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685409] = clik.newPhoto({"link":"photo_8685409.html","caption":"","height":87,"id":8685409,"server_id":31,"src":"_DSC1047_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685410] = clik.newPhoto({"link":"photo_8685410.html","caption":"","height":87,"id":8685410,"server_id":31,"src":"_DSC1057_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685411] = clik.newPhoto({"link":"photo_8685411.html","caption":"","height":87,"id":8685411,"server_id":31,"src":"_DSC1064_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685412] = clik.newPhoto({"link":"photo_8685412.html","caption":"","height":87,"id":8685412,"server_id":31,"src":"_DSC1134_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685413] = clik.newPhoto({"link":"photo_8685413.html","caption":"","height":87,"id":8685413,"server_id":31,"src":"_DSC1135_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685414] = clik.newPhoto({"link":"photo_8685414.html","caption":"","height":87,"id":8685414,"server_id":31,"src":"DSC_1157_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685415] = clik.newPhoto({"link":"photo_8685415.html","caption":"","height":87,"id":8685415,"server_id":31,"src":"DSC_1234_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685416] = clik.newPhoto({"link":"photo_8685416.html","caption":"","height":87,"id":8685416,"server_id":31,"src":"DSC_1266_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685417] = clik.newPhoto({"link":"photo_8685417.html","caption":"","height":87,"id":8685417,"server_id":31,"src":"DSC_1533_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8685418] = clik.newPhoto({"link":"photo_8685418.html","caption":"","height":71,"id":8685418,"server_id":31,"src":"Tulips_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8686974] = clik.newPhoto({"link":"photo_8686974.html","caption":"","height":87,"id":8686974,"server_id":31,"src":"_DSC0163_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8686982] = clik.newPhoto({"link":"photo_8686982.html","caption":"","height":87,"id":8686982,"server_id":31,"src":"Forest_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8686983] = clik.newPhoto({"link":"photo_8686983.html","caption":"","height":130,"id":8686983,"server_id":31,"src":"Tree_thumb.jpg","galleries_id":458254,"width":87});
thumbnails[8686990] = clik.newPhoto({"link":"photo_8686990.html","caption":"","height":87,"id":8686990,"server_id":31,"src":"Trees1_thumb.jpg","galleries_id":458254,"width":130});
thumbnails[8686992] = clik.newPhoto({"link":"photo_8686992.html","caption":"","height":130,"id":8686992,"server_id":31,"src":"Waterfall_thumb.jpg","galleries_id":458254,"width":86});
thumbnails[8692539] = clik.newPhoto({"link":"photo_8692539.html","caption":"","height":119,"id":8692539,"server_id":31,"src":"DSC_0086_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692543] = clik.newPhoto({"link":"photo_8692543.html","caption":"","height":126,"id":8692543,"server_id":31,"src":"DSC_0140_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692546] = clik.newPhoto({"link":"photo_8692546.html","caption":"","height":89,"id":8692546,"server_id":31,"src":"DSC_6920_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692548] = clik.newPhoto({"link":"photo_8692548.html","caption":"","height":194,"id":8692548,"server_id":31,"src":"DSC_1288_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692550] = clik.newPhoto({"link":"photo_8692550.html","caption":"","height":186,"id":8692550,"server_id":31,"src":"DSC_4124_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692552] = clik.newPhoto({"link":"photo_8692552.html","caption":"","height":174,"id":8692552,"server_id":31,"src":"DSC_0625_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692554] = clik.newPhoto({"link":"photo_8692554.html","caption":"","height":194,"id":8692554,"server_id":31,"src":"DSC_7116_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692558] = clik.newPhoto({"link":"photo_8692558.html","caption":"","height":188,"id":8692558,"server_id":31,"src":"Indian1_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692559] = clik.newPhoto({"link":"photo_8692559.html","caption":"","height":194,"id":8692559,"server_id":31,"src":"MidasTouch_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8692562] = clik.newPhoto({"link":"photo_8692562.html","caption":"","height":194,"id":8692562,"server_id":31,"src":"Eyes_right_thumb.jpg","galleries_id":457922,"width":130});
thumbnails[8684296] = clik.newPhoto({"link":"photo_8684296.html","caption":"","height":105,"id":8684296,"server_id":31,"src":"DSC_00615_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684408] = clik.newPhoto({"link":"photo_8684408.html","caption":"","height":77,"id":8684408,"server_id":31,"src":"DSC_01122_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684410] = clik.newPhoto({"link":"photo_8684410.html","caption":"","height":105,"id":8684410,"server_id":31,"src":"DSC_0114_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684412] = clik.newPhoto({"link":"photo_8684412.html","caption":"","height":130,"id":8684412,"server_id":31,"src":"DSC_0161_thumb.jpg","galleries_id":457921,"width":86});
thumbnails[8684407] = clik.newPhoto({"link":"photo_8684407.html","caption":"","height":130,"id":8684407,"server_id":31,"src":"DSC_1001_thumb.jpg","galleries_id":457921,"width":87});
thumbnails[8684413] = clik.newPhoto({"link":"photo_8684413.html","caption":"","height":103,"id":8684413,"server_id":31,"src":"DSC_1455_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684414] = clik.newPhoto({"link":"photo_8684414.html","caption":"","height":124,"id":8684414,"server_id":31,"src":"DSC_1467_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684415] = clik.newPhoto({"link":"photo_8684415.html","caption":"","height":130,"id":8684415,"server_id":31,"src":"DSC_6114_thumb.jpg","galleries_id":457921,"width":87});
thumbnails[8684420] = clik.newPhoto({"link":"photo_8684420.html","caption":"","height":111,"id":8684420,"server_id":31,"src":"DSC_6119_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684421] = clik.newPhoto({"link":"photo_8684421.html","caption":"","height":85,"id":8684421,"server_id":31,"src":"DSC_6897_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684423] = clik.newPhoto({"link":"photo_8684423.html","caption":"","height":88,"id":8684423,"server_id":31,"src":"DSC_6910_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684424] = clik.newPhoto({"link":"photo_8684424.html","caption":"","height":88,"id":8684424,"server_id":31,"src":"DSC_7074_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684426] = clik.newPhoto({"link":"photo_8684426.html","caption":"","height":130,"id":8684426,"server_id":31,"src":"DSC_7086_thumb.jpg","galleries_id":457921,"width":87});
thumbnails[8684428] = clik.newPhoto({"link":"photo_8684428.html","caption":"","height":71,"id":8684428,"server_id":31,"src":"DSC_7093_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684429] = clik.newPhoto({"link":"photo_8684429.html","caption":"","height":92,"id":8684429,"server_id":31,"src":"DSC_7113_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684430] = clik.newPhoto({"link":"photo_8684430.html","caption":"","height":130,"id":8684430,"server_id":31,"src":"DSC_7135_thumb.jpg","galleries_id":457921,"width":70});
thumbnails[8684431] = clik.newPhoto({"link":"photo_8684431.html","caption":"","height":130,"id":8684431,"server_id":31,"src":"DSC_7153_thumb.jpg","galleries_id":457921,"width":79});
thumbnails[8684294] = clik.newPhoto({"link":"photo_8684294.html","caption":"","height":94,"id":8684294,"server_id":31,"src":"_DSC01872_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684343] = clik.newPhoto({"link":"photo_8684343.html","caption":"","height":130,"id":8684343,"server_id":31,"src":"_DSC02101_thumb.jpg","galleries_id":457921,"width":96});
thumbnails[8684344] = clik.newPhoto({"link":"photo_8684344.html","caption":"","height":75,"id":8684344,"server_id":31,"src":"_DSC0580_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684345] = clik.newPhoto({"link":"photo_8684345.html","caption":"","height":130,"id":8684345,"server_id":31,"src":"_DSC0584_thumb.jpg","galleries_id":457921,"width":84});
thumbnails[8685401] = clik.newPhoto({"link":"photo_8685401.html","caption":"","height":130,"id":8685401,"server_id":31,"src":"_DSC0597_thumb.jpg","galleries_id":457921,"width":87});
thumbnails[8684347] = clik.newPhoto({"link":"photo_8684347.html","caption":"","height":88,"id":8684347,"server_id":31,"src":"_DSC0600_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684348] = clik.newPhoto({"link":"photo_8684348.html","caption":"","height":87,"id":8684348,"server_id":31,"src":"_DSC0652_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684349] = clik.newPhoto({"link":"photo_8684349.html","caption":"","height":92,"id":8684349,"server_id":31,"src":"_DSC0660_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684350] = clik.newPhoto({"link":"photo_8684350.html","caption":"","height":130,"id":8684350,"server_id":31,"src":"_DSC0667_thumb.jpg","galleries_id":457921,"width":79});
thumbnails[8684351] = clik.newPhoto({"link":"photo_8684351.html","caption":"","height":130,"id":8684351,"server_id":31,"src":"_DSC0757_thumb.jpg","galleries_id":457921,"width":83});
thumbnails[8684353] = clik.newPhoto({"link":"photo_8684353.html","caption":"","height":130,"id":8684353,"server_id":31,"src":"_DSC0800_thumb.jpg","galleries_id":457921,"width":94});
thumbnails[8684354] = clik.newPhoto({"link":"photo_8684354.html","caption":"","height":86,"id":8684354,"server_id":31,"src":"_DSC0810_thumb.jpg","galleries_id":457921,"width":130});
thumbnails[8684355] = clik.newPhoto({"link":"photo_8684355.html","caption":"","height":130,"id":8684355,"server_id":31,"src":"_DSC0829_thumb.jpg","galleries_id":457921,"width":80});
thumbnails[8684356] = clik.newPhoto({"link":"photo_8684356.html","caption":"","height":130,"id":8684356,"server_id":31,"src":"_DSC0947_thumb.jpg","galleries_id":457921,"width":63});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[457921] = clik.newGallery({"photoIDs":[8684296,8684408,8684410,8684412,8684407,8684413,8684414,8684415,8684420,8684421,8684423,8684424,8684426,8684428,8684429,8684430,8684431,8684294,8684343,8684344,8684345,8685401,8684347,8684348,8684349,8684350,8684351,8684353,8684354,8684355,8684356],"link":"gallery_457921.html","skipIndex":0,"section_code":"gallery","id":457921,"parentGallery":"","featured_images":"8685401,8684431,8684430,8684429,8684428,8684426,8684424,8684423,8684421,8684420","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Weddings"});galleries[457922] = clik.newGallery({"photoIDs":[8692539,8692543,8692546,8692548,8692550,8692552,8692554,8692558,8692559,8692562],"link":"gallery_457922.html","skipIndex":0,"section_code":"gallery","id":457922,"parentGallery":"","featured_images":"8692562,8692559,8692558,8692554,8692552,8692550,8692548,8692546,8692543,8692539","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Portraits"});galleries[458254] = clik.newGallery({"photoIDs":[8685402,8685403,8685404,8685405,8685406,8685407,8685408,8685409,8685410,8685411,8685412,8685413,8685414,8685415,8685416,8685417,8685418,8686974,8686982,8686983,8686990,8686992],"link":"gallery_458254.html","skipIndex":0,"section_code":"gallery","id":458254,"parentGallery":"","featured_images":"8686992,8686990,8686983,8686982,8686974,8685418,8685417,8685416,8685415,8685414","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Landscape and Fine Art"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '8692562,8692559,8692558,8692554,8692552,8692550,8692548,8692546,8692543,8692539,8686992,8686990,8686983,8686982,8686974,8685418,8685417,8685416,8685415,8685414,8685413,8685412,8685411,8685410,8685409,8685408,8685407,8685406,8685405,8685404,8685403,8685402,8685401,8684431,8684430,8684429,8684428,8684426,8684424,8684423,8684421,8684420,8684415,8684414,8684413,8684412,8684410,8684408,8684407,8684356';
imageSets[1] = '8692562,8692559,8692558,8692554,8692552,8692550,8692548,8692546,8692543,8692539,8686992,8686990,8686983,8686982,8686974,8685418,8685417,8685416,8685415,8685414,8685413,8685412,8685411,8685410,8685409,8685408,8685407,8685406,8685405,8685404,8685403,8685402,8685401,8684431,8684430,8684429,8684428,8684426,8684424,8684423,8684421,8684420,8684415,8684414,8684413,8684412,8684410,8684408,8684407,8684356';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/markrupps/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/markrupps/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/markrupps/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/markrupps/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/markrupps/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/markrupps/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/markrupps/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 += '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 = 'pmr images: ' + 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.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({					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;
	}
}

		

