// String.Format
String.prototype.format = function()
{
    var str = this;
    for(var i=0;i<arguments.length;i++)
    {
        var re = new RegExp('\\{' + (i) + '\\}','gm');
        str = str.replace(re, arguments[i]);
    }
    return str;
}

function createWindow(url, WinName, theWidth, theHeight){
	var winLeft = (screen.width - theWidth) / 2;
	var winTop = (screen.height - theHeight) / 2;
	window.open(url, WinName, 'titlebar.maximize=no, scrollbars=no, resizable=no, width=' + theWidth + ', height=' + theHeight + ', left=' + winLeft + ', top=' + winTop);
}

function createScrollingWindow(url, WinName, theWidth, theHeight){
        var winLeft = (screen.width - theWidth) / 2;
        var winTop = (screen.height - theHeight) / 2;
        //var winLeft = 50;
        //var winTop = 30;
        window.open(url, WinName, 'titlebar.maximize=no, scrollbars=yes, resizable=no, width=' + theWidth + ', height=' + theHeight + ', left=' + winLeft + ', top=' + winTop);
}

function createScrollingWindowRelatorio(url, WinName, theWidth, theHeight){
        var winLeft = 50;
        var winTop = 30;
        window.open(url, WinName, 'titlebar.maximize=no, scrollbars=yes, resizable=no, width=' + theWidth + ', height=' + theHeight + ', left=' + winLeft + ', top=' + winTop);
}