    $(document).ready(function() {
        $('ul.udm').superfish({
            delay:       1000,                            // one second delay on mouseout
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
            speed:       'normal',                          // faster animation speed
            autoArrows:  true,                           // disable generation of arrow mark-up
            dropShadows: true                            // disable drop shadows
        });

        $('ul.leftudm').superfish({
            delay:       1000,                            // one second delay on mouseout
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
            speed:       'normal',                          // faster animation speed
            autoArrows:  false,                           // disable generation of arrow mark-up
            dropShadows: false                            // disable drop shadows
			
        });

		// Hide register button on events page
		if (window.location.pathname.indexOf("event74_1620") == -1) $('#eventlisting div.evtregcontainer a.evtreglink').css({"display":"block"});

		$('a[href^=mailto:]').each(function() {
		var t = $(this);
		var emailText = t.html();
		var getP = t.parent().attr('class');
			
		if (getP == "emailLink") {
			var newEmailStaff = t.attr('href') + "&BCC=kmillett@vwv.co.uk&subject=Web%20enquiry%20for%20Veale%20Wasbrough%20Vizards";
			t.attr({href:newEmailStaff});
		} else {
			var newEmail = t.attr('href') + "?subject=Web%20enquiry%20for%20Veale%20Wasbrough%20Vizards&BCC=kmillett@vwv.co.uk";
			t.attr({href:newEmail});
		};
		
		t.html(emailText);
		  
		});
		
		/*
			Interactive Form - Briefings Subscriptions
		*/
		
		var subsActive = 0;
		
		$('.subCheck').each(function() {
			$(this).click(function() {
				updateSubList($(this));
			});
			updateSubList($(this));
		});
		
		function updateSubList(subCheck) {
			if (subCheck.attr('checked')) {
				$('#subList .' + subCheck.attr('id')).removeClass('hide');
				subsActive++;
			} else {
				if (!$('#subList .' + subCheck.attr('id')).hasClass('hide')) {
					$('#subList .' + subCheck.attr('id')).addClass('hide');
					subsActive--;
				}
			}
			if (subsActive == 0) {
				$('.notSelected').removeClass('hide');
			} else {
				if (!$('.notSelected').hasClass('hide')) $('.notSelected').addClass('hide');
			}
		}
		
        /* ------- Replace title of partner on Academy pages ---------- */
        var url = window.location.pathname;
        if(url.indexOf('services_for_academies') != -1) {
            $('body').addClass('services-for-academies');
        } else if(url.indexOf('academy_conversion_services') != -1) {
            $('body').addClass('academy-conversion-services');
        } else if(url.indexOf('startup_companies') != -1) {
            $('body').addClass('startups');
        } else if(url.indexOf('fam_business') != -1) {
            $('body').addClass('fam_business');
        }
        
        if(($('.academy-conversion-services').length > 0) || ($('.services-for-academies').length > 0)) {
            replacePartnerTitle();
        }
        
        if($('.academy-conversion-services').length > 0) {
            addTitle('Academy conversion', '/site/sectors/academy_conversion_services/');
        }
        
        if($('.services-for-academies').length > 0) {
            addTitle('Services for existing academies', '/site/sectors/services_for_academies/');
        }
        
        if($('.startups').length > 0) {
            addTitle('Start-ups & early stage companies', '/site/sectors/startup_companies/');
        }
        
        if($('.fam_business').length > 0) {
            addTitle('Family business', '/site/sectors/fam_business/');
        }
        
        function replacePartnerTitle() {
            var $speakerText = $('.speaker_detail');
            $speakerText.html(function() {
                return $(this).html().replace('Partner &amp; Head of Pastoral', 'Partner &amp; Head of Academies Team');
            });
            // html contains a JS function which adds email links - this causes the email links to be added again so hide the second one
            $speakerText.find('.emailLink a:last-child').hide();
        }
        
        // these two sections are using a different lhs template which doesn't include the header bar, so add it in
        function addTitle(title, url) {
            $('<div class="title"><h2 class="leftudm_h2_active"><a href="' + url + '">' + title + '</a></h2></div>')
                .prependTo('#container-left');
        }
        
        $('.leftudm_menu_item_level_2_active').parent().addClass('active');
        $('.leftudm_menu_item_level_3_active').parent().addClass('active');
        
        // -------------- lhs accordions -------------------
        var $content = $('.calltoaction > a').siblings();
        $content.hide();
        $('.calltoaction > a').click(function() {
            var $this = $(this);
            $this.siblings().slideToggle();
            $content.not($this.siblings()).slideUp();
            return false;
        }); // end accordion

	});
    
    
