var dlgStep = 40;
var dlgTimeout = 15;
var dlgLeft = 225;
var dlgRight = 225;
var dlgWidth = 450;

function dialogOpen() {
    if (dlgLeft >= 0) {
        dlgRight += dlgStep;
        dlgLeft -= dlgStep;
        var rect = 'rect(auto, ' + dlgRight + 'px, auto, ' + dlgLeft + 'px)';
        document.getElementById("dialogWindow").style.clip = rect;
        setTimeout(dialogOpen, dlgTimeout);
    }
}

function dialogClose() {
    if (dlgLeft < dlgRight) {
        dlgRight -= dlgStep;
        dlgLeft += dlgStep;
        var rect = 'rect(auto, ' + dlgRight + 'px, auto, ' + dlgLeft + 'px)';
        document.getElementById("dialogWindow").style.clip = rect;
        setTimeout(dialogClose, dlgTimeout);
    }
}

function genOrderNumber() {
    var result;
    var day = (new Date()).getDay();
    var month = (new Date()).getMonth();
    if (day.toString().length == 1) {
        day = "0" + day;
    }
    if (month.toString().length == 1) {
        month = "0" + month;
    }
    var rnd_number = Math.round(999 - Math.random() * 899);
    result = "RH" + day + month + (new Date()).getFullYear() + rnd_number;
    return result;
}