
var Framework = {

    PROJECT_NAME:   '',
    WWW_HOME_DIR:   '/',
    WWW_SCRIPT_DIR: '/',


    getQueryParam: function(query, param) {
        param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regex = new RegExp("[\\?&]" + param + "=([^&#]*)");
        var results = regex.exec( query );
        return (results == null)? '' : results[1];
    },

    replaceQueryString: function (url,param,value) {
        var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i");
        if (url.match(re))
            return url.replace(re,'$1' + param + "=" + value + '$2');
        else if (url.indexOf("?") == -1)
            return url + '?' + param + "=" + value;
        else
            return url + '&' + param + "=" + value;
    },


    init: function() {
        var HTMLScriptElement = document.getElementById('framework');
        if ((HTMLScriptElement) && (HTMLScriptElement.src.match(/framework\.js(.*)?$/))) {
            var query = RegExp.$1;

            this.WWW_HOME_DIR   = Framework.getQueryParam(query, 'home');
            this.PROJECT_NAME   = Framework.getQueryParam(query, 'project');
            this.WWW_SCRIPT_DIR = Framework.getQueryParam(query, 'script');

        }
    }
}
Framework.init();




function popurl(sUrl, sWindow, iWidth, iHeight)
{
	iWidth  = iWidth ? iWidth : (screen.width  - 200);
	iHeight = iHeight ? iHeight : (screen.height - 200);
	oW = window.open(sUrl, sWindow, 'width=' + iWidth + ',height=' + iHeight + ',menubar=no,status=no,resizable=yes,scrollbars=yes');

	iPos_x = (screen.width  - iWidth)  / 2;
	iPos_y = (screen.height - iHeight) / 2;

	oW.moveTo(iPos_x, iPos_y);
	oW.focus();
}


function mt(name,domain,subject,body) {
  location.href = 'mailto:' + name + '@' + domain + '?subject=' + subject + '&body=' + body;
}

