window.thumbnails = new Object();
												thumbnails[360358] = new thumbnail(360358,'29631','Studio of Ghirlandaio','180_thumb.jpg',130, 162,18,'photo_360358.html');
												thumbnails[360581] = new thumbnail(360581,'29632','White, Black, Yellow & Blue',' 1641_thumb.jpg',130, 130,18,'photo_360581.html');
												thumbnails[363067] = new thumbnail(363067,'29633','Study of a Head, I','study_thumb.jpg',130, 130,18,'photo_363067.html');
												thumbnails[2474160] = new thumbnail(2474160,'29637','Composition, I','c225_thumb.jpg',130, 131,18,'photo_2474160.html');
												thumbnails[5023113] = new thumbnail(5023113,'29634','Nude Torso','torso2_thumb.jpg',130, 163,18,'photo_5023113.html');
												thumbnails[5633014] = new thumbnail(5633014,'319436','Zurbaran','IMG_4444_thumb.jpg',130, 153,18,'photo_5633014.html');
												thumbnails[7990069] = new thumbnail(7990069,'429599','Away We Go','2651_thumb.jpg',130, 131,18,'photo_7990069.html');
												thumbnails[5386972] = new thumbnail(5386972,'284304','Self  No.48','400x400px_thumb.jpg',130, 130,18,'photo_5386972.html');
												thumbnails[5629053] = new thumbnail(5629053,'284304','Woman in White','_245500x500_thumb.jpg',130, 130,18,'photo_5629053.html');
												thumbnails[5202926] = new thumbnail(5202926,'284304','Daniel','111_thumb.jpg',130, 128,18,'photo_5202926.html');
												thumbnails[2482673] = new thumbnail(2482673,'284304','Painter\'s Mother','174_thumb.jpg',130, 115,18,'photo_2482673.html');
												thumbnails[360366] = new thumbnail(360366,'29631','Studio of Botticelli',' 181_thumb.jpg',130, 164,18,'photo_360366.html');
												thumbnails[360585] = new thumbnail(360585,'29632','Black, Red, Yellow & Blue',' 172_thumb.jpg',130, 130,18,'photo_360585.html');
												thumbnails[363073] = new thumbnail(363073,'29633','Study of a Head, II','head_thumb.jpg',130, 130,18,'photo_363073.html');
												thumbnails[363161] = new thumbnail(363161,'284304','To the One Who Knows','dreamer_thumb.jpg',130, 159,18,'photo_363161.html');
												thumbnails[363330] = new thumbnail(363330,'29636','The Singer','43_thumb.jpg',130, 160,18,'photo_363330.html');
												thumbnails[2474159] = new thumbnail(2474159,'29637','Composition, III','c224_thumb.jpg',130, 130,18,'photo_2474159.html');
												thumbnails[5023120] = new thumbnail(5023120,'29634','Nude Torso','torso3_thumb.jpg',130, 162,18,'photo_5023120.html');
												thumbnails[5632765] = new thumbnail(5632765,'319436','The Passion','246400x4701_thumb.jpg',130, 154,18,'photo_5632765.html');
												thumbnails[7992494] = new thumbnail(7992494,'429599','Giving Chance a Chance, I','271_thumb.jpg',130, 130,18,'photo_7992494.html');
												thumbnails[360439] = new thumbnail(360439,'29632','Vanity',' 175_thumb.jpg',130, 131,18,'photo_360439.html');
												thumbnails[363105] = new thumbnail(363105,'29636','Masquerade','61_thumb.jpg',130, 159,18,'photo_363105.html');
												thumbnails[363398] = new thumbnail(363398,'284304','St Francis and an Angel','francis_thumb.jpg',130, 163,18,'photo_363398.html');
												thumbnails[4002065] = new thumbnail(4002065,'29637','Kite in the Studio','241vk_thumb.jpg',130, 130,18,'photo_4002065.html');
												thumbnails[6087303] = new thumbnail(6087303,'319436','Mantegna','IMG_4664_thumb.jpg',130, 163,18,'photo_6087303.html');
												thumbnails[7992505] = new thumbnail(7992505,'429599','Giving Chance a Chance, II','272_thumb.jpg',130, 130,18,'photo_7992505.html');
												thumbnails[361386] = new thumbnail(361386,'284304','Sallyanne','217_thumb.jpg',130, 163,18,'photo_361386.html');
												thumbnails[363154] = new thumbnail(363154,'29636','In the Morning Light','42_thumb.jpg',130, 160,18,'photo_363154.html');
												thumbnails[363336] = new thumbnail(363336,'29633','Head Study, IV','interview_thumb.jpg',130, 130,18,'photo_363336.html');
												thumbnails[4002061] = new thumbnail(4002061,'29637','Kite in the Studio','240vk_thumb.jpg',130, 130,18,'photo_4002061.html');
												thumbnails[5727103] = new thumbnail(5727103,'319436','Ecce Homo','247500x500_thumb.jpg',130, 129,18,'photo_5727103.html');
												thumbnails[7992525] = new thumbnail(7992525,'429599','Body Talk','268_thumb.jpg',130, 131,18,'photo_7992525.html');
												thumbnails[4002049] = new thumbnail(4002049,'29637','Orpheus and Eurydice  ','239vk_thumb.jpg',130, 130,18,'photo_4002049.html');
												thumbnails[4002059] = new thumbnail(4002059,'29637','Orpheus','238vk_thumb.jpg',130, 130,18,'photo_4002059.html');
												thumbnails[360397] = new thumbnail(360397,'29631','Studio of Gericault','119_thumb.jpg',130, 160,18,'photo_360397.html');
												thumbnails[360707] = new thumbnail(360707,'29637','Composition',' 196_thumb.jpg',130, 107,18,'photo_360707.html');
												thumbnails[360812] = new thumbnail(360812,'29634','By the Black Screen',' 135_thumb.jpg',130, 162,18,'photo_360812.html');
												thumbnails[360825] = new thumbnail(360825,'29633','Character Study, II',' 214_thumb.jpg',130, 130,18,'photo_360825.html');
												thumbnails[360893] = new thumbnail(360893,'284304','Interview',' 127_thumb.jpg',130, 162,18,'photo_360893.html');
												thumbnails[363315] = new thumbnail(363315,'29636','Legacy','46_thumb.jpg',130, 160,18,'photo_363315.html');
												thumbnails[6087300] = new thumbnail(6087300,'319436','Piero','IMG_4663_thumb.jpg',130, 92,18,'photo_6087300.html');
												thumbnails[7992550] = new thumbnail(7992550,'429599','Adagio Melancholico','266_thumb.jpg',130, 130,18,'photo_7992550.html');
												thumbnails[360399] = new thumbnail(360399,'29631','Studio of Brugghen','118_thumb.jpg',130, 160,18,'photo_360399.html');
												thumbnails[363127] = new thumbnail(363127,'29636','Cassandra','cassandra_thumb.jpg',130, 158,18,'photo_363127.html');
												thumbnails[363151] = new thumbnail(363151,'29634','Nude Seated','nude_thumb.jpg',130, 163,18,'photo_363151.html');
												thumbnails[6087290] = new thumbnail(6087290,'319436','Flagellation','249400x500_thumb.jpg',130, 109,18,'photo_6087290.html');
												thumbnails[7992563] = new thumbnail(7992563,'429599','Someone For Everyone','270_thumb.jpg',130, 130,18,'photo_7992563.html');
												thumbnails[360435] = new thumbnail(360435,'29636','First Touch','218_thumb.jpg',130, 159,18,'photo_360435.html');
												thumbnails[360619] = new thumbnail(360619,'29632','Whispers',' 182_thumb.jpg',130, 130,18,'photo_360619.html');
												thumbnails[5202968] = new thumbnail(5202968,'319436','The Origins of Argument','243_thumb.jpg',130, 95,18,'photo_5202968.html');
												thumbnails[7992571] = new thumbnail(7992571,'429599','A Question of Attitude','267_thumb.jpg',130, 129,18,'photo_7992571.html');
												thumbnails[360621] = new thumbnail(360621,'29632','Belgian Pears',' 179_thumb.jpg',130, 131,18,'photo_360621.html');
												thumbnails[360690] = new thumbnail(360690,'29636','Ritual',' 220_thumb.jpg',130, 156,18,'photo_360690.html');
												thumbnails[369962] = new thumbnail(369962,'29634','Seated Nude','97_thumb.jpg',130, 163,18,'photo_369962.html');
												thumbnails[2767961] = new thumbnail(2767961,'29633','Natalie','b_thumb.jpg',130, 130,18,'photo_2767961.html');
												thumbnails[7992568] = new thumbnail(7992568,'429599','The Midday Ritual','263_thumb.jpg',130, 130,18,'photo_7992568.html');
												thumbnails[360416] = new thumbnail(360416,'29632','Grand Lotus',' 207_thumb.jpg',130, 130,18,'photo_360416.html');
												thumbnails[360813] = new thumbnail(360813,'29634','Character Study, I',' 212_thumb.jpg',130, 130,18,'photo_360813.html');
												thumbnails[2482674] = new thumbnail(2482674,'29636','Model in The Studio','48_thumb.jpg',130, 162,18,'photo_2482674.html');
												thumbnails[360613] = new thumbnail(360613,'29632','Reflections',' 199_thumb.jpg',130, 130,18,'photo_360613.html');
												thumbnails[360815] = new thumbnail(360815,'29634','Character Study, III',' 213_thumb.jpg',130, 131,18,'photo_360815.html');
												thumbnails[3083071] = new thumbnail(3083071,'29633','The Player',' 234_thumb.jpg',130, 129,2,'photo_3083071.html');
												thumbnails[360419] = new thumbnail(360419,'29631','Card from Rome',' 189_thumb.jpg',130, 129,18,'photo_360419.html');
												thumbnails[360816] = new thumbnail(360816,'29634','Naked Portrait','134_thumb.jpg',130, 106,18,'photo_360816.html');
												thumbnails[2483130] = new thumbnail(2483130,'29633','Lady in a Turban, II','8_thumb.jpg',130, 133,18,'photo_2483130.html');
												thumbnails[360423] = new thumbnail(360423,'29631','Card from Florence',' 186_thumb.jpg',130, 131,18,'photo_360423.html');
												thumbnails[375834] = new thumbnail(375834,'29633','Self Portrait','156_thumb.jpg',130, 130,18,'photo_375834.html');
												thumbnails[2471528] = new thumbnail(2471528,'158749','','32911_thumb.jpg',130, 173,18,'photo_2471528.html');
												thumbnails[2469723] = new thumbnail(2469723,'158741','Pomegranates','131600272_thumb.jpg',130, 164,18,'photo_2469723.html');
												thumbnails[2469727] = new thumbnail(2469727,'158741','','131600261_thumb.jpg',130, 164,18,'photo_2469727.html');
												thumbnails[2469730] = new thumbnail(2469730,'158741','','131600251_thumb.jpg',130, 162,18,'photo_2469730.html');
												thumbnails[2469732] = new thumbnail(2469732,'158741','','131600141_thumb.jpg',130, 164,18,'photo_2469732.html');
												thumbnails[2471529] = new thumbnail(2471529,'158749','','33101_thumb.jpg',130, 176,18,'photo_2471529.html');
												thumbnails[2471530] = new thumbnail(2471530,'158749','','33181_thumb.jpg',130, 173,18,'photo_2471530.html');
												thumbnails[2471531] = new thumbnail(2471531,'158749','','33681_thumb.jpg',130, 173,18,'photo_2471531.html');
												thumbnails[2469238] = new thumbnail(2469238,'158741','Reflections','13160010_thumb.jpg',130, 164,18,'photo_2469238.html');
												thumbnails[2471505] = new thumbnail(2471505,'158749','','3307_thumb.jpg',130, 98,18,'photo_2471505.html');
												thumbnails[2471506] = new thumbnail(2471506,'158749','','3301_thumb.jpg',130, 101,18,'photo_2471506.html');
												thumbnails[2469293] = new thumbnail(2469293,'158741','','13160008_thumb.jpg',130, 164,18,'photo_2469293.html');
												thumbnails[2471508] = new thumbnail(2471508,'158749','','3304_thumb.jpg',130, 93,18,'photo_2471508.html');
												thumbnails[2469370] = new thumbnail(2469370,'158741','','13160039_thumb.jpg',130, 165,18,'photo_2469370.html');
												thumbnails[2464574] = new thumbnail(2464574,'158741','','13160002_thumb.jpg',130, 163,18,'photo_2464574.html');
												thumbnails[2471519] = new thumbnail(2471519,'158749','','3323_thumb.jpg',130, 107,18,'photo_2471519.html');
												thumbnails[2469591] = new thumbnail(2469591,'158741','Floating','13160003_thumb.jpg',130, 165,18,'photo_2469591.html');
												thumbnails[2469603] = new thumbnail(2469603,'158741','','13160028_thumb.jpg',130, 164,18,'photo_2469603.html');
												thumbnails[2469606] = new thumbnail(2469606,'158741','','13160022_thumb.jpg',130, 163,18,'photo_2469606.html');
												thumbnails[4324368] = new thumbnail(4324368,'30679','','about1_thumb.jpg',130, 110,18,'photo_4324368.html');
												thumbnails[5204258] = new thumbnail(5204258,'30679','','d_thumb.jpg',130, 50,18,'photo_5204258.html');
												thumbnails[5614229] = new thumbnail(5614229,'30679','','243560x560_thumb.jpg',130, 130,18,'photo_5614229.html');
												thumbnails[5620867] = new thumbnail(5620867,'30679','','_245560x236_thumb.jpg',130, 55,18,'photo_5620867.html');
												thumbnails[5614375] = new thumbnail(5614375,'30679','','246560x235_thumb.jpg',130, 55,18,'photo_5614375.html');
												thumbnails[5614475] = new thumbnail(5614475,'30679','','244560x240_thumb.jpg',130, 56,18,'photo_5614475.html');
												thumbnails[5615782] = new thumbnail(5615782,'30679','','_234560_x_235_thumb.jpg',130, 55,18,'photo_5615782.html');
												thumbnails[5620806] = new thumbnail(5620806,'30679','','___67560x246_thumb.jpg',130, 57,18,'photo_5620806.html');
												thumbnails[5620825] = new thumbnail(5620825,'30679','','_217560x235_thumb.jpg',130, 55,18,'photo_5620825.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[30679] = new gallery(30679,'5620867,5620825,5620806,5615782,5614475,5614375,5614229,5204258,4324368','1','section50148',[4324368,5204258,5614229,5620867,5614375,5614475,5615782,5620806,5620825],0, 0, '', 'section50148.html',0,1);
				  					galleries[29633] = new gallery(29633,'363073','head study','section48818',[363067,363073,363336,360825,2767961,3083071,2483130,375834],0, 0, '', 'section48818_29633.html',0,0);
				  					galleries[158741] = new gallery(158741,'2464574','paintings','section201172',[2469723,2469727,2469730,2469732,2469238,2469293,2469370,2464574,2469591,2469603,2469606],0, 0, '', 'section201172_158741.html',0,0);
				  					galleries[158749] = new gallery(158749,'2471528','site images','section201172',[2471528,2471529,2471530,2471531,2471505,2471506,2471508,2471519],0, 0, '', 'section201172_158749.html',0,0);
				  					galleries[29632] = new gallery(29632,'360585','still life','section48818',[360581,360585,360439,360619,360621,360416,360613],0, 0, '', 'section48818_29632.html',0,0);
				  					galleries[29637] = new gallery(29637,'2474160','compositions','section48818',[2474160,2474159,4002065,4002061,4002049,4002059,360707],0, 0, '', 'section48818_29637.html',0,0);
				  					galleries[284304] = new gallery(284304,'5386972','portrait','section48818',[5386972,5629053,5202926,2482673,363161,363398,361386,360893],0, 0, '', 'section48818_284304.html',0,0);
				  					galleries[29631] = new gallery(29631,'360358','homage ','section48818',[360358,360366,360397,360399,360419,360423],0, 0, '', 'section48818_29631.html',0,0);
				  					galleries[29636] = new gallery(29636,'363154','figure','section48818',[363330,363105,363154,363315,363127,360435,360690,2482674],0, 0, '', 'section48818_29636.html',0,0);
				  					galleries[29634] = new gallery(29634,'5023120','nude','section48818',[5023113,5023120,360812,363151,369962,360813,360815,360816],0, 0, '', 'section48818_29634.html',0,0);
				  					galleries[319436] = new gallery(319436,'5632765','2010','section48818',[5633014,5632765,6087303,5727103,6087300,6087290,5202968],0, 0, '', 'section48818_319436.html',0,0);
				  					galleries[429599] = new gallery(429599,'7992494','2011','section48818',[7990069,7992494,7992505,7992525,7992550,7992563,7992571,7992568],0, 0, '', 'section48818_429599.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5614229';
imageSets[2] = '7992494,5632765,5386972,5023120,2474160,2471528,2464574,363154,363073,360585,360358';
imageSets[3] = '5727103';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Valery/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Valery/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Valery/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Valery/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Valery/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Valery/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 += 'section48818.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 && 'section48818' != '') {
					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 = 'Valery Koroshilov Fine Art Painting: ' + 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 == 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;
	}
}

			

