function thumbnail(g,e,b,f,d,a,c){this.id=g;this.galleries_id=e;this.caption=b;this.src=getServerPath(c)+"/"+f;this.width=d;this.height=a}function gallery(e,c,d,b,a){this.id=e;this.featured_images=c;this.title=d;this.section_code=b;this.photoIDs=a}var thumbnails=new Object();thumbnails[5266220]=new thumbnail(5266220,"7110","Meall Garbh","Amp_2002_copy_thumb.jpg",130,87,1);thumbnails[4398961]=new thumbnail(4398961,"7110","Goatfell","Amp_1826_copy_thumb.jpg",130,86,1);thumbnails[4750242]=new thumbnail(4750242,"7110","Faskally Wood","Amp_1871_copy_thumb.jpg",130,195,1);thumbnails[4085297]=new thumbnail(4085297,"1237","Ben Starav","Amp_1780_copy_thumb.jpg",130,87,1);thumbnails[3203090]=new thumbnail(3203090,"1237","Black Mount","Amp 1523 copy_thumb.jpg",130,87,1);thumbnails[3222398]=new thumbnail(3222398,"1237","Ben Lomond","Amp 1518 copy_thumb.jpg",130,87,1);thumbnails[2919666]=new thumbnail(2919666,"1237","Queen Elizabeth 2","Amp 1441_thumb.jpg",130,86,1);thumbnails[3443072]=new thumbnail(3443072,"1237","Glen Coe","Amp 1500 copy_thumb.jpg",130,87,1);thumbnails[2360876]=new thumbnail(2360876,"1237","Black Mount","IMG_8370 copy 2_thumb.jpg",130,86,1);thumbnails[2174016]=new thumbnail(2174016,"1237","Ben More Assynt","IMG_6339 (1) copy_thumb.jpg",130,87,1);thumbnails[3222530]=new thumbnail(3222530,"1237","Stob Binnein","Amp 1560 copy_thumb.jpg",130,87,1);thumbnails[1706554]=new thumbnail(1706554,"1237","Rannoch Moor","Amp 1241_thumb.jpg",130,195,1);thumbnails[3847841]=new thumbnail(3847841,"1237","Sandwood Cottage","Amp_1413_copy_thumb.jpg",130,87,1);thumbnails[1314952]=new thumbnail(1314952,"1237","Ben Lomond","Amp 1218_thumb.JPG",130,87,1);thumbnails[697228]=new thumbnail(697228,"1237","Cloch Lighthouse","Amp 1212 copy_thumb.jpg",130,181,1);thumbnails[577557]=new thumbnail(577557,"1237","Faskally Wood","Amp 1210copy_thumb.jpg",130,93,1);thumbnails[229746]=new thumbnail(229746,"1237","Stac Pollaidh","Amp 1188 copy_thumb.jpg",130,87,1);thumbnails[266692]=new thumbnail(266692,"1237","An Teallach","Amp 1193 copy_thumb.jpg",130,80,1);thumbnails[240887]=new thumbnail(240887,"1237","Ardmair Bay","Amp 1191 copy_thumb.jpg",130,87,1);thumbnails[1075586]=new thumbnail(1075586,"1237","Eilean Donan Castle","Amp 1216_thumb.jpg",130,87,1);thumbnails[103918]=new thumbnail(103918,"1237","Buachaille Etive Mor","Amp 1164 copy_thumb.jpg",130,90,1);thumbnails[66159]=new thumbnail(66159,"1237","Storm Cloud","Storm Cloud 2_thumb.jpg",130,87,1);thumbnails[3674144]=new thumbnail(3674144,"1234","Beinn an Dothaidh","Amp_1691_copy_thumb.jpg",130,39,1);thumbnails[3141999]=new thumbnail(3141999,"1234","Dumgoyne Hill","Amp 1504 copy_thumb.jpg",130,34,1);thumbnails[2627978]=new thumbnail(2627978,"1234","Ben Nevis","Amp 1336 copy_thumb.jpg",130,48,1);thumbnails[5023636]=new thumbnail(5023636,"1234","Achmelvich Beach","Amp_1925_copy_thumb.jpg",130,33,1);thumbnails[1950661]=new thumbnail(1950661,"1234","Duncarnock Hill","Amp 1250copy_thumb.jpg",130,42,1);thumbnails[1770232]=new thumbnail(1770232,"1234","Winter Sunrise","Amp 1249_thumb.jpg",130,29,1);thumbnails[1649861]=new thumbnail(1649861,"1234","Black Mount & Lochan na Stainge","Amp 1240_thumb.jpg",130,33,1);thumbnails[1524449]=new thumbnail(1524449,"1234","Fyne Reflections","Amp 1220_thumb.jpg",130,52,1);thumbnails[1444159]=new thumbnail(1444159,"1234","Blackrock Cottage","Amp 1219_thumb.jpg",130,50,1);thumbnails[973359]=new thumbnail(973359,"1234","Foinaven","Amp 1215_thumb.jpg",130,34,1);thumbnails[764798]=new thumbnail(764798,"1234","Rannoch Moor","Amp 1213copy_thumb.jpg",130,31,1);thumbnails[413848]=new thumbnail(413848,"1234","Loch Lomond","Loch Lomond Sunrise_thumb.jpg",130,38,1);thumbnails[413925]=new thumbnail(413925,"1234","Loch Etive","Amp 1201_thumb.jpg",130,40,1);thumbnails[247088]=new thumbnail(247088,"1234","An Teallach","Amp 1192copy_thumb.jpg",130,39,1);thumbnails[237429]=new thumbnail(237429,"1234","Inverpolly","Amp 1190 copy_thumb.jpg",130,44,1);thumbnails[187279]=new thumbnail(187279,"1234","Glen Coe","Stitched_Result 21 copya_thumb.jpg",130,56,1);thumbnails[133253]=new thumbnail(133253,"1234","Glenfinnan","glenfinnan copy_thumb.jpg",130,41,1);thumbnails[98788]=new thumbnail(98788,"1234","Lochan na Stainge","Stitched_Result 13 copy 21_thumb.jpg",130,40,1);thumbnails[86568]=new thumbnail(86568,"1234","Eilean Donan Castle","Stitched_Result 5 copy_thumb.jpg",130,33,1);thumbnails[138762]=new thumbnail(138762,"1234","Black Mount","Stitched_Result copy1_thumb.jpg",130,39,1);thumbnails[43057]=new thumbnail(43057,"1234","Duncarnock Hill","jpg2_thumb.jpg",130,39,1);thumbnails[86851]=new thumbnail(86851,"1234","Buachaille Etive Beag","S03 copy_thumb.jpg",130,45,1);thumbnails[14114]=new thumbnail(14114,"1234","Buachaille Etive Mor 2","S1 copy 2_thumb.jpg",130,43,1);thumbnails[10415]=new thumbnail(10415,"1234","Crianlarich Mountains","Ben More & Stob Binneinn copy_thumb.jpg",130,38,1);thumbnails[524463]=new thumbnail(524463,"1236","Winter Sunrise","Amp 1207copy_thumb.jpg",130,93,1);thumbnails[342952]=new thumbnail(342952,"1236","Ben More Sunrise","Amp 1197 copy_thumb.jpg",130,87,1);thumbnails[73640]=new thumbnail(73640,"1236","Sunset Wave","Stitched_Result 3 copy a_thumb.jpg",130,53,1);thumbnails[63017]=new thumbnail(63017,"1236","Sunrise Mist","Stitched_Result copy 2_thumb.jpg",130,34,1);thumbnails[86849]=new thumbnail(86849,"1236","Arran Sunset 2","S7 copy_thumb.jpg",130,47,1);thumbnails[61267]=new thumbnail(61267,"1236","The Sun","IMG_5406 (1) copy 2_thumb.jpg",130,92,1);thumbnails[19753]=new thumbnail(19753,"1236","The Nesting Tree","Tree jpg_thumb.jpg",130,87,1);thumbnails[12834]=new thumbnail(12834,"1236","Irvine Estuary Sunset","IMG_0645 copy_thumb.jpg",130,84,1);thumbnails[8862]=new thumbnail(8862,"1236","Arran Sunset","Ardrossan Sunset Print copy_thumb.jpg",130,50,1);thumbnails[474175]=new thumbnail(474175,"16549","Stac Pollaidh","Amp 1202copy_thumb.jpg",130,93,1);thumbnails[413916]=new thumbnail(413916,"16549","Loch Duich","Amp 1200_thumb.jpg",130,40,1);thumbnails[103946]=new thumbnail(103946,"16549","Buachaille Etive Mor","IMG_0222 (2) copy_thumb.jpg",130,87,1);thumbnails[157894]=new thumbnail(157894,"16549","Anchor Mills","S2 copy 2_thumb.jpg",130,107,1);thumbnails[115835]=new thumbnail(115835,"16549","Sgurr Eilde Mor","output 2005-12-13 200934 copy_thumb.jpg",130,64,1);thumbnails[535525]=new thumbnail(535525,"1235","Blue","Amp 1209copy_thumb.jpg",130,112,1);thumbnails[524473]=new thumbnail(524473,"1235","Slow Flow","Amp 1208 copy_thumb.jpg",130,181,1);thumbnails[9266]=new thumbnail(9266,"1235","Tree Bark","1 (167) copy_thumb.jpg",130,173,1);thumbnails[8326]=new thumbnail(8326,"1235","Beach Pebbles","Lochinver 1 (551)_thumb.jpg",130,98,1);thumbnails[4463152]=new thumbnail(4463152,"234158","Above the cloud.","Amp_1835_copy_thumb.jpg",130,87,1);thumbnails[847749]=new thumbnail(847749,"234158","Quinag","Amp 1214_thumb.jpg",130,93,1);thumbnails[1123358]=new thumbnail(1123358,"234158","Suilven","Amp 1217_thumb.jpg",130,83,1);thumbnails[116031]=new thumbnail(116031,"234158","Glen Dessarry","IMG_7843 (1) copy_thumb.jpg",130,87,1);var galleries=new Object();galleries[7110]=new gallery(7110,"5266220,4750242,4398961","New Releases","gallery",[5266220,4398961,4750242]);galleries[1237]=new gallery(1237,"4085297,3847841,3443072,3222530,3222398,3203090,2919666,2360876,2174016,1706554","Landscape","gallery",[4085297,3203090,3222398,2919666,3443072,2360876,2174016,3222530,1706554,3847841,1314952,697228,577557,229746,266692,240887,1075586,103918,66159]);galleries[1234]=new gallery(1234,"5023636,3674144,3141999,2627978,1950661,1770232,1649861,1524449,1444159,973359","Panoramic","gallery",[3674144,3141999,2627978,5023636,1950661,1770232,1649861,1524449,1444159,973359,764798,413848,413925,247088,237429,187279,133253,98788,86568,138762,43057,86851,14114,10415]);galleries[1236]=new gallery(1236,"524463,342952,86849,73640,63017,61267,19753,12834,8862","Sunset & Sunrise","gallery",[524463,342952,73640,63017,86849,61267,19753,12834,8862]);galleries[16549]=new gallery(16549,"474175,413916,157894,115835,103946","Black & White","gallery",[474175,413916,103946,157894,115835]);galleries[1235]=new gallery(1235,"535525,524473,9266,8326","Macro & Abstract","gallery",[535525,524473,9266,8326]);galleries[234158]=new gallery(234158,"4463152,1123358,847749,116031","From the Hill","gallery",[4463152,847749,1123358,116031]);var imageSets=new Object();imageSets[1]="4750242,4463152,3674144,3222530,3203090,1524449,1314952,1123358,973359,764798,577557,157894";imageSets[3]="4750242,4463152";function randomListVal(a){arrayVals=a.split(",");if(arrayVals.length){pos=Math.round(Math.random()*(arrayVals.length-1));val=arrayVals[pos]}else{val=0}return val}function getServerPath(a){var b=-1;switch(a){case 21:b="http://www6.clikpic.com/trekpete/images";break}switch(a){case 1:b="http://www1.clikpic.com/trekpete/images";break}switch(a){case 2:b="http://admin.clikpic.com/trekpete/images";break}switch(a){case 24:b="http://tpc15/clikpic/trekpete/images";break}switch(a){case 4:b="http://www.clikchurch.com/trekpete/images";break}switch(a){case 5:b="http://www2.clikpic.com/trekpete/images";break}switch(a){case 22:b="http://tpc5/clikpic/trekpete/images";break}switch(a){case 23:b="http://tpc10/clikpic/trekpete/images";break}switch(a){case 25:b="http://tpc16/clikpic/trekpete/images";break}switch(a){case 15:b="http://www3.clikpic.com/trekpete/images";break}switch(a){case 18:b="http://www4.clikpic.com/trekpete/images";break}switch(a){case 19:b="http://www5.clikpic.com/trekpete/images";break}switch(a){case 31:b="http://www7.clikpic.com/trekpete/images";break}switch(a){case 32:b="http://admin2.clikpic.com/trekpete/images";break}switch(a){case 33:b="http://www8.clikpic.com/trekpete/images";break}switch(a){case 34:b="http://www9.clikpic.com/trekpete/images";break}switch(a){case 35:b="http://admin3.clikpic.com/trekpete/images";break}switch(a){case 37:b="http://admin4.clikpic.com/trekpete/images";break}return b}function showHomeImage(a){imageID=randomListVal("");if(!basic){a.src=photos[imageID].src;a.width=photos[imageID].width;a.height=photos[imageID].height}else{newImage=new Image(photos[imageID].width,photos[imageID].height);newImage.src=photos[imageID].src;document.images[a.name]=newImage}}function showHomeImageInline(){html="";imageID=randomListVal(imageSets[1]);if("gallery"!=""){if(backgrounds[imageID].galleries_id!=""){html+='<a href="'+backgrounds[imageID].section_code+"_"+backgrounds[imageID].galleries_id+'.html">'}else{html+='<a href="gallery.html">'}}html+='<img src="'+backgrounds[imageID].src+'" width="'+backgrounds[imageID].width+'" height="'+backgrounds[imageID].height+'" class="mainhomepageimage photo" id="mainSample" name="mainSample" alt="'+backgrounds[imageID].caption+'" border="0">';if("gallery"!=""){html+="</a>"}$("#homepageimage").html(html)}function getNextId(b,d,a){var c=getArrayPos(d,b);if(a){if(c==0){nextImgPos=d.length-1}else{nextImgPos=c-1}}else{if(c==d.length-1){nextImgPos=0}else{nextImgPos=c+1}}nextImg=d[nextImgPos];return nextImg}function next(d,b){var c=d.value;var a=galleries[photos[c].galleries_id].photoIDs;nextImg=getNextId(c,a);if(nextImg!=-1){updateImage(nextImg,d,b)}}function updateImage(f,e,b){if(!basic){document.getElementById("imagePhoto").innerHTML='<img class="mainphoto photo" src="'+photos[f].src+' " id="mainPic" name="mainPic" width="'+photos[f].width+'" height="'+photos[f].height+'" alt="'+photos[f].caption+'">';e.value=photos[f].id;$("#imageTitle").html(photos[f].caption);document.title="Allmo Photography: "+photos[f].caption;if(photos[f].caption==""){document.getElementById("imageTitle").style.display="none"}else{document.getElementById("imageTitle").style.display="block"}var a=fnGetImageDetails(f);if(a==""){document.getElementById("imageDetails").style.display="none";var c=document.getElementById("infoWrap");var d=document.getElementById("photoInfo");if(photos[f].caption==""){if(c!=null){c.className="empty"}if(d!=null){d.className="empty"}}else{if(c!=null){c.className="noinfo"}if(d!=null){d.className="noinfo"}}}else{document.getElementById("imageDetails").style.display="block";var c=document.getElementById("infoWrap");if(c!=null){c.className="normal"}var d=document.getElementById("photoInfo");if(d!=null){d.className="normal"}}document.getElementById("imageDetails").innerHTML=a;resizePhotoInfo();toggleAddToCartConfirm()}else{window.location="photo_"+photos[f].id+".html"}}function toggleAddToCartConfirm(){if($("#paymentConfirm").size()){$("#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,photos,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()}}else{$("#paymentConfirm").text("Item not added - check cookies are enabled in your browser.").fadeIn()}})}}function fnGetImageDetails(b){var a="";if(photos[b].description!=""){a=a+'<p id="imageDescription">'+photos[b].description+"</p>"}if(photos[b].photo_ref!=""){a=a+'<p class="imageinfo" id="imageRef"><strong>Ref: </strong>'+photos[b].photo_ref+"</p>"}if(photos[b].takendate!=""){a=a+'<p class="imageinfo" id="imageDate"><strong>Date: </strong>'+photos[b].takendate+"</p>"}if(photos[b].location!=""){a=a+'<p class="imageinfo" id="imageLocation"><strong>Location: </strong>'+photos[b].location+"</p>"}if(photos[b].photographer!=""){a=a+'<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>'+photos[b].photographer+"</p>"}a=a+fnGetPaymentInfo(photos[b]);if(a!=""){a=a+'<div class="spacer"></div>'}return a}function fnGetPaymentInfo(c){var b="";if(c.item_price!==""){b=b+"<p>Buy now using PayPal:</p>";b=b+'<p class="imageinfo" id="imagePrice"><strong>'+c.purchase_instruction+"</strong> 				&pound;"+(c.item_price).toFixed(2)+"</p>";var e=c.purchase_instruction;var d=(c.item_price).toFixed(2);var a=0}else{if(c.payment_groups_id!==""){b=b+"<p>Buy this print online:</p>";b=b+'<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';b=b+'<select class="paymentlink" name="payment_options_id" onchange="updateCartValue(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';b=b+getPaymentOptions(c.payment_groups_id);b=b+"</select>";b=b+"</form>";var a=paymentGroups[c.payment_groups_id].options[0];if(paymentOptions[a]){var e=paymentOptions[a].payment_option;var d=paymentOptions[a].price}}else{}}if(c.item_price!==""||c.payment_groups_id!==""){b=b+'<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';b=b+'	<input type="hidden" name="item_option" value="'+a+'">';b=b+'	<input type="hidden" name="site" value="TREKPETE">';b=b+'	<input type="hidden" name="item_number" value="'+c.id+'">';b=b+'	<input type="hidden" name="quantity" value="1">';b=b+'	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button">';b=b+'	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';b=b+"</form>";b=b+'<div class="clearing">&nbsp;</div>';b=b+'<div id="confirmContainer">';b=b+'<div id="paymentConfirm">Item added to cart</div>';b=b+"</div>";b=b+'<div class="clearing">&nbsp;</div>'}return b}function previous(d,b){var c=d.value;var a=galleries[photos[c].galleries_id].photoIDs;nextImg=getNextId(c,a,1);if(nextImg!=-1){updateImage(nextImg,d,b)}}function showGalleryImage(c,b){imageID=randomListVal(galleries[c].featured_images);if(imageID!=0){b.src=thumbnails[imageID].src;b.width=thumbnails[imageID].width;b.height=thumbnails[imageID].height;if(b.width<130){var f=$("img#gallery"+c);f.parents(".thumbWrap").width(b.width);var a=f.siblings("h3").size()==1?f.siblings("h3"):f.parent(".thumbWrap").siblings("h3");var g=parseInt(a.css("padding-left"))+parseInt(a.css("padding-right"));var d=parseInt(a.css("border-left-width"))+parseInt(a.css("border-right-width"));var e=parseInt(f.parents(".thumbWrap").css("border-left-width"))+parseInt(f.parents(".thumbWrap").css("border-right-width"));a.width(f.outerWidth(true)-g-d+e)}}}function showGalleries(a){if(!basic){temp="";for(i=0;i<galleries.length;i++){if(galleries[i].id!=a){if(temp!=""){temp=temp+" | "}temp=temp+'<a href="gallery_'+galleries[i].id+'.html">'+galleries[i].title+"</a>"}}document.all.galleryLinks.innerHTML="Other galleries: "+temp}}function resizePhotoInfo(n){var b=$.extend({centre:false},n||{});var d=3;$("div#photoPanelOuter").height("auto");$("div#infoWrap").width(200);$("div#photoDetail").css("width","auto");var h=$("div#maincolContent").width();var j=$("div#photoWrap").outerWidth(true);var m=$("div#infoWrap").outerWidth(true);var k=$("div#photoWrap").outerHeight();var f=$("div#infoWrap").outerHeight();var c=$("div#infoWrap").hasClass("empty");floatDrop=0;var g=j;if(!c){if(h<(j+m)){floatDrop=1}if(!floatDrop){var a=$("div#infoWrap").innerWidth();$("div#infoWrap").width(a+(h-j-m-d));m=$("div#infoWrap").outerWidth(true);g=j+m;if(k>f){var e=$("div#photoPanelOuter").height();$("div#photoPanelOuter").height(e+(k-f));var f=$("div#infoWrap").outerHeight()}}else{var l=$("div#photoWrap").outerWidth();$("div#infoWrap").width(l)}}if(b.centre){$("div#photoDetail").width(g);$("div#photoDetail").css("margin-left","auto");$("div#photoDetail").css("margin-right","auto")}else{$("div#photoDetail").css("margin-left","0");$("div#photoDetail").css("margin-right","0")}}function getArrayPos(c,b){for(var a=0;a<c.length;a++){if(c[a]==b){return a}}return -1}function changeBgImg(a,e){var c=randomListVal(imageSets[e]);var d=backgrounds[c].src;var b=$(a);if(b.size()>0){if(/\bimg$/.test(a)){b.attr({src:d})}else{b.css({"background-image":'url("'+d+'")'})}}};