/*

*/
var showtime=0;
var marginL=10; //??
var it1;

function ShowPop(){
	var popup=document.createElement("DIV");
	popup.id="popup";
	popup.className='t';
	popup.style.height=popHeight+"px";
	popup.style.width=popWidth+"px";
	popup.style.padding="0";
	popup.style.margin="0";
	popup.style.backgroundColor="";
	popup.style.position="absolute";
	popup.style.top=ietruebody().clientHeight+ietruebody().scrollTop-marginL-popHeight+"px";
	popup.style.right=marginL+"px";
	popup.innerHTML="<table cellspacing=0 cellpadding=0 width=100%><tr><td class='h'><span style='float:right;'>"+popTitle+"<a id='closeButton' title='close' onclick='hidePop();'>X</a></span></td></tr><tr class='f_one'><td style='padding:5px;'>" + popCode + "</td></tr></table>";
	var btn = findElement(popup,'a',"closeButton");
	btn.style.cssText='cursor:pointer;padding:1px 2px 1px;height:8px;width:8px;margin-left:5px;border:1px solid #9ad; font:9px Verdana; text-decoration:none;';
	
	document.body.appendChild(popup);
	it1 = setInterval("floatPop()",100);
}
function floatPop(){
	if(autoClose>0){
		showtime++;
		if(showtime > autoClose*10){
			hidePop('auto');
			return;
		}
	}
	document.getElementById("popup").style.top=ietruebody().clientHeight+ietruebody().scrollTop-marginL-popHeight+"px";
}
function hidePop(type){
	document.getElementById("popup").style.display="none";
	clearInterval(it1);
	if(typeof type=='undefined') document.cookie="hidepop=1; path=/";
}
function findElement(root,tag,id){
	var ar=root.getElementsByTagName(tag);
	for(var i=0;i<ar.length;i++){
		if(ar[i].id==id) return ar[i];
	}
	return null;
}

/*
?
*/
var it2;
var delay = 10;
var x = 0,y = 60; //?
var xin = true,yin = true;
var step = 1;

function ShowAd(){
	document.write("<div id='floatAd' style='position:absolute;border:1px solid #f00; z-index:100;'>");
	document.write(floatCode);
	//document.write("<br /><a style='cursor:pointer;' onclick='hideAd();'>?</a></div>");
	obj = document.getElementById("floatAd");
	it2= setInterval("floatAd()", delay);
	obj.onmouseover=function(){clearInterval(it2)};
	obj.onmouseout=function(){it2=setInterval("floatAd()", delay)};
}
function floatAd(){
	var L=T=-20;
	var R = ietruebody().clientWidth-obj.offsetWidth;
	var B = ietruebody().clientHeight-obj.offsetHeight;
	obj = document.getElementById("floatAd");
	obj.style.left =0; // x + ietruebody().scrollLeft + "px";
	obj.style.top = y + ietruebody().scrollTop + "px";
	x = x + step*(xin?1:-1);
	if (x < L) { xin = true; x = L};
	if (x > R) { xin = false; x = R};
	y = y + step*(yin?1:-1);
	if (y < T) { yin = true; y = T };
	if (y > B) { yin = false; y = B };
}
function hideAd(){
	document.getElementById("floatAd").style.display="none";
	clearInterval(it2);
}

/*
?
*/
var marginTop = 3; //???
var marginX = 0; // ?
var it3;

function ShowFloat(){
	//LeftCode+='<a href="http://news.woniu.com/5jqnews/2008-05-15/1096.shtml" target="_blank"><img src="http://bbs.woniu.com/images/150w.jpg" border=0/></a>';
	if(LeftCode!='')
		document.write("<div id=\"adLeftFloat2\" style=\"position: absolute; z-index:100; left:"+marginX+"px; top:"+marginTop+"px;\">"+LeftCode+"</div>");
	if(RightCode!='')
		document.write("<div id=\"adRightFloat\" style=\"position: absolute; z-index:100; right:"+marginX+"px; top:"+marginTop+"px;\">"+ RightCode +"</div>");
	moveFloat();
}
function hideFloat(){
	clearTimeout(it3);
	if(IsElement("adLeftFloat2"))
		document.getElementById("adLeftFloat2").style.display = "none";
	if(IsElement("adRightFloat"))
		document.getElementById("adRightFloat").style.display = "none";
	return false;
}
function moveFloat(){
	if(IsElement("adLeftFloat2"))
		document.getElementById("adLeftFloat2").style.top = ietruebody().scrollTop + marginTop + 'px';
	if(IsElement("adRightFloat"))
		document.getElementById("adRightFloat").style.top = ietruebody().scrollTop + marginTop + 'px';
	it3 = setTimeout("moveFloat();",80);
}