window.thumbnails = {};
															thumbnails[7150202] = clik.newPhoto({"id":7150202,"src":"20090130-IMGP0125_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150202.html","width":130,"caption":"","height":96});
															thumbnails[7150214] = clik.newPhoto({"id":7150214,"src":"20090130-IMGP0322_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150214.html","width":130,"caption":"","height":196});
															thumbnails[7150216] = clik.newPhoto({"id":7150216,"src":"20090225-D20_0916_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150216.html","width":130,"caption":"","height":130});
															thumbnails[7150219] = clik.newPhoto({"id":7150219,"src":"20090412-IMGP3196_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150219.html","width":130,"caption":"","height":88});
															thumbnails[7150221] = clik.newPhoto({"id":7150221,"src":"20090412-IMGP3468_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150221.html","width":130,"caption":"","height":174});
															thumbnails[7150224] = clik.newPhoto({"id":7150224,"src":"2886535351_4b6efae2a1_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150224.html","width":130,"caption":"","height":87});
															thumbnails[7150228] = clik.newPhoto({"id":7150228,"src":"3848946743_8f7a8af565_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150228.html","width":130,"caption":"","height":86});
															thumbnails[7150229] = clik.newPhoto({"id":7150229,"src":"3849684294_a5a9a338ed_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150229.html","width":130,"caption":"","height":86});
															thumbnails[7150233] = clik.newPhoto({"id":7150233,"src":"3950395036_693df05223_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150233.html","width":130,"caption":"","height":86});
															thumbnails[7150236] = clik.newPhoto({"id":7150236,"src":"3950395238_469c77bca2_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150236.html","width":130,"caption":"","height":187});
															thumbnails[7150240] = clik.newPhoto({"id":7150240,"src":"4152983208_86ac1f848a_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150240.html","width":130,"caption":"","height":86});
															thumbnails[7150242] = clik.newPhoto({"id":7150242,"src":"4199615881_21fbacb673_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150242.html","width":130,"caption":"","height":119});
															thumbnails[7150244] = clik.newPhoto({"id":7150244,"src":"4199753629_b9bbe3a310_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150244.html","width":130,"caption":"","height":196});
															thumbnails[7150247] = clik.newPhoto({"id":7150247,"src":"4199814983_f0464b5988_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150247.html","width":130,"caption":"","height":86});
															thumbnails[7150248] = clik.newPhoto({"id":7150248,"src":"4200371530_cde21c952a_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150248.html","width":130,"caption":"","height":86});
															thumbnails[7150251] = clik.newPhoto({"id":7150251,"src":"4200568046_08daf8ee93_o_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150251.html","width":130,"caption":"","height":86});
															thumbnails[7150271] = clik.newPhoto({"id":7150271,"src":"CI-6_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150271.html","width":130,"caption":"","height":66});
															thumbnails[7150272] = clik.newPhoto({"id":7150272,"src":"CI-85_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150272.html","width":130,"caption":"","height":196});
															thumbnails[7150273] = clik.newPhoto({"id":7150273,"src":"CI-102_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150273.html","width":130,"caption":"","height":86});
															thumbnails[7150275] = clik.newPhoto({"id":7150275,"src":"CLaire__Damien_-38_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150275.html","width":130,"caption":"","height":86});
															thumbnails[7150276] = clik.newPhoto({"id":7150276,"src":"CLaire__Damien_-85_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150276.html","width":130,"caption":"","height":86});
															thumbnails[7150277] = clik.newPhoto({"id":7150277,"src":"CLaire__Damien_-104_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150277.html","width":130,"caption":"","height":86});
															thumbnails[7150279] = clik.newPhoto({"id":7150279,"src":"Collinsimages-18_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150279.html","width":130,"caption":"","height":86});
															thumbnails[7150280] = clik.newPhoto({"id":7150280,"src":"Collinsimages-34_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150280.html","width":130,"caption":"","height":86});
															thumbnails[7150281] = clik.newPhoto({"id":7150281,"src":"Karen__Damien-74_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150281.html","width":130,"caption":"","height":130});
															thumbnails[7150282] = clik.newPhoto({"id":7150282,"src":"Karen__Damien-251_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150282.html","width":130,"caption":"","height":196});
															thumbnails[7150283] = clik.newPhoto({"id":7150283,"src":"Karen__Damien-261_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150283.html","width":130,"caption":"","height":86});
															thumbnails[7150285] = clik.newPhoto({"id":7150285,"src":"Karen__Damien-282_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150285.html","width":130,"caption":"","height":86});
															thumbnails[7150288] = clik.newPhoto({"id":7150288,"src":"Karen__Damien-299_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150288.html","width":130,"caption":"","height":86});
															thumbnails[7150293] = clik.newPhoto({"id":7150293,"src":"Karen__Damien-323_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150293.html","width":130,"caption":"","height":196});
															thumbnails[7150295] = clik.newPhoto({"id":7150295,"src":"Michelle__Brad_-101_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150295.html","width":130,"caption":"","height":86});
															thumbnails[7150297] = clik.newPhoto({"id":7150297,"src":"Susie__Steve-64_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150297.html","width":130,"caption":"","height":86});
															thumbnails[7150299] = clik.newPhoto({"id":7150299,"src":"Susie__Steve-70_thumb.jpg","galleries_id":181461,"server_id":1,"link":"photo_7150299.html","width":130,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[181461] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding","link":"gallery_181461.html","maxRecords":0.0,"photoIDs":[7150202.0,7150214.0,7150216.0,7150219.0,7150221.0,7150224.0,7150228.0,7150229.0,7150233.0,7150236.0,7150240.0,7150242.0,7150244.0,7150247.0,7150248.0,7150251.0,7150271.0,7150272.0,7150273.0,7150275.0,7150276.0,7150277.0,7150279.0,7150280.0,7150281.0,7150282.0,7150283.0,7150285.0,7150288.0,7150293.0,7150295.0,7150297.0,7150299.0],"skipIndex":0,"section_code":"gallery","featured_images":"7150299,7150297,7150295,7150293,7150288,7150285,7150283,7150282,7150281,7150280","id":181461,"singleSection":false});				  						galleries[181462] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portrait","link":"gallery_181462.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":181462,"singleSection":false});				  						galleries[187814] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Glamour","link":"gallery_187814.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":187814,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7150299,7150297,7150295,7150293,7150288,7150285,7150283,7150282,7150281,7150280,7150279,7150277,7150276,7150275,7150273,7150272,7150271,7150251,7150248,7150247,7150244,7150242,7150240,7150236,7150233,7150229,7150228,7150224,7150221,7150219,7150216,7150214,7150202';
imageSets[3] = '7150299,7150297,7150295,7150293,7150288,7150285,7150283,7150282,7150281,7150280,7150279,7150277,7150276,7150275,7150273,7150272,7150271,7150251,7150248,7150247,7150244,7150242,7150240,7150236,7150233,7150229,7150228,7150224,7150221,7150219,7150216,7150214,7150202';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/glenncollins/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/glenncollins/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 = 'Www.Collinsimages.me.uk: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

