window.thumbnails = {};
thumbnails[7311431] = clik.newPhoto({"link":"photo_7311431.html","caption":"","height":93,"id":7311431,"server_id":21,"src":"_GRA2401-450_thumb.jpg","galleries_id":395303,"width":130});
thumbnails[7421264] = clik.newPhoto({"link":"photo_7421264.html","caption":"","height":163,"id":7421264,"server_id":21,"src":"_HOL3283-BW_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7421265] = clik.newPhoto({"link":"photo_7421265.html","caption":"","height":87,"id":7421265,"server_id":21,"src":"_HOL3292-Edit_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7421267] = clik.newPhoto({"link":"photo_7421267.html","caption":"","height":87,"id":7421267,"server_id":21,"src":"_HOL3295-BW_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[8450839] = clik.newPhoto({"link":"photo_8450839.html","caption":"","height":166,"id":8450839,"server_id":21,"src":"_MOL3965-BW-_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[8451033] = clik.newPhoto({"link":"photo_8451033.html","caption":"","height":220,"id":8451033,"server_id":21,"src":"_MOL3916_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[8451034] = clik.newPhoto({"link":"photo_8451034.html","caption":"","height":187,"id":8451034,"server_id":21,"src":"_MOL3927_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7978621] = clik.newPhoto({"link":"photo_7978621.html","caption":"","height":98,"id":7978621,"server_id":21,"src":"VIN_4560-16x12-toned_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978625] = clik.newPhoto({"link":"photo_7978625.html","caption":"","height":196,"id":7978625,"server_id":21,"src":"VIN_4573-Edit_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978627] = clik.newPhoto({"link":"photo_7978627.html","caption":"","height":237,"id":7978627,"server_id":21,"src":"VIN_4788-BW_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978612] = clik.newPhoto({"link":"photo_7978612.html","caption":"","height":228,"id":7978612,"server_id":21,"src":"VIN_4613-Edit_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978613] = clik.newPhoto({"link":"photo_7978613.html","caption":"","height":413,"id":7978613,"server_id":21,"src":"VIN_4753_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978617] = clik.newPhoto({"link":"photo_7978617.html","caption":"","height":204,"id":7978617,"server_id":21,"src":"VIN_4762-Edit-Paper-Toner-1_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7314752] = clik.newPhoto({"link":"photo_7314752.html","caption":"","height":87,"id":7314752,"server_id":21,"src":"CAT1604_thumb.JPG","galleries_id":395303,"width":130});
thumbnails[7978608] = clik.newPhoto({"link":"photo_7978608.html","caption":"","height":163,"id":7978608,"server_id":21,"src":"TEO_4319-BW_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978605] = clik.newPhoto({"link":"photo_7978605.html","caption":"","height":196,"id":7978605,"server_id":21,"src":"TEO_4310-PC-VIGNETTE-2_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978602] = clik.newPhoto({"link":"photo_7978602.html","caption":"","height":173,"id":7978602,"server_id":21,"src":"TEO_4309-PAPER-TONER-7-HI-CONTRAST--BRIGHTNESS_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978600] = clik.newPhoto({"link":"photo_7978600.html","caption":"","height":195,"id":7978600,"server_id":21,"src":"_HOL3722-SOFT-DUOTONE_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7978596] = clik.newPhoto({"link":"photo_7978596.html","caption":"","height":195,"id":7978596,"server_id":21,"src":"_HOL3720_thumb.jpg","galleries_id":395616,"width":130});
thumbnails[7315079] = clik.newPhoto({"link":"photo_7315079.html","caption":"","height":87,"id":7315079,"server_id":21,"src":"CAT1644_thumb.JPG","galleries_id":395303,"width":130});
thumbnails[7315081] = clik.newPhoto({"link":"photo_7315081.html","caption":"","height":87,"id":7315081,"server_id":21,"src":"DSC_1281_thumb.JPG","galleries_id":395303,"width":130});
thumbnails[7315085] = clik.newPhoto({"link":"photo_7315085.html","caption":"","height":87,"id":7315085,"server_id":21,"src":"LYL_9801_thumb.JPG","galleries_id":395303,"width":130});
thumbnails[7315089] = clik.newPhoto({"link":"photo_7315089.html","caption":"","height":130,"id":7315089,"server_id":21,"src":"LYL_9840_thumb.JPG","galleries_id":395303,"width":130});
thumbnails[7315092] = clik.newPhoto({"link":"photo_7315092.html","caption":"","height":87,"id":7315092,"server_id":21,"src":"DEB_6086-CROP_thumb.jpg","galleries_id":395303,"width":130});
thumbnails[7315099] = clik.newPhoto({"link":"photo_7315099.html","caption":"","height":130,"id":7315099,"server_id":21,"src":"DMZ_4811_thumb.jpg","galleries_id":395303,"width":130});
thumbnails[7315095] = clik.newPhoto({"link":"photo_7315095.html","caption":"","height":87,"id":7315095,"server_id":21,"src":"DMZ_4669NC_thumb.jpg","galleries_id":395303,"width":130});
thumbnails[7315101] = clik.newPhoto({"link":"photo_7315101.html","caption":"","height":130,"id":7315101,"server_id":21,"src":"HAN_0723_thumb.JPG","galleries_id":395303,"width":130});
thumbnails[7315102] = clik.newPhoto({"link":"photo_7315102.html","caption":"","height":87,"id":7315102,"server_id":21,"src":"JAM_6129-STYLE_thumb.jpg","galleries_id":395303,"width":130});
thumbnails[7315259] = clik.newPhoto({"link":"photo_7315259.html","caption":"","height":195,"id":7315259,"server_id":21,"src":"_GRA2321_thumb.jpg","galleries_id":395303,"width":130});
thumbnails[7315262] = clik.newPhoto({"link":"photo_7315262.html","caption":"","height":195,"id":7315262,"server_id":21,"src":"_GRA2408_thumb.jpg","galleries_id":395303,"width":130});
thumbnails[7315181] = clik.newPhoto({"link":"photo_7315181.html","caption":"","height":195,"id":7315181,"server_id":21,"src":"_WED2838_thumb.JPG","galleries_id":395304,"width":130});
thumbnails[7315188] = clik.newPhoto({"link":"photo_7315188.html","caption":"","height":130,"id":7315188,"server_id":21,"src":"_WED2936_thumb.JPG","galleries_id":395304,"width":130});
thumbnails[7315193] = clik.newPhoto({"link":"photo_7315193.html","caption":"","height":195,"id":7315193,"server_id":21,"src":"_WED2777_thumb.JPG","galleries_id":395304,"width":130});
thumbnails[7315197] = clik.newPhoto({"link":"photo_7315197.html","caption":"","height":87,"id":7315197,"server_id":21,"src":"_WED2768_thumb.JPG","galleries_id":395304,"width":130});
thumbnails[7315208] = clik.newPhoto({"link":"photo_7315208.html","caption":"","height":130,"id":7315208,"server_id":21,"src":"_WED2674_thumb.JPG","galleries_id":395304,"width":130});
thumbnails[7315209] = clik.newPhoto({"link":"photo_7315209.html","caption":"","height":195,"id":7315209,"server_id":21,"src":"BRI_6817_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315210] = clik.newPhoto({"link":"photo_7315210.html","caption":"","height":195,"id":7315210,"server_id":21,"src":"BRI_7039_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315212] = clik.newPhoto({"link":"photo_7315212.html","caption":"","height":195,"id":7315212,"server_id":21,"src":"BRI_6897_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315213] = clik.newPhoto({"link":"photo_7315213.html","caption":"","height":130,"id":7315213,"server_id":21,"src":"BRI_7060_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315216] = clik.newPhoto({"link":"photo_7315216.html","caption":"","height":195,"id":7315216,"server_id":21,"src":"BRI_7093-CROP_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315217] = clik.newPhoto({"link":"photo_7315217.html","caption":"","height":195,"id":7315217,"server_id":21,"src":"BRI_7109_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315218] = clik.newPhoto({"link":"photo_7315218.html","caption":"","height":130,"id":7315218,"server_id":21,"src":"BRI_7134_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315219] = clik.newPhoto({"link":"photo_7315219.html","caption":"","height":87,"id":7315219,"server_id":21,"src":"BRI_7139_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315221] = clik.newPhoto({"link":"photo_7315221.html","caption":"","height":130,"id":7315221,"server_id":21,"src":"CAT1932_thumb.JPG","galleries_id":395304,"width":130});
thumbnails[7315223] = clik.newPhoto({"link":"photo_7315223.html","caption":"","height":87,"id":7315223,"server_id":21,"src":"CAT1708_thumb.JPG","galleries_id":395304,"width":130});
thumbnails[7315224] = clik.newPhoto({"link":"photo_7315224.html","caption":"","height":195,"id":7315224,"server_id":21,"src":"CATN0625_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315228] = clik.newPhoto({"link":"photo_7315228.html","caption":"","height":195,"id":7315228,"server_id":21,"src":"POW_9303BG_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315229] = clik.newPhoto({"link":"photo_7315229.html","caption":"","height":87,"id":7315229,"server_id":21,"src":"POW_9412BG_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315230] = clik.newPhoto({"link":"photo_7315230.html","caption":"","height":130,"id":7315230,"server_id":21,"src":"POW_9682BG_thumb.jpg","galleries_id":395304,"width":130});
thumbnails[7315232] = clik.newPhoto({"link":"photo_7315232.html","caption":"","height":195,"id":7315232,"server_id":21,"src":"POW_9590_thumb.jpg","galleries_id":395304,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[395303] = clik.newGallery({"photoIDs":[7311431,7314752,7315079,7315081,7315085,7315089,7315092,7315099,7315095,7315101,7315102,7315259,7315262],"link":"gallery_395303.html","skipIndex":0,"section_code":"gallery","id":395303,"parentGallery":"","featured_images":"7315262,7315259,7315102,7315101,7315099,7315095,7315092,7315089,7315085,7315081","maxRecords":0,"usePopups":true,"singleSection":false,"title":"PORTRAITS"});galleries[395304] = clik.newGallery({"photoIDs":[8450839,8451033,8451034,7315181,7315188,7315193,7315197,7315208,7315209,7315210,7315212,7315213,7315216,7315217,7315218,7315219,7315221,7315223,7315224,7315228,7315229,7315230,7315232],"link":"gallery_395304.html","skipIndex":0,"section_code":"gallery","id":395304,"parentGallery":"","featured_images":"8450839,7315197","maxRecords":0,"usePopups":true,"singleSection":false,"title":"WEDDINGS"});galleries[395616] = clik.newGallery({"photoIDs":[7421264,7421265,7421267,7978621,7978625,7978627,7978612,7978613,7978617,7978608,7978605,7978602,7978600,7978596],"link":"gallery_395616.html","skipIndex":0,"section_code":"gallery","id":395616,"parentGallery":"","featured_images":7978617,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"Vintage-Style Portraits"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '8451034,8451033,8450839,7978627,7978625,7978621,7978617,7978613,7978612,7978608,7978605,7978602,7978600,7978596,7421267,7421265,7421264,7315262,7315259,7315232,7315230,7315229,7315228,7315224,7315223,7315221,7315219,7315218,7315217,7315216,7315213,7315212,7315210,7315209,7315208,7315197,7315193,7315188,7315181,7315102,7315101,7315099,7315095,7315092,7315089,7315085,7315081,7315079,7314752,7311431';
imageSets[2] = '8450839,7978617,7315197';
imageSets[1] = '7978621';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/dmiles2011/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/dmiles2011/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 = 'Miles of Smiles Creative Portrait 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>';
	}
			
				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;
	}
}

		

