jQuery.extend({
    getBackBaseURL:function (t) {
            var serverBase = window.location.protocol +"//"+ window.location.host;
            var currentBase = window.location.pathname;
            currentBase = getBackURL(currentBase,t);
            if(currentBase.lastIndexOf("/")!=(currentBase.length-1)){
                currentBase = currentBase+"/";
            }
            return serverBase+currentBase;
        }
});
function getBackURL(currentBase,step){
    if(step>0){
        if(currentBase.lastIndexOf("/")>=0){
            if(currentBase.indexOf("/") != currentBase.lastIndexOf("/")){
                currentBase = currentBase.substring(0,currentBase.lastIndexOf("/"));
                step = step-1;
                return getBackURL(currentBase,step);
            }else{
                return "/";
            }
        }else{
            return currentBase;
        }
    }else{
        return currentBase;
    }
}

$(function(){
    var notifyUrlObj = $("input[name='notifyUrl']");
    var callbackUrlObj = $("input[name='callbackUrl']");
    var splitNotifyObj = $("input[name='splitNotifyUrl']");
    if(notifyUrlObj.size()>0 && "" != notifyUrlObj.val()){
        if(notifyUrlObj.val().indexOf("http")!=0){
            notifyUrlObj.val($.getBackBaseURL(1) + notifyUrlObj.val());
        }
    }
    if(callbackUrlObj.size()>0 && "" != callbackUrlObj.val()){
        if(callbackUrlObj.val().indexOf("http")!=0){
            callbackUrlObj.val($.getBackBaseURL(3) + callbackUrlObj.val());
        }
    }

    if(splitNotifyObj.size() > 0 && "" != splitNotifyObj.val()){
        if(splitNotifyObj.val().indexOf("http")!=0){
            splitNotifyObj.val($.getBackBaseURL(1) + splitNotifyObj.val());
        }
    }
});