if (navigator.cookieEnabled) 
{
    
    function pop_cookie_enabled()
    {
        var is_enabled = false;
        if (!window.opera && !navigator.cookieEnabled) {
            return is_enabled;
        }
        if (typeof document.cookie == 'string')
        {
            if (document.cookie.length == 0) {
                document.cookie = "test";
                is_enabled = document.cookie == 'test';
                document.cookie = '';
            }
            else {
                is_enabled = true;
            }
            return is_enabled;;
        }
    }
    
    function pop_getCookie(name)
    {
        var cookie = " " + document.cookie;
        var search = " " + name + "=";
        var setStr = null;
        var offset = 0;
        var end = 0;
        if (cookie.length > 0)
        {
            offset = cookie.indexOf(search);
            if (offset != - 1)
            {
                offset += search.length;
                end = cookie.indexOf(";", offset);
                if (end == - 1) {
                    end = cookie.length;
                }
                setStr = unescape(cookie.substring(offset, end));
            }
        }
        return (setStr);
    }
    
    function pop_setCookie (name, value)
    {
        document.cookie = name + "=" + escape(value) + "; expires=Friday,31-Dec-50 23:59:59 GMT; path=/;";
    }
    
    /*
     * 	"url" => "",
     * 	"under"	=> null,
     * 	"cookie_name" => "turbobit1",
     * 	"timeout"  => 720
     */
    function show_pop(param)
    {
        var fea_wnd = "scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0";
        var need_open = true;
        if (document.onclick_copy != null) {
            document.onclick_copy();
        }
        if (document.body.onbeforeunload_copy != null) {
            document.body.onbeforeunload_copy();
        }
        if (param["under"] != null) {
            if (! param["under"].closed) {
                need_open = false;
            }
        }
        if (need_open)
        {
            if (pop_cookie_enabled())
            {
                val = pop_getCookie(param["cookie_name"]);
                if (val != null)
                {
                    now = new Date();
                    val2 = new Date(val);
                    utc1 = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), 
                    now.getMinutes(), now.getSeconds());
                    utc2 = Date.UTC(val2.getFullYear(), val2.getMonth(), val2.getDate(), val2.getHours(), 
                    val2.getMinutes(), val2.getSeconds());
                    if ((utc1 - utc2) / 1000 < param["timeout"] * 60) {
                        need_open = false;
                    }
                }
            }
        }
        if (need_open)
        {
            under = window.open(param["url"], "", fea_wnd);
            under.blur();
            window.focus();
            if (pop_cookie_enabled()) {
                now = new Date();
                pop_setCookie(param["cookie_name"], now);
            }
        }
    }

}