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[1892983]=new thumbnail(1892983,"63534","Bella","web bella_thumb.jpg",130,88,1);thumbnails[824601]=new thumbnail(824601,"63894","Daybreak","Daybreak_thumb.jpg",130,68,1);thumbnails[824611]=new thumbnail(824611,"63894","Passing By","passingby1_thumb.jpg",130,96,1);thumbnails[824643]=new thumbnail(824643,"63894","Twiston","twiston_thumb.jpg",80,60,1);thumbnails[828517]=new thumbnail(828517,"63894","Before Sunset","Beforesunset_thumb.jpg",100,54,1);thumbnails[828534]=new thumbnail(828534,"63894","Last Summer","lastsummer1_thumb.jpg",100,75,1);thumbnails[828550]=new thumbnail(828550,"63894","Croppers Place","croppersplace_thumb.jpg",100,47,1);thumbnails[828578]=new thumbnail(828578,"63894","Changing Moods","changingmoods_thumb.jpg",100,53,1);thumbnails[964897]=new thumbnail(964897,"63534","Jasper","6 left springer dotted finished JASPER1_thumb.jpg",130,92,1);thumbnails[1028102]=new thumbnail(1028102,"63893","Bedruthen Steps ","Resize of bedruthan steps_thumb.jpg",130,89,1);thumbnails[1398923]=new thumbnail(1398923,"63534","Monty ","Resize of monty2_thumb.jpg",89,130,1);thumbnails[2021973]=new thumbnail(2021973,"63534","Victor","victor_thumb.jpg",130,86,1);thumbnails[3463813]=new thumbnail(3463813,"","Tommy","Resize of TOMMY1_thumb.jpg",102,130,1);thumbnails[3463826]=new thumbnail(3463826,"63534","Tommy","Resize of TOMMY2_thumb.jpg",102,130,1);thumbnails[3703092]=new thumbnail(3703092,"63534","Truffle","Resize_of_1st_500dpi_snow_truffleFINAL1_thumb.jpg",130,88,1);thumbnails[3787170]=new thumbnail(3787170,"211699","","ResizeButtermereNo2031_thumb.jpg",130,87,1);thumbnails[828513]=new thumbnail(828513,"63894","Arnside in Red","arnsideinred_thumb.jpg",40,100,1);thumbnails[828636]=new thumbnail(828636,"63894","Summit in Red","summitinred_thumb.jpg",40,100,1);thumbnails[828506]=new thumbnail(828506,"63894","Moorland","moorlandgrass_thumb.jpg",70,130,1);thumbnails[864010]=new thumbnail(864010,"63894","Byways","byways_thumb.jpg",60,100,1);thumbnails[829026]=new thumbnail(829026,"63894","Toddling Home","toddlinhome_thumb.jpg",60,100,1);thumbnails[828523]=new thumbnail(828523,"63893","Waiting","waiting_thumb.jpg",100,75,1);thumbnails[829201]=new thumbnail(829201,"63879","Long Tailed Tit","longtailedtit  10x8_thumb.jpg",70,55,1);thumbnails[1670293]=new thumbnail(1670293,"63893"," Paddling Pools","Resize of Resize of paddling pools_thumb.jpg",130,66,1);thumbnails[2859545]=new thumbnail(2859545,"63534","Tribute To Moses","higlight cast alteredmoses 500 FINAL_resize_thumb.jpg",87,130,1);thumbnails[3463397]=new thumbnail(3463397,"211699","203 Buttermere","ResizeButtermereNo203_thumb.jpg",130,87,1);thumbnails[3463398]=new thumbnail(3463398,"211699","201 Downham","ResizeofDownhamNo201_thumb.jpg",130,84,1);thumbnails[3463405]=new thumbnail(3463405,"211699","206 Buttermere","ResizeofButtermereNo206_thumb.jpg",130,86,1);thumbnails[3463407]=new thumbnail(3463407,"211699","207 Jenny Browns Point","ResizeofJennyBrownsPointNo207_thumb.jpg",130,78,1);thumbnails[3463410]=new thumbnail(3463410,"211699","208 Derwent Water","ResizeofDerwentWaterNo208_thumb.jpg",130,87,1);thumbnails[3463411]=new thumbnail(3463411,"211699","209 Silverdale","ResizeofSilverdaleNo209_thumb.jpg",130,87,1);thumbnails[3463412]=new thumbnail(3463412,"211699","210 Grane Rd Haslingden","ResizeofTheGraneHaslingdonNo210_thumb.jpg",130,87,1);thumbnails[824710]=new thumbnail(824710,"63534","Waiting for Stan","waitingforstan_thumb.jpg",71,100,1);thumbnails[828514]=new thumbnail(828514,"63894","A Way To Go","awaytogo_thumb.jpg",130,103,1);thumbnails[828982]=new thumbnail(828982,"63879","Coal Tit","coaltit_thumb.jpg",70,56,1);thumbnails[824335]=new thumbnail(824335,"63534","Roy and Lilly","roylily2_thumb.jpg",130,100,1);thumbnails[828515]=new thumbnail(828515,"63894","By Moonlight","bymoonlight_thumb.jpg",130,103,1);thumbnails[829002]=new thumbnail(829002,"63879","Great Tit","greattit_thumb.jpg",70,56,1);thumbnails[824650]=new thumbnail(824650,"63534","Trooper","trooper2_thumb.jpg",90,100,1);thumbnails[828976]=new thumbnail(828976,"63879","Blue Tit","blue tit_thumb.jpg",70,55,1);thumbnails[829270]=new thumbnail(829270,"63894","Dusk Over Pendle","duskoverpendle_thumb.jpg",130,103,1);thumbnails[824406]=new thumbnail(824406,"63894","In The Shadow Of Pendle","intheshadowofpendle_thumb.jpg",130,104,1);thumbnails[828999]=new thumbnail(828999,"63879","Chaffinch","chaffinch_thumb.jpg",70,55,1);thumbnails[829262]=new thumbnail(829262,"63534","Loyalty","LOYALTY_thumb.jpg",65,100,1);thumbnails[824657]=new thumbnail(824657,"63534","Logo","logo_thumb.jpg",62,100,1);thumbnails[828629]=new thumbnail(828629,"63894","Still Waters Buttermere","stillwatersbuttermere_thumb.jpg",130,97,1);thumbnails[828990]=new thumbnail(828990,"63879","Greenfinch","greenfinch_thumb.jpg",70,56,1);thumbnails[824320]=new thumbnail(824320,"63534","Watching and Waiting ","watchingandwaiting1_thumb.jpg",80,56,1);thumbnails[824365]=new thumbnail(824365,"63894","Buttermere","buttermere_thumb.jpg",130,89,1);thumbnails[828536]=new thumbnail(828536,"63879","Gold Finch","goldfinch_thumb.jpg",100,79,1);thumbnails[824495]=new thumbnail(824495,"63534","Hawk","hawk1_thumb.jpg",130,97,1);thumbnails[824367]=new thumbnail(824367,"63894","Mac at Work","macatwork_thumb.jpg",130,62,1);thumbnails[828955]=new thumbnail(828955,"63894","Gathering In","Gatheringin_thumb.jpg",70,53,1);thumbnails[824194]=new thumbnail(824194,"63879","Barn Owl","barnowl1_thumb.jpg",130,164,1);thumbnails[824622]=new thumbnail(824622,"63894","Wuthering Heights","wutheringheights_thumb.jpg",100,75,1);thumbnails[1670294]=new thumbnail(1670294,"63893"," Silky Waters","Resize of Resize of silky waters_thumb.jpg",130,86,1);thumbnails[824682]=new thumbnail(824682,"63894","Morning light Wycoller","morninglightwycoller_thumb.jpg",100,75,1);thumbnails[828583]=new thumbnail(828583,"63879","Long Eared Owl","longearedowl_thumb.jpg",80,100,1);thumbnails[828526]=new thumbnail(828526,"63879","Merlin","merlin_thumb.jpg",80,100,1);thumbnails[824662]=new thumbnail(824662,"63879","Morning Glory","morninggloryrobin_thumb.jpg",100,79,1);thumbnails[824659]=new thumbnail(824659,"63879","Sitting on the Fence","sittingonthefence_thumb.jpg",100,78,1);thumbnails[824667]=new thumbnail(824667,"63879","Fisherman","fisherman_thumb.jpg",75,100,1);thumbnails[1670295]=new thumbnail(1670295,"63893"," Striding Stones","Resize of Resize of striding stones_thumb.jpg",87,130,1);thumbnails[3463364]=new thumbnail(3463364,"211699","203 Buttermere","ResizeofButtermereNo2021_thumb.jpg",130,80,1);thumbnails[2859547]=new thumbnail(2859547,"","web bella","web bella1_thumb.jpg",130,88,1);thumbnails[3463365]=new thumbnail(3463365,"211699","204 Buttermere","ResizeofBUTTERMERENo204_thumb.jpg",130,87,1);thumbnails[3463366]=new thumbnail(3463366,"211699","205 Buttermere","ResizeofButtermereNo205_thumb.jpg",130,87,1);thumbnails[824640]=new thumbnail(824640,"63894","Wallerbrook Clapper","Wallerbrookclapper_thumb.jpg",100,79,1);thumbnails[824631]=new thumbnail(824631,"63894","Teign Clapper","Teignclapper_thumb.jpg",100,80,1);thumbnails[828626]=new thumbnail(828626,"63894","Heckwood Tor","heckwoodtor_thumb.jpg",100,49,1);thumbnails[828580]=new thumbnail(828580,"63894","Kings Tor","kingstor_thumb.jpg",100,68,1);thumbnails[828964]=new thumbnail(828964,"63894","West Mill Tor","westmilltor_thumb.jpg",70,48,1);thumbnails[879218]=new thumbnail(879218,"63894","Rays of Light","raysoflight_thumb.jpg",130,69,1);thumbnails[3463367]=new thumbnail(3463367,"211699","200 Pendle Hill","ResizeofPendleHillNo200_thumb.jpg",130,87,1);thumbnails[824709]=new thumbnail(824709,"63517","Warmth of Nature","WarmthofNature_thumb.jpg",100,67,1);thumbnails[864062]=new thumbnail(864062,"63517","Affection","Affection_thumb.JPG",80,58,1);thumbnails[864077]=new thumbnail(864077,"63517","Morning Dew","Morning Dew_thumb.JPG",79,100,1);thumbnails[864590]=new thumbnail(864590,"63517","Curiosity","Curiosity_thumb.jpg",70,100,1);thumbnails[864596]=new thumbnail(864596,"63517","Left Behind","Left Behind_thumb.jpg",80,56,1);var galleries=new Object();galleries[63879]=new gallery(63879,"829201,829002,828999,828990,828982,828976,828583,828536,828526,824667","Birds","section92594",[829201,828982,829002,828976,828999,828990,828536,824194,828583,828526,824662,824659,824667]);galleries[63534]=new gallery(63534,"2859545","Dogs","section92106",[1892983,964897,1398923,2021973,3463826,3703092,2859545,824710,824335,824650,829262,824657,824320,824495]);galleries[63894]=new gallery(63894,"879218,864010,829270,829026,828964,828955,828636,828629,828626,828580","Landscapes","section92595",[824601,824611,824643,828517,828534,828550,828578,828513,828636,828506,864010,829026,828514,828515,829270,824406,828629,824365,824367,828955,824622,824682,824640,824631,828626,828580,828964,879218]);galleries[211699]=new gallery(211699,"3787170,3463412,3463411,3463410,3463407,3463405,3463398,3463397,3463367,3463366","Photography","section95975",[3787170,3463397,3463398,3463405,3463407,3463410,3463411,3463412,3463364,3463365,3463366,3463367]);galleries[63893]=new gallery(63893,"1670294","Seascapes","section92593",[1028102,828523,1670293,1670294,1670295]);galleries[63517]=new gallery(63517,"864596,864590,864077,864062,824709","Wildlife","section92596",[824709,864062,864077,864590,864596]);var imageSets=new Object();imageSets[1]="3703092";imageSets[2]="2859545,1670294";imageSets[3]="3787170,3703092,3463826,3463813,3463412,3463411,3463410,3463407,3463405,3463398,3463397,3463367,3463366,3463365,3463364,2859547,2859545,2021973,1892983,1670295,1670294,1670293,1398923,1028102,964897,879218,864596,864590,864077,864062,864010,829270,829262,829201,829026,829002,828999,828990,828982,828976,828964,828955,828636,828629,828626,828583,828580,828578,828550,828536";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 34:b="http://www9.clikpic.com/townsend/images";break}switch(a){case 1:b="http://www1.clikpic.com/townsend/images";break}switch(a){case 2:b="http://admin.clikpic.com/townsend/images";break}switch(a){case 4:b="http://www.clikchurch.com/townsend/images";break}switch(a){case 5:b="http://www2.clikpic.com/townsend/images";break}switch(a){case 15:b="http://www3.clikpic.com/townsend/images";break}switch(a){case 21:b="http://www6.clikpic.com/townsend/images";break}switch(a){case 18:b="http://www4.clikpic.com/townsend/images";break}switch(a){case 19:b="http://www5.clikpic.com/townsend/images";break}switch(a){case 22:b="http://tpc5/clikpic/townsend/images";break}switch(a){case 23:b="http://tpc10/clikpic/townsend/images";break}switch(a){case 24:b="http://tpc15/clikpic/townsend/images";break}switch(a){case 25:b="http://tpc16/clikpic/townsend/images";break}switch(a){case 31:b="http://www7.clikpic.com/townsend/images";break}switch(a){case 32:b="http://admin2.clikpic.com/townsend/images";break}switch(a){case 33:b="http://www8.clikpic.com/townsend/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("section92594"!=""){if(backgrounds[imageID].galleries_id!=""){html+='<a href="'+backgrounds[imageID].section_code+"_"+backgrounds[imageID].galleries_id+'.html">'}else{html+='<a href="section92594.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("section92594"!=""){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="The Townsend Gallery: "+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;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>Artist </strong>'+photos[b].photographer+"</p>"}if(a!=""){a=a+'<div class="spacer"></div>'}return a}function fnGetPaymentInfo(c){var b="";if(c.item_price!==""){b=b+"<p>Order this print:</p>";b=b+'<p class="imageinfo" id="imagePrice"><strong>'+c.purchase_instruction+"</strong> 							"+(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="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';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+'<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+'")'})}}};