window.thumbnails = new Object();
												thumbnails[7220788] = new thumbnail(7220788,'','view','ISG_50268_thumb.jpg',160, 106,18,'							photo_7220788.html');
												thumbnails[7224121] = new thumbnail(7224121,'390257','Kajsa','ISG_1971_thumb.jpg',160, 241,18,'							photo_7224121.html');
												thumbnails[7224123] = new thumbnail(7224123,'390257','Kajsa','ISG_1972_thumb.jpg',160, 106,18,'							photo_7224123.html');
												thumbnails[7224124] = new thumbnail(7224124,'390257','Kajsa','ISG_1973_thumb.jpg',160, 106,18,'							photo_7224124.html');
												thumbnails[7224127] = new thumbnail(7224127,'390257','Kajsa','ISG_1974_thumb.jpg',160, 106,18,'							photo_7224127.html');
												thumbnails[7224128] = new thumbnail(7224128,'390257','Kajsa','ISG_1980_thumb.jpg',160, 106,18,'							photo_7224128.html');
												thumbnails[7224129] = new thumbnail(7224129,'390257','Kajsa','ISG_1990_thumb.jpg',160, 106,18,'							photo_7224129.html');
												thumbnails[7224166] = new thumbnail(7224166,'390104','','ISG_50123_thumb.jpg',160, 106,18,'							photo_7224166.html');
												thumbnails[7224168] = new thumbnail(7224168,'390104','','ISG_5018_thumb.jpg',160, 241,18,'							photo_7224168.html');
												thumbnails[7224171] = new thumbnail(7224171,'390104','','ISG_5019_thumb.jpg',160, 241,18,'							photo_7224171.html');
												thumbnails[7224172] = new thumbnail(7224172,'390104','','ISG_5021_thumb.jpg',160, 106,18,'							photo_7224172.html');
												thumbnails[7224173] = new thumbnail(7224173,'390104','','ISG_50269_thumb.jpg',160, 106,18,'							photo_7224173.html');
												thumbnails[7224174] = new thumbnail(7224174,'390104','','ISG_5028_thumb.jpg',160, 241,18,'							photo_7224174.html');
												thumbnails[7224175] = new thumbnail(7224175,'390104','','ISG_5041_thumb.jpg',160, 106,18,'							photo_7224175.html');
												thumbnails[7224177] = new thumbnail(7224177,'390104','','ISG_50431_thumb.jpg',160, 241,18,'							photo_7224177.html');
												thumbnails[7224178] = new thumbnail(7224178,'390104','','ISG_5058_thumb.jpg',160, 235,18,'							photo_7224178.html');
												thumbnails[7224179] = new thumbnail(7224179,'390104','','ISG_5072_thumb.jpg',160, 241,18,'							photo_7224179.html');
												thumbnails[7224180] = new thumbnail(7224180,'390104','','ISG_5095_thumb.jpg',160, 106,18,'							photo_7224180.html');
												thumbnails[7224181] = new thumbnail(7224181,'390104','','ISG_5130_thumb.jpg',160, 241,18,'							photo_7224181.html');
												thumbnails[7224182] = new thumbnail(7224182,'390104','','ISG_5139_thumb.jpg',160, 237,18,'							photo_7224182.html');
												thumbnails[7224183] = new thumbnail(7224183,'390104','','ISG_5144_thumb.jpg',160, 106,18,'							photo_7224183.html');
												thumbnails[7224184] = new thumbnail(7224184,'390104','','ISG_5153_thumb.jpg',160, 241,18,'							photo_7224184.html');
												thumbnails[7224797] = new thumbnail(7224797,'390218','Angry looks','KOL_0717_thumb.jpg',160, 241,18,'							photo_7224797.html');
												thumbnails[7224830] = new thumbnail(7224830,'390218','Keep away','KOL_0699_thumb.jpg',160, 241,18,'							photo_7224830.html');
												thumbnails[7224860] = new thumbnail(7224860,'390218','Great suck','KOL_0639_thumb.jpg',160, 106,18,'							photo_7224860.html');
												thumbnails[7226393] = new thumbnail(7226393,'390218','Good balance','KOL_1764_3_thumb.jpg',160, 106,18,'							photo_7226393.html');
												thumbnails[7226394] = new thumbnail(7226394,'390218','Good balance','KOL_1764_2_thumb.jpg',160, 106,18,'							photo_7226394.html');
												thumbnails[7226396] = new thumbnail(7226396,'390218','Check me out','KOL_1696_thumb.jpg',160, 241,18,'							photo_7226396.html');
												thumbnails[7226412] = new thumbnail(7226412,'390220','Easy','KOL_0510_thumb.jpg',160, 241,18,'							photo_7226412.html');
												thumbnails[7226413] = new thumbnail(7226413,'390220','Standby','KOL_0514_thumb.jpg',160, 106,18,'							photo_7226413.html');
												thumbnails[7226414] = new thumbnail(7226414,'390220','Wait up','KOL_0520_thumb.jpg',160, 106,18,'							photo_7226414.html');
												thumbnails[7226416] = new thumbnail(7226416,'390220','Spread \'em','KOL_0743_thumb.jpg',160, 106,18,'							photo_7226416.html');
												thumbnails[7228247] = new thumbnail(7228247,'390102','Castle walk','ISG_46811_thumb.jpg',160, 241,18,'							photo_7228247.html');
												thumbnails[7228300] = new thumbnail(7228300,'390102','View','ISG_46921_thumb.jpg',160, 106,18,'							photo_7228300.html');
												thumbnails[7228328] = new thumbnail(7228328,'390102','Mirror','ISG_4695_thumb.jpg',160, 241,18,'							photo_7228328.html');
												thumbnails[7228332] = new thumbnail(7228332,'390102','Reflect me','ISG_4713_thumb.jpg',160, 241,18,'							photo_7228332.html');
												thumbnails[7228334] = new thumbnail(7228334,'390102','Reflection','ISG_4714_thumb.jpg',160, 241,18,'							photo_7228334.html');
												thumbnails[7228340] = new thumbnail(7228340,'390102','Wide','ISG_4741_thumb.jpg',160, 106,18,'							photo_7228340.html');
												thumbnails[7228341] = new thumbnail(7228341,'390102','Sunset','ISG_4751_thumb.jpg',160, 106,18,'							photo_7228341.html');
												thumbnails[7228360] = new thumbnail(7228360,'390187','The thing','ISG_0866_thumb.jpg',160, 106,18,'							photo_7228360.html');
												thumbnails[7228361] = new thumbnail(7228361,'390187','Sky high','ISG_0882_thumb.jpg',160, 241,18,'							photo_7228361.html');
												thumbnails[7228362] = new thumbnail(7228362,'390187','Sky high II','ISG_0903_thumb.jpg',160, 241,18,'							photo_7228362.html');
												thumbnails[7228363] = new thumbnail(7228363,'390187','\"high\"way','ISG_0896_thumb.jpg',160, 241,18,'							photo_7228363.html');
												thumbnails[7228364] = new thumbnail(7228364,'390187','...','ISG_0911_thumb.jpg',160, 241,18,'							photo_7228364.html');
												thumbnails[7228365] = new thumbnail(7228365,'390187','\"high\"way II','ISG_0919_thumb.jpg',160, 239,18,'							photo_7228365.html');
												thumbnails[7228538] = new thumbnail(7228538,'390504','Ice cold','ISG_4882_thumb.jpg',160, 241,18,'							photo_7228538.html');
												thumbnails[7228579] = new thumbnail(7228579,'390504','Yellow snow','ISG_48951_thumb.jpg',160, 241,18,'							photo_7228579.html');
												thumbnails[7228592] = new thumbnail(7228592,'390504','Look up','ISG_4987_thumb.jpg',160, 106,18,'							photo_7228592.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[390190] = new gallery(390190,'7226413,7224129','Animals','gallery',[],0, 1, '', '																																																																																																							gallery_390190.html',0,0);
				  					galleries[390220] = new gallery(390220,'7226413','Bugs','gallery',[7226412,7226413,7226414,7226416],0, 1, '390190', '																																																																																																							gallery_390220.html',0,0);
				  					galleries[390504] = new gallery(390504,'7228592,7228579,7228538','Cold Cold Country','gallery',[7228538,7228579,7228592],0, 1, '390059', '																																																																																																							gallery_390504.html',0,0);
				  					galleries[390102] = new gallery(390102,'7228340','Hammershus, Bornholm','gallery',[7228247,7228300,7228328,7228332,7228334,7228340,7228341],0, 1, '390059', '																																																																																																							gallery_390102.html',0,0);
				  					galleries[390257] = new gallery(390257,'7224129','Kajsa','gallery',[7224121,7224123,7224124,7224127,7224128,7224129],0, 1, '390190', '																																																																																																							gallery_390257.html',0,0);
				  					galleries[390218] = new gallery(390218,'7224797','Macro','gallery',[7224797,7224830,7224860,7226393,7226394,7226396],0, 1, '', '																																																																																																							gallery_390218.html',0,0);
				  					galleries[390104] = new gallery(390104,'7224180,7224166','Reersų, sealand','gallery',[7224166,7224168,7224171,7224172,7224173,7224174,7224175,7224177,7224178,7224179,7224180,7224181,7224182,7224183,7224184],0, 1, '390059', '																																																																																																							gallery_390104.html',0,0);
				  					galleries[390059] = new gallery(390059,'7228364,7228340,7224180,7224166','Scapes','gallery',[],0, 1, '', '																																																																																																							gallery_390059.html',0,0);
				  					galleries[390187] = new gallery(390187,'7228364','The Bridge, Great Belt','gallery',[7228360,7228361,7228362,7228363,7228364,7228365],0, 1, '390059', '																																																																																																							gallery_390187.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7228341,7224180,7224172,7224166';
imageSets[2] = '7228364,7228340,7226413,7224797,7224180,7224166,7224129';
imageSets[3] = '7220788';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/islotgallery/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/islotgallery/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));		}, 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 = 'islot gallery: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      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));    }        
    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 = 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> 				&euro;' + (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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = 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 = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="currency_code" value="EUR">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							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;
	}
}

			

