window.thumbnails = {};
															thumbnails[3325112] = clik.newPhoto({"id":3325112,"src":"Beach_1_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3325112.html","width":96,"caption":"Beach_I","height":100});
															thumbnails[3325116] = clik.newPhoto({"id":3325116,"src":"Beach_21_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3325116.html","width":95,"caption":"Beach 2","height":100});
															thumbnails[3325181] = clik.newPhoto({"id":3325181,"src":"Eternity_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3325181.html","width":98,"caption":"Eternity","height":100});
															thumbnails[3325184] = clik.newPhoto({"id":3325184,"src":"Festival_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325184.html","width":46,"caption":"Festival","height":100});
															thumbnails[3325188] = clik.newPhoto({"id":3325188,"src":"Hidden_Meaning_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325188.html","width":100,"caption":"Hidden Meaning","height":73});
															thumbnails[3325198] = clik.newPhoto({"id":3325198,"src":"Illusion_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3325198.html","width":96,"caption":"Illusion","height":100});
															thumbnails[3325201] = clik.newPhoto({"id":3325201,"src":"Inspiration_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325201.html","width":130,"caption":"Inspiration","height":86});
															thumbnails[3325204] = clik.newPhoto({"id":3325204,"src":"Long_Awaited_thumb.jpg","galleries_id":202223,"server_id":15,"link":"photo_3325204.html","width":69,"caption":"Long Awaited","height":100});
															thumbnails[3325206] = clik.newPhoto({"id":3325206,"src":"Somewhere_Else_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325206.html","width":75,"caption":"Somewhere Else","height":100});
															thumbnails[3325230] = clik.newPhoto({"id":3325230,"src":"Installation_1_thumb.jpg","galleries_id":202664,"server_id":15,"link":"photo_3325230.html","width":75,"caption":"Installation 1 <br>\r\nEncincture (2005)","height":100});
															thumbnails[3325366] = clik.newPhoto({"id":3325366,"src":"Moving_On2_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3325366.html","width":100,"caption":"Moving On","height":65});
															thumbnails[3325370] = clik.newPhoto({"id":3325370,"src":"Torment_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3325370.html","width":100,"caption":"Torment","height":65});
															thumbnails[3325376] = clik.newPhoto({"id":3325376,"src":"Turmoil_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3325376.html","width":100,"caption":"Turmoil","height":65});
															thumbnails[3325379] = clik.newPhoto({"id":3325379,"src":"Thought_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325379.html","width":67,"caption":"Thought","height":100});
															thumbnails[3325383] = clik.newPhoto({"id":3325383,"src":"Spatter_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325383.html","width":59,"caption":"Spatter","height":100});
															thumbnails[3325385] = clik.newPhoto({"id":3325385,"src":"Meditation_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325385.html","width":59,"caption":"Meditation","height":100});
															thumbnails[3325386] = clik.newPhoto({"id":3325386,"src":"Lovers_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325386.html","width":64,"caption":"Lovers","height":100});
															thumbnails[3325387] = clik.newPhoto({"id":3325387,"src":"Into_Beyond_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325387.html","width":100,"caption":"Into Beyond","height":73});
															thumbnails[3325389] = clik.newPhoto({"id":3325389,"src":"Keeping_Watch_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_3325389.html","width":100,"caption":"Keeping Watch","height":74});
															thumbnails[3348605] = clik.newPhoto({"id":3348605,"src":"Tumult_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_3348605.html","width":100,"caption":"Tumult","height":65});
															thumbnails[4560187] = clik.newPhoto({"id":4560187,"src":"Culture_Street_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4560187.html","width":100,"caption":"Culture Street","height":74});
															thumbnails[4561767] = clik.newPhoto({"id":4561767,"src":"Tuesday_in_Times_Square_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561767.html","width":100,"caption":"Tuesday in Times Square","height":71});
															thumbnails[4561771] = clik.newPhoto({"id":4561771,"src":"No_Turning_Back_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561771.html","width":100,"caption":"No Turning Back","height":69});
															thumbnails[4561773] = clik.newPhoto({"id":4561773,"src":"Evening_in_Times_Square_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561773.html","width":74,"caption":"Evening in Times Square","height":100});
															thumbnails[4561776] = clik.newPhoto({"id":4561776,"src":"Midnight_in_Times_Square_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561776.html","width":73,"caption":"Midnight in Times Square","height":100});
															thumbnails[4561778] = clik.newPhoto({"id":4561778,"src":"In_the_City_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561778.html","width":100,"caption":"In the City","height":100});
															thumbnails[4561780] = clik.newPhoto({"id":4561780,"src":"Above_the_City_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561780.html","width":100,"caption":"Above the City","height":100});
															thumbnails[4561783] = clik.newPhoto({"id":4561783,"src":"House-of-Zen_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561783.html","width":76,"caption":"House of Zen","height":100});
															thumbnails[4561790] = clik.newPhoto({"id":4561790,"src":"MARY_thumb.jpg","galleries_id":441244,"server_id":15,"link":"photo_4561790.html","width":83,"caption":"MARY","height":100});
															thumbnails[4561792] = clik.newPhoto({"id":4561792,"src":"Songs_of_Praise_thumb.jpg","galleries_id":441244,"server_id":15,"link":"photo_4561792.html","width":100,"caption":"Songs of Praise","height":71});
															thumbnails[4561793] = clik.newPhoto({"id":4561793,"src":"Spirit_Calling_thumb.jpg","galleries_id":441244,"server_id":15,"link":"photo_4561793.html","width":100,"caption":"Spirit Calling","height":63});
															thumbnails[4561796] = clik.newPhoto({"id":4561796,"src":"Those_Who_Have_thumb.jpg","galleries_id":441244,"server_id":15,"link":"photo_4561796.html","width":34,"caption":"Those Who Have","height":100});
															thumbnails[4561797] = clik.newPhoto({"id":4561797,"src":"Salisbury-Cathedral_thumb.jpg","galleries_id":441244,"server_id":15,"link":"photo_4561797.html","width":85,"caption":"Salisbury Cathedral","height":100});
															thumbnails[4561820] = clik.newPhoto({"id":4561820,"src":"Trinity_thumb.jpg","galleries_id":441244,"server_id":15,"link":"photo_4561820.html","width":74,"caption":"Praise Eternal","height":100});
															thumbnails[4561838] = clik.newPhoto({"id":4561838,"src":"Floral_Arrangement_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561838.html","width":75,"caption":"Floral Arrangement","height":100});
															thumbnails[4561852] = clik.newPhoto({"id":4561852,"src":"Beauty_thumb.jpg","galleries_id":202663,"server_id":15,"link":"photo_4561852.html","width":28,"caption":"Beauty","height":100});
															thumbnails[4561855] = clik.newPhoto({"id":4561855,"src":"Dancer_1_thumb.jpg","galleries_id":441245,"server_id":15,"link":"photo_4561855.html","width":46,"caption":"Dancer I","height":100});
															thumbnails[4561858] = clik.newPhoto({"id":4561858,"src":"Dancer_2_thumb.jpg","galleries_id":441245,"server_id":15,"link":"photo_4561858.html","width":47,"caption":"Dancer II","height":100});
															thumbnails[4561865] = clik.newPhoto({"id":4561865,"src":"Dancer_3_thumb.jpg","galleries_id":441245,"server_id":15,"link":"photo_4561865.html","width":48,"caption":"Dancer III","height":100});
															thumbnails[4561878] = clik.newPhoto({"id":4561878,"src":"Purple_Haze_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_4561878.html","width":100,"caption":"Purple Haze","height":75});
															thumbnails[4561888] = clik.newPhoto({"id":4561888,"src":"Evening_in_Porthkerris_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_4561888.html","width":100,"caption":"Evening Near Porthkerris","height":75});
															thumbnails[4561898] = clik.newPhoto({"id":4561898,"src":"Near_Porthkerris_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_4561898.html","width":54,"caption":"Near Porthkerris","height":100});
															thumbnails[4561908] = clik.newPhoto({"id":4561908,"src":"More_To_Life1_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_4561908.html","width":68,"caption":"More to Life","height":100});
															thumbnails[4561921] = clik.newPhoto({"id":4561921,"src":"Follow_Me1_thumb.jpg","galleries_id":202668,"server_id":15,"link":"photo_4561921.html","width":73,"caption":"Follow Me","height":100});
															thumbnails[8272292] = clik.newPhoto({"id":8272292,"src":"Romance_and_Melody_thumb.jpg","galleries_id":441245,"server_id":38,"link":"photo_8272292.html","width":100,"caption":"Romance and Melody","height":67});
															thumbnails[8272294] = clik.newPhoto({"id":8272294,"src":"In-Love_thumb.jpg","galleries_id":202663,"server_id":38,"link":"photo_8272294.html","width":67,"caption":"In Love","height":100});
															thumbnails[8278155] = clik.newPhoto({"id":8278155,"src":"A-Night-at-the-Opera-_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278155.html","width":100,"caption":"A Night at the Opera","height":67});
															thumbnails[8278163] = clik.newPhoto({"id":8278163,"src":"Another_World_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278163.html","width":100,"caption":"Another World","height":44});
															thumbnails[8278171] = clik.newPhoto({"id":8278171,"src":"Ballerina-_thumb.jpg","galleries_id":441245,"server_id":37,"link":"photo_8278171.html","width":100,"caption":"Ballerina","height":100});
															thumbnails[8278220] = clik.newPhoto({"id":8278220,"src":"By_Any_Other_Name_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278220.html","width":67,"caption":"By Any Other Name","height":100});
															thumbnails[8278223] = clik.newPhoto({"id":8278223,"src":"Crown_of_Thorns_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278223.html","width":100,"caption":"Crown of Thorns","height":67});
															thumbnails[8278226] = clik.newPhoto({"id":8278226,"src":"Darkest_Hour_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278226.html","width":67,"caption":"Darkest Hour","height":100});
															thumbnails[8278229] = clik.newPhoto({"id":8278229,"src":"Call_To_Worship_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278229.html","width":67,"caption":"Call to Worship","height":100});
															thumbnails[8278232] = clik.newPhoto({"id":8278232,"src":"Evensong_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278232.html","width":67,"caption":"Evensong","height":100});
															thumbnails[8278233] = clik.newPhoto({"id":8278233,"src":"Floral_Air_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278233.html","width":67,"caption":"Floral Air","height":100});
															thumbnails[8278237] = clik.newPhoto({"id":8278237,"src":"Search_for_a_Better_World_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278237.html","width":100,"caption":"Search for a Better World","height":67});
															thumbnails[8278240] = clik.newPhoto({"id":8278240,"src":"Silence-Within_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278240.html","width":67,"caption":"Silence Within","height":100});
															thumbnails[8278242] = clik.newPhoto({"id":8278242,"src":"A_New_Commandment_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278242.html","width":67,"caption":"A New Commandment","height":100});
															thumbnails[8278244] = clik.newPhoto({"id":8278244,"src":"Father_Forgive_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278244.html","width":67,"caption":"Father Forgive","height":100});
															thumbnails[8278249] = clik.newPhoto({"id":8278249,"src":"Love_Personified_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278249.html","width":67,"caption":"Love Personified","height":100});
															thumbnails[8278252] = clik.newPhoto({"id":8278252,"src":"Palm_Sunday_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278252.html","width":67,"caption":"Palm Sunday","height":100});
															thumbnails[8278255] = clik.newPhoto({"id":8278255,"src":"Perfect_Harmony_thumb.jpg","galleries_id":441245,"server_id":37,"link":"photo_8278255.html","width":67,"caption":"Perfect Harmony","height":100});
															thumbnails[8278260] = clik.newPhoto({"id":8278260,"src":"Pointe_Shoes_thumb.jpg","galleries_id":441245,"server_id":37,"link":"photo_8278260.html","width":100,"caption":"Pointe Shoes","height":100});
															thumbnails[8278268] = clik.newPhoto({"id":8278268,"src":"The_Time_Is_Nigh_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278268.html","width":67,"caption":"The Time is Nigh","height":100});
															thumbnails[8278274] = clik.newPhoto({"id":8278274,"src":"In_the_Palm_of_His_Hand_thumb.jpg","galleries_id":441244,"server_id":37,"link":"photo_8278274.html","width":100,"caption":"In the Palm of His Hand","height":67});
															thumbnails[8278280] = clik.newPhoto({"id":8278280,"src":"Playing_With_Fire-_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278280.html","width":100,"caption":"Playing With Fire","height":67});
															thumbnails[8278287] = clik.newPhoto({"id":8278287,"src":"Serenade_thumb.jpg","galleries_id":441245,"server_id":37,"link":"photo_8278287.html","width":100,"caption":"Serenade","height":100});
															thumbnails[8278300] = clik.newPhoto({"id":8278300,"src":"With_Affection_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278300.html","width":67,"caption":"With Affection","height":100});
															thumbnails[8278305] = clik.newPhoto({"id":8278305,"src":"Something_In_The_Air_Tonight_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278305.html","width":100,"caption":"Something in the Air Tonight","height":67});
															thumbnails[8278310] = clik.newPhoto({"id":8278310,"src":"Window_to_Beyond_thumb.jpg","galleries_id":202663,"server_id":37,"link":"photo_8278310.html","width":67,"caption":"Window to Beyond","height":100});
															thumbnails[8278317] = clik.newPhoto({"id":8278317,"src":"Prelude_in_C_thumb.jpg","galleries_id":441245,"server_id":37,"link":"photo_8278317.html","width":100,"caption":"Prelude in C","height":67});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[441245] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Music and Dance","link":"gallery_441245.html","maxRecords":0.0,"photoIDs":[4561855.0,4561858.0,4561865.0,8272292.0,8278171.0,8278255.0,8278260.0,8278287.0,8278317.0],"skipIndex":0,"section_code":"gallery","featured_images":"8278317,8278287,8278260,8278255,8278171,8272292,4561865,4561858,4561855","id":441245,"singleSection":false});				  						galleries[441244] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Religious Based Works","link":"gallery_441244.html","maxRecords":0.0,"photoIDs":[4561790.0,4561792.0,4561793.0,4561796.0,4561797.0,4561820.0,8278226.0,8278229.0,8278232.0,8278242.0,8278244.0,8278249.0,8278252.0,8278268.0,8278274.0],"skipIndex":0,"section_code":"gallery","featured_images":"8278274,8278268,8278252,8278249,8278244,8278242,8278232,8278229,8278226,4561820","id":441244,"singleSection":false});				  						galleries[202663] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Giclée Prints","link":"gallery_202663.html","maxRecords":0.0,"photoIDs":[3325184.0,3325188.0,3325201.0,3325206.0,3325379.0,3325383.0,3325385.0,3325386.0,3325387.0,3325389.0,4560187.0,4561767.0,4561771.0,4561773.0,4561776.0,4561778.0,4561780.0,4561783.0,4561838.0,4561852.0,8272294.0,8278155.0,8278163.0,8278220.0,8278223.0,8278233.0,8278237.0,8278240.0,8278280.0,8278300.0,8278305.0,8278310.0],"skipIndex":0,"section_code":"gallery","featured_images":"8278310,8278305,8278300,8278280,8278240,8278237,8278233,8278223,8278220,8278163","id":202663,"singleSection":false});				  						galleries[202664] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Installations","link":"gallery_202664.html","maxRecords":0.0,"photoIDs":[3325230.0],"skipIndex":0,"section_code":"gallery","featured_images":3325230.0,"id":202664,"singleSection":false});				  						galleries[202668] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mixed Media\/ Collage\/Paintings","link":"gallery_202668.html","maxRecords":0.0,"photoIDs":[3325112.0,3325116.0,3325181.0,3325198.0,3325366.0,3325370.0,3325376.0,3348605.0,4561878.0,4561888.0,4561898.0,4561908.0,4561921.0],"skipIndex":0,"section_code":"gallery","featured_images":"4561921,4561908,4561898,4561888,4561878,3348605,3325376,3325370,3325366,3325198","id":202668,"singleSection":false});				  						galleries[202223] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wall Hangings","link":"gallery_202223.html","maxRecords":0.0,"photoIDs":[3325204.0],"skipIndex":0,"section_code":"gallery","featured_images":3325204.0,"id":202223,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3325389,3325387,3325201';
imageSets[3] = '8278317,8278310,8278305,8278300,8278287,8278280,8278274,8278268,8278260,8278255,8278252,8278249,8278244,8278242,8278240,8278237,8278233,8278232,8278229,8278226,8278223,8278220,8278171,8278163,8278155,8272294,8272292,4561921,4561908,4561898,4561888,4561878,4561865,4561858,4561855,4561852,4561838,4561820,4561797,4561796,4561793,4561792,4561790,4561783,4561780,4561778,4561776,4561773,4561771,4561767';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/gerrysissons/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/gerrysissons/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'GERRY SISSONS BA (Hons) Visual Art: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

