var xmlHttp;
function creatXMLHttpRequest() {
	if(window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
	}
}
function MediaWin(fname)             {             
 window.open(fname,'tv','toolbar=no,menubar=no,directories=no,status=no,width=525,height=500,scrollbars=no');            
 } 
function switchtask(id,cid,ids,cids){
	var tasks,news,i;
	tasks = ids.split(",");
	for(var i=0;i<tasks.length;i++)
		eval(tasks[i]+".className='taskoff';");
	news = cids.split(",");
	for(var i=0;i<news.length;i++)
		eval(news[i]+".style.display='none';");
	id.className="taskon";
	cid.style.display="block";
}
function login(){
	if (document.userlogon.username.value=="")
		{
		     window.alert("请填写用户帐号！");
		     document.userlogon.username.focus();
		     return false;
		    }
	if (document.userlogon.passwd.value=="")
		    {
		      window.alert("请填写用户密码！");
		      document.userlogon.passwd.focus();
		      return false;
		    }
 	if(document.userlogon.usertype.selectedIndex == 0)
 	{
 	document.userlogon.action="/usercenter/login.php";
 	}

 	if(document.userlogon.usertype.selectedIndex == 1)
	 {
	 document.userlogon.action="http://siteshare21.gsinfo.net.cn/index.php";
 	}

 	document.userlogon.submit;
}
function delinfo(table,id,url){
 if(confirm("你确定删除本条信息吗?")){
	window.location.href="/include/xquery.php?action=delete&dbid="+table+"&id="+id+"&url="+url;
 }
}
function updateinfo(table,id,url,query,msgbox,title){
	var queryString;
	var RegisterURI = "/include/xquery.php";
	queryString = "action=update&dbid="+table+"&id="+id+"&query="+query+"&url="+url+"&title="+title;
	creatXMLHttpRequest();
	xmlHttp.open("POST",RegisterURI,"true");
	xmlHttp.onreadystatechange = function(){handleStateChange(msgbox)};
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	xmlHttp.send(queryString);
}
function handleStateChange(msgbox){
	if(xmlHttp.readyState == 4) {
		if(xmlHttp.status == 200) {
			if(xmlHttp.responseText=="ok")
				if(msgbox=="yes")
					alert("用户操作成功");
		}
	}
}