//Pop-it menu- By Dynamic Drive - Modified by Wbird
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var menuOffX=0	//菜单距连接文字最左端距离
var menuOffY=18	//菜单距连接文字顶端距离

var fo_shadows=new Array()
var linkset=new Array()

var tmenu = '<a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("default");>恢复默认设置</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("default");>默认模板</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("blue");>蓝色主题</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("green");>绿色主题</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("orange");>桔色主题</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("purple");>水晶紫色</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("autumn");>秋意盎然</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("brown");>棕红预览</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("purpleA");>紫色淡雅</a>'+
'<br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("snow");>雪花飘飘</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("etown");>e点小镇</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("gray");>心情灰色</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("grass");>青青河草</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("greenA");>绿色淡雅</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("bluegreen");>兰雅绿</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("blueA");>蓝色水晶</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("red");>红红夜思</a><br><a style=font-size:9pt;line-height:12pt; href=JavaScript:modifyStyle("pink");>粉色回忆</a>'


////No need to edit beyond here

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no' );
}
function mybook() {
  h = 300;
  w = 300;
  t = ( screen.availHeight - h ) / 2;
  l = ( screen.availWidth - w ) / 2;
  window.open("http://forumAd.to5198.com/common/login.jsp?sCheckUrl=/out/login.jsp&sDesUrl=/out/mybook.jsp", "我的服务",
     "left=" + l + ",top=" + t + ",height=" + h + ",width=" + w
     + ",toolbar=no,status=no,scrollbars=no,resizable=yes" );
  return;
}
function showmenu(e,vmenu,mod){
	if (!document.all&&!document.getElementById&&!document.layers)
		return
	which=vmenu
	clearhidemenu()
	ie_clearshadow()
	menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
	menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj

	if (ie4||ns6)
		menuobj.innerHTML=which
	else{
		menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
		menuobj.document.close()
	}
	menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
	menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height

	eventX=ie4? event.clientX : ns6? e.clientX : e.x
	eventY=ie4? event.clientY : ns6? e.clientY : e.y

	var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
	var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
		if (rightedge<menuobj.contentwidth)
			menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
		else
			menuobj.thestyle.left=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX

		if (bottomedge<menuobj.contentheight&&mod!=0)
			menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23 : ns6? window.pageYOffset+eventY-menuobj.contentheight-10 : eventY-menuobj.contentheight
		else
			menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
	menuobj.thestyle.visibility="visible"
	ie_dropshadow(menuobj,"#999999",3)
	return false
}

function ie_y(e){
	var t=e.offsetTop;
	while(e=e.offsetParent){
		t+=e.offsetTop;
	}
	return t;
}
function ie_x(e){
	var l=e.offsetLeft;
	while(e=e.offsetParent){
		l+=e.offsetLeft;
	}
	return l;
}
function ie_dropshadow(el, color, size)
{
	var i;
	for (i=size; i>0; i--)
	{
		var rect = document.createElement('div');
		var rs = rect.style
		rs.position = 'absolute';
		rs.left = (el.style.posLeft + i) + 'px';
		rs.top = (el.style.posTop + i) + 'px';
		rs.width = el.offsetWidth + 'px';
		rs.height = el.offsetHeight + 'px';
		rs.zIndex = el.style.zIndex - i;
		rs.backgroundColor = color;
		var opacity = 1 - i / (i + 1);
		rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		//el.insertAdjacentElement('afterEnd', rect);
		fo_shadows[fo_shadows.length] = rect;
	}
}
function ie_clearshadow()
{
	for(var i=0;i<fo_shadows.length;i++)
	{
		if (fo_shadows[i])
			fo_shadows[i].style.display="none"
	}
	fo_shadows=new Array();
}


function contains_ns6(a, b) {
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
	return false;
}

function hidemenu(){
	if (window.menuobj)
		menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
	ie_clearshadow()
}

function dynamichide(e){
	if (ie4&&!menuobj.contains(e.toElement))
		hidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
		hidemenu()
}

function delayhidemenu(){
	if (ie4||ns6||ns4)
		delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
	if (window.delayhide)
		clearTimeout(delayhide)
}

