function check_form()
{
	var qhfile=$('qhfile').value;
	if(!qhfile)
	{
		alert('上传内容不能为空!');
		return false;
	}
	var usuid=$('usernameuid').value;
	if(!usuid)
	{
		alert('请先登录!');
		return false;
	}
	var item=qhfile.split('.');
	if(!item[1]=='txt'||!item[1]=='rar')
	{
		alert('只允许上传txt或者rar文件!');
		return false;
	}
}
function check_form1()
{
	var qhfile=$('qhfile1').value;
	if(!qhfile)
	{
		alert('上传内容不能为空!');
		return false;
	}
	var usuid=$('usernameuid').value;
	if(!usuid)
	{
		alert('请先登录!');
		return false;
	}
	var item=qhfile.split('.');
	if(!item[1]=='txt'||!item[1]=='rar')
	{
		alert('只允许上传txt或者rar文件!');
		return false;
	}
}

function search_user(eventobject){
	if((event.ctrlKey&&window.event.keyCode==13)||window.event.keyCode==13){
		document.getElementById("search_button").focus();
	}
}
function onsearch_pk_name(){
	var search_pk_name;
	 search_pk_name	= document.getElementById("search_pk_name").value; 
	var paihang=$('getpaihangvalue').value;
	var url = "danqi_list2.php?search_pk_name="+search_pk_name+'&paihang='+paihang; //alert(url);
	//alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack_onsearch_pk_name;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
	return false;
}

function search_user_keydown_pk_paiming(eventobject){
	if((event.ctrlKey&&window.event.keyCode==13)||window.event.keyCode==13){
		document.getElementById("onsearch_pk_name_button").focus();	 
	}
	
}

function onsearch_pre(){
	var search_username;
	search_username	= document.getElementById("search_username").value;
	if(search_username){
		onsearch();
	}else{
		alert("请输入关键字!");
	}
}


//用于弹出模块窗口
function openModalDialog(strurl) { //v2.0
	window.showModalDialog(strurl,window,"help: yes; resizable: yes; status: yes;scrollbars:yes;center: Yes;dialogWidth:600px;dialogHeight:500px;");
}

function getqihao()
{
	var url="danqi_list.php";
	var get_id=$('search_qihao').value;
	var pars ='getqihao='+get_id;
	var update='';
	var myAjax = new Ajax.Updater(
	update,
	url,
	{
		method: 'POST',
		parameters: pars,
		valScripts : true,
		onComplete:Show
	});
}
function Show()
{
	var stringText=response.responseText
	alert(stringText);
}

