window.thumbnails = new Object();
												thumbnails[7256184] = new thumbnail(7256184,'','Landscape sketch','LandscapeSketch_thumb.jpg',130, 93,5,'#');
												thumbnails[7930966] = new thumbnail(7930966,'427397','Morrisons','Morrisons1_thumb.jpg',130, 130,5,'photo_7930966.html');
												thumbnails[7131859] = new thumbnail(7131859,'382148','Whittox Lane, Frome 2008 (SOLD)','wittox01_thumb.jpg',130, 159,5,'photo_7131859.html');
												thumbnails[7131870] = new thumbnail(7131870,'382147','Mont Saint Michel 1992 (NFS)','Universe_thumb.jpg',130, 174,5,'photo_7131870.html');
												thumbnails[7131871] = new thumbnail(7131871,'382147','Rail','rail_thumb.jpg',130, 256,5,'photo_7131871.html');
												thumbnails[7131897] = new thumbnail(7131897,'382147','Coal','coal_thumb.jpg',130, 268,5,'photo_7131897.html');
												thumbnails[7142219] = new thumbnail(7142219,'382148','Catherine Hill Frome ','Cathill_thumb.jpg',130, 161,5,'photo_7142219.html');
												thumbnails[7142222] = new thumbnail(7142222,'393815','Corfe Castle, Dorset ','Corfe_thumb.jpg',130, 171,5,'photo_7142222.html');
												thumbnails[7151396] = new thumbnail(7151396,'387614','Blue Rose ','Bluerose_thumb.jpg',130, 130,5,'photo_7151396.html');
												thumbnails[7173391] = new thumbnail(7173391,'382148','Catherine Hill Abstract/Cubist 2010 (Sold)','2010-06_304_thumb.jpg',130, 171,5,'photo_7173391.html');
												thumbnails[7173414] = new thumbnail(7173414,'382148','P.A.C. charity christmas card design 2010','8928retouched_thumb.jpg',130, 163,5,'photo_7173414.html');
												thumbnails[7173429] = new thumbnail(7173429,'387614','Pink Rose 2008 (Sold)','rose_thumb.jpg',130, 87,5,'photo_7173429.html');
												thumbnails[7173433] = new thumbnail(7173433,'387611','Oxwich bay, The Gower, Wales 2008','Oxwych_Bay_thumb.jpg',130, 98,5,'photo_7173433.html');
												thumbnails[7173434] = new thumbnail(7173434,'387611','Abstract Seascape 2009','Seascape_thumb.jpg',130, 173,5,'photo_7173434.html');
												thumbnails[7231929] = new thumbnail(7231929,'387615','Durdle door sketch 2008 ','beach01_thumb.jpg',130, 195,5,'photo_7231929.html');
												thumbnails[7231943] = new thumbnail(7231943,'387611','Boat and Reflections 2009','boat_thumb.jpg',130, 129,5,'photo_7231943.html');
												thumbnails[7231959] = new thumbnail(7231959,'382148','Whittox Lane, Frome 2010','Whittox_thumb.jpg',130, 129,5,'photo_7231959.html');
												thumbnails[7256161] = new thumbnail(7256161,'387615','Catherine Hill Sketch','catherine_hill_sketch_thumb.jpg',130, 204,5,'photo_7256161.html');
												thumbnails[7256178] = new thumbnail(7256178,'393815','Cherry Blossom','cherry_blossom_thumb.jpg',130, 130,5,'photo_7256178.html');
												thumbnails[7256263] = new thumbnail(7256263,'382148','PAC Christmas card 2009','PAC-2009card_408_x_600_thumb.jpg',130, 191,5,'photo_7256263.html');
												thumbnails[7279736] = new thumbnail(7279736,'382147','Frome Mills','mill_thumb.jpg',130, 262,5,'photo_7279736.html');
												thumbnails[7279752] = new thumbnail(7279752,'387614','Fruit ','fruity_thumb.jpg',130, 129,5,'photo_7279752.html');
												thumbnails[7279777] = new thumbnail(7279777,'387611','Driftwood (Sold)','driftwood_thumb.jpg',130, 96,5,'photo_7279777.html');
												thumbnails[7279790] = new thumbnail(7279790,'382147','Fullers earth works','fullers_thumb.jpg',130, 257,5,'photo_7279790.html');
												thumbnails[7281891] = new thumbnail(7281891,'382148','Catherine Hill + Paul st','2009_029_450_x_600_thumb.jpg',130, 173,5,'photo_7281891.html');
												thumbnails[7930994] = new thumbnail(7930994,'382148','Eagle Lane, Frome','Eagle_Lane_Frome_thumb.jpg',130, 172,5,'photo_7930994.html');
												thumbnails[7931014] = new thumbnail(7931014,'382148','Palmer St, Frome','Palmer_St_Frome_thumb.jpg',130, 175,5,'photo_7931014.html');
												thumbnails[7964391] = new thumbnail(7964391,'427396',' ','2011-05_076_thumb.jpg',130, 98,5,'photo_7964391.html');
												thumbnails[7965209] = new thumbnail(7965209,'427396','','14BW_thumb.jpg',130, 101,5,'photo_7965209.html');
												thumbnails[7967660] = new thumbnail(7967660,'427396','','16BW_thumb.jpg',130, 191,5,'photo_7967660.html');
												thumbnails[7967670] = new thumbnail(7967670,'427396','','cathederal_thumb.jpg',130, 94,5,'photo_7967670.html');
												thumbnails[7967673] = new thumbnail(7967673,'382148','','Gentle_St_2_thumb.jpg',130, 130,5,'photo_7967673.html');
												thumbnails[7967675] = new thumbnail(7967675,'427397','','hundertwassercopy_thumb.jpg',130, 163,5,'photo_7967675.html');
												thumbnails[7967680] = new thumbnail(7967680,'427396','','kidsonbeachBW_thumb.jpg',130, 88,5,'photo_7967680.html');
												thumbnails[7967727] = new thumbnail(7967727,'427397','','kiss_thumb.jpg',130, 251,5,'photo_7967727.html');
												thumbnails[7967734] = new thumbnail(7967734,'427396','','portrait08BW_thumb.jpg',130, 191,5,'photo_7967734.html');
												thumbnails[7967817] = new thumbnail(7967817,'427396','','croyde_thumb.jpg',130, 98,5,'photo_7967817.html');
												thumbnails[7967921] = new thumbnail(7967921,'387611','','01241_thumb.jpg',130, 163,5,'photo_7967921.html');
												thumbnails[7974035] = new thumbnail(7974035,'393815','','LandscapeSketch_CC336768-1EC9-DFB6-0942E3852DCE35F9_thumb.jpg',130, 93,5,'photo_7974035.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[427397] = new gallery(427397,'7930966','Abstract/Semi-Abstract','gallery',[7930966,7967675,7967727],0, 0, '', 'gallery_427397.html',0,0);
				  					galleries[393815] = new gallery(393815,'7974035,7256178,7142222','Landscape','gallery',[7142222,7256178,7974035],0, 0, '', 'gallery_393815.html',0,0);
				  					galleries[427396] = new gallery(427396,'7967817,7964391','Photography','gallery',[7964391,7965209,7967660,7967670,7967680,7967734,7967817],0, 0, '', 'gallery_427396.html',0,0);
				  					galleries[387611] = new gallery(387611,'7967921','Seascapes','gallery',[7173433,7173434,7231943,7279777,7967921],0, 0, '', 'gallery_387611.html',0,0);
				  					galleries[387615] = new gallery(387615,'7256161,7231929','Sketchbook extracts','gallery',[7231929,7256161],0, 0, '', 'gallery_387615.html',0,0);
				  					galleries[387614] = new gallery(387614,'7279752,7173429,7151396','Still life','gallery',[7151396,7173429,7279752],0, 0, '', 'gallery_387614.html',0,0);
				  					galleries[382147] = new gallery(382147,'7279790,7279736,7131897,7131871,7131870','College','gallery',[7131870,7131871,7131897,7279736,7279790],0, 0, '', 'gallery_382147.html',0,0);
				  					galleries[382148] = new gallery(382148,'7930994','Frome','gallery',[7131859,7142219,7173391,7173414,7231959,7256263,7281891,7930994,7931014,7967673],0, 0, '', 'gallery_382148.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7974035,7967817,7967670,7964391,7231959,7231943,7173433,7173429';
imageSets[2] = '7967921,7967817,7964391,7930994,7930966';
imageSets[3] = '7974035,7967921,7967817,7967734,7967727,7967680,7967675,7967673,7967670,7967660,7965209,7964391,7931014,7930994,7930966,7281891,7279790,7279777,7279752,7279736,7256263,7256184,7256178,7256161,7231959,7231943,7231929,7173434,7173433,7173429,7173414,7173391,7151396,7142222,7142219,7131897,7131871,7131870,7131859';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/amyyates/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/amyyates/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/amyyates/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/amyyates/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/amyyates/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/amyyates/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 = 'Aimless Art Illustration: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      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 == undefined) {
    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;
	}
}

			

