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[598982]=new thumbnail(598982,"46082","The Arrival (II)","TheArrivalIIupload_thumb.jpg",130,101,15);thumbnails[598983]=new thumbnail(598983,"46082","The Gate","TheGateupload_thumb.jpg",130,130,15);thumbnails[5887415]=new thumbnail(5887415,"46087","Tyne Bridge Dusk","Tyne_Bridge_at_Dusk1_thumb.jpg",130,86,15);thumbnails[5887407]=new thumbnail(5887407,"46087","Tyne Bridge","Bridges2BW12_thumb.jpg",130,86,15);thumbnails[5887412]=new thumbnail(5887412,"46087","Tyne Bridge 2","Bridges5_BW12_thumb.jpg",130,86,15);thumbnails[5887385]=new thumbnail(5887385,"46087","Quayside","Queyside_BW_filtered1_thumb.jpg",130,93,15);thumbnails[5887366]=new thumbnail(5887366,"46087","Quayside 2","Waterfront_thumb.jpg",130,86,15);thumbnails[526775]=new thumbnail(526775,"40742","John at home","John1_thumb.jpg",130,175,15);thumbnails[526777]=new thumbnail(526777,"40742","Handpiece","Handpiece1_thumb.jpg",130,87,15);thumbnails[598998]=new thumbnail(598998,"40743","Friends (II)","Friends Polaroid(upload)_thumb.jpg",130,130,15);thumbnails[526778]=new thumbnail(526778,"40742","Old cowshed","Cowshed1_thumb.jpg",130,73,15);thumbnails[528372]=new thumbnail(528372,"40865","Prague by night","Praguebynight_thumb.jpg",130,65,15);thumbnails[528315]=new thumbnail(528315,"40865","Graves, Josehov","JosehovPrague_thumb.jpg",130,86,15);thumbnails[528377]=new thumbnail(528377,"40865","The old clocktower","Tower_thumb.jpg",130,86,15);thumbnails[528228]=new thumbnail(528228,"40865","Charles bridge, dawn","Charlesbridgedawn_thumb.jpg",130,65,15);thumbnails[526783]=new thumbnail(526783,"40742","Windowpane","Windowpane1_thumb.jpg",130,90,15);thumbnails[528314]=new thumbnail(528314,"40865","Josehov Jewish cemetary","JosehovPano_thumb.jpg",130,43,15);thumbnails[526786]=new thumbnail(526786,"40742","Thunderbird","Thunderbird1_thumb.jpg",130,87,15);thumbnails[526795]=new thumbnail(526795,"40743","'The firm': Lee","LeeSage1_thumb.jpg",130,43,15);thumbnails[526788]=new thumbnail(526788,"40742","Rain from the hills","Rain1_thumb.jpg",130,130,15);thumbnails[528379]=new thumbnail(528379,"40865","Bone stack","BoneStack_thumb.jpg",130,370,15);thumbnails[1593273]=new thumbnail(1593273,"39963","Last Light over Rum, Sepia I","Rum No 19 (T-Max 100 Sepia Terra)_thumb.jpg",130,194,15);thumbnails[1593278]=new thumbnail(1593278,"39963","Storm over Rum, Sepia","Rum No 20 (Fuji Acros 100)_thumb.jpg",130,194,15);thumbnails[1593281]=new thumbnail(1593281,"39963","Last light over Rum, Sepia II","Rum Type No 18 (Delta 100 Sepia Terra)_thumb.jpg",130,194,15);thumbnails[832133]=new thumbnail(832133,"39963","Kotukumoana II","Lake Brunner(TMax100)_thumb.jpg",130,130,15);thumbnails[832132]=new thumbnail(832132,"39963","Single Pole, West coast","Single Pole, West Coast (neopan)_thumb.jpg",130,130,15);thumbnails[832126]=new thumbnail(832126,"39963","Failing Light, Milford Sound","Failing Light Milford_thumb.jpg",130,130,15);thumbnails[580200]=new thumbnail(580200,"39963","Buachaille Etive Mor","BuachailleEtiveTree_thumb.jpg",130,130,15);thumbnails[598964]=new thumbnail(598964,"39963","The Gate","TheGateSeliniumupload_thumb.jpg",130,130,15);thumbnails[880376]=new thumbnail(880376,"39963","Time","Time trails (Delta Sepia)_thumb.jpg",130,130,15);thumbnails[580188]=new thumbnail(580188,"39963","Cill Chriosd (Church of Christ), Isle of Skye","CillChriosd_thumb.jpg",130,43,15);thumbnails[512613]=new thumbnail(512613,"39963","Rannoch Moor","TreeRannochIR_thumb.jpg",130,43,15);thumbnails[880371]=new thumbnail(880371,"39963","First Light, Milford Sound","Milford F (Acros)_thumb.jpg",130,46,15);thumbnails[1587288]=new thumbnail(1587288,"39731","Isle of Rum from Camas Sgiotaig, Late afternoon","Rum 9 (Velvia uncropped)_thumb.jpg",130,194,15);thumbnails[1587369]=new thumbnail(1587369,"39731","Last Light, Isle of Rum II","Rum Type No 18 (Velvia 50)_thumb.jpg",130,194,15);thumbnails[1606378]=new thumbnail(1606378,"39731","Failing Light over Rum","Rum No 14 (Dxo Velvia warmup)_thumb.jpg",130,87,15);thumbnails[1587354]=new thumbnail(1587354,"39731","Storm over Rum I","Rum No 13 (Velvia 50)_thumb.jpg",130,87,15);thumbnails[832120]=new thumbnail(832120,"39731","Lake Wanaka, Dusk","Lake Wanaka Dusk_thumb.jpg",130,130,15);thumbnails[515775]=new thumbnail(515775,"39731","Housesteads Dawn","Housteads_thumb.jpg",130,130,15);thumbnails[512947]=new thumbnail(512947,"39731","Poppy field, Hexhamshire","Poppyfield_thumb.jpg",130,130,15);thumbnails[513424]=new thumbnail(513424,"39731","Dead Tree, Rannoch Moor","RannochMoorTree_thumb.jpg",130,130,15);thumbnails[513129]=new thumbnail(513129,"39731","St Mary's Island, low tide","Stmary_thumb.jpg",130,130,15);thumbnails[515434]=new thumbnail(515434,"39731","Dusk over the Cuillin, Elgol","Elgol1_thumb.jpg",130,46,15);thumbnails[515616]=new thumbnail(515616,"39731","Glen Coe, Summer","GlenCoeSummer_thumb.jpg",130,43,15);thumbnails[513435]=new thumbnail(513435,"39731","Rannoch Moor Dawn","RannochMoorDawn_thumb.jpg",130,46,15);thumbnails[512603]=new thumbnail(512603,"39731","Letah Burn, Autumn","LetahBurn_thumb.jpg",130,43,15);thumbnails[517633]=new thumbnail(517633,"39731","Allt Coire Eoghainne","GlenNevis_thumb.jpg",130,43,15);thumbnails[512573]=new thumbnail(512573,"39738","What will be","Whatmaybe_thumb.jpg",130,130,15);thumbnails[512597]=new thumbnail(512597,"39738","8 Months, Wahine of Ngai Tahu","NgaiTahu_thumb.jpg",130,130,15);thumbnails[518005]=new thumbnail(518005,"39738","Jodi at Bamburgh","Jodi_thumb.jpg",130,131,15);thumbnails[518007]=new thumbnail(518007,"39738","Nina","Nina_thumb.jpg",130,131,15);thumbnails[518008]=new thumbnail(518008,"39738","Hands","Hands_thumb.jpg",130,131,15);var galleries=new Object();galleries[40743]=new gallery(40743,"598998,526795","Commissions","gallery",[598998,526795]);galleries[40865]=new gallery(40865,"528372,528228","Czech republic","gallery",[528372,528315,528377,528228,528314,528379]);galleries[46082]=new gallery(46082,"598983,598982","Mysterious Places","gallery",[598982,598983]);galleries[40742]=new gallery(40742,"526788,526786,526777","New Zealand","gallery",[526775,526777,526778,526783,526786,526788]);galleries[46087]=new gallery(46087,"5887415,5887412,5887407,5887385,5887366","Townscape","gallery",[5887415,5887407,5887412,5887385,5887366]);galleries[39963]=new gallery(39963,"1593281,1593278,1593273,880376,880371,832133,832132,832126,598964,580200,580188,512613","Mono Landscape","gallery",[1593273,1593278,1593281,832133,832132,832126,580200,598964,880376,580188,512613,880371]);galleries[39731]=new gallery(39731,"1587369,1587354,1587288,832120,515775","Landscape","gallery",[1587288,1587369,1606378,1587354,832120,515775,512947,513424,513129,515434,515616,513435,512603,517633]);galleries[39738]=new gallery(39738,"512573","Portraiture","gallery",[512573,512597,518005,518007,518008]);galleries[40741]=new gallery(40741,"528372,528228,526788,526786,526777","Travel","gallery",[]);galleries[46092]=new gallery(46092,"598998,598983,598982,526795","Other","gallery",[]);var imageSets=new Object();imageSets[1]="1593281,1593278,1593273,1587369,1587354,1587288,880376,880371,832133,832132,832126,832120,598983,598964,580200,580188,528372,515775,515616,515434,513435,512947,512613,512573";imageSets[2]="1593281,1593278,1593273,1587369,1587354,1587288,880376,880371,832133,832132,832126,832120,598998,598983,598982,598964,580200,580188,528372,528228,526795,526788,526786,526777,515775,512613,512573";imageSets[3]="5887415,5887412,5887407,5887385,5887366";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/benheaven/images";break}switch(a){case 1:b="http://www1.clikpic.com/benheaven/images";break}switch(a){case 2:b="http://admin.clikpic.com/benheaven/images";break}switch(a){case 24:b="http://tpc15/clikpic/benheaven/images";break}switch(a){case 4:b="http://www.clikchurch.com/benheaven/images";break}switch(a){case 5:b="http://www2.clikpic.com/benheaven/images";break}switch(a){case 22:b="http://tpc5/clikpic/benheaven/images";break}switch(a){case 23:b="http://tpc10/clikpic/benheaven/images";break}switch(a){case 25:b="http://tpc16/clikpic/benheaven/images";break}switch(a){case 15:b="http://www3.clikpic.com/benheaven/images";break}switch(a){case 18:b="http://www4.clikpic.com/benheaven/images";break}switch(a){case 19:b="http://www5.clikpic.com/benheaven/images";break}switch(a){case 31:b="http://www7.clikpic.com/benheaven/images";break}switch(a){case 32:b="http://admin2.clikpic.com/benheaven/images";break}switch(a){case 33:b="http://www8.clikpic.com/benheaven/images";break}switch(a){case 34:b="http://www9.clikpic.com/benheaven/images";break}switch(a){case 35:b="http://admin3.clikpic.com/benheaven/images";break}switch(a){case 37:b="http://admin4.clikpic.com/benheaven/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="Ben Heaven 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="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+'<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';b=b+'<input type="hidden" name="item_name" value="'+e+'">';ref="";if(c.photo_ref!=""){ref=c.photo_ref+" - "+c.caption}else{ref=c.id+" - "+c.caption}price=d;b=b+'<input type="hidden" name="cmd" value="_cart">';b=b+'<input type="hidden" name="business" value="B.R.J.Heaven@ncl.ac.uk">';b=b+'<input type="hidden" name="currency_code" value="GBP">';b=b+'<input type="hidden" name="add" value="1">';b=b+'<input type="hidden" name="amount" value="'+d+'">';b=b+'<input type="hidden" name="item_number" value="'+ref+'">';b=b+'<input type="Submit" value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';">';b=b+"</form>";b=b+'<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';b=b+'<input type="hidden" name="cmd" value="_cart">';b=b+'<input type="hidden" name="business" value="B.R.J.Heaven@ncl.ac.uk">';b=b+'<input type="hidden" name="display" value="1">';b=b+'<input type="Submit" value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';">';b=b+"</form>";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+'")'})}}};