function cf_wd_loadbox(t_id) {
    if(typeof cogfun_widget != "undefined") {
        //        return;
    }
    cogfun_widget.p(t_id);
}

cogfun_widget = {
    IEnoyaro: function() {
        return (typeof(window.innerWidth)!='number') ;
    },

    fetch: function() {
        this.$("cf_wd_point").appendChild(this.$("cf_bx_sidebar_160"));
    },

    p: function(t_id) {
        var d=document.createElement('div');
        var h=540, bxlh='50px';
        var bxclose = '<div style="color:#FFF;cursor:pointer;font-weight:bold;font-size:14pt;width:100%;height:'+bxlh+';line-height:'+bxlh+';background-color:#333;filter:alpha(opacity=50);opacity:0.5;" onclick="cogfun_widget.dai(this.parentNode);">click anywhere in this bar to close</div>';
        var p = 'fixed', t = this.wsz()[1];
        if(this.IEnoyaro()) {
            p = 'absolute';
            t = t-h-100;
        }
        else {
            t = t/2-h/2-60;
        }
        LT=['0px',t+'px'];
        this.sty(d, {textAlign:'center',width:'100%',height:h+'px',position:p,left:LT[0],top:LT[1],zIndex:9999});
        d.innerHTML+=bxclose;
        d.innerHTML+='<div style="width:100%;background-color:#FFF;padding:10px 0 10px 0;"><iframe style="border:none;width:680px;height:540px;z-index:9999;" src="http://cognitivefun.net/wloader/'+t_id+'?'+encodeURIComponent(window.location.href)+'"></iframe></div>';
        d.innerHTML+=bxclose;
        var dbd=document.body;
        dbd.insertBefore(d, dbd.lastChild);
    },

    oLT: function(o) {o=this.$(o);
        var ar = [0,0];
        if(o.offsetParent) {
            do { ar[0]+=o.offsetLeft; ar[1]+=o.offsetTop; } while (o = o.offsetParent);
        }
        return ar;
    },
    wsz: function() {
        return this.IEnoyaro()
          ? [document.body.clientWidth,document.body.clientHeight]
          : [window.innerWidth,window.innerHeight];
    },

    hai: function(n) {
        var o = this.$('cf_bx_desc_'+n);
        var s = this.oLT(o.parentNode);
        var d = parseInt(o.style.width);
        if(!d) d = 180;
        if(s[0] > 300) { d = -d - 40; }
        this.sty(o, {display:"",marginLeft:d+'px'});
    },
    bai: function(n) {
        this.$('cf_bx_desc_'+n).style.display="none";
    },
    dai: function(n) {
        this.$(n).parentNode.removeChild(this.$(n));
    },
    sty: function(t_o, s_o) {
        for(var i in s_o) {
            t_o.style[i] = s_o[i];
        }
    },

    $: function(n){
        return (typeof n == "string") ? document.getElementById(n) : n;
    }
}
