LBM_sImageName		= "http://www.myfrfr.com/images/ky02.gif";
LBM_sClickUrl		= "http://beijing.crelune.org/";
LBM_sImageUrl		= "";
LBM_sIsCover			= "Y";
LBM_bIsCover = true;
if(LBM_sIsCover.toUpperCase() == "N") LBM_bIsCover = false;
LBM_iImageWidth		= parseInt("110");
if (isNaN(LBM_iImageWidth)) LBM_iImageWidth = 110;
LBM_iImageHeight	= parseInt("88");
if (isNaN(LBM_iImageHeight)) LBM_iImageHeight = 88;

LBM_iLeft = 3;
LBM_iBottom = 260;
LBM_iMinTop = 88;
LBM_iTimeout = 50;
var __bs__ = navigator.userAgent.indexOf("MSIE") > 0 ?
	"MSIE" : navigator.userAgent.indexOf("Safari") > 0 ?
	"Safari" : "others";
var __dt__ = (document.documentElement.clientHeight > 0) &&
	(__bs__ == "MSIE" || document.body.clientHeight > document.documentElement.clientHeight) ?
	"W3C" : "undefined";
function MK_pageY() {
	if (__bs__ == "MSIE") {
		if (__dt__ == "W3C")
			return document.documentElement.scrollTop;
		else
			return document.body.scrollTop;
	} else {
		return window.pageYOffset;
	}
}
function MK_pageX() {
	if (__bs__ == "MSIE") {
		if (__dt__ == "W3C")
			return document.documentElement.scrollLeft;
		else
			return document.body.scrollLeft;
	} else {
		return window.pageXOffset;
	}
}
function MK_pageH() {
	if (__bs__ == "Safari")
		return window.innerHeight;
	else if (__dt__ == "W3C")
		return document.documentElement.clientHeight;
	else
		return document.body.clientHeight;
}
function MK_pageW() {
	if (__bs__ == "Safari")
		return window.innerWidth;
	else if (__dt__ == "W3C")
		return document.documentElement.clientWidth;
	else
		return document.body.clientWidth;
}
function MK_posY(o, v) {
	if (!o || !o.style) return ;
	if (v) {
		o.style.top = parseInt(v) + "px";
	} else {
		return o.style.top;
	}
}
function MK_posX(o, v) {
	if (!o || !o.style) return ;
	if (v) {
		o.style.left = parseInt(v) + "px";
	} else {
		return o.style.left;
	}
}
function tmh__make_ad_fodder(src, width, height)
{
	src = src.replace(" ", "");
	var TEMP_IMAGE = '<img src="$src$" height="88" WIDTH="110" border="0" />';
	var TEMP_FLASH = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
		+ ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" '
		+ ' height="88" WIDTH="110"> '
		+ '<param name="movie" value="$src$" /> '
		+ '<param name="quality" value="high" /> '
		+ '<param name="wmode" value="opaque" /> '
		+ '<EMBED src="$src$" quality="high" WIDTH="110" height="88" '
		+ ' wmode="opaque" TYPE="application/x-shockwave-flash" '
		+ ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> '
		+ '</object>';
	return (/\.swf$/gi.test(src) == true ? TEMP_FLASH : TEMP_IMAGE)
		.replace(/\$src\$/gi, src)
		.replace(/\$width\$/gi, width)
		.replace(/\$height\$/gi, height)
		;
}
function tmh__make_ad_content(strImageUrl, strImageName, iWidth, iHeight, strClickUrl, blClickCover)
{
	var TEMP_LINK = '<a href="$click_url$" target="_blank">$ad_fodder$</a>';
	var TEMP_COVER = '<div onClick="javascript:window.open(\'$click_url$\');" style="width:110px; height:88px; '
		+ ' position:absolute; cursor:pointer; background-color:#000000; z-index:9999; '
		+ ' filter:Alpha(Opacity=0); opacity:0.0; MozOpacity:0.0; KhtmlOpacity:0.0; "></div>'
		+ '$ad_fodder$';
	var src = strImageName || strImageUrl;
	var width = parseInt(iWidth);
	var height = parseInt(iHeight);
	var click_url = strClickUrl || "http://www.myfrfr.com/";	
	var ad_fodder = tmh__make_ad_fodder(src, width, height);
	if (/\.swf$/gi.test(src) == false) {
		return TEMP_LINK
			.replace(/\$ad_fodder\$/gi, ad_fodder)
			.replace(/\$click_url\$/gi, click_url)
			;
	}
	if (blClickCover == false) {
		return ad_fodder;
	}
	return TEMP_COVER
		.replace(/\$width\$/gi, width)
		.replace(/\$height\$/gi, height)
		.replace(/\$click_url\$/gi, click_url)
		.replace(/\$ad_fodder\$/gi, ad_fodder)
		;
}
function atoi(s) {
	var r = parseInt(s);
	return isNaN(r) ? 0 : r;
}
function magic_locus(x1, x2, n) {
	x1 = atoi(x1);
	x2 = atoi(x2);
	n = atoi(n);
	var d = Math.abs(x1 - x2);
	if (d < n) return magic_locus(x1, x2, d / 2);
	return n <= 1 ? x1 : (x1 + (n-1) * x2) / n ;
}
function LBM_Load() {
	var style_class = 'style="position: absolute; width:' +LBM_iImageWidth + 'px; height:'+ LBM_iImageHeight + 'px"';
	var _temp = '<div id="LBM_Div" ' + style_class + '>' +
		' $js_ad_content$ </div>';
	var _con = tmh__make_ad_content(LBM_sImageUrl, LBM_sImageName, LBM_iImageWidth, LBM_iImageHeight,LBM_sClickUrl,LBM_bIsCover);
	
	var _str = _temp.replace(/\$js_ad_content\$/gi, _con);
	document.writeln(_str);
	setInterval("LBM_Move();", LBM_iTimeout);
}
function LBM_Move() {
	try {
		var _div = document.getElementById('LBM_Div');
		
		var _left = MK_pageX() + LBM_iLeft;
		var _top = MK_pageY() + MK_pageH() - LBM_iBottom - LBM_iImageHeight;
		/*-- magic locus begin, add by moky @ 2006/12/29 --*/
		_top = magic_locus(_top, MK_posY(_div), 4);
		var max_y = MK_pageY() + MK_pageH();
		if (_top > max_y) _top = max_y;
		/*-- magic locus end,   add by moky @ 2006/12/29 --*/
		if (_top < LBM_iMinTop) _top = LBM_iMinTop;
		
		MK_posY(_div, _top);
		MK_posX(_div, _left);
	} catch(e) {}
}
LBM_Load();