// JScript File

    function changeSite(newSiteID) {
        //Only change site if the user has chosen a new site.
        if (newSiteID != "" && newSiteID != "-- Change Site --") {
            var href= document.location.href;

            // This is in case there's already a ChangeSite=XX in the URL (need to scrap it)
            href = href.replace(/ChangeSite=[0-9]*/g,"");

            // In case there is a hash at the end of the string
            href = href.replace(/#[^$]*$/g,"");
            
            //Now, we just tack a "ChangeSite=XX" at the end.   
            //(the funky bit in the middle just works out whether we should put a ? or a & before the variable, 
            //   based on whether there's already a "?")
            document.location.href = href+((href.indexOf('?')>-1)?'&':'?')+'ChangeSite=' + newSiteID
        }
    }
  

