window.thumbnails = new Object();
												thumbnails[29663] = new thumbnail(29663,'','SDAG','SDAGLogo1_thumb.jpg',130, 119,18,'#');
												thumbnails[1909874] = new thumbnail(1909874,'12072','Rita Mitchell:<br><I>Tulips</I>','a001Tulips_1_thumb.jpg',130, 130,18,'photo_1909874.html');
												thumbnails[1909883] = new thumbnail(1909883,'12072','Linda Child:<br><I>Venice</I>','Venice-Study-in-Blue-&-Yell_1_thumb.jpg',130, 130,18,'photo_1909883.html');
												thumbnails[1909900] = new thumbnail(1909900,'12072','','dscf2456a_thumb.jpg',130, 130,18,'photo_1909900.html');
												thumbnails[1909914] = new thumbnail(1909914,'12072','','dscf2457a_thumb.jpg',130, 130,18,'photo_1909914.html');
												thumbnails[1909915] = new thumbnail(1909915,'12072','','dscf2458a_thumb.jpg',130, 130,18,'photo_1909915.html');
												thumbnails[1909916] = new thumbnail(1909916,'12072','','dscf2459a_thumb.jpg',130, 130,18,'photo_1909916.html');
												thumbnails[1909917] = new thumbnail(1909917,'12072','','dscf2460a_thumb.jpg',130, 130,18,'photo_1909917.html');
												thumbnails[1909918] = new thumbnail(1909918,'12072','','dscf2462a_thumb.jpg',130, 130,18,'photo_1909918.html');
												thumbnails[1909919] = new thumbnail(1909919,'12072','','dscf2464a_thumb.jpg',130, 130,18,'photo_1909919.html');
												thumbnails[1909925] = new thumbnail(1909925,'12072','','dscf2464d_thumb.jpg',130, 130,18,'photo_1909925.html');
												thumbnails[1909930] = new thumbnail(1909930,'12072','','dscf2466a_thumb.jpg',130, 130,18,'photo_1909930.html');
												thumbnails[1909935] = new thumbnail(1909935,'12072','','dscf2467a_thumb.jpg',130, 130,18,'photo_1909935.html');
												thumbnails[5504728] = new thumbnail(5504728,'128072','Richard Eddleston:<br><I>Cornish Surf</I><br>\r\n','Cornish_Surf_thumb.jpg',130, 130,18,'photo_5504728.html');
												thumbnails[5504816] = new thumbnail(5504816,'128072','Richard Eddleston:<br><I>High and Dry</I>','High_and_Dry_thumb.jpg',130, 130,18,'photo_5504816.html');
												thumbnails[6319489] = new thumbnail(6319489,'128072','Richard Eddleston:<br><I>Wells Harbour Sunrise</I><br>\r\n','Wells_Harbour_Sunrise_thumb.jpg',130, 130,18,'photo_6319489.html');
												thumbnails[6319561] = new thumbnail(6319561,'128072','Richard Eddleston:<br><I>Stormy Seas - Spurn</I>','Stormy_Seas_-_Spurn_thumb.jpg',130, 130,18,'photo_6319561.html');
												thumbnails[6798905] = new thumbnail(6798905,'128072','Janet Waters:<br><I>Scottish Farm Builidngs</I>','Scottish_Farm_Builidngs_thumb.jpg',130, 130,18,'photo_6798905.html');
												thumbnails[6798982] = new thumbnail(6798982,'128072','Janet Waters:<br><I>Tulips</I>','tulips_thumb.jpg',130, 130,18,'photo_6798982.html');
												thumbnails[6876840] = new thumbnail(6876840,'128072','Ilse Browne:<br><I>Coastal path, Northumbria</I>','Coastal_path_Northumbria_web_thumb.jpg',130, 130,18,'photo_6876840.html');
												thumbnails[6876842] = new thumbnail(6876842,'128072','Ilse Browne:<br><I>Evening mood on the lake</I>','Evening_mood_web_thumb.jpg',130, 130,18,'photo_6876842.html');
												thumbnails[6876845] = new thumbnail(6876845,'128072','Ilse Browne:<br><I>Tuscan hill village</I>','Tuscan_hill_village_web_thumb.jpg',130, 130,18,'photo_6876845.html');
												thumbnails[3148807] = new thumbnail(3148807,'3335','','sdag_thumb.jpg',130, 97,18,'photo_3148807.html');
												thumbnails[31630] = new thumbnail(31630,'10675','Workshops','Workshop 1_thumb.jpg',130, 97,18,'photo_31630.html');
												thumbnails[114526] = new thumbnail(114526,'10676','Council House, Nottingham','250 council house clikpic1_thumb.jpg',130, 97,18,'photo_114526.html');
												thumbnails[31891] = new thumbnail(31891,'10675','Workshop Results','Workshop 3_thumb.JPG',130, 69,18,'photo_31891.html');
												thumbnails[131767] = new thumbnail(131767,'10678','Cherry Blossom in Kyoto, Japan.  oil','Cherry Blossom 1_thumb.jpg',130, 98,18,'photo_131767.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[12072] = new gallery(12072,'1909900,1909874','ONE','section167065',[1909874,1909883,1909900,1909914,1909915,1909916,1909917,1909918,1909919,1909925,1909930,1909935],0, 0, '', 'section167065_12072.html',0,0);
				  					galleries[128072] = new gallery(128072,'6876845,6876842,6876840,6798982,6798905,6319561,6319489,5504816,5504728','TWO','section167065',[5504728,5504816,6319489,6319561,6798905,6798982,6876840,6876842,6876845],0, 0, '', 'section167065_128072.html',0,0);
				  					galleries[3335] = new gallery(3335,'3148807','The Programme','gallery',[3148807],0, 0, '', 'gallery_3335.html',0,0);
				  					galleries[10675] = new gallery(10675,'31630','Workshops','gallery',[31630,31891],0, 0, '', 'gallery_10675.html',0,0);
				  					galleries[10676] = new gallery(10676,'114526','Social Evenings','gallery',[114526],0, 0, '', 'gallery_10676.html',0,0);
				  					galleries[10678] = new gallery(10678,'131767','Exhibitions','gallery',[131767],0, 0, '', 'gallery_10678.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '3148807';
imageSets[2] = '1909900,1909874,31630';
imageSets[3] = '6876845,6876842,6876840,6798982,6798905,6319561,6319489,5504816,5504728,3148807,1909935,1909930,1909925,1909919,1909918,1909917,1909916,1909915,1909914,1909900,1909883,1909874,131767,114526,31891,31630,29663';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/SDArtGroup/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/SDArtGroup/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 += 'section167065.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 && 'section167065' != '') {
					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 = 'Spotted  Dog  Art  Group: ' + 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;
	}
}

		

