var floatingMenuId = 'floatdiv';
var notHideIn = new Array ('mblog[.]gery[.]pl', '.*[.]mblog[.]pl');

var floatingMenu =
{
    targetX: -1,
    targetY: 'center',

    hasInner: typeof(window.innerWidth) == 'number',
    hasElement: typeof(document.documentElement) == 'object'
        && typeof(document.documentElement.clientWidth) == 'number',

    menu:
        document.getElementById
        ? document.getElementById(floatingMenuId)
        : document.all
          ? document.all[floatingMenuId]
          : document.layers[floatingMenuId]
};

floatingMenu.kill = function()
{
	var hide = true;
	for (i=0;i<notHideIn.length;i++)
	{
		if (document.domain.search(notHideIn[i]) != -1) {
			hide = false;
			break;
		}
	}
	
	if (hide) {
		floatingMenu.menu.parentNode.removeChild(floatingMenu.menu);
	}
}

floatingMenu.buildMenu = function()
{
    if (document.domain.search('gamerstation[.]pl') != -1) {
        var randIdx = 0;
    } else if(document.domain.search('twitt[.]pl') != -1) {
        var randIdx = 1;
    } else {
        var randIdx = Math.ceil(100*Math.random())%buttons.length;
    }
	
	var menuSpan = floatingMenu.menu.getElementsByTagName('span')[0];
	menuSpan.style.backgroundImage="url('"+buttons[randIdx][1]+"')";
	menuSpan.style.width=buttons[randIdx][2]+'px';
	menuSpan.style.height=buttons[randIdx][3]+'px';
	menuSpan.setAttribute('name', buttons[randIdx][1]);
	
	var menuA = floatingMenu.menu.getElementsByTagName('a')[0];
	menuA.href = buttons[randIdx][0];
	
	floatingMenu.targetX = -buttons[randIdx][2];
}

floatingMenu.init = function()
{
    floatingMenu.buildMenu();
    setTimeout('floatingMenu.kill()', 60*1000);
};

floatingMenu.init();