function onsearch()
{
	var search_qihao,search_username,search_alltime,search_button;
	search_qihao	= document.getElementById("search_qihao").selectedIndex;
	search_qihao	=	document.getElementById("search_qihao").options[search_qihao].value;

	search_username	= document.getElementById("search_username").value;

	search_alltime	= document.getElementById("search_alltime").checked;  
	search_button	= document.getElementById("search_button").value;
	var url = "danqi_list.php?search_username="+search_username+"&search_alltime="+search_alltime+"&search_qihao="+search_qihao+"&search_button="+search_button; //alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}

var xmlHttp;
function login_transfer() {
	var username,password,vercode;
	username=document.login.username.value;
	password=document.login.password.value;
	vercode=document.login.vercode.value;
	if(username==""){
		alert("请填写用户名!");
		exit();
	}else if(password==""){
		alert("请填写密码!");
		exit();
	}else if(vercode==""){
		alert("请输入验证码!");
		exit();
	}
	var url = "loginCheck.php?username="+username+"&password="+password+"&vercode="+vercode;
	//alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack_login;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}
function logout() {
	var username,password,vercode;
	username=document.login.username.value;
	password=document.login.password.value;
	vercode=document.login.vercode.value;

	var url = "loginCheck.php?logout=1";
	//alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack_logout;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}


function user_check() {

	var url = "loginCheck.php?user_check=1";
	//alert(qihao);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack_user_check;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
	//return false;
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
	var p;
		var search_qihao_id_hidden,search_alltime,search_username;
	
	search_qihao_id_hidden=document.getElementById("search_qihao_id_hidden").value;
	search_username	= document.getElementById("search_username_hidden").value;
	search_alltime	= document.getElementById("search_alltime_hidden").value;	
	
	//eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	p=selObj.selectedIndex + 1;
	//  alert(p);
	var url = "danqi_list.php?page=" + p +"&search_qihao="+search_qihao_id_hidden+"&search_alltime="+search_alltime+"&search_username="+search_username;
	//   alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);

	//  if (restore) selObj.selectedIndex=0;

}

function  MM_jumpMenu_pk(targ,selObj,restore){ //v3.0
	var p;
	//eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

	//    cin=document.select3.selectedIndex;
	//   //alert(document.form2.select.selectedIndex);
	//
	//
	//   p=document.select3.options[cin].value;
	p=selObj.selectedIndex;

	var paihang=$('getpaihangvalue').value;
	//  p=selObj.selectedIndex -1;
	//alert(p);
	var url = "danqi_list2.php?currentPage=" + p+'&paihang='+paihang;
	//alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack_pk_list;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);

	//  if (restore) selObj.selectedIndex=0;

}


function  MM_jumpMenu_qihao_id(targ,selObj,restore){ //v3.0
	var qihao_id,url;	
		qihao_id=selObj.selectedIndex ;
	//alert(qihao_id);
	  qihao_id=selObj.options[qihao_id].value;
	 url = "danqi_list.php?search_qihao=" + qihao_id;
//	alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}

function valideMail(p) {
	var search_qihao_id_hidden,search_alltime,search_username;
	
	search_qihao_id_hidden=document.getElementById("search_qihao_id_hidden").value;
	search_username	= document.getElementById("search_username_hidden").value;
	search_alltime	= document.getElementById("search_alltime_hidden").value;	
 
	var url = "danqi_list.php?page=" + p +"&search_qihao="+search_qihao_id_hidden+"&search_alltime="+search_alltime+"&search_username="+search_username;  
//alert(url);
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}
function callBack() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			//alert(xmlHttp.responseText);

			document.getElementById("show").innerHTML =  xmlHttp.responseText;

		}
	}
}
function valide_pk_list(p) {
	var paihang=$('getpaihangvalue').value;
	var url = "danqi_list2.php?currentPage=" + p+"&paihang="+paihang;
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	xmlHttp.onreadystatechange = callBack_pk_list;
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}
function callBack_pk_list() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			//alert(xmlHttp.responseText);

			document.getElementById("pk_list_content").innerHTML =  xmlHttp.responseText;
		}
	}
}

function callBack_logout() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			document.getElementById("logininfo").innerHTML =  xmlHttp.responseText;
		}
	}
}
function callBack_user_check() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			//document.getElementById("logininfo").innerHTML =  xmlHttp.responseText;
			if(xmlHttp.responseText){
				alert(xmlHttp.responseText);
				return false;

			}
			if(xmlHttp.responseText==""){

				document.f1.submit();
			}
			// document.getElementById("user_content").innerHTML =  xmlHttp.responseText;
			//document.f1.submit();
			//file_submit();

		}else{

			document.f1.submit();
		}

	}
}


function callBack_login() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			document.getElementById("logininfo").innerHTML =  xmlHttp.responseText;
		}
	}

}

//用于显示搜索用户排名
function callBack_onsearch_pk_name() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			document.getElementById("user_pk_order_id_show").innerHTML =  xmlHttp.responseText;
		}
	}

}

function  showMoney(){
	//alert(document.order.elements[0].value);
	//document.getElementById("showmoney").value ;
	var usermoney="<{$user_money}>";
	if(document.getElementById("showmoney").value=="显示"){
		document.getElementById("showmoney").value="隐藏";
		// document.getElementById("showMoney").innerHTML =  <{$usermoney}> ;
		document.getElementById("a2").innerHTML =  usermoney;
	}else	 if(document.getElementById("showmoney").value=="隐藏"){
		document.getElementById("showmoney").value="显示";

		document.getElementById("a2").innerHTML =  "******" ;
	}
}
function enterkey(e)
{
    if (e==13)
    {
    	alert('hello');
    	return false;
    }
    return false;
}
jQuery.noConflict();
/*首页登陆事件*/
jQuery("#username").focus(function(){jQuery(this).removeClass().addClass("input1");}).blur(function(){jQuery(this).removeClass().addClass("input0");});
jQuery("#password").focus(function(){jQuery(this).removeClass().addClass("input1");}).blur(function(){jQuery(this).removeClass().addClass("input0");});
jQuery("#vercode").focus(function(){jQuery(this).removeClass().addClass("input1");}).blur(function(){jQuery(this).removeClass().addClass("input0");});
jQuery("#SUB_FORM").focus(function(){jQuery(this).removeClass().addClass("input_bt_2");}).blur(function(){jQuery(this).removeClass().addClass("input_bt_1");}).mousemove(function(){jQuery(this).removeClass().addClass("input_bt_2");}).mouseout(function(){jQuery(this).removeClass().addClass("input_bt_1");});

