var gsPathImages = './D001_images/';
var gsPathInclude = './D001_include/';

var MAINASPX = 'index.aspx';
var ADMINNAME = '密码';
var ISADMIN = false;
var docDW = document;
var dyHint = null;

var GUESTLIMIT = false;
var iWinWidth = screen.width / 8 * 7;

//获取实际长度
function LenB(str){
	var i,n,c,k;
	n = str.length;
	k = 0;
	for (i=0;i<n;i++){
		c = str.charCodeAt(i);
		k++;
		if ((c < 0) || (c > 255)) k++;
	}
	return k;
}

//获取指定长度字符
function GetStrLeft(str,len){
	var i,n,s,c,k;
	n = str.length;
	k = 0;
	s = '';
	for (i=0;i<n;i++){
		c = str.charCodeAt(i);
		k++;
		if ((c < 0) || (c > 255)) k++;
		if (k < len){
			s += str.charAt(i);
			continue;
		}
		if (k > len){
			s += '.';
			break;
		}
		if (i == n - 1)
			s += str.charAt(i);
		else{
			if ((c < 0) || (c > 255))
				s += '..';
			else
				s += '.';
		}
		break;
	}
	return s;
}

//需要此两函数处理输入的汉字，Program By Aoeiuv.Com
function GetAString(s){
	var c,n,i;
	c = '';
	n = s.length;
	for (i=0;i<n;i++)
	{
		if (s.charCodeAt(i) == 0) return c;
		c += s.charAt(i);
	}
	return c;
}

function GetInput(info,d){
	var s
	s = prompt(info,d);
	if (s)
		return GetAString(s);
	else
		return '';
}
//处理汉字输入，Program By Aoeiuv.Com

function dw(){
	var i,n;
	n = arguments.length;
	for (i=0;i<n;i++)
		docDW.write(arguments[i]);
}

function wos(url,msg){
	window.focus();
	if (msg != null) 
		if (msg != '') 
			if (!confirm(msg)) return;
	return window.open(url,'_self');
//	window.open(a,'','width=200,height=200,status=yes,toolbar=yes,menubar=no,location=no,resizable=yes,scrollbars=yes');
}

function wo(url,msg){
	window.focus();
	if (msg != null)
		if (msg != '') 
			if (!confirm(msg)) return;
	return window.open(url,'_blank');
}

function woc(url,msg){
	window.focus();
	if (!confirm(msg)) return;
	return window.open(url,'_blank');
}

function FormSubmitMsg(frm,url,msg){
	if (msg != null) 
		if (msg != '') 
			if (!confirm(msg)) return false;
	frm.action = url;
	return true;
}

function TrOver(t){
	t.style.backgroundColor = '#CCCCCC';
}

function TrOut(t){
	t.style.backgroundColor = '';
}

function TrOverClub(t){
	t._className = t.className;
	t.className = t._className + 'S';
}

function TrOutClub(t){
	t.className = t._className;
}

//<A href="aoeiuv10.aspx" onclick="return SetForHomepage(this);" target="_self">设为首页</a>
function SetForHomepage(it){
	it.style.behavior='url(#default#homepage)';
	it.setHomePage('http://www.aoeiuv.com');
	return false;
}

//<A href="aoeiuv10.aspx" onclick="return SetAddFavorite(this);">加入收藏</a>
function SetAddFavorite(it){
	window.external.AddFavorite('http://www.aoeiuv.com','宝贝悟语(aoeiuv.com)');
	return false;
}

function TodayInfo(){
	var today = new Date();
	var y = today.getYear();
	var m = today.getMonth() + 1;
	var d = today.getDate();
	var w = today.getDay();
	var wd = new Array('日','一','二','三','四','五','六');
	return  y + '年' + m + '月' + d + '日 星期' + wd[w];
}


function ShowTable(width,border,pad,align){
	return '<table width="'+width+'" border="'+border+'" cellspacing="0" cellpadding="'+pad
		+ '" bordercolorlight="#BAE684" bordercolordark="#FFFFFF" style="text-align:'+align+'">';
}

function ShowTableC(cs,border){
	return '<table class="'+cs+'" border="'+border+'" cellspacing="0" cellpadding="0" bordercolorlight="#BAE684" bordercolordark="#FFFFFF">';
}

function ShowLineTd(colspan){
	return '<tr height="1"><td colspan="'+colspan+'"><img height="0"></td></tr>';
}

function div(a,b){
	return (a - a % b) / b;
}

function GetSize(size){
	if (size < 10000) return size;
	var s = Math.round(size / 1024);
	if (s < 100) s = s + ' ';
	return s + 'K';
}

