window.thumbnails = {};
thumbnails[7995317] = clik.newPhoto({"link":"#","caption":"","height":125,"id":7995317,"server_id":21,"src":"71_thumb.jpg","galleries_id":"","width":130});
thumbnails[7995359] = clik.newPhoto({"link":"#","caption":"","height":150,"id":7995359,"server_id":21,"src":"79_thumb.jpg","galleries_id":"","width":130});
thumbnails[8001479] = clik.newPhoto({"link":"photo_8001479.html","caption":"","height":159,"id":8001479,"server_id":21,"src":"61_thumb.JPG","galleries_id":429788,"width":130});
thumbnails[8001485] = clik.newPhoto({"link":"photo_8001485.html","caption":"","height":159,"id":8001485,"server_id":21,"src":"14c_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8001500] = clik.newPhoto({"link":"photo_8001500.html","caption":"","height":162,"id":8001500,"server_id":21,"src":"88a_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8001588] = clik.newPhoto({"link":"photo_8001588.html","caption":"","height":193,"id":8001588,"server_id":21,"src":"c270_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8001809] = clik.newPhoto({"link":"photo_8001809.html","caption":"","height":105,"id":8001809,"server_id":21,"src":"15_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8001967] = clik.newPhoto({"link":"photo_8001967.html","caption":"","height":161,"id":8001967,"server_id":21,"src":"21..3_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002069] = clik.newPhoto({"link":"photo_8002069.html","caption":"","height":187,"id":8002069,"server_id":21,"src":"28_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002076] = clik.newPhoto({"link":"photo_8002076.html","caption":"","height":157,"id":8002076,"server_id":21,"src":"10a_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002084] = clik.newPhoto({"link":"photo_8002084.html","caption":"","height":139,"id":8002084,"server_id":21,"src":"231bc_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002098] = clik.newPhoto({"link":"photo_8002098.html","caption":"","height":104,"id":8002098,"server_id":21,"src":"225.a_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002181] = clik.newPhoto({"link":"photo_8002181.html","caption":"","height":148,"id":8002181,"server_id":21,"src":"143_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002182] = clik.newPhoto({"link":"photo_8002182.html","caption":"","height":150,"id":8002182,"server_id":21,"src":"c237.111_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002186] = clik.newPhoto({"link":"photo_8002186.html","caption":"","height":187,"id":8002186,"server_id":21,"src":"109_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002190] = clik.newPhoto({"link":"photo_8002190.html","caption":"","height":65,"id":8002190,"server_id":21,"src":"150_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002192] = clik.newPhoto({"link":"photo_8002192.html","caption":"","height":87,"id":8002192,"server_id":21,"src":"25.1_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002193] = clik.newPhoto({"link":"photo_8002193.html","caption":"","height":195,"id":8002193,"server_id":21,"src":"71_D68C00A2-1EC9-DFB6-09F7EFAAD940E0B8_thumb.JPG","galleries_id":429788,"width":130});
thumbnails[8002194] = clik.newPhoto({"link":"photo_8002194.html","caption":"","height":152,"id":8002194,"server_id":21,"src":"9_RED_SKY_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002224] = clik.newPhoto({"link":"photo_8002224.html","caption":"","height":94,"id":8002224,"server_id":21,"src":"352_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002227] = clik.newPhoto({"link":"photo_8002227.html","caption":"","height":163,"id":8002227,"server_id":21,"src":"241aaaaaaa_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002234] = clik.newPhoto({"link":"photo_8002234.html","caption":"","height":143,"id":8002234,"server_id":21,"src":"214_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002236] = clik.newPhoto({"link":"photo_8002236.html","caption":"","height":87,"id":8002236,"server_id":21,"src":"294a_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002396] = clik.newPhoto({"link":"photo_8002396.html","caption":"","height":195,"id":8002396,"server_id":21,"src":"C137_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002399] = clik.newPhoto({"link":"photo_8002399.html","caption":"","height":87,"id":8002399,"server_id":21,"src":"C25_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8002405] = clik.newPhoto({"link":"photo_8002405.html","caption":"","height":172,"id":8002405,"server_id":21,"src":"506_thumb.JPG","galleries_id":429788,"width":130});
thumbnails[8002412] = clik.newPhoto({"link":"photo_8002412.html","caption":"","height":174,"id":8002412,"server_id":21,"src":"c1642_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8002431] = clik.newPhoto({"link":"photo_8002431.html","caption":"","height":104,"id":8002431,"server_id":21,"src":"114a_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002432] = clik.newPhoto({"link":"photo_8002432.html","caption":"","height":136,"id":8002432,"server_id":21,"src":"c1652_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002433] = clik.newPhoto({"link":"photo_8002433.html","caption":"","height":195,"id":8002433,"server_id":21,"src":"583_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002434] = clik.newPhoto({"link":"photo_8002434.html","caption":"","height":163,"id":8002434,"server_id":21,"src":"157a_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002435] = clik.newPhoto({"link":"photo_8002435.html","caption":"","height":148,"id":8002435,"server_id":21,"src":"C754_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002437] = clik.newPhoto({"link":"photo_8002437.html","caption":"","height":168,"id":8002437,"server_id":21,"src":"358_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002438] = clik.newPhoto({"link":"photo_8002438.html","caption":"","height":138,"id":8002438,"server_id":21,"src":"205a_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002439] = clik.newPhoto({"link":"photo_8002439.html","caption":"","height":114,"id":8002439,"server_id":21,"src":"476_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002440] = clik.newPhoto({"link":"photo_8002440.html","caption":"","height":163,"id":8002440,"server_id":21,"src":"04062011_010_thumb.JPG","galleries_id":429998,"width":130});
thumbnails[8002442] = clik.newPhoto({"link":"photo_8002442.html","caption":"","height":185,"id":8002442,"server_id":21,"src":"B291_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8002448] = clik.newPhoto({"link":"photo_8002448.html","caption":"","height":163,"id":8002448,"server_id":21,"src":"193a_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002449] = clik.newPhoto({"link":"photo_8002449.html","caption":"","height":195,"id":8002449,"server_id":21,"src":"565_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8002450] = clik.newPhoto({"link":"photo_8002450.html","caption":"","height":135,"id":8002450,"server_id":21,"src":"72a_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8004034] = clik.newPhoto({"link":"photo_8004034.html","caption":"","height":183,"id":8004034,"server_id":21,"src":"479_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8004035] = clik.newPhoto({"link":"photo_8004035.html","caption":"","height":163,"id":8004035,"server_id":21,"src":"251b_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8004036] = clik.newPhoto({"link":"photo_8004036.html","caption":"","height":131,"id":8004036,"server_id":21,"src":"419_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8004038] = clik.newPhoto({"link":"photo_8004038.html","caption":"","height":98,"id":8004038,"server_id":21,"src":"416_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8004050] = clik.newPhoto({"link":"photo_8004050.html","caption":"","height":104,"id":8004050,"server_id":21,"src":"c197.111_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8004168] = clik.newPhoto({"link":"photo_8004168.html","caption":"","height":116,"id":8004168,"server_id":21,"src":"293a2_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004176] = clik.newPhoto({"link":"photo_8004176.html","caption":"","height":134,"id":8004176,"server_id":21,"src":"300_thumb.JPG","galleries_id":430012,"width":130});
thumbnails[8004182] = clik.newPhoto({"link":"photo_8004182.html","caption":"","height":186,"id":8004182,"server_id":21,"src":"c2492_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004185] = clik.newPhoto({"link":"photo_8004185.html","caption":"","height":195,"id":8004185,"server_id":21,"src":"539_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004189] = clik.newPhoto({"link":"photo_8004189.html","caption":"","height":111,"id":8004189,"server_id":21,"src":"209c_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004192] = clik.newPhoto({"link":"photo_8004192.html","caption":"","height":104,"id":8004192,"server_id":21,"src":"191.a_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004196] = clik.newPhoto({"link":"photo_8004196.html","caption":"","height":90,"id":8004196,"server_id":21,"src":"342_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004208] = clik.newPhoto({"link":"photo_8004208.html","caption":"","height":127,"id":8004208,"server_id":21,"src":"561_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004210] = clik.newPhoto({"link":"photo_8004210.html","caption":"","height":104,"id":8004210,"server_id":21,"src":"303a_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004212] = clik.newPhoto({"link":"photo_8004212.html","caption":"","height":195,"id":8004212,"server_id":21,"src":"104.a_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004281] = clik.newPhoto({"link":"photo_8004281.html","caption":"","height":131,"id":8004281,"server_id":21,"src":"71_EF255197-1EC9-DFB6-09556DD089D5CD36_thumb.jpg","galleries_id":429788,"width":130});
thumbnails[8004285] = clik.newPhoto({"link":"photo_8004285.html","caption":"","height":109,"id":8004285,"server_id":21,"src":"c2211_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8004286] = clik.newPhoto({"link":"photo_8004286.html","caption":"","height":195,"id":8004286,"server_id":21,"src":"153_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8004288] = clik.newPhoto({"link":"photo_8004288.html","caption":"","height":87,"id":8004288,"server_id":21,"src":"222a_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004291] = clik.newPhoto({"link":"photo_8004291.html","caption":"","height":192,"id":8004291,"server_id":21,"src":"B10_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8004293] = clik.newPhoto({"link":"photo_8004293.html","caption":"","height":189,"id":8004293,"server_id":21,"src":"c2551_thumb.jpg","galleries_id":429998,"width":130});
thumbnails[8004294] = clik.newPhoto({"link":"photo_8004294.html","caption":"","height":90,"id":8004294,"server_id":21,"src":"c264_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004295] = clik.newPhoto({"link":"photo_8004295.html","caption":"","height":104,"id":8004295,"server_id":21,"src":"49.a_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004296] = clik.newPhoto({"link":"photo_8004296.html","caption":"","height":103,"id":8004296,"server_id":21,"src":"399_thumb.JPG","galleries_id":429789,"width":130});
thumbnails[8004307] = clik.newPhoto({"link":"photo_8004307.html","caption":"","height":211,"id":8004307,"server_id":21,"src":"16.1_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8004350] = clik.newPhoto({"link":"photo_8004350.html","caption":"","height":113,"id":8004350,"server_id":21,"src":"325_thumb.JPG","galleries_id":429998,"width":130});
thumbnails[8004374] = clik.newPhoto({"link":"photo_8004374.html","caption":"","height":195,"id":8004374,"server_id":21,"src":"333_thumb.JPG","galleries_id":430012,"width":130});
thumbnails[8004386] = clik.newPhoto({"link":"photo_8004386.html","caption":"","height":114,"id":8004386,"server_id":21,"src":"372_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8004398] = clik.newPhoto({"link":"photo_8004398.html","caption":"","height":236,"id":8004398,"server_id":21,"src":"587_thumb.JPG","galleries_id":430012,"width":130});
thumbnails[8004408] = clik.newPhoto({"link":"photo_8004408.html","caption":"","height":189,"id":8004408,"server_id":21,"src":"89.12_thumb.jpg","galleries_id":430012,"width":130});
thumbnails[8010220] = clik.newPhoto({"link":"photo_8010220.html","caption":"","height":94,"id":8010220,"server_id":21,"src":"Jo_Triptych_thumb.jpg","galleries_id":430381,"width":130});
thumbnails[8010222] = clik.newPhoto({"link":"photo_8010222.html","caption":"","height":106,"id":8010222,"server_id":21,"src":"Stacy_Triptych_thumb.jpg","galleries_id":430381,"width":130});
thumbnails[8010302] = clik.newPhoto({"link":"photo_8010302.html","caption":"","height":94,"id":8010302,"server_id":21,"src":"Katrina_Triptych_thumb.jpg","galleries_id":430381,"width":130});
thumbnails[8035881] = clik.newPhoto({"link":"photo_8035881.html","caption":"","height":104,"id":8035881,"server_id":21,"src":"Maria_and_Sergio_thumb.JPG","galleries_id":431311,"width":130});
thumbnails[8035882] = clik.newPhoto({"link":"photo_8035882.html","caption":"","height":104,"id":8035882,"server_id":21,"src":"Stacy_and_robert_thumb.JPG","galleries_id":431311,"width":130});
thumbnails[8038405] = clik.newPhoto({"link":"photo_8038405.html","caption":"","height":104,"id":8038405,"server_id":21,"src":"DSC00537_thumb.JPG","galleries_id":430012,"width":130});
thumbnails[8038406] = clik.newPhoto({"link":"photo_8038406.html","caption":"","height":195,"id":8038406,"server_id":21,"src":"DSC00547_thumb.JPG","galleries_id":429998,"width":130});
thumbnails[8168502] = clik.newPhoto({"link":"photo_8168502.html","caption":"","height":195,"id":8168502,"server_id":21,"src":"A8_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8168587] = clik.newPhoto({"link":"photo_8168587.html","caption":"","height":61,"id":8168587,"server_id":21,"src":"A10_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8168596] = clik.newPhoto({"link":"photo_8168596.html","caption":"","height":196,"id":8168596,"server_id":21,"src":"C12_thumb.jpg","galleries_id":429789,"width":130});
thumbnails[8168599] = clik.newPhoto({"link":"photo_8168599.html","caption":"","height":195,"id":8168599,"server_id":21,"src":"A5..1HDR2_thumb.jpg","galleries_id":429789,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[429788] = clik.newGallery({"photoIDs":[8001479,8001485,8001500,8001588,8001809,8001967,8002069,8002076,8002084,8002098,8002181,8002182,8002193,8002399,8002405,8002450,8004281],"link":"gallery_429788.html","skipIndex":0,"section_code":"gallery","id":429788,"parentGallery":"","featured_images":8001479,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"The Detail"});galleries[429789] = clik.newGallery({"photoIDs":[8002186,8002190,8002192,8002194,8002224,8002227,8002234,8002236,8002396,8002412,8004036,8004038,8004050,8004285,8004296,8004307,8168502,8168587,8168596,8168599],"link":"gallery_429789.html","skipIndex":0,"section_code":"gallery","id":429789,"parentGallery":"","featured_images":"8002224,8002186","maxRecords":0,"usePopups":false,"singleSection":false,"title":"People and Places"});galleries[429998] = clik.newGallery({"photoIDs":[8002431,8002432,8002433,8002434,8002435,8002437,8002438,8002439,8002440,8002448,8002449,8004034,8004035,8004286,8004291,8004293,8004350,8038406],"link":"gallery_429998.html","skipIndex":0,"section_code":"gallery","id":429998,"parentGallery":"","featured_images":8002438,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Brides"});galleries[430012] = clik.newGallery({"photoIDs":[8002442,8004168,8004176,8004182,8004185,8004189,8004192,8004196,8004208,8004210,8004212,8004288,8004294,8004295,8004374,8004386,8004398,8004408,8038405],"link":"gallery_430012.html","skipIndex":0,"section_code":"gallery","id":430012,"parentGallery":"","featured_images":8004208,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Brides and Grooms"});galleries[430381] = clik.newGallery({"photoIDs":[8010220,8010222,8010302],"link":"gallery_430381.html","skipIndex":0,"section_code":"gallery","id":430381,"parentGallery":"","featured_images":8010220,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Montage and Story Books"});galleries[431311] = clik.newGallery({"photoIDs":[8035881,8035882],"link":"gallery_431311.html","skipIndex":0,"section_code":"gallery","id":431311,"parentGallery":"","featured_images":8035881,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Thank you's"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '8168599,8168596,8168587,8168502,8038406,8038405,8035882,8035881,8010302,8010222,8010220,8004408,8004398,8004386,8004374,8004350,8004307,8004296,8004295,8004294,8004293,8004291,8004288,8004286,8004285,8004281,8004212,8004210,8004208,8004196,8004192,8004189,8004185,8004182,8004176,8004168,8004050,8004038,8004036,8004035,8004034,8002450,8002449,8002448,8002442,8002440,8002439,8002438,8002437,8002435';
imageSets[2] = '8035881,8010220,8004208,8002438,8002224,8002186,8001479';
imageSets[1] = '7995359';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/bevraggatt/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/bevraggatt/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 = 'Alpha Images              07944 191 112: ' + 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.item_price !== '') {
			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;
	}
}

		

