window.thumbnails = {};
															thumbnails[1885033] = clik.newPhoto({"id":1885033,"src":"IMG_4056_thumb.JPG","galleries_id":234842,"server_id":18,"link":"photo_1885033.html","width":130,"caption":"","height":33});
															thumbnails[2180391] = clik.newPhoto({"id":2180391,"src":"IMG_0093_edited-1_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_2180391.html","width":130,"caption":"","height":80});
															thumbnails[2964403] = clik.newPhoto({"id":2964403,"src":"IMG_6647_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_2964403.html","width":87,"caption":"","height":130});
															thumbnails[2964405] = clik.newPhoto({"id":2964405,"src":"IMG_6556_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_2964405.html","width":87,"caption":"","height":130});
															thumbnails[3428911] = clik.newPhoto({"id":3428911,"src":"montage web version_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3428911.html","width":130,"caption":"","height":71});
															thumbnails[3428917] = clik.newPhoto({"id":3428917,"src":"first montage web ver_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3428917.html","width":130,"caption":"","height":71});
															thumbnails[3903043] = clik.newPhoto({"id":3903043,"src":"sophie2_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3903043.html","width":130,"caption":"","height":130});
															thumbnails[3903045] = clik.newPhoto({"id":3903045,"src":"sophie3_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3903045.html","width":104,"caption":"","height":130});
															thumbnails[3903101] = clik.newPhoto({"id":3903101,"src":"baby1_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3903101.html","width":130,"caption":"","height":130});
															thumbnails[3903103] = clik.newPhoto({"id":3903103,"src":"baby2_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3903103.html","width":104,"caption":"","height":130});
															thumbnails[3903152] = clik.newPhoto({"id":3903152,"src":"ben11_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3903152.html","width":130,"caption":"","height":65});
															thumbnails[3903160] = clik.newPhoto({"id":3903160,"src":"ben2_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_3903160.html","width":108,"caption":"","height":130});
															thumbnails[4947263] = clik.newPhoto({"id":4947263,"src":"louise2_thumb.gif","galleries_id":123162,"server_id":18,"link":"photo_4947263.html","width":130,"caption":"","height":100});
															thumbnails[4947270] = clik.newPhoto({"id":4947270,"src":"louise1_edited-1_thumb.gif","galleries_id":123162,"server_id":18,"link":"photo_4947270.html","width":130,"caption":"","height":126});
															thumbnails[4947271] = clik.newPhoto({"id":4947271,"src":"louise3_thumb.gif","galleries_id":123162,"server_id":18,"link":"photo_4947271.html","width":86,"caption":"","height":130});
															thumbnails[5410814] = clik.newPhoto({"id":5410814,"src":"commun3_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410814.html","width":79,"caption":"","height":130});
															thumbnails[5410819] = clik.newPhoto({"id":5410819,"src":"commun4_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410819.html","width":105,"caption":"","height":130});
															thumbnails[5410821] = clik.newPhoto({"id":5410821,"src":"commun5_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410821.html","width":105,"caption":"","height":130});
															thumbnails[5410823] = clik.newPhoto({"id":5410823,"src":"commun6_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410823.html","width":88,"caption":"","height":130});
															thumbnails[5410835] = clik.newPhoto({"id":5410835,"src":"commun7_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410835.html","width":88,"caption":"","height":130});
															thumbnails[5410837] = clik.newPhoto({"id":5410837,"src":"commun8_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410837.html","width":88,"caption":"","height":130});
															thumbnails[5410840] = clik.newPhoto({"id":5410840,"src":"commun9_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410840.html","width":87,"caption":"","height":130});
															thumbnails[5410846] = clik.newPhoto({"id":5410846,"src":"commun10_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410846.html","width":88,"caption":"","height":130});
															thumbnails[5410848] = clik.newPhoto({"id":5410848,"src":"commun11_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410848.html","width":130,"caption":"","height":88});
															thumbnails[5410854] = clik.newPhoto({"id":5410854,"src":"montage_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5410854.html","width":80,"caption":"","height":130});
															thumbnails[5411152] = clik.newPhoto({"id":5411152,"src":"por1_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5411152.html","width":90,"caption":"","height":130});
															thumbnails[5411157] = clik.newPhoto({"id":5411157,"src":"por2_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5411157.html","width":91,"caption":"","height":130});
															thumbnails[5411162] = clik.newPhoto({"id":5411162,"src":"por3a_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5411162.html","width":130,"caption":"","height":91});
															thumbnails[5411164] = clik.newPhoto({"id":5411164,"src":"por4_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5411164.html","width":130,"caption":"","height":90});
															thumbnails[5411182] = clik.newPhoto({"id":5411182,"src":"por8_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5411182.html","width":130,"caption":"","height":117});
															thumbnails[5412443] = clik.newPhoto({"id":5412443,"src":"fre1_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412443.html","width":130,"caption":"","height":88});
															thumbnails[5412447] = clik.newPhoto({"id":5412447,"src":"fre2_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412447.html","width":130,"caption":"","height":88});
															thumbnails[5412449] = clik.newPhoto({"id":5412449,"src":"fre3_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412449.html","width":130,"caption":"","height":88});
															thumbnails[5412461] = clik.newPhoto({"id":5412461,"src":"val1_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412461.html","width":85,"caption":"","height":130});
															thumbnails[5412473] = clik.newPhoto({"id":5412473,"src":"val2_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412473.html","width":91,"caption":"","height":130});
															thumbnails[5412475] = clik.newPhoto({"id":5412475,"src":"val3_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412475.html","width":89,"caption":"","height":130});
															thumbnails[5412481] = clik.newPhoto({"id":5412481,"src":"val4_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412481.html","width":89,"caption":"","height":130});
															thumbnails[5412486] = clik.newPhoto({"id":5412486,"src":"val5_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412486.html","width":89,"caption":"","height":130});
															thumbnails[5412488] = clik.newPhoto({"id":5412488,"src":"wed-a_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412488.html","width":104,"caption":"","height":130});
															thumbnails[5412491] = clik.newPhoto({"id":5412491,"src":"wed-b_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412491.html","width":100,"caption":"","height":130});
															thumbnails[5412494] = clik.newPhoto({"id":5412494,"src":"wed-c_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412494.html","width":116,"caption":"","height":130});
															thumbnails[5412496] = clik.newPhoto({"id":5412496,"src":"wed-d_thumb.jpg","galleries_id":123162,"server_id":18,"link":"photo_5412496.html","width":130,"caption":"","height":111});
															thumbnails[5412502] = clik.newPhoto({"id":5412502,"src":"port1_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5412502.html","width":130,"caption":"","height":114});
															thumbnails[5412506] = clik.newPhoto({"id":5412506,"src":"port2_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5412506.html","width":130,"caption":"","height":80});
															thumbnails[5412539] = clik.newPhoto({"id":5412539,"src":"port3_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5412539.html","width":130,"caption":"","height":88});
															thumbnails[5412547] = clik.newPhoto({"id":5412547,"src":"port4_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5412547.html","width":98,"caption":"","height":130});
															thumbnails[5412549] = clik.newPhoto({"id":5412549,"src":"port5_thumb.jpg","galleries_id":123164,"server_id":18,"link":"photo_5412549.html","width":130,"caption":"","height":90});
															thumbnails[5415560] = clik.newPhoto({"id":5415560,"src":"butt1_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_5415560.html","width":70,"caption":"","height":130});
															thumbnails[5415563] = clik.newPhoto({"id":5415563,"src":"butt2_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_5415563.html","width":94,"caption":"","height":130});
															thumbnails[5415565] = clik.newPhoto({"id":5415565,"src":"butt3_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_5415565.html","width":68,"caption":"","height":130});
															thumbnails[5415571] = clik.newPhoto({"id":5415571,"src":"mod1_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_5415571.html","width":130,"caption":"","height":114});
															thumbnails[5415572] = clik.newPhoto({"id":5415572,"src":"mod2_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_5415572.html","width":124,"caption":"","height":130});
															thumbnails[5415574] = clik.newPhoto({"id":5415574,"src":"mod3_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_5415574.html","width":121,"caption":"","height":130});
															thumbnails[5415578] = clik.newPhoto({"id":5415578,"src":"mod4_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_5415578.html","width":130,"caption":"","height":116});
															thumbnails[5459218] = clik.newPhoto({"id":5459218,"src":"emma1_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5459218.html","width":96,"caption":"","height":130});
															thumbnails[5459220] = clik.newPhoto({"id":5459220,"src":"emma2_thumb.jpg","galleries_id":305726,"server_id":18,"link":"photo_5459220.html","width":92,"caption":"","height":130});
															thumbnails[7362804] = clik.newPhoto({"id":7362804,"src":"2010_04_17_0030_edited-1_thumb.jpg","galleries_id":234842,"server_id":18,"link":"photo_7362804.html","width":97,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[123164] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraiture","link":"gallery_123164.html","maxRecords":0.0,"photoIDs":[3428911.0,3428917.0,3903043.0,3903045.0,3903101.0,3903103.0,3903152.0,3903160.0,5411152.0,5411157.0,5411162.0,5411164.0,5411182.0,5412502.0,5412506.0,5412539.0,5412547.0,5412549.0],"skipIndex":0,"section_code":"gallery","featured_images":"5412549,5412547,5412539,5412506,5412502,5411182,5411164,5411162,5411157,5411152","id":123164,"singleSection":false});				  						galleries[123162] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_123162.html","maxRecords":0.0,"photoIDs":[4947263.0,4947270.0,4947271.0,5412443.0,5412447.0,5412449.0,5412461.0,5412473.0,5412475.0,5412481.0,5412486.0,5412488.0,5412491.0,5412494.0,5412496.0],"skipIndex":0,"section_code":"gallery","featured_images":"5412496,5412494,5412491,5412488,5412486,5412481,5412475,5412473,5412461,5412449","id":123162,"singleSection":false});				  						galleries[305726] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Communion\/Confirmation","link":"gallery_305726.html","maxRecords":0.0,"photoIDs":[5410814.0,5410819.0,5410821.0,5410823.0,5410835.0,5410837.0,5410840.0,5410846.0,5410848.0,5410854.0,5459218.0,5459220.0],"skipIndex":0,"section_code":"gallery","featured_images":"5459220,5459218,5410854,5410848,5410846,5410840,5410837,5410835,5410823,5410821","id":305726,"singleSection":false});				  						galleries[234842] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Event Photography","link":"gallery_234842.html","maxRecords":0.0,"photoIDs":[1885033.0,2180391.0,2964403.0,2964405.0,5415560.0,5415563.0,5415565.0,5415571.0,5415572.0,5415574.0,5415578.0,7362804.0],"skipIndex":0,"section_code":"gallery","featured_images":"7362804,5415578,5415574,5415572,5415571,5415565,5415563,5415560,2964405,2964403","id":234842,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7362804,5459218,5412549,5412547,5412539,5412494,5412481,5410854,5410846,3903160,3903101,3903043,3428911';
imageSets[212335] = '4947271,4947270,4947263';
imageSets[3] = '4947271,4947270';
imageSets[212337] = '7362804';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/brianpatrick/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/brianpatrick/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 = 'Brian Patrick 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> &euro;' + (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="pmull@hotmail.com">';
					temp += '<input type="hidden" name="currency_code" value="EUR">';
					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="pmull@hotmail.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;
	}
}

			

