window.thumbnails = {};
															thumbnails[1510840] = clik.newPhoto({"id":1510840,"src":"Arktiske linjer click_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1510840.html","width":130,"caption":"Sigerfjord Arctic light","height":91});
															thumbnails[1512137] = clik.newPhoto({"id":1512137,"src":"Rype_filtered clickpic 1_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_1512137.html","width":130,"caption":"Grouse (Rypestegg)","height":109});
															thumbnails[1512153] = clik.newPhoto({"id":1512153,"src":"Vinterclickpic1_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1512153.html","width":130,"caption":"Winter in Sigerfjord","height":85});
															thumbnails[1513235] = clik.newPhoto({"id":1513235,"src":"merget4 nedskalert til clickpic_edited-1_thumb.jpg","galleries_id":105928,"server_id":1,"link":"photo_1513235.html","width":130,"caption":"High water","height":47});
															thumbnails[1513240] = clik.newPhoto({"id":1513240,"src":"Høst i Hestdalen  clickpic_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_1513240.html","width":130,"caption":"Autumn","height":80});
															thumbnails[1514395] = clik.newPhoto({"id":1514395,"src":"Ternene_filtered cp_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_1514395.html","width":130,"caption":"Common tern","height":87});
															thumbnails[1514397] = clik.newPhoto({"id":1514397,"src":"Kaktus miniatyr_thumb.jpg","galleries_id":103939,"server_id":1,"link":"photo_1514397.html","width":130,"caption":"Flower of Caktus","height":108});
															thumbnails[1514410] = clik.newPhoto({"id":1514410,"src":"Fossen3 manip_edited-1 cp_thumb.jpg","galleries_id":103818,"server_id":1,"link":"photo_1514410.html","width":130,"caption":"Norwegian fantasy","height":81});
															thumbnails[1514919] = clik.newPhoto({"id":1514919,"src":"Løkta i Nordlys 800_filtered cp_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1514919.html","width":130,"caption":"Night light","height":116});
															thumbnails[1514925] = clik.newPhoto({"id":1514925,"src":"bønatur1_edited-4cp_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1514925.html","width":130,"caption":"Rocks in fjord","height":68});
															thumbnails[1514927] = clik.newPhoto({"id":1514927,"src":"Frostrøyk cp_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1514927.html","width":130,"caption":"Cold fjord in moonlight (-18c)","height":93});
															thumbnails[1514930] = clik.newPhoto({"id":1514930,"src":"Tjelden_edited-2cp_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_1514930.html","width":130,"caption":"Oystercracker","height":94});
															thumbnails[1515791] = clik.newPhoto({"id":1515791,"src":"Jennestad_edited cp_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1515791.html","width":130,"caption":"Fog in fjord","height":61});
															thumbnails[1515795] = clik.newPhoto({"id":1515795,"src":"bregnebarn cp_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_1515795.html","width":130,"caption":"Bregnebarn","height":145});
															thumbnails[1516234] = clik.newPhoto({"id":1516234,"src":"Sommerfugl cp_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_1516234.html","width":130,"caption":"Admiral","height":106});
															thumbnails[1516237] = clik.newPhoto({"id":1516237,"src":"Øksnes fullmåne  i januar cp_thumb.jpg","galleries_id":105928,"server_id":1,"link":"photo_1516237.html","width":130,"caption":"Moonlight","height":44});
															thumbnails[1516282] = clik.newPhoto({"id":1516282,"src":"Mainatt i Kanstad_filtered cp_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1516282.html","width":130,"caption":"Pink summer night","height":174});
															thumbnails[1516294] = clik.newPhoto({"id":1516294,"src":"Nestuva 3 framed_filtered cp_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1516294.html","width":130,"caption":"Jørnfjord","height":176});
															thumbnails[1516466] = clik.newPhoto({"id":1516466,"src":"Mannin i auenfjord_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1516466.html","width":130,"caption":"Man in water","height":75});
															thumbnails[1516473] = clik.newPhoto({"id":1516473,"src":"www_thumb.digit.no.jpg","galleries_id":103937,"server_id":1,"link":"photo_1516473.html","width":130,"caption":"Autumn","height":86});
															thumbnails[1516477] = clik.newPhoto({"id":1516477,"src":"www_thumb.digit.no_edited-1.jpg","galleries_id":103784,"server_id":1,"link":"photo_1516477.html","width":130,"caption":"Eagle in the night","height":105});
															thumbnails[1516492] = clik.newPhoto({"id":1516492,"src":"www_thumb.digit.no_edited-2.jpg","galleries_id":105928,"server_id":1,"link":"photo_1516492.html","width":130,"caption":"Slåttdalen","height":58});
															thumbnails[1516520] = clik.newPhoto({"id":1516520,"src":"www_thumb.digit.no11.jpg","galleries_id":103697,"server_id":1,"link":"photo_1516520.html","width":130,"caption":"Night in Auenfjord","height":73});
															thumbnails[1516531] = clik.newPhoto({"id":1516531,"src":"www_thumb.digit.no2.jpg","galleries_id":103777,"server_id":1,"link":"photo_1516531.html","width":130,"caption":"Summer delight","height":89});
															thumbnails[1516538] = clik.newPhoto({"id":1516538,"src":"www_thumb.digit.no3.jpg","galleries_id":103939,"server_id":1,"link":"photo_1516538.html","width":130,"caption":"Fucsia","height":193});
															thumbnails[1516793] = clik.newPhoto({"id":1516793,"src":"www_thumb.digit.no_edited-3.jpg","galleries_id":103784,"server_id":1,"link":"photo_1516793.html","width":130,"caption":"Puffin (Lundefugl)","height":90});
															thumbnails[1517424] = clik.newPhoto({"id":1517424,"src":"www_brua cp_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1517424.html","width":130,"caption":"Hadselbrua","height":82});
															thumbnails[1517425] = clik.newPhoto({"id":1517425,"src":"fluesopp cp_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_1517425.html","width":130,"caption":"Fluesopp","height":95});
															thumbnails[1517429] = clik.newPhoto({"id":1517429,"src":"www_thumb.digit.no_edited-7.jpg","galleries_id":103784,"server_id":1,"link":"photo_1517429.html","width":130,"caption":"Family at six","height":89});
															thumbnails[1517858] = clik.newPhoto({"id":1517858,"src":"www_thumb.digit.no_edited-8.jpg","galleries_id":103818,"server_id":1,"link":"photo_1517858.html","width":130,"caption":"Icesculpture from nature","height":202});
															thumbnails[1517926] = clik.newPhoto({"id":1517926,"src":"www_thumb.digit.no_edited-9.jpg","galleries_id":103937,"server_id":1,"link":"photo_1517926.html","width":130,"caption":"Icecold","height":112});
															thumbnails[1530779] = clik.newPhoto({"id":1530779,"src":"hav mot land_edited-2_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1530779.html","width":130,"caption":"Rocks","height":85});
															thumbnails[1541641] = clik.newPhoto({"id":1541641,"src":"Clickpic Fjæra_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1541641.html","width":130,"caption":"Autumn weather over Vesteraalen","height":74});
															thumbnails[1546203] = clik.newPhoto({"id":1546203,"src":"Tåke vestfjorden-02 clp_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1546203.html","width":130,"caption":"Fog in Lofoten","height":80});
															thumbnails[1546220] = clik.newPhoto({"id":1546220,"src":"Strandstinden i Nordlys_filtered clp_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1546220.html","width":130,"caption":"Aurora Polaris","height":192});
															thumbnails[1575645] = clik.newPhoto({"id":1575645,"src":"www_thumb.digit.no_edited-12.jpg","galleries_id":103784,"server_id":1,"link":"photo_1575645.html","width":130,"caption":"Larus","height":167});
															thumbnails[1575657] = clik.newPhoto({"id":1575657,"src":"Sidensvans1_filtered_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_1575657.html","width":130,"caption":"Sidensvans","height":139});
															thumbnails[1576516] = clik.newPhoto({"id":1576516,"src":"Gåse formasjonen clickpic_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_1576516.html","width":130,"caption":"Pink-footed Goose (Kortnebbgås)","height":96});
															thumbnails[1580368] = clik.newPhoto({"id":1580368,"src":"Black country Bridge Clickpic_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1580368.html","width":130,"caption":"Sortland Bridge","height":58});
															thumbnails[1580370] = clik.newPhoto({"id":1580370,"src":"Vik i novemberlys clickpic_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1580370.html","width":130,"caption":"","height":80});
															thumbnails[1810067] = clik.newPhoto({"id":1810067,"src":"MåneskinnsturClickpic_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1810067.html","width":130,"caption":"Moonflight","height":87});
															thumbnails[1810070] = clik.newPhoto({"id":1810070,"src":"Låven cp_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1810070.html","width":130,"caption":"Afternoon in Bø","height":73});
															thumbnails[1810113] = clik.newPhoto({"id":1810113,"src":"gravstøtteblåClickpic_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_1810113.html","width":130,"caption":"Graveyard","height":218});
															thumbnails[1852619] = clik.newPhoto({"id":1852619,"src":"Clickpic_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_1852619.html","width":130,"caption":"Hamarøy","height":76});
															thumbnails[2011519] = clik.newPhoto({"id":2011519,"src":"Elgen i ramme clickpic_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_2011519.html","width":130,"caption":"Moose","height":130});
															thumbnails[2011521] = clik.newPhoto({"id":2011521,"src":"Older Clickpic_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_2011521.html","width":130,"caption":"","height":90});
															thumbnails[2073399] = clik.newPhoto({"id":2073399,"src":"Hyllest til våren CP1_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_2073399.html","width":130,"caption":"Welcome to the Springtime","height":92});
															thumbnails[2919154] = clik.newPhoto({"id":2919154,"src":"Gullesfjord Clickpic_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_2919154.html","width":130,"caption":"Mountains in Gullesfjord","height":41});
															thumbnails[2919343] = clik.newPhoto({"id":2919343,"src":"Full fart_filteredClickpic2_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_2919343.html","width":130,"caption":"Skarv from above","height":162});
															thumbnails[3720387] = clik.newPhoto({"id":3720387,"src":"Grønn_Duo_Clickpic_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_3720387.html","width":130,"caption":"Grønn duo","height":98});
															thumbnails[3720392] = clik.newPhoto({"id":3720392,"src":"Ikke_noe_kos_clickpic_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_3720392.html","width":130,"caption":"Grønnfink","height":90});
															thumbnails[3877128] = clik.newPhoto({"id":3877128,"src":"ThemsenMerget_Clickpic_edited-1_thumb.jpg","galleries_id":105928,"server_id":1,"link":"photo_3877128.html","width":130,"caption":"","height":48});
															thumbnails[5105778] = clik.newPhoto({"id":5105778,"src":"Clicpic001_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_5105778.html","width":130,"caption":"Canibal ;)","height":93});
															thumbnails[5105780] = clik.newPhoto({"id":5105780,"src":"Clicpic002_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_5105780.html","width":130,"caption":"Skorpa, Bø","height":93});
															thumbnails[5105785] = clik.newPhoto({"id":5105785,"src":"Clicpic003_thumb.jpg","galleries_id":288627,"server_id":1,"link":"photo_5105785.html","width":130,"caption":"Serrano ","height":119});
															thumbnails[5105786] = clik.newPhoto({"id":5105786,"src":"Clicpic004_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_5105786.html","width":130,"caption":"Bønatur","height":79});
															thumbnails[5105787] = clik.newPhoto({"id":5105787,"src":"Clicpic005_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_5105787.html","width":130,"caption":"Vikbrua","height":81});
															thumbnails[5105790] = clik.newPhoto({"id":5105790,"src":"Clicpic006_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_5105790.html","width":130,"caption":"Soppberget","height":98});
															thumbnails[5105791] = clik.newPhoto({"id":5105791,"src":"Fargerik_nostalgi_CP_thumb.jpg","galleries_id":103818,"server_id":1,"link":"photo_5105791.html","width":130,"caption":"Maritim nostalgi","height":87});
															thumbnails[5105793] = clik.newPhoto({"id":5105793,"src":"Høstblad_CP_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_5105793.html","width":130,"caption":"Høstblad","height":123});
															thumbnails[6443322] = clik.newPhoto({"id":6443322,"src":"Djevelens_tanngard800px_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_6443322.html","width":97,"caption":"\"Djevelens tanngard\"<br>\r\n","height":130});
															thumbnails[6443330] = clik.newPhoto({"id":6443330,"src":"Djevelens_tanngard1Clikpic_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_6443330.html","width":100,"caption":"\"Djevelens tanngard 2\"","height":130});
															thumbnails[6443334] = clik.newPhoto({"id":6443334,"src":"Artig_nordlys_edited-1_filtered_clikpic_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_6443334.html","width":130,"caption":"Nordlysnatt ved Nyken","height":85});
															thumbnails[6443337] = clik.newPhoto({"id":6443337,"src":"Høydeformat_nyken_filtered_copy_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_6443337.html","width":87,"caption":"Nordlys ved Nyken","height":130});
															thumbnails[6443350] = clik.newPhoto({"id":6443350,"src":"Stråler_edited-clikpic_thumb.jpg","galleries_id":103697,"server_id":1,"link":"photo_6443350.html","width":130,"caption":"Strålende Nordlys","height":84});
															thumbnails[6443393] = clik.newPhoto({"id":6443393,"src":"Linerleunge_cropetclikpic_thumb.jpg","galleries_id":103784,"server_id":1,"link":"photo_6443393.html","width":130,"caption":"Linerleunge","height":130});
															thumbnails[6443402] = clik.newPhoto({"id":6443402,"src":"Skodde_i_JørnfjordClikpic_thumb.jpg","galleries_id":103777,"server_id":1,"link":"photo_6443402.html","width":130,"caption":"Jørnfjord i nattedis","height":68});
															thumbnails[8558281] = clik.newPhoto({"id":8558281,"src":"En_disig_aften_1000px_thumb.jpg","galleries_id":103937,"server_id":1,"link":"photo_8558281.html","width":130,"caption":"","height":44});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[103784] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Birds","link":"gallery_103784.html","maxRecords":0.0,"photoIDs":[1512137.0,1514395.0,1514930.0,1516477.0,1516793.0,1517429.0,1575645.0,1575657.0,1576516.0,2073399.0,2919343.0,3720387.0,3720392.0,5105778.0,6443393.0],"skipIndex":0,"section_code":"gallery","featured_images":"5105778,3720392,2919343,2073399","id":103784,"singleSection":false});				  						galleries[103939] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Flowers","link":"gallery_103939.html","maxRecords":0.0,"photoIDs":[1514397.0,1516538.0],"skipIndex":0,"section_code":"gallery","featured_images":"1516538,1514397","id":103939,"singleSection":false});				  						galleries[288627] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Food","link":"gallery_288627.html","maxRecords":0.0,"photoIDs":[5105785.0],"skipIndex":0,"section_code":"gallery","featured_images":5105785.0,"id":288627,"singleSection":false});				  						galleries[103937] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_103937.html","maxRecords":0.0,"photoIDs":[1512153.0,1514925.0,1515791.0,1516294.0,1516466.0,1516473.0,1517424.0,1517926.0,1530779.0,1541641.0,1546203.0,1580370.0,1810070.0,1852619.0,2919154.0,5105780.0,5105786.0,5105787.0,6443322.0,6443330.0,8558281.0],"skipIndex":0,"section_code":"gallery","featured_images":"1810070,1580370","id":103937,"singleSection":false});				  						galleries[103777] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nature","link":"gallery_103777.html","maxRecords":0.0,"photoIDs":[1513240.0,1515795.0,1516234.0,1516531.0,1517425.0,2011519.0,2011521.0,5105790.0,5105793.0,6443402.0],"skipIndex":0,"section_code":"gallery","featured_images":2011519.0,"id":103777,"singleSection":false});				  						galleries[105928] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Panorama ","link":"gallery_105928.html","maxRecords":0.0,"photoIDs":[1513235.0,1516237.0,1516492.0,3877128.0],"skipIndex":0,"section_code":"gallery","featured_images":1516237.0,"id":105928,"singleSection":false});				  						galleries[123142] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Video","link":"gallery_123142.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":123142,"singleSection":false});				  						galleries[103818] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Water","link":"gallery_103818.html","maxRecords":0.0,"photoIDs":[1514410.0,1517858.0,5105791.0],"skipIndex":0,"section_code":"gallery","featured_images":1514410.0,"id":103818,"singleSection":false});				  						galleries[103697] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Night-photos","link":"gallery_103697.html","maxRecords":0.0,"photoIDs":[1510840.0,1514919.0,1514927.0,1516282.0,1516520.0,1546220.0,1580368.0,1810067.0,1810113.0,6443334.0,6443337.0,6443350.0],"skipIndex":0,"section_code":"gallery","featured_images":"1810113,1810067,1546220","id":103697,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3877128,3720392,3720387,2919343,2919154,2073399,2011521,2011519,1852619,1810113,1810070,1810067,1580370,1576516,1546203,1541641,1517429,1517425,1516793,1516531,1516477,1516473,1514930,1514919,1512137';
imageSets[2] = '5105785,5105778,3720392,2919343,2073399,2011519,1810113,1810070,1810067,1580370,1546220,1516237,1514410';
imageSets[3] = '8558281,6443402,6443393,6443350,6443337,6443334,6443330,6443322,5105793,5105791,5105790,5105787,5105786,5105785,5105780,5105778,3877128,3720392,3720387,2919343,2919154,2073399,2011521,2011519,1852619,1810113,1810070,1810067,1580370,1580368,1576516,1575657,1575645,1546220,1546203,1541641,1530779,1517926,1517858,1517429,1517425,1517424,1516793,1516538,1516531,1516520,1516492,1516477,1516473,1516466';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lorrephoto/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lorrephoto/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 = 'Lorrephoto: ' + 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> kr ' + (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 += '<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="gelundli@start.no">';
					temp += '<input type="hidden" name="currency_code" value="NOK">';
					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="gelundli@start.no">';
				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;
	}
}

			

