(function(n,t){function tt(n,t){return(n+"").length===1?t+""+n:n}function kt(n){return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n]}function dt(n){var t=tt(n.getDate(),"0"),i=kt(n.getMonth()),r=nt.getFullYear()-2e3,u=tt(n.getHours(),"0"),f=tt(n.getMinutes(),"0");return t+" "+i+" "+r+" - "+u+":"+f}var d,f,e,o,r,vt,yt,ut,c,l,a,v,ft,g,u,pt="data-max-page",i="",y="columnAscending",s="columnDescending",et="columnSortable",ri=new Date,nt=new Date,w=0,b=new Date,ot=Math.round(b.getTime()/1e3),wt=36e3;n.init=function(n){d=n.table;f=d.find("tbody");e=n.expandLink;o=n.shrinkLink;r=n.pageSize;vt=n.pagingWrapper;g=n.service;c="#"+n.iconSortLink;ut="#"+n.resetSortLink;l="#"+n.dateSortLink;a="#"+n.locationSortLink;v="#"+n.descriptionSortLink;ft="#"+n.lastUpdateContainer;u=parseInt(f.attr("data-start-page"),10);gt();ni();bt();ht();lt(n.popTimeout)};n.resetSort=function(){return i="",h(c),h(l),h(v),h(a),p(),!1};n.iconSort=function(){return k(c),i="icon",$(c).hasClass(s)&&(i+="desc"),p(),!1};n.dateSort=function(){return k(l),i="date",$(l).hasClass(s)&&(i+="desc"),p(),!1};n.locationSort=function(){return k(a),i="location",$(a).hasClass(s)&&(i+="desc"),p(),!1};n.descriptionSort=function(){return k(v),i="description",$(v).hasClass(s)&&(i+="desc"),p(),!1};var p=function(){w=0;it(st,0,u*r,i)},bt=function(){$(c).click(n.iconSort);$(l).click(n.dateSort);$(v).click(n.descriptionSort);$(a).click(n.locationSort);$(ut).click(n.resetSort)},k=function(n){if($(n).hasClass(y)){$(n).removeClass(y);$(n).addClass(s);return}if($(n).hasClass(s)){$(n).removeClass(s);$(n).addClass(y);return}h(c);h(l);h(v);h(a);$(n).removeClass(et);$(n).addClass(y)},h=function(n){$(n).removeClass(y);$(n).removeClass(s);$(n).addClass(et)},st=function(n){f.find("tr").remove();var i=n.d;t.each(i,function(n,t){f.append(at(t))})};var ht=function(){$(ft).text(dt(nt))},it=function(n,t,i,r){$.ajax({type:"POST",url:g+"/GetItems",contentType:"application/json; charset=utf-8",data:"{ 'pageIndex' : "+t+", 'pageSize': "+i+", 'sortedBy' : '"+r+"', 'timestamp': "+ot+" }",dataType:"json",success:function(t){n(t);window._paq.push(["trackEvent","ARC","LTI GetItems"])}})},gt=function(){e.length===0&&(e=$('<a href="#" class="feed-show-more">View More<\/a>'),e.hide(),e.insertAfter("#jumpToFeedTop"));e.click(function(n){n.preventDefault();b=new Date;it(function(n){var i=n.d;t.each(i,function(n,t){f.append(at(t))});u+=1;rt()},u,r,i)})},ni=function(){o.length===0&&(o=$('<a href="#" class="feed-show-less">View Less<\/a>'),o.hide(),o.insertAfter("#jumpToFeedTop"));o.click(function(n){var i,e,t;n.preventDefault();b=new Date;i=f.find("tr").length;i>r&&(e=Math.ceil(i/r),t=(e-1)*r,t<r&&(t=r),f.find("tr:gt("+(t-1)+")").remove(),u-=1,rt())})},rt=function(){var n=f.attr(pt);u==1?o.hide():ct(o);u==n?e.hide():ct(e)},ct=function(n){n.css("display","inline")},lt=function(n){nt=new Date;yt=setTimeout(function(){ii(function(){lt(n)})},n*1e3)},ti=function(n){window._paq.push(["trackEvent","ARC","LTI GetPopUpdates"]);n&&n.d&&(it(st,0,u*r,i),rt());ht()},ii=function(r){if(Math.abs((new Date-b)/1e3)<wt){w=w+1;i.length>0&&w>=5&&n.resetSort();var f=[];d.find("tbody tr").each(function(){f.push(t(this).attr("data-key"))});$.ajax({type:"POST",url:g+"/GetPopUpdates",contentType:"application/json; charset=utf-8",data:"{ 'currentIds': "+JSON.stringify(f)+", 'pages': "+u+", 'timestamp': "+ot+" }",dataType:"json",success:ti});r&&r()}else window.alert("The Live Traffic Information automatic update has stopped as this session has been inactive for 10 hours. Please refresh the page to restart automatic updates.")},at=function(n){var t="";return t+="<tr",n.IsPinned&&(t+=' class="pinned"'),t+=' data-key="'+n.Key+'">',t+='<td class="icon">',n.MapLink&&(t+='<a href="'+n.MapLink+'">'),t+='<img src="'+n.Icon+'" />',n.MapLink&&(t+="<\/a>"),t+="<\/td>",t+="<td>"+n.Date+"<\/td>",t+="<td>"+n.Location+"<\/td>",t+="<td>"+n.Description+"<\/td>",t+='<td class="details">',n.DetailsLink&&(t+='<a href="'+n.DetailsLink+'">details<\/a>'),n.MapLink&&(t+='<a href="'+n.MapLink+'">map<\/a>'),t+="<\/td>",t+"<\/tr>"}})(window.$lti=window.$lti||{},$,undefined);jQuery.cookie=function(n,t,i){var u,r,f,e;return arguments.length>1&&String(t)!=="[object Object]"?(i=jQuery.extend({},i),(t===null||t===undefined)&&(i.expires=-1),typeof i.expires=="number"&&(u=i.expires,r=i.expires=new Date,r.setDate(r.getDate()+u)),t=String(t),document.cookie=[encodeURIComponent(n),"=",i.raw?t:encodeURIComponent(t),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")):(i=t||{},e=i.raw?function(n){return n}:decodeURIComponent,(f=new RegExp("(?:^|; )"+encodeURIComponent(n)+"=([^;]*)").exec(document.cookie))?e(f[1]):null)},function(n,t){function k(){l(!0)}if(n.respond={},respond.update=function(){},respond.mediaQueriesSupported=t,!t){var i=n.document,a=i.documentElement,e=[],u=[],r=[],o={},v=30,f=i.getElementsByTagName("head")[0]||a,s=f.getElementsByTagName("link"),h=[],y=function(){for(var f=s,c=f.length,r=0,t,i,u,e;r<c;r++)t=f[r],i=t.href,u=t.media,e=t.rel&&t.rel.toLowerCase()==="stylesheet",!i||!e||o[i]||(t.styleSheet&&t.styleSheet.rawCssText?(w(t.styleSheet.rawCssText,i,u),o[i]=!0):/^([a-zA-Z]+?:(\/\/)?)/.test(i)&&i.replace(RegExp.$1,"").split("/")[0]!==n.location.host||h.push({href:i,media:u}));p()},p=function(){if(h.length){var n=h.shift();d(n.href,function(t){w(t,n.href,n.media);o[n.href]=!0;p()})}},w=function(n,t,i){var o=n.match(/@media[^\{]+\{([^\{\}]+\{[^\}\{]+\})+/gi),s=o&&o.length||0,t=t.substring(0,t.lastIndexOf("/")),v=function(n){return n.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+t+"$2$3")},y=!s&&i,h=0,r,c,f,a,p;for(t.length&&(t+="/"),y&&(s=1);h<s;h++)for(r=0,y?(c=i,u.push(v(n))):(c=o[h].match(/@media ([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,u.push(RegExp.$2&&v(RegExp.$2))),a=c.split(","),p=a.length;r<p;r++)f=a[r],e.push({media:f.match(/(only\s+)?([a-zA-Z]+)(\sand)?/)&&RegExp.$2,rules:u.length-1,minw:f.match(/\(min\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1),maxw:f.match(/\(max\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1)});l()},c,b,l=function(n){var w="clientWidth",k=a[w],d=i.compatMode==="CSS1Compat"&&k||i.body[w]||k,y={},g=i.createDocumentFragment(),tt=s[s.length-1],nt=(new Date).getTime(),t,o,h,p;if(n&&c&&nt-c<v){clearTimeout(b);b=setTimeout(l,v);return}c=nt;for(o in e)t=e[o],(!t.minw&&!t.maxw||(!t.minw||t.minw&&d>=t.minw)&&(!t.maxw||t.maxw&&d<=t.maxw))&&(y[t.media]||(y[t.media]=[]),y[t.media].push(u[t.rules]));for(o in r)r[o]&&r[o].parentNode===f&&f.removeChild(r[o]);for(o in y)h=i.createElement("style"),p=y[o].join("\n"),h.type="text/css",h.media=o,h.styleSheet?h.styleSheet.cssText=p:h.appendChild(i.createTextNode(p)),g.appendChild(h),r.push(h);f.insertBefore(g,tt.nextSibling)},d=function(n,t){var i=g();i&&(i.open("GET",n,!0),i.onreadystatechange=function(){i.readyState==4&&(i.status==200||i.status==304)&&t(i.responseText)},i.readyState!=4)&&i.send(null)},g=function(){var n=!1;try{n=new XMLHttpRequest}catch(t){n=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return n}}();y();respond.update=y;n.addEventListener?n.addEventListener("resize",k,!1):n.attachEvent&&n.attachEvent("onresize",k)}}(this,function(n){if(n.matchMedia)return!0;var f,i=document,r=i.documentElement,o=r.firstElementChild||r.firstChild,e=!i.body,u=i.body||i.createElement("body"),t=i.createElement("div");return t.id="mq-test-1",t.style.cssText="position:absolute;top:-99em",u.appendChild(t),t.innerHTML='_<style media="only all"> #mq-test-1 { width: 9px; }<\/style>',e&&r.insertBefore(u,o),t.removeChild(t.firstChild),f=t.offsetWidth==9,e?r.removeChild(u):u.removeChild(t),f}(this)),function(n){function u(n){$.cookie("switchSite",n,{expires:365,path:"/"})}function f(){return $("#mobSwitchRemember input:checkbox").is(":checked")}function o(){var n='<div id="mobSwitcher"><div id="mobpanel"><p>You appear to be accessing this on a hand-held device. Would you like to view our <b>mobile website<\/b>?<\/p><ul><li class="yes"><a href="'+i+'">Yes<\/a><\/li><li class="no"><a href="#">No<\/a><\/li><\/ul><label for="switchChoice" id="mobSwitchRemember"><input type="checkbox" id="switchChoice"> Remember my choice*<\/label><p class="cookie">*Your selection will be stored as a cookie on your device. See Traffic Scotland help for further information on cookies<\/p><\/div><\/div>';$(n).insertBefore("#pageholder")}var r=$.cookie("switchSite"),i,e=480,t={yesRecurring:"yesRecurring",noRecurring:"noRecurring",noSession:"noSession"};n.init=function(n){(n&&n.mobUrl&&(i=n.mobUrl),n&&n.maxWidth&&(i=n.maxWidth),window.innerWidth>e||r===t.noRecurring||r===t.noSession)||(r===t.yesRecurring?document.location=i:(o(),$("li.no").click(function(n){f()?u(t.noRecurring):$.cookie("switchSite",t.noSession);n.preventDefault();$("#mobSwitcher").css("display","none")}),$("li.yes a").click(function(){f()&&u(t.yesRecurring)})))}}(window.$siteSwitcher=window.$siteSwitcher||{})