

// BM_ShowFixedBottom("corner_ad", "http://www.anymedia.lv/files/175bd400831799734ef46c42dd0b1e07.gif", "http://www.seko.lv", 250, 250, 3);


function BM_ShowFixedBottom(target_object_id, src, target_link, banner_width, banner_height, display_type)
{
	try
	{
		var banner_object = document.getElementById(target_object_id);
		if (banner_object == null)
			return;

		banner_object.style.width = banner_width+"px";
		banner_object.style.height = banner_height+"px";
		banner_object.style.dispaly = "none";
		banner_object.style.backgroundColor = "transparent";
		banner_object.style.margin = "0px";
		banner_object.style.padding = "0px";
		banner_object.style.overflow = "hidden";

		if (display_type == 3)
			banner_object.style.right = "0px";
		else if (display_type == 4)
			banner_object.style.left = "0px";

		var browser = ''; 
		var version = 0;
		var myregexp = /(MSIE|Opera|Firefox|Chrome)(?: |\/)(\d+\.\d)/i;
		var match = myregexp.exec(navigator.userAgent);
		if (match != null)
		{
			browser = match[1];
			version = match[2];
		}
		if ((browser == 'MSIE' && version >= 7) || (browser == 'Opera' && version >= 9)  || (browser == 'Firefox' && version >= 3.0)  || (browser == 'Chrome' && version >= 5.0) )
		{
			banner_object.style.display = "block";
			banner_object.style.position = "fixed";
			banner_object.style.bottom = "0px";
		}
		else
		{
			if (window.attachEvent)
			{
				window.attachEvent("onscroll", function(){BM_ShowFixedBottom_AdjustPosition(banner_object, banner_width, banner_height);});
				window.attachEvent("onresize", function(){BM_ShowFixedBottom_AdjustPosition(banner_object, banner_width, banner_height);});
			}
			else
			{
				window.addEventListener("resize", function(){BM_ShowFixedBottom_AdjustPosition(banner_object, banner_width, banner_height);}, 1);
			}

			BM_ShowFixedBottom_AdjustPosition(banner_object, banner_width, banner_height);
		}


		string_tmp_first = '<a href="'+target_link+'" target="_blank"><img src="'+src+'" border="0"></a>';
		string_tmp_first += '<div style="position: absolute; right: 3px; top: 3px; width: 15px; height: 15px; background-image:url(http://www.balticmaps.eu/rekl/close.gif); cursor: pointer;" title="" OnClick="document.getElementById(\''+target_object_id+'\').style.display=\'none\';"></div>';
		banner_object.innerHTML = string_tmp_first;
	}
	catch (e)
	{
	}
}


	
function BM_ShowFixedBottom_AdjustPosition(banner_object, banner_width, banner_height)
{
	try
	{
		var height = 0;
		if (!window.innerWidth)
		{
			var height1 = document.documentElement.scrollTop + document.documentElement.clientHeight;
			var height2 = document.body.scrollTop + document.body.clientHeight;
			height = (height1>0)?height1:height2;
			banner_object.style.position = "absolute";
		}
		else
		{
			height = window.innerHeight;
			banner_object.style.position = "fixed";
		}

		height -= banner_height;
		banner_object.style.top = height + "px";
		banner_object.style.dispaly = "block";

	}
	catch (e)
	{
	}
}

