window.thumbnails = new Object();
												thumbnails[5349124] = new thumbnail(5349124,'301122','Sian','sian1_thumb.jpg',130, 87,5,'photo_5349124.html');
												thumbnails[5349128] = new thumbnail(5349128,'301122','','thomas6_thumb.jpg',130, 87,5,'photo_5349128.html');
												thumbnails[5349249] = new thumbnail(5349249,'301122','Ryan Inglis','ryan5_thumb.jpg',130, 87,5,'photo_5349249.html');
												thumbnails[5349356] = new thumbnail(5349356,'301122','Kiss','sian2_thumb.jpg',130, 103,5,'photo_5349356.html');
												thumbnails[5349536] = new thumbnail(5349536,'301122','Mario Ellis','mario9_thumb.jpg',130, 98,5,'photo_5349536.html');
												thumbnails[5349660] = new thumbnail(5349660,'301122','Terri','4014753424_1f0c6e1271_b_thumb.jpg',130, 195,5,'photo_5349660.html');
												thumbnails[5349734] = new thumbnail(5349734,'301122','Sian','4072800606_fe60d2e98a_thumb.jpg',130, 195,5,'photo_5349734.html');
												thumbnails[5349737] = new thumbnail(5349737,'301122','Amy','4053236063_9d2dbfb0d4_thumb.jpg',130, 195,5,'photo_5349737.html');
												thumbnails[5349739] = new thumbnail(5349739,'301122','Tom Conibear','4050987294_ed5271cf8b_thumb.jpg',130, 195,5,'photo_5349739.html');
												thumbnails[5349745] = new thumbnail(5349745,'301122','Sian','4017146467_5840970b9d_thumb.jpg',130, 195,5,'photo_5349745.html');
												thumbnails[5350264] = new thumbnail(5350264,'301122','Terri','9930_155498454486_91262169486_2433378_199049_n_thumb.jpg',130, 195,5,'photo_5350264.html');
												thumbnails[5350600] = new thumbnail(5350600,'301122','Tom Conibear','4052134139_6e751c6c77_thumb.jpg',130, 195,5,'photo_5350600.html');
												thumbnails[5412824] = new thumbnail(5412824,'301122','Alison Eales','4301027027_d32cb9c946_thumb.jpg',130, 195,5,'photo_5412824.html');
												thumbnails[5456641] = new thumbnail(5456641,'301122','Kate Lee','4327830326_948a02f771_thumb.jpg',130, 108,5,'photo_5456641.html');
												thumbnails[5918756] = new thumbnail(5918756,'301122','Amy-lou','4584082067_345f6b9a8d_thumb.jpg',130, 195,5,'photo_5918756.html');
												thumbnails[5918760] = new thumbnail(5918760,'301122','Amy Lou','4582933078_d44ed8ab9e_thumb.jpg',130, 195,5,'photo_5918760.html');
												thumbnails[7424681] = new thumbnail(7424681,'301122','Becky Tomkins','5452840035_496d3f518e_thumb.jpg',130, 87,5,'photo_7424681.html');
												thumbnails[5349934] = new thumbnail(5349934,'301234','Backstage','3944947607_ab7eafdd8e_thumb.jpg',130, 195,5,'photo_5349934.html');
												thumbnails[5349937] = new thumbnail(5349937,'301234','Mic & Drum','3943887127_4cbf006ec61_thumb.jpg',130, 195,5,'photo_5349937.html');
												thumbnails[5349938] = new thumbnail(5349938,'301234','Drum Stool','3941056953_ca1254755b1_thumb.jpg',130, 87,5,'photo_5349938.html');
												thumbnails[5349940] = new thumbnail(5349940,'301234','\'59 Mic','3809224107_45e5c4d89c1_thumb.jpg',130, 87,5,'photo_5349940.html');
												thumbnails[5349941] = new thumbnail(5349941,'301234','Snare Drum & Mic','3796602531_e482f5e9e61_thumb.jpg',130, 87,5,'photo_5349941.html');
												thumbnails[5350031] = new thumbnail(5350031,'301234','Tuning Snare Drum','3944272376_b39d881237_thumb.jpg',130, 87,5,'photo_5350031.html');
												thumbnails[5350032] = new thumbnail(5350032,'301234','Drum Pedal','3797410594_a177521b15_thumb.jpg',130, 87,5,'photo_5350032.html');
												thumbnails[5350033] = new thumbnail(5350033,'301234','Trombone','3723990655_15c0747f50_thumb.jpg',130, 87,5,'photo_5350033.html');
												thumbnails[5350140] = new thumbnail(5350140,'301234','Bass Head','3720865894_55503a82a9_thumb.jpg',130, 195,5,'photo_5350140.html');
												thumbnails[5350230] = new thumbnail(5350230,'301234','Drum Pedals','3944404332_64c99e135a_thumb.jpg',130, 195,5,'photo_5350230.html');
												thumbnails[5356614] = new thumbnail(5356614,'301234','Stage Lighting','3797406750_24e983bdcd_1_thumb.jpg',130, 87,5,'photo_5356614.html');
												thumbnails[5356981] = new thumbnail(5356981,'301234','','3759605007_399dab0f9b_thumb.jpg',130, 195,5,'photo_5356981.html');
												thumbnails[5643777] = new thumbnail(5643777,'301234','Amp','4433232256_08c8575f1a_thumb.jpg',130, 87,5,'photo_5643777.html');
												thumbnails[5643863] = new thumbnail(5643863,'301234','Bass Guitar','4433228018_5a61c3c8f0_thumb.jpg',130, 108,5,'photo_5643863.html');
												thumbnails[5643911] = new thumbnail(5643911,'301234','Tom Tom','4433225276_3b94af7f5d_thumb.jpg',130, 108,5,'photo_5643911.html');
												thumbnails[5643981] = new thumbnail(5643981,'301234','Drum Sticks','4432280363_76da6dba09_thumb.jpg',130, 108,5,'photo_5643981.html');
												thumbnails[5644040] = new thumbnail(5644040,'301234','Guitar Tuner','4432950058_ee26f314e6_thumb.jpg',130, 108,5,'photo_5644040.html');
												thumbnails[5644043] = new thumbnail(5644043,'301234','Trumpet','4413918429_dc57116d17_thumb.jpg',130, 207,5,'photo_5644043.html');
												thumbnails[5841901] = new thumbnail(5841901,'301234','Adam Chetland','4511498316_96c9e9f562_thumb.jpg',130, 108,5,'photo_5841901.html');
												thumbnails[5842564] = new thumbnail(5842564,'301234','Headphones','3797346294_432103d6f0_thumb.jpg',130, 87,5,'photo_5842564.html');
												thumbnails[5931316] = new thumbnail(5931316,'301234','Cymbals','4591924009_d974209d19_thumb.jpg',130, 195,5,'photo_5931316.html');
												thumbnails[5931318] = new thumbnail(5931318,'301234','Tom Sheppard','4592466122_ef49974199_thumb.jpg',130, 108,5,'photo_5931318.html');
												thumbnails[5931319] = new thumbnail(5931319,'301234','Drum Pedal','4592575096_e272177eda_thumb.jpg',130, 108,5,'photo_5931319.html');
												thumbnails[5931321] = new thumbnail(5931321,'301234','Drum Sticks','4592632758_ac7d088974_thumb.jpg',130, 108,5,'photo_5931321.html');
												thumbnails[5349744] = new thumbnail(5349744,'301121','Colin MacIntyre','4075259037_e5b2e95907_thumb.jpg',130, 87,5,'photo_5349744.html');
												thumbnails[5349748] = new thumbnail(5349748,'301121','Tom Forrister ','3944594408_94b4748e28_thumb.jpg',130, 195,5,'photo_5349748.html');
												thumbnails[5349750] = new thumbnail(5349750,'301121','Sleeping With Satellites ','3796549059_efee1ffb46_thumb.jpg',130, 195,5,'photo_5349750.html');
												thumbnails[5349751] = new thumbnail(5349751,'301121','Alex Lipinski','3796515377_efbdd6bf13_thumb.jpg',130, 195,5,'photo_5349751.html');
												thumbnails[5349753] = new thumbnail(5349753,'301121','Skank Tank ','3541949955_d113736eed_thumb.jpg',130, 195,5,'photo_5349753.html');
												thumbnails[5349755] = new thumbnail(5349755,'301121','Skank Tank ','3637573735_06868f9e27_thumb.jpg',130, 87,5,'photo_5349755.html');
												thumbnails[5349760] = new thumbnail(5349760,'301121','Abie Jones ','3638406766_95278b2879_thumb.jpg',130, 87,5,'photo_5349760.html');
												thumbnails[5349761] = new thumbnail(5349761,'301121','Harry North ','3657679163_c9cbe2f8dd_thumb.jpg',130, 195,5,'photo_5349761.html');
												thumbnails[5350052] = new thumbnail(5350052,'301121','Adam Lipinski','3225730863_5c4dddf834_thumb.jpg',130, 87,5,'photo_5350052.html');
												thumbnails[5350258] = new thumbnail(5350258,'301121','Streetfest UK','3944457907_88720a09ef_thumb.jpg',130, 195,5,'photo_5350258.html');
												thumbnails[5351983] = new thumbnail(5351983,'301121','Junkyard Scientists','3637603951_f0df282c02_thumb.jpg',130, 212,5,'photo_5351983.html');
												thumbnails[5351986] = new thumbnail(5351986,'301121','Sickwax ','3638434106_60ea556c25_thumb.jpg',130, 195,5,'photo_5351986.html');
												thumbnails[5351988] = new thumbnail(5351988,'301121','Paul Shippey ','3737034883_9eacfa6256_thumb.jpg',130, 195,5,'photo_5351988.html');
												thumbnails[5352293] = new thumbnail(5352293,'301121','Chiller','3760407172_c920712b14_thumb.jpg',130, 87,5,'photo_5352293.html');
												thumbnails[5352330] = new thumbnail(5352330,'301121','Alex Lipinski ','3759575637_01789e1ea8_thumb.jpg',130, 87,5,'photo_5352330.html');
												thumbnails[5356444] = new thumbnail(5356444,'301121','BMX','3447699403_57aec90c60_thumb.jpg',130, 87,5,'photo_5356444.html');
												thumbnails[5357076] = new thumbnail(5357076,'301121','\'House of the flying Slippers\' ','3944247615_45b89965ac_thumb.jpg',130, 61,5,'photo_5357076.html');
												thumbnails[5452120] = new thumbnail(5452120,'301121','Adam Bowers','4323577949_d8b715edb7_thumb.jpg',130, 195,5,'photo_5452120.html');
												thumbnails[5570291] = new thumbnail(5570291,'301121','Rich Evans from Skank Tank ','4395173593_cf1fcf69de_thumb.jpg',130, 108,5,'photo_5570291.html');
												thumbnails[5349358] = new thumbnail(5349358,'301181','Ryan Inglis','edit4_thumb.jpg',130, 120,5,'photo_5349358.html');
												thumbnails[5349361] = new thumbnail(5349361,'301181','DJ Bella Beatz','hollinsheadheadhots10007_thumb.jpg',130, 87,5,'photo_5349361.html');
												thumbnails[5349643] = new thumbnail(5349643,'301181','Fibre Mic','3660324376_2efe591ff8_thumb.jpg',130, 87,5,'photo_5349643.html');
												thumbnails[5349649] = new thumbnail(5349649,'301181','Ryan Inglis','4075186771_8c2d75f951_b_thumb.jpg',130, 122,5,'photo_5349649.html');
												thumbnails[5349681] = new thumbnail(5349681,'301181','DJ Bella Beatz','3759579481_f87b05e6e1_thumb.jpg',130, 87,5,'photo_5349681.html');
												thumbnails[5349764] = new thumbnail(5349764,'301181','Lenny Savage','3447741297_31d55df20d_thumb.jpg',130, 195,5,'photo_5349764.html');
												thumbnails[5350141] = new thumbnail(5350141,'301181','Mario Ellis','4012436410_cecbd1ba0f_thumb.jpg',130, 195,5,'photo_5350141.html');
												thumbnails[5350214] = new thumbnail(5350214,'301181','DJ Bella Beatz','3676016550_44c3772853_thumb.jpg',130, 195,5,'photo_5350214.html');
												thumbnails[5358358] = new thumbnail(5358358,'301181','Alex Lipinski Album Cover','3051027878_d3d929d5a9_1_thumb.jpg',130, 106,5,'photo_5358358.html');
												thumbnails[5358360] = new thumbnail(5358360,'301181','Alex Lipinski Band','3050991820_a85e173751_1_thumb.jpg',130, 98,5,'photo_5358360.html');
												thumbnails[5415932] = new thumbnail(5415932,'301181','Kate Lee','4304274860_01a61e2154_thumb.jpg',130, 96,5,'photo_5415932.html');
												thumbnails[5422975] = new thumbnail(5422975,'301181','Alison Eales','4304191279_3fec046128_thumb.jpg',130, 77,5,'photo_5422975.html');
												thumbnails[5456639] = new thumbnail(5456639,'301181','KLEE Photography','4327798611_957d1c4bbf_thumb.jpg',130, 107,5,'photo_5456639.html');
												thumbnails[5998361] = new thumbnail(5998361,'301181','Skank Tank','4619076495_a73eb4a48b_thumb.jpg',130, 87,5,'photo_5998361.html');
												thumbnails[5998365] = new thumbnail(5998365,'301181','Skank Tank','4621246651_005ef4c10c_thumb.jpg',130, 87,5,'photo_5998365.html');
												thumbnails[5998369] = new thumbnail(5998369,'301181','','4625300352_015c32613a_thumb.jpg',130, 108,5,'photo_5998369.html');
												thumbnails[6115202] = new thumbnail(6115202,'301181','The Emperials','4677885043_668345d0bf_thumb.jpg',130, 195,5,'photo_6115202.html');
												thumbnails[6525468] = new thumbnail(6525468,'301181','Corinna Jane','4885119898_15a7a0f1d5_thumb.jpg',130, 195,5,'photo_6525468.html');
												thumbnails[7424663] = new thumbnail(7424663,'301181','Miss Skarlett','5366978456_1cf04ef852_thumb.jpg',130, 195,5,'photo_7424663.html');
												thumbnails[7424671] = new thumbnail(7424671,'301181','Miss Skarlet Promo Shoot','5257415470_7740e7fdca_thumb.jpg',130, 143,5,'photo_7424671.html');
												thumbnails[7424673] = new thumbnail(7424673,'301181','Displaced','5226474738_dca17a8121_thumb.jpg',130, 195,5,'photo_7424673.html');
												thumbnails[7424689] = new thumbnail(7424689,'301181','Anthony Lee & Alex Lee','4856443501_bcdf46b807_thumb.jpg',130, 108,5,'photo_7424689.html');
												thumbnails[7424699] = new thumbnail(7424699,'301181','Corinna Jane','5003551073_c3050a7d1b_thumb.jpg',130, 195,5,'photo_7424699.html');
												thumbnails[7439293] = new thumbnail(7439293,'301181','Jambo Reign','5464248789_f7d16893d1_thumb.jpg',130, 87,5,'photo_7439293.html');
												thumbnails[5350045] = new thumbnail(5350045,'301233','In the studio with Lenny Savage','3760495413_85fa542015_thumb.jpg',130, 56,5,'photo_5350045.html');
												thumbnails[5350046] = new thumbnail(5350046,'301233','In the studio with Lenny Savage','3761298926_4bedd3c403_thumb.jpg',130, 56,5,'photo_5350046.html');
												thumbnails[5350047] = new thumbnail(5350047,'301233','Tony Hobden, Music Producer','3761267588_64781df79b_thumb.jpg',130, 166,5,'photo_5350047.html');
												thumbnails[5350057] = new thumbnail(5350057,'301233','Tim Sweet & Lipinski Brothers','3583742652_50ced7f133_thumb.jpg',130, 87,5,'photo_5350057.html');
												thumbnails[5350135] = new thumbnail(5350135,'301233','Robert Michael Clarke','3660308898_9d5e3daa12_thumb.jpg',130, 87,5,'photo_5350135.html');
												thumbnails[5350138] = new thumbnail(5350138,'301233','Robert Michael Clarke','3659510363_84778ffa1e_thumb.jpg',130, 195,5,'photo_5350138.html');
												thumbnails[5350144] = new thumbnail(5350144,'301233','Skank Tank (Backstage) @ Streetfest \'09','3945591005_742d4cfbb5_thumb.jpg',130, 87,5,'photo_5350144.html');
												thumbnails[5350215] = new thumbnail(5350215,'301233','The Borderline, London','4073034392_665dcc1c1b_thumb.jpg',130, 114,5,'photo_5350215.html');
												thumbnails[5357169] = new thumbnail(5357169,'301233','Backstage at Unsigned Music Live','3797354858_9170915bb5_thumb.jpg',130, 87,5,'photo_5357169.html');
												thumbnails[5644044] = new thumbnail(5644044,'301233','','4414502278_e194fe1c2b_thumb.jpg',130, 108,5,'photo_5644044.html');
												thumbnails[5842542] = new thumbnail(5842542,'301233','Lenny Savage in the studio.','3761268072_3b31d2e259_thumb.jpg',130, 166,5,'photo_5842542.html');
												thumbnails[5842559] = new thumbnail(5842559,'301233','Miss Skarlet, outside DB\'s, Weston-Super-Mare','24961_380176794486_91262169486_3499494_6684483_n_thumb.jpg',130, 87,5,'photo_5842559.html');
												thumbnails[5931322] = new thumbnail(5931322,'301233','Miss Skarlet','4511564760_e0c4f4e343_thumb.jpg',130, 166,5,'photo_5931322.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[301121] = new gallery(301121,'5350258,5350052,5349761,5349760,5349755,5349753,5349751,5349750,5349748,5349744','Live Music/Events','section360349',[5349744,5349748,5349750,5349751,5349753,5349755,5349760,5349761,5350052,5350258,5351983,5351986,5351988,5352293,5352330,5356444,5357076,5452120,5570291],0, 0, '', 'section360349.html',0,1);
				  					galleries[301122] = new gallery(301122,'5350264,5349745,5349739,5349737,5349734,5349536','Studio Photography','section360348',[5349124,5349128,5349249,5349356,5349536,5349660,5349734,5349737,5349739,5349745,5350264,5350600,5412824,5456641,5918756,5918760,7424681],0, 0, '', 'section360348.html',0,1);
				  					galleries[301181] = new gallery(301181,'5350214,5349764,5349643,5349361','Promos','section360350',[5349358,5349361,5349643,5349649,5349681,5349764,5350141,5350214,5358358,5358360,5415932,5422975,5456639,5998361,5998365,5998369,6115202,6525468,7424663,7424671,7424673,7424689,7424699,7439293],0, 0, '', 'section360350.html',0,1);
				  					galleries[301234] = new gallery(301234,'5350230,5350033,5350032,5350031,5349941,5349940,5349937','Art','gallery',[5349934,5349937,5349938,5349940,5349941,5350031,5350032,5350033,5350140,5350230,5356614,5356981,5643777,5643863,5643911,5643981,5644040,5644043,5841901,5842564,5931316,5931318,5931319,5931321],0, 0, '', 'gallery.html',0,1);
				  					galleries[301233] = new gallery(301233,'5350047,5350046','Documentary','section360351',[5350045,5350046,5350047,5350057,5350135,5350138,5350144,5350215,5357169,5644044,5842542,5842559,5931322],0, 0, '', 'section360351.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7439293,7424699,7424689,7424681,7424673,7424671,7424663,6525468,6115202,5998369,5998365,5998361,5931322,5931321,5931319,5931318,5931316,5918760,5918756,5842564,5842559,5842542,5841901,5644044,5644043,5644040,5643981,5643911,5643863,5643777,5570291,5456641,5456639,5452120,5422975,5415932,5412824,5358360,5358358,5357169,5357076,5356981,5356614,5356444,5352330,5352293,5351988,5351986,5351983,5350600';
imageSets[2] = '5350264,5350258,5350230,5350214,5350052,5350047,5350046,5350033,5350032,5350031,5349941,5349940,5349937,5349764,5349761,5349760,5349755,5349753,5349751,5349750,5349748,5349745,5349744,5349739,5349737,5349734,5349643,5349536,5349361';
imageSets[3] = '5350230,5349941,5349937,5349681,5349536,5349361';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/kateleephotos/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/kateleephotos/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 += 'section360348.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 && 'section360348' != '') {
					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 = 'KLEE 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.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> &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="">';
	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="">';
	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;
	}
}

			

