window.thumbnails = new Object();
												thumbnails[2562749] = new thumbnail(2562749,'','','1495674975_17be48347e_o_thumb.jpg',130, 195,32,'#');
												thumbnails[2562751] = new thumbnail(2562751,'','','1495724901_9ca8069d54_o2_thumb.jpg',130, 147,32,'#');
												thumbnails[2612249] = new thumbnail(2612249,'','','1497459888_05b158f4f5_b_thumb.jpg',130, 138,32,'#');
												thumbnails[2562158] = new thumbnail(2562158,'163628','','505625840_8ada425b41_o_thumb.jpg',130, 193,32,'photo_2562158.html');
												thumbnails[2562159] = new thumbnail(2562159,'163615','','537473405_25156f080d_o_thumb.jpg',130, 99,32,'photo_2562159.html');
												thumbnails[2562752] = new thumbnail(2562752,'163205','','1790595981_c7fb8d46fe_o_thumb.jpg',130, 194,32,'photo_2562752.html');
												thumbnails[2562809] = new thumbnail(2562809,'163204','','1859280103_519705e83e_o_1_thumb.jpg',130, 100,32,'photo_2562809.html');
												thumbnails[2562857] = new thumbnail(2562857,'163204','','2130901261_aa4d9ea4b3_o_thumb.jpg',130, 127,32,'photo_2562857.html');
												thumbnails[2562858] = new thumbnail(2562858,'163205','','2139261824_5e54719359_o_thumb.jpg',130, 205,32,'photo_2562858.html');
												thumbnails[2562860] = new thumbnail(2562860,'163205','','2140959041_eed6006356_o_thumb.jpg',130, 196,32,'photo_2562860.html');
												thumbnails[2562861] = new thumbnail(2562861,'163205','','2140959391_efa0c8185b_o_thumb.jpg',130, 140,32,'photo_2562861.html');
												thumbnails[2562863] = new thumbnail(2562863,'163205','','2187003701_54662b2a1d_o_thumb.jpg',130, 159,32,'photo_2562863.html');
												thumbnails[2562864] = new thumbnail(2562864,'163205','','2203776527_8d198254f9_o_thumb.jpg',130, 123,32,'photo_2562864.html');
												thumbnails[2562865] = new thumbnail(2562865,'163205','','2223752116_3d42052883_o_thumb.jpg',130, 123,32,'photo_2562865.html');
												thumbnails[2562866] = new thumbnail(2562866,'163204','','2288497337_a447e3668a_o-1_thumb.jpg',130, 135,32,'photo_2562866.html');
												thumbnails[2562868] = new thumbnail(2562868,'163205','','2303903399_aa0970d1b6_o_thumb.jpg',130, 88,32,'photo_2562868.html');
												thumbnails[2562870] = new thumbnail(2562870,'163615','','2335080161_3618c357f2_o_thumb.jpg',130, 88,32,'photo_2562870.html');
												thumbnails[2562872] = new thumbnail(2562872,'163615','','2335080383_019f24e64b_o_thumb.jpg',130, 104,32,'photo_2562872.html');
												thumbnails[2562873] = new thumbnail(2562873,'163615','','2337459311_d03f24c5e3_o_thumb.jpg',130, 96,32,'photo_2562873.html');
												thumbnails[2562874] = new thumbnail(2562874,'163615','','2392216775_2ba42b9fba_o_thumb.jpg',130, 93,32,'photo_2562874.html');
												thumbnails[2562875] = new thumbnail(2562875,'163615','','2393049758_ed486239b5_o_thumb.jpg',130, 96,32,'photo_2562875.html');
												thumbnails[2562876] = new thumbnail(2562876,'163628','','2403955426_a44ab14719_o_thumb.jpg',130, 88,32,'photo_2562876.html');
												thumbnails[2562878] = new thumbnail(2562878,'163205','','2414540532_146c65efa7_o_1_thumb.jpg',130, 95,32,'photo_2562878.html');
												thumbnails[2562879] = new thumbnail(2562879,'163205','','2456765249_b285ee0f2f_o_thumb.jpg',130, 194,32,'photo_2562879.html');
												thumbnails[2562930] = new thumbnail(2562930,'163205','','2468343513_b434f6fd98_o_thumb.jpg',130, 107,32,'photo_2562930.html');
												thumbnails[2562933] = new thumbnail(2562933,'163205','','2489992721_e31d5a8f24_o_thumb.jpg',130, 103,32,'photo_2562933.html');
												thumbnails[2562935] = new thumbnail(2562935,'163615','','2503242364_a6a4972e84_o_thumb.jpg',130, 88,32,'photo_2562935.html');
												thumbnails[2562936] = new thumbnail(2562936,'163205','','2525675652_4bed605b33_o-1_thumb.jpg',130, 129,32,'photo_2562936.html');
												thumbnails[2562939] = new thumbnail(2562939,'163204','','2561452359_d1a00bbd50_o_thumb.jpg',130, 189,32,'photo_2562939.html');
												thumbnails[2562943] = new thumbnail(2562943,'163205','','2599983825_f9cab1265f_o_thumb.jpg',130, 157,32,'photo_2562943.html');
												thumbnails[2562945] = new thumbnail(2562945,'163615','','2613248419_ac2203dab4_o_thumb.jpg',130, 143,32,'photo_2562945.html');
												thumbnails[2562949] = new thumbnail(2562949,'163615','','2614080974_18b7860c15_o_thumb.jpg',130, 94,32,'photo_2562949.html');
												thumbnails[2562981] = new thumbnail(2562981,'163204','','2304717776_4b21edff18_o_thumb.jpg',130, 92,32,'photo_2562981.html');
												thumbnails[2562983] = new thumbnail(2562983,'163205','','2489992387_abf2d1c4e1_o_thumb.jpg',130, 122,32,'photo_2562983.html');
												thumbnails[2562984] = new thumbnail(2562984,'163205','','1793638782_5e8e495351_o_thumb.jpg',130, 195,32,'photo_2562984.html');
												thumbnails[2562986] = new thumbnail(2562986,'163205','','1842966988_41c7a1ed4c_o_thumb.jpg',130, 87,32,'photo_2562986.html');
												thumbnails[2562987] = new thumbnail(2562987,'163205','','2059072869_d533ef4e36_o_1_thumb.jpg',130, 179,32,'photo_2562987.html');
												thumbnails[2562992] = new thumbnail(2562992,'163205','','2459714138_035dcf5d65_o_1_thumb.jpg',130, 193,32,'photo_2562992.html');
												thumbnails[2562994] = new thumbnail(2562994,'163204','','2710032096_9f420a591a_o_thumb.jpg',130, 98,32,'photo_2562994.html');
												thumbnails[2612245] = new thumbnail(2612245,'163615','','527865723_6925e1bce0_b_thumb.jpg',130, 100,32,'photo_2612245.html');
												thumbnails[2612255] = new thumbnail(2612255,'163615','','1558721187_6d01ff3934_o_thumb.jpg',130, 94,32,'photo_2612255.html');
												thumbnails[2612257] = new thumbnail(2612257,'163204','','1859461963_1c46862b76_b_thumb.jpg',130, 195,32,'photo_2612257.html');
												thumbnails[2612258] = new thumbnail(2612258,'163628','','2388124842_6b7c075d62_b_thumb.jpg',130, 98,32,'photo_2612258.html');
												thumbnails[2712743] = new thumbnail(2712743,'163205','','brittle_dreams_thumb.jpg',130, 87,32,'photo_2712743.html');
												thumbnails[2712754] = new thumbnail(2712754,'163615','','dai_profile_hand_thumb.jpg',130, 166,32,'photo_2712754.html');
												thumbnails[2923717] = new thumbnail(2923717,'163205','','time_travel_thumb.jpg',130, 138,32,'photo_2923717.html');
												thumbnails[2923719] = new thumbnail(2923719,'163205','','flat_liner_thumb.jpg',130, 121,32,'photo_2923719.html');
												thumbnails[3239669] = new thumbnail(3239669,'163205','','3047191145_3ebb84e914_b_thumb.jpg',130, 195,32,'photo_3239669.html');
												thumbnails[3239671] = new thumbnail(3239671,'163205','','3071363932_aa322f1416_b_thumb.jpg',130, 147,32,'photo_3239671.html');
												thumbnails[3239674] = new thumbnail(3239674,'163205','','3088713635_311e52d0b9_b_thumb.jpg',130, 130,32,'photo_3239674.html');
												thumbnails[3512439] = new thumbnail(3512439,'163205','','embers_thumb.jpg',130, 135,32,'photo_3512439.html');
												thumbnails[3864817] = new thumbnail(3864817,'252809','','noriko_april09_12_thumb.jpg',130, 124,32,'photo_3864817.html');
												thumbnails[3864911] = new thumbnail(3864911,'163205','','space_management_thumb.jpg',130, 94,32,'photo_3864911.html');
												thumbnails[3930226] = new thumbnail(3930226,'252809','','noriko_piano_may09_02smaller_thumb.jpg',130, 225,32,'photo_3930226.html');
												thumbnails[3930227] = new thumbnail(3930227,'252809','','noriko_piano_may09_04smaller_thumb.jpg',130, 87,32,'photo_3930227.html');
												thumbnails[3930230] = new thumbnail(3930230,'252809','','noriko_piano_may09_08smaller_thumb.jpg',130, 207,32,'photo_3930230.html');
												thumbnails[4280671] = new thumbnail(4280671,'252809','','noriko_piano_may09_14_smaller_thumb.jpg',130, 133,32,'photo_4280671.html');
												thumbnails[4280673] = new thumbnail(4280673,'252809','','noriko_piano_may09_19_smaller_thumb.jpg',130, 201,32,'photo_4280673.html');
												thumbnails[5007921] = new thumbnail(5007921,'163204','','sunbeams_over_the_sea_thumb.jpg',130, 86,32,'photo_5007921.html');
												thumbnails[5007928] = new thumbnail(5007928,'163204','','inviting_sea_thumb.jpg',130, 126,32,'photo_5007928.html');
												thumbnails[5007943] = new thumbnail(5007943,'163205','','waves_above_thumb.jpg',130, 195,32,'photo_5007943.html');
												thumbnails[5007959] = new thumbnail(5007959,'163205','','imperfections_thumb.jpg',130, 141,32,'photo_5007959.html');
												thumbnails[5007984] = new thumbnail(5007984,'163615','','milena_Oct09_thumb.jpg',130, 124,32,'photo_5007984.html');
												thumbnails[5007996] = new thumbnail(5007996,'163204','','autumn_bath_thumb.jpg',130, 90,32,'photo_5007996.html');
												thumbnails[5078040] = new thumbnail(5078040,'163205','','ripple_blue_thumb.jpg',130, 131,32,'photo_5078040.html');
												thumbnails[5078048] = new thumbnail(5078048,'163205','','abstract_waves_thumb.jpg',130, 130,32,'photo_5078048.html');
												thumbnails[5078054] = new thumbnail(5078054,'163615','','Theo_red_hat_nov09_thumb.jpg',130, 130,32,'photo_5078054.html');
												thumbnails[5078183] = new thumbnail(5078183,'163205','','changes_begin_from_within_thumb.jpg',130, 121,32,'photo_5078183.html');
												thumbnails[5078212] = new thumbnail(5078212,'163205','','seven_thumb.jpg',130, 139,32,'photo_5078212.html');
												thumbnails[5278772] = new thumbnail(5278772,'163205','','the_silken_tie_thumb.jpg',130, 204,32,'photo_5278772.html');
												thumbnails[5278779] = new thumbnail(5278779,'163204','','nordic_sunrise_thumb.jpg',130, 84,32,'photo_5278779.html');
												thumbnails[5325908] = new thumbnail(5325908,'163205','','sunshine_thumb.jpg',130, 144,32,'photo_5325908.html');
												thumbnails[5325936] = new thumbnail(5325936,'163205','','golden_curves_thumb.jpg',130, 195,32,'photo_5325936.html');
												thumbnails[5611886] = new thumbnail(5611886,'163205','','4341161735_a25e3b01fb_b_thumb.jpg',130, 130,32,'photo_5611886.html');
												thumbnails[5611891] = new thumbnail(5611891,'163205','','4348435227_21c6df017e_b-1_thumb.jpg',130, 130,32,'photo_5611891.html');
												thumbnails[5611893] = new thumbnail(5611893,'163205','','4351324730_39d2958c4a_b_thumb.jpg',130, 85,32,'photo_5611893.html');
												thumbnails[5611895] = new thumbnail(5611895,'163205','','4356345254_f30f81511f_b_thumb.jpg',130, 130,32,'photo_5611895.html');
												thumbnails[5611905] = new thumbnail(5611905,'163205','','4349183206_82235c7bec_o_thumb.jpg',130, 130,32,'photo_5611905.html');
												thumbnails[5611908] = new thumbnail(5611908,'163205','','4385836460_8c49e139f4_b_thumb.jpg',130, 130,32,'photo_5611908.html');
												thumbnails[5611910] = new thumbnail(5611910,'163205','','4394827356_acf9232ace_b_thumb.jpg',130, 130,32,'photo_5611910.html');
												thumbnails[6598885] = new thumbnail(6598885,'163205','','stratum_for_clickpic1_thumb.jpg',130, 130,32,'photo_6598885.html');
												thumbnails[6598913] = new thumbnail(6598913,'163205','','4888158893_9a4eed8645_z_thumb.jpg',130, 131,32,'photo_6598913.html');
												thumbnails[6598915] = new thumbnail(6598915,'163205','','4910141739_91810e9353_z_thumb.jpg',130, 130,32,'photo_6598915.html');
												thumbnails[6598917] = new thumbnail(6598917,'163205','','4910744092_fe9eb09e48_thumb.jpg',130, 155,32,'photo_6598917.html');
												thumbnails[6598922] = new thumbnail(6598922,'163615','','4128827058_8c7a380d6f_z_thumb.jpg',130, 109,32,'photo_6598922.html');
												thumbnails[6598923] = new thumbnail(6598923,'163615','','4559629165_588ee9aaf6_z_thumb.jpg',130, 130,32,'photo_6598923.html');
												thumbnails[6598929] = new thumbnail(6598929,'163615','','3788774739_4e17f904a3_z_thumb.jpg',130, 92,32,'photo_6598929.html');
												thumbnails[7144793] = new thumbnail(7144793,'163615','','misho_thumb.jpg',130, 130,32,'photo_7144793.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[252809] = new gallery(252809,'4280673,4280671,3930230,3930227,3930226,3864817','Commissions','gallery',[3864817,3930226,3930227,3930230,4280671,4280673],0, 0, '', 'gallery_252809.html',0,0);
				  					galleries[163628] = new gallery(163628,'2612258,2562876,2562158','Paris','gallery',[2562158,2562876,2612258],0, 0, '', 'gallery_163628.html',0,0);
				  					galleries[163615] = new gallery(163615,'7144793,6598929,6598923,6598922,5078054,5007984,2712754,2612255,2612245,2562949','portrait','gallery',[2562159,2562870,2562872,2562873,2562874,2562875,2562935,2562945,2562949,2612245,2612255,2712754,5007984,5078054,6598922,6598923,6598929,7144793],0, 0, '', 'gallery_163615.html',0,0);
				  					galleries[163204] = new gallery(163204,'5278779,5007996,5007928,5007921,2612257,2562994,2562981,2562939,2562866,2562857','Nature','gallery',[2562809,2562857,2562866,2562939,2562981,2562994,2612257,5007921,5007928,5007996,5278779],0, 0, '', 'gallery_163204.html',0,0);
				  					galleries[163205] = new gallery(163205,'6598917,6598915,6598913,6598885,5611910,5611908,5611905,5611895,5611893,5611891','Abstract','gallery',[2562752,2562858,2562860,2562861,2562863,2562864,2562865,2562868,2562878,2562879,2562930,2562933,2562936,2562943,2562983,2562984,2562986,2562987,2562992,2712743,2923717,2923719,3239669,3239671,3239674,3512439,3864911,5007943,5007959,5078040,5078048,5078183,5078212,5278772,5325908,5325936,5611886,5611891,5611893,5611895,5611905,5611908,5611910,6598885,6598913,6598915,6598917],0, 0, '', 'gallery_163205.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7144793,6598929,6598923,6598922,6598917,6598915,6598913,6598885,5611910,5611908,5611905,5611895,5611893,5611891,5611886,5325936,5325908,5278779,5278772,5078212,5078183,5078054,5078048,5078040,5007996,5007984,5007959,5007943,5007928,5007921,4280673,4280671,3930230,3930227,3930226,3864911,3864817,3512439,3239674,3239671,3239669,2923719,2923717,2712754,2712743,2612258,2612257,2612255,2612249,2612245';
imageSets[3] = '7144793,6598929,6598923,6598922,6598917,6598915,6598913,6598885,5611910,5611908,5611905,5611895,5611893,5611891,5611886,5325936,5325908,5278779,5278772,5078212,5078183,5078054,5078048,5078040,5007996,5007984,5007959,5007943,5007928,5007921,4280673,4280671,3930230,3930227,3930226,3864911,3864817,3512439,3239674,3239671,3239669,2923719,2923717,2712754,2712743,2612258,2612257,2612255,2612249,2612245';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/milenamihaylova/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/milenamihaylova/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 = 'Milena Mihaylova Photography: ' + 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;
	}
}

			