function highlightmenu(e,state){
	if (document.all)
		source_el=event.srcElement
	else if (document.getElementById)
		source_el=e.target
	if (source_el.className=="menuitems"){
		source_el.id=(state=="on")? "mouseoverstyle" : ""
	}
	else{
		while(source_el.id!="popmenu"){
			source_el=document.getElementById? source_el.parentNode : source_el.parentElement
			if (source_el.className=="menuitems"){
				source_el.id=(state=="on")? "mouseoverstyle" : ""
			}
		}
	}
}

if (ie4||ns6)
document.onclick=hidemenu
function doSClick() {
	var targetId, srcElement, targetElement, imageId, imageElement;
	srcElement = window.event.srcElement;
	targetId = srcElement.id + "content";
	targetElement = document.all(targetId);
	imageId = srcElement.id;
	imageId = imageId.charAt(0);
	imageElement = document.all(imageId);
	if (targetElement.style.display == "none") {
		imageElement.src = "Skins/Default/minus.gif"
		targetElement.style.display = "";
	} else {
		imageElement.src = "Skins/Default/plus.gif"
		targetElement.style.display = "none";
	}
}
function doClick() {
	var targetId, srcElement, targetElement;
	srcElement = window.event.srcElement;
	targetId = srcElement.id + "_content";
	targetElement = document.all(targetId);
	if (targetElement.style.display == "none") {
		srcElement.src = "Skins/Default/minus.gif"
		targetElement.style.display = "";
	} else {
		srcElement.src = "Skins/Default/plus.gif"
		targetElement.style.display = "none";
	}
}

