var ottTab = {
	init: function( code, type )
	{
		if( window.addEventListener )
		{
			window.addEventListener( 'load', function()
			{
				ottTab.run( code, type );
			}, false );
		}
		else if( window.attachEvent )
		{
			window.attachEvent( 'onload', function()
			{
				ottTab.run( code, type );
			} );
		}
	},
	
	run: function( code, type )
	{
		var tab = document.createElement( 'div' );
		var img = { noactive: '', active: '' };
		
			switch( type )
			{
				case 'rt':
				{
					img.noactive = 'http://123konkurs.pl/resources/tab/rt.gif';
					img.active   = 'http://123konkurs.pl/resources/tab/rt.png';
					
					tab.style.backgroundPosition = '100% 0%';
					tab.style.top   = 0;
					tab.style.right = 0;
					tab.style.height          = '135px';
					tab.style.width           = '132px';
				}
				break;
				
				case 'lc':
				{
					img.noactive = 'http://123konkurs.pl/resources/tab/lc.gif';
					img.active   = 'http://123konkurs.pl/resources/tab/lc.png';
					
					tab.style.backgroundPosition = '0% 50%';
					tab.style.left = 0;
					tab.style.top  = '200px';
					tab.style.height          = '211px';
					tab.style.width           = '45px';
				}
				break;
				
				default:
				{
					return;
				}
			}
		
		var body = document.getElementsByTagName( 'body' );
		
			if( !body.length )
			{
				return;
			}
			
			body = body[0];
			
		var node = body.firstChild;
			
			if( node )
			{
				body.insertBefore( tab, node );
			}
			else
			{
				body.appendChild( tab );
			}

			tab.style.backgroundImage = 'url( ' + img.noactive + ' )'; 
			tab.style.backgroundRepeat = 'no-repeat';
			tab.style.cursor          = 'pointer';
			tab.style.display         = 'block';
			tab.style.position        = 'fixed';
			tab.style.zIndex          = 500000;
			tab.onclick = ( function()
			{
				window.location = 'http://123konkurs.pl/partnersprogram/' + code + '.html';
			} );
			tab.onmouseover = ( function() 
			{
				tab.style.backgroundImage = 'url( ' + img.active + ' )';
			} );
			tab.onmouseout = ( function() 
			{
				tab.style.backgroundImage = 'url( ' + img.noactive + ' )';
			} );
	}
}