function GuestDo(t){
	alert('提示：登录前不能进行文本选取或鼠标拖拽。');
	return false;
}

function GuestPause() {
	document.oncontextmenu = null;
	document.ondragstart = null;
	document.onselectstart = null;
//	if (event != null) {event.returnValue=true; event.cancelBubble=false;}
	return true;
}

var IntervalID;
function GuestFun(){
	document.oncontextmenu = GuestDo;
	document.ondragstart = GuestDo;
	document.onselectstart = GuestDo;
//	window.clearInterval(IntervalID);
}

if (GUESTLIMIT)
{
	if (0 == USERID)
	{
		document.oncontextmenu = GuestDo;
		document.ondragstart = GuestDo;
		document.onselectstart = GuestDo;
		IntervalID = window.setInterval("GuestFun()",100);	
	}
}

function ShowMyLoading(doc)
{
	var img,x,y;
	with (doc)
	{
		img = createElement('IMG');
		img.style.position = "absolute";
		img.style.display = 'block';
		img.src = '/club/images/loading.asp';
		img.style.zOrder = 99;
		x = body.scrollLeft + (body.clientWidth - 64) / 2;
		y = body.scrollTop + (body.clientHeight - 64) / 2;
		img.style.pixelLeft = x;
		img.style.pixelTop  = y;
		body.insertBefore(img);
	}
}
/*--------------小-------亮-------晓-------之-------亮--------------------------
作者：密码
主页：<a href="http://www.aoeiuv.com">宝贝悟语(aoeiuv.com)</a>
说明：显示滚动公告以及显示提示信息
申明：如果您使用了以下的代码，请保留头注释。
历史：2003年03月18日 创建
1.0版：2003年03月18日
1.目前该功能只支持IE4以上版本。
------------------------------------------------－请－保－留－以－上－信－息－*/
var isNS = (document.layers);
var isIE = (document.all);

function js(obj, obj_name) { 
	var result = '', i = '';
	for (i in obj)
//	if (obj[i] != '' && obj[i] != '[object]' && obj[i] != null)
		result += obj_name + '.' + i + ' = ' + obj[i] + '\n';
	return result;
}

//<div id="dyLLB" onmouseover="this._MoveStop=true;" onmouseout="this._MoveStop=false;" title="<b>鼠标移到上面将暂停滚动，移开后恢复。</b>"></div>
//ScrollText('dyLLB')
function ScrollTextFun(d){
	var s = 'ScrollTextFun("'+d+'")';
	with (eval(d)){
		if (_MoveStop){
			_Timeout = setTimeout(s,100);
			return;
		}
		var n = scrollTop;
		scrollTop += _Step;
		if (n == scrollTop) scrollTop = _Step;
		if (scrollTop == 0 || scrollTop == scrollHeight - 18)
			_Timeout = setTimeout(s,_TimerScroll);
		else
			if (Math.round(scrollTop / _LineHeight) * _LineHeight == scrollTop)
				_Timeout = setTimeout(s,_TimerStop);
			else
				_Timeout = setTimeout(s,_TimerScroll);
	}
}

function ScrollText(d){
	var ff = eval(d);
	if (ff._Timeout != null) clearTimeout(ff._Timeout);
	with (ff.style){
		overflow = 'auto';
		overflowX = 'hidden';
		overflowY = 'hidden';
		paddingRight = 4; 
		paddingLeft = 4;
		paddingTop = 2;
		paddingBottom = 2;
		fontSize = '12px';
		lineHeight = "14px";
		height = 16;
	}
	ff.scrollTop = 0;
	ff._Step = 2;
	ff._TimerScroll = 100;
	ff._TimerStop = 3000;
	ff._LineHeight = 14;
	ff._MoveStop = false;
	ScrollTextFun(d);
}

/*
document.write('<div id="dyHint" style="left:0;top:0;visibility:hidden; position:absolute;z-index:777;background-color: #F4F7FB; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; padding-top: 4px; padding-bottom: 4px;overflow-x:hidden;overflow-y:hidden; text-align:left"></div>');
dyHint._Type = 0;
dyHint._tWait = 200;
dyHint._tStep = 50;
dyHint._tStop = 5000
dyHint._tOver = 100;
dyHint._CurH = 0;
dyHint._StepOpen = 8;
dyHint._StepClose = 8;
dyHint._ScrollOpen = false;
dyHint._ScrollClose = true;
dyHint._TimeOut = 0;
dyHint._From = null;
*/

