function newRequest()
{
    var request = false;
    try 
    {
	    request = new XMLHttpRequest();
    } 
    catch (trymicrosoft) 
    {
	    try 
	    {
		    request = new ActiveXObject("Msxml2.XMLHTTP");
	    } 
	    catch (othermicrosoft) 
	    {
		    try 
		    {
			    request = new ActiveXObject("Microsoft.XMLHTTP");
		    } 
		    catch (failed) 
		    {
			    request = false;
                alert("Ошибка инициализации XMLHttpRequest!");
		    }  
	    }
    }
    return request;
}

function esc(str)
{
    var src = ["%", "&", "\\?", "=", " "];
    var dest = ["%25", "%26", "%3F", "%3D", "%20"];
    for (i = 0; i < src.length; i++)
    {
        str = str.replace(eval("/" + src[i] + "/g"), dest[i]);
    }
    return str;
}

String.prototype.right = function(padString, length) 
{
	var str = this;
	str = padString + str;
    return str.substr(str.length - length);
}

String.prototype.rtrim = function()
{
    return this.replace(/(.*?)\s+$/i, "$1");
}

Date.prototype.tos = function()
{
    var dt = this;
    var res = new String();

    res += dt.getDate().toString().right("0", 2) + ".";
    res += (dt.getMonth() + 1).toString().right("0", 2) + ".";
    res += dt.getFullYear().toString();
    if (dt.getHours() > 0 || dt.getMinutes() > 0)
    {
        res +=  " ";
        res += dt.getHours().toString().right("0", 2) + ":";
        res += dt.getMinutes().toString().right("0", 2);
    }
    return res;    
}

function now()
{
    var now = new Date();
    return now.tos();
}

