window.thumbnails = new Object();
												thumbnails[7851008] = new thumbnail(7851008,'','','Anette_thumb.jpg',105, 160,15,'#');
												thumbnails[7910127] = new thumbnail(7910127,'','Andrea','Andrea1HomeP_thumb.jpg',100, 100,15,'#');
												thumbnails[5765517] = new thumbnail(5765517,'423641','Lene','Lene_thumb.jpg',160, 160,15,'photo_5765517.html');
												thumbnails[5765622] = new thumbnail(5765622,'423638','','Porselen_1_thumb.jpg',100, 100,15,'photo_5765622.html');
												thumbnails[5765674] = new thumbnail(5765674,'222919','','TYW1_thumb.jpg',130, 130,15,'photo_5765674.html');
												thumbnails[5765861] = new thumbnail(5765861,'423634','','TYW5_thumb.jpg',100, 100,15,'photo_5765861.html');
												thumbnails[5766644] = new thumbnail(5766644,'224797','','Linn_thumb.jpg',130, 130,15,'photo_5766644.html');
												thumbnails[7849077] = new thumbnail(7849077,'423632','Andrea','Andrea1_thumb.jpg',100, 100,15,'photo_7849077.html');
												thumbnails[7849534] = new thumbnail(7849534,'423633','Amanda','Amanda3_thumb.jpg',100, 100,15,'photo_7849534.html');
												thumbnails[7849753] = new thumbnail(7849753,'423630','Birk Banden','Birk-Banden11_thumb.jpg',100, 100,15,'photo_7849753.html');
												thumbnails[7852562] = new thumbnail(7852562,'224796','Glasskjellaren','GlasskjellarenBirgit2_thumb.jpg',100, 100,15,'photo_7852562.html');
												thumbnails[5765528] = new thumbnail(5765528,'423641','Lene','Lene2_thumb.jpg',160, 160,15,'photo_5765528.html');
												thumbnails[5765624] = new thumbnail(5765624,'423638','','Porselen_2_thumb.jpg',100, 100,15,'photo_5765624.html');
												thumbnails[5765677] = new thumbnail(5765677,'222919','','TYW2_thumb.jpg',130, 130,15,'photo_5765677.html');
												thumbnails[5765866] = new thumbnail(5765866,'423634','','TYW4_thumb.jpg',100, 100,15,'photo_5765866.html');
												thumbnails[5766639] = new thumbnail(5766639,'423633','Amanda','Amanda2_thumb.jpg',100, 100,15,'photo_5766639.html');
												thumbnails[5766643] = new thumbnail(5766643,'224797','','Fredrick_thumb.jpg',130, 130,15,'photo_5766643.html');
												thumbnails[7849080] = new thumbnail(7849080,'423632','Andrea','Andrea2_thumb.jpg',100, 100,15,'photo_7849080.html');
												thumbnails[7849650] = new thumbnail(7849650,'423630','Birk Banden','Birk-Banden2123_thumb.jpg',100, 100,15,'photo_7849650.html');
												thumbnails[7852565] = new thumbnail(7852565,'224796','Glasskjellaren','GlasskjellarenKors_thumb.jpg',100, 100,15,'photo_7852565.html');
												thumbnails[5765531] = new thumbnail(5765531,'423641','','Lene3_thumb.jpg',130, 130,15,'photo_5765531.html');
												thumbnails[5765627] = new thumbnail(5765627,'423638','','Porselen_3_thumb.jpg',100, 100,15,'photo_5765627.html');
												thumbnails[5765678] = new thumbnail(5765678,'222919','','TYW3_thumb.jpg',130, 130,15,'photo_5765678.html');
												thumbnails[5766640] = new thumbnail(5766640,'224797','','Cash_thumb.jpg',130, 130,15,'photo_5766640.html');
												thumbnails[7849084] = new thumbnail(7849084,'423632','Andrea','Andrea3_thumb.jpg',100, 100,15,'photo_7849084.html');
												thumbnails[7852567] = new thumbnail(7852567,'224796','Glasskjellaren','GlasskjellarenBirgit_thumb.jpg',100, 100,15,'photo_7852567.html');
												thumbnails[7852407] = new thumbnail(7852407,'423632','','Andrea6_thumb.jpg',100, 100,15,'photo_7852407.html');
												thumbnails[5766646] = new thumbnail(5766646,'226444','','Personal2_thumb.jpg',100, 100,15,'photo_5766646.html');
												thumbnails[7852431] = new thumbnail(7852431,'423632','','Andrea7_thumb.jpg',100, 100,15,'photo_7852431.html');
												thumbnails[5766655] = new thumbnail(5766655,'224797','','Sukkerferdig2_thumb.jpg',130, 130,15,'photo_5766655.html');
												thumbnails[4030837] = new thumbnail(4030837,'226444','','Collage_thumb.jpg',160, 160,15,'photo_4030837.html');
												thumbnails[5766641] = new thumbnail(5766641,'224797','','Feet3_thumb.jpg',130, 130,15,'photo_5766641.html');
												thumbnails[7852433] = new thumbnail(7852433,'423632','Andrea','Andrea5_thumb.jpg',100, 100,15,'photo_7852433.html');
												thumbnails[7852434] = new thumbnail(7852434,'423632','Andrea','Andrea4_thumb.jpg',100, 100,15,'photo_7852434.html');
												thumbnails[5912041] = new thumbnail(5912041,'271518','','Glass_2_thumb.jpg',100, 100,15,'photo_5912041.html');
												thumbnails[5912049] = new thumbnail(5912049,'271518','','Sommerfugler_2_thumb.jpg',100, 100,15,'photo_5912049.html');
												thumbnails[5912053] = new thumbnail(5912053,'271518','','Sommerfugler_thumb.jpg',100, 100,15,'photo_5912053.html');
												thumbnails[5912120] = new thumbnail(5912120,'271518','','Glassfat_thumb.jpg',100, 100,15,'photo_5912120.html');
												thumbnails[5912131] = new thumbnail(5912131,'271518','','BeigeKrakkelertSommerfugl_thumb.jpg',100, 100,15,'photo_5912131.html');
												thumbnails[5968561] = new thumbnail(5968561,'271518','','Powderblue_thumb.jpg',130, 130,15,'photo_5968561.html');
												thumbnails[5968578] = new thumbnail(5968578,'271518','','WhiteVase_thumb.jpg',100, 100,15,'photo_5968578.html');
												thumbnails[5968581] = new thumbnail(5968581,'271518','','VaseMintGreen_thumb.jpg',100, 100,15,'photo_5968581.html');
												thumbnails[5968708] = new thumbnail(5968708,'271518','','CloseupCrackle_thumb.jpg',100, 100,15,'photo_5968708.html');
												thumbnails[5968718] = new thumbnail(5968718,'271518','','Crackle2_thumb.jpg',100, 100,15,'photo_5968718.html');
												thumbnails[5970788] = new thumbnail(5970788,'271518','','IMG_6618_thumb.jpg',100, 100,15,'photo_5970788.html');
												thumbnails[5971137] = new thumbnail(5971137,'271518','','Blaanyanser_thumb.jpg',130, 130,15,'photo_5971137.html');
												thumbnails[5761256] = new thumbnail(5761256,'271518','','Vase_thumb.jpg',100, 100,15,'photo_5761256.html');
												thumbnails[5761440] = new thumbnail(5761440,'271518','','VaseCloseUp_thumb.jpg',130, 130,15,'photo_5761440.html');
												thumbnails[5761360] = new thumbnail(5761360,'271518','','Crackle_thumb.jpg',130, 130,15,'photo_5761360.html');
												thumbnails[5761438] = new thumbnail(5761438,'271518','','Crackle3_thumb.jpg',130, 130,15,'photo_5761438.html');
												thumbnails[5761439] = new thumbnail(5761439,'271518','','Crackle4_thumb.jpg',130, 130,15,'photo_5761439.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[423638] = new gallery(423638,'5765627,5765624,5765622','2009','gallery',[5765622,5765624,5765627],0, 1, '', 'gallery_423638.html',0,0);
				  					galleries[423633] = new gallery(423633,'7849534,5766639','Amanda','gallery',[7849534,5766639],0, 1, '', 'gallery_423633.html',0,0);
				  					galleries[423632] = new gallery(423632,'7849077','Andrea','gallery',[7849077,7849080,7849084,7852407,7852431,7852433,7852434],0, 1, '', 'gallery_423632.html',0,0);
				  					galleries[423630] = new gallery(423630,'7849753,7849650','Birk Banden','gallery',[7849753,7849650],0, 1, '', 'gallery_423630.html',0,0);
				  					galleries[423634] = new gallery(423634,'5765866,5765861','Elin','gallery',[5765861,5765866],0, 1, '', 'gallery_423634.html',0,0);
				  					galleries[271518] = new gallery(271518,'5971137,5970788,5968718,5968708,5968581,5968578,5968561,5912131,5912120,5912053','Fusing','section275234',[5912041,5912049,5912053,5912120,5912131,5968561,5968578,5968581,5968708,5968718,5970788,5971137,5761256,5761440,5761360,5761438,5761439],0, 1, '', 'section275234.html',0,1);
				  					galleries[423641] = new gallery(423641,'5765531,5765528,5765517','Lene','gallery',[5765517,5765528,5765531],0, 1, '', 'gallery_423641.html',0,0);
				  					galleries[222919] = new gallery(222919,'5765678','The Yellow Wallpaper','gallery',[5765674,5765677,5765678],0, 1, '', 'gallery_222919.html',0,0);
				  					galleries[224797] = new gallery(224797,'5766655,5766644,5766643,5766641,5766640','Sweet Seduction','gallery',[5766644,5766643,5766640,5766655,5766641],0, 1, '', 'gallery_224797.html',0,0);
				  					galleries[224796] = new gallery(224796,'7852567,7852565,7852562','Commissions','gallery',[7852562,7852565,7852567],0, 1, '', 'gallery_224796.html',0,0);
				  					galleries[226444] = new gallery(226444,'5766646,4030837','Personal','gallery',[5766646,4030837],0, 1, '', 'gallery_226444.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[242279] = '7851008';
imageSets[1] = '7910127,5912053,5765627,5761360,5761256';
imageSets[2] = '7849077,5765678';
imageSets[3] = '7910127,7852567,7852565,7852562,7852434,7852433,7852431,7852407,7851008,7849753,7849650,7849534,7849084,7849080,7849077,5971137,5970788,5968718,5968708,5968581,5968578,5968561,5912131,5912120,5912053,5912049,5912041,5766655,5766646,5766644,5766643,5766641,5766640,5766639,5765866,5765861,5765678,5765677,5765674,5765627,5765624,5765622,5765531,5765528,5765517,5761440,5761439,5761438,5761360,5761256';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/anettevr/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/anettevr/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/anettevr/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/anettevr/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/anettevr/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/anettevr/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Anette Vadla Ravnås: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == undefined) {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

