window.thumbnails = {};
															thumbnails[2862712] = clik.newPhoto({"id":2862712,"src":"Dawn_At_Sea_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862712.html","width":130,"caption":"Dawn at Sea","height":45});
															thumbnails[2862723] = clik.newPhoto({"id":2862723,"src":"Night Wave On The Rocks_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862723.html","width":130,"caption":"Night Wave on the Rocks","height":109});
															thumbnails[2851534] = clik.newPhoto({"id":2851534,"src":"wave 1_thumb.jpg","galleries_id":177017,"server_id":32,"link":"photo_2851534.html","width":130,"caption":"Wave 1<br>\r\n","height":108});
															thumbnails[2851866] = clik.newPhoto({"id":2851866,"src":"Breaking_Wave_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2851866.html","width":130,"caption":"Breaking Wave","height":105});
															thumbnails[2862733] = clik.newPhoto({"id":2862733,"src":"On this island_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862733.html","width":130,"caption":"On this Island   SOLD","height":82});
															thumbnails[2862749] = clik.newPhoto({"id":2862749,"src":"Seacape On This Island_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862749.html","width":130,"caption":"Seascape - island","height":43});
															thumbnails[2862752] = clik.newPhoto({"id":2862752,"src":"skellig_rock_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862752.html","width":129,"caption":"Skellig Rock","height":129});
															thumbnails[2862758] = clik.newPhoto({"id":2862758,"src":"Surf_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862758.html","width":130,"caption":"Surf","height":104});
															thumbnails[2862760] = clik.newPhoto({"id":2862760,"src":"Surf_1_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862760.html","width":130,"caption":"Surf 1","height":96});
															thumbnails[2862762] = clik.newPhoto({"id":2862762,"src":"Surf_2_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862762.html","width":130,"caption":"Surf 2","height":108});
															thumbnails[2862766] = clik.newPhoto({"id":2862766,"src":"Surf_3_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862766.html","width":130,"caption":"Surf 3","height":96});
															thumbnails[2862769] = clik.newPhoto({"id":2862769,"src":"Surf_4 _thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862769.html","width":130,"caption":"Surf 4","height":101});
															thumbnails[2862794] = clik.newPhoto({"id":2862794,"src":"Wave_1_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862794.html","width":129,"caption":"Wave 1   ","height":111});
															thumbnails[2862798] = clik.newPhoto({"id":2862798,"src":"Wave_2_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_2862798.html","width":129,"caption":"Wave 2  Sold","height":106});
															thumbnails[2862809] = clik.newPhoto({"id":2862809,"src":"Diamonds_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_2862809.html","width":129,"caption":"Diamonds","height":90});
															thumbnails[2862870] = clik.newPhoto({"id":2862870,"src":"Eva_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_2862870.html","width":130,"caption":"Eva","height":177});
															thumbnails[2862879] = clik.newPhoto({"id":2862879,"src":"lines_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_2862879.html","width":130,"caption":"Lines","height":93});
															thumbnails[2862899] = clik.newPhoto({"id":2862899,"src":"Natasha_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_2862899.html","width":130,"caption":"Natasha","height":169});
															thumbnails[2862916] = clik.newPhoto({"id":2862916,"src":"Shaba_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_2862916.html","width":130,"caption":"Shaba","height":131});
															thumbnails[2862923] = clik.newPhoto({"id":2862923,"src":"reclining nude_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_2862923.html","width":130,"caption":"Reclining nude - SOLD","height":104});
															thumbnails[2862935] = clik.newPhoto({"id":2862935,"src":"abstract_land scape1_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2862935.html","width":130,"caption":"Landscape 1","height":91});
															thumbnails[2862944] = clik.newPhoto({"id":2862944,"src":"africa_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2862944.html","width":130,"caption":"Africa","height":110});
															thumbnails[2862954] = clik.newPhoto({"id":2862954,"src":"Calm_After _storm_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2862954.html","width":130,"caption":"Calm after the storm","height":43});
															thumbnails[2862988] = clik.newPhoto({"id":2862988,"src":"day_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2862988.html","width":130,"caption":"Day sold","height":52});
															thumbnails[2862992] = clik.newPhoto({"id":2862992,"src":"fire_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2862992.html","width":130,"caption":"Fire  SOLD","height":67});
															thumbnails[2862997] = clik.newPhoto({"id":2862997,"src":"Ice_On_Fire_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2862997.html","width":129,"caption":"Ice on Fire   SOLD","height":101});
															thumbnails[2863002] = clik.newPhoto({"id":2863002,"src":"Prisim_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2863002.html","width":130,"caption":"Prism   SOLD","height":113});
															thumbnails[2863005] = clik.newPhoto({"id":2863005,"src":"Storm_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2863005.html","width":130,"caption":"Storm","height":44});
															thumbnails[2863010] = clik.newPhoto({"id":2863010,"src":"Bog_in_Autunm_thumb.JPG","galleries_id":177497,"server_id":32,"link":"photo_2863010.html","width":130,"caption":"Bog in Autumn","height":176});
															thumbnails[2863077] = clik.newPhoto({"id":2863077,"src":"Cork_Bonded_Warehouses_thumb.JPG","galleries_id":177497,"server_id":32,"link":"photo_2863077.html","width":130,"caption":"Cork Bonded Warehouses Ltd","height":52});
															thumbnails[2863083] = clik.newPhoto({"id":2863083,"src":"headspace_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_2863083.html","width":129,"caption":"Head space","height":101});
															thumbnails[2863091] = clik.newPhoto({"id":2863091,"src":"Miles_To_Go_Before_I_Sleep_thumb.JPG","galleries_id":177497,"server_id":32,"link":"photo_2863091.html","width":130,"caption":"Miles to go before I sleep...SOLD","height":150});
															thumbnails[3521651] = clik.newPhoto({"id":3521651,"src":"IMG_0964_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_3521651.html","width":130,"caption":"Sunshine","height":172});
															thumbnails[3521660] = clik.newPhoto({"id":3521660,"src":"IMG_0962_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_3521660.html","width":130,"caption":"Curves","height":100});
															thumbnails[3521670] = clik.newPhoto({"id":3521670,"src":"IMG_0961_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_3521670.html","width":130,"caption":"Kiaria","height":87});
															thumbnails[3521677] = clik.newPhoto({"id":3521677,"src":"IMG_0957_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_3521677.html","width":130,"caption":"Girl with the gold bar","height":107});
															thumbnails[3522086] = clik.newPhoto({"id":3522086,"src":"IMG_0965_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_3522086.html","width":130,"caption":"Clew bay","height":51});
															thumbnails[3522090] = clik.newPhoto({"id":3522090,"src":"IMG_0966_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_3522090.html","width":130,"caption":"Clew Bay 2","height":52});
															thumbnails[3522091] = clik.newPhoto({"id":3522091,"src":"IMG_0967_thumb.JPG","galleries_id":177017,"server_id":32,"link":"photo_3522091.html","width":130,"caption":"Calm seas","height":52});
															thumbnails[3522101] = clik.newPhoto({"id":3522101,"src":"IMG_0922_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522101.html","width":130,"caption":"Gates","height":69});
															thumbnails[3522105] = clik.newPhoto({"id":3522105,"src":"IMG_0924_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522105.html","width":130,"caption":"Mango forest","height":67});
															thumbnails[3522110] = clik.newPhoto({"id":3522110,"src":"IMG_0921_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522110.html","width":130,"caption":"the Eyes","height":99});
															thumbnails[3522118] = clik.newPhoto({"id":3522118,"src":"IMG_0930_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522118.html","width":130,"caption":"Fall","height":155});
															thumbnails[3522119] = clik.newPhoto({"id":3522119,"src":"IMG_0932_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522119.html","width":130,"caption":"Tree","height":154});
															thumbnails[3522121] = clik.newPhoto({"id":3522121,"src":"IMG_0933_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522121.html","width":130,"caption":"Tree 2","height":153});
															thumbnails[3522135] = clik.newPhoto({"id":3522135,"src":"IMG_0934_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522135.html","width":130,"caption":"Snow tree 1","height":155});
															thumbnails[3522137] = clik.newPhoto({"id":3522137,"src":"IMG_0935_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522137.html","width":130,"caption":"Snow Tree 2","height":151});
															thumbnails[3522138] = clik.newPhoto({"id":3522138,"src":"IMG_0928_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522138.html","width":130,"caption":"Forever Autum","height":489});
															thumbnails[3522202] = clik.newPhoto({"id":3522202,"src":"IMG_0947_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522202.html","width":130,"caption":"Forest","height":174});
															thumbnails[3522206] = clik.newPhoto({"id":3522206,"src":"IMG_0956_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522206.html","width":130,"caption":"Fire","height":37});
															thumbnails[3522263] = clik.newPhoto({"id":3522263,"src":"IMG_0951_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522263.html","width":130,"caption":"Bush fire","height":107});
															thumbnails[3522295] = clik.newPhoto({"id":3522295,"src":"IMG_0920_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522295.html","width":130,"caption":"","height":93});
															thumbnails[3522317] = clik.newPhoto({"id":3522317,"src":"IMG_0958_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522317.html","width":130,"caption":"Abstract landscape 1","height":42});
															thumbnails[3522320] = clik.newPhoto({"id":3522320,"src":"IMG_0959_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522320.html","width":130,"caption":"View from a room","height":104});
															thumbnails[3522354] = clik.newPhoto({"id":3522354,"src":"IMG_0960_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522354.html","width":130,"caption":"Calm","height":42});
															thumbnails[3522364] = clik.newPhoto({"id":3522364,"src":"IMG_1050t_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3522364.html","width":130,"caption":"Golden view","height":42});
															thumbnails[3525568] = clik.newPhoto({"id":3525568,"src":"IMG_0938_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3525568.html","width":130,"caption":"firebird","height":170});
															thumbnails[3525572] = clik.newPhoto({"id":3525572,"src":"IMG_0941_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3525572.html","width":130,"caption":"Teacher","height":174});
															thumbnails[3525573] = clik.newPhoto({"id":3525573,"src":"IMG_0944_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3525573.html","width":130,"caption":"Tequila sunrise","height":104});
															thumbnails[3525575] = clik.newPhoto({"id":3525575,"src":"IMG_0945_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3525575.html","width":130,"caption":"Dandy","height":171});
															thumbnails[3525578] = clik.newPhoto({"id":3525578,"src":"IMG_0946_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3525578.html","width":130,"caption":"Sea Bird","height":105});
															thumbnails[3525583] = clik.newPhoto({"id":3525583,"src":"IMG_0937_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3525583.html","width":130,"caption":"seascape","height":99});
															thumbnails[3525590] = clik.newPhoto({"id":3525590,"src":"IMG_0942_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3525590.html","width":130,"caption":"Starburst","height":102});
															thumbnails[3525606] = clik.newPhoto({"id":3525606,"src":"IMG_0952_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3525606.html","width":130,"caption":"Kenya","height":113});
															thumbnails[3525608] = clik.newPhoto({"id":3525608,"src":"IMG_0953_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3525608.html","width":130,"caption":"Africa II","height":105});
															thumbnails[3532217] = clik.newPhoto({"id":3532217,"src":"IMG_1054t_thumb.JPG","galleries_id":177497,"server_id":32,"link":"photo_3532217.html","width":130,"caption":"Just beyond these trees...","height":171});
															thumbnails[3532225] = clik.newPhoto({"id":3532225,"src":"IMG_1053t_thumb.JPG","galleries_id":177497,"server_id":32,"link":"photo_3532225.html","width":130,"caption":"Winter clearing","height":173});
															thumbnails[3532227] = clik.newPhoto({"id":3532227,"src":"IMG_1042t_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3532227.html","width":130,"caption":"Three blind mice...","height":101});
															thumbnails[3532433] = clik.newPhoto({"id":3532433,"src":"IMG_1037t_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3532433.html","width":130,"caption":"Evolution","height":108});
															thumbnails[3532438] = clik.newPhoto({"id":3532438,"src":"IMG_1045t_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3532438.html","width":130,"caption":"Maelstrom","height":73});
															thumbnails[3532443] = clik.newPhoto({"id":3532443,"src":"IMG_1040t_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3532443.html","width":130,"caption":"Volcano","height":81});
															thumbnails[3532453] = clik.newPhoto({"id":3532453,"src":"IMG_1039t_thumb.JPG","galleries_id":215744,"server_id":32,"link":"photo_3532453.html","width":130,"caption":"Fire","height":100});
															thumbnails[3532640] = clik.newPhoto({"id":3532640,"src":"IMG_1008t_thumb.JPG","galleries_id":177496,"server_id":32,"link":"photo_3532640.html","width":130,"caption":"Long Journey into darkness...","height":107});
															thumbnails[3532872] = clik.newPhoto({"id":3532872,"src":"IMG_0923_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3532872.html","width":130,"caption":"untitled","height":65});
															thumbnails[3532941] = clik.newPhoto({"id":3532941,"src":"IMG_1012t_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3532941.html","width":130,"caption":"splat!!!","height":100});
															thumbnails[3532943] = clik.newPhoto({"id":3532943,"src":"IMG_1014t_thumb.JPG","galleries_id":177018,"server_id":32,"link":"photo_3532943.html","width":130,"caption":"Abstract colours...","height":99});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[177496] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"female form","link":"gallery_177496.html","maxRecords":0.0,"photoIDs":[2862809.0,2862870.0,2862879.0,2862899.0,2862916.0,2862923.0,3521651.0,3521660.0,3521670.0,3521677.0,3532640.0],"skipIndex":0,"section_code":"gallery","featured_images":2862809.0,"id":177496,"singleSection":false});				  						galleries[177497] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Other","link":"gallery_177497.html","maxRecords":0.0,"photoIDs":[2863010.0,2863077.0,2863091.0,3532217.0,3532225.0],"skipIndex":0,"section_code":"gallery","featured_images":2863091.0,"id":177497,"singleSection":false});				  						galleries[215744] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Paint sculptures","link":"gallery_215744.html","maxRecords":0.0,"photoIDs":[3525568.0,3525572.0,3525573.0,3525575.0,3525578.0,3525583.0,3525590.0,3532227.0,3532433.0,3532438.0,3532443.0,3532453.0],"skipIndex":0,"section_code":"gallery","featured_images":"3532453,3532443,3532438,3532433,3532227,3525590,3525583,3525578,3525575,3525573","id":215744,"singleSection":false});				  						galleries[177017] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes","link":"gallery_177017.html","maxRecords":0.0,"photoIDs":[2862712.0,2862723.0,2851534.0,2851866.0,2862733.0,2862749.0,2862752.0,2862758.0,2862760.0,2862762.0,2862766.0,2862769.0,2862794.0,2862798.0,3522086.0,3522090.0,3522091.0],"skipIndex":0,"section_code":"gallery","featured_images":2851866.0,"id":177017,"singleSection":false});				  						galleries[177018] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract","link":"gallery_177018.html","maxRecords":0.0,"photoIDs":[2862935.0,2862944.0,2862954.0,2862988.0,2862992.0,2862997.0,2863002.0,2863005.0,2863083.0,3522101.0,3522105.0,3522110.0,3522118.0,3522119.0,3522121.0,3522135.0,3522137.0,3522138.0,3522202.0,3522206.0,3522263.0,3522295.0,3522317.0,3522320.0,3522354.0,3522364.0,3525606.0,3525608.0,3532872.0,3532941.0,3532943.0],"skipIndex":0,"section_code":"gallery","featured_images":2862944.0,"id":177018,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '2862809';
imageSets[2] = '2863091,2862944,2862809,2851866';
imageSets[3] = '3532943,3532941,3532872,3532640,3532453,3532443,3532438,3532433,3532227,3532225,3532217,3525608,3525606,3525590,3525583,3525578,3525575,3525573,3525572,3525568,3522364,3522354,3522320,3522317,3522295,3522263,3522206,3522202,3522138,3522137,3522135,3522121,3522119,3522118,3522110,3522105,3522101,3522091,3522090,3522086,3521677,3521670,3521660,3521651,2863091,2863083,2863077,2863010,2863005,2863002';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/eddieb/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/eddieb/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/eddieb/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/eddieb/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/eddieb/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/eddieb/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/eddieb/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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Ed Bradley Art: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		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.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &euro;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="EDDIEB">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

