window.thumbnails = new Object();
												thumbnails[2857846] = new thumbnail(2857846,'','Enigma','enigma_thumb.jpg',130, 105,5,'							photo_2857846.html');
												thumbnails[3345731] = new thumbnail(3345731,'199566','','annexhib_thumb.jpg',130, 86,5,'							photo_3345731.html');
												thumbnails[3345735] = new thumbnail(3345735,'199566','','annaexhib2_thumb.jpg',130, 86,5,'							photo_3345735.html');
												thumbnails[3345748] = new thumbnail(3345748,'199566','','exhib3_thumb.jpg',130, 86,5,'							photo_3345748.html');
												thumbnails[3345751] = new thumbnail(3345751,'199566','','exhib4_thumb.jpg',130, 87,5,'							photo_3345751.html');
												thumbnails[3345759] = new thumbnail(3345759,'199566','','exhib5_thumb.jpg',130, 87,5,'							photo_3345759.html');
												thumbnails[3519050] = new thumbnail(3519050,'215451','I','1_thumb. I 120 x120 cm.jpg',130, 132,5,'							photo_3519050.html');
												thumbnails[3519053] = new thumbnail(3519053,'215451','II','2_thumb. II 70 x90 cm .jpg',130, 169,5,'							photo_3519053.html');
												thumbnails[3519065] = new thumbnail(3519065,'215451','III','3_thumb. III  120x153 cm.jpg',130, 103,5,'							photo_3519065.html');
												thumbnails[3519071] = new thumbnail(3519071,'215451','IV','4_thumb. IV 50 x50 cm.jpg',130, 129,5,'							photo_3519071.html');
												thumbnails[3519074] = new thumbnail(3519074,'215451','VI','6_thumb. VI 120 x120 cm.jpg',130, 129,5,'							photo_3519074.html');
												thumbnails[3519078] = new thumbnail(3519078,'215451','XII','12_thumb. XII  90X 90 CM .jpg',130, 128,5,'							photo_3519078.html');
												thumbnails[3519081] = new thumbnail(3519081,'215451','XVII','17_thumb. XVII 50 X50 CM .jpg',130, 138,5,'							photo_3519081.html');
												thumbnails[3520888] = new thumbnail(3520888,'215451','VIII','8_thumb. VIII 100 X100 CM .jpg',130, 130,5,'							photo_3520888.html');
												thumbnails[3643935] = new thumbnail(3643935,'222739','','345pm_50x50cm_thumb.jpg',130, 131,5,'							photo_3643935.html');
												thumbnails[3850758] = new thumbnail(3850758,'','','054__MG_7945_thumb.jpg',130, 116,5,'							photo_3850758.html');
												thumbnails[3858936] = new thumbnail(3858936,'','','_MG_7908_thumb.jpg',130, 86,5,'							photo_3858936.html');
												thumbnails[5223605] = new thumbnail(5223605,'','','_AC09746_thumb.jpg',130, 194,5,'							photo_5223605.html');
												thumbnails[5483534] = new thumbnail(5483534,'310302','9.55 a.m','64208661_thumb.jpg',130, 128,5,'							photo_5483534.html');
												thumbnails[5483544] = new thumbnail(5483544,'310302','Crushed opal detail','64208866-7ea1c39311cbe4f95df9c6e0399c33844b718200-scaled_thumb.jpg',130, 118,5,'							photo_5483544.html');
												thumbnails[3645489] = new thumbnail(3645489,'222739','','DSC_0680_thumb.JPG',130, 128,5,'							photo_3645489.html');
												thumbnails[3645499] = new thumbnail(3645499,'222739','','DSC_0687_thumb.JPG',130, 133,5,'							photo_3645499.html');
												thumbnails[7111098] = new thumbnail(7111098,'384654','','DSC_0224_thumb.jpg',130, 161,5,'							photo_7111098.html');
												thumbnails[7111102] = new thumbnail(7111102,'384654','','DSC_02201_thumb.jpg',130, 87,5,'							photo_7111102.html');
												thumbnails[3645520] = new thumbnail(3645520,'222739','','DSC_0704_thumb.JPG',130, 130,5,'							photo_3645520.html');
												thumbnails[7111097] = new thumbnail(7111097,'384654','','DSC_0218_thumb.jpg',130, 87,5,'							photo_7111097.html');
												thumbnails[3645528] = new thumbnail(3645528,'222739','','DSC_0708_thumb.JPG',130, 133,5,'							photo_3645528.html');
												thumbnails[7111095] = new thumbnail(7111095,'384654','','DSC_1423_thumb.jpg',130, 128,5,'							photo_7111095.html');
												thumbnails[3645530] = new thumbnail(3645530,'222739','','DSC_0711_thumb.JPG',130, 130,5,'							photo_3645530.html');
												thumbnails[7111091] = new thumbnail(7111091,'384654','','DSC_0223_thumb.jpg',130, 97,5,'							photo_7111091.html');
												thumbnails[3645533] = new thumbnail(3645533,'222739','','DSC_0715_thumb.JPG',130, 128,5,'							photo_3645533.html');
												thumbnails[7111093] = new thumbnail(7111093,'384654','','DSC_0227_thumb.jpg',130, 87,5,'							photo_7111093.html');
												thumbnails[3645792] = new thumbnail(3645792,'222739','','DSC_0053_thumb.JPG',130, 106,5,'							photo_3645792.html');
												thumbnails[3643933] = new thumbnail(3643933,'222739','','_Bring_me_back__100x100cm_thumb.jpg',130, 131,5,'							photo_3643933.html');
												thumbnails[3645472] = new thumbnail(3645472,'222739','','DSC_0676_thumb.JPG',130, 129,5,'							photo_3645472.html');
												thumbnails[3645482] = new thumbnail(3645482,'222739','','DSC_0678_thumb.JPG',130, 128,5,'							photo_3645482.html');
												thumbnails[3645509] = new thumbnail(3645509,'222739','','DSC_0691_thumb.JPG',130, 98,5,'							photo_3645509.html');
												thumbnails[3645516] = new thumbnail(3645516,'222739','','DSC_06961_thumb.JPG',130, 170,5,'							photo_3645516.html');
												thumbnails[3645522] = new thumbnail(3645522,'222739','','DSC_0707_thumb.JPG',130, 126,5,'							photo_3645522.html');
												thumbnails[3645513] = new thumbnail(3645513,'222739','','DSC_0693_thumb.JPG',130, 129,5,'							photo_3645513.html');
												thumbnails[3646279] = new thumbnail(3646279,'222739','','green50x50cm_thumb.jpg',130, 128,5,'							photo_3646279.html');
												thumbnails[3646295] = new thumbnail(3646295,'222739','','30X24CM_thumb.jpg',130, 102,5,'							photo_3646295.html');
												thumbnails[3646305] = new thumbnail(3646305,'222739','','30x30cmred_thumb.jpg',130, 127,5,'							photo_3646305.html');
												thumbnails[3646321] = new thumbnail(3646321,'222739','','xx130x30cm_thumb.jpg',130, 126,5,'							photo_3646321.html');
												thumbnails[3646400] = new thumbnail(3646400,'222739','','VII_90_X90_CM_thumb.jpg',130, 128,5,'							photo_3646400.html');
												thumbnails[5223649] = new thumbnail(5223649,'172536','3.45AM','image_thumb.jpg',130, 156,5,'							photo_5223649.html');
												thumbnails[2748406] = new thumbnail(2748406,'172536','9.27am','orgasm6_thumb.jpg',130, 134,5,'							photo_2748406.html');
												thumbnails[2856945] = new thumbnail(2856945,'172536','Euphoria','euphora_thumb.jpg',130, 138,5,'							photo_2856945.html');
												thumbnails[2747226] = new thumbnail(2747226,'172536','1.55pm','orgasm4_thumb.jpg',130, 127,5,'							photo_2747226.html');
												thumbnails[2856753] = new thumbnail(2856753,'172536','Remora','remora_thumb.jpg',130, 132,5,'							photo_2856753.html');
												thumbnails[2748425] = new thumbnail(2748425,'172536','Pegasus','Little_Pegasus_thumb.jpg',130, 132,5,'							photo_2748425.html');
												thumbnails[2856863] = new thumbnail(2856863,'172536','St Mary\'s Garden','stmarysgarden_thumb.jpg',130, 132,5,'							photo_2856863.html');
												thumbnails[2856922] = new thumbnail(2856922,'172536','Heading Home','headinghome_thumb.jpg',130, 132,5,'							photo_2856922.html');
												thumbnails[2747220] = new thumbnail(2747220,'172536','3.55pm<br>\r\n','1452846496_l_thumb.jpg',130, 129,5,'							photo_2747220.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[199566] = new gallery(199566,'3345759,3345751,3345748,3345735,3345731','\'Angels Fall First\' at Tal-Pilar Church','section352234',[3345731,3345735,3345748,3345751,3345759],0, 1, '', '																																																																																																							section352234_199566.html',0,0);
				  					galleries[384654] = new gallery(384654,'7111102,7111098,7111097,7111095,7111093,7111091','\'Come as I am\' at Doyle Devere ','section352234',[7111098,7111102,7111097,7111095,7111091,7111093],0, 1, '', '																																																																																																							section352234_384654.html',0,0);
				  					galleries[215451] = new gallery(215451,'3520888,3519081,3519078,3519074,3519071,3519065,3519053,3519050','\'Union of the Senses\'','gallery',[3519050,3519053,3519065,3519071,3519074,3519078,3519081,3520888],0, 0, '', '																																																																																																							gallery_215451.html',0,0);
				  					galleries[310302] = new gallery(310302,'5483544,5483534','Haiti Fundraising Auction','gallery',[5483534,5483544],0, 0, '', '																																																																																																							gallery_310302.html',0,0);
				  					galleries[222739] = new gallery(222739,'3646400,3646321,3646305,3646295,3646279,3645792,3645533,3645530,3645528,3645522','Paintings currently in stock','gallery',[3643935,3645489,3645499,3645520,3645528,3645530,3645533,3645792,3643933,3645472,3645482,3645509,3645516,3645522,3645513,3646279,3646295,3646305,3646321,3646400],0, 0, '', '																																																																																																							gallery_222739.html',0,0);
				  					galleries[172536] = new gallery(172536,'5223649,2856945,2856922,2856863,2856753,2748425,2748406,2747226,2747220','Recently Sold','gallery',[5223649,2748406,2856945,2747226,2856753,2748425,2856863,2856922,2747220],0, 0, '', '																																																																																																							gallery_172536.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '2748406,2747226,2747220';
imageSets[2] = '3858936';
imageSets[3] = '7111102,7111098,7111097,7111095,7111093,7111091,5483544,5483534,5223649,5223605,3858936,3850758,3646400,3646321,3646305,3646295,3646279,3645792,3645533,3645530,3645528,3645522,3645520,3645516,3645513,3645509,3645499,3645489,3645482,3645472,3643935,3643933,3520888,3519081,3519078,3519074,3519071,3519065,3519053,3519050,3345759,3345751,3345748,3345735,3345731,2857846,2856945,2856922,2856863,2856753';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/jenya09/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/jenya09/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/jenya09/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/jenya09/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/jenya09/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/jenya09/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 = 'Anna Nightingale Contemporary Art: ' + 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;
	}
}

			

