$('html').attr('xmlns:msgr', 'http://messenger.live.com/2009/ui-tags');
if (!($.browser.msie && $.browser.version.substr(0.3) < 7)) {
 if(JS_SECTION.indexOf('messengertab') == -1){
    var NinemsnWebIM = {
        SIGN_IN_LINK: "http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=1257201008&rver=4.5.2125.0&wp=LBI&wreply=http%3a%2f%2fsignout.msn.com%2fmsnsignin.aspx&lc=1033&id=76307",
        SignOutLink: "http://login.live.com/logout.srf?ct=1257201009&rver=4.5.2125.0&lc=1033&id=76307&ru=" + escape(document.URL).replace(/\//g, '%2F').replace(/\+/g, '%2b'),
        SIGN_IN_IMG_URL: "http://windowslive.ninemsn.com.au/img/messenger/IMHereSmall.png"
    }
    function onScriptLoaded() {
        setTimeout(showSignInLink, 5000);
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + 1);
        document.cookie = 'sourceURI=' + document.URL + '; domain=ninemsn.com.au; expires=' + exdate.toUTCString() + '; path=/';
        $('body').append('<msgr:app rps-auth-enabled="true" channel-url="Channel.html" application-logo="ninemsn" onsignedin="signInCompletedCallback" onsignedout="msgrSignOut"></msgr:app><div id="msgr_signin" onclick="msgrSignIn();"><msgr:if condition="online" cid="$user"><msgr:else><img src="' + NinemsnWebIM.SIGN_IN_IMG_URL + '" class="sign_in_img" alt="Sign In"/><span class="sign_in_txt">Sign In</span></msgr:else></msgr:if></div><msgr:bar></msgr:bar>');
    }
    function signInCompletedCallback() {
        $('.ProfileControl_ExpandedSignOutLocal').text('Sign Out');
    }
    function showSignInLink() {
        $('#msgr_signin').show();
    }
    function msgrSignIn() {
        window.location.href = NinemsnWebIM.SIGN_IN_LINK;
    }
    function msgrSignOut() {
        window.location.href = NinemsnWebIM.SignOutLink;
    }
    Microsoft.Live.Core.Loader.load(['messenger.ui', 'messenger.ui.styles.core'], onScriptLoaded);
 }
}


