﻿function convertSHLinks()
{
    // Kör bara denna funktion en gång
    if( linksConverted )
        return;
    linksConverted = true;
    $('a').each(function(){
        try {
            if( $(this).attr('href').indexOf("http://www.sh.se/") == 0 && !$(this).hasClass('public'))
            {
                if( shLoggedIn )
                    $(this).attr({'href': $(this).attr('href').replace("http://www.sh.se/", "https://info.web.sh.se/") });
                //else
                    //$(this).attr({'href': $(this).attr('href').replace("http://www.sh.se/", "http://webappl.web.sh.se/") });
            }
        }
        catch(e) { }
    });
    
    if( shLoggedIn )
    {
        if( $('#usrstatuslist li').length > 0 )
            $('#usrstatuslist').html("<li><div><a title=\"Logga ut\" href=\"javascript:location.replace('https://info.web.sh.se/logoutredirect.nsf/iNotes/Proxy/?OpenDocument&amp;Form=s_Logout&amp;l=en&amp;gz&amp;CacheResults&amp;ui=inotes&amp;PresetFields=s_UseActXUpload;1')\"><strong class=\"heading\">Logga ut <br/></strong></a></div></li><li><div><a title=\"Personal\" name=\"InternalLink\" href=\"https://info.web.sh.se/personal\"><strong class=\"heading\">Personal <br/></strong></a></div></li><li class=\"last\"><div><a title=\"Student\" name=\"InternalLink\" href=\"https://info.web.sh.se/C1256C8A0066623D/tmt.view/C13B5CF48E71215FC1256C8B00278366?open&amp;ref=CAEA2646ADAD066AC12572FE005CB956\"><strong class=\"heading\">Student <br/></strong></a></div></li>");
    }
}