window.thumbnails = new Object();
												thumbnails[363978] = new thumbnail(363978,'29960','Bass Rock','Bass Rock_thumb.jpg',130, 128,1,'photo_363978.html');
												thumbnails[363982] = new thumbnail(363982,'29960','Castle from Grassmarket','Castle from Grassmarket_thumb.jpg',130, 98,1,'photo_363982.html');
												thumbnails[363986] = new thumbnail(363986,'29960','Calton Hill','Calton Hill_thumb.jpg',130, 50,1,'photo_363986.html');
												thumbnails[363992] = new thumbnail(363992,'29960','Castle at Night','Castle at Night_thumb.jpg',130, 104,1,'photo_363992.html');
												thumbnails[364028] = new thumbnail(364028,'29960','Edinburgh from the Crags','Edinburgh from the Crags_thumb.jpg',130, 126,1,'photo_364028.html');
												thumbnails[364031] = new thumbnail(364031,'29960','Edinburgh Nights','Edinburgh Nights_thumb.jpg',130, 98,1,'photo_364031.html');
												thumbnails[364042] = new thumbnail(364042,'29960','Forth Road Bridge','Forth Road Bridge_thumb.jpg',130, 130,1,'photo_364042.html');
												thumbnails[364046] = new thumbnail(364046,'29960','George Street at Christmas','George St at Xmas_thumb.jpg',130, 129,1,'photo_364046.html');
												thumbnails[364062] = new thumbnail(364062,'29960','Museum of Scotland','Museum of Scotland_thumb.jpg',130, 140,1,'photo_364062.html');
												thumbnails[364064] = new thumbnail(364064,'29960','Ramsay Garden','Ramsay Gardens_thumb.jpg',130, 336,1,'photo_364064.html');
												thumbnails[364074] = new thumbnail(364074,'29960','Salisbury Crags','Salisbury Crags_thumb.jpg',130, 51,1,'photo_364074.html');
												thumbnails[364077] = new thumbnail(364077,'29960','Scott Monument','Scott Monument_thumb.jpg',130, 131,1,'photo_364077.html');
												thumbnails[364081] = new thumbnail(364081,'29960','St Anthony\'s Chapel ','St Anthony\'s Chapel_thumb.jpg',130, 122,1,'photo_364081.html');
												thumbnails[364092] = new thumbnail(364092,'29960','St Margaret\'s Loch','St Margaret\'s Loch_thumb.jpg',130, 173,1,'photo_364092.html');
												thumbnails[364109] = new thumbnail(364109,'29960','Sunset over Fountainbridge','Sunset over Fountainbridge_thumb.jpg',130, 129,1,'photo_364109.html');
												thumbnails[364113] = new thumbnail(364113,'29960','Sunset over St. Anthony\'s Chapel','Sunset over St Anthony\'s Chapel_thumb.jpg',130, 131,1,'photo_364113.html');
												thumbnails[364117] = new thumbnail(364117,'29960','Tantallon Castle','Tantallon Castle_thumb.jpg',130, 98,1,'photo_364117.html');
												thumbnails[364121] = new thumbnail(364121,'29960','View from Calton Hill','View from Calton Hill_thumb.jpg',130, 130,1,'photo_364121.html');
												thumbnails[365187] = new thumbnail(365187,'29960','Ross Fountain & Castle','Ross Fountain and castle_thumb.jpg',130, 133,1,'photo_365187.html');
												thumbnails[369087] = new thumbnail(369087,'30215','Uluru, Ayers Rock. ','Uluru_thumb.jpg',130, 65,1,'photo_369087.html');
												thumbnails[369094] = new thumbnail(369094,'30215','Hill Inlet, Whitsundays.','Hill Inlet, Whitsundays_thumb.jpg',130, 356,1,'photo_369094.html');
												thumbnails[369135] = new thumbnail(369135,'30215','Elizabeth Bay, New South Wales.','Elizabeth Bay, NSW_thumb.jpg',130, 108,1,'photo_369135.html');
												thumbnails[369152] = new thumbnail(369152,'30216','Blue Wave ','Blue Wave_thumb.jpg',130, 129,1,'photo_369152.html');
												thumbnails[369159] = new thumbnail(369159,'30216','Shepherd\'s Delight','Shepherd\'s Delight_thumb.jpg',130, 129,1,'photo_369159.html');
												thumbnails[369168] = new thumbnail(369168,'30216','Zoom','Zoom_thumb.jpg',130, 133,1,'photo_369168.html');
												thumbnails[369181] = new thumbnail(369181,'29960','Castle from Johnston Terrace','Castle from Johnston Terrace_thumb.jpg',130, 176,1,'photo_369181.html');
												thumbnails[369192] = new thumbnail(369192,'29960','Fireworks I','Festival Fireworks I_thumb.jpg',130, 130,1,'photo_369192.html');
												thumbnails[369195] = new thumbnail(369195,'29960','Fireworks IV','Festival Fireworks II_thumb.jpg',130, 130,1,'photo_369195.html');
												thumbnails[369198] = new thumbnail(369198,'29960','Fireworks III','Festival Fireworks III_thumb.jpg',130, 128,1,'photo_369198.html');
												thumbnails[369203] = new thumbnail(369203,'29960','Festival Fireworks II','Festival Fireworks IV_thumb.jpg',130, 132,1,'photo_369203.html');
												thumbnails[369229] = new thumbnail(369229,'29960','Crieff Hydro Hotel','Creiff Hydro_thumb.jpg',130, 176,1,'photo_369229.html');
												thumbnails[390738] = new thumbnail(390738,'30216','Nova','Nova_thumb.jpg',130, 128,1,'photo_390738.html');
												thumbnails[390740] = new thumbnail(390740,'29960','Cumbrae','Cumbrae_thumb.jpg',130, 180,1,'photo_390740.html');
												thumbnails[401545] = new thumbnail(401545,'30216','Fusion','Fusion_thumb.jpg',130, 129,1,'photo_401545.html');
												thumbnails[401550] = new thumbnail(401550,'32345','Tyne Bridges & Tall Ships','Tyne Bridges & Tall Ships_thumb.jpg',130, 98,1,'photo_401550.html');
												thumbnails[789180] = new thumbnail(789180,'29960','Glenelg Bay','Glenelg Bay_thumb.jpg',130, 96,1,'photo_789180.html');
												thumbnails[789191] = new thumbnail(789191,'29960','Bernera Barracks, Glenelg','Bernera Barracks2_thumb.jpg',130, 170,1,'photo_789191.html');
												thumbnails[2672377] = new thumbnail(2672377,'169035','Bird of Paradise','Bird-of-Paradise-Web_thumb.jpg',130, 131,1,'photo_2672377.html');
												thumbnails[2672949] = new thumbnail(2672949,'29960','The Maze, Tiree','The-Maze,-Tiree-web_thumb.jpg',130, 87,1,'photo_2672949.html');
												thumbnails[3119067] = new thumbnail(3119067,'191354','Longing for Open Water','Longing-for-Open-Water---We_thumb.jpg',130, 51,1,'photo_3119067.html');
												thumbnails[5890528] = new thumbnail(5890528,'29960','Aberlady Sunset','IMG_1084web1_thumb.jpg',130, 51,1,'photo_5890528.html');
												thumbnails[5890530] = new thumbnail(5890530,'29960','The Lamb, North Berwick','IMG_1085web_thumb.jpg',130, 129,1,'photo_5890530.html');
												thumbnails[5890537] = new thumbnail(5890537,'29960','Oystercatcher at Aberlady','IMG_1086web_thumb.jpg',130, 126,1,'photo_5890537.html');
												thumbnails[5890541] = new thumbnail(5890541,'29960','Edinburgh from Cockenzie','IMG_1088web_thumb.jpg',130, 98,1,'photo_5890541.html');
												thumbnails[6276507] = new thumbnail(6276507,'29960','North Berwick','1_thumb.jpg',130, 98,1,'photo_6276507.html');
												thumbnails[6276617] = new thumbnail(6276617,'29960','Aberlady Bay','11_thumb.jpg',130, 99,1,'photo_6276617.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[30216] = new gallery(30216,'369168','Abstract Art','gallery',[369152,369159,369168,390738,401545],0, 0, '', 'gallery_30216.html',0,0);
				  					galleries[30215] = new gallery(30215,'369087','Australia','gallery',[369087,369094,369135],0, 0, '', 'gallery_30215.html',0,0);
				  					galleries[32345] = new gallery(32345,'401550','England','gallery',[401550],0, 0, '', 'gallery_32345.html',0,0);
				  					galleries[169035] = new gallery(169035,'2672377','Nature','gallery',[2672377],0, 0, '', 'gallery_169035.html',0,0);
				  					galleries[29960] = new gallery(29960,'5890528','Scotland','gallery',[363978,363982,363986,363992,364028,364031,364042,364046,364062,364064,364074,364077,364081,364092,364109,364113,364117,364121,365187,369181,369192,369195,369198,369203,369229,390740,789180,789191,2672949,5890528,5890530,5890537,5890541,6276507,6276617],0, 0, '', 'gallery_29960.html',0,0);
				  					galleries[191354] = new gallery(191354,'3119067','Wales','gallery',[3119067],0, 0, '', 'gallery_191354.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '2672377';
imageSets[2] = '5890528,2672377,401550,369168,369087';
imageSets[3] = '6276617,6276507,5890541,5890537,5890530,5890528,3119067,2672949,2672377,789191,789180,401550,401545,390740,390738,369229,369203,369198,369195,369192,369181,369168,369159,369152,369135,369094,369087,365187,364121,364117,364113,364109,364092,364081,364077,364074,364064,364062,364046,364042,364031,364028,363992,363986,363982,363978';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/toledo1/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/toledo1/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/toledo1/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/toledo1/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/toledo1/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/toledo1/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 = 'mariacampbell.co.uk: ' + 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>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="clifford@wlough.freeserve.co.uk">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="clifford@wlough.freeserve.co.uk">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							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;
	}
}

			

