var imageServer="image.el99.cn";
function addToolBar(){
	var toolbarHTML = '<div id="toolbarDIV" style="position:absolute;left:-1px;height:28px;overflow:hidden;border-top:1px solid gray;display:none;z-index:101">'+
			'<iframe src="toolbar.asp" name=toolbarFrame id=toolbarFrame border=0 height="29px" style="margin:-3px 0px -2px -1px;" allowTransparency="true" scrolling=no></iframe></div>'+
			'<img src="css/toolbar/toolbar02.gif" id="toolbarImg1" onclick="showToolBar()" style="position:absolute;left:-1px;top:100px;cursor:pointer;;display:none;z-index:101" alt="显示工具条" title="显示工具条">'+
			'<img src="css/toolbar/toolbar02.gif" id="toolbarImg2" onclick="showToolBar()" style="position:absolute;left:1005px;cursor:pointer;;display:none;z-index:101" alt="显示工具条" title="显示工具条">';
	if(document.readyState=="complete"){
		d = document.createElement("div");
		d.innerHTML=toolbarHTML
		document.body.insertBefore(d,null);
	}else{
		document.write(toolbarHTML);
	}
	toolbarStatement="hide";
	/*if (parent.location.hash!="#showToolbar")
		hideToolBar();
	else*/
		showToolBar();
}
var timer,toolbarStatement;
var minIframeWidth = 980;
var oldscrolltop=0;
var oldBodyClientHeight = 0;

function fixToolBar(){
	var e = document.body
	if (document.documentElement.clientHeight>0)
		e=document.documentElement;
	var h = e.clientHeight;
	if(h>1200 && parent.g_iUin>10000)
		h=1200
	var t = e.scrollTop+h;
	var w = Math.max(minIframeWidth,e.clientWidth);
	if(parent.g_iUin>10000){
		if(e.clientWidth>1024) w=1024
		else if(e.clientWidth<minIframeWidth) w=minIframeWidth
		else w=e.clientWidth;
	}

	var d = document.getElementById("toolbarDIV");
	d.style.top=t-d.offsetHeight+2 +"px";
	var d = document.getElementById("toolbarFrame");
	d.width = w+2;

	var d = document.getElementById("toolbarImg1");
	d.style.top=t-d.offsetHeight-1 +"px";
	var d = document.getElementById("toolbarImg2");
	d.style.top=t-d.offsetHeight-1 +"px";
	d.style.left = w-20 +"px";
	oldscrolltop = e.scrollTop
	oldBodyClientHeight = e.clientHeight;
}
function hideToolBar(){
	document.getElementById("toolbarDIV").style.display="none";
	document.getElementById("toolbarImg1").style.display="block";
	document.getElementById("toolbarImg2").style.display="block";
	fixToolBar();
	toolbarStatement="hide"
}
function showToolBar(){
	document.getElementById("toolbarDIV").style.display="block";
	document.getElementById("toolbarDIV").style.filter="alpha(opacity=25)";
	setTimeout('document.getElementById("toolbarDIV").style.filter="alpha(opacity=50)";',50);
	setTimeout('document.getElementById("toolbarDIV").style.filter="alpha(opacity=75)";',100);
	setTimeout('document.getElementById("toolbarDIV").style.filter="alpha(opacity=100)";',150);
	document.getElementById("toolbarImg1").style.display="none";
	document.getElementById("toolbarImg2").style.display="none";
	fixToolBar();
	toolbarStatement="show"
}

function doOnScroll(){
	var e = document.body
	if (document.documentElement.clientHeight>0)
	e=document.documentElement;
	if(e.scrollTop == oldscrolltop && oldBodyClientHeight == e.clientHeight) return;
	if(timer)clearTimeout(timer);
	if(toolbarStatement=="hide")
		timer = setTimeout(hideToolBar,800)
	else
		timer = setTimeout(showToolBar,800)
	document.getElementById("toolbarDIV").style.display=document.getElementById("toolbarImg1").style.display=document.getElementById("toolbarImg2").style.display="none";

}

addToolBar()
var fixTimer = setInterval(doOnScroll,1000);
var isIE = !!document.all;
if(isIE){
	window.attachEvent("onload",function(){clearInterval(fixTimer)});
	window.attachEvent("onresize",fixToolBar);
	window.attachEvent("onscroll",doOnScroll);
}else{
	window.addEventListener('resize', fixToolBar, false); 
	window.addEventListener('scroll', doOnScroll, false); 
}
