var Utils = {
    getURLVar: function(name, url) { // optionally pass an URL to parse
                   if (!url) url = window.location.href;
                   name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
                   var results = new RegExp("[\\?&]"+name+"=([^&#]*)").exec(url);
                   if( results == null ) return null;
                   else // decodeURIComponent doesn't recognize + as encoding for space
                       return decodeURIComponent(results[1].replace(/\+/g," "));
                },
                
    addURLVar: function(url, variable, value) {
    
        if( (q_index = url.indexOf('?')) > 0) {
            
            if(q_index == url.length-1)
                return url + variable + '=' + value;
            else
                return url + (url.charAt(url.length-1) != '&' ? '&' : '') + variable + '=' + value;
            
        }
    
        return url + '?' + variable + '=' + value;
    
    }
};

