window.thumbnails = {};
thumbnails[7773022] = clik.newPhoto({"link":"photo_7773022.html","caption":"","height":99,"id":7773022,"server_id":21,"src":"Isaak_thumb.gif","galleries_id":419610,"width":130});
thumbnails[7773029] = clik.newPhoto({"link":"photo_7773029.html","caption":"","height":99,"id":7773029,"server_id":21,"src":"May-bank-holiday-weekend-Ap_thumb.gif","galleries_id":419610,"width":130});
thumbnails[7773067] = clik.newPhoto({"link":"photo_7773067.html","caption":"","height":87,"id":7773067,"server_id":21,"src":"Mike_thumb.gif","galleries_id":419610,"width":130});
thumbnails[7773069] = clik.newPhoto({"link":"photo_7773069.html","caption":"","height":100,"id":7773069,"server_id":21,"src":"Jo_thumb.gif","galleries_id":419610,"width":130});
thumbnails[7773535] = clik.newPhoto({"link":"photo_7773535.html","caption":"","height":87,"id":7773535,"server_id":21,"src":"Tahlia01_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7773541] = clik.newPhoto({"link":"photo_7773541.html","caption":"","height":116,"id":7773541,"server_id":21,"src":"Tahlia02_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7773543] = clik.newPhoto({"link":"photo_7773543.html","caption":"","height":87,"id":7773543,"server_id":21,"src":"Tahlia03_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7773551] = clik.newPhoto({"link":"photo_7773551.html","caption":"","height":87,"id":7773551,"server_id":21,"src":"Tahlia04_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7773552] = clik.newPhoto({"link":"photo_7773552.html","caption":"","height":121,"id":7773552,"server_id":21,"src":"Tahlia05_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7773880] = clik.newPhoto({"link":"photo_7773880.html","caption":"","height":60,"id":7773880,"server_id":21,"src":"art01_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7773887] = clik.newPhoto({"link":"photo_7773887.html","caption":"","height":55,"id":7773887,"server_id":21,"src":"art02_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7773895] = clik.newPhoto({"link":"photo_7773895.html","caption":"","height":87,"id":7773895,"server_id":21,"src":"art04_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7773897] = clik.newPhoto({"link":"photo_7773897.html","caption":"","height":73,"id":7773897,"server_id":21,"src":"art05_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7773903] = clik.newPhoto({"link":"photo_7773903.html","caption":"","height":87,"id":7773903,"server_id":21,"src":"art08_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7773905] = clik.newPhoto({"link":"photo_7773905.html","caption":"","height":87,"id":7773905,"server_id":21,"src":"atr03_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7782043] = clik.newPhoto({"link":"photo_7782043.html","caption":"","height":82,"id":7782043,"server_id":21,"src":"art09_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7782045] = clik.newPhoto({"link":"photo_7782045.html","caption":"","height":87,"id":7782045,"server_id":21,"src":"dad01_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7782046] = clik.newPhoto({"link":"photo_7782046.html","caption":"","height":79,"id":7782046,"server_id":21,"src":"Harlum-and-Tahlia02_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7782047] = clik.newPhoto({"link":"photo_7782047.html","caption":"","height":80,"id":7782047,"server_id":21,"src":"landscape01_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782048] = clik.newPhoto({"link":"photo_7782048.html","caption":"","height":78,"id":7782048,"server_id":21,"src":"landscapes02_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782049] = clik.newPhoto({"link":"photo_7782049.html","caption":"","height":87,"id":7782049,"server_id":21,"src":"landscapes03_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782050] = clik.newPhoto({"link":"photo_7782050.html","caption":"","height":87,"id":7782050,"server_id":21,"src":"landscapes04_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782054] = clik.newPhoto({"link":"photo_7782054.html","caption":"","height":88,"id":7782054,"server_id":21,"src":"landscapes06_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782055] = clik.newPhoto({"link":"photo_7782055.html","caption":"","height":79,"id":7782055,"server_id":21,"src":"landscapes07_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782056] = clik.newPhoto({"link":"photo_7782056.html","caption":"","height":75,"id":7782056,"server_id":21,"src":"landscapes08_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782057] = clik.newPhoto({"link":"photo_7782057.html","caption":"","height":94,"id":7782057,"server_id":21,"src":"landscapes09_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782060] = clik.newPhoto({"link":"photo_7782060.html","caption":"","height":64,"id":7782060,"server_id":21,"src":"landscapes12_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782061] = clik.newPhoto({"link":"photo_7782061.html","caption":"","height":86,"id":7782061,"server_id":21,"src":"lifegaurd2_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782062] = clik.newPhoto({"link":"photo_7782062.html","caption":"","height":81,"id":7782062,"server_id":21,"src":"lifeguard_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7782063] = clik.newPhoto({"link":"photo_7782063.html","caption":"","height":87,"id":7782063,"server_id":21,"src":"sian01_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7782065] = clik.newPhoto({"link":"photo_7782065.html","caption":"","height":87,"id":7782065,"server_id":21,"src":"sian02_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7782067] = clik.newPhoto({"link":"photo_7782067.html","caption":"","height":89,"id":7782067,"server_id":21,"src":"sian03_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7782073] = clik.newPhoto({"link":"photo_7782073.html","caption":"","height":87,"id":7782073,"server_id":21,"src":"Tahlia031_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7810156] = clik.newPhoto({"link":"photo_7810156.html","caption":"","height":173,"id":7810156,"server_id":21,"src":"art006_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7810157] = clik.newPhoto({"link":"photo_7810157.html","caption":"","height":173,"id":7810157,"server_id":21,"src":"art7_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7811132] = clik.newPhoto({"link":"photo_7811132.html","caption":"","height":86,"id":7811132,"server_id":21,"src":"landscapes13_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811136] = clik.newPhoto({"link":"photo_7811136.html","caption":"","height":82,"id":7811136,"server_id":21,"src":"landscapes14_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811138] = clik.newPhoto({"link":"photo_7811138.html","caption":"","height":93,"id":7811138,"server_id":21,"src":"landscapes15_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811139] = clik.newPhoto({"link":"photo_7811139.html","caption":"","height":80,"id":7811139,"server_id":21,"src":"landscapes16_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811141] = clik.newPhoto({"link":"photo_7811141.html","caption":"","height":80,"id":7811141,"server_id":21,"src":"landscapes17_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811142] = clik.newPhoto({"link":"photo_7811142.html","caption":"","height":76,"id":7811142,"server_id":21,"src":"landscapes18_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811143] = clik.newPhoto({"link":"photo_7811143.html","caption":"","height":98,"id":7811143,"server_id":21,"src":"landscapes19_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811144] = clik.newPhoto({"link":"photo_7811144.html","caption":"","height":87,"id":7811144,"server_id":21,"src":"art10_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7811146] = clik.newPhoto({"link":"photo_7811146.html","caption":"","height":98,"id":7811146,"server_id":21,"src":"landscapes05_F8821A1E-1EC9-D45B-1C4C1AAB8F2624F8_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7811148] = clik.newPhoto({"link":"photo_7811148.html","caption":"","height":84,"id":7811148,"server_id":21,"src":"boardmasters01_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7814936] = clik.newPhoto({"link":"photo_7814936.html","caption":"","height":82,"id":7814936,"server_id":21,"src":"bmx1_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7814941] = clik.newPhoto({"link":"photo_7814941.html","caption":"","height":74,"id":7814941,"server_id":21,"src":"tahlia07_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7814944] = clik.newPhoto({"link":"photo_7814944.html","caption":"","height":87,"id":7814944,"server_id":21,"src":"art11_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7821718] = clik.newPhoto({"link":"photo_7821718.html","caption":"","height":195,"id":7821718,"server_id":21,"src":"landscapes20_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7821719] = clik.newPhoto({"link":"photo_7821719.html","caption":"","height":168,"id":7821719,"server_id":21,"src":"art13_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7821720] = clik.newPhoto({"link":"photo_7821720.html","caption":"","height":181,"id":7821720,"server_id":21,"src":"art14_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7821721] = clik.newPhoto({"link":"photo_7821721.html","caption":"","height":50,"id":7821721,"server_id":21,"src":"art15_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7821756] = clik.newPhoto({"link":"photo_7821756.html","caption":"","height":79,"id":7821756,"server_id":21,"src":"landscapes22_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7821807] = clik.newPhoto({"link":"photo_7821807.html","caption":"","height":87,"id":7821807,"server_id":21,"src":"landscapes23_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7843367] = clik.newPhoto({"link":"photo_7843367.html","caption":"","height":170,"id":7843367,"server_id":21,"src":"mia3_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7843369] = clik.newPhoto({"link":"photo_7843369.html","caption":"","height":228,"id":7843369,"server_id":21,"src":"mia2_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7843397] = clik.newPhoto({"link":"photo_7843397.html","caption":"","height":87,"id":7843397,"server_id":21,"src":"brandonmia_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7843623] = clik.newPhoto({"link":"photo_7843623.html","caption":"","height":116,"id":7843623,"server_id":21,"src":"tahlia08_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7843626] = clik.newPhoto({"link":"photo_7843626.html","caption":"","height":101,"id":7843626,"server_id":21,"src":"tahlia09_thumb.gif","galleries_id":419611,"width":130});
thumbnails[7843632] = clik.newPhoto({"link":"photo_7843632.html","caption":"","height":98,"id":7843632,"server_id":21,"src":"landscapes211_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7843714] = clik.newPhoto({"link":"photo_7843714.html","caption":"","height":60,"id":7843714,"server_id":21,"src":"art16_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7843715] = clik.newPhoto({"link":"photo_7843715.html","caption":"","height":90,"id":7843715,"server_id":21,"src":"art18_thumb.gif","galleries_id":420071,"width":130});
thumbnails[7894626] = clik.newPhoto({"link":"photo_7894626.html","caption":"","height":74,"id":7894626,"server_id":21,"src":"art19_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7894628] = clik.newPhoto({"link":"photo_7894628.html","caption":"","height":89,"id":7894628,"server_id":21,"src":"art20_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7894629] = clik.newPhoto({"link":"photo_7894629.html","caption":"","height":172,"id":7894629,"server_id":21,"src":"art21_thumb.gif","galleries_id":425895,"width":130});
thumbnails[7894632] = clik.newPhoto({"link":"photo_7894632.html","caption":"","height":195,"id":7894632,"server_id":21,"src":"landscapes24_thumb.gif","galleries_id":420057,"width":130});
thumbnails[7894635] = clik.newPhoto({"link":"photo_7894635.html","caption":"","height":112,"id":7894635,"server_id":21,"src":"nature1_thumb.gif","galleries_id":425895,"width":130});
thumbnails[7894636] = clik.newPhoto({"link":"photo_7894636.html","caption":"","height":91,"id":7894636,"server_id":21,"src":"nature2_thumb.gif","galleries_id":425895,"width":130});
thumbnails[7894637] = clik.newPhoto({"link":"photo_7894637.html","caption":"","height":96,"id":7894637,"server_id":21,"src":"nature3_thumb.gif","galleries_id":425895,"width":130});
thumbnails[7894638] = clik.newPhoto({"link":"photo_7894638.html","caption":"","height":60,"id":7894638,"server_id":21,"src":"nature4_thumb.gif","galleries_id":425895,"width":130});
thumbnails[7894639] = clik.newPhoto({"link":"photo_7894639.html","caption":"","height":125,"id":7894639,"server_id":21,"src":"nature5_thumb.gif","galleries_id":425896,"width":130});
thumbnails[8486814] = clik.newPhoto({"link":"photo_8486814.html","caption":"","height":87,"id":8486814,"server_id":21,"src":"air_thumb.gif","galleries_id":420071,"width":130});
thumbnails[8486817] = clik.newPhoto({"link":"photo_8486817.html","caption":"","height":79,"id":8486817,"server_id":21,"src":"Bubbles_thumb.gif","galleries_id":419611,"width":130});
thumbnails[8486820] = clik.newPhoto({"link":"photo_8486820.html","caption":"","height":64,"id":8486820,"server_id":21,"src":"grasshopper_thumb.gif","galleries_id":425895,"width":130});
thumbnails[8486825] = clik.newPhoto({"link":"photo_8486825.html","caption":"","height":70,"id":8486825,"server_id":21,"src":"Surf-church_thumb.gif","galleries_id":420057,"width":130});
thumbnails[9048993] = clik.newPhoto({"link":"photo_9048993.html","caption":"","height":107,"id":9048993,"server_id":21,"src":"Harlum2_thumb.gif","galleries_id":419611,"width":130});
thumbnails[9048999] = clik.newPhoto({"link":"photo_9048999.html","caption":"","height":87,"id":9048999,"server_id":21,"src":"old-car-and-little-boy_thumb.gif","galleries_id":420071,"width":130});
thumbnails[9049010] = clik.newPhoto({"link":"photo_9049010.html","caption":"","height":94,"id":9049010,"server_id":21,"src":"rustic-camper_thumb.gif","galleries_id":420071,"width":130});
thumbnails[9049034] = clik.newPhoto({"link":"photo_9049034.html","caption":"","height":95,"id":9049034,"server_id":21,"src":"isaakand_thumb.gif","galleries_id":419610,"width":130});
thumbnails[9049059] = clik.newPhoto({"link":"photo_9049059.html","caption":"","height":79,"id":9049059,"server_id":21,"src":"landscapes221_thumb.gif","galleries_id":420057,"width":130});
thumbnails[9049068] = clik.newPhoto({"link":"photo_9049068.html","caption":"","height":79,"id":9049068,"server_id":21,"src":"Bubbles_79E464AA-1EC9-D45B-1C5C3DAB74C00775_thumb.gif","galleries_id":419611,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[420057] = clik.newGallery({"photoIDs":[7782047,7782048,7782049,7782050,7782054,7782055,7782056,7782057,7782060,7782061,7782062,7811132,7811136,7811138,7811139,7811141,7811142,7811143,7811146,7814944,7821718,7821756,7821807,7843632,7843714,7894626,7894628,7894632,8486825,9049059],"link":"gallery_420057.html","skipIndex":0,"section_code":"gallery","id":420057,"parentGallery":"","featured_images":"9049059,8486825,7894632,7894628,7894626,7843714,7843632,7821807,7821756,7821718","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Landscapes"});galleries[425895] = clik.newGallery({"photoIDs":[7894629,7894635,7894636,7894637,7894638,8486820],"link":"gallery_425895.html","skipIndex":0,"section_code":"gallery","id":425895,"parentGallery":"","featured_images":"8486820,7894638,7894637,7894636,7894635,7894629","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Nature"});galleries[425896] = clik.newGallery({"photoIDs":[7894639],"link":"gallery_425896.html","skipIndex":0,"section_code":"gallery","id":425896,"parentGallery":"","featured_images":7894639,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Pets"});galleries[420071] = clik.newGallery({"photoIDs":[7773880,7773887,7773895,7773897,7773903,7773905,7782043,7810156,7810157,7811144,7811148,7821719,7821720,7821721,7843715,8486814,9048999,9049010],"link":"gallery_420071.html","skipIndex":0,"section_code":"gallery","id":420071,"parentGallery":"","featured_images":"9049010,9048999,8486814,7843715,7821721,7821720,7821719,7811148,7811144,7810157","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Wall Art"});galleries[419610] = clik.newGallery({"photoIDs":[7773022,7773029,7773067,7773069,9049034],"link":"gallery_419610.html","skipIndex":0,"section_code":"gallery","id":419610,"parentGallery":"","featured_images":"9049034,7773069,7773067,7773029,7773022","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Gallery 1"});galleries[419611] = clik.newGallery({"photoIDs":[7773535,7773541,7773543,7773551,7773552,7782045,7782046,7782063,7782065,7782067,7782073,7814936,7814941,7843367,7843369,7843397,7843623,7843626,8486817,9048993,9049068],"link":"gallery_419611.html","skipIndex":0,"section_code":"gallery","id":419611,"parentGallery":"","featured_images":"9049068,9048993,8486817,7843626,7843623,7843397,7843369,7843367,7814941,7814936","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Gallery 2"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '9049068,9049059,9049034,9049010,9048999,9048993,8486825,8486820,8486817,8486814,7894639,7894638,7894637,7894636,7894635,7894632,7894629,7894628,7894626,7843715,7843714,7843632,7843626,7843623,7843397,7843369,7843367,7821807,7821756,7821721,7821720,7821719,7821718,7814944,7814941,7814936,7811148,7811146,7811144,7811143,7811142,7811141,7811139,7811138,7811136,7811132,7810157,7810156,7782073,7782067';
imageSets[1] = '9049068,9049059,9049034,9049010,9048999,9048993,8486825,8486820,8486817,8486814,7894639,7894638,7894637,7894636,7894635,7894632,7894629,7894628,7894626,7843715,7843714,7843632,7843626,7843623,7843397,7843369,7843367,7821807,7821756,7821721,7821720,7821719,7821718,7814944,7814941,7814936,7811148,7811146,7811144,7811143,7811142,7811141,7811139,7811138,7811136,7811132,7810157,7810156,7782073,7782067,7782065,7782063,7782062,7782061,7782060,7782057,7782056,7782055,7782054,7782050,7782049,7782048,7782047,7782046,7782045,7782043,7773552,7773551,7773543,7773541,7773535,7773069,7773067,7773029,7773022';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mellewis/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mellewis/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mellewis/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mellewis/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/mellewis/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/mellewis/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/mellewis/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/mellewis/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 || photos || {})[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 = 'Melanie Lewis 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>';
	}
			
	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> &pound;' + (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.item_price !== '') {
					temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			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 += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="mel.lewisphotos@btinternet.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="mel.lewisphotos@btinternet.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
				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;
	}
}

		

