window.thumbnails = new Object();
												thumbnails[2646996] = new thumbnail(2646996,'','Padkaart','Padkaart_thumb.jpg',130, 92,5,'#');
												thumbnails[2049429] = new thumbnail(2049429,'136748','Armmansstrand 1940s','Armmansstrand_1940s_thumb.jpg',130, 87,5,'photo_2049429.html');
												thumbnails[2049434] = new thumbnail(2049434,'136748','Pont by Schoemansdrift','Pont_Schoemansdrift_thumb.jpeg',130, 88,5,'photo_2049434.html');
												thumbnails[2052543] = new thumbnail(2052543,'137167','Gideon as Krygsgevangene','Gideon_Krygsgevangene_Groen_Punt_1901_thumb.jpg',130, 84,5,'photo_2052543.html');
												thumbnails[2641230] = new thumbnail(2641230,'136746','Van voor','kruisbessie_dek_thumb.jpg',130, 87,5,'photo_2641230.html');
												thumbnails[2646013] = new thumbnail(2646013,'136747','Van voor','Kollegerus_thumb.jpg',130, 98,5,'photo_2646013.html');
												thumbnails[6890823] = new thumbnail(6890823,'355116','Doppruim van voor','DSC_0001_thumb.jpg',130, 87,5,'photo_6890823.html');
												thumbnails[2049437] = new thumbnail(2049437,'136748','Pont Schoemansdrift','Pont_Schoemansdrift_thumb.jpg',130, 83,5,'photo_2049437.html');
												thumbnails[2052628] = new thumbnail(2052628,'137167','Koos Naudé en Jan Smuts 1902','Koos_Naude_en_Jan_Smuts_1902_thumb.jpg',130, 97,5,'photo_2052628.html');
												thumbnails[2641236] = new thumbnail(2641236,'136746','Somer','kruisbessie_somer_thumb.jpg',130, 88,5,'photo_2641236.html');
												thumbnails[2645788] = new thumbnail(2645788,'136544','Pasgebore lammetjie','Skaap_lammetjie_thumb.jpg',130, 88,5,'photo_2645788.html');
												thumbnails[3236889] = new thumbnail(3236889,'136747','Kollegerus se lapa','Kollegerus_se_lapa_thumb.jpg',130, 98,5,'photo_3236889.html');
												thumbnails[6890827] = new thumbnail(6890827,'355116','Doppruim se heerlike koeltebome vanuit die boma','DSC_0003_thumb.jpg',130, 87,5,'photo_6890827.html');
												thumbnails[2049438] = new thumbnail(2049438,'136748','Schoemanshof 1880s','Schoemanshof_1880s_thumb.jpg',130, 88,5,'photo_2049438.html');
												thumbnails[2052630] = new thumbnail(2052630,'137167','Martin Schoeman op Kommando','Martin_Schoeman_thumb.jpg',130, 87,5,'photo_2052630.html');
												thumbnails[2641305] = new thumbnail(2641305,'136746','Nog een van voor','kruisbessie_voor_thumb.jpg',130, 87,5,'photo_2641305.html');
												thumbnails[2645829] = new thumbnail(2645829,'136544','Plaas','Plaas_in_rigting_van_waenhuis_thumb.jpg',130, 88,5,'photo_2645829.html');
												thumbnails[3236890] = new thumbnail(3236890,'136747','','Kollegerus_lapa_2_thumb.jpg',130, 172,5,'photo_3236890.html');
												thumbnails[6890830] = new thumbnail(6890830,'355116','Laatmiddag by Doppruim','DSC_0014_thumb.jpg',130, 87,5,'photo_6890830.html');
												thumbnails[2049529] = new thumbnail(2049529,'136748','Schoemans Sept 1921','Familiefoto_voor_deur_van_Kelder_Sept_1921_thumb.jpg',130, 95,5,'photo_2049529.html');
												thumbnails[2049451] = new thumbnail(2049451,'136748','Ingang na Schoemanshof','Bloekom_en_oorspronklike_huis_thumb.jpg',130, 187,5,'photo_2049451.html');
												thumbnails[2052644] = new thumbnail(2052644,'137167','Kerskaartjie','Kerskaartjie_thumb.jpg',130, 192,5,'photo_2052644.html');
												thumbnails[2645533] = new thumbnail(2645533,'136746','winter','kruisbessie_winter_thumb.jpg',130, 87,5,'photo_2645533.html');
												thumbnails[2052652] = new thumbnail(2052652,'137167','Bewys van identiteit','Boereoorlog_Rooikruis_Naude_thumb.jpg',130, 97,5,'photo_2052652.html');
												thumbnails[2646017] = new thumbnail(2646017,'136746','Lugfoto','lugfoto_thumb.jpg',130, 98,5,'photo_2646017.html');
												thumbnails[2049532] = new thumbnail(2049532,'136748','Heuninghandjie','Heuninghandjie_thumb.jpg',130, 186,5,'photo_2049532.html');
												thumbnails[2646044] = new thumbnail(2646044,'136746','Kroeg','kroeg_thumb.jpg',130, 173,5,'photo_2646044.html');
												thumbnails[2646136] = new thumbnail(2646136,'136544','Vaalrivier    ','Vaalrivier_thumb.jpg',130, 98,5,'photo_2646136.html');
												thumbnails[2049543] = new thumbnail(2049543,'136748','Gideon & Susan Schoeman 1921','Gideon_en_Susan_Schoeman_Sep1921_thumb.jpg',130, 179,5,'photo_2049543.html');
												thumbnails[2646089] = new thumbnail(2646089,'136544','Lugfoto','lugfoto1_thumb.jpg',130, 74,5,'photo_2646089.html');
												thumbnails[2646689] = new thumbnail(2646689,'136544','Logo','Schoemanshof_logo_thumb.jpg',130, 93,5,'photo_2646689.html');
												thumbnails[2049552] = new thumbnail(2049552,'136748','Schoemansdrift brug','Schoemansdrift_brug_thumb.jpg',130, 80,5,'photo_2049552.html');
												thumbnails[2645763] = new thumbnail(2645763,'136544','waenhuis','Waenhuis_thumb.jpg',130, 193,5,'photo_2645763.html');
												thumbnails[2646097] = new thumbnail(2646097,'136544','Veld','veld_thumb.jpg',130, 173,5,'photo_2646097.html');
												thumbnails[2049605] = new thumbnail(2049605,'136748','Kelder 1880','Die_kelder_1880_thumb.jpg',130, 82,5,'photo_2049605.html');
												thumbnails[2049606] = new thumbnail(2049606,'136748','Kersvakansie 1940s','Na_Kersvakansie_by_Armmansstrand_1040s_thumb.jpg',130, 93,5,'photo_2049606.html');
												thumbnails[2049607] = new thumbnail(2049607,'136748','Rieme werk 1915','Oupa_Gideon_en_Kierie_1915_thumb.jpg',130, 85,5,'photo_2049607.html');
												thumbnails[2049611] = new thumbnail(2049611,'136748','Kierie kamp','Kierie_by_Ossewa_thumb.jpg',130, 87,5,'photo_2049611.html');
												thumbnails[2049649] = new thumbnail(2049649,'136748','Oorspronklike opstal 1950','Plaas_1950_thumb.jpg',130, 98,5,'photo_2049649.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[136544] = new gallery(136544,'2646689,2646136,2646097,2646089,2645829,2645788,2645763','Schoemanshof','gallery',[2645788,2645829,2646136,2646089,2646689,2645763,2646097],0, 0, '', 'gallery_136544.html',0,0);
				  					galleries[136746] = new gallery(136746,'2646044,2646017,2645533,2641305,2641236,2641230','Kruisbessie','gallery',[2641230,2641236,2641305,2645533,2646017,2646044],0, 0, '', 'gallery_136746.html',0,0);
				  					galleries[136747] = new gallery(136747,'3236890,3236889,2646013','Kollegerus','gallery',[2646013,3236889,3236890],0, 0, '', 'gallery_136747.html',0,0);
				  					galleries[355116] = new gallery(355116,'6890830,6890827,6890823','Doppruim','gallery',[6890823,6890827,6890830],0, 0, '', 'gallery_355116.html',0,0);
				  					galleries[136748] = new gallery(136748,'2049649,2049611,2049607,2049606,2049605,2049552,2049543,2049532,2049529,2049451','Die verlede','gallery',[2049429,2049434,2049437,2049438,2049529,2049451,2049532,2049543,2049552,2049605,2049606,2049607,2049611,2049649],0, 0, '', 'gallery_136748.html',0,0);
				  					galleries[137167] = new gallery(137167,'2052652,2052644,2052630,2052628,2052543','Boereoorlog','gallery',[2052543,2052628,2052630,2052644,2052652],0, 0, '', 'gallery_137167.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '3236890,3236889,2645829,2645763,2641236,2641230';
imageSets[3] = '6890830,6890827,6890823,3236890,3236889,2646996,2646689,2646136,2646097,2646089,2646044,2646017,2646013,2645829,2645788,2645763,2645533,2641305,2641236,2641230,2052652,2052644,2052630,2052628,2052543,2049649,2049611,2049607,2049606,2049605,2049552,2049543,2049532,2049529,2049451,2049438,2049437,2049434,2049429';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/schoemanshof/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/schoemanshof/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 = 'Schoemanshof: ' + 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 = 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;
	}
}

		

