    function startIM() {
        window.open("?action=im", "FF_IM", "top=40px, left="+(screen.width-210)+"px, width=180px, height="+(screen.height-210)+"px, location=no, resizable=yes, directories=no, menubar=no, scrollbars=no, status=no, titlebar=no, toolbar=no");
    }

    function LoadIM(f_id) {
        window.open("?action=client&doRequest=1&f_id="+f_id, genValue(), "top=80px, left=80px, width=500px, height=400px, location=no, resizable=yes, directories=no, menubar=no, scrollbars=no, status=no, titlebar=no, toolbar=no");
    }

    function genValue() {
        var d=new Date;
        var h = d.getHours();
        var m = d.getMinutes();
        var s = d.getSeconds();
        var r1 = Math.floor(Math.random()*9.0);
        var r2 = Math.floor(Math.random()*9.0);

        if (h < 10) h = "0" + h;
        if (m < 10) m = "0" + m;
        if (s < 10) s = "0" + s;

        return "im"+h+m+s+r1+r2;
    }

    function getCookie(name) {
        var dc = document.cookie;
        var prefix = name + "=";
        var begin = dc.indexOf("; " + prefix);

        if (begin == -1) {
            begin = dc.indexOf(prefix);
            if (begin != 0) return null;
        } else {
            begin += 2;
        }
        var end = document.cookie.indexOf(";", begin);
        if (end == -1)
            end = dc.length;
        return unescape(dc.substring(begin + prefix.length, end));
    }

    function sendFinish(f_id) {
        var img = new Image;
        img.src = "?action=connect&doFinish=1&f_id="+f_id;
    }

    function finish(f_id) {
        setTimeout("sendFinish('"+f_id+"');", 100);
    }

