var Startime,Endtime;
var now =new Date()
Startime=now.getTime();

function links(type)
{
	this.type=type
}

function Showpic(picurl,vTitle)
{
	if (picurl!='')
	{
		if (vTitle=="")
		{
			return('<img border=0 src="'+picurl+'" align="absmiddle" >');
		}
		else
		{
			return('<img border=0 src="'+picurl+'" title="'+vTitle+'" align="absmiddle">');
		}
	}
}
//一般标题过滤
function dvhtmlencode(str)
{
	var tmpstr=''
	if (str!='')
	{	
		var Bword
		str=str.replace(/ /gi,"&nbsp;")
		str=str.replace(/>/gi,"&#62;")
		str=str.replace(/</gi,"&#60;")
		str=str.replace("/","&#47;")
		str=str.replace(/\r/gi,"")
		str=str.replace(/\n/gi,"")
		str=str.replace(/\'/gi,"&#39;")
		str=str.replace(/\"/gi,'&#34;')
		str=str.replace(/'/gi,"&#39;")
		str=str.replace(/"/gi,'&#34;')
		for (iii=0;iii<Dvbbs.Badwords.length ;iii++ )
		{	
			Badword=Dvbbs.Badwords[iii]
			Bword =eval('/'+Badword+'/gi');
			for (q=0;q<Badword.length;q++)
			{
				tmpstr+='*'
			}
			str=str.replace(Badword,tmpstr)
			tmpstr=''
		}
	}
	else
	{
		str='';
		
	}return(str);
}
function dvhtmlencode1(str)
{
	var tmpstr=''
	if (str!='')
	{	
		var Bword
		str=str.replace(/ /gi,"&nbsp;")
		str=str.replace(/>/gi,"&gt;")
		str=str.replace(/</gi,"&lt;")
		for (iii=0;iii<Dvbbs.Badwords.length ;iii++ )
		{	
			Badword=Dvbbs.Badwords[iii]
			Bword =eval('/'+Badword+'/gi');
			for (q=0;q<Badword.length;q++)
			{
				tmpstr+='*'
			}
			str=str.replace(Bword,tmpstr)
			tmpstr=''
		}
	}
	else
	{
		str='';
		
	}return(str);
}
//针对js特效菜单中的过滤
function vhtmlencode(str)
{
	var tmpstr=''
	if (str!='')
	{	
		var Bword
		str=str.replace(/ /gi,"&nbsp;")
		str=str.replace("\r","<br>")
		str=str.replace("\n","<br>")
		str=str.replace("\'","‘")
		str=str.replace(/>/gi,"》")
		str=str.replace(/</gi,"《")
		str=str.replace(/&gt;/gi,"》")
		str=str.replace(/&lt;/gi,"《")
		str=str.replace(/&quot;/gi,'“')
		str=str.replace(/&#34/gi,'“')
		str=str.replace(/&#39/gi,"‘")
		str=str.replace("'","‘")
		str=str.replace('"','“')
		for (iii=0;iii<Dvbbs.Badwords.length ;iii++ )
		{	
			Badword=Dvbbs.Badwords[iii]
			Bword =eval('/'+Badword+'/gi');
			for (q=0;q<Badword.length;q++)
			{
				tmpstr+='*'
			}
			str=str.replace((Dvbbs.Badwords[iii]),tmpstr)
			tmpstr=''
		}
	}
	else
	{
		str='';
	}
return(str);
}
//上一版本中现在继续使用的JS
//标题处理开始
//***********默认设置定义.*********************
tPopWait=50;//停留tWait豪秒后显示提示。
tPopShow=1000;//显示tShow豪秒后关闭提示
showPopStep=20;
popOpacity=99;
//***************内部变量定义*****************
sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;
document.write('<style type="text/css" id="defaultPopStyle">');
document.write('.cPopText {  background-color: #F8F8F5;color:#000000; border: 1px #000000 solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}');
document.write('</style>');
document.write('<div id="dypopLayer" style="position:absolute;z-index:1000;" class="cPopText"></div>');
function showPopupText()
{
	var o=event.srcElement;
	MouseX=event.x;
	MouseY=event.y;
	
	if (((o.tagName=="INPUT") || (o.tagName=="TEXTAREA"))&&(! o.disabled))
	{
		//o.
		//if ( o.blur )
		{
			//o.focus();
			//o.value += "";
		}
	}

	if( o.HintWidth != null)
	{
		dypopLayer.style.width = o.HintWidth
	}
	if(o.alt!=null && o.alt!='')
	{
		o.dypop=o.alt;o.alt=''
	}
	if(o.title!=null && o.title!="")
	{
		o.dypop=o.title;o.title=''
	}
	if(o.dypop!=sPop)
	{		
		sPop=o.dypop;
		clearTimeout(curShow);
		clearTimeout(tFadeOut);
		clearTimeout(tFadeIn);
		clearTimeout(tFadeWaiting);	
		if(sPop==null || sPop=='') 
		{
			dypopLayer.innerHTML='';
			dypopLayer.style.filter='Alpha()';
			dypopLayer.filters.Alpha.opacity=0;	
		}
		else 
		{
			if(o.dyclass!=null) popStyle=o.dyclass 
			else popStyle='cPopText';
			curShow=setTimeout('showIt()',tPopWait);
		}
	}
}
	
function showIt()
{
		dypopLayer.className=popStyle;
		dypopLayer.innerHTML=sPop;
		popWidth=dypopLayer.clientWidth;
		popHeight=dypopLayer.clientHeight;
		if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
			else popLeftAdjust=0;
		if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
			else popTopAdjust=0;
		dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
		dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
		dypopLayer.style.filter='Alpha(Opacity=0)';
		fadeOut();
}

function fadeOut(){
	if(dypopLayer.filters.Alpha.opacity<popOpacity) 
	{
		dypopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout('fadeOut()',1);
	}
	else 
	{
		dypopLayer.filters.Alpha.opacity=popOpacity;
		tFadeWaiting=setTimeout('fadeIn()',tPopShow);
		}
}

function fadeIn(){
	if(dypopLayer.filters.Alpha.opacity>0)
	 {
		dypopLayer.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout('fadeIn()',1);
	}
}
document.onmouseover=showPopupText;

document.write ('<div id="menuDiv" style="Z-INDEX: 2; WIDTH: 1px; POSITION: absolute; HEIGHT: 1px; BACKGROUND-COLOR: #9cc5f8; visibility: hidden;"></div>');
//标题处理结束
//下拉菜单相关代码
 var h;
 var w;
 var l;
 var t;
 var topMar = 1;
 var leftMar = -5;
 var space = 1;
 var isvisible;
 var MENU_SHADOW_COLOR='#D9D9D9';//定义下拉菜单阴影色
 var global = window.document
 global.fo_currentMenu = null
 global.fo_shadows = new Array

function HideMenu() 
{
 	var mX;
 	var mY;
 	var vDiv;
 	var mDiv;
	if (isvisible == true)
	{
		vDiv = document.all("menuDiv");
		mX = window.event.clientX + document.body.scrollLeft;
		mY = window.event.clientY + document.body.scrollTop;
		if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight))
		{
			vDiv.style.visibility = "hidden";
			isvisible = false;
		}
	}
}

function ShowMenu(vMnuCode,tWidth) 
{
	vSrc = window.event.srcElement;
	if (tWidth<0)	
		tWidth = vSrc.offsetWidth;
	vMnuCode = "<table id='submenu' cellspacing=1 cellpadding=3 style='width:"+tWidth+"' class=tbpopMenu onmouseout='HideMenu()'><tr height=23><td nowrap align=center class=tablebody1 valign=middle >" + vMnuCode + "</td></tr></table>";

	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	l = vSrc.offsetLeft + leftMar+4;
	t = vSrc.offsetTop + topMar + h + space+5;
	vParent = vSrc.offsetParent;
	while (vParent.tagName.toUpperCase() != "BODY")
	{
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	}

	menuDiv.innerHTML = vMnuCode;
	//if ( t + menuDiv.clientHeight >document.body.clientHeight ) 
	//	t = t-menuDiv.clientHeight - vSrc.offsetHeight/2
	if ( l + menuDiv.clientWidth >document.body.clientWidth ) 
		l = l-vSrc.offsetWidth
	menuDiv.style.top = t;
	menuDiv.style.left = l;
	menuDiv.style.visibility = "visible";
	isvisible = true;
    makeRectangularDropShadow(submenu, MENU_SHADOW_COLOR, 4)
}
function makeRectangularDropShadow(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 = '#FFFFCC';
		var opacity = 1 - i / (i + 1);
		rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		el.insertAdjacentElement('afterEnd', rect);
		global.fo_shadows[global.fo_shadows.length] = rect;
	}
}
/////////////////////////////////////////////
//定义快捷键
///无常　2003.12.1

document.onkeydown=keydown;

function keydown() //设置键盘运行操作对象函数
{

	//status = event.keyCode;

	//status = Date() + String.fromCharCode(event.keyCode) + "   " + event.keyCode + "   " + window.event.srcElement.url;
	//if (window.event.ctrlKey && window.event.keyCode==10)	
	//if (window.event.keyCode==10) 
	{
		//document.plan_new.submit.click()
		//status = 
	}
	//if ( event.ctrlKey&& event.srcElement.tagName!="INPUT" &&event.srcElement.tagName!="TEXTAREA" && event.keyCode==192 ) 
	//if (window.event.keyCode==10) 
	//status = top.main.bbsmain.name;
	
	// ESC 键清除表单内容
	if( event.keyCode==27 )
	{
		if ( event.srcElement.tagName=="INPUT" ||event.srcElement.tagName=="TEXTAREA" 
			||event.srcElement.tagName=="TSELECT" ) 
		{
			event.returnValue=false;
		}
	}
	
	//论坛快捷键
	if ( /*event.ctrlKey&&*/event.srcElement.tagName!="INPUT" &&event.srcElement.tagName!="TEXTAREA" 
		&&event.srcElement.tagName!="TSELECT" ) 
	{
		if( event.keyCode==192 )
		{
			if( top.main.bbsmain == null )
			{
				status = "null" + Date();
				top.main.location.href = "/bbs/bbs_list.asp";
				top.main.bbsmain.location.href = "/bbs/list_new_today.asp";
			}else
			{
				top.main.bbsmain.location.href = "/bbs/list_new_today.asp";
			}
		
		}
		//event.returnValue=false;
	}
}

function SaveAs( FileName )
{
	//html="";
	//t=document.all.item(0,0);
	//while(t!=null)
	//{
	//	html+=t.outerHTML;
	//	t=t.nextSibling;
	//}
	//document.open("text/html","gb2312");
	//document.write(html);
	//document.execCommand("SaveAs",true,document.title+"1.htm");
	document.execCommand("SaveAs",false, FileName.toString());
}

//滚轮缩放图片
function wuChang_img_onmousewheel(e, o)
{
        var zoom = parseInt(o.style.zoom, 10) || 100;

        zoom += event.wheelDelta / 12;
        if (zoom > 0) o.style.zoom = zoom + '%';

        return false;
}

//Alt+S或Ctrl+Enter发送
//调用　onkeydown=ctlent()
function ctlent( frm)
{
	if ((event.ctrlKey && window.event.keyCode==13)  || (window.event.keyCode=='s'))
		frm.Submit.click()
}

