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[1515854]=new thumbnail(1515854,"","","Front Page Bike_nt_thumb.jpg",130,93,1);thumbnails[1515855]=new thumbnail(1515855,"","","Front Page Car_nt_thumb.jpg",130,86,1);thumbnails[1515857]=new thumbnail(1515857,"","","Front Page SideCar_nt_thumb.jpg",130,86,1);thumbnails[1515860]=new thumbnail(1515860,"","","Front Page TrialsBike_nt_thumb.jpg",130,86,1);thumbnails[1824239]=new thumbnail(1824239,"","","Rally Isle of Man 2007 Day 2 0101_thumb.jpg",130,90,1);thumbnails[1991617]=new thumbnail(1991617,"","","IMG_9501_thumb.jpg",130,200,1);thumbnails[4664884]=new thumbnail(4664884,"268933","","1_CT91227_thumb.jpg",130,93,1);thumbnails[4664885]=new thumbnail(4664885,"268933","","2_CT90842_thumb.jpg",130,93,1);thumbnails[4664887]=new thumbnail(4664887,"268933","","3_CT90848_thumb.jpg",130,93,1);thumbnails[4664895]=new thumbnail(4664895,"268933","","4_CT91144_thumb.jpg",130,93,1);thumbnails[4664897]=new thumbnail(4664897,"268933","","5_CT90630_thumb.jpg",130,182,1);thumbnails[4664899]=new thumbnail(4664899,"268933","","6_CT90662_thumb.jpg",130,182,1);thumbnails[4664905]=new thumbnail(4664905,"268933","","7_CT90698_thumb.jpg",130,182,1);thumbnails[4664907]=new thumbnail(4664907,"268933","","8_CT90699_thumb.jpg",130,182,1);thumbnails[4664908]=new thumbnail(4664908,"268933","","9_CT90869_thumb.jpg",130,182,1);thumbnails[4664909]=new thumbnail(4664909,"268933","","10_CT90950_thumb.jpg",130,182,1);thumbnails[4664921]=new thumbnail(4664921,"268933","","11_CT91183_thumb.jpg",130,182,1);thumbnails[4664923]=new thumbnail(4664923,"268933","","12_CT91187_thumb.jpg",130,182,1);thumbnails[3424902]=new thumbnail(3424902,"209329","","DSC_5454_thumb.jpg",130,93,1);thumbnails[3424936]=new thumbnail(3424936,"209329","","DSC_5821_thumb.jpg",130,93,1);thumbnails[3424946]=new thumbnail(3424946,"209329","","DSC_5843_thumb.jpg",130,93,1);thumbnails[3424950]=new thumbnail(3424950,"209329","","DSC_5925_thumb.jpg",130,93,1);thumbnails[3424953]=new thumbnail(3424953,"209329","","RI_07_ 055_thumb.jpg",130,93,1);thumbnails[3424959]=new thumbnail(3424959,"209329","","RI_07_ 143_thumb.jpg",130,93,1);thumbnails[3424965]=new thumbnail(3424965,"209329","","RI_07_ 178_thumb.jpg",130,93,1);thumbnails[3424968]=new thumbnail(3424968,"209329","","RI_07_ 268_thumb.jpg",130,93,1);thumbnails[3424984]=new thumbnail(3424984,"209331","","Rally Isle of Man 2006 048_thumb.jpg",130,93,1);thumbnails[3424990]=new thumbnail(3424990,"209331","","Rally Isle of Man 2006 Day 3 034_thumb.jpg",130,93,1);thumbnails[3424996]=new thumbnail(3424996,"209331","","Rally Isle of Man 2006 Day 3 073_thumb.jpg",130,93,1);thumbnails[3425002]=new thumbnail(3425002,"209331","","Rally Isle of Man 2007 - Shakedown 139_thumb.jpg",130,93,1);thumbnails[3425008]=new thumbnail(3425008,"209331","","Rally Isle of Man 2007 Day 2 003_thumb.jpg",130,93,1);thumbnails[3425010]=new thumbnail(3425010,"209331","","RIOM_08_D1_ 043_thumb.jpg",130,93,1);thumbnails[3425013]=new thumbnail(3425013,"209331","","RIOM_08_D3_ 025_thumb.jpg",130,93,1);thumbnails[3425017]=new thumbnail(3425017,"209331","","RIOM_08_D3_ 288_thumb.jpg",130,93,1);thumbnails[4242863]=new thumbnail(4242863,"251290","","TT09_PS3__0101_thumb.jpg",130,93,1);thumbnails[4242902]=new thumbnail(4242902,"251290","","TT09_PS3__1221_thumb.jpg",130,93,1);thumbnails[4242904]=new thumbnail(4242904,"251290","","TT09_PS__098_thumb.jpg",130,93,1);thumbnails[4242921]=new thumbnail(4242921,"251290","","TT09_PS__199_thumb.jpg",130,93,1);thumbnails[4242931]=new thumbnail(4242931,"251290","","TT09_PS__294_thumb.jpg",130,93,1);thumbnails[4243032]=new thumbnail(4243032,"251290","","TT09_PS__387_thumb.jpg",130,93,1);thumbnails[4243127]=new thumbnail(4243127,"251290","","TT09_RD1__247_thumb.jpg",130,93,1);thumbnails[4243139]=new thumbnail(4243139,"251290","","TT09_RD2__035_thumb.jpg",130,93,1);thumbnails[4243155]=new thumbnail(4243155,"251290","","TT09_RD2__072_thumb.jpg",130,93,1);thumbnails[4243166]=new thumbnail(4243166,"251290","","TT09_RD2__164_thumb.jpg",130,93,1);thumbnails[4243183]=new thumbnail(4243183,"251290","","TT09_RD2__292_thumb.jpg",130,93,1);thumbnails[4243274]=new thumbnail(4243274,"251290","","TT09_RD3__135_thumb.jpg",130,93,1);var galleries=new Object();galleries[268933]=new gallery(268933,"4664923,4664921,4664909,4664908,4664907,4664905,4664899,4664897,4664895,4664887","Manx Classic Weekend Trial 2009","gallery",[4664884,4664885,4664887,4664895,4664897,4664899,4664905,4664907,4664908,4664909,4664921,4664923]);galleries[209329]=new gallery(209329,"3424968,3424965,3424959,3424953,3424950,3424946,3424936,3424902","World Rally Championship","gallery",[3424902,3424936,3424946,3424950,3424953,3424959,3424965,3424968]);galleries[209331]=new gallery(209331,"3425017,3425013,3425010,3425008,3425002,3424996,3424990,3424984","British Rally Championship","gallery",[3424984,3424990,3424996,3425002,3425008,3425010,3425013,3425017]);galleries[251290]=new gallery(251290,"4243274,4243183,4243166,4243155,4243139,4243127,4243032,4242931,4242921,4242904","TT 2009","gallery",[4242863,4242902,4242904,4242921,4242931,4243032,4243127,4243139,4243155,4243166,4243183,4243274]);var imageSets=new Object();imageSets[1]="1824239,1515860,1515857,1515855,1515854";imageSets[3]="4664923,4664921,4664909,4664908,4664907,4664905,4664899,4664897,4664895,4664887,4664885,4664884,4243274,4243183,4243166,4243155,4243139,4243127,4243032,4242931,4242921,4242904,4242902,4242863,3425017,3425013,3425010,3425008,3425002,3424996,3424990,3424984,3424968,3424965,3424959,3424953,3424950,3424946,3424936,3424902,1991617,1824239,1515860,1515857,1515855,1515854";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/arcowley/images";break}switch(a){case 1:b="http://www1.clikpic.com/arcowley/images";break}switch(a){case 2:b="http://admin.clikpic.com/arcowley/images";break}switch(a){case 4:b="http://www.clikchurch.com/arcowley/images";break}switch(a){case 5:b="http://www2.clikpic.com/arcowley/images";break}switch(a){case 15:b="http://www3.clikpic.com/arcowley/images";break}switch(a){case 21:b="http://www6.clikpic.com/arcowley/images";break}switch(a){case 18:b="http://www4.clikpic.com/arcowley/images";break}switch(a){case 19:b="http://www5.clikpic.com/arcowley/images";break}switch(a){case 22:b="http://tpc5/clikpic/arcowley/images";break}switch(a){case 23:b="http://tpc10/clikpic/arcowley/images";break}switch(a){case 24:b="http://tpc15/clikpic/arcowley/images";break}switch(a){case 25:b="http://tpc16/clikpic/arcowley/images";break}switch(a){case 31:b="http://www7.clikpic.com/arcowley/images";break}switch(a){case 32:b="http://admin2.clikpic.com/arcowley/images";break}switch(a){case 33:b="http://www8.clikpic.com/arcowley/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="Manx Motor Sport Photos by Andrew Cowley: "+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>Photographer: </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> 				&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+'<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+'")'})}}};