window.thumbnails = {};
															thumbnails[1269586] = clik.newPhoto({"id":1269586,"src":"DSC_0302_thumb.JPG","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1270885] = clik.newPhoto({"id":1270885,"src":"DSC_0004_thumb.JPG","galleries_id":90178,"server_id":1,"link":"photo_1270885.html","width":130,"caption":"","height":87});
															thumbnails[1270891] = clik.newPhoto({"id":1270891,"src":"DSC_00111_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_1270891.html","width":130,"caption":"","height":87});
															thumbnails[1281483] = clik.newPhoto({"id":1281483,"src":"DSC_0013_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_1281483.html","width":130,"caption":"","height":87});
															thumbnails[1281485] = clik.newPhoto({"id":1281485,"src":"DSC_0006_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_1281485.html","width":130,"caption":"","height":87});
															thumbnails[1281486] = clik.newPhoto({"id":1281486,"src":"DSC_0012_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_1281486.html","width":130,"caption":"","height":87});
															thumbnails[1281490] = clik.newPhoto({"id":1281490,"src":"DSC_0107_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_1281490.html","width":130,"caption":"","height":51});
															thumbnails[1281491] = clik.newPhoto({"id":1281491,"src":"DSC_0084_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_1281491.html","width":130,"caption":"","height":38});
															thumbnails[1281498] = clik.newPhoto({"id":1281498,"src":"DSC_0016_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1281498.html","width":130,"caption":"","height":87});
															thumbnails[1281500] = clik.newPhoto({"id":1281500,"src":"DSC_0241_thumb.JPG","galleries_id":91015,"server_id":1,"link":"photo_1281500.html","width":130,"caption":"","height":87});
															thumbnails[1289825] = clik.newPhoto({"id":1289825,"src":"DSC_0007-1_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_1289825.html","width":130,"caption":"","height":87});
															thumbnails[1289828] = clik.newPhoto({"id":1289828,"src":"DSC_00461_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1289828.html","width":130,"caption":"","height":87});
															thumbnails[1289831] = clik.newPhoto({"id":1289831,"src":"DSC_0061_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_1289831.html","width":130,"caption":"","height":87});
															thumbnails[1289832] = clik.newPhoto({"id":1289832,"src":"DSC_0033-1_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_1289832.html","width":130,"caption":"","height":93});
															thumbnails[1289851] = clik.newPhoto({"id":1289851,"src":"DSC_0223_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1289851.html","width":130,"caption":"","height":87});
															thumbnails[1291198] = clik.newPhoto({"id":1291198,"src":"DSC_0163_thumb.JPG","galleries_id":91584,"server_id":1,"link":"photo_1291198.html","width":130,"caption":"","height":87});
															thumbnails[1291232] = clik.newPhoto({"id":1291232,"src":"DSC_0204_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1291232.html","width":130,"caption":"","height":87});
															thumbnails[1294393] = clik.newPhoto({"id":1294393,"src":"DSC_0095-1_thumb.JPG","galleries_id":91015,"server_id":1,"link":"photo_1294393.html","width":130,"caption":"","height":87});
															thumbnails[1294394] = clik.newPhoto({"id":1294394,"src":"DSC_0530_thumb.JPG","galleries_id":91584,"server_id":1,"link":"photo_1294394.html","width":130,"caption":"","height":87});
															thumbnails[1294401] = clik.newPhoto({"id":1294401,"src":"DSC_0372_thumb.JPG","galleries_id":91584,"server_id":1,"link":"photo_1294401.html","width":130,"caption":"","height":87});
															thumbnails[1294403] = clik.newPhoto({"id":1294403,"src":"DSC_0373_thumb.JPG","galleries_id":91738,"server_id":1,"link":"photo_1294403.html","width":130,"caption":"","height":87});
															thumbnails[1294406] = clik.newPhoto({"id":1294406,"src":"DSC_0395_thumb.JPG","galleries_id":91738,"server_id":1,"link":"photo_1294406.html","width":130,"caption":"","height":87});
															thumbnails[1294407] = clik.newPhoto({"id":1294407,"src":"DSC_0572_thumb.JPG","galleries_id":91015,"server_id":1,"link":"photo_1294407.html","width":130,"caption":"","height":201});
															thumbnails[1294409] = clik.newPhoto({"id":1294409,"src":"DSC_0141_thumb.JPG","galleries_id":91015,"server_id":1,"link":"photo_1294409.html","width":130,"caption":"","height":87});
															thumbnails[1294411] = clik.newPhoto({"id":1294411,"src":"DSC_0558_thumb.JPG","galleries_id":91584,"server_id":1,"link":"photo_1294411.html","width":130,"caption":"","height":87});
															thumbnails[1294414] = clik.newPhoto({"id":1294414,"src":"DSC_0170_thumb.JPG","galleries_id":91584,"server_id":1,"link":"photo_1294414.html","width":130,"caption":"","height":87});
															thumbnails[1295241] = clik.newPhoto({"id":1295241,"src":"DSC_0008_thumb.JPG","galleries_id":91786,"server_id":1,"link":"photo_1295241.html","width":130,"caption":"","height":87});
															thumbnails[1295245] = clik.newPhoto({"id":1295245,"src":"DSC_0004-1_thumb.JPG","galleries_id":91786,"server_id":1,"link":"photo_1295245.html","width":130,"caption":"","height":87});
															thumbnails[1295394] = clik.newPhoto({"id":1295394,"src":"DSC_0265_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1295394.html","width":130,"caption":"","height":87});
															thumbnails[1295401] = clik.newPhoto({"id":1295401,"src":"DSC_0285_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1295401.html","width":130,"caption":"","height":87});
															thumbnails[1298538] = clik.newPhoto({"id":1298538,"src":"DSC_00112_thumb.JPG","galleries_id":91738,"server_id":1,"link":"photo_1298538.html","width":130,"caption":"","height":84});
															thumbnails[1298539] = clik.newPhoto({"id":1298539,"src":"DSC_0020_thumb.JPG","galleries_id":91738,"server_id":1,"link":"photo_1298539.html","width":130,"caption":"","height":194});
															thumbnails[1300612] = clik.newPhoto({"id":1300612,"src":"DSC_0031_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_1300612.html","width":130,"caption":"","height":87});
															thumbnails[1300876] = clik.newPhoto({"id":1300876,"src":"DSC_00121_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1300876.html","width":130,"caption":"","height":46});
															thumbnails[1302381] = clik.newPhoto({"id":1302381,"src":"DSC_0001_thumb.JPG","galleries_id":90178,"server_id":1,"link":"photo_1302381.html","width":130,"caption":"","height":87});
															thumbnails[1302383] = clik.newPhoto({"id":1302383,"src":"DSC_0053_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_1302383.html","width":130,"caption":"","height":87});
															thumbnails[1304571] = clik.newPhoto({"id":1304571,"src":"DSC_00122_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_1304571.html","width":130,"caption":"","height":53});
															thumbnails[1304861] = clik.newPhoto({"id":1304861,"src":"DSC_0005_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_1304861.html","width":130,"caption":"","height":87});
															thumbnails[1328694] = clik.newPhoto({"id":1328694,"src":"DSC_0164_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1328694.html","width":130,"caption":"","height":87});
															thumbnails[1337681] = clik.newPhoto({"id":1337681,"src":"DSC_0032_thumb.JPG","galleries_id":91738,"server_id":1,"link":"photo_1337681.html","width":130,"caption":"","height":98});
															thumbnails[1375363] = clik.newPhoto({"id":1375363,"src":"DSC_0045_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1375363.html","width":130,"caption":"","height":87});
															thumbnails[1375368] = clik.newPhoto({"id":1375368,"src":"DSC_0026_thumb.JPG","galleries_id":91584,"server_id":1,"link":"photo_1375368.html","width":130,"caption":"","height":87});
															thumbnails[1408504] = clik.newPhoto({"id":1408504,"src":"DSC_0073_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1408504.html","width":130,"caption":"","height":87});
															thumbnails[1408507] = clik.newPhoto({"id":1408507,"src":"DSC_01631_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1408507.html","width":130,"caption":"","height":194});
															thumbnails[1408509] = clik.newPhoto({"id":1408509,"src":"DSC_0231_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1408509.html","width":130,"caption":"","height":194});
															thumbnails[1408511] = clik.newPhoto({"id":1408511,"src":"DSC_0243_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1408511.html","width":130,"caption":"","height":87});
															thumbnails[1408513] = clik.newPhoto({"id":1408513,"src":"DSC_0110_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1408513.html","width":130,"caption":"","height":175});
															thumbnails[1421450] = clik.newPhoto({"id":1421450,"src":"DSC_0120_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1421450.html","width":130,"caption":"","height":87});
															thumbnails[1421453] = clik.newPhoto({"id":1421453,"src":"DSC_0233_thumb.JPG","galleries_id":91015,"server_id":1,"link":"photo_1421453.html","width":130,"caption":"","height":87});
															thumbnails[1421461] = clik.newPhoto({"id":1421461,"src":"DSC_0176_thumb.JPG","galleries_id":91015,"server_id":1,"link":"photo_1421461.html","width":130,"caption":"","height":87});
															thumbnails[1421463] = clik.newPhoto({"id":1421463,"src":"DSC_0320_thumb.JPG","galleries_id":91015,"server_id":1,"link":"photo_1421463.html","width":130,"caption":"","height":87});
															thumbnails[1421468] = clik.newPhoto({"id":1421468,"src":"27_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1421468.html","width":130,"caption":"","height":86});
															thumbnails[1421471] = clik.newPhoto({"id":1421471,"src":"DSC_0335_thumb.JPG","galleries_id":91014,"server_id":1,"link":"photo_1421471.html","width":130,"caption":"","height":87});
															thumbnails[1522504] = clik.newPhoto({"id":1522504,"src":"DSC_0023_thumb.JPG","galleries_id":91584,"server_id":1,"link":"photo_1522504.html","width":130,"caption":"","height":87});
															thumbnails[1673779] = clik.newPhoto({"id":1673779,"src":"DSC_0033_thumb.JPG","galleries_id":91786,"server_id":1,"link":"photo_1673779.html","width":130,"caption":"","height":83});
															thumbnails[1781747] = clik.newPhoto({"id":1781747,"src":"DSC_0009_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1781747.html","width":130,"caption":"","height":57});
															thumbnails[1781748] = clik.newPhoto({"id":1781748,"src":"DSC_0024_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1781748.html","width":130,"caption":"","height":87});
															thumbnails[1781750] = clik.newPhoto({"id":1781750,"src":"DSC_0036_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1781750.html","width":130,"caption":"","height":42});
															thumbnails[1781751] = clik.newPhoto({"id":1781751,"src":"DSC_0173_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1781751.html","width":130,"caption":"","height":87});
															thumbnails[1781754] = clik.newPhoto({"id":1781754,"src":"DSC_00331_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_1781754.html","width":130,"caption":"","height":60});
															thumbnails[2078828] = clik.newPhoto({"id":2078828,"src":"DSC_0092_thumb.JPG","galleries_id":91738,"server_id":1,"link":"photo_2078828.html","width":130,"caption":"","height":194});
															thumbnails[2494897] = clik.newPhoto({"id":2494897,"src":"DSC_0040_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_2494897.html","width":130,"caption":"","height":81});
															thumbnails[2511546] = clik.newPhoto({"id":2511546,"src":"DSC_0013-1_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_2511546.html","width":130,"caption":"","height":87});
															thumbnails[3509679] = clik.newPhoto({"id":3509679,"src":"DSC_0035-4_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_3509679.html","width":130,"caption":"","height":115});
															thumbnails[3509684] = clik.newPhoto({"id":3509684,"src":"DSC_0006_1_thumb.JPG","galleries_id":90401,"server_id":1,"link":"photo_3509684.html","width":130,"caption":"","height":87});
															thumbnails[4499340] = clik.newPhoto({"id":4499340,"src":"DSC_0042_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_4499340.html","width":130,"caption":"","height":87});
															thumbnails[4499342] = clik.newPhoto({"id":4499342,"src":"DSC_0072_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_4499342.html","width":130,"caption":"","height":87});
															thumbnails[4499343] = clik.newPhoto({"id":4499343,"src":"DSC_0080_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_4499343.html","width":130,"caption":"","height":87});
															thumbnails[4499346] = clik.newPhoto({"id":4499346,"src":"DSC_0133_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_4499346.html","width":130,"caption":"","height":87});
															thumbnails[4499349] = clik.newPhoto({"id":4499349,"src":"DSC_0101_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_4499349.html","width":130,"caption":"","height":85});
															thumbnails[4499352] = clik.newPhoto({"id":4499352,"src":"DSC_0114_thumb.JPG","galleries_id":97880,"server_id":1,"link":"photo_4499352.html","width":130,"caption":"","height":95});
															thumbnails[4499374] = clik.newPhoto({"id":4499374,"src":"DSC_0007888_thumb.jpg","galleries_id":91013,"server_id":1,"link":"photo_4499374.html","width":130,"caption":"","height":104});
															thumbnails[4499662] = clik.newPhoto({"id":4499662,"src":"DSC_0025_thumb.JPG","galleries_id":91013,"server_id":1,"link":"photo_4499662.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[91738] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract","link":"gallery_91738.html","maxRecords":0.0,"photoIDs":[1294403.0,1294406.0,1298538.0,1298539.0,1337681.0,2078828.0],"skipIndex":0,"section_code":"gallery","featured_images":1294403.0,"id":91738,"singleSection":false});				  						galleries[90401] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"After dark","link":"gallery_90401.html","maxRecords":0.0,"photoIDs":[1270891.0,1281483.0,1281485.0,1281486.0,1289825.0,1300612.0,2494897.0,3509679.0,3509684.0],"skipIndex":0,"section_code":"gallery","featured_images":1270891.0,"id":90401,"singleSection":false});				  						galleries[91014] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Automotive","link":"gallery_91014.html","maxRecords":0.0,"photoIDs":[1281498.0,1289828.0,1289851.0,1291232.0,1295394.0,1295401.0,1300876.0,1328694.0,1375363.0,1421450.0,1421468.0,1421471.0],"skipIndex":0,"section_code":"gallery","featured_images":1295394.0,"id":91014,"singleSection":false});				  						galleries[91015] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Candids","link":"gallery_91015.html","maxRecords":0.0,"photoIDs":[1281500.0,1294393.0,1294407.0,1294409.0,1421453.0,1421461.0,1421463.0],"skipIndex":0,"section_code":"gallery","featured_images":1281500.0,"id":91015,"singleSection":false});				  						galleries[97880] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commissions","link":"gallery_97880.html","maxRecords":0.0,"photoIDs":[1408504.0,1408507.0,1408509.0,1408511.0,1408513.0,1781747.0,1781748.0,1781750.0,1781751.0,1781754.0,4499340.0,4499342.0,4499343.0,4499346.0,4499349.0,4499352.0],"skipIndex":0,"section_code":"gallery","featured_images":1408504.0,"id":97880,"singleSection":false});				  						galleries[91584] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Random collection","link":"gallery_91584.html","maxRecords":0.0,"photoIDs":[1291198.0,1294394.0,1294401.0,1294411.0,1294414.0,1375368.0,1522504.0],"skipIndex":0,"section_code":"gallery","featured_images":1294394.0,"id":91584,"singleSection":false});				  						galleries[91786] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Still life","link":"gallery_91786.html","maxRecords":0.0,"photoIDs":[1295241.0,1295245.0,1673779.0],"skipIndex":0,"section_code":"gallery","featured_images":1295241.0,"id":91786,"singleSection":false});				  						galleries[91013] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wildlife","link":"gallery_91013.html","maxRecords":0.0,"photoIDs":[1281490.0,1281491.0,1289831.0,1289832.0,1302383.0,1304571.0,1304861.0,2511546.0,4499374.0,4499662.0],"skipIndex":0,"section_code":"gallery","featured_images":1289831.0,"id":91013,"singleSection":false});				  						galleries[90178] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Urban","link":"gallery_90178.html","maxRecords":0.0,"photoIDs":[1270885.0,1302381.0],"skipIndex":0,"section_code":"gallery","featured_images":1270885.0,"id":90178,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '1269586';
imageSets[2] = '1408504,1295394,1295241,1294403,1294394,1289831,1281500,1270891,1270885';
imageSets[3] = '4499662,4499374,4499352,4499349,4499346,4499343,4499342,4499340,3509684,3509679,2511546,2494897,2078828,1781754,1781751,1781750,1781748,1781747,1673779,1522504,1421471,1421468,1421463,1421461,1421453,1421450,1408513,1408511,1408509,1408507,1408504,1375368,1375363,1337681,1328694,1304861,1304571,1302383,1302381,1300876,1300612,1298539,1298538,1295401,1295394,1295245,1295241,1294414,1294411,1294409';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/vanillacoffee/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/vanillacoffee/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 = 'Vanilla Coffee photography: ' + 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>';
	}
				
				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>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (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="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		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 += '<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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

