$(document).ready(function () {
    var stagingUrl = document.domain == 'localhost' || document.domain == '192.168.1.230' || document.domain == '192.168.1.70';
    var wwwVectone = 'http://www.vectonemobile.at/';
    var myVectone = 'http://my.vectonemobile.at/';
    var wwwPatt = /https?\:\/\/(www.)?vectonemobile.at\/?/gi;
    if (stagingUrl) {
        wwwVectone = 'http://192.168.1.230:4301/';
        myVectone = 'http://192.168.1.70/vmat_vNET/';
        wwwPatt = /(http\:\/\/[^\/\r\n\b]*.?)?vmat_(v5|vNET)\/?/gi;
    }

    var myaccount = /(myvectone|my-vectone|myvectone2|my-vectone2)[\w\/\-\_\.\?\=]*\b/g;

    $('a').each(function () {
        var href = $(this).attr('href');
        if (href) {
            // My Vectone
            if (href.search(myaccount) != -1) {
                href = myVectone + href.match(myaccount);
                $(this).attr('href', href);
            }
            else {
                href = href.replace(wwwPatt, wwwVectone);
                $(this).attr('href', href);
            }
        }
    });
});

