function submitonce(theform)
{
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById)
	{
		//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++)
		{
			var tempobj=theform.elements[i];
			if(tempobj.type.toLowerCase() == "submit"
				|| tempobj.type.toLowerCase() == "reset")
			{
				//disable em
				tempobj.disabled=true;
			}
		}
	}
}

function copyText(obj) {
    var rng = document.body.createTextRange();
    rng.moveToElementText(obj);
    rng.scrollIntoView();
    rng.select();
    rng.execCommand("Copy");
    rng.collapse(false);
}

function openScript(url, width, height)
{
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}

function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if (e.name != 'chkall')
			e.checked = form.chkall.checked;
	}
}

//************* 双脚鼠标滚动屏幕 ********************************
var timer;
function initialize() { timer=setInterval("scrollwindow()",10);}
function sc(){clearInterval(timer);}
function scrollwindow(){currentpos=document.body.scrollTop;window.scroll(0,++currentpos);if (currentpos != document.body.scrollTop) sc();}
document.onmousedown=sc
document.ondblclick=initialize


//************* 获取客户端操作系统及浏览器类型 *********************
var __userAgent = window.navigator.userAgent.toLowerCase();
var __platform = window.navigator.platform.toLowerCase();
function getUserPlatform()
{
    var os = "未知";
    if(__platform.indexOf('win') != -1)
    {
        os = "win";
    }
    else if (__platform.indexOf('mac') != -1)
    {
        os = "Macintosh";
    }
    else if (__platform.indexOf('sun') != -1)
    {
        os = "Solaris";
    }
    else if (__platform.indexOf('hp-ux') != -1)
    {
        os = "HP Unix";
    }
    else if (__platform.indexOf('linux') != -1)
    {
        os = "Linux";
    }
    else if (__platform.indexOf('unix') != -1)
    {
        os = "Unix";
    }
    else
    {
        os = "未知";
    }
    //对Windows的处理
    if(os == "win")
    {
        if (__userAgent.indexOf('windows 95') != -1)
        {
            os = "Windows 95";
        }
        else if (__userAgent.indexOf('windows 98') != -1)
        {
            os = "Windows 98";
        }
        else if (__userAgent.indexOf('win 9x') != -1)
        {
            os = "Windows Me";
        }
        else if (__userAgent.indexOf('nt 5.0') != -1)
        {
            os = "Windows 2000";
        }
        else if (__userAgent.indexOf('nt 5.1') != -1)
        {
            os = "Windows XP";
        }
        else
        {
            os = "Windows";
        }
    }
    return os;
}

function getUserNavigator()
{
    var browser = "未知";
    var p1 = 0;
    var p2 = 0;
    if (__userAgent.indexOf('msie') != -1)
    {
        browser = "Microsoft Internet Explorer";
        p1 = __userAgent.indexOf("msie");
        p2 = __userAgent.indexOf(";", p1);
        browser += __userAgent.substring(p1 + 4, p2);
    }
    else if (__userAgent.indexOf('opera') != -1)
    {
        browser = "Opera";
    }
    else if (__userAgent.indexOf('mozilla') != -1)
    {
        browser = "Netscape";
    }
    else if (__userAgent.indexOf('aol') != -1)
    {
        browser = "AOL";
    }
    else if (__userAgent.indexOf('hotjava') != -1)
    {
        browser = "Sun HotJava";
    }
    else
    {
        browser = "未知";
    }
    return browser;
}



