//读取COOKIE
function GetCookieData(sL)
{
    var sRet="";
    var sC=""+document.cookie;
    if(sC.length>0)
    {
        var aC=sC.split(";",100);
        var iC=aC.length;
        for(var i=0;i<iC;i++)
        {
            if(aC[i].indexOf(sL+"=")!=-1)
            {
                var aRet=aC[i].split("=");
                sRet=unescape(aRet[1]);
                break;
            }
        }
    }
    return sRet;
}


//屏蔽js错误
// function ResumeError() {
// return true;
// }
// window.onerror = ResumeError;


function Submit_onclick()
 {
 if(parent.document.getElementById("left").style.width=='179px'){
 parent.document.getElementById("left").style.width='0px';
 parent.document.getElementById("main").style.width='662px';
 parent.document.getElementById("ImgArrow").src='images_hompy/right.gif';
 }
 else{
 parent.document.getElementById("left").style.width='179px';
 parent.document.getElementById("main").style.width='482px';
 parent.document.getElementById("ImgArrow").src='images_hompy/left.gif';
 }
  }  
  
function Submit_onclick1()
 {

 parent.document.getElementById("left").style.width='0px';
 parent.document.getElementById("main").style.width='662px';
 parent.document.getElementById("ImgArrow").src='images_hompy/right.gif';

  }  
function Submit_onclick2()
 {

 parent.document.getElementById("left").style.width='179px';
 parent.document.getElementById("main").style.width='482px';
 parent.document.getElementById("ImgArrow").src='images_hompy/left.gif';

  }  


//跳转页面显示

function ShowPage(TotalPage,PageIndex,url){
document.write("<div class=manu><span class=disabled>"+PageIndex+"/"+TotalPage+"</span>");
document.write("<a href=?PageIndex=1&"+url+"><<</a>");
if (PageIndex<6){PageLong=11-PageIndex;}
else
if (TotalPage-PageIndex<6){PageLong=10-(TotalPage-PageIndex)}
else{PageLong=5;}
for (var i=1; i <= TotalPage; i++) {
if (i < PageIndex+PageLong && i > PageIndex-PageLong || i==1 || i==TotalPage){
if (PageIndex==i){document.write("<span class=current><b>"+ i +"</b></span>");}else{document.write("<a href=?PageIndex="+i+"&"+url+">"+ i +"</a>");}
}
}
document.write("<a href=?PageIndex="+TotalPage+"&"+url+">>></a></div>");
}

//全选复选框
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;}}

//全选主题ID复选框
function ThreadIDCheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name == 'ThreadID')e.checked = form.chkall.checked;
}
}
//全选主题ID复选框
function CheckedAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name == 'list')e.checked = form.chkall.checked;
}
}
//自定义类别
function ChangeCategory()
{
	CategoryName=prompt("请输入类别名称(最多20个字符):","");
	if(!CategoryName) return;
	if(CategoryName.length > 20){alert("类别名称不能大于20个字符！");return false;}
	this.focus();
	i=document.form.Category.length;
	document.form.Category.options[i]=new Option(CategoryName,CategoryName);
	document.form.Category.options[i].selected=true;
}

//图片check
function Submit_check()
 {
 if(parent.document.getElementById('CookieDate').value=='0'){
 parent.document.getElementById('checked').src='images_1/checked.gif';	 
 parent.document.getElementById('CookieDate').value='3';
 }
 else{
 parent.document.getElementById('checked').src='images_1/check.gif';
 parent.document.getElementById('CookieDate').value='0';
 }
  }  

// add area script
function focusEdit(editBox)
{
 if ( editBox.value == editBox.Helptext )
 {
 editBox.value = '';
 editBox.className = 'editbox';
 }
 return true;
}
function blurEdit(editBox)
{
 if ( editBox.value.length == 0 )
 {
 editBox.className = 'editbox Graytitle';
 editBox.value = editBox.Helptext;
 }
}
function ValidateTextboxAdd(box, button)
{
 var buttonCtrl = document.getElementById( button );
 if ( buttonCtrl != null )
 {
 if (box.value == "" || box.value == box.Helptext)
 {
 buttonCtrl.disabled = true;
 }
 else
 {
 buttonCtrl.disabled = false;
 }
 }
}
// add area script end


function loadtree(ino){
frames["hiddenframe"].location.replace("ForumTree.asp?id="+ino+"")
}

function loadThreadFollow(ino,Online){
var targetImg =document.getElementById("followImg" + ino);
var targetDiv =document.getElementById("follow" + ino);
if (targetDiv.style.display!='block'){
if(targetImg.loaded=="no"){frames["hiddenframe"].location.replace("loading.asp?id="+ino+"&ForumID="+Online+"");}
targetDiv.style.display="block";
targetImg.src="images/minus.gif";
}else{
targetDiv.style.display="none";
targetImg.src="images/plus.gif";
}
}

