window.thumbnails = {};
															thumbnails[2234290] = clik.newPhoto({"id":2234290,"src":"Bilde-1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Kart","height":86});
															thumbnails[2257771] = clik.newPhoto({"id":2257771,"src":"logo1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":91});
															thumbnails[2257841] = clik.newPhoto({"id":2257841,"src":"Kapell_190_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":273});
															thumbnails[2310487] = clik.newPhoto({"id":2310487,"src":"_MG_3791_21_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":205});
															thumbnails[2788629] = clik.newPhoto({"id":2788629,"src":"_MG_5481_246_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":195});
															thumbnails[3043568] = clik.newPhoto({"id":3043568,"src":"Adventsboka08_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":92});
															thumbnails[3987274] = clik.newPhoto({"id":3987274,"src":"Aktuelt_75_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":54});
															thumbnails[8600884] = clik.newPhoto({"id":8600884,"src":"20090107-IMG_0770_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":169});
															thumbnails[8600903] = clik.newPhoto({"id":8600903,"src":"_MG_3779_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":175});
															thumbnails[8600904] = clik.newPhoto({"id":8600904,"src":"_MG_3800_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":195});
															thumbnails[2307690] = clik.newPhoto({"id":2307690,"src":"_MG_3783_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2307690.html","width":130,"caption":"","height":87});
															thumbnails[2307692] = clik.newPhoto({"id":2307692,"src":"_MG_3796_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2307692.html","width":130,"caption":"","height":87});
															thumbnails[2307698] = clik.newPhoto({"id":2307698,"src":"_MG_4570_2_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_2307698.html","width":130,"caption":"","height":87});
															thumbnails[2307699] = clik.newPhoto({"id":2307699,"src":"_MG_4576_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_2307699.html","width":130,"caption":"","height":87});
															thumbnails[2788578] = clik.newPhoto({"id":2788578,"src":"_MG_5470_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_2788578.html","width":130,"caption":"","height":87});
															thumbnails[2788582] = clik.newPhoto({"id":2788582,"src":"_MG_5477_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_2788582.html","width":130,"caption":"","height":87});
															thumbnails[2788591] = clik.newPhoto({"id":2788591,"src":"_MG_5479_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2788591.html","width":130,"caption":"","height":87});
															thumbnails[2788594] = clik.newPhoto({"id":2788594,"src":"_MG_5486_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2788594.html","width":130,"caption":"","height":87});
															thumbnails[2788597] = clik.newPhoto({"id":2788597,"src":"_MG_5498_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2788597.html","width":130,"caption":"","height":87});
															thumbnails[4131653] = clik.newPhoto({"id":4131653,"src":"20090621-_MG_6890_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_4131653.html","width":130,"caption":"","height":87});
															thumbnails[4131660] = clik.newPhoto({"id":4131660,"src":"20090621-_MG_6881_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_4131660.html","width":130,"caption":"","height":87});
															thumbnails[4131585] = clik.newPhoto({"id":4131585,"src":"20090621-_MG_6920_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131585.html","width":130,"caption":"","height":195});
															thumbnails[4131645] = clik.newPhoto({"id":4131645,"src":"20090621-_MG_6904_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131645.html","width":130,"caption":"","height":195});
															thumbnails[4131642] = clik.newPhoto({"id":4131642,"src":"20090621-_MG_6913_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131642.html","width":130,"caption":"","height":195});
															thumbnails[4131656] = clik.newPhoto({"id":4131656,"src":"20090621-_MG_6888_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131656.html","width":130,"caption":"","height":87});
															thumbnails[4131649] = clik.newPhoto({"id":4131649,"src":"20090621-_MG_6901_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131649.html","width":130,"caption":"","height":87});
															thumbnails[2788598] = clik.newPhoto({"id":2788598,"src":"_MG_5504_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_2788598.html","width":130,"caption":"","height":87});
															thumbnails[4131646] = clik.newPhoto({"id":4131646,"src":"20090621-_MG_6902_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131646.html","width":130,"caption":"","height":87});
															thumbnails[2788600] = clik.newPhoto({"id":2788600,"src":"_MG_5507_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_2788600.html","width":130,"caption":"","height":195});
															thumbnails[4131651] = clik.newPhoto({"id":4131651,"src":"20090621-_MG_6900_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131651.html","width":130,"caption":"","height":87});
															thumbnails[2788587] = clik.newPhoto({"id":2788587,"src":"_MG_5474_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_2788587.html","width":130,"caption":"","height":195});
															thumbnails[4131639] = clik.newPhoto({"id":4131639,"src":"20090621-_MG_6917_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131639.html","width":130,"caption":"","height":87});
															thumbnails[4131640] = clik.newPhoto({"id":4131640,"src":"20090621-_MG_6915_thumb.jpg","galleries_id":247372,"server_id":32,"link":"photo_4131640.html","width":130,"caption":"","height":87});
															thumbnails[4131662] = clik.newPhoto({"id":4131662,"src":"20090621-_MG_6875_thumb.jpg","galleries_id":150958,"server_id":32,"link":"photo_4131662.html","width":130,"caption":"","height":195});
															thumbnails[2307701] = clik.newPhoto({"id":2307701,"src":"_MG_4581_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2307701.html","width":130,"caption":"","height":195});
															thumbnails[2788595] = clik.newPhoto({"id":2788595,"src":"_MG_5490_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2788595.html","width":130,"caption":"","height":195});
															thumbnails[4131652] = clik.newPhoto({"id":4131652,"src":"20090621-_MG_6898_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_4131652.html","width":130,"caption":"","height":195});
															thumbnails[2310461] = clik.newPhoto({"id":2310461,"src":"Kapellet_st_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_2310461.html","width":130,"caption":"","height":76});
															thumbnails[5373676] = clik.newPhoto({"id":5373676,"src":"Aakerlehaugen_IMG_0762_thumb.jpg","galleries_id":150959,"server_id":32,"link":"photo_5373676.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[247372] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Hagen","link":"gallery_247372.html","maxRecords":0.0,"photoIDs":[4131585.0,4131645.0,4131642.0,4131656.0,4131649.0,4131646.0,4131651.0,4131639.0,4131640.0],"skipIndex":0,"section_code":"gallery","featured_images":"4131656,4131651,4131649,4131646,4131645,4131642,4131640,4131639,4131585","id":247372,"singleSection":false});				  						galleries[150959] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Kapellet","link":"gallery_150959.html","maxRecords":0.0,"photoIDs":[2307690.0,2307692.0,2788591.0,2788594.0,2788597.0,4131660.0,2307701.0,2788595.0,4131652.0,2310461.0,5373676.0],"skipIndex":0,"section_code":"gallery","featured_images":"5373676,4131660,4131652,2788597,2788595,2788594,2788591,2310461,2307701,2307692","id":150959,"singleSection":false});				  						galleries[150958] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Hovedhuset","link":"gallery_150958.html","maxRecords":0.0,"photoIDs":[2307698.0,2307699.0,2788578.0,2788582.0,4131653.0,2788598.0,2788600.0,2788587.0,4131662.0],"skipIndex":0,"section_code":"gallery","featured_images":"4131662,4131653,2788600,2788598,2788587,2788582,2788578,2307699,2307698","id":150958,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8600904,8600903,8600884,4131585,4131662,2307701,2788595';
imageSets[2] = '3043568';
imageSets[3] = '8600904,8600903,8600884,5373676,4131662,4131660,4131656,4131653,4131652,4131651,4131649,4131646,4131645,4131642,4131640,4131639,4131585,3987274,3043568,2788629,2788600,2788598,2788597,2788595,2788594,2788591,2788587,2788582,2788578,2310487,2310461,2307701,2307699,2307698,2307692,2307690,2257841,2257771,2234290';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Akerlehaugen/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Akerlehaugen/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 = 'ÅKERLEHAUGEN: ' + 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('Varen er lagt i handlekurven').show();}
				else{
					$('#paymentConfirm', root).text('Varen er lagt i handlekurven').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> kr ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="salg@naturfotografi.no">';
					temp += '<input type="hidden" name="currency_code" value="NOK">';
					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=\"Kjøp\" 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="salg@naturfotografi.no">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"Handlekurv\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