// 取代系统的提示信息
function ToShowTitle(t){
	if ((t == null) || (t == '')) return;
	dyHint = document.createElement('DIV');
	dyHint.style.cssText = 'left:0;top:0;visibility:hidden; position:absolute;z-index:777;background-color: #F4F7FB; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; padding-top: 4px; padding-bottom: 4px;overflow-x:hidden;overflow-y:hidden; text-align:left';
	dyHint._Type = 0;
	dyHint._tWait = 200;
	dyHint._tStep = 50;
	dyHint._tStop = 7000
	dyHint._tOver = 100;
	dyHint._CurH = 0;
	dyHint._StepOpen = 8;
	dyHint._StepClose = 8;
	dyHint._ScrollOpen = false;
	dyHint._ScrollClose = true;
	dyHint._TimeOut = 0;
	dyHint._From = null;
	document.body.insertBefore(dyHint);

	t = t.replace(/\n/ig,'<br>');
	with (dyHint)
	{
		innerHTML = t;
		_From = event.srcElement;
		_From.title = '';
		var l = event.clientX+document.body.scrollLeft+12;
		var t = event.clientY+document.body.scrollTop+15;
		var l1 = document.body.clientWidth + document.body.scrollLeft - 10;
		var t1 = document.body.clientHeight + document.body.scrollTop - 10;
		if (l + scrollWidth > l1) l = l1 - scrollWidth;
		if (t + scrollHeight > t1) t = t1 - scrollHeight;
		_CurH = 0;
		_Type = 1;
		with (style){
			height = 0;
			pixelLeft = l;
			pixelTop = t;
		}
		_TimeOut =	window.setTimeout('ShowTitle()',_tWait);
	}
}

function GetTitle(){
	var t = event.srcElement;
	if ((t == null) || (t == '')) return true;
	t = t.title;
	if (!((t == null) || (t == '')))
		ToShowTitle(t);
	if (ghOldOnMouseOver != null) 
		return ghOldOnMouseOver;
	else
		return true;
}

function ShowTitle(){
	with (dyHint){
		var n = scrollHeight;
		switch (_Type){
			case 1:
				style.visibility = 'visible';
				_Type = 2;
			case 2:
				if ((_CurH += _StepOpen) > n) _CurH = n;
				if (_ScrollOpen) scrollTop = n - _CurH;
				if ((style.height = _CurH) == n) 
				{
					_Type = 3;
					_TimeOut = window.setTimeout('ShowTitle()',_tStop);
				}else
					_TimeOut = window.setTimeout('ShowTitle()',_tStep);
				break;
			case 3:
				if ((_CurH -= _StepClose) < 0) _CurH = 0;
				if (_ScrollClose) scrollTop = n - _CurH;
				if ((style.height = _CurH) == 0)
					StopTitle();
				else
					_TimeOut = window.setTimeout('ShowTitle()',_tOver);
				break;
		}
	}
}

function StopTitle(){
	if (null == dyHint) return;
	with (dyHint)
	{
		clearTimeout(_TimeOut);
		_TimeOut = 0;
		_Type = 0;
		style.visibility = 'hidden';
		if (_From == null) return;
		_From.title = innerHTML;
		_From = null
	}
	dyHint.removeNode(true);
	dyHint = null;
	if (ghOldOnMouseUp != null) 
		return ghOldOnMouseUp;
	else
		return true;
}

/*--------------小-------亮-------晓-------之-------亮--------------------------
作者：密码
主页：<a href="http://www.aoeiuv.com">宝贝悟语(aoeiuv.com)</a>
说明：建立浮动且可拖动的发贴专用章
申明：如果您使用了以下的代码，请保留头注释。
历史：2001-9-15 创建
      1.0版：
	       1.目前该功能只支持IE4以上版本。
			<div style="position:absolute;" onmousedown="Drag(this)">
------------------------------------------------－请－保－留－以－上－信－息－*/
var aDivCount = 10;
var aDivFloater = new Array(10);//(null,null,null,null,null,null,null,null,null,null);
for (var aN=0;aN<10 ;aN++ ) aDivFloater[aN] = null;

var OldMouseX,OldMouseY,OldDivX,OldDivY;
var DragDiv = null;
var floaterLeft = 0 , floaterTop = 0 ;
var FloatImgNum = 0;
var iStep = 7;
var IntervalID = 0;

var OldMouseOver = document.onmouseover;
var OldMouseUp = document.onmouseup;