function ToggleMenuOnOff (menuName) {
    var menu = document.getElementById(menuName);
    if (menu.style.display == 'none') {
      menu.style.display = 'block';
    } else {
      menu.style.display = 'none';
    }
}

function OpenWindow (target) { 
  window.open(target, "_Child", "toolbar=no,scrollbars=yes,resizable=yes,width=400,height=400"); 
}
function OpenFriendWindows (target,width,height) { 
  window.open(target, "Friend", "toolbar=no,scrollbars=yes,resizable=yes,resizable=yes,width="+width+",height="+height+""); 
}
function OpenFriendWindow (target) { 
  window.open(target, "Friend", "resizable=yes,resizable=yes,width=320,height=160"); 
}
function OpenFriendWindow2 (target) { 
  window.open(target, "open", "resizable=yes,resizable=yes,width=320,height=190"); 
}

function OpenWindow3 (target) { 
  window.open(target, "open2", "toolbar=no,scrollbars=yes,resizable=yes,width=320,height=400"); 
}

function log_out()
{
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('你确定要退出？'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
}
function log_outs()
{
	
	if (confirm('你确定要退出？'))
	{
		return true;
	}
	else
	{
		
		return false;
	}
}
function guest_del()
{
	
	if (confirm('你确定要删除？'))
	{
		return true;
	}
	else
	{
		
		return false;
	}
}
function guest_stop()
{
	
	alert('请先停用！');
}

function ShowError(sitename,message){
document.writeln("<style type=\"text\/css\">body {margin:20px 10px 10px 6px;}<\/style>");	
document.writeln("<table cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"480\" class=\"tdcolor\"  style=\"border:1px solid #dddddd;padding-bottom:5px;padding-top:8px;\">");
document.writeln("<tr align=\"center\"><td width=\"100%\" ><b><font style=font-size:12px;>错误信息</font><\/b><\/td><\/tr>");
document.writeln("<tr align=\"center\"><td width=\"100%\" style=\"padding:0px;height:1px;\"><img src=\"\" height=1 width=460 style=\"background:#dddddd\"><br><img src=\"\" height=1 width=460 style=\"background:#ffffff\"><\/td><\/tr>");
document.writeln("<tr><td width=\"100%\" style=\"padding:5px 8px 8px 8px;font-size:12px;color:#666666\" height=80 valign=top>"+message+"<\/td><\/tr>");
document.writeln("<\/table>");
}

function Succ(sitename,message){
	
document.writeln("<style type=\"text\/css\">body {margin:20px 10px 10px 6px;}a:link{FONT:normal 12px Tahoma, Arial, Helvetica, Sans-Serif;text-decoration:underline;color:#999999}a:visited{FONT:normal 12px Tahoma, Arial, Helvetica, Sans-Serif;text-decoration:underline;color:#999999}a:active{FONT:normal 12px Tahoma, Arial, Helvetica, Sans-Serif;TEXT-DECORATION:underline;color:#999999}a:hover{FONT:normal 12px Tahoma, Arial, Helvetica, Sans-Serif;COLOR: #999999; TEXT-DECORATION: none}<\/style>");	
document.writeln("<table cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"480\" class=\"tdcolor\" style=\"border:1px solid #dddddd;padding-bottom:5px;padding-top:8px;\">");
document.writeln("<tr align=\"center\"><td width=\"100%\" ><b><font style=font-size:12px;>操作成功</font><\/b><\/td><\/tr>");
document.writeln("<tr align=\"center\"><td width=\"100%\" style=\"padding:0px;height:1px;\"><img src=\"\" height=1 width=460 style=\"background:#dddddd\"><br><img src=\"\" height=1 width=460 style=\"background:#ffffff\"><\/td><\/tr>");
document.writeln("<tr><td width=\"100%\" style=\"padding:10px 8px 12px 8px;font-size:12px;color:#666666;\" height=80 valign=top><b><span id=\"count\">3<\/span><a href=\"javascript:countDown\"><\/a>秒钟后系统将自动返回...<\/b><br>"+message+"<\/td><\/tr>");
document.writeln("<\/table>");
countDown(3);
}


function countDown(secs)
{
count.innerText=secs;if(--secs>0)setTimeout("countDown("+secs+")",1000);
}

function showdz(sID)
{
whichEl = eval("dz" + sID);
if (whichEl.style.display == "none")
{
eval("dz" + sID + ".style.display=\"\";");
}
else
{
eval("dz" + sID + ".style.display=\"none\";");
}
}

function setFontSize(n)
{
	var elements = document.getElementsByTagName('span');
	for (var i=0; i<elements.length; i++)
	{
		var element = elements[i];
		if (element.getAttribute('name') != 'content') continue;
		element.style.fontSize   = n + 'px';
		element.style.lineHeight = (8 + n) + 'px';
	}
}
