    var $j = jQuery.noConflict();
    
    /**
     * We use the initCallback callback
     * to assign functionality to the controls
    */
    function mycarousel_initCallback(carousel) {
        $j('.jcarousel-control a').bind('click', function() {
            carousel.scroll($j.jcarousel.intval($j(this).text()));
            return false;
        });

        $j('.jcarousel-scroll select').bind('change', function() {
            carousel.options.scroll = $j.jcarousel.intval(this.options[this.selectedIndex].value);
            return false;
        });

        $j('#mycarousel-next').bind('click', function() {
            carousel.next();
            return false;
        });

        $j('#mycarousel-prev').bind('click', function() {
            carousel.prev();
            return false;
        });
    };
    
    $j(document).ready(function() {
        $j('#langSelector').clickMenu();
        $j('#langSelector').removeAttr('style');
        $j('#langSelector ul').removeAttr('style');
        $j('#langSelector li').removeAttr('style');
        $j('#langSelector li a').removeAttr('style');
         
        $j.fn.search = function() {
            return this.focus(function() {
                if (this.value == "Ask a question") {
                    this.value = "";
                }
            }).blur(function() {
                if (!this.value.length) {
                    this.value = "Ask a question";
                }
            });
        };
        $j("#p_search_text").search();
        
        $j('#mycarousel ul').removeAttr('style');
        $j('#carousel-franchisee').removeAttr('style');
        $j('#carousel-consultant').removeAttr('style');
        $j('#carousel-multinational').removeAttr('style');
        $j('#carousel-entrepreneur').removeAttr('style');
        $j('#carousel-accountant').removeAttr('style');
        $j('#carousel-banker').removeAttr('style');
        
        $j('#abdiv').fadeIn(1000);
        
        $j("#mycarousel").jcarousel({
            scroll: 1,
            initCallback: mycarousel_initCallback,
            // This tells jCarousel NOT to autobuild prev/next buttons
            buttonNextHTML: false,
            buttonPrevHTML: false
        });
    	
	    //jQuery.browser alteration for Google Chrome detection
	    //source: javascriptly.com/2008/09/javascript-to-detect-google-chrome/
	    var userAgent = navigator.userAgent.toLowerCase();
	    $j.browser = {
	      version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
	        chrome: /chrome/.test( userAgent ),
	        safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
	        opera: /opera/.test( userAgent ),
	        msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
	        mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
	    }; 

	    $j('.toolTip').hover(
        function() {
        this.tip = this.title;
        
        $j(this).append(
         '<div class="toolTipWrapper">'
            +'<div class="toolTipTop"></div>'
            +'<div class="toolTipMid">'
              +this.tip
            +'</div>'
            +'<div class="toolTipBtm"></div>'
          +'</div>'
        );
        this.title = "";
        this.width = $j(this).width();
        $j(this).find('.toolTipWrapper').css({left:this.width-82})
        if ($j.browser.chrome || $j.browser.msie) {
			$j('.toolTipWrapper').show();
		} else {
			$j('.toolTipWrapper').fadeIn(300);
		}
        },
        function() {
		  if ($j.browser.chrome || $j.browser.msie) {
			$j('.toolTipWrapper').hide();
		  } else {
	        $j('.toolTipWrapper').fadeOut(600);
		  }
          $j(this).children().remove();
            this.title = this.tip;
          }
        );
        
        
    });

    function changeCountry(countryCode) {
        document.getElementById('CountryCode').value = countryCode;
        document.getElementById('locationSwitcherForm').submit();
    };

    // Send tab view to Google Analytics
    function tabAnalytics(tab) {
        /* Track to the global site tracker */
        var tabTracker = _gat._getTracker("UA-3776042-4");
        // set to -11 profile for analytics testing
        // var tabTracker = _gat._getTracker("UA-3776042-11");
        tabTracker._setCampaignTrack(true);
        tabTracker._setCampNameKey("campaign"); // name
        tabTracker._setCampMediumKey("medium"); // medium
        tabTracker._setCampSourceKey("source"); // source
        tabTracker._setCampContentKey("tab"); // content
        tabTracker._initData();
        tabToTrack = "index.html?source=xero-homepage&medium=web&tab=" + tab + "&campaign=homepage-tabs";

        tabTracker._trackPageview(tabToTrack);
        tabTracker._trackEvent("Homepage Personas", "Viewed", tab)
    };