function divMouseMove()
{
	if (null == DragDiv) return;
	var mouseX = event.clientX - OldMouseX + OldDivX + document.body.scrollLeft;
	var mouseY = event.clientY - OldMouseY + OldDivY + document.body.scrollTop;
	DragDiv.style.pixelLeft = mouseX;
	DragDiv.style.pixelTop = mouseY;

	return;
}

function UnDrag()
{
	event.srcElement.style.position = '';
}

function Drag(div)
{
	if (event.button==2) 
	{
		if (1 == div._IsFloater)
		{
			if (confirm('按确定取消浮动功能^_^ ')) DelFloater(div);
		}
		else
		{
			if (confirm('按确定打开浮动功能：） '))	AddFloater(div,1);
		}
		return false;
	}

	div._IsDrag = 1;
	div.ondblclick = UnDrag;
	DragDiv = div;

	if (div.style.position != "absolute"){
		OldMouseX = event.clientX + document.body.scrollLeft;
		OldMouseY = event.clientY + document.body.scrollTop;
		div.style.position = "absolute";
		div.style.pixelLeft = OldMouseX;
		div.style.pixelTop  = OldMouseY;
		OldDivX = OldMouseX - 2;
		OldDivY = OldMouseY - 2;
	}
	else
	{
		OldMouseX = event.clientX + document.body.scrollLeft;
		OldMouseY = event.clientY + document.body.scrollTop;
		OldDivX = OldMouseX - event.offsetX - 2;
		OldDivY = OldMouseY - event.offsetY - 2;
	}

	OldMouseOver = document.onmouseover;
	OldMouseUp = document.onmouseup;
	document.onmousemove = divMouseMove;
	document.onmouseup   = divMouseUp;

	return false;
}

function divMouseUp()
{
	var l,t;

	if (event.button==2) 
	{
		window.event.cancelBubble = true;
		return;
	}

	if (null == DragDiv) return;

	l = document.body.scrollLeft + document.body.clientWidth - DragDiv.scrollWidth;
	t = document.body.scrollTop + document.body.clientHeight - DragDiv.scrollHeight;

	if (DragDiv.style.pixelLeft > l) DragDiv.style.pixelLeft = l;
	if (DragDiv.style.pixelTop  > t) DragDiv.style.pixelTop  = t;

	l = document.body.scrollLeft;
	t = document.body.scrollTop;

	if (DragDiv.style.pixelLeft < l) DragDiv.style.pixelLeft = l;
	if (DragDiv.style.pixelTop  < t) DragDiv.style.pixelTop  = t;


	DragDiv._floaterLeft = DragDiv.style.pixelLeft - document.body.scrollLeft;
	DragDiv._floaterTop = DragDiv.style.pixelTop - document.body.scrollTop;
	DragDiv._IsDrag = 0;
	DragDiv = null;
	
	document.onmousemove = OldMouseOver;
	document.onmouseup   = OldMouseUp;

	return;
}

function AddFloater(div,step){
	var i;
	if (1 == div._IsFloater) return;
	for (i=0;i<aDivCount ;i++ )
	{
		if (aDivFloater[i] == null)
		{
			div._Step = step;
			div._IsFloater = 1;
			div._floaterLeft = div.style.pixelLeft - document.body.scrollLeft;
			div._floaterTop = div.style.pixelTop - document.body.scrollTop;
			aDivFloater[i] = div;
			if (IntervalID == 0) 
				IntervalID = window.setInterval("SetFloater()",1);
			return;
		}
	}
}

function DelFloater(div){
	var i,n = 0;
	if (1 != div._IsFloater) return;
	for (i=0;i<aDivCount ;i++ )
	{
		if (aDivFloater[i] == null)
			n++;
		else if (aDivFloater[i] == div)
		{
			aDivFloater[i] = null;
			div._floaterLeft = div.style.pixelLeft;
			div._floaterTop = div.style.pixelTop;
			div._IsFloater = 0;
			n++;
		}
	}
	if (n == aDivCount)
	{
		if (IntervalID)
		{
			window.clearInterval(IntervalID);
			IntervalID = 0;
		}
	}
}

function SetFloater(){
	var i,div,newLeft,newTop;
	
	for (i=0;i<aDivCount ;i++)
	{
		if ((div = aDivFloater[i]) == null) continue;
		{
			if (1 == div._IsDrag) continue;
			newLeft = div._floaterLeft + document.body.scrollLeft;
			newTop = div._floaterTop + document.body.scrollTop;
			if (div._Step)
			{
				newLeft -= div.style.pixelLeft;
				newTop  -= div.style.pixelTop;
				newLeft /= iStep;
				newTop  /= iStep; 
				if (Math.abs(newLeft) >= 1)
					div.style.pixelLeft += newLeft;
				else
					div.style.pixelLeft = div._floaterLeft + document.body.scrollLeft;
				if (Math.abs(newTop) >= 1)
					div.style.pixelTop += newTop;
				else
					div.style.pixelTop = div._floaterTop + document.body.scrollTop;
			}
			else
			{
				div.style.pixelLeft = newLeft;
				div.style.pixelTop = newTop;
			}
		}
	}

}
//IntervalID = window.setInterval("SetFloater()",1);


