    $(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
        });
	
		$('#articles_share_links').appendTo('#container-centre');
        
		$('#container-centre').append('<div class="clear"><!-- clear --></div>');
		
		$('body#home .newsTH .link a.morelink span').html("Employment law news");

		// Bookmark Javascript 

		var wlprot = window.location.protocol;
		var wlhost = window.location.host;
		var wlpath = window.location.pathname;
		var wlpathnew = wlpath.replace( /\//g, "%2F");
		var pt = document.title;
		var pagetitle = pt.replace(/[^a-zA-Z 0-9 -]+/g,'').replace(/  /, ' ');
		var fullURL = wlprot + "//www." +  wlhost + wlpath;
		var pagetitleLI = pagetitle.replace(/ /g, "+");

		var fblink = "http://www.facebook.com/share.php?u=http%3A%2F%2Fwww."+wlhost+wlpathnew;
		var twlink = "http://twitter.com/share?url=http%3A%2F%2Fwww."+wlhost+wlpathnew+"&text="+pagetitle;
		var lilink = "http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Fwww"+wlhost+wlpathnew+"&title="+pagetitleLI+"&ro=false&summary=&source="
		var dilink = "http://digg.com/submit?url=http%3A%2F%2Fwww."+wlhost+wlpathnew
		var sulink = "http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww."+wlhost+wlpathnew+"&title="+pagetitleLI;
		
		$('a#bmfb').attr('href',fblink);
		$('a#bmtw').attr('href',twlink);
		$('a#bmli').attr('href',lilink);	
		$('a#bmdi').attr('href',dilink);	
		$('a#bmsu').attr('href',sulink);		
        
        
        // ------------------- add id to phone number in articles (for MediaHawk) ---------------
        var count = 2; // textNumber1 is in header
        $('.DDIQuote').each(function() {
            $(this).attr('id', 'textNumber' + count);
            count++;
        });
        
        count = 4; // textNumber2 in sidebar in drill pages
        $('#people .phone').each(function() {
            $(this).attr('id', 'textNumber' + count);
            count++;
        });
        
        /* ---------------- Change PDF links --------------- */
        // phone number which will trigger link changes
        var targetNumber = '0845 322 9171';
        
        function checkNumber() {
            // get textNumber1 text - should always be present in header
            var text = $('#textNumber1').text();
            
            $('.booklet_download, .booklet_sub_download').each(function() {
                if(text == targetNumber) {
                    replaceLink($(this));
                } else {
                    useNormalLink($(this));
                }
            });
        }
        
        function replaceLink(element) {
            element.attr('href', "http://www.compromiseagreement.org.uk/cms/document/compromise_agreements_employees_guide.pdf");
        }
        
        function useNormalLink(element) {
            element.attr('href', "http://www.compromiseagreement.org.uk/cms/document/compromise_agreements_an_employees_guide.pdf");
        }
        
        // wait 1sec before checking - make sure MH code has finished running
        // may need to be setInterval - on slow connections 1sec may not be enough
        setTimeout(checkNumber, 1000);
    });


