window.thumbnails = {};
															thumbnails[8466300] = clik.newPhoto({"id":8466300,"src":"Blue_chair_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":176});
															thumbnails[8466302] = clik.newPhoto({"id":8466302,"src":"Hudtoner_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":156});
															thumbnails[8466324] = clik.newPhoto({"id":8466324,"src":"Dancing-in-the-street_10_x_15_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":113});
															thumbnails[8466332] = clik.newPhoto({"id":8466332,"src":"Happy_10_x_15_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8466334] = clik.newPhoto({"id":8466334,"src":"Mates_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":107});
															thumbnails[8466336] = clik.newPhoto({"id":8466336,"src":"Joy_45x30_filtered_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":86});
															thumbnails[8466345] = clik.newPhoto({"id":8466345,"src":"Vandmand_10_x_15_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8466353] = clik.newPhoto({"id":8466353,"src":"Shy_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":235});
															thumbnails[8466356] = clik.newPhoto({"id":8466356,"src":"Snooker_Shark_light_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[8466360] = clik.newPhoto({"id":8466360,"src":"_DSC9154_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[2013641] = clik.newPhoto({"id":2013641,"src":"Sun-is-down_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_2013641.html","width":130,"caption":"","height":66});
															thumbnails[6124757] = clik.newPhoto({"id":6124757,"src":"Colours_of_Dawn_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124757.html","width":130,"caption":"","height":87});
															thumbnails[6124761] = clik.newPhoto({"id":6124761,"src":"Desert_Graffiti_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124761.html","width":130,"caption":"","height":85});
															thumbnails[6124768] = clik.newPhoto({"id":6124768,"src":"Feeding_the_Alien_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124768.html","width":130,"caption":"","height":87});
															thumbnails[6124772] = clik.newPhoto({"id":6124772,"src":"Simplicity_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124772.html","width":130,"caption":"","height":86});
															thumbnails[6124777] = clik.newPhoto({"id":6124777,"src":"Tits2_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124777.html","width":130,"caption":"","height":87});
															thumbnails[6987953] = clik.newPhoto({"id":6987953,"src":"Blue_Psyko_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6987953.html","width":130,"caption":"","height":87});
															thumbnails[7671280] = clik.newPhoto({"id":7671280,"src":"A_Bigger_Bang_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_7671280.html","width":130,"caption":"","height":87});
															thumbnails[7671710] = clik.newPhoto({"id":7671710,"src":"Bushfire_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_7671710.html","width":130,"caption":"","height":87});
															thumbnails[6124762] = clik.newPhoto({"id":6124762,"src":"Scribbley_Worms_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124762.html","width":130,"caption":"","height":86});
															thumbnails[6124760] = clik.newPhoto({"id":6124760,"src":"Cracking_Up_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124760.html","width":130,"caption":"","height":86});
															thumbnails[6124751] = clik.newPhoto({"id":6124751,"src":"Aboriginal_art_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124751.html","width":130,"caption":"","height":87});
															thumbnails[6124778] = clik.newPhoto({"id":6124778,"src":"Vikinger_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124778.html","width":130,"caption":"","height":87});
															thumbnails[6124776] = clik.newPhoto({"id":6124776,"src":"The_Mask_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124776.html","width":130,"caption":"","height":87});
															thumbnails[6987978] = clik.newPhoto({"id":6987978,"src":"Psycodelic_Landscape_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6987978.html","width":130,"caption":"","height":87});
															thumbnails[6124765] = clik.newPhoto({"id":6124765,"src":"El_Toro_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124765.html","width":130,"caption":"","height":86});
															thumbnails[6987961] = clik.newPhoto({"id":6987961,"src":"Blues_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6987961.html","width":130,"caption":"","height":87});
															thumbnails[6987945] = clik.newPhoto({"id":6987945,"src":"Waterflow_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6987945.html","width":130,"caption":"","height":87});
															thumbnails[2013622] = clik.newPhoto({"id":2013622,"src":"Hjarbæk-Fjord_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_2013622.html","width":130,"caption":"","height":86});
															thumbnails[2968741] = clik.newPhoto({"id":2968741,"src":"Sunrise_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_2968741.html","width":130,"caption":"","height":65});
															thumbnails[2773027] = clik.newPhoto({"id":2773027,"src":"Kermits-Pool_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_2773027.html","width":130,"caption":"","height":86});
															thumbnails[6124780] = clik.newPhoto({"id":6124780,"src":"Stonehenge_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124780.html","width":130,"caption":"","height":65});
															thumbnails[6124779] = clik.newPhoto({"id":6124779,"src":"Springtime_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_6124779.html","width":130,"caption":"","height":86});
															thumbnails[8342709] = clik.newPhoto({"id":8342709,"src":"Colors_of_a_cliff_1_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8342709.html","width":130,"caption":"","height":87});
															thumbnails[8342653] = clik.newPhoto({"id":8342653,"src":"Flight_A6E429E1-1EC9-DFB6-09E6E9BF39BED93E_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8342653.html","width":130,"caption":"","height":195});
															thumbnails[8342726] = clik.newPhoto({"id":8342726,"src":"Beach_Tree_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8342726.html","width":130,"caption":"","height":195});
															thumbnails[8342729] = clik.newPhoto({"id":8342729,"src":"Burning_Out_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8342729.html","width":130,"caption":"","height":195});
															thumbnails[8342736] = clik.newPhoto({"id":8342736,"src":"Crash_Landing_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8342736.html","width":130,"caption":"","height":87});
															thumbnails[8647483] = clik.newPhoto({"id":8647483,"src":"DSC_6519-1_1_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8647483.html","width":130,"caption":"","height":87});
															thumbnails[8647484] = clik.newPhoto({"id":8647484,"src":"DSC_6529-1_1_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8647484.html","width":130,"caption":"","height":87});
															thumbnails[8647486] = clik.newPhoto({"id":8647486,"src":"_DSC8956_1_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8647486.html","width":130,"caption":"","height":195});
															thumbnails[8647485] = clik.newPhoto({"id":8647485,"src":"_DSC8941_thumb.jpg","galleries_id":307694,"server_id":32,"link":"photo_8647485.html","width":130,"caption":"","height":195});
															thumbnails[7025796] = clik.newPhoto({"id":7025796,"src":"The_Wind_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025796.html","width":130,"caption":"","height":87});
															thumbnails[7671526] = clik.newPhoto({"id":7671526,"src":"Black_Tits_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7671526.html","width":130,"caption":"","height":87});
															thumbnails[7671617] = clik.newPhoto({"id":7671617,"src":"Blues_BW_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7671617.html","width":130,"caption":"","height":87});
															thumbnails[7671967] = clik.newPhoto({"id":7671967,"src":"Spider_Territory_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7671967.html","width":130,"caption":"","height":87});
															thumbnails[7025733] = clik.newPhoto({"id":7025733,"src":"_DSC7254_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025733.html","width":130,"caption":"","height":86});
															thumbnails[7025800] = clik.newPhoto({"id":7025800,"src":"Vintersolhverv_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025800.html","width":130,"caption":"","height":72});
															thumbnails[7025798] = clik.newPhoto({"id":7025798,"src":"Vinterdag_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025798.html","width":130,"caption":"","height":86});
															thumbnails[7025734] = clik.newPhoto({"id":7025734,"src":"_DSC7274_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025734.html","width":130,"caption":"","height":87});
															thumbnails[7025735] = clik.newPhoto({"id":7025735,"src":"_DSC7275_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025735.html","width":130,"caption":"","height":87});
															thumbnails[7025783] = clik.newPhoto({"id":7025783,"src":"Frazer_Island_filtered_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025783.html","width":130,"caption":"","height":87});
															thumbnails[7025786] = clik.newPhoto({"id":7025786,"src":"Greyscale_30x45_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025786.html","width":130,"caption":"","height":75});
															thumbnails[7073826] = clik.newPhoto({"id":7073826,"src":"Vestas_2_filtered_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7073826.html","width":130,"caption":"","height":90});
															thumbnails[7025790] = clik.newPhoto({"id":7025790,"src":"Nightflight_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_7025790.html","width":130,"caption":"","height":87});
															thumbnails[6124782] = clik.newPhoto({"id":6124782,"src":"Two-Sisters_BW_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_6124782.html","width":130,"caption":"","height":85});
															thumbnails[6124397] = clik.newPhoto({"id":6124397,"src":"Birds1_thumb.jpg","galleries_id":415533,"server_id":32,"link":"photo_6124397.html","width":130,"caption":"","height":87});
															thumbnails[2773029] = clik.newPhoto({"id":2773029,"src":"Kookaburra_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_2773029.html","width":130,"caption":"","height":87});
															thumbnails[6241534] = clik.newPhoto({"id":6241534,"src":"Robin_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_6241534.html","width":130,"caption":"","height":87});
															thumbnails[6241565] = clik.newPhoto({"id":6241565,"src":"Woodpecker_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_6241565.html","width":130,"caption":"","height":182});
															thumbnails[7671500] = clik.newPhoto({"id":7671500,"src":"Allike_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671500.html","width":130,"caption":"","height":87});
															thumbnails[7671548] = clik.newPhoto({"id":7671548,"src":"Blue_Tit_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671548.html","width":130,"caption":"","height":87});
															thumbnails[7671667] = clik.newPhoto({"id":7671667,"src":"Bogfinke_30x30_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671667.html","width":130,"caption":"","height":130});
															thumbnails[7671713] = clik.newPhoto({"id":7671713,"src":"Falcon_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671713.html","width":130,"caption":"","height":87});
															thumbnails[7671716] = clik.newPhoto({"id":7671716,"src":"Finch_RB_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671716.html","width":130,"caption":"","height":87});
															thumbnails[7671899] = clik.newPhoto({"id":7671899,"src":"Musvit_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671899.html","width":130,"caption":"","height":87});
															thumbnails[7671954] = clik.newPhoto({"id":7671954,"src":"Sjagger_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671954.html","width":130,"caption":"","height":87});
															thumbnails[7671957] = clik.newPhoto({"id":7671957,"src":"Skovskade_30x30_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671957.html","width":130,"caption":"","height":130});
															thumbnails[7671964] = clik.newPhoto({"id":7671964,"src":"Solsort_30_x_45_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671964.html","width":130,"caption":"","height":87});
															thumbnails[7671973] = clik.newPhoto({"id":7671973,"src":"Tyrkerdue_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_7671973.html","width":130,"caption":"","height":87});
															thumbnails[2919853] = clik.newPhoto({"id":2919853,"src":"Sparrow_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_2919853.html","width":130,"caption":"","height":86});
															thumbnails[2788705] = clik.newPhoto({"id":2788705,"src":"Isfugl2_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_2788705.html","width":130,"caption":"","height":112});
															thumbnails[6241536] = clik.newPhoto({"id":6241536,"src":"Stær_30x45_thumb.jpg","galleries_id":415532,"server_id":32,"link":"photo_6241536.html","width":130,"caption":"","height":195});
															thumbnails[8633588] = clik.newPhoto({"id":8633588,"src":"Galleri_Svalegangen1_IPfoto_thumb.jpg","galleries_id":456071,"server_id":32,"link":"photo_8633588.html","width":130,"caption":"","height":184});
															thumbnails[8633589] = clik.newPhoto({"id":8633589,"src":"Galleri_Svalegangen2_IPfoto_thumb.jpg","galleries_id":456071,"server_id":32,"link":"photo_8633589.html","width":130,"caption":"","height":184});
															thumbnails[8633502] = clik.newPhoto({"id":8633502,"src":"I_øjeblikket_udstiller_webIPfoto_thumb.jpg","galleries_id":456071,"server_id":32,"link":"photo_8633502.html","width":130,"caption":"","height":61});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[307694] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract","link":"section583096.html","maxRecords":0.0,"photoIDs":[2013641.0,6124757.0,6124761.0,6124768.0,6124772.0,6124777.0,6987953.0,7671280.0,7671710.0,6124762.0,6124760.0,6124751.0,6124778.0,6124776.0,6987978.0,6124765.0,6987961.0,6987945.0,2013622.0,2968741.0,2773027.0,6124780.0,6124779.0,8342709.0,8342653.0,8342726.0,8342729.0,8342736.0,8647483.0,8647484.0,8647486.0,8647485.0],"skipIndex":0,"section_code":"section583096","featured_images":"8647486,8647485,8647484,8647483,8342736,8342729,8342726,8342709,8342653,7671710","id":307694,"singleSection":true});				  						galleries[415533] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Black & White","link":"section583097.html","maxRecords":0.0,"photoIDs":[7025796.0,7671526.0,7671617.0,7671967.0,7025733.0,7025800.0,7025798.0,7025734.0,7025735.0,7025783.0,7025786.0,7073826.0,7025790.0,6124782.0,6124397.0],"skipIndex":0,"section_code":"section583097","featured_images":"7671967,7671617,7671526,7073826,7025800,7025798,7025796,7025790,7025786,7025783","id":415533,"singleSection":true});				  						galleries[415532] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Birds","link":"section583098.html","maxRecords":0.0,"photoIDs":[2773029.0,6241534.0,6241565.0,7671500.0,7671548.0,7671667.0,7671713.0,7671716.0,7671899.0,7671954.0,7671957.0,7671964.0,7671973.0,2919853.0,2788705.0,6241536.0],"skipIndex":0,"section_code":"section583098","featured_images":"7671973,7671964,7671957,7671954,7671899,7671716,7671713,7671667,7671548,7671500","id":415532,"singleSection":true});				  						galleries[456071] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Galleri Svalegangen","link":"section385953.html","maxRecords":0.0,"photoIDs":[8633588.0,8633589.0,8633502.0],"skipIndex":0,"section_code":"section385953","featured_images":"8633589,8633588,8633502","id":456071,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7025796,6987953,6241565,6241534,6124777,6124772,6124768,6124761,6124757,2773029,2013641';
imageSets[2] = '8466345';
imageSets[3] = '8647486,8647485,8647484,8647483,8633589,8633588,8633502,8466360,8466356,8466353,8466345,8466336,8466334,8466332,8466324,8466302,8466300,8342736,8342729,8342726,8342709,8342653,7671973,7671967,7671964,7671957,7671954,7671899,7671716,7671713,7671710,7671667,7671617,7671548,7671526,7671500,7671280,7073826,7025800,7025798,7025796,7025790,7025786,7025783,7025735,7025734,7025733,6987978,6987961,6987953';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ingvardp/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/ingvardp/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 += 'section583096.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 && 'section583096' != '') {
					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 = 'NaturePhotography from a creative view: ' + 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> AU$' + (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="ipfoto@hotmail.com">';
					temp += '<input type="hidden" name="currency_code" value="AUD">';
					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="ipfoto@hotmail.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;
	}
}

			

