window.thumbnails = new Object();
												thumbnails[6396203] = new thumbnail(6396203,'','Me','portrait_thumb.jpg',130, 175,5,'#');
												thumbnails[6614114] = new thumbnail(6614114,'','Me','Mike_Chapman_Summer_2010_thumb.JPG',130, 195,5,'#');
												thumbnails[6382992] = new thumbnail(6382992,'353029','Christ Child','Mike_Chapman_Christ_Child_thumb.jpg',130, 87,5,'photo_6382992.html');
												thumbnails[6383020] = new thumbnail(6383020,'353029','Martha','Mike_Chapman_Martha_thumb.JPG',130, 147,5,'photo_6383020.html');
												thumbnails[6383046] = new thumbnail(6383046,'353046','Drawing 1','Drawing_1_thumb.jpg',130, 173,5,'photo_6383046.html');
												thumbnails[6614105] = new thumbnail(6614105,'353047','Liberty 2010','Liberty_carving2_2010_thumb.JPG',130, 195,5,'photo_6614105.html');
												thumbnails[6383075] = new thumbnail(6383075,'353047','Barbara Letter Cutting 2010','IMG_0535_thumb.JPG',130, 87,5,'photo_6383075.html');
												thumbnails[6614076] = new thumbnail(6614076,'353047','Brenda Summer 2010','Brenda_carving_2010_thumb.JPG',130, 195,5,'photo_6614076.html');
												thumbnails[6614009] = new thumbnail(6614009,'353047','Liberty Summer 2010','Liberty_carving_2010_thumb.JPG',130, 195,5,'photo_6614009.html');
												thumbnails[6383051] = new thumbnail(6383051,'353046','Drawing 2','Drawing_2_thumb.JPG',130, 175,5,'photo_6383051.html');
												thumbnails[6396140] = new thumbnail(6396140,'353029','Sleeper','hand_and_nipple2_thumb.jpg',130, 165,5,'photo_6396140.html');
												thumbnails[6614164] = new thumbnail(6614164,'353047','Louise Summer 2010','Summer_2009_thumb.JPG',130, 195,5,'photo_6614164.html');
												thumbnails[6614053] = new thumbnail(6614053,'353047','Rob Summer 2010','Rob_carving_2010_thumb.JPG',130, 87,5,'photo_6614053.html');
												thumbnails[7671444] = new thumbnail(7671444,'353029','Bird','IMG_0948_thumb.JPG',130, 195,5,'photo_7671444.html');
												thumbnails[6383061] = new thumbnail(6383061,'353047','','IMG_0180_thumb.JPG',130, 87,5,'photo_6383061.html');
												thumbnails[7671797] = new thumbnail(7671797,'353029','Rising','IMG_1266b_thumb.JPG',130, 99,5,'photo_7671797.html');
												thumbnails[6382985] = new thumbnail(6382985,'353029','Arthur','Mike_Chapman_Arthur_thumb.jpg',130, 184,5,'photo_6382985.html');
												thumbnails[6383058] = new thumbnail(6383058,'353047','','IMG_0098_thumb.JPG',130, 195,5,'photo_6383058.html');
												thumbnails[6382987] = new thumbnail(6382987,'353029','Birdman','Mike_Chapman_Birdman_thumb.JPG',130, 195,5,'photo_6382987.html');
												thumbnails[6383063] = new thumbnail(6383063,'353047','','IMG_0185_thumb.JPG',130, 195,5,'photo_6383063.html');
												thumbnails[6382969] = new thumbnail(6382969,'353029','Figure 1','Mike_Chapman__Figure_1_thumb.jpg',130, 195,5,'photo_6382969.html');
												thumbnails[6383065] = new thumbnail(6383065,'353047','','IMG_0522_thumb.JPG',130, 107,5,'photo_6383065.html');
												thumbnails[6382960] = new thumbnail(6382960,'353029','Figure 2','Mike_Chapman__2_thumb.jpg',130, 195,5,'photo_6382960.html');
												thumbnails[6382982] = new thumbnail(6382982,'353029','Antelope','Mike_Chapman_Antelope_thumb.jpg',130, 195,5,'photo_6382982.html');
												thumbnails[6383072] = new thumbnail(6383072,'353047','','IMG_0532_thumb.JPG',130, 87,5,'photo_6383072.html');
												thumbnails[6382971] = new thumbnail(6382971,'353029','Moon','Mike_Chapman__Moon_thumb.jpg',130, 195,5,'photo_6382971.html');
												thumbnails[6383027] = new thumbnail(6383027,'353029','Owl','Mike_Chapman_Owl_thumb.jpg',130, 195,5,'photo_6383027.html');
												thumbnails[6383079] = new thumbnail(6383079,'353047','','IMG_0536_thumb.JPG',130, 109,5,'photo_6383079.html');
												thumbnails[6383037] = new thumbnail(6383037,'353029','Unicorn','Mike_Chapman_Unicorn_thumb.JPG',130, 195,5,'photo_6383037.html');
												thumbnails[6383081] = new thumbnail(6383081,'353047','','IMG_0538_thumb.JPG',130, 87,5,'photo_6383081.html');
												thumbnails[6383028] = new thumbnail(6383028,'353029','Roskoe','Mike_Chapman_Roskoe_thumb.jpg',130, 195,5,'photo_6383028.html');
												thumbnails[6383025] = new thumbnail(6383025,'353029','Mother and Child','Mike_Chapman_Mother_and_Child_thumb.JPG',130, 98,5,'photo_6383025.html');
												thumbnails[6382994] = new thumbnail(6382994,'353029','Cockerel','Mike_Chapman_Cockerel_thumb.JPG',130, 173,5,'photo_6382994.html');
												thumbnails[6383043] = new thumbnail(6383043,'353029','Wood Spirit','Mike_Chapman_Wood_Spirit_thumb.JPG',130, 173,5,'photo_6383043.html');
												thumbnails[6383018] = new thumbnail(6383018,'353029','Mare and Foal','Mike_Chapman_Mare__Foal_thumb.jpg',130, 103,5,'photo_6383018.html');
												thumbnails[6383013] = new thumbnail(6383013,'353029','Foal','Mike_Chapman_Foal_thumb.jpg',130, 205,5,'photo_6383013.html');
												thumbnails[6383033] = new thumbnail(6383033,'353029','Thunderbird','Mike_Chapman_Thunderbird_thumb.jpg',130, 195,5,'photo_6383033.html');
												thumbnails[6382999] = new thumbnail(6382999,'353029','Cormorant Totem','Mike_Chapman_Cormorant_Totem_thumb.JPG',130, 173,5,'photo_6382999.html');
												thumbnails[6383004] = new thumbnail(6383004,'353029','Crucifix','Mike_Chapman_Crucifix_thumb.JPG',130, 195,5,'photo_6383004.html');
												thumbnails[6383007] = new thumbnail(6383007,'353029','Family','Mike_Chapman_Family_thumb.JPG',130, 195,5,'photo_6383007.html');
												thumbnails[6383022] = new thumbnail(6383022,'353029','Mary Secole','Mike_Chapman_Mary_Secole_thumb.JPG',130, 173,5,'photo_6383022.html');
												thumbnails[6383035] = new thumbnail(6383035,'353029','Totem','Mike_Chapman_Totam_thumb.JPG',130, 195,5,'photo_6383035.html');
												thumbnails[6383029] = new thumbnail(6383029,'353029','Sand Lizard','Mike_Chapman_Sand_Lizard_thumb.jpg',130, 86,5,'photo_6383029.html');
												thumbnails[6383039] = new thumbnail(6383039,'353029','Wild Boar','Mike_Chapman_Wild_Boar_thumb.jpg',130, 87,5,'photo_6383039.html');
												thumbnails[6614077] = new thumbnail(6614077,'353047','','Liberty_shell_2010_thumb.JPG',130, 87,5,'photo_6614077.html');
												thumbnails[6614158] = new thumbnail(6614158,'353046','Drawing 3','Drawing_3_thumb.JPG',130, 87,5,'photo_6614158.html');
												thumbnails[6614163] = new thumbnail(6614163,'353046','Drawing 4','Drawing_4_thumb.JPG',130, 195,5,'photo_6614163.html');
												thumbnails[6614171] = new thumbnail(6614171,'353029','Hoxton Memorial','Hoxton_Memorial_thumb.JPG',130, 195,5,'photo_6614171.html');
												thumbnails[6614175] = new thumbnail(6614175,'353046','Drawing 5','Drawing_5_thumb.JPG',130, 195,5,'photo_6614175.html');
												thumbnails[6614217] = new thumbnail(6614217,'353029','Hare','Mike_Chapman_Hare_thumb.JPG',130, 46,5,'photo_6614217.html');
												thumbnails[7672274] = new thumbnail(7672274,'353046','Drawing 6','IMG_1280a_thumb.JPG',130, 195,5,'photo_7672274.html');
												thumbnails[7672167] = new thumbnail(7672167,'353046','Drawing 7','IMG_1272a_thumb.JPG',130, 195,5,'photo_7672167.html');
												thumbnails[7672278] = new thumbnail(7672278,'353046','Drawing 8','IMG_1281a_thumb.JPG',130, 195,5,'photo_7672278.html');
												thumbnails[7672285] = new thumbnail(7672285,'353046','Drawing 9','IMG_1286a_thumb.JPG',130, 195,5,'photo_7672285.html');
												thumbnails[7672292] = new thumbnail(7672292,'353046','Drawing 10','IMG_1287a_thumb.JPG',130, 195,5,'photo_7672292.html');
												thumbnails[6614222] = new thumbnail(6614222,'353029','Agnes','Mike_Chapman_Agnes_thumb.JPG',130, 86,5,'photo_6614222.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[353029] = new gallery(353029,'7671797,7671444,6396140,6383020,6382992,6382985','Portfolio','gallery',[6382992,6383020,6396140,7671444,7671797,6382985,6382987,6382969,6382960,6382982,6382971,6383027,6383037,6383028,6383025,6382994,6383043,6383018,6383013,6383033,6382999,6383004,6383007,6383022,6383035,6383029,6383039,6614171,6614217,6614222],0, 0, '', 'gallery_353029.html',0,0);
				  					galleries[353046] = new gallery(353046,'7672292,7672285,7672278,7672274,7672167,6614175,6614163,6614158,6383051,6383046','Drawings','gallery',[6383046,6383051,6614158,6614163,6614175,7672274,7672167,7672278,7672285,7672292],0, 0, '', 'gallery_353046.html',0,0);
				  					galleries[353047] = new gallery(353047,'6614164,6614105,6614076,6614053,6614009,6383075','Summer School and Workshops','gallery',[6614105,6383075,6614076,6614009,6614164,6614053,6383061,6383058,6383063,6383065,6383072,6383079,6383081,6614077],0, 0, '', 'gallery_353047.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[241442] = '6614114';
imageSets[1] = '7671797,7671444,6396140,6383020,6382992,6382985,6382969';
imageSets[2] = '7671797,7671444,6614164,6614105,6614076,6614053,6614009,6396140,6383075,6383020,6382992,6382985';
imageSets[3] = '7672292,7672285,7672278,7672274,7672167,7671797,7671444,6614222,6614217,6614175,6614171,6614164,6614163,6614158,6614114,6614105,6614077,6614076,6614053,6614009,6396203,6396140,6383081,6383079,6383075,6383072,6383065,6383063,6383061,6383058,6383051,6383046,6383043,6383039,6383037,6383035,6383033,6383029,6383028,6383027,6383025,6383022,6383020,6383018,6383013,6383007,6383004,6382999,6382994,6382992';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mikechapman/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mikechapman/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));		  $('body').trigger('clikUpdate');		}, 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 = 'Mike Chapman Sculptor: ' + 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));      $('body').trigger('clikUpdate');    }        
    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;
	}
}

		

