document.ns = navigator.appName == "Netscape"
var over=false,down=false,divleft,divtop;
var top
function open_member(typeID,nameID)
{
 window.open("http://forum.0898.net/showmember.php?typeID="+typeID+"&nameID="+nameID, '', '');
 return;
}
function sendmsg(urls,wl,hl){
        var theURL = urls
        var w=wl,h=hl
        var l=(screen.width-w)/2
        var t=(screen.height-h)/2
        if(screen.width < 800){
                l=t=0
        }
        window.open(theURL,"发送信息","fullscreen2=1;toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=1,status=0,top="+t+",left="+l+",width="+w+",height="+h)
}

function sendmsg_xiaoyuan(title,urls,wl,hl){
		var title=title
		var theURL = urls
        var w=wl,h=hl
        var l=(screen.width-w)/2
        var t=(screen.height-h)/2
        if(screen.width < 800){
                l=t=0
        }
        window.open(theURL,title,"fullscreen2=1;toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=1,status=0,top="+t+",left="+l+",width="+w+",height="+h)
}

function ShowTitle()
{
  if (Fav.st.value == 0){
    return;
  }
  if (Fav.st.value == 1){
    parent.right.location.href="showmessage.php";
    return;
  }
  if (Fav.st.value == 2){
    parent.right.location.href="showfriend.php";
    return;
  }
  if (Fav.st.value == 3){
    parent.right.location.href="changemember.php";
    return;
  }
  if (Fav.st.value == 4){
    parent.right.location.href="changepasswd.php";
    return;
  }
  if (Fav.st.value == 5){
    sendmsg('addmessage.php','310','220');
    return;
  }
  if (Fav.st.value == 6){
    parent.right.location.href="logout.php";
    return;
  }
  if (Fav.st.value == 7){
    parent.right.location.href="showonline.php";
    return;
  }
  if (Fav.st.value == 8){
    parent.right.location.href="showadminlog.php";
    return;
  }
  if (Fav.st.value == 9){
    parent.right.location.href="club_new.php?type=master";

    return;
  }
}
function ShowTitle_xiaoyuan()
{
  if (Fav.st.value == 0){
    return;
  }
  if (Fav.st.value == 1){
  //  parent.right.location.href="showmessage.php";
	sendmsg_xiaoyuan('消息列表','showmessage.php','310','220');
    return;
  }
  if (Fav.st.value == 2){
//    parent.right.location.href="showfriend.php";
	sendmsg_xiaoyuan('好友列表','showfriend.php','310','220');
    return;
  }
  if (Fav.st.value == 3){
    //parent.right.location.href="changemember.php";
	sendmsg_xiaoyuan('修改资料','changemember.php','310','220');
    return;
  }
  if (Fav.st.value == 4){
   //parent.right.location.href="changepasswd.php";
	sendmsg_xiaoyuan('修改密码','changepasswd.php','310','220');
    return;
  }
  if (Fav.st.value == 5){
    sendmsg('addmessage.php','310','220');
    return;
  }
  if (Fav.st.value == 6){
    location.href="logout.php";
    return;
  }
  if (Fav.st.value == 7){
    //parent.right.location.href="showonline.php";
	sendmsg_xiaoyuan('在线统计','showonline.php','310','220');
    return;
  }
  if (Fav.st.value == 8){
    //parent.right.location.href="showadminlog.php";
	sendmsg_xiaoyuan('管理日志','showadminlog.php','310','220');
    return;
  }
  if (Fav.st.value == 9){
    //parent.right.location.href="club_new.php?type=master";
	sendmsg_xiaoyuan('最新主题','index.php','310','220');

    return;
  }
}
function move() {
        if(down){
                menu.style.left=event.clientX-divleft;
                menu.style.top=event.clientY-divtop;
        }
}
function menumove()
{
        window.screen.width>800 ? top=160:top=0;
        if(document.ns)        {
                document.menu.top=pageYOffset+top;
                setTimeout("menumove();",1);
        } else {
                menu.style.top=document.body.scrollTop+top;
                setTimeout("menumove();",1);
        }
}
function upimage()
{
    img=window.prompt('贴图片是直接链接网上的图片（右键点击图片然后选属性可查地址）\n请输入图片的地址：','http://');
    if(img){
       if(img != "http://" && img != ""){
            window.restoreForm.maintext.innerText+='[img]'+img+'[/img]';
       }
    }
}
function actionRead(flag)
{
     if(flag == 1){
         document.restoreForm.restore_content.focus();
     }else{
         window.location.href="login.php";
     }
}
function CheckAll()
{
  for (var i=0;i<document.messageForm.elements.length;i++)
    {
    var e = document.messageForm.elements[i];
    if (e.name != 'allbox')
      e.checked = document.messageForm.allbox.checked;
    }
}


//Get sms

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var checkresult=null;
var username =null;

function $(s){
	return document.getElementById(s);
} 

function init(){
	window.setInterval('Check_sms()',10000); //每隔30秒检查一次
}

function Check_sms()

{
	xmlhttp.open("POST", "check_sms.php", false);
	xmlhttp.onreadystatechange = updatePage;
	xmlhttp.send();
}

function updatePage() {

	var showbox = $('sms_result');

	if (xmlhttp.readyState < 4) {
		//showbox.innerHTML="loading...";
	}

	if (xmlhttp.readyState == 4) {
	
		var response = xmlhttp.responseText;
		//判断为假
		if(response==1){
			//showbox.innerHTML="";
			checkresult=1;
		}else{ 
		//判断为真
			showbox.innerHTML="<a href=showmessage.php  target=right><img src=images/message.gif align=absmiddle border=0 onclick=window.location.reload()></a><bgsound src=images/new_msg.wav loop=1>";
			checkresult=0;
		}
	
	}

}