//HTML过滤函数
function HTMLEncode(text)
{
	text = text.replace(/&/g, "&amp;") ;
	text = text.replace(/"/g, "&quot;") ;
	text = text.replace(/</g, "&lt;") ;
	text = text.replace(/>/g, "&gt;") ;
	text = text.replace(/'/g, "&#146;") ;

	return text ;
}
function bbimg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}
function Dvbbs_ViewCode(replyid)
{
	var bodyTag="<html><head><style type=text/css>.quote{margin:5px 20px;border:1px solid #CCCCCC;padding:5px; background:#F3F3F3 }\nbody{boder:0px}.HtmlCode{margin:5px 20px;border:1px solid #CCCCCC;padding:5px;background:#FDFDDF;font-size:14px;font-family:Tahoma;font-style : oblique;line-height : normal ;font-weight:bold;}\nbody{boder:0px}</style></head><BODY bgcolor=\"#FFFFFF\" >";
	bodyTag+=document.getElementById('scode'+replyid).CodeText.value
	bodyTag+="</body></html>"
	preWin=window.open('preview','','left=0,top=0,width=550,height=400,resizable=1,scrollbars=1, status=1, toolbar=1, menubar=0');
	preWin.document.open();
	preWin.document.write(bodyTag);
	preWin.document.close();
	preWin.document.title="查看贴子内容";
	preWin.document.charset="UTF-8";
}

var template=new Array();
var piclist=new Array();
var Strings=new Array();
var mainsetting=new Array();
var ShowMasters,tablecount,tablewidth,islist,Divstr1,Divstr2,listst,RootID=0,Child=0,boardcount=0;
var tmpstr1,tmpstr2
var k
//显示分类头表格，入口参数BoardID,BoardType,Board_Setting
function showclass(BoardID,BoardType,Board_Setting,Cookies,vChild)
{
	Board_Setting=Board_Setting.split(",")
	var pic='Skins/Default/nofollow.gif';
	var thetitle=Strings[3]
	tablecount=(Board_Setting[41]);
	tablewidth=Math.floor(100/tablecount);
	tablewidth+="%"
	var Divstr1=''
	var Divstr2='style=display:none'
	RootID=BoardID
	Child=(vChild)
	boardcount=0
	var str=template[0]
	if(Cookies=='')
	{
		islist=(Board_Setting[39])
	}
	else
	{
		islist=(Cookies)
	}
	if (islist!="0")
	{
		pic='Skins/Default/plus.gif';
		thetitle=Strings[4]
		Divstr2=''
		Divstr1='style=display:none'
		str = str.replace(/{\$value}/gi,"0");
	}
	else
	{
		str = str.replace(/{\$value}/gi,"1");
	}

	str = str.replace(/{\$boardid}/gi,BoardID);
	str = str.replace(/{\$pic}/gi,pic);
	str = str.replace(/{\$title}/gi,thetitle);
	str = str.replace(/{\$BoardType}/gi,BoardType);
	str = str.replace(/{\$Divstr1}/gi,Divstr1);
	str = str.replace(/{\$Divstr2}/gi,Divstr2);
	document.write (str);
	k=0
}

function showboard(BoardID,BoardType,child,readme,BoardMaster,PostNum,TopicNum,indexIMG,todayNum,LastPost,Board_Setting,havenew)
{
	boardcount++
	k++
	var str=template[2]
	var str1=template[4]
	Board_Setting=Board_Setting.split(",")
	BoardMaster=BoardMaster.split("|")
	ShowMasters=''
	ShowMaster=''
	var tmp
	for(j=0;j<BoardMaster.length;j++)
	{
		if (j>5){ShowMasters+=' <font color=gray>More</font>';break;}
		ShowMasters+='&nbsp;<a  onMouseOver=\'showmenu(event,"<a style=font-size:9pt;line-height:14pt; href=dispuser.asp?name='+BoardMaster[j]+' target=_blank>资料</a><br><a style=font-size:9pt;line-height:14pt; href=messanger.asp?action=new&touser='+BoardMaster[j]+' target=_blank>留言</a>")\'>'+BoardMaster[j]+'</a>';
	}
	for(j=0;j<BoardMaster.length;j++)
	{
		if (j>1){ShowMaster+=' <font color=gray>More</font>';break;}
		ShowMaster+='&nbsp;<a  onMouseOver=\'showmenu(event,"<a style=font-size:9pt;line-height:14pt; href=dispuser.asp?name='+BoardMaster[j]+' target=_blank>资料</a><br><a style=font-size:9pt;line-height:14pt; href=messanger.asp?action=new&touser='+BoardMaster[j]+' target=_blank>留言</a>")\'>'+BoardMaster[j]+'</a>';
	}
	str = str.replace(/{\$boardid}/gi,BoardID);
	str1 = str1.replace(/{\$boardid}/gi,BoardID);
	str1 = str1.replace(/{\$width}/gi,tablewidth);
	str1 = str1.replace(/{\$blinkcolor}/gi,mainsetting[3]);
	str1 = str1.replace(/{\$alertcolor}/gi,mainsetting[1]);
	str1 = str1.replace(/{\$ShowMasters}/gi,ShowMaster);
	str1 = str1.replace(/{\$todayNum}/gi,todayNum);
	str1 = str1.replace(/{\$PostNum}/gi,PostNum);
	str1 = str1.replace(/{\$TopicNum}/gi,TopicNum);
	str1 = str1.replace(/{\$readme}/gi,HTMLEncode(readme));
	str = str.replace(/{\$BoardType}/gi,BoardType);
	str1 = str1.replace(/{\$BoardType}/gi,BoardType);

	if (child==0)
	{
		str = str.replace(/{\$child}/gi,'');
		str1 = str1.replace(/{\$child}/gi,'');
	}
	else
	{
		tmp = Strings[1];
		tmp = tmp.replace(/{\$child}/gi,child);
		str1 = str1.replace(/{\$child}/gi,tmp);
		str = str.replace(/{\$child}/gi,tmp);
		Child=Child-child;
	}
	str = str.replace(/{\$statuspic}/gi,showpic(havenew,Board_Setting[0],Board_Setting[2]));
	str = str.replace(/{\$readme}/gi,readme);
	str = str.replace(/{\$ShowMasters}/gi,ShowMasters);
	str = str.replace(/{\$PostNum}/gi,PostNum);
	str = str.replace(/{\$TopicNum}/gi,TopicNum);
	str = str.replace(/{\$todayNum}/gi,todayNum);
	str = str.replace(/{\$blinkcolor}/gi,mainsetting[3]);
	str = str.replace(/{\$alertcolor}/gi,mainsetting[1]);
	if (Board_Setting[2]=='1')
	{
		str = str.replace(/{\$LastPost}/gi,Strings[2]);
	}
	else
	{
		str = str.replace(/{\$LastPost}/gi,showlastpost(LastPost));
	}

	if (indexIMG!='')
	{
		str = str.replace(/{\$indexIMG}/gi,'<table align="left"><tr><td><a href="list.asp?boardid='+BoardID+'"><img src='+indexIMG+' align="top" border="0"></a></td><td width="20"></td></tr></table>');
	}
	else
	{
		str = str.replace(/{\$indexIMG}/gi,'');
	}
	if(k==tablecount)
	{
		str1+="</tr>"
		if (boardcount!=Child)
		{str1+="<tr>"}
		k=0
	}

	showcode(str,str1)
}
function showcode(str,str1)
{
	if (boardcount==1)
	{
		tmpstr1=template[1]
		tmpstr2=template[1]
		tmpstr2+="<tr>"
	}
	tmpstr1+=str
	tmpstr2+=str1
}
function classfooter()
{
	if (k!=0)
		{	template[5]=template[5].replace(/{\$width}/gi,tablewidth);
			for(jj=0;jj<tablecount-k;jj++)
			{
			tmpstr2+=template[5]
			}
		}
		tmpstr1+=template[3]
		tmpstr2+="</tr>"
		tmpstr2+=template[3]
		document.getElementById("ListDiv1_"+RootID).innerHTML=tmpstr1
		document.getElementById("ListDiv2_"+RootID).innerHTML=tmpstr2
		tmpstr1='';
		tmpstr2='';
		boardcount=0
}

function showpic(havenew,Board_Setting,Board_Setting1)
{
	var pic,Str,Str1
	Str="无新贴"
	Str1="开放的版面"
	pic=piclist[0]
	if(havenew==1)
	{
		Str="有新贴"
		pic=piclist[1]
	}
	if(Board_Setting==1)
	{
		pic=piclist[2]
		Str1="锁定的版面"
	}
	if(Board_Setting1==1)
	{
		pic=piclist[2]
		Str1="认证论坛"
	}
	return('<img src="'+pic+'" alt="'+Str1+','+Str+'">')
}
function showlastpost(lastpoststr)
{
	lastpoststr=lastpoststr.replace(/</gi,'&lt;');
	if (lastpoststr=='$$$$'||lastpoststr=='')
	{
		return('主题：无<br>作者：无<br>日期：无')
	}
	else
	{
		var str='';
		lastpoststr=lastpoststr.split("$");
		str+='主题：<a href="Dispbbs.asp?boardid='+lastpoststr[7]+'&ID='+lastpoststr[6]+'&replyID='+lastpoststr[1]+'&skin=1" title="转到：'+lastpoststr[3]+'">';
		str+=lastpoststr[3].substring(0,10);
		str+='</a>';
		str+='<br>作者：';
		str+='<a href="dispuser.asp?id='+lastpoststr[5]+'" target="_blank">'+lastpoststr[0] +'</a>';
		str+='<br>日期：';
		str+=lastpoststr[2] +'&nbsp;<a href="dispbbs.asp?Boardid='+lastpoststr[7]+'&ID='+ lastpoststr[6] +'&replyID=' + lastpoststr[1] +'&skin=1"><IMG border=0 src="Skins/Default/lastpost.gif" title="主题：'+lastpoststr[3]+'"></a>';
		return(str)
	}

}
function ReShowList(ListID)
{
	var ListDiv1=document.getElementById("ListDiv1_"+ListID);
	var ListDiv2=document.getElementById("ListDiv2_"+ListID);
	var titlepic=document.getElementById("titlepic_"+ListID);
	if (ListDiv1.style.display=='none')
	{
		ListDiv2.style.display='none';
		ListDiv1.style.display='block';
		titlepic.innerHTML='<a href="cookies.asp?action=setlistmod&thisvalue=1&id='+ListID+'" target="hiddenframe"><img src="Skins/Default/nofollow.gif" border=0 title='+Strings[3]+'></a>';

	}
	else
	{
		ListDiv1.style.display='none';
		ListDiv2.style.display='block';
		titlepic.innerHTML='<a href="cookies.asp?action=setlistmod&thisvalue=0&id='+ListID+'" target="hiddenframe"><img src="Skins/Default/plus.gif" border=0 title='+Strings[4]+'></a>';

	}
}
