// wireblur base namespace
var wb = {};

// utility namespace
wb.util = {
    getQueryParam: function(name) {
        name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var results = regex.exec( window.location.href );
        if( results == null )
            return "";
        else
            return results[1];
    },
    // get root url
    root: function() {
        var url = document.location.toString();
        var root = '';
        var p1 = 0;
        var p2 = 0

        // get rid of http:// first
        // then find position of first /
        p1 = url.indexOf("//");
        var temp = url.substring(p1+2);
        p2 = temp.indexOf("/")

        if (p2 > 0) {
            root = url.substring(0, p1 + p2 + 3);
        }
        else {
            root = url + "/";
        }
        
        return root;
    }
}

