var b2bcontext_h = window.location + '';
    b2bcontext_h = b2bcontext_h.replace (/^http:\/\//, '');
    b2bcontext_h = b2bcontext_h.replace (/^www\./, '');
    b2bcontext_h = b2bcontext_h.replace (/\/.*$/, '');

var src = 'http://b2bcontext.ru/partner/rubricator?rand=' + Math.random();

if(typeof(b2bcontext_block_background) != "undefined")           src+= '&background='+b2bcontext_block_background;
if(typeof(b2bcontext_block_rubricator_columns) != "undefined")   src+= '&rubricator_columns='+b2bcontext_block_rubricator_columns;

var w,h;
if(typeof(b2bcontext_block_w) != "undefined")
{
    b2bcontext_block_w += '';
    w = (b2bcontext_block_w.match(/^\d+$/)) ? b2bcontext_block_w + 'px' : b2bcontext_block_w;
}
else
{
    w = '800px'
}

if(typeof(b2bcontext_block_h) != "undefined")
{
    b2bcontext_block_h += '';
    h = (b2bcontext_block_h.match(/^\d+$/)) ? b2bcontext_block_h + 'px' : b2bcontext_block_h;
}
else
{
    h = '500px'
}

var params = [];
if (b2bcontext_h)
    params.push ('h=' + b2bcontext_h);
if (params.length)
{
    params.push ('page_key=0039fccd3a68f14b0ac5');
    var script = '<img src="http://b2bcontext.ru/service/counter.pl?' + params.join ('&', params) + '">';
    document.write(script);
}

document.write('<iframe src="'+src+'" style="width: '+w+'; height: '+h+';" scrolling="auto" frameBorder="0"></iframe>')

