function toSecure() {
    var loc = window.location.href.toLowerCase();
    if (loc.indexOf('https://') < 0) {
        
        var start = window.location.href.indexOf('http://');
        if (start < 0) {
            return;
        }
        var newUrl = 'https://' + window.location.href.substring(start + 7, window.location.href.length);
        window.location = newUrl;
    }
}
