﻿// JScript 文件


//商机通帐号设置
jstx_DivWidth		= parseInt("109");
jstx_DivHeight	= parseInt("80");
jstx_iRight = 5;
jstx_MinRight=830;
jstx_iTop = 400;
jstx_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 sjt_onlick()
{
var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=906048240';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;
}
function sjt_content()
{
   temp="<div id='divStayTopleft' style='position: absolute;'> <table width='87' border='0' cellspacing='0'cellpadding='0'><tr>  <td><img src='/images/kf_top.gif' width='87' height='24'></td></tr> <tr> <td height='30' align='center' background='/images/kf_bj.gif'><a href=tencent://message/?uin=906048240&Site=www.tenwe.com&Menu=yes class='leftlink'><img SRC='/images/qq_c.gif' alt='QQ' width='64' height='18' border='0'></a><br>     </td> </tr> <tr> <td height='30' align='center' background='/images/kf_bj.gif'><a  href=tencent://message/?uin=524973253&Site=www.tenwe.com&Menu=yes class='leftlink'><img SRC='/images/qq_c.gif' alt='QQ' width='64' height='18' border='0'></a><br>     </td> </tr><tr> <td height='30' align='center' background='/images/kf_bj.gif'><a  href=tencent://message/?uin=312328754&Site=www.tenwe.com&Menu=yes class='leftlink'><img SRC='/images/qq_c.gif' alt='QQ' width='64' height='18' border='0'></a><br>     </td> </tr><tr><td><img src='/images/kf_bottom.gif' width='87' height='3'></td> </tr> </table></div>";
   return temp;
}
function jstx_Load() {
	var style_class = 'style="position: absolute; width:' +jstx_DivWidth + 'px; height:'+ jstx_DivHeight + 'px"';
	var _temp = '<div id="jstx_Div" ' + style_class + '>' +
		'$js_sjt_content$ </div>';
	var _con = sjt_content();
	var _str = _temp.replace(/\$js_sjt_content\$/gi, _con);
	document.writeln(_str);
	setInterval("jstx_Move();", jstx_iTimeout);
}
function jstx_Move() {
	try {
		var _div = document.getElementById('jstx_Div');
		
		var _left = MK_pageW() - jstx_iRight - jstx_DivWidth;
		if (_left<jstx_MinRight)
		{
			_left=jstx_MinRight
		}
		var _top = MK_pageY() + jstx_iTop ;
		_top = magic_locus(_top, MK_posY(_div), 4);		
		MK_posY(_div, _top);
		MK_posX(_div, _left);
	} catch(e) {}
} 
jstx_Load();
