var isIE = true;
switch (navigator.appName) {
	case ("Microsoft Internet Explorer"):
		isIE=true;
		break;
	case ("Netscape"):
		isIE=false;
		break;
	default:
		isIE=false;
		break;
}

function CreateElement(t) {
	if (isIE) return document.createElement(t);
	else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
}

var Tip_Onscroll;
function Tip(Msg,TipName,Top,Left) {
	if (!TipName) TipName="MyTip";
	if (Top==undefined) Top=(document.documentElement.scrollTop+(clientHeight()-30)/3);
	if (Left==undefined) Left=((document.body.clientWidth-300)/2);
	if (document.getElementById(TipName)) {
		Tip_Remove(TipName,true);
	}
	if (isIE) {
		var pTip = document.createElement("<div id='"+TipName+"' style='position:absolute;z-index:2007;top:"+Top+"px;left:"+Left+"px;background-color:#c44;padding-left:6px;padding-right:6px;padding-top:2px;padding-bottom:2px;font-size:16px;color:white;/>");
		pTip.appendChild(document.createTextNode(Msg));
		pTip.appendChild(document.createTextNode(" "));
		pTip.appendChild(document.createTextNode(" "));

		var pTipFunnyWeber = document.createElement("<a style='color:white;text-decoration:none;'/>");
		pTipFunnyWeber.setAttribute("href","javascript:Tip_Remove('"+TipName+"')");
		pTipFunnyWeber.appendChild(document.createTextNode("×"));

		pTip.appendChild(pTipFunnyWeber);
		document.body.appendChild(pTip);
	}
	else {
		if (document.getElementById(TipName)==null) {
			var pTip = document.createElement("div");
			pTip.setAttribute("id",TipName);
			pTip.setAttribute("style","position:absolute;z-index:2007;top:"+Top+"px;left:"+Left+"px;background-color:#c44;padding-left:6px;padding-right:6px;padding-top:2px;padding-bottom:2px;font-size:16px;color:white;");
			pTip.appendChild(document.createTextNode(Msg));
			pTip.appendChild(document.createTextNode(" "));
			pTip.appendChild(document.createTextNode(" "));

			var pTipFunnyWeber = document.createElement("a");
			pTipFunnyWeber.setAttribute("style","color:white;text-decoration:none;");
			pTipFunnyWeber.setAttribute("href","javascript:Tip_Remove('"+TipName+"')");
			pTipFunnyWeber.appendChild(document.createTextNode("×"));

			pTip.appendChild(pTipFunnyWeber);
			document.body.appendChild(pTip);
		}
	}
	Tip_Onscroll=window.onscroll;
	window.onscroll = function() {
		var tmpTop=(document.documentElement.scrollTop+(clientHeight()-30)/3);
		if (document.getElementById(TipName)) {
			document.getElementById(TipName).style.top=tmpTop+"px";
		}
	}
}

function Tip_Remove(TipName,isInit) {
	if (!TipName) TipName="MyTip";
	if (!isInit) isInit=false;
	if (document.getElementById(TipName)) {
		if (isIE) {
			document.getElementById(TipName).removeNode(true);
		}
		else {
			document.getElementById(TipName).parentNode.removeChild(document.getElementById(TipName));
		}
		if (!isInit) {
			window.onscroll=Tip_Onscroll;
		}
	}
}

function clientHeight() {
	if (document.documentElement.clientHeight<=document.body.clientHeight && document.documentElement.clientHeight!=0) {
		return document.body.clientHeight;
	}
	else {
		return document.documentElement.clientHeight;	
	}
}