window.thumbnails = {};
															thumbnails[771967] = clik.newPhoto({"id":771967,"src":"Reflection_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_771967.html","width":130,"caption":"Graphic Reflection","height":182});
															thumbnails[1194648] = clik.newPhoto({"id":1194648,"src":"AHelpingHand2_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1194648.html","width":130,"caption":"A Helping Hand","height":196});
															thumbnails[771983] = clik.newPhoto({"id":771983,"src":"FlowerGirl_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_771983.html","width":130,"caption":"Flower Girl","height":174});
															thumbnails[771981] = clik.newPhoto({"id":771981,"src":"BridesMaid_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_771981.html","width":130,"caption":"Brides Maid","height":157});
															thumbnails[772073] = clik.newPhoto({"id":772073,"src":"Bride&Maid_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772073.html","width":130,"caption":"Bride & Maid","height":191});
															thumbnails[772020] = clik.newPhoto({"id":772020,"src":"Arrival_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772020.html","width":130,"caption":"Arrival","height":164});
															thumbnails[772097] = clik.newPhoto({"id":772097,"src":"Bride2_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772097.html","width":130,"caption":"Bride 1","height":186});
															thumbnails[772152] = clik.newPhoto({"id":772152,"src":"FromTheBack_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772152.html","width":130,"caption":"From The Back","height":195});
															thumbnails[772125] = clik.newPhoto({"id":772125,"src":"Bride_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772125.html","width":130,"caption":"Bride 2","height":195});
															thumbnails[772139] = clik.newPhoto({"id":772139,"src":"FromTheLoft_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772139.html","width":130,"caption":"From The Loft","height":89});
															thumbnails[772154] = clik.newPhoto({"id":772154,"src":"Rings_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772154.html","width":130,"caption":"With This Ring","height":87});
															thumbnails[1197045] = clik.newPhoto({"id":1197045,"src":"The Ceremony_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1197045.html","width":130,"caption":"The Ceremony","height":87});
															thumbnails[1196742] = clik.newPhoto({"id":1196742,"src":"Casual Embrace_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1196742.html","width":130,"caption":"Casual Embrace","height":182});
															thumbnails[772551] = clik.newPhoto({"id":772551,"src":"BackLit1_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772551.html","width":130,"caption":"Back Lit","height":195});
															thumbnails[772227] = clik.newPhoto({"id":772227,"src":"LookingBackDoorway_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772227.html","width":130,"caption":"Looking Back","height":181});
															thumbnails[772246] = clik.newPhoto({"id":772246,"src":"BrideCloseUp_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772246.html","width":130,"caption":"Bride Close Up","height":93});
															thumbnails[772162] = clik.newPhoto({"id":772162,"src":"SigningRegister_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772162.html","width":130,"caption":"Signing Register","height":87});
															thumbnails[772243] = clik.newPhoto({"id":772243,"src":"BrideUnderTree_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772243.html","width":130,"caption":"Bride Under Tree","height":86});
															thumbnails[772241] = clik.newPhoto({"id":772241,"src":"BrideSmiling_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772241.html","width":130,"caption":"Bride Half Length","height":163});
															thumbnails[772288] = clik.newPhoto({"id":772288,"src":"Handshake_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772288.html","width":130,"caption":"Congratulations","height":195});
															thumbnails[772317] = clik.newPhoto({"id":772317,"src":"UnderTheArches_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772317.html","width":130,"caption":"Under The Arches","height":183});
															thumbnails[772271] = clik.newPhoto({"id":772271,"src":"JumpingUshers_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772271.html","width":130,"caption":"Jumping Ushers","height":87});
															thumbnails[772315] = clik.newPhoto({"id":772315,"src":"Peepo_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772315.html","width":130,"caption":"Peepo","height":98});
															thumbnails[772554] = clik.newPhoto({"id":772554,"src":"MaidsFlowers1_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772554.html","width":130,"caption":"Brides Maids Flowers","height":87});
															thumbnails[772304] = clik.newPhoto({"id":772304,"src":"Bride&GroomWall_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772304.html","width":130,"caption":"So In Love","height":181});
															thumbnails[772296] = clik.newPhoto({"id":772296,"src":"Bride&GroomCasual_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772296.html","width":130,"caption":"Bride & Groom Casual","height":162});
															thumbnails[772290] = clik.newPhoto({"id":772290,"src":"Bride&Groom_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772290.html","width":130,"caption":"Bride & Groom Formal","height":195});
															thumbnails[772306] = clik.newPhoto({"id":772306,"src":"LookingBack1_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772306.html","width":130,"caption":"Over The Shoulder","height":192});
															thumbnails[772300] = clik.newPhoto({"id":772300,"src":"Bride&GroomEmbracing_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772300.html","width":130,"caption":"Embracing","height":174});
															thumbnails[772310] = clik.newPhoto({"id":772310,"src":"NoseJob_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772310.html","width":130,"caption":"Nose Job","height":195});
															thumbnails[772293] = clik.newPhoto({"id":772293,"src":"Bride&GroomCanon_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772293.html","width":130,"caption":"Kissing","height":195});
															thumbnails[1197040] = clik.newPhoto({"id":1197040,"src":"Brides Bouquet_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1197040.html","width":130,"caption":"Brides Bouquet","height":196});
															thumbnails[772313] = clik.newPhoto({"id":772313,"src":"OnTheBeach_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772313.html","width":130,"caption":"On The Beach","height":195});
															thumbnails[772266] = clik.newPhoto({"id":772266,"src":"GroomButtonHole_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772266.html","width":130,"caption":"Button Hole","height":195});
															thumbnails[1197047] = clik.newPhoto({"id":1197047,"src":"The Rings_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1197047.html","width":130,"caption":"The Rings","height":159});
															thumbnails[772547] = clik.newPhoto({"id":772547,"src":"PoppingCork1_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_772547.html","width":130,"caption":"Popping The Cork","height":183});
															thumbnails[1197041] = clik.newPhoto({"id":1197041,"src":"For Ever & Ever_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1197041.html","width":130,"caption":"For Ever & Ever","height":196});
															thumbnails[1197043] = clik.newPhoto({"id":1197043,"src":"Sepia Setting_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1197043.html","width":130,"caption":"Sepia Setting","height":159});
															thumbnails[1197042] = clik.newPhoto({"id":1197042,"src":"Ready For Toasting_thumb.jpg","galleries_id":52875,"server_id":15,"link":"photo_1197042.html","width":130,"caption":"Ready For Toasting","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[52875] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery.html","maxRecords":0.0,"photoIDs":[771967.0,1194648.0,771983.0,771981.0,772073.0,772020.0,772097.0,772152.0,772125.0,772139.0,772154.0,1197045.0,1196742.0,772551.0,772227.0,772246.0,772162.0,772243.0,772241.0,772288.0,772317.0,772271.0,772315.0,772554.0,772304.0,772296.0,772290.0,772306.0,772300.0,772310.0,772293.0,1197040.0,772313.0,772266.0,1197047.0,772547.0,1197041.0,1197043.0,1197042.0],"skipIndex":0,"section_code":"gallery","featured_images":"1197045,1197042,1197041,1196742,1194648,772554,772551,772547,772317,772315,772313,772310,772306,772304,772300,772296,772293,772290,772288,772271,772266,772246,772243,772241,772227,772162,772154,772152,772139,772125,772097,772073,772020,771983,771981,771967","id":52875,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '1197042';
imageSets[2] = '771967,1194648,771983,771981,772073,772020,772097,772152,772125,772139,772154,1197045,1196742,772551,772227,772246,772162,772243,772241,772288,772317,772271,772315,772554,772304,772296,772290,772306,772300,772310,772293,772313,772266,772547,1197041,1197042';
imageSets[3] = '1197047,1197045,1197043,1197042,1197041,1197040,1196742,1194648,772554,772551,772547,772317,772315,772313,772310,772306,772304,772300,772296,772293,772290,772288,772271,772266,772246,772243,772241,772227,772162,772154,772152,772139,772125,772097,772073,772020,771983,771981,771967';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Jagercaster/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Jagercaster/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 = 'George Knights - Photography - U.K: ' + 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;
	}
}

			

