var nW=70;function m_add_your_comment_box(){return true}function get_limited(d){if(!d){return""}var l="</p>";if($.browser.msie){l="\n"}else{var f=new RegExp(l,"m");var g=d.split(f);var e=new RegExp("<br />","m");var c=d.split(e);if(c.length>g.length){l="<br />"}}var m=new RegExp(l,"m");var i=new RegExp(" +","m");var k=d.split(m);var b=0;var a=0;for(true;b<nW&&a<k.length;++a){var j=k[a].split(i);b+=j.length}k.length=a;var h=k.join(l)+l;return h}function m_hs_sign_in_words(b){var a=get_limited(b);var c=a+'<div id="comment_box" style="padding:5px; background-repeat:no-repeat; width:490px;  clear:both; background-color:#FFFDEE; border-bottom:#CCCCCC; border-right:#CCCCCC; border-bottom-style:solid;  border-right-style:solid; border-right-width:2px; border-bottom-width:2px; background-repeat:no-repeat;"><h3 class="h3"  style="margin-top:3px; font-size:18px; color:#009933">Sign in to read the full article</h3>  <p style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">heraldscotland.com is available for free  to registered users. Registering gives you full access to all articles, daily news headlines by email and allows you to share your opinions. It also means you can help us make the services we offer more relevant to you. It\'s easy to register and it\'s completely free.  <a href="http://'+myLogin+myHost+"/login.cgi?rw=1&referrer="+escape(document.location.href)+'">Sign in</a> or <a href="http://'+myLogin+myHost+"/register.cgi?rw=1&referrer="+escape(document.location.href)+'">Register now</a></p></div>';return c}m__restrict_enable=true;m__is_comment_detail=false;if(document.location.pathname.match(/\/comment\/[^-]+-[^-]+(-[^-]+)*\/.+/)&&$("div.comment-article-body")){m__is_comment_detail=true}m__is_technology_detail=false;if(document.location.pathname.match(/\/technology\/([a-z0-9-]+\/)*[a-z0-9.-]+[0-9.]+$/)){m__is_technology_detail=true}m__is_newssport_detail=false;if(document.location.pathname.match(/\/(news|sport)\/([a-z0-9-]+\/)*[a-z0-9.-]+[0-9.]+$/)){m__is_newssport_detail=true}m__is_article_detail=false;if(document.location.pathname.match(/\/[a-z0-9-]+\/([a-z0-9-]+\/)*[a-z0-9.-]+[0-9.]+$/)){if((!document.location.pathname.match(/^\/services|misc/))&&(!document.location.pathname.match(/\/search-[0-9.]+$/))){m__is_article_detail=true}}m__is_diary_detail=false;m__hour_now=-1;if(document.location.pathname.match(/\/comment\/ken-smiths-diary\/[a-z0-9.-]+[0-9]\.[0-9]+$/)){m__is_diary_detail=true;var mmd=new Date();m__hour_now=mmd.getHours()}m__is_archived_content=false;var myPP=document.location.pathname;var m__is_ae_section=myPP.match(/\/(classical|arts-ents)(\/[^\/]+)?$/);var m__is_ae_detail=myPP.match(/\/(classical|arts-ents)\/[^\/]+\/.+/);var m__is_homepage=myPP.match(/^\/?$/);var m__starratings_enable=true;var m__error_title=new String("");var m__error_message=new String("");var m__error_style="red";var error_where="div.thirds-two";var m__allow_comments=false;var m__display_error_if=true;if(myPP.match(/\/news\/([^\/]+\/)*[^\/]+[0-9\.]+$/)){if(!myPP.match(/\/(election(-[0-9]+)?|crime-courts)\//)){m__allow_comments=true}}else{if(myPP.match(/\/[a-z-]+\/([^\/]+\/)*[^\/]+[0-9\.]+$/)){if(!myPP.match(/\/comment\/ken-smiths-diary\//)){m__allow_comments=true}}}if(!m__is_article_detail){m__allow_comments=false}if(myPP.match(/books-and-poetry\/your-100-best-scottish-novels$/)){m__allow_comments=true}if(myPP.match(/\/quiz\//)){m__allow_comments=false}function m__set_error_on_sunday(){if(typeof(m__error_message)!="undefined"&&m__error_message.length>0){return}var a=new Date();var c=a.getDay();var b=a.getHours();if(c==0&&b>=3&&b<12){m__error_style="blue";m__error_message="<strong>The latest content from The Sunday Herald will be available today at 12 noon UK time.</strong>"}return true}function m__check_error(){var a={red:{bgcolor:"#FADCEA",h3color:"#FF0000"},blue:{bgcolor:"#DCF3F5",h3color:"#003366"},green:{bgcolor:"#BFFFBF",h3color:"#006633"},orange:{bgcolor:"#FFB062",h3color:"#750000"},purple:{bgcolor:"#E8D0E8",h3color:"#663333"},turquoise:{bgcolor:"#D9FFEC",h3color:"#003366"},yellow:{bgcolor:"#F7EF99",h3color:"#333333"}};if(m__display_error_if&&m__error_message.length){var b=a[m__error_style];var c='<div style="padding: 5px; width: 620px; clear: both; background-color: '+b.bgcolor+';  border-bottom: 2px solid rgb(204, 204, 204); border-right: 2px solid rgb(204, 204, 204); background-repeat: no-repeat;" id="comment_box"><h3 style="margin-top: 3px; font-size: 18px; color: '+b.h3color+';" class="h3">'+m__error_title+'</h3><p style="font-family: Arial,Helvetica,sans-serif; font-size: 12px;">'+m__error_message+"</p></div>";$(error_where).prepend(c)}return true}function m__fix_contact_link(){$("A").each(function(){var a=new String($(this).attr("href"));if(a&&a.match(/\/contact-us-element-7\.698$/)){$(this).attr("href","http://www.heraldscotland.com/services/heraldscotland-help-faqs-1.819361")}});return true}function m__set_most_commented(){var a=$("div#most-commented-content").html();if(a&&a.length){$.ajax({type:"GET",url:"http://"+myLogin+myHost+"/gmc.cgi",dataType:"jsonp",success:function(c){var d="";for(var b=0;b<5&&b<c.length;++b){d+='<li><a href="'+c[b].url+'">'+c[b].headline+"</a></li>"}$("div#most-commented-content ul.mostread").append(d);$("#most-read").removeClass("on");$("#most-read-content").removeClass("on");$("#most-commented").addClass("on");$("#most-commented-content").addClass("on");return true}})}return true}function m__set_premier_jobs(){$.ajax({type:"GET",url:"http://"+myLogin+myHost+"/gj.cgi",dataType:"jsonp",success:function(b){var c="";for(var a=0;a<b.length;++a){c+='<li><a href="http://www.s1jobs.com/job/'+b[a].vacancy_id+'.html" target="_blank">'+b[a].job_title+"</a><br/>"+b[a].agent_name+"<br/>"+b[a].salary_modifier+"</li>"}$("ul#premierjobs").append(c);return true}});return true}function m__fix_archive_mainsection(){if(myPP.match(/^\/2\.377\/archive-index-7\.550\/[a-z]+/)){$("div.mainsection").css("float","left")}return true}function m__add_star_ratings(){if(m__starratings_enable){var a=new Array();if(m__is_ae_detail){a.push({select:"DIV.article-body > P",width:111,height:21},{select:"DIV.article-body > P > STRONG",width:111,height:21})}else{if(m__is_ae_section){a.push({select:"DIV.article-summary > P > A",width:55,height:11},{select:"DIV.top-story > P.abstract > A",width:83,height:16})}else{if(m__is_homepage){a.push({select:"P.abstract > A",width:73,height:14})}}}jQuery.each(a,function(){var c=this.width;var b=this.height;$(this.select).each(function(){var d=$(this).html();if(d.match(/^(Star rating: )?[H\*]+$/)){var f=d.replace(/[^H\*]+/,"");var e=f.length;var g="star"+(e==1?"":"s");d=d.replace(/[H\*]+/,'<img alt="'+e+" "+g+'" width="'+c+'" height="'+b+'" border="0" title=""  src="http://www.s1play.com/images/global/'+e+'stars.gif" />');$(this).html(d)}})})}return true}myContentSelector="div.article-body";if(typeof(m__is_comment_detail)!="undefined"){if(m__is_comment_detail){myContentSelector="div.comment-article-body";var testIt=new String($(myContentSelector).html());if((!testIt)||(!testIt.length)||testIt.length<10){myContentSelector="div.article-body"}}}function m__run_restrict(){if(typeof(m__restrict_enable)!="undefined"){if(m__restrict_enable){if(typeof(m__is_article_detail)!="undefined"){if(m__is_article_detail){if(typeof(m__is_diary_detail)!="undefined"&&m__is_diary_detail&&m__hour_now>=4&&m__hour_now<18){mypubdate=$("p.pubdate").html();topdate=$("DIV#logo > P").html();mypubdate=mypubdate.replace(/Published on /,"");topdate=topdate.replace(/^[A-Z][a-z]+ /,"");topdate=topdate.replace(/([A-Z][a-z][a-z])[a-z]+/,"$1");if(mypubdate==topdate){var c=$(myContentSelector).html();var b=c.split(/[\n\r]+/);var f="";if($.browser.msie){var e=0;for(var a=3;(e==0)&&a<b.length;++a){if(b[a].match(/[A-Z][A-Z]/)){e=a}}if(e>0){while(b.length>e){b.pop()}}f=b.join("")}else{c=b.join(" ");f=c.replace(/<p>[A-Z][A-Z]+ .+$/,"")}$(myContentSelector).html(f+"<p><strong>Read the full Herald Diary in today's paper.</strong></p>");return true}}if(!m__is_signed_in){var c=$(myContentSelector).html();var d=m_hs_sign_in_words(c);$(myContentSelector).html(d).show();$("DIV#mpu2-source").hide();return true}}}}}$(myContentSelector).show();return true}$(function(){m__add_star_ratings();m__fix_contact_link();m__set_error_on_sunday();m__check_error();m__fix_archive_mainsection();m__set_most_commented();m__set_premier_jobs();$.ajax({url:"http://"+myLogin+myHost+"/pv.cgi?r="+escape(document.location.href)+"&mm="+escape(m__tLogged),type:"GET",dataType:"jsonp",success:function(c){return true}});var d=28;if(m__is_article_detail){var i=$("p.pubdate").html();if(i){var k=i.match(/[^ ]+/g);if(k&&k.length==3){var e=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var p=-1;for(var o=0;p==-1&&o<e.length;o++){if(k[1]==e[o]){p=o}}if(p>-1&&k[0]&&k[0]>=1&&k[0]<=31&&k[2]&&k[2]>=1800&&k[2]<=3000){var m=new Date(k[2],p,k[0]);var l=m.valueOf();var n=new Date();var j=n.valueOf();if(j&&l&&j-l>(86400*1000*d)){m__is_archived_content=true}}}}}var a=function(r,s){var c=r.toFixed(s);if(c==r){return r.toString()}return c};var h="<style type='text/css'>#weather-widget{float: left;background: #fff;width: 184px; height: 50px; border: solid 2px #10888c; border-radius:5px; padding: 5px; position:relative; left:480px; top:-20px;}#weather-widget h3 {color:#2c4989; font-size:12px; }#weather-location {font-size: 18px !important; font-weight: normal;}#temp-holder{font-size: 18px !important; position: relative; top:-37px; left: 90px; color: #10888c;}#weather-widget img {width: auto; height: auto; position:relative;float:right;top:-55px;}#logo p {left: 0px;}#change-loc {background: url(http://www.heraldscotland.com/ui/img/icon-sprite.gif); background-position: -424px -80px; background-repeat: no-repeat; padding: 0 10px 5px 10px;}";h+="#mini-dog { display: none;position: absolute !important; top: 35px !important; left: 125px !important; z-index: 100 !important; width: 56px !important; }#weather-widget { width: 249px; left: 445px; } #weather-widget img { left: -40px; } #mini-dog { display: none;margin-left: 74px; margin-top: -30px; }#weather-icon img { left: -61px; }</style>";weatherWidgetHTML="<div id='weather-widget'><h3>WEATHER</h3><h3 id='weather-location'>Edinburgh</h3><a href='http://www.heraldscotland.com/weather/' id='change-loc'>Change location<img id='mini-dog' src='http://www.s1now.com/images/mini-dog.png'/></a><div id='weather-icon'><img src='http://login.heraldscotland.com/weather/images/fair-small-night.png'/></div><div id='temp-holder'><span id='maxtemp'></span>&deg;C</div></div>";h+=weatherWidgetHTML;$("#logo").append(h);var g=function(v){var c="",u=false,s,x;if(typeof(v[0].wdaynow)!="undefined"&&(v[0].wdaynow==0||v[0].wdaynow==6)){$("iframe#weatheriframe").hide()}s=v[0].hournow+6;if(s<6){s="0"}else{if(s<12){s="6"}else{if(s<18){s="2"}else{s="8"}}}if(typeof v[0].forecast!="undefined"){$(v[0].forecast).each(function(A){if(s===this.datetime.substr(12,1)){x=A;return false}return true});var t=v[0].forecast[x].weathercondition;var z=a((parseFloat(v[0].forecast[x].tempmax)+parseFloat(v[0].forecast[x].tempmin))/2,1);var r=v[0].forecast[x].chancerain}$("#weather-condition").text(t);$("#maxtemp").text(z);$("#chance-of-rain").text(r);switch(t){case"Clear":c+="fair";u=true;break;case"Mostly clear":c+="fair";u=true;break;case"Clear spells":c+="fair";u=true;break;case"Broken cloud":c+="fair";u=true;break;case"Cloudy":c+="cloudy";u=false;break;case"Fog":c+="fog";u=false;break;case"Dense Fog":c+="fog";u=false;break;case"Fog patches":c+="fog";u=false;break;case"Mist":c+="mist";u=false;break;case"Mostly Cloudy":c+="cloudy";u=false;break;case"Light rain":c+="showers";u=false;break;case"Drizzle":c+="showers";u=false;break;case"Light showers":c+="showers";u=false;break;case"Light hail showers":c+="showers";u=false;break;case"Hail shower":c+="showers";u=false;break;case"Thunderstorm":c+="thundery";u=false;break;case"Thundery":c+="thundery";u=false;break;case"Snow":c+="snow";u=false;break;case"Snowy":c+="snow";u=false;break;case"Sleet":c+="sleet";u=false;break;case"Moderate showers":c+="showers";u=false;break;case"Heavy showers":c+="showers";u=false;break;case"Patchy drizzle":c+="showers";u=false;break;case"Rain":c+="rain";u=false;break;default:break}var w=0,y="";s=v[0].hournow+6;if((s<6)||(s>18)){if(u){y="-night"}}$("#weather-icon").html("<img src='http://login.heraldscotland.com/weather/images/"+c+"-small"+y+".png'/>");return true};var b=function(c){$.ajax({url:"http://login.heraldscotland.com/make-weather.cgi?location="+escape(c),dataType:"jsonp",success:function(r){g(r);return true}});return true};if($.cookie("herald-weather-location")){b($.cookie("herald-weather-location"));$("#weather-location").text($.cookie("herald-weather-location"))}else{b("Edinburgh");$("#weather-location").text("Edinburgh")}var f=$.cookie("herald-weather-location");var q=function(){if(f!=$.cookie("herald-weather-location")){b($.cookie("herald-weather-location"));$("#weather-location").text($.cookie("herald-weather-location"))}return true};q();return true});true;

