window.thumbnails = new Object();
												thumbnails[1370147] = new thumbnail(1370147,'95686','Martini Lancia Delta. Didier Auriol','lancia delta copy_thumb.jpg',130, 60,1,'																			photo_1370147.html');
												thumbnails[1370148] = new thumbnail(1370148,'95693','Mitsubishi WRC. Gigi Galli','mitsi_thumb.jpg',130, 55,1,'																			photo_1370148.html');
												thumbnails[1370153] = new thumbnail(1370153,'95688','Skoda Fabia WRC. Toni Gardermister','skoda felicia copy_thumb.jpg',130, 74,1,'																			photo_1370153.html');
												thumbnails[1370156] = new thumbnail(1370156,'95686','Lancia Stratos. Munari','Lancia stratos copy_thumb.jpg',130, 53,1,'																			photo_1370156.html');
												thumbnails[1370158] = new thumbnail(1370158,'95686','Peugeot Cosworth. Andy Burton','peugeot cosworth copy_thumb.jpg',130, 62,1,'																			photo_1370158.html');
												thumbnails[1370159] = new thumbnail(1370159,'95688','Computervision Metro 6R4. David Llewellin','metro 6r4 copy_thumb.jpg',130, 77,1,'																			photo_1370159.html');
												thumbnails[1370161] = new thumbnail(1370161,'95694','Ford Focus WRC. Colin McRae','focus copy_thumb.jpg',130, 54,1,'																			photo_1370161.html');
												thumbnails[1370163] = new thumbnail(1370163,'95694','Eaton Yale Ford Escort. Bjorn Waldergaard','mk2 escort copy_thumb.jpg',130, 66,1,'																			photo_1370163.html');
												thumbnails[1370168] = new thumbnail(1370168,'95693','Audi Quattro. Hannu Mikkola','audi_thumb.gif',130, 56,1,'																			photo_1370168.html');
												thumbnails[1370171] = new thumbnail(1370171,'95688','Andrews Heat for Hire Opel Manta. Russell Brookes','manta copy_thumb.jpg',130, 56,1,'																			photo_1370171.html');
												thumbnails[1370174] = new thumbnail(1370174,'95693','Triumph TR7. Tony Pond','tr7_thumb.jpg',130, 61,1,'																			photo_1370174.html');
												thumbnails[1370180] = new thumbnail(1370180,'95693','Citroen Xsara WRC. Colin McRae','xsara_thumb.jpg',130, 59,1,'																			photo_1370180.html');
												thumbnails[1370186] = new thumbnail(1370186,'95694','Hyundai Accent WRC. Damian Cole','hyundai cole copy_thumb.jpg',130, 62,1,'																			photo_1370186.html');
												thumbnails[1387287] = new thumbnail(1387287,'95688','Toyota Celica. Juha Kankkunen','celica copy_thumb.jpg',130, 54,1,'																			photo_1387287.html');
												thumbnails[1387291] = new thumbnail(1387291,'95693','Suzuki Swift S1600. Guy Wilks','swift_thumb.jpg',130, 76,1,'																			photo_1387291.html');
												thumbnails[1519089] = new thumbnail(1519089,'95693','Subaru Impreza 555. Colin McRae','555 sub copy_thumb.jpg',130, 60,1,'																			photo_1519089.html');
												thumbnails[1519093] = new thumbnail(1519093,'95693','Toyota Corolla WRC. Carlos Sainz','corolla copy_thumb.jpg',130, 61,1,'																			photo_1519093.html');
												thumbnails[1519096] = new thumbnail(1519096,'95693','Ford Escort Cosworth. Francois Delecour','esc cosw copy_thumb.jpg',130, 60,1,'																			photo_1519096.html');
												thumbnails[1519104] = new thumbnail(1519104,'95693','Hyundai Accent WRC. Alister McRae','hyundai mcrae copy_thumb.jpg',130, 85,1,'																			photo_1519104.html');
												thumbnails[1519108] = new thumbnail(1519108,'95694','Lancia 037. Jolly Club','lancia 037 copy_thumb.jpg',130, 61,1,'																			photo_1519108.html');
												thumbnails[1519113] = new thumbnail(1519113,'95688','Subaru Impreza WRC. Richard Burns','New Impreza copy_thumb.jpg',130, 51,1,'																			photo_1519113.html');
												thumbnails[1519116] = new thumbnail(1519116,'95694','Porsche 911. Rothmans Livery','porsche copy_thumb.jpg',130, 53,1,'																			photo_1519116.html');
												thumbnails[1519120] = new thumbnail(1519120,'95693','Peugeot 205 T16. Ari Vatanen','pug205 t16 copy_thumb.jpg',130, 66,1,'																			photo_1519120.html');
												thumbnails[1519124] = new thumbnail(1519124,'95686','Peugeot 206 WRC. Marcuus Gronholm','pug 206_thumb.jpg',130, 60,1,'																			photo_1519124.html');
												thumbnails[1519126] = new thumbnail(1519126,'95693','Renault 5 Turbo. Jean Ragnotti','renault 5 copy_thumb.jpg',130, 64,1,'																			photo_1519126.html');
												thumbnails[1519127] = new thumbnail(1519127,'95693','Ford RS200. Belga Rally Team','rs200 copy_thumb.jpg',130, 75,1,'																			photo_1519127.html');
												thumbnails[1519129] = new thumbnail(1519129,'95693','Ford Sierra Cosworth. Jimmy McRae','sierra cos copy_thumb.jpg',130, 72,1,'																			photo_1519129.html');
												thumbnails[1519135] = new thumbnail(1519135,'95693','Talbot Sunbeam. Henri Toivonen','sunbeam copy_thumb.jpg',130, 62,1,'																			photo_1519135.html');
												thumbnails[1589229] = new thumbnail(1589229,'95686','Audi Quattro S1. Hannu Mikkola','AudiS1 copy_thumb.jpg',130, 55,1,'																			photo_1589229.html');
												thumbnails[1613360] = new thumbnail(1613360,'95693','Vauxhall Chevette HSR. Jimmy McRae','chevette copy_thumb.jpg',130, 63,1,'																			photo_1613360.html');
												thumbnails[1636074] = new thumbnail(1636074,'95693','Peugeot 205 GTi. Richard Burns','Copy of 205 Burns  copy_thumb.jpg',130, 61,1,'																			photo_1636074.html');
												thumbnails[1662075] = new thumbnail(1662075,'95688','Spectator Pack. Click on Image to Buy','P1000218_thumb.JPG',130, 98,1,'																			photo_1662075.html');
												thumbnails[1662076] = new thumbnail(1662076,'95686','Classic Pack. Click on Image to Buy','P1000216_thumb.JPG',130, 98,1,'																			photo_1662076.html');
												thumbnails[1662077] = new thumbnail(1662077,'95694','Drivers Pack. Click on Image to Buy','P1000217_thumb.JPG',130, 98,1,'																			photo_1662077.html');
												thumbnails[1666367] = new thumbnail(1666367,'95693','Vauxhall Nova. Dave Metcalfe','Nova copy_thumb.jpg',130, 70,1,'																			photo_1666367.html');
												thumbnails[1745709] = new thumbnail(1745709,'95693','Ford Focus 07. Mikko Hirvonen','Focus 07 copy_thumb.jpg',130, 63,1,'																			photo_1745709.html');
												thumbnails[1745712] = new thumbnail(1745712,'95693','Roger Clark. Uniflow Ford Escort 1972 RAC Rally','mk1 escort copy_thumb.jpg',130, 72,1,'																			photo_1745712.html');
												thumbnails[1786645] = new thumbnail(1786645,'95693','Ford Escort Mk2. Mark Ellis','ellis escort copy_thumb.jpg',130, 61,1,'																			photo_1786645.html');
												thumbnails[3139453] = new thumbnail(3139453,'95693','Alan Cookson. Subaru Impreza WRC','Cookson Subaru WRC 98_thumb.jpg',130, 57,1,'																			photo_3139453.html');
												thumbnails[3139457] = new thumbnail(3139457,'95693','Nik Elsmore. Mitsubishi Lancer EvoIX','Elsmore Evo9_thumb.jpg',130, 64,1,'																			photo_3139457.html');
												thumbnails[3139460] = new thumbnail(3139460,'95693','Huw Evans. TQ Impreza N14','Evans TQ Subaru N14_thumb.jpg',130, 68,1,'																			photo_3139460.html');
												thumbnails[3139463] = new thumbnail(3139463,'95693','Nigel Griffiths. Tesco 99 Impreza','Griffith Subaru_thumb.jpg',130, 80,1,'																			photo_3139463.html');
												thumbnails[3139468] = new thumbnail(3139468,'95693','Colin Mcrae. Subaru Impreza WRC','Impreza WRC98_thumb.jpg',130, 62,1,'																			photo_3139468.html');
												thumbnails[3139472] = new thumbnail(3139472,'95693','Stephen Moore. Focus WRC','Moore Focus 2007_thumb.jpg',130, 62,1,'																			photo_3139472.html');
												thumbnails[3139475] = new thumbnail(3139475,'95693','Tony Pond. Computervision Metro 6R4','Pond Metro 6r4_thumb.jpg',130, 69,1,'																			photo_3139475.html');
												thumbnails[3139482] = new thumbnail(3139482,'95693','Gardner S1400 Astra','Spud 1400 Astra_thumb.jpg',130, 81,1,'																			photo_3139482.html');
												thumbnails[3139488] = new thumbnail(3139488,'95693','Brendan Wellman. Micra Kit Car','Wellman Micra_thumb.jpg',130, 66,1,'																			photo_3139488.html');
												thumbnails[3511907] = new thumbnail(3511907,'95693','Mark Ellis. GpA Subaru Impreza','Ellis Subaru low webs_thumb.jpg',130, 67,1,'																			photo_3511907.html');
												thumbnails[3511912] = new thumbnail(3511912,'95693','Sebastian Loeb. Citroen C4','Loeb2008 low web_thumb.jpg',130, 86,1,'																			photo_3511912.html');
												thumbnails[3511915] = new thumbnail(3511915,'95693','Kris Meeke. Peugeot 207 Super 2000','Meeke 207 low webs_thumb.jpg',130, 78,1,'																			photo_3511915.html');
												thumbnails[3511917] = new thumbnail(3511917,'95693','Malcom Wilson. Mitchelin Pilot Escort Cosworth','Michelin Pilot Escort low webs_thumb.jpg',130, 64,1,'																			photo_3511917.html');
												thumbnails[3511918] = new thumbnail(3511918,'95693','Ari Vatanen. Rothmans Ford Escort','Vatanen Rothmans Escortlow webs_thumb.jpg',130, 73,1,'																			photo_3511918.html');
												thumbnails[5471682] = new thumbnail(5471682,'95693','Audi A3 - Kynnaston','Audi_S3_Kynnaston_web1_thumb.jpg',130, 63,1,'																			photo_5471682.html');
												thumbnails[5471732] = new thumbnail(5471732,'95693','Citroen C4. Petter Solberg','Citroen_C4_Solberg_web_thumb.jpg',130, 56,1,'																			photo_5471732.html');
												thumbnails[5471751] = new thumbnail(5471751,'95693','Fiat 131 Arbarth. Michelle Mouton','Fiat_131_Arbarth_web_thumb.jpg',130, 64,1,'																			photo_5471751.html');
												thumbnails[5471759] = new thumbnail(5471759,'95693','Mini Cooper. Monte Carlo','Mini_Cooper_web_thumb.jpg',130, 71,1,'																			photo_5471759.html');
												thumbnails[5471763] = new thumbnail(5471763,'95693','Skoda Fabia S2000','Skoda_S2000_Fabia_web_thumb.jpg',130, 69,1,'																			photo_5471763.html');
												thumbnails[5471774] = new thumbnail(5471774,'95693','Subaru Legacy. Colin Mcrae','Subaru_Legacy_web_thumb.jpg',130, 66,1,'																			photo_5471774.html');
												thumbnails[5570667] = new thumbnail(5570667,'315986','Ford Escort RS Cosworth','escort_cos_thumb.jpg',130, 81,1,'																			photo_5570667.html');
												thumbnails[5570682] = new thumbnail(5570682,'315986','Ford Escort RS','escort_kerrigde_thumb.jpg',130, 62,1,'																			photo_5570682.html');
												thumbnails[5570711] = new thumbnail(5570711,'315986','Ford Escort RS','escort_mk270001_thumb.jpg',130, 84,1,'																			photo_5570711.html');
												thumbnails[5570776] = new thumbnail(5570776,'315986','MG Metro 6R4','Metro_thumb.jpg',130, 93,1,'																			photo_5570776.html');
												thumbnails[5570785] = new thumbnail(5570785,'315986','Peugeot 205 GTI 1.6','pug_woodpecker_thumb.jpg',130, 84,1,'																			photo_5570785.html');
												thumbnails[5570810] = new thumbnail(5570810,'315986','Ford Escort RS','red_escort_thumb.jpg',130, 67,1,'																			photo_5570810.html');
												thumbnails[5570832] = new thumbnail(5570832,'315986','Toyota Corolla AE86','toyota_manx_thumb.jpg',130, 83,1,'																			photo_5570832.html');
												thumbnails[5574553] = new thumbnail(5574553,'315986','Peugeot 205 GTI 1.9','Down_Amp_thumb.jpg',130, 75,1,'																			photo_5574553.html');
												thumbnails[1589291] = new thumbnail(1589291,'95693','Selected any three images from the website to be printed in a 12\"x8\" mount','Three in a frame_thumb.jpg',130, 160,1,'																			photo_1589291.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[315986] = new gallery(315986,'5574553,5570667','Rallycards Rally Cars','gallery',[5570667,5570682,5570711,5570776,5570785,5570810,5570832,5574553],0, 0, '', '																																																																																																							gallery_315986.html',0,0);
				  					galleries[95688] = new gallery(95688,'1662075,1519113,1387287,1370171,1370159,1370153','Spectator Pack','gallery',[1370153,1370159,1370171,1387287,1519113,1662075],0, 0, '', '																																																																																																							gallery_95688.html',0,0);
				  					galleries[95686] = new gallery(95686,'1589229,1370158','Classic Pack','gallery',[1370147,1370156,1370158,1519124,1589229,1662076],0, 0, '', '																																																																																																							gallery_95686.html',0,0);
				  					galleries[95694] = new gallery(95694,'1519108','Drivers Pack','gallery',[1370161,1370163,1370186,1519108,1519116,1662077],0, 0, '', '																																																																																																							gallery_95694.html',0,0);
				  					galleries[95693] = new gallery(95693,'5471774,3511918,3139460,3139453,1613360,1370148','Gallery','gallery',[1370148,1370168,1370174,1370180,1387291,1519089,1519093,1519096,1519104,1519120,1519126,1519127,1519129,1519135,1613360,1636074,1666367,1745709,1745712,1786645,3139453,3139457,3139460,3139463,3139468,3139472,3139475,3139482,3139488,3511907,3511912,3511915,3511917,3511918,5471682,5471732,5471751,5471759,5471763,5471774,1589291],0, 0, '', '																																																																																																							gallery_95693.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5471763,5471732,5471682,3511917,3139460,1636074';
imageSets[2] = '5574553,5570667,5471774,3511918,3139460,3139453,1613360,1589229,1519108,1370158,1370148';
imageSets[3] = '5574553,5570832,5570810,5570785,5570776,5570711,5570682,5570667,5471774,5471763,5471759,5471751,5471732,5471682,3511918,3511917,3511915,3511912,3511907,3139488,3139482,3139475,3139472,3139468,3139463,3139460,3139457,3139453,1786645,1745712,1745709,1666367,1662077,1662076,1662075,1636074,1613360,1589291,1589229,1519135,1519129,1519127,1519126,1519124,1519120,1519116,1519113,1519108,1519104,1519096';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rallycards/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rallycards/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rallycards/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rallycards/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rallycards/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rallycards/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 = 'rallycards.co.uk: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      		      options.centre = 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));    }        
    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 pack of Rallycards online or order mounted print</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="garethlay@yahoo.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="garethlay@yahoo.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;
	}
}

		

