window.thumbnails = {};
thumbnails[8576748] = clik.newPhoto({"link":"#","caption":"nostalgic expression","height":87,"id":8576748,"server_id":21,"src":"nostalgic_thumb.jpg","galleries_id":"","width":130});
thumbnails[8577564] = clik.newPhoto({"link":"#","caption":"In focus","height":87,"id":8577564,"server_id":21,"src":"IndianWedding16_thumb.jpg","galleries_id":"","width":130});
thumbnails[8565767] = clik.newPhoto({"link":"photo_8565767.html","caption":"Burning Desire","height":195,"id":8565767,"server_id":21,"src":"_DSC0986_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8565769] = clik.newPhoto({"link":"photo_8565769.html","caption":"Colorful Wonders","height":87,"id":8565769,"server_id":21,"src":"_DSC1016_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8565775] = clik.newPhoto({"link":"photo_8565775.html","caption":"I have a Dream","height":172,"id":8565775,"server_id":21,"src":"_DSC1091_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8565778] = clik.newPhoto({"link":"photo_8565778.html","caption":"Masks that people wear","height":87,"id":8565778,"server_id":21,"src":"_DSC2336_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8565780] = clik.newPhoto({"link":"photo_8565780.html","caption":"Passion","height":195,"id":8565780,"server_id":21,"src":"_DSC3039_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8565784] = clik.newPhoto({"link":"photo_8565784.html","caption":"ME","height":195,"id":8565784,"server_id":21,"src":"sameep4_thumb.jpg","galleries_id":452755,"width":130});
thumbnails[8565785] = clik.newPhoto({"link":"photo_8565785.html","caption":"In the Sun","height":87,"id":8565785,"server_id":21,"src":"sameep8_thumb.jpg","galleries_id":452755,"width":130});
thumbnails[8566098] = clik.newPhoto({"link":"photo_8566098.html","caption":"Majestic","height":87,"id":8566098,"server_id":21,"src":"_DSC1336_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8566105] = clik.newPhoto({"link":"photo_8566105.html","caption":"Pillars of Peace","height":87,"id":8566105,"server_id":21,"src":"_DSC1693_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8567366] = clik.newPhoto({"link":"photo_8567366.html","caption":"Peace","height":87,"id":8567366,"server_id":21,"src":"_DSC1397_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8567371] = clik.newPhoto({"link":"photo_8567371.html","caption":"Golden Hour","height":87,"id":8567371,"server_id":21,"src":"_DSC3085_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8571368] = clik.newPhoto({"link":"photo_8571368.html","caption":"Attitude","height":195,"id":8571368,"server_id":21,"src":"_DSC2085_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8571546] = clik.newPhoto({"link":"photo_8571546.html","caption":"Free Flight","height":87,"id":8571546,"server_id":21,"src":"_DSC1099_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8571550] = clik.newPhoto({"link":"photo_8571550.html","caption":"Green choices","height":186,"id":8571550,"server_id":21,"src":"_DSC0729_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8571557] = clik.newPhoto({"link":"photo_8571557.html","caption":"Someone stands out?","height":87,"id":8571557,"server_id":21,"src":"_DSC2556_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8571561] = clik.newPhoto({"link":"photo_8571561.html","caption":"FreeFlight","height":87,"id":8571561,"server_id":21,"src":"_DSC3336_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8571776] = clik.newPhoto({"link":"photo_8571776.html","caption":"Boating out","height":87,"id":8571776,"server_id":21,"src":"_DSC2563_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8571789] = clik.newPhoto({"link":"photo_8571789.html","caption":"Masked Smiles","height":87,"id":8571789,"server_id":21,"src":"dsc_thumb.jpg","galleries_id":452752,"width":130});
thumbnails[8571794] = clik.newPhoto({"link":"photo_8571794.html","caption":"Shy Music","height":195,"id":8571794,"server_id":21,"src":"_DSC3031_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8577545] = clik.newPhoto({"link":"photo_8577545.html","caption":"Calm","height":87,"id":8577545,"server_id":21,"src":"IndianWedding01_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577546] = clik.newPhoto({"link":"photo_8577546.html","caption":"Mother Love","height":195,"id":8577546,"server_id":21,"src":"IndianWedding02_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577549] = clik.newPhoto({"link":"photo_8577549.html","caption":"Twinkle of my Eye","height":87,"id":8577549,"server_id":21,"src":"IndianWedding03_thumb.jpg","galleries_id":452755,"width":130});
thumbnails[8577551] = clik.newPhoto({"link":"photo_8577551.html","caption":"A child gives birth to a Mother","height":87,"id":8577551,"server_id":21,"src":"IndianWedding04_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577552] = clik.newPhoto({"link":"photo_8577552.html","caption":"Bridegroom and small bridegroom","height":195,"id":8577552,"server_id":21,"src":"IndianWedding07_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577556] = clik.newPhoto({"link":"photo_8577556.html","caption":"Overflow of Happiness","height":195,"id":8577556,"server_id":21,"src":"IndianWedding09_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577559] = clik.newPhoto({"link":"photo_8577559.html","caption":"Smiles, smiles and Smiles","height":87,"id":8577559,"server_id":21,"src":"IndianWedding14_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577562] = clik.newPhoto({"link":"photo_8577562.html","caption":"Second Bridegroom ","height":87,"id":8577562,"server_id":21,"src":"IndianWedding15_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577567] = clik.newPhoto({"link":"photo_8577567.html","caption":"Blessed Families","height":195,"id":8577567,"server_id":21,"src":"IndianWedding21_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8577570] = clik.newPhoto({"link":"photo_8577570.html","caption":"Looking at ME?","height":87,"id":8577570,"server_id":21,"src":"IndianWedding25_thumb.jpg","galleries_id":453468,"width":130});
thumbnails[8604816] = clik.newPhoto({"link":"photo_8604816.html","caption":"Clothes that People Wear","height":87,"id":8604816,"server_id":21,"src":"1_thumb.jpg","galleries_id":454943,"width":130});
thumbnails[8604818] = clik.newPhoto({"link":"photo_8604818.html","caption":"Perfection?","height":87,"id":8604818,"server_id":21,"src":"2_thumb.jpg","galleries_id":454943,"width":130});
thumbnails[8604819] = clik.newPhoto({"link":"photo_8604819.html","caption":"Yarn ","height":87,"id":8604819,"server_id":21,"src":"3_thumb.jpg","galleries_id":454943,"width":130});
thumbnails[8613463] = clik.newPhoto({"link":"photo_8613463.html","caption":"Are we done?","height":156,"id":8613463,"server_id":21,"src":"_DSC0994_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8613464] = clik.newPhoto({"link":"photo_8613464.html","caption":"I got the Look","height":195,"id":8613464,"server_id":21,"src":"_DSC2924_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8613465] = clik.newPhoto({"link":"photo_8613465.html","caption":"Are we shy?","height":195,"id":8613465,"server_id":21,"src":"_DSC3050_thumb.jpg","galleries_id":452751,"width":130});
thumbnails[8883175] = clik.newPhoto({"link":"photo_8883175.html","caption":"","height":195,"id":8883175,"server_id":21,"src":"guitar2_thumb.jpg","galleries_id":467212,"width":130});
thumbnails[8883176] = clik.newPhoto({"link":"photo_8883176.html","caption":"PieBoy Scarf","height":87,"id":8883176,"server_id":21,"src":"PASSION_thumb.jpg","galleries_id":467212,"width":130});
thumbnails[8883177] = clik.newPhoto({"link":"photo_8883177.html","caption":"PieBoy Bags","height":87,"id":8883177,"server_id":21,"src":"PIEBOY01_thumb.jpg","galleries_id":467212,"width":130});
thumbnails[8883178] = clik.newPhoto({"link":"photo_8883178.html","caption":"Concepts","height":87,"id":8883178,"server_id":21,"src":"PIEBOY05-2_thumb.jpg","galleries_id":467212,"width":130});
thumbnails[8883179] = clik.newPhoto({"link":"photo_8883179.html","caption":"","height":87,"id":8883179,"server_id":21,"src":"PIEBOY07_thumb.jpg","galleries_id":467212,"width":130});
thumbnails[8883180] = clik.newPhoto({"link":"photo_8883180.html","caption":"Brand Endorsement","height":195,"id":8883180,"server_id":21,"src":"PIEBOY-SQUASH06_thumb.jpg","galleries_id":467212,"width":130});
thumbnails[8577557] = clik.newPhoto({"link":"photo_8577557.html","caption":"God-ly Smile ","height":87,"id":8577557,"server_id":21,"src":"IndianWedding13_thumb.jpg","galleries_id":453468,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[452755] = clik.newGallery({"photoIDs":[8565784,8565785,8577549],"link":"gallery_452755.html","skipIndex":0,"section_code":"gallery","id":452755,"parentGallery":"","featured_images":"8565785,8565784","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Archit Sureka"});galleries[467212] = clik.newGallery({"photoIDs":[8883175,8883176,8883177,8883178,8883179,8883180],"link":"gallery_467212.html","skipIndex":0,"section_code":"gallery","id":467212,"parentGallery":"","featured_images":"8883180,8883178,8883177,8883176,8883175","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Commercial Photography"});galleries[453468] = clik.newGallery({"photoIDs":[8577545,8577546,8577551,8577552,8577556,8577559,8577562,8577567,8577570,8577557],"link":"gallery_453468.html","skipIndex":0,"section_code":"gallery","id":453468,"parentGallery":"","featured_images":8577570,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"Great Indian Wedding"});galleries[454943] = clik.newGallery({"photoIDs":[8604816,8604818,8604819],"link":"gallery_454943.html","skipIndex":0,"section_code":"gallery","id":454943,"parentGallery":"","featured_images":"8604819,8604818,8604816","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Industrial Profile"});galleries[452751] = clik.newGallery({"photoIDs":[8565767,8565769,8565775,8565778,8565780,8571368,8571794,8613463,8613464,8613465],"link":"gallery_452751.html","skipIndex":0,"section_code":"gallery","id":452751,"parentGallery":"","featured_images":"8613465,8613464,8613463,8571794,8571368,8565780,8565778,8565775,8565769,8565767","maxRecords":0,"usePopups":true,"singleSection":false,"title":"Portraits "});galleries[452752] = clik.newGallery({"photoIDs":[8566098,8566105,8567366,8567371,8571546,8571550,8571557,8571561,8571776,8571789],"link":"gallery_452752.html","skipIndex":0,"section_code":"gallery","id":452752,"parentGallery":"","featured_images":8566105,"maxRecords":0,"usePopups":true,"singleSection":false,"title":"Places"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '8883180,8604819,8571789,8571776,8571561,8571557,8571550,8571546,8567371,8567366,8566105,8566098,8565785,8565784,8565780,8565778';
imageSets[2] = '8883180,8883178,8883177,8883176,8883175,8577570,8566105,8565785,8565784';
imageSets[1] = '8883180,8883179,8883178,8883177,8883176,8883175,8613465,8613464,8604819,8577570,8577562,8577559,8577551,8576748,8571557,8566105,8566098,8565775,8565769,8565767,8577557';
imageSets[245433] = '8565784';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/archit/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/archit/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/archit/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/archit/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/archit/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/archit/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/archit/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/archit/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 = 'Nostalgic Expressions: ' + 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;
	}
}

		