//*********** 以下为弹出文字提示框 *********************
tPopWait=50;//停留tWait豪秒后显示提示。
tPopShow=5000;//显示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;
if(o!=null)
{
    MouseX=event.x;
    MouseY=event.y;
    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;

//下拉菜单相关代码
 var h;
 var w;
 var l;
 var t;
 var topMar = 1;
 var leftMar = -2;
 var space = 1;
 var isvisible;
 var MENU_SHADOW_COLOR='#999999';//定义下拉菜单阴影色
 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;
	vMnuCode = "<table id='submenu' cellspacing=1 cellpadding=3 style='width:"+tWidth+"' class=tableborder1 onmouseout='HideMenu()'><tr height=23><td nowrap align=left class=tablebody1>" + vMnuCode + "</td></tr></table>";

	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	l = vSrc.offsetLeft + leftMar+4;
	t = vSrc.offsetTop + topMar + h + space-2;
	vParent = vSrc.offsetParent;
	while (vParent.tagName.toUpperCase() != "BODY")
	{
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	}

	menuDiv.innerHTML = vMnuCode;
	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 = color;
		var opacity = 1 - i / (i + 1);
		rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		el.insertAdjacentElement('afterEnd', rect);
		global.fo_shadows[global.fo_shadows.length] = rect;
	}
}


//add by sungeng for change forum style 2005-03-07
function modifyStyle(skin){
    var url = escape(location.href);
    window.location = 'modifyStyle.jsp?skin='+skin+'&parmurl='+url;

}

//用户控制面板
var manage= '<a style=font-size:9pt;line-height:14pt; href=\"JavaScript:openScript(\'messanger.asp?action=new\',500,400)\">发短信</a><br><a style=font-size:9pt;line-height:14pt; href=\"dispuser.asp?id=0&boardid=16&action=permission\">我能做什么</a><br><a style=font-size:9pt;line-height:14pt; href=\"topicwithme.asp?s=2\">我发表的主题</a><br><a style=font-size:9pt;line-height:14pt; href=\"topicwithme.asp?s=1\">我参与的主题</a><br><a style=font-size:9pt;line-height:14pt; href=\"mymodify.asp\">基本资料修改</a><br><a style=font-size:9pt;line-height:14pt; href=\"modifypsw.asp\">用户密码修改</a><br><a style=font-size:9pt;line-height:14pt; href=\"modifyadd.asp\">联系资料修改</a><br><a style=font-size:9pt;line-height:14pt; href=\"usersms.asp\">用户短信服务</a><br><a style=font-size:9pt;line-height:14pt; href=\"friendlist.asp\">编辑好友列表</a><br><a style=font-size:9pt;line-height:14pt; href=\"favlist.asp\">用户收藏管理</a><br><a style=font-size:9pt;line-height:14pt; href=\"myfile.asp\">个人文件管理</a>'
//模板列表
var stylelist = '<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>'

//论坛状态
var boardstat= '<a style=font-size:9pt;line-height:14pt; href=\"boardstat.asp?boardid=16\">今日贴数图例</a><br><a style=font-size:9pt;line-height:14pt; href=\"boardstat.asp?action=lasttopicnum&boardid=16\">主题数图例</a><br><a style=font-size:9pt;line-height:14pt; href=\"boardstat.asp?action=lastbbsnum&boardid=16\">总帖数图例</a><br><a style=font-size:9pt;line-height:14pt; href=\"boardstat.asp?reaction=online&boardid=16\">在线图例</a><br><a style=font-size:9pt;line-height:14pt; href=\"boardstat.asp?reaction=onlineinfo&boardid=16\">在线情况</a><br><a style=font-size:9pt;line-height:14pt; href=\"boardstat.asp?reaction=onlineUserinfo&boardid=16\">用户组在线图例</a>'
//论坛收藏
var downlist= '<a style=font-size:9pt;line-height:14pt; href=\"show.asp?filetype=0&boardid=16\">文件集浏览</a><br><a style=font-size:9pt;line-height:14pt; href=\"show.asp?filetype=1&boardid=16\">图片集浏览</a><br><a style=font-size:9pt;line-height:14pt; href=\"show.asp?filetype=2&boardid=16\">Flash浏览</a><br><a style=font-size:9pt;line-height:14pt; href=\"show.asp?filetype=3&boardid=16\">音乐集浏览</a><br><a style=font-size:9pt;line-height:14pt; href=\"show.asp?filetype=4&boardid=16\">电影集浏览</a><br><a style=font-size:9pt;line-height:14pt; href=\"show.asp\">贺卡发送</a>'

