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[6162635]=new thumbnail(6162635,"338286","TANGERINE TREES wins at Hamilton trained by Brian Smart with Paul Hanagan up.","5TT_WIN_thumb.JPG",130,83,15);thumbnails[4597704]=new thumbnail(4597704,"332478","COWDENBEATH v ALLOA ","3_CLATTER1_thumb.JPG",123,130,15);thumbnails[3957741]=new thumbnail(3957741,"332478","ALLOA v QUEENS PARK RECS PARK 25TH APRIL 2009","111_thumb.JPG",130,114,15);thumbnails[5285272]=new thumbnail(5285272,"332460","HEARTS v CELTIC at TYNECASTLE 20.12.2009","2tangle_thumb.JPG",130,87,15);thumbnails[5285277]=new thumbnail(5285277,"281284","","1EYES_thumb.JPG",106,130,15);thumbnails[5285279]=new thumbnail(5285279,"332460","","1CLOSE_UP_thumb.JPG",130,116,15);thumbnails[5314826]=new thumbnail(5314826,"281284","","1HIGH_UP_thumb.JPG",105,130,15);thumbnails[5314875]=new thumbnail(5314875,"332460","","1TUG_thumb.JPG",130,125,15);thumbnails[5542776]=new thumbnail(5542776,"314032","SILVER BY NATURE","1silver_eye_thumb.JPG",130,94,15);thumbnails[5812292]=new thumbnail(5812292,"332461","HAM v KILLIE 17 04 2010","12ND_GOAL_thumb.JPG",130,94,15);thumbnails[5886431]=new thumbnail(5886431,"332460","RANGERS v HEARTS IBROX APRIL 2010","1DRIVE_ON_thumb.JPG",130,126,15);thumbnails[5886444]=new thumbnail(5886444,"332459","","1_AND_2_AND_211_thumb.JPG",130,107,15);thumbnails[5886448]=new thumbnail(5886448,"332459","","INCHING_PAST_thumb.JPG",130,68,15);thumbnails[5886450]=new thumbnail(5886450,"332459","","218_thumb.JPG",130,67,15);thumbnails[5886452]=new thumbnail(5886452,"332459","","HITCH_A_RIDE_thumb.JPG",130,72,15);thumbnails[5886453]=new thumbnail(5886453,"332459","","16_leads_the_way_thumb.JPG",130,84,15);thumbnails[5886456]=new thumbnail(5886456,"332460","","2pen_shout_thumb.JPG",130,112,15);thumbnails[5925246]=new thumbnail(5925246,"338286","CAWDOR WINS AT HAMILTON","1CAWDOR_WINS_THE_525_thumb.JPG",130,107,15);thumbnails[5956932]=new thumbnail(5956932,"314032","BEIN WINS AT PERTH MAY 2010","1BEIDH_TINE_ANSEO_thumb.JPG",130,97,15);thumbnails[5956933]=new thumbnail(5956933,"314032","ADVICE FROM AN OLD HAND","1CAM_N_SCU_thumb.JPG",130,115,15);thumbnails[5956935]=new thumbnail(5956935,"314032","","1JACK_2ND_thumb.JPG",84,130,15);thumbnails[5959341]=new thumbnail(5959341,"332463","PROFICIENCY at PERTH","1PROFICIENCY_thumb.JPG",130,127,15);thumbnails[5959346]=new thumbnail(5959346,"332463","","1ROSSINI_thumb.JPG",130,116,15);thumbnails[5959509]=new thumbnail(5959509,"332460","","1GOAL_C_thumb.JPG",85,130,15);thumbnails[5959657]=new thumbnail(5959657,"332460","HEARTS v CELTIC MAY 2010","1DIRECT_HIT_thumb.JPG",130,86,15);thumbnails[5960125]=new thumbnail(5960125,"332461","HAMILTON v ST JOHNSTONE","13RD_GOAL_2_thumb.JPG",130,93,15);thumbnails[5960132]=new thumbnail(5960132,"332461","CELEBRATE PORTUGESE STYLE","1112ND_GOAL_CELS_9D762D9D-1D09-001F-9919D483F56B57D2_thumb.JPG",81,130,15);thumbnails[5960145]=new thumbnail(5960145,"332461","","1JUMP_thumb.JPG",113,130,15);thumbnails[5960167]=new thumbnail(5960167,"332460","","1CHALLENGE_thumb.JPG",122,130,15);thumbnails[5960169]=new thumbnail(5960169,"332460","","1WEIR_FOUL_thumb.JPG",130,124,15);thumbnails[5960173]=new thumbnail(5960173,"332478","ALLOA v Cowdenbeath May 2010 at ALLOA ","1FLYING_thumb.JPG",130,108,15);thumbnails[5960176]=new thumbnail(5960176,"332478","ALLOA v Cowdenbeath","2MARK_BROWN_thumb.JPG",130,127,15);thumbnails[5960199]=new thumbnail(5960199,"336474","MISS ALEXANDER at PERTH","1MISS_L_thumb.JPG",101,130,15);thumbnails[5960211]=new thumbnail(5960211,"332463","","CNV00156_thumb.JPG",130,87,15);thumbnails[5962255]=new thumbnail(5962255,"338286","HAMILTON RACES","1WILLIAM_MORGAN_GETS_3RD_thumb.JPG",130,85,15);thumbnails[5962325]=new thumbnail(5962325,"332462","OVER THE TOP AT HAMILTON","12_HAM_FIN_thumb.JPG",130,68,15);thumbnails[5962328]=new thumbnail(5962328,"338285","GREG FAIRLEY","1GREG_FAIRLEY_thumb.JPG",130,121,15);thumbnails[5962332]=new thumbnail(5962332,"338285","PAUL MULRENNAN","1PAUL_MULRENNAN_thumb.JPG",86,130,15);thumbnails[5962391]=new thumbnail(5962391,"338285","PJ McDONALD at Hamilton","1pj_thumb.JPG",80,130,15);thumbnails[6009381]=new thumbnail(6009381,"338285","David Allan","1David_Allan_thumb.JPG",102,130,15);thumbnails[6009390]=new thumbnail(6009390,"332462","","Jackday_wins_the_840_for_Tim_Easterby_thumb.JPG",130,98,15);thumbnails[6009400]=new thumbnail(6009400,"332462","Jigajig (right) wins the apprentice handicap at Musselburgh on 21st May 2010 under Amy Ryan","1jigajigwhite_sleeves_wins_the_640__Musselb_21052010trained_by_Kevin_Ryan_ridden_by_Amy_Ryan_thumb.JPG",130,89,15);thumbnails[6009409]=new thumbnail(6009409,"338285","CATHY GANNON","Cathy_Gannon_thumb.JPG",110,130,15);thumbnails[6017504]=new thumbnail(6017504,"314032","GO SILVER BULLET","1GO_SILVER_BULLET_thumb.JPG",130,112,15);thumbnails[6017515]=new thumbnail(6017515,"314032","SUMMER SOUL","1SOUL_LEADS_thumb.JPG",130,113,15);thumbnails[6023620]=new thumbnail(6023620,"332463","Ollie Magern wins at Perth May 2010","1OLLIE_M_thumb.JPG",130,112,15);thumbnails[6023629]=new thumbnail(6023629,"314032","GO SILVER BULLET","1SILVER_B_thumb.JPG",103,130,15);thumbnails[6030582]=new thumbnail(6030582,"336474","","ap_thumb.JPG",71,130,15);thumbnails[6033867]=new thumbnail(6033867,"339250","","11_thumb.JPG",130,119,15);thumbnails[6041558]=new thumbnail(6041558,"332461","","13RD_GOAL_2_DB892BFC-24E8-5EC4-4FAFDFE7945B9CDF_thumb.JPG",130,93,15);thumbnails[6080169]=new thumbnail(6080169,"341331","STROBE, JUMPS AT PERTH MAY 2010","11STROBE_thumb.JPG",130,80,15);thumbnails[6095895]=new thumbnail(6095895,"332462","JUST LILLE wins on 5th June 2010","1JUST_LILLE_wins_the_450_trained_by_ANNE_DUFFIELD_and_ridden_by_BARRY_McHUGH_thumb.JPG",130,109,15);thumbnails[6158691]=new thumbnail(6158691,"341331","","1LOC_thumb.JPG",109,130,15);thumbnails[6168224]=new thumbnail(6168224,"341331","LOCHIEL prior to Lanark Silver Bell at Hamilton June 2010 ","1LOC_424965A6-24E8-5EC4-4FEBEE36EBC5D1D8_thumb.JPG",109,130,15);thumbnails[6295985]=new thumbnail(6295985,"","","RYAN_MOORE_thumb.JPG",116,130,15);thumbnails[6354352]=new thumbnail(6354352,"332462","BOLD BIDDER(right) wins 13th July 2010 ","MUSSELB_13072010_D300_103_thumb.JPG",130,120,15);thumbnails[3936508]=new thumbnail(3936508,"332461","HAMILTON v KILMARNOCK","CHALLENGE_thumb.JPG",129,130,15);thumbnails[5960178]=new thumbnail(5960178,"222178","ROBBIE KEANE","1ROBBIE_KEANE_thumb.JPG",93,130,15);thumbnails[5960217]=new thumbnail(5960217,"222178","","1-0_cel_thumb.JPG",90,130,15);var galleries=new Object();galleries[332478]=new gallery(332478,"3957741","ALLOA FOOTBALL CLUB","gallery",[4597704,3957741,5960173,5960176]);galleries[338285]=new gallery(338285,"6009409,6009381,5962391,5962332,5962328","FLAT JOCKEY SHOTS","gallery",[5962328,5962332,5962391,6009381,6009409]);galleries[332461]=new gallery(332461,"6041558,5960145,5960132,5960125,5812292,3936508","HAMILTON FOOTBALL CLUB","gallery",[5812292,5960125,5960132,5960145,6041558,3936508]);galleries[338286]=new gallery(338286,"6162635,5962255,5925246","HAMILTON RACES","gallery",[6162635,5925246,5962255]);galleries[332460]=new gallery(332460,"5886456","HEARTS FOOTBALL CLUB","gallery",[5285272,5285279,5314875,5886431,5886456,5959509,5959657,5960167,5960169]);galleries[332463]=new gallery(332463,"6023620,5960211,5959346,5959341","JUMP HORSE RACING","gallery",[5959341,5959346,5960211,6023620]);galleries[336474]=new gallery(336474,"6030582,5960199","JUMP JOCKEY SHOTS","gallery",[5960199,6030582]);galleries[314032]=new gallery(314032,"6023629,6017515,6017504,5956935,5956933,5956932,5542776","LUCINDA RUSSELL RACING","gallery",[5542776,5956932,5956933,5956935,6017504,6017515,6023629]);galleries[341331]=new gallery(341331,"6168224,6158691,6080169","LUCY AND ALAN NORMILES HORSES","gallery",[6080169,6158691,6168224]);galleries[332462]=new gallery(332462,"6354352,6095895,6009400,6009390,5962325","MUSSELBURGH RACES","gallery",[5962325,6009390,6009400,6095895,6354352]);galleries[339250]=new gallery(339250,"6033867","ODDS AND ENDS","gallery",[6033867]);galleries[281284]=new gallery(281284,"5314826,5285277","RUGBY","gallery",[5285277,5314826]);galleries[332459]=new gallery(332459,"5886453,5886452,5886450,5886448,5886444","STOCK CARS","gallery",[5886444,5886448,5886450,5886452,5886453]);galleries[222178]=new gallery(222178,"5960217,5960178","FOOTBALL","gallery",[5960178,5960217]);var imageSets=new Object();imageSets[1]="5886456,3936508";imageSets[2]="5886456,3957741";imageSets[3]="5886456,5542776";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/MikeB396/images";break}switch(a){case 1:b="http://www1.clikpic.com/MikeB396/images";break}switch(a){case 2:b="http://admin.clikpic.com/MikeB396/images";break}switch(a){case 24:b="http://tpc15/clikpic/MikeB396/images";break}switch(a){case 4:b="http://www.clikchurch.com/MikeB396/images";break}switch(a){case 5:b="http://www2.clikpic.com/MikeB396/images";break}switch(a){case 22:b="http://tpc5/clikpic/MikeB396/images";break}switch(a){case 23:b="http://tpc10/clikpic/MikeB396/images";break}switch(a){case 25:b="http://tpc16/clikpic/MikeB396/images";break}switch(a){case 15:b="http://www3.clikpic.com/MikeB396/images";break}switch(a){case 18:b="http://www4.clikpic.com/MikeB396/images";break}switch(a){case 19:b="http://www5.clikpic.com/MikeB396/images";break}switch(a){case 31:b="http://www7.clikpic.com/MikeB396/images";break}switch(a){case 32:b="http://admin2.clikpic.com/MikeB396/images";break}switch(a){case 33:b="http://www8.clikpic.com/MikeB396/images";break}switch(a){case 34:b="http://www9.clikpic.com/MikeB396/images";break}switch(a){case 35:b="http://admin3.clikpic.com/MikeB396/images";break}switch(a){case 37:b="http://admin4.clikpic.com/MikeB396/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="'+escape(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="MBSPORTSPHOTOS.CO.UK: "+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> 							"+(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+'")'})}}};