/*--------------小-------亮-------晓-------之-------亮--------------------------
作者：密码
主页：<a href="http://www.aoeiuv.com">宝贝悟语(aoeiuv.com)</a>
说明：一些页面结束后的设置
申明：如果您使用了以下的代码，请保留头注释。
------------------------------------------------－请－保－留－以－上－信－息－*/
function ShowLoading()
{
//	return;
//	alert('tt');
	ShowMyLoading(document);
}

var gbFirstSubmit = true;
function FormSubmit(t){
	if (gbFirstSubmit)
	{
		if (confirm(t))
		{
			ShowLoading();
			gbFirstSubmit = false;
			return true;
		}
	}
	return false;
}

function FirstSubmit(){
	if (gbFirstSubmit)
	{
		ShowLoading();
		gbFirstSubmit = false;
		return true;
	}
	return false;
}

function MyAClick() {
	var t
	if ('A' == event.srcElement.tagName)
	{
		t = event.srcElement.target;
		if ('_self' == t)
			ShowLoading();
		if (!gbTargetBlank)
		{
			if (t == null) ShowLoading();
		}
	}
	else
		SetTextFocus();

	if (ghOldOnClick != null) 
		return ghOldOnClick;
	else
		return;
}

var gLastElement = null;

function SetTextFocus(){
	var v = event.srcElement;
	if (v == gLastElement) return;
	with (gLastElement = v){
		var s = v.type;
		if (s == "text" || s == "password")
		{
			if (!readOnly && !disabled){
				select();
				focus();
			}
		}
	}
}


function EL(s,t){
	var i,n,c,k;
	n = s.length;
	c = '';
	k = 0;
	for (i=0;i<n;i++)
	{
		k ++;
		if (k>29) k = 1;
		c += String.fromCharCode(s.charCodeAt(i)-k);
	}
	document.write(c.toLowerCase() + t + '</a>');
}


function tabTdClick(td){
	var i,n,tr,k,tbl;
	tr = td.parentElement;
	while (tr.tagName != 'TR') tr = tr.parentElement;
	n = tr.cells.length;
	for (i=0;i<n;i++){
		if (td == tr.cells(i)) k = i;
		tr.cells(i).className = 'CAreaTab';
	}
	td.className = 'CAreaTabA';

	tbl = tr.parentElement;	//.parentElement.parentElement;
	while (tbl.tagName != 'TABLE') tbl = tbl.parentElement;
	tbl = tbl.parentElement;	//.parentElement.parentElement;
	while (tbl.tagName != 'TABLE') tbl = tbl.parentElement;
	n = tbl.rows.length;
	for (i=1;i<n;i++){
		if (i == k+1)
			tbl.rows(i).className = 'Show';
		else
			tbl.rows(i).className = 'Hide';
	}
}

// 书页形式的Tab切换
function tabSwitch(td,he){
	var i,n,tr,k,tbl,css;
	css = td.className;
	n = css.length;
	if ('A' == css.charAt(n-1))	css = css.substring(0,n-1);
	if (he == null) he = 0;

	tr = td.parentElement;
	while (tr.tagName != 'TR') tr = tr.parentElement;
	n = tr.cells.length - he;
	for (i=he;i<n;i++){
		if (td == tr.cells(i)) k = i + 1 - he;
		tr.cells(i).className = css;
	}
	td.className = css + 'A';

	tbl = tr.parentElement;
	while (tbl.tagName != 'TABLE') tbl = tbl.parentElement;
	if (tbl.rows.length > 1)
	{
		tr = tbl.rows(1);
		for (i=1;i<n;i++) tr.cells(i).innerHTML = '';
		tr.cells(k).innerHTML = '<div class="TabSelect"><img class="hr" /></div>';
	}
	tbl = tbl.parentElement;
	while (tbl.tagName != 'TABLE') tbl = tbl.parentElement;
	n = tbl.rows.length;
	for (i=1;i<n;i++){
		if (i == k)
			tbl.rows(i).className = 'Show';
		else
			tbl.rows(i).className = 'Hide';
	}
}
