$(document).ready(function($){$('.header-menu-button').on("click",function(e){e.preventDefault()});$.fn.getCursorPosition=function(){var input=this.get(0);if(!input){return}if('selectionStart'in input){return input.selectionStart}else if(document.selection){input.focus();var sel=document.selection.createRange();var selLen=document.selection.createRange().text.length;sel.moveStart('character',-input.value.length);return sel.text.length-selLen}else{return 0}};$.fn.bindWithDelay=function(type,data,fn,timeout,throttle){if($.isFunction(data)){throttle=timeout;timeout=fn;fn=data;data=undefined}fn.guid=fn.guid||($.guid&&$.guid++);return this.each(function(){var wait=null;function cb(){var e=$.extend(true,{},arguments[0]);var ctx=this;var throttler=function(){wait=null;fn.apply(ctx,[e])};if(!throttle){clearTimeout(wait);wait=null}if(!wait){wait=setTimeout(throttler,timeout)}}cb.guid=fn.guid;$(this).bind(type,data,cb)})};var animation;var position=0;$('.close-button').click(function(){$('.emergency-message').slideUp();return false});$('.show-search').click(function(){$('.internal-site-search').toggleClass('show-input');return false});$('.nav-tabs a').click(function(event){$(this).tab('show');event.preventDefault();event.stopImmediatePropagation();window.location.hash=event.target.hash;return false});var url=document.location.toString();if(url.match('#')){$('.nav-tabs a[href$=#'+url.split('#')[1]+']').tab('show')}$(".footer-content table").wrap("
");$(".image-row a img").addClass("img-responsive");var originalFontSize=$('html').css('font-size');$(".small-text").click(function(){var currentFontSize=$('html').css('font-size');var currentFontSizeNum=parseFloat(currentFontSize,10);var newFontSize=currentFontSizeNum*0.8;if(newFontSize>="6.4"){$('html').css('font-size',newFontSize);return false}});$(".normal-text").click(function(){$('html').css('font-size',originalFontSize)});$(".large-text").click(function(){var currentFontSize=$('html').css('font-size');var currentFontSizeNum=parseFloat(currentFontSize,10);var newFontSize=currentFontSizeNum*1.2;if(newFontSize<="14.4"){$('html').css('font-size',newFontSize)}return false});function tabHeightFunc(){$('#transactionsTab li a').css("height","auto");var tabHeights=$('#transactionsTab li').map(function(){return $(this).height()}).get();var tabHeight=Math.max.apply(null,tabHeights);$('#transactionsTab li a').css("height",tabHeight)}$(window).on('resize',function(){tabHeightFunc()});tabHeightFunc();function serviceHeightWrapperFunc(){$('.service-tile a').css({height:'auto'});$('.service-tile a i').css({width:'auto',height:'auto','min-height':'150px','min-width':'150px'});var servicesHeights=$('.service-tile').map(function(){return $(this).height()}).get();var servicesHeight=Math.max.apply(null,servicesHeights);$('.service-tile a').css({height:servicesHeight})}function servicesHeightFunc(){var servicesHeightsS=$('.service-tile').map(function(){return $(this).height()}).get();var servicesHeightT=Math.max.apply(null,servicesHeightsS);if($(window).width()>=992){serviceHeightWrapperFunc();$('.service-tile a i').css({width:'auto',height:'auto','min-width':'150px','min-height':'150px'});$('.service-tile a').css({width:'auto',height:'auto'});var servicesHeightsThree=$('.service-tile a').map(function(){return $(this).height()}).get();var servicesHeightThree=Math.max.apply(null,servicesHeightsThree);$.each($('.service-tile a i'),function(i){var newHeightThree=(servicesHeightThree)+"px";$(this).css({width:'150px',height:newHeightThree,'min-height':newHeightThree,'min-width':'150px'})});$.each($('.service-tile a'),function(i){var newHeightFour=(servicesHeightThree)+"px";$(this).css({height:'auto'});$(this).css({height:newHeightFour})});$(".text-resizer-controls a").click(function(){serviceHeightWrapperFunc();$('.service-tile a i').css({width:'auto',height:'auto','min-height':'150px','min-width':'150px'});$('.service-tile a').css({width:'auto',height:'auto'});var servicesHeightsFive=$('.service-tile a').map(function(){return $(this).height()}).get();var servicesHeightFive=Math.max.apply(null,servicesHeightsFive);$.each($('.service-tile a i'),function(i){var newHeightFive=(servicesHeightFive+10)+"px";$('.service-tile a i').css({width:'150px',height:newHeightFive,'min-height':newHeightFive,'min-width':'150px'})})});$(".text-resizer-controls a.normal-text").click(function(){$('.service-tile a i').css({width:'150px',height:newHeightFive,'min-height':newHeightFive,'min-width':'150px'});$('.service-tile a').css({height:'auto'})})}else if($(window).width()>=768&&$(window).width()<992){$('html').css('font-size',originalFontSize);serviceHeightWrapperFunc();$('.service-tile a i').css({width:'120px',height:'120px','min-height':'120px','min-width':'120px'});$('.service-tile a').css({width:'auto',height:'auto'});var servicesHeightsThreeA=$('.service-tile a').map(function(){return $(this).height()}).get();var servicesHeightThreeA=Math.max.apply(null,servicesHeightsThreeA);$.each($('.service-tile a i'),function(i){var newHeightThreeA=(servicesHeightThreeA)+"px";$(this).css({width:'120px',height:newHeightThreeA,'min-height':newHeightThreeA,'min-width':'120px'})});$.each($('.service-tile a'),function(i){var newHeightFourA=(servicesHeightThreeA)+"px";$(this).css({height:'auto'});$(this).css({height:newHeightFourA})})}else if($(window).width()<768){$('.service-tile a i').css({width:'60px',height:'60px','min-height':'60px','min-width':'60px'});$('.service-tile a').css({height:'auto'})}}if($('.home-wrapper').length){$(window).on('resize',function(){servicesHeightFunc()});servicesHeightFunc()}function topicalHeightFunc(){var topicalHeights=$('.topical-item-wrapper h3').map(function(){return $(this).height()}).get();var topicalHeight=Math.max.apply(null,topicalHeights);$.each($('.topical-item-wrapper h3'),function(i){var newHeight=(topicalHeight-$(this).height())+10;$(this).css('padding-top',newHeight)})}function topicalHeightFuncP(){var topicalHeightsP=$('.topical-item-wrapper p').map(function(){return $(this).css('height','auto').height()}).get();var topicalHeightP=Math.max.apply(null,topicalHeightsP);$.each($('.topical-item-wrapper p'),function(i){$(this).css('height',topicalHeightP)})}if($(window).width()>767){$(window).on('resize',function(){topicalHeightFunc();topicalHeightFuncP()});topicalHeightFunc();topicalHeightFuncP();$(".text-resizer-controls a").click(function(){topicalHeightFunc();topicalHeightFuncP()})}function tabsHeightFunc(){var searchTabsHeights=$('.search-tabs li').map(function(){return $(this).css('height','auto').height()}).get();var searchTabHeight=Math.max.apply(null,searchTabsHeights);$.each($('.search-tabs li'),function(i){$(this).css('height',searchTabHeight)})}if($(window).width()>767){$(window).on('resize',function(){tabsHeightFunc()});tabsHeightFunc();$(".text-resizer-controls a").click(function(){tabsHeightFunc()})}$(".text-resizer-controls a:last").click(function(){if($("body").hasClass("high-contrast")){$("body").removeClass("high-contrast");$.cookie("high-contrast","");location.reload()}else{$("body").addClass("high-contrast");$.cookie("high-contrast","high-contrast")}});$('form .reset-form').click(function(){$(this).closest('form')[0].reset();return false});$('.hasDatePicker').datepicker({dateFormat:'dd/mm/yy'});if(navigator.cookieEnabled){if($.cookie("cookie-message-set")){}else{$('.cookie-message').show();$.cookie("cookie-message-set","true")}}$("body").addClass($.cookie("high-contrast"));$(".transactions-main .transaction-tile > a").click(function(){var showDiv='';if($(this).hasClass("trans-closed")){showDiv=$(this).data("target");var theCarousel=$(this).data("carousel-name");var clickedDiv=$(this);var clickedDivClass=$(this).attr('id');$('.scc-transparent-btn').addClass('trans-closed').removeClass('trans-open').removeClass('active-transaction');$(this).addClass('trans-open').addClass('active-transaction').removeClass('trans-closed');if($(".transactions-sub-menu.in").length>0){$(".transactions-sub-menu.in").fadeOut('fast',function(){$(".transactions-sub-menu.in").removeClass("in");$(showDiv).fadeIn().addClass("in")})}else{showDiv=$(this).data("target");$(clickedDiv).css("border-bottom","none");$(".transactions-sub-menu").removeClass("in");$(showDiv).fadeIn().addClass("in")}$(".close-menu").click(function(){$(showDiv).fadeOut();$(theCarousel).carousel(0);$('.scc-transparent-btn').removeClass("trans-open").removeClass("active-transaction").addClass('trans-closed')})}else if($(this).hasClass("trans-open")){showDiv=$(this).data("target");$(showDiv).fadeOut();$('.scc-transparent-btn').removeClass("trans-open").removeClass("active-transaction");$(this).addClass('trans-closed')}});$(".service-tile > a").click(function(){var serviceName=$(this).data("service");$(serviceName).fadeIn();$(this).parent().css("background-color","#fbaa3e");$(".sub-services .close-menu").attr("data-sub-menu",serviceName)});$(".sub-services .close-menu").click(function(){var serviceName=$(this).data("target");$("."+serviceName).fadeOut();$(".service-tile").removeAttr('style')});$('.menu-header').click(function(){$(this).next().toggleClass("collapse");if($(this).next().hasClass('collapse')){$(this).find('.fa').removeClass('fa-minus-circle').addClass('fa-plus-circle')}else{$(this).find('.fa').removeClass('fa-plus-circle').addClass('fa-minus-circle')}});var thumbOuterWidth=93;var galleryAnimationLeft=function(){var li=$('.image-slider li');li.stop(true,true);li.animate({left:+position+'px'},10,'linear');++position;if(position>0){position=0}return false};var galleryAnimationRight=function(){var li=$('.image-slider li');var imgCount=li.length;li.stop(true,true);li.animate({left:+position+'px'},10,'linear');++position;if(position>0){position=0}if(Math.abs(position)<((imgCount-1)*thumbOuterWidth)){--position}return false};var adjustControlHeight=function(){var img=$('.image-gallery-modal .modal-body img:first');if(img.height()<1){setTimeout(adjustControlHeight,250);setTimeout(adjustControlHeight,500);return}$('.image-gallery-modal .modal-body .control').height(img.height())};$('.slide-left').hover(function(){animation=setInterval(galleryAnimationLeft,10)},function(){clearInterval(animation)});$('.slide-right').hover(function(){animation=setInterval(galleryAnimationRight,10)},function(){clearInterval(animation)});$('.gallery-modal-button').click(function(){var imgSrc;var imgCaption;$('.image-gallery-wrapper .active, .image-gallery-modal .active').removeClass('active');if(!$(this).hasClass('button')){var index=$(this).parent().index();position=-Math.abs((index)*thumbOuterWidth);$('.image-slider li').animate({left:+position+'px'},10,'linear');imgSrc=$(this).attr('data-src');imgCaption=$(this).attr('data-caption');$('.image-gallery-modal .modal-header ul li:nth-child('+(index+1)+') a').addClass('active')}else{var button=$('.image-gallery .image-row a:first');imgSrc=button.attr('data-src');imgCaption=button.attr('data-caption');$('.image-gallery-modal .modal-header ul a:first').addClass('active')}$('.image-gallery-modal .modal-body img:first').attr('src',imgSrc);$('.image-gallery-modal .modal-body .caption').html(imgCaption)});$('.image-gallery-modal .control.move-left').click(function(){var index=$('.image-gallery-modal .modal-header .active').parent().index();var li=$('.image-slider li');var imgCount=li.length;var button='';$('.image-gallery-wrapper .active, .image-gallery-modal .active').removeClass('active');if(index==$('.image-gallery-modal .modal-header ul li:first').index()){position=-Math.abs((imgCount-1)*thumbOuterWidth);$('.image-slider li').animate({left:+position+'px'},10,'linear');button=$('.image-gallery .image-row a:last');imgSrc=button.attr('data-src');imgCaption=button.attr('data-caption');$('.image-gallery-modal .modal-header ul a:last').addClass('active')}else{position=-Math.abs((index-1)*thumbOuterWidth);$('.image-slider li').animate({left:+position+'px'},10,'linear');button=$('.image-gallery-modal .modal-header ul li:nth-child('+(index)+') a');imgSrc=button.attr('data-src');imgCaption=button.attr('data-caption');$('.image-gallery-modal .modal-header ul li:nth-child('+(index)+') a').addClass('active')}$('.image-gallery-modal .modal-body img:first').attr('src',imgSrc);$('.image-gallery-modal .modal-body .caption').html(imgCaption)});$('.image-gallery-modal .control.move-right').click(function(){var index=$('.image-gallery-modal .modal-header .active').parent().index();var button='';$('.image-gallery-wrapper .active, .image-gallery-modal .active').removeClass('active');if(index==$('.image-gallery-modal .modal-header ul li:last').index()){position=0;$('.image-slider li').animate({left:+position+'px'},10,'linear');button=$('.image-gallery .image-row a:first');imgSrc=button.attr('data-src');imgCaption=button.attr('data-caption');$('.image-gallery-modal .modal-header ul a:first').addClass('active')}else{position=-Math.abs((index+1)*thumbOuterWidth);$('.image-slider li').animate({left:+position+'px'},10,'linear');button=$('.image-gallery-modal .modal-header ul li:nth-child('+(index+2)+') a');imgSrc=button.attr('data-src');imgCaption=button.attr('data-caption');$('.image-gallery-modal .modal-header ul li:nth-child('+(index+2)+') a').addClass('active')}$('.image-gallery-modal .modal-body img:first').attr('src',imgSrc);$('.image-gallery-modal .modal-body .caption').html(imgCaption)});var showSteps=function(answerId){var requestURL=window.location.pathname+'/step';var request=$.ajax({url:requestURL,type:"POST",data:{AnswerID:answerId},dataType:"json"});request.fail(function(){alert("Unknown error occurred")});request.done(function(data){var html='';if(data.type=='step'){var questionNumber=$('.decision-tree-form select').length+1;html='
'+''+'';html+='
';if(typeof data.help!='undefined'&&data.help!==''){html+=''}$('.decision-tree-form').append(html);$('.decision-tree-wrapper .active-group').removeClass('active-group');$('.decision-tree-wrapper select:not(.decision-tree-wrapper select:last)').parent().addClass('active-group');$('.decision-tree-result').hide()}else if(data.type=='outcome'){var h3Class='';if(data.colour=='#b7cc14'){h3Class='dt-pass'}else if(data.colour=='#9a2c22'){h3Class='dt-fail'}else if(data.colour=='#e8850c'){h3Class='dt-action'}else{data.colour='#000000'}if(data.title){if(data.link){html+=''}html+='

';html+=data.title+'

'}html+='
'+data.content+'
';$('.decision-tree-result').html(html).show()}else{alert("Unsupported type")}})};$('.decision-tree-wrapper').on('change','select',function(){var answerId=$(this).val();if($(this).is(':not(.decision-tree-wrapper select:last)')){var modal=$('#warningModal');$('.decision-tree-select-index').remove();$('.decision-tree-answer-id').remove();modal.append('');modal.append('');modal.modal('show');return false}if(!answerId)return false;showSteps(answerId)});$('.continue-btn').click(function(){var index=$('.decision-tree-select-index').val();var answerId=$('.decision-tree-answer-id').val();var deleteElement=false;$('.form-group').each(function(){if($(this).find('select').val()==answerId){deleteElement=true}else if(deleteElement){$(this).remove()}});$('.decision-tree-result').hide();if(answerId){showSteps(answerId)}});$(".datepicker").datepicker({changeMonth:true,changeYear:true,dateFormat:'dd/mm/yy',constrainInput:true});$('.ui-datepicker-inline').hide();var hash=window.location.hash;$('a[data-hash="'+hash+'"]').tab('show');$('#transactionsTab a').click(function(e){e.preventDefault()});if(!window.matchMedia('print').matches){$('#tab1-collapse').collapse('hide');$('#tab1-collapse').parent().find('.panel-title a').addClass('collapsed')}$('.dropdown-menu a').click(function(e){e.stopPropagation()});if($('.optionset.radioset').length!==0){$.each($('.optionset.radioset'),function(i){newName=$(this).find('input[type=radio]').attr('name').replace(/\[.*?\]/g,'');$(this).find('input[type=radio]').attr('name',newName)})}$('#navbar').on('shown.bs.collapse',function(){if($(window).width()<768){$('body').addClass('fixed')}});$('#navbar').on('hidden.bs.collapse',function(){if($('body').hasClass('fixed')){$('body').removeClass('fixed')}});function removeBodyFix(){if($(window).width()>767){if($('body').hasClass('fixed')){$('body').removeClass('fixed')}}}$(window).on('resize',function(){removeBodyFix()});function headerHeightFunc(){if($(window).width()<=991){var headerHeight=$('.site-header').height();if($('.content-page-wrapper').length>0){$('.content-page-wrapper').css('margin-top',headerHeight)}}else{if($('.content-page-wrapper').length>0){$('.content-page-wrapper').css('margin-top','0')}}}$(window).on('resize',function(){headerHeightFunc()});headerHeightFunc()})