window.thumbnails = new Object();
												thumbnails[6842294] = new thumbnail(6842294,'371475','Concorde Lady','Joss_-_the_classic1_thumb.jpg',130, 87,5,'																			photo_6842294.html');
												thumbnails[6842434] = new thumbnail(6842434,'371476','Asteria, totally','Asteria_001_thumb.jpg',130, 174,5,'																			photo_6842434.html');
												thumbnails[6842488] = new thumbnail(6842488,'371487','Bethany','Bethany1sword_thumb.jpg',130, 128,5,'																			photo_6842488.html');
												thumbnails[6843186] = new thumbnail(6843186,'371484','Reservoir sheep','Reservoir_sheep-e_thumb.jpg',130, 46,5,'																			photo_6843186.html');
												thumbnails[6843337] = new thumbnail(6843337,'371482','Sarah','Sarah77-1_thumb.jpg',130, 175,5,'																			photo_6843337.html');
												thumbnails[6843341] = new thumbnail(6843341,'371476','Sarah in the woods','Sarah_in_the_woods_thumb.jpg',130, 166,5,'																			photo_6843341.html');
												thumbnails[6843369] = new thumbnail(6843369,'371486','Way out','Way_out_thumb.jpg',130, 194,5,'																			photo_6843369.html');
												thumbnails[6852248] = new thumbnail(6852248,'371476','Questioning look','Delta_BW002_thumb.jpg',130, 185,5,'																			photo_6852248.html');
												thumbnails[6852964] = new thumbnail(6852964,'371476','Clayre, lying','Clayre001_thumb.jpg',130, 89,5,'																			photo_6852964.html');
												thumbnails[6853045] = new thumbnail(6853045,'371480','Classic pose','Chloe_thumb.jpg',130, 106,5,'																			photo_6853045.html');
												thumbnails[6853118] = new thumbnail(6853118,'371480','Still and composed','Chloe_lith_thumb.jpg',130, 93,5,'																			photo_6853118.html');
												thumbnails[6853124] = new thumbnail(6853124,'371480','Abandon','Chloe_older_thumb.jpg',130, 103,5,'																			photo_6853124.html');
												thumbnails[6853244] = new thumbnail(6853244,'371482','Distant engagement','Clayre_thumb.jpg',130, 169,5,'																			photo_6853244.html');
												thumbnails[6853246] = new thumbnail(6853246,'371486','Up the stairs at the Museum','British_Museum_thumb.jpg',130, 192,5,'																			photo_6853246.html');
												thumbnails[6853348] = new thumbnail(6853348,'371476','Alexis - elegant cover','Alexis_thumb.jpg',130, 202,5,'																			photo_6853348.html');
												thumbnails[6853356] = new thumbnail(6853356,'371476','Reach upwards','Amy_thumb.jpg',130, 203,5,'																			photo_6853356.html');
												thumbnails[6854226] = new thumbnail(6854226,'371476','Despair','Angela_1_thumb.jpg',130, 180,5,'																			photo_6854226.html');
												thumbnails[6854249] = new thumbnail(6854249,'371483','Inez in harness','Inez_thumb.jpg',130, 214,5,'																			photo_6854249.html');
												thumbnails[6854250] = new thumbnail(6854250,'371483','Inez in shadow','Inez_002_thumb.jpg',130, 184,5,'																			photo_6854250.html');
												thumbnails[6854260] = new thumbnail(6854260,'372080','Stamp your heels!','Bethany_thumb.jpg',130, 220,5,'																			photo_6854260.html');
												thumbnails[6854302] = new thumbnail(6854302,'371482','A bit of a boob?','ScarlettC1_thumb.jpg',130, 192,5,'																			photo_6854302.html');
												thumbnails[6854798] = new thumbnail(6854798,'371487','Knife','Anastasia_2_thumb.jpg',130, 194,5,'																			photo_6854798.html');
												thumbnails[6855000] = new thumbnail(6855000,'371487','Multiple blades...','Anastasia_1_thumb.jpg',130, 169,5,'																			photo_6855000.html');
												thumbnails[7217553] = new thumbnail(7217553,'371485','Mawddach Estuary and Barmouth Bridge','Barmouth-final_thumb.jpg',130, 48,5,'																			photo_7217553.html');
												thumbnails[7217582] = new thumbnail(7217582,'371485','Mawddach stream','Mawddach-A_thumb.jpg',130, 339,5,'																			photo_7217582.html');
												thumbnails[7217585] = new thumbnail(7217585,'371485','The Knoll','Mawddach-B_thumb.jpg',130, 50,5,'																			photo_7217585.html');
												thumbnails[7217588] = new thumbnail(7217588,'371485','From the Knoll','Mawddach-C_thumb.jpg',130, 47,5,'																			photo_7217588.html');
												thumbnails[7217592] = new thumbnail(7217592,'371485','Mawddach from the Knoll','Mawddach-D_thumb.jpg',130, 359,5,'																			photo_7217592.html');
												thumbnails[7217620] = new thumbnail(7217620,'371476','Exercise ball','Kitty002_thumb.jpg',130, 173,5,'																			photo_7217620.html');
												thumbnails[7226241] = new thumbnail(7226241,'371476','Nwando','Nwando_thumb.jpg',130, 164,5,'																			photo_7226241.html');
												thumbnails[7395183] = new thumbnail(7395183,'371476','Lottie in infra-red','Lottie032_thumb.jpg',130, 191,5,'																			photo_7395183.html');
												thumbnails[7395188] = new thumbnail(7395188,'371476','Joy','Joy_BW_thumb.jpg',130, 95,5,'																			photo_7395188.html');
												thumbnails[7395192] = new thumbnail(7395192,'371476','Against the light','Ruby-R003_thumb.jpg',130, 195,5,'																			photo_7395192.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[371483] = new gallery(371483,'6854250,6854249','Alternative figure - neo-classical?','gallery',[6854249,6854250],0, 1, '', '																																																																																																							gallery_371483.html',0,0);
				  					galleries[371482] = new gallery(371482,'6854302,6853244,6843337','Alternative portraits','gallery',[6843337,6853244,6854302],0, 1, '', '																																																																																																							gallery_371482.html',0,0);
				  					galleries[371488] = new gallery(371488,'','Clay...','gallery',[],0, 1, '', '																																																																																																							gallery_371488.html',0,0);
				  					galleries[371484] = new gallery(371484,'6843186','Landscapes','gallery',[6843186],0, 1, '', '																																																																																																							gallery_371484.html',0,0);
				  					galleries[371485] = new gallery(371485,'7217592,7217588,7217585,7217582,7217553','Mawddach Estuary','gallery',[7217553,7217582,7217585,7217588,7217592],0, 1, '', '																																																																																																							gallery_371485.html',0,0);
				  					galleries[371486] = new gallery(371486,'6853246,6843369','Urban landscapes','gallery',[6843369,6853246],0, 1, '', '																																																																																																							gallery_371486.html',0,0);
				  					galleries[371487] = new gallery(371487,'6855000,6854798,6842488','Warrior princesses','gallery',[6842488,6854798,6855000],0, 1, '', '																																																																																																							gallery_371487.html',0,0);
				  					galleries[371475] = new gallery(371475,'6842294','Joceline','gallery',[6842294],0, 1, '', '																																																																																																							gallery_371475.html',0,0);
				  					galleries[371476] = new gallery(371476,'7395192,7395188,7395183,7226241,7217620,6854226,6853356,6853348,6852964,6852248','Classical figure','gallery',[6842434,6843341,6852248,6852964,6853348,6853356,6854226,7217620,7226241,7395183,7395188,7395192],0, 1, '', '																																																																																																							gallery_371476.html',0,0);
				  					galleries[371480] = new gallery(371480,'6853124,6853118,6853045','Chloe','gallery',[6853045,6853118,6853124],0, 1, '', '																																																																																																							gallery_371480.html',0,0);
				  					galleries[372080] = new gallery(372080,'6854260','Dance and elegance...','gallery',[6854260],0, 1, '', '																																																																																																							gallery_372080.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7395192,7395188,7395183,7226241,7217620,7217592,7217588,7217585,7217582,7217553,6855000,6854798,6854302,6854260,6854250,6854249,6854226,6853356,6853348,6853246,6853244,6853124,6853118,6853045,6852964,6852248,6843369,6843341,6843337,6843186,6842488,6842434,6842294';
imageSets[3] = '7395192,7395188,7395183,7226241,7217620,7217592,7217588,7217585,7217582,7217553,6855000,6854798,6854302,6854260,6854250,6854249,6854226,6853356,6853348,6853246,6853244,6853124,6853118,6853045,6852964,6852248,6843369,6843341,6843337,6843186,6842488,6842434,6842294';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/dudler/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/dudler/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/dudler/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/dudler/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/dudler/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/dudler/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Diplodocus Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 							' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

