window.thumbnails = {};
															thumbnails[3631132] = clik.newPhoto({"id":3631132,"src":"Epic1_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_3631132.html","width":130,"caption":"","height":130});
															thumbnails[3631134] = clik.newPhoto({"id":3631134,"src":"hairblow1_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_3631134.html","width":130,"caption":"","height":130});
															thumbnails[3662754] = clik.newPhoto({"id":3662754,"src":"Both_2_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_3662754.html","width":130,"caption":"","height":130});
															thumbnails[3675097] = clik.newPhoto({"id":3675097,"src":"Aelrid_02_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_3675097.html","width":130,"caption":"","height":130});
															thumbnails[3675098] = clik.newPhoto({"id":3675098,"src":"Aelrid_03_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_3675098.html","width":130,"caption":"","height":130});
															thumbnails[3675099] = clik.newPhoto({"id":3675099,"src":"Sam_01_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_3675099.html","width":130,"caption":"","height":130});
															thumbnails[3675101] = clik.newPhoto({"id":3675101,"src":"Both_4_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_3675101.html","width":130,"caption":"","height":130});
															thumbnails[4826711] = clik.newPhoto({"id":4826711,"src":"Aelrid_Fence_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826711.html","width":130,"caption":"","height":130});
															thumbnails[4826715] = clik.newPhoto({"id":4826715,"src":"AelridBike_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826715.html","width":130,"caption":"","height":130});
															thumbnails[4826716] = clik.newPhoto({"id":4826716,"src":"AelridSkyline_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826716.html","width":130,"caption":"","height":130});
															thumbnails[4826718] = clik.newPhoto({"id":4826718,"src":"Drape_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826718.html","width":130,"caption":"","height":130});
															thumbnails[4826719] = clik.newPhoto({"id":4826719,"src":"Fireescape2_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826719.html","width":130,"caption":"","height":130});
															thumbnails[4826722] = clik.newPhoto({"id":4826722,"src":"NYSkyline3_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826722.html","width":130,"caption":"","height":130});
															thumbnails[4826723] = clik.newPhoto({"id":4826723,"src":"Stoop_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826723.html","width":130,"caption":"","height":130});
															thumbnails[4826726] = clik.newPhoto({"id":4826726,"src":"Stoopbw_thumb.jpg","galleries_id":274802,"server_id":32,"link":"photo_4826726.html","width":130,"caption":"","height":130});
															thumbnails[6348390] = clik.newPhoto({"id":6348390,"src":"_MG_9441_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6348390.html","width":130,"caption":"","height":130});
															thumbnails[6348392] = clik.newPhoto({"id":6348392,"src":"_MG_9312_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6348392.html","width":130,"caption":"","height":130});
															thumbnails[6348393] = clik.newPhoto({"id":6348393,"src":"_MG_9620_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6348393.html","width":130,"caption":"","height":130});
															thumbnails[6348395] = clik.newPhoto({"id":6348395,"src":"_MG_9739_earing_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6348395.html","width":130,"caption":"","height":130});
															thumbnails[6923246] = clik.newPhoto({"id":6923246,"src":"_MG_6262_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_6923246.html","width":130,"caption":"","height":130});
															thumbnails[6923248] = clik.newPhoto({"id":6923248,"src":"_MG_6403_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_6923248.html","width":130,"caption":"","height":130});
															thumbnails[6923251] = clik.newPhoto({"id":6923251,"src":"_MG_6544_thumb.jpg","galleries_id":158857,"server_id":32,"link":"photo_6923251.html","width":130,"caption":"","height":130});
															thumbnails[3920391] = clik.newPhoto({"id":3920391,"src":"Aelrid2_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3920391.html","width":130,"caption":"","height":130});
															thumbnails[3920392] = clik.newPhoto({"id":3920392,"src":"Aelrid_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3920392.html","width":130,"caption":"","height":130});
															thumbnails[3920393] = clik.newPhoto({"id":3920393,"src":"Aelrid3_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3920393.html","width":130,"caption":"","height":130});
															thumbnails[3631053] = clik.newPhoto({"id":3631053,"src":"Karen_coat_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631053.html","width":130,"caption":"","height":130});
															thumbnails[3945775] = clik.newPhoto({"id":3945775,"src":"UrbOut_thumb.jpg","galleries_id":239238,"server_id":32,"link":"photo_3945775.html","width":130,"caption":"","height":130});
															thumbnails[3631043] = clik.newPhoto({"id":3631043,"src":"Silhouette_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3631043.html","width":130,"caption":"","height":130});
															thumbnails[3945777] = clik.newPhoto({"id":3945777,"src":"UrbOut2_thumb.jpg","galleries_id":239238,"server_id":32,"link":"photo_3945777.html","width":130,"caption":"","height":130});
															thumbnails[4018132] = clik.newPhoto({"id":4018132,"src":"Karen_crouch_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_4018132.html","width":130,"caption":"","height":130});
															thumbnails[3631063] = clik.newPhoto({"id":3631063,"src":"Karen_red_screen_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631063.html","width":130,"caption":"","height":130});
															thumbnails[3945810] = clik.newPhoto({"id":3945810,"src":"HLivingston2_thumb.jpg","galleries_id":239238,"server_id":32,"link":"photo_3945810.html","width":130,"caption":"","height":130});
															thumbnails[3631033] = clik.newPhoto({"id":3631033,"src":"lipstick_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3631033.html","width":130,"caption":"","height":130});
															thumbnails[3631060] = clik.newPhoto({"id":3631060,"src":"Karen_kneel_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631060.html","width":130,"caption":"","height":130});
															thumbnails[3945811] = clik.newPhoto({"id":3945811,"src":"HLivingston_thumb.jpg","galleries_id":239238,"server_id":32,"link":"photo_3945811.html","width":130,"caption":"","height":130});
															thumbnails[3631042] = clik.newPhoto({"id":3631042,"src":"Seams1_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3631042.html","width":130,"caption":"","height":130});
															thumbnails[3631052] = clik.newPhoto({"id":3631052,"src":"Dazed1_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631052.html","width":130,"caption":"","height":130});
															thumbnails[3631080] = clik.newPhoto({"id":3631080,"src":"Wallpaper_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631080.html","width":130,"caption":"","height":130});
															thumbnails[3631125] = clik.newPhoto({"id":3631125,"src":"Treasure_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_3631125.html","width":130,"caption":"","height":130});
															thumbnails[3945812] = clik.newPhoto({"id":3945812,"src":"HLivingston3_thumb.jpg","galleries_id":239238,"server_id":32,"link":"photo_3945812.html","width":130,"caption":"","height":130});
															thumbnails[4017501] = clik.newPhoto({"id":4017501,"src":"SWG3_2_thumb.jpg","galleries_id":239238,"server_id":32,"link":"photo_4017501.html","width":130,"caption":"","height":130});
															thumbnails[5422346] = clik.newPhoto({"id":5422346,"src":"Table_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_5422346.html","width":130,"caption":"","height":130});
															thumbnails[3631045] = clik.newPhoto({"id":3631045,"src":"Veil_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3631045.html","width":130,"caption":"","height":130});
															thumbnails[3631069] = clik.newPhoto({"id":3631069,"src":"Nightwear2_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631069.html","width":130,"caption":"","height":130});
															thumbnails[4017504] = clik.newPhoto({"id":4017504,"src":"SWG3_1_thumb.jpg","galleries_id":239238,"server_id":32,"link":"photo_4017504.html","width":130,"caption":"","height":130});
															thumbnails[3631065] = clik.newPhoto({"id":3631065,"src":"Nightwear_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631065.html","width":130,"caption":"","height":130});
															thumbnails[3631046] = clik.newPhoto({"id":3631046,"src":"Tetley1_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_3631046.html","width":130,"caption":"","height":130});
															thumbnails[3631072] = clik.newPhoto({"id":3631072,"src":"Nightwear3_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631072.html","width":130,"caption":"","height":130});
															thumbnails[7410292] = clik.newPhoto({"id":7410292,"src":"_MG_2126_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_7410292.html","width":130,"caption":"","height":130});
															thumbnails[3631078] = clik.newPhoto({"id":3631078,"src":"Scott_c_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631078.html","width":130,"caption":"","height":130});
															thumbnails[7410294] = clik.newPhoto({"id":7410294,"src":"_MG_2067_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_7410294.html","width":130,"caption":"","height":130});
															thumbnails[3631074] = clik.newPhoto({"id":3631074,"src":"Scott_a_thumb.jpg","galleries_id":161112,"server_id":32,"link":"photo_3631074.html","width":130,"caption":"","height":130});
															thumbnails[7410296] = clik.newPhoto({"id":7410296,"src":"_MG_2198_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_7410296.html","width":130,"caption":"","height":130});
															thumbnails[7410298] = clik.newPhoto({"id":7410298,"src":"_MG_2361_thumb.jpg","galleries_id":200508,"server_id":32,"link":"photo_7410298.html","width":130,"caption":"","height":130});
															thumbnails[6923252] = clik.newPhoto({"id":6923252,"src":"_MG_6745__thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6923252.html","width":130,"caption":"","height":130});
															thumbnails[6923293] = clik.newPhoto({"id":6923293,"src":"_MG_6640_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6923293.html","width":130,"caption":"","height":130});
															thumbnails[6923295] = clik.newPhoto({"id":6923295,"src":"_MG_6812_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6923295.html","width":130,"caption":"","height":130});
															thumbnails[6923297] = clik.newPhoto({"id":6923297,"src":"_MG_6400_thumb.jpg","galleries_id":221893,"server_id":32,"link":"photo_6923297.html","width":130,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[158857] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 1","link":"gallery_158857.html","maxRecords":0.0,"photoIDs":[3631132.0,3631134.0,3662754.0,3675097.0,3675098.0,3675099.0,3675101.0,6923246.0,6923248.0,6923251.0],"skipIndex":0,"section_code":"gallery","featured_images":3675098.0,"id":158857,"singleSection":false});				  						galleries[161112] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 2","link":"gallery_161112.html","maxRecords":0.0,"photoIDs":[3631053.0,4018132.0,3631063.0,3631060.0,3631052.0,3631080.0,3631069.0,3631065.0,3631072.0,3631078.0,3631074.0],"skipIndex":0,"section_code":"gallery","featured_images":3631078.0,"id":161112,"singleSection":false});				  						galleries[221893] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 3","link":"gallery_221893.html","maxRecords":0.0,"photoIDs":[6348390.0,6348392.0,6348393.0,6348395.0,3631125.0,5422346.0,6923252.0,6923293.0,6923295.0,6923297.0],"skipIndex":0,"section_code":"gallery","featured_images":"6923252,3631125","id":221893,"singleSection":false});				  						galleries[274802] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 4","link":"gallery_274802.html","maxRecords":0.0,"photoIDs":[4826711.0,4826715.0,4826716.0,4826718.0,4826719.0,4826722.0,4826723.0,4826726.0],"skipIndex":0,"section_code":"gallery","featured_images":4826723.0,"id":274802,"singleSection":false});				  						galleries[200508] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery 5","link":"gallery_200508.html","maxRecords":0.0,"photoIDs":[3920391.0,3920392.0,3920393.0,3631043.0,3631033.0,3631042.0,3631045.0,3631046.0,7410292.0,7410294.0,7410296.0,7410298.0],"skipIndex":0,"section_code":"gallery","featured_images":7410298.0,"id":200508,"singleSection":false});				  						galleries[239238] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Exhibitions","link":"gallery_239238.html","maxRecords":0.0,"photoIDs":[3945775.0,3945777.0,3945810.0,3945811.0,3945812.0,4017501.0,4017504.0],"skipIndex":0,"section_code":"gallery","featured_images":"4017501,3945810","id":239238,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7410298,6923252,6923246,6348392,4826726,4826719,4826718,4826716,3675101,3675098,3662754,3631125,3631078,3631065';
imageSets[2] = '7410298,6923252,4826723,4017501,3945810,3675098,3631125,3631078';
imageSets[3] = '7410298,7410296,7410294,7410292,6923297,6923295,6923293,6923252,6923251,6923248,6923246,6348395,6348393,6348392,6348390,5422346,4826726,4826723,4826722,4826719,4826718,4826716,4826715,4826711,4018132,4017504,4017501,3945812,3945811,3945810,3945777,3945775,3920393,3920392,3920391,3675101,3675099,3675098,3675097,3662754,3631134,3631132,3631125,3631080,3631078,3631074,3631072,3631069,3631065,3631063';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/jenncucumber/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/jenncucumber/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 = 'Jennifer Connolly Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="playthat_funkymusic@hotmail.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="playthat_funkymusic@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({					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;
	}
}

			

