﻿RBM_sImageName		= "";
RBM_sClickUrl		= "";
RBM_sImageUrl		= "";
RBM_sIsCover			= "Y";
RBM_bIsCover = true;
if(RBM_sIsCover.toUpperCase() == "N") RBM_bIsCover = false;
RBM_iImageWidth		= parseInt("350");
if (isNaN(RBM_iImageWidth)) RBM_iImageWidth = 350;
RBM_iImageHeight	= parseInt("188");
if (isNaN(RBM_iImageHeight)) RBM_iImageHeight = 188;
RBM_iRight = 30;
RBM_iBottom = 30;
RBM_iMinTop = 335;
RBM_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 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 tmh__make_ad_content(strImageUrl, strImageName, iWidth, iHeight, strClickUrl, blClickCover)
{
	var TEMP_LINK = '$ad_fodder$';
	var TEMP_COVER = '<div style="width:350px;padding:10px; height:188px; '
		+ ' position:absolute; cursor:pointer; background-color:#FBFFF8; 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.luckyfax.com/";	
	var ad_fodder = "<div id='tmpdiv' style='width:350px;padding:10px;height:188px;background-color:#FBFFF8; z-index:9999;border:1px solid #D6D6D6;line-height: 20px;'><span style='width:14px; hight:14px; position:absolute; top:3px; right:5px;  background:url(/skins/LUCKY/gonggao/close.gif) no-repeat 0px 0px;'><a href='javascript:;' onclick='javascript:document.getElementById(\"tmpdiv\").style.display=\"none\";'>&nbsp;&nbsp;</a></span><h4 style='font-size:14px; text-align:center; font-weight:bold; color:#FF6600;border-bottom:1px solid #ccc;margin-bottom:3px;'>2010年9月震撼优惠</h4><font color='#FF6600'><strong>电子传真：交600元=含一年租金+含600话费发传真<br />400电话：推出600元、960元、1500元套餐，免开户费、免月租，免选号费！<br />传真群发：交1千元=含2千话费+再送1千条短信  <br /><br />以上优惠9月30日结束，详情免费致电4006-399-391<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.luckyfax.com/html/notice/view_532.html'>点击查看更多详情</a></strong></font></div>"
	//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 RBM_Load() {
	var style_class = 'style="position: absolute; width:' +RBM_iImageWidth + 'px; height:'+ RBM_iImageHeight + 'px"';
	var _temp = '<div id="RBM_Div" ' + style_class + '>' +
		'$js_ad_content$ </div>';
	var _con = tmh__make_ad_content(RBM_sImageUrl, RBM_sImageName, RBM_iImageWidth, RBM_iImageHeight,RBM_sClickUrl,RBM_bIsCover);
	var _str = _temp.replace(/\$js_ad_content\$/gi, _con);
	document.writeln(_str);
	setInterval("RBM_Move();", RBM_iTimeout);
}
function RBM_Move() {
	try {
		var _div = document.getElementById('RBM_Div');
		
		var _left = MK_pageX() + MK_pageW() - RBM_iRight - RBM_iImageWidth;
		var _top = MK_pageY() + MK_pageH() - RBM_iBottom - RBM_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 < RBM_iMinTop) _top = RBM_iMinTop;
		
		MK_posY(_div, _top);
		MK_posX(_div, _left);
	} catch(e) {}
}
RBM_Load();
document.write("<img width='0px' height='0px' style='width:0px; height:0px;visibility:hidden; display:none; '");