function Obj(o){
	return document.getElementById(o);
}
function say(text){
	alert(text);
}

function gourl(url){
window.location.href=url;
}

function echo(text){
document.write(text);
}

/*取小数点*/
function getNum(n,len)
{
    var tmpN = n.toString()
    var firstNum = tmpN.split(".")[0]
    var lastNum = tmpN.split(".")[1].substring(0,len)
    var newNum = firstNum+"."+lastNum
    return newNum
}

Array.prototype.del=function(n) {
　if(n<0)
　　return this;
　else
　　return this.slice(0,n).concat(this.slice(n+1,this.length));
}

/*垂直居中*/
function center(obj) { 
var screenWidth = $(window).width(), screenHeight = $(window).height(); //当前浏览器窗口的 宽高 
var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 
var objLeft = (screenWidth - obj.width())/2 ; 
var objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({left: objLeft + 'px', top: objTop + 'px','display': 'block'}); 
//浏览器窗口大小改变时 
$(window).resize(function() { 
screenWidth = $(window).width(); 
screenHeight = $(window).height();
scrolltop = $(document).scrollTop(); 
objLeft = (screenWidth - obj.width())/2 ; 
objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({left: objLeft + 'px', top: objTop + 'px','display': 'block'}); 
}); 
$(window).scroll(function() { 
screenWidth = $(window).width(); 
screenHeight = $(window).height(); 
scrolltop = $(document).scrollTop(); 
objLeft = (screenWidth - obj.width())/2 ; 
objTop = (screenHeight - obj.height())/2 + scrolltop; 
obj.css({left: objLeft + 'px', top: objTop + 'px','display': 'block'}); 
}); 

} 
function un_center(obj) { 
	obj.css('display', 'none'); 
	//浏览器窗口大小改变时 
	$(window).resize(function(){
		obj.css('display', 'none');
	}); 
	$(window).scroll(function(){
		obj.css('display', 'none');
	}); 
} 


function c_right(obj) { 
	var margin_top=150; //距上 越大越往下
	var screenWidth = $(window).width(), screenHeight = $(window).height(); //当前浏览器窗口的 宽高 
	var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 
	var objTop = (screenHeight - obj.height())/2 + scrolltop-margin_top; 
	obj.css({top: objTop + 'px','display': 'block'}); 
	//浏览器窗口大小改变时 
	$(window).resize(function() { 
	screenWidth = $(window).width(); 
	screenHeight = $(window).height();
	scrolltop = $(document).scrollTop(); 
	objTop = (screenHeight - obj.height())/2 + scrolltop-margin_top; 
	obj.css({top: objTop + 'px','display': 'block'}); 
	}); 
	$(window).scroll(function() { 
	screenWidth = $(window).width(); 
	screenHeight = $(window).height(); 
	scrolltop = $(document).scrollTop(); 
	objTop = (screenHeight - obj.height())/2 + scrolltop-margin_top; 
	obj.css({top: objTop + 'px','display': 'block'}); 
	}); 
}
function show_hao(){
	$("#divmenu").css("display","none");
	$("#divonline").css("display","block");
}

function hidden_hao(){
	$("#divmenu").css("display","block");
	$("#divonline").css("display","none");
}

function xmlhttprequest(){
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
	}
	else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
	else{
		say('您的浏览器不支持Ajax技术！');
	}
}


/*投票~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function clicknum(softid){
	var NameOfCookie="click"+softid;
	var c = document.cookie.indexOf(NameOfCookie+"="); 
	if (c != -1)
	{
	  say('您已经对他(她)投过票了，感谢您的参与！');
	  return;
	}
	var file='checkall.php?id='+softid+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			Obj('text'+softid).innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.send(null);	
}


/*投票End~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/*视频顶踩~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function sEval(softid,et){
	var NameOfCookie="digg"+softid;
	var c = document.cookie.indexOf(NameOfCookie+"="); 
	if (c != -1)
	{
	  alert('您已经投过票了，感谢您的参与！');
	  return;
	}
	var file='vodupdown.php?et='+et+'&id='+softid+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			Obj('s'+et).innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.send(null);	
}
/*视频顶踩end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*评论~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

function show_list(){
	var id=Obj('id').value;
	var file='comment_do.php?action=list&id='+id+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = show_list_done;
	xmlHttp.send(null);	
}

function show_lista(){
	var id=Obj('id').value;
	var file='comment_do.php?action=list&id='+id+'&a='+Math.random();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = show_list_done;
	xmlHttp.send(null);	
}

//输出列表
function show_list_done(){
	if(xmlHttp.readyState == 1){
		Obj('pllist').innerHTML="<div class='loading'><img src='manage/templets/images/loading.gif'>读取列表中...</div>";
	}
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
		Obj('pllist').innerHTML=xmlHttp.responseText;
	}
}

function pagelist(page, tid, attr, keyword,urlstring){
	var url = 'comment_do.php?'+'id='+tid+'&attr='+attr+'&page='+page+'&keyword='+keyword+'&a='+Math.random()+'&'+urlstring;
	xmlhttprequest();
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = show_list_done;
	xmlHttp.send(null);
}


function fb(){
var commentContact=Obj('commentContact');
var commentContent=Obj('commentContent');
var id=Obj('id');
　　if (commentContact.value.length<2)
　　{
       commentContact.focus();
	   Obj('commentContacta').innerText='昵称最少2个字符';
       return false;
　　}else{
	   Obj('commentContacta').innerText='';
    }
　　if (commentContent.value.length<1)
　　{
       commentContent.focus();
	   Obj('commentContenta').innerText='评论内容不能为空';
       return false;
　　}else{
	Obj('commentContenta').innerText='';
    }
	xmlhttprequest();
	var file = 'comment_do.php?action=add&commentContent='+encodeURI(commentContent.value)+'&commentContact='+encodeURI(commentContact.value)+'&id='+id.value+'&a='+Math.random();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = fbshow;
	xmlHttp.send(null);
    commentContent.value="";
    commentContact.value="";
}

function fbshow(){
	var msg=Obj('msg');
    if(xmlHttp.readyState == 1){
			msg.innerText="读取中...";
	}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			msg.innerText=xmlHttp.responseText;
			show_list();
	}
}
/*评论End~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/*对比~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function add_contrast(id){
	var NameOfCookie="contrast"+id;
	if ($.Cookie.get(NameOfCookie))
	{
	  say('该型号已在对比栏中！');
	  return;
	}
	var file='products_do.php?action=add&id='+id+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			$("#contrast_list_ul").append(xmlHttp.responseText);
			show_contrast_list();
		}
	}
	xmlHttp.send(null);	
}

function del_contrast(id){
	$('#contrast_list_ul #'+id+'').remove();
	var file='products_do.php?action=del&id='+id+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.send(null);
}

function del_contrast_go(id){
	$('#contrast_list_ul #'+id+'').remove();
	var file='products_do.php?action=del&id='+id+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.send(null);
	window.location.reload();
}

function show_contrast_list(){
	var NameOfCookie="contrastarray";
	if ($.Cookie.get(NameOfCookie))
	{
	  $('#contrast_list_small').fadeOut(200);
	  $('#contrast_list').fadeIn(200);
	}else{
	  say('对比栏中没有信息！');
	  return;
	}
}


function hide_contrast_list(){
	$('#contrast_list').fadeOut(200);
	$('#contrast_list_small').fadeIn(200);
}
function clear_both(){
    $('#contrast_list_ul').empty();
	var file='products_do.php?action=delall'+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.send(null);
}
function nowCompare(){
	gourl('contrast.php')
}
/*对比End~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


/*注册~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

function submitform(action){

switch(action){
    case 'reg':
	var uname=Obj('uname').value;
	var pwd=Obj('pwd').value;
	var repwd=Obj('repwd').value;
	var c1=Obj('c1').value;
	var c2=Obj('c2').value;
	var c3=Obj('c3').value;
	var c4=Obj('c4').value;
	var c5=Obj('c5').value;
	var vdcode=Obj('vdcode').value;
	var file = 'checkall.php?action='+action+
			   '&uname='+encodeURI(uname)+
			   '&pwd='+encodeURI(pwd)+
			   '&repwd='+encodeURI(repwd)+
	           '&c1='+encodeURI(c1)+
			   '&c2='+encodeURI(c2)+
			   '&c3='+encodeURI(c3)+
			   '&c4='+encodeURI(c4)+
			   '&c5='+encodeURI(c5)+
			   '&vdcode='+encodeURI(vdcode)+
			   '&a='+Math.random();
			   //alert(file);
	break
	case 'regback':
	var uname=Obj('uname').value;
	var c1=Obj('c1').value;
	var vdcode=Obj('vdcode').value;
	var file = 'checkall.php?action='+action+
			   '&uname='+encodeURI(uname)+
	           '&c1='+encodeURI(c1)+
			   '&vdcode='+encodeURI(vdcode)+
			   '&a='+Math.random();
			   //alert(file);
	break
	case 'update':
	var uname=Obj('uname').value;
	var c1=Obj('c1').value;
	var file = 'checkall.php?action='+action+
			   '&uname='+encodeURI(uname)+
			   '&pwd='+encodeURI(pwd)+
			   '&repwd='+encodeURI(repwd)+
	           '&c1='+encodeURI(c1)+
			   '&c2='+encodeURI(c2)+
			   '&c3='+encodeURI(c3)+
			   '&c4='+encodeURI(c4)+
			   '&c5='+encodeURI(c5)+
			   '&vdcode='+encodeURI(vdcode)+
			   '&a='+Math.random();
			   //alert(file);
	break
}
	xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = action_true;
	xmlHttp.send(null);
}


function action_true(){
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
	q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
	$(".loading").fadeOut();
		if(q=="注册成功!(需通过邮箱验证才能登陆!)"||q=="找回成功!(密码已发到您的保密邮箱中,请注意查收!)"){
			$("#action_true").removeClass("action_false");
			$("#action_true").addClass("action_true");
			Obj('action_true').innerHTML=q;
			setInterval('gourl("index.php")',5000)
		}else{
			$("#action_true").removeClass();
			$("#action_true").addClass("action_false");
			Obj('action_true').innerHTML=q;
		}
    $("#action_true").fadeIn();
	}else{
		$(".loading").fadeIn()
	}
	
}
function action_true_hidden(){
	$("#action_true").fadeOut();
}


/*注册end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/*买卖游戏币~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function check_buy_form(formname){
	var url=Obj('url').value;
	switch(formname){
	   case "buy1":
	        var paytype = $("input[name='paytype']:checked").val();
			if(!paytype){
			 $("#action_true").removeClass();
			 $("#action_true").addClass("action_false");
			 Obj('action_true').innerHTML="ご購入手段を選択してください。";
			 $("#action_true").fadeIn();
			 return false;
			}
			var paytypevalue=Obj('paytype'+paytype+'').value;
			xmlhttprequest();
			var file = 'checkall.php?action=check'+formname+''+
					   '&paytype='+encodeURI(paytype)+
					   '&paytypevalue='+encodeURI(paytypevalue)+
					   '&'+encodeURI(url)+
					   '&a='+Math.random();
			 //alert(file);
	   break	
	   
	   case "buy2":
	        var banktype = $("input[name='banktype']:checked").val();
			var wmnumber=Obj('wmnumber').value;
			if(!wmnumber){
			 $("#action_true").removeClass();
			 $("#action_true").addClass("action_false");
			 Obj('action_true').innerHTML="入力されたWM番号に誤りがあります。";
			 $("#action_true").fadeIn();
			 return false;
			}
			wmnumber=wmnumber.replace(/\r\n/g,","); 
			xmlhttprequest();
			var file = 'checkall.php?action=check'+formname+''+
					   '&wmnumber='+encodeURI(wmnumber)+
					   '&'+encodeURI(url)+
					   '&a='+Math.random();
			 //alert(file);
	   break
	   
	   case "buy3":
	        var pname=Obj('pname').value;
			var truename=Obj('truename').value;
			xmlhttprequest();
			var file = 'checkall.php?action=check'+formname+''+
					   '&pname='+encodeURI(pname)+
					   '&truename='+encodeURI(truename)+
					   '&'+encodeURI(url)+
					   '&a='+Math.random();
			 //alert(file);
	   break
	   
	   case "buy4":
	        var gamename=Obj('gamename').value;
			var unlogin=Obj('unlogin').value;
			if (unlogin==0){
			    var email=Obj('email').value;
				var reemail=Obj('reemail').value;
				if(!email){
				 $("#action_true").removeClass();
				 $("#action_true").addClass("action_false");
				 Obj('action_true').innerHTML="メールアドレスに誤りがあります。";
				 $("#action_true").fadeIn();
				 return false;
				}
			}else{
				var points=Obj('points').value;
			}
			
			var timetype=parseInt($("input[name='timetype']:checked").val());
			if(!timetype){
			 $("#action_true").removeClass();
			 $("#action_true").addClass("action_false");
			 Obj('action_true').innerHTML="希望取引日時を選択してください。";
			 $("#action_true").fadeIn();
			 return false;
			}
			
			switch(timetype){
				 case 2:
				   var y=$("select[name='y'] option:selected").val();
				   var h=$("select[name='h'] option:selected").val();
				   var s=$("select[name='s'] option:selected").val();
				   var timevalue=y+','+h+','+s;
				 break
				 
				 case 3:
				   var timevalue=Obj('comments').value;;
				 break   
			}
			xmlhttprequest();
			var file = 'checkall.php?action=check'+formname+''+
					   '&gamename='+encodeURI(gamename)+
					   '&timetype='+encodeURI(timetype)+
					   '&timevalue='+encodeURI(timevalue)+
					   '&unlogin='+encodeURI(unlogin)+
					   '&email='+encodeURI(email)+
					   '&reemail='+encodeURI(reemail)+
					   '&points='+encodeURI(points)+
					   '&'+encodeURI(url)+
					   '&a='+Math.random();
			 //alert(file);
	   break
	   
	   case "sell1":
	        var kou=Obj('kou').value;
			var kou1=Obj('kou1').value;
			var kou2=Obj('kou2').value;
			xmlhttprequest();
			var file = 'checkall.php?action=check'+formname+''+
					   '&kou='+encodeURI(kou)+
					   '&kou1='+encodeURI(kou1)+
					   '&kou2='+encodeURI(kou2)+
					   '&'+encodeURI(url)+
					   '&a='+Math.random();
			 //alert(file);
	   break
	   
	   case "sell2":
	        var paytype = parseInt($("input[name='paytype']:checked").val());
			if(!paytype){
			 $("#action_true").removeClass();
			 $("#action_true").addClass("action_false");
			 Obj('action_true').innerHTML="決済手段を選択してください";
			 $("#action_true").fadeIn();
			 return false;
			}
			
			switch(paytype){
			   case 1:
			    var c1=Obj('c1_'+paytype+'').value;
				var c2=Obj('c2_'+paytype+'').value;
				var c3=$("input[name='c3_"+paytype+"']:checked").val();
				var c4=Obj('c4_'+paytype+'').value;
				var c5=Obj('c5_'+paytype+'').value;
			   break
			   
			   case 2:
			    var c1=Obj('c1_'+paytype+'').value;
				var c2=Obj('c2_'+paytype+'').value;
				var c3=Obj('c3_'+paytype+'').value;
			   break
			   
			   case 3:
			    var c1=Obj('c1_'+paytype+'').value;
				var c2=Obj('c2_'+paytype+'').value;
				var c3=$("input[name='c3_"+paytype+"']:checked").val();
				var c4=Obj('c4_'+paytype+'').value;
				var c5=Obj('c5_'+paytype+'').value;
			   break	
			}
			xmlhttprequest();
			var file = 'checkall.php?action=check'+formname+''+
			           '&paytype='+encodeURI(paytype)+
					   '&c1='+encodeURI(c1)+
					   '&c2='+encodeURI(c2)+
					   '&c3='+encodeURI(c3)+
					   '&c4='+encodeURI(c4)+
					   '&c5='+encodeURI(c5)+
					   '&'+encodeURI(url)+
					   '&a='+Math.random();
			 //alert(file);
	   break
	}
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = function (){
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			$(".loading").fadeOut();
			   switch(q){
				case "true":
					Obj(formname).submit();
				break
				
				case "less1":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="未満ではない 1 口";
				break 
				
				case "erro_count":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="正しい番号を入力してください";
				break
				
				case "noInventory":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="在庫数が不足しているか、他のお客様がご予約になられています,申し訳ありませんが口数を調整頂き、再度ご入力ください";
				break
				
				case "erro_wmnumber":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力されたWM番号に誤りがあります。";
				break
				
				case "erro_pname":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力されたフリガナに誤りがあります。";
				break
				
				case "erro_truename":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力された振込名義人に誤りがあります。";
				break
				
				case "erro_gamename":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="キャラクター名に誤りがあります。";
				break
				
				case "erro_timetype":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="希望取引日時を選択してください。";
				break
				
				case "erro_hour":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="希望取引時刻に設定出来ません。再度ご入力ください。";
				break
				
				case "erro_comments":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="備考欄へお取引希望日時をご記入ください。";
				break
				
				case "erro_email":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="メールアドレスに誤りがあります。";
				break
				
				case "erro_sameemail":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="メールアドレスが一致しません。再度ご入力をお願いします。";
				break
				
				case "erro_points":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="インテグラル入力エラー";
				break
				
				case "erro_kou":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力された口数に誤りがあります。";
				break
				
				case "erro_kou1":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="最低買取口数に満たないためお受付できません，申し訳ありませんが口数を調整頂き、再度ご入力ください";
				break
				
				case "erro_kou2":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="買取上限口数を超えているためお受付できません,申し訳ありませんが口数を調整頂き、再度ご入力ください";
				break
				
				case "erro_c1_1":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力された銀行名に誤りがあります。";
				break
				
				case "erro_c2_1":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力された支店名に誤りがあります。";
				break
				
				case "erro_c1_2":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力されたフリガナに誤りがあります。";
				break
				
				case "erro_c2_2":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力された支店名に誤りがあります。 ";
				break
				
				case "erro_c3":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力されたフリガナに誤りがあります。";
				break
				
				case "erro_c4":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力された口座番号に誤りがあります。";
				break
				
				case "erro_c5":
					$("#action_true").removeClass();
					$("#action_true").addClass("action_false");
					Obj('action_true').innerHTML="入力されたフリガナに誤りがあります。";
				break
				
			   }
			$("#action_true").fadeIn();
			}else{
				$(".loading").fadeIn()
			}
		}
	xmlHttp.send(null);
}

function submit_buy_form(){
	
	xmlhttprequest();
	var file = 'checkall.php?action=submitbuy'+
			   '&a='+Math.random();
	 //alert(file);
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = function (){
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
				q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
				$(".loading").fadeOut();
				$("#accesscontent").html(q);
			}else{
				$("#accesscontent").html('');
				$(".ajaxtext").fadeIn();
			}
	}
	xmlHttp.send(null);

}


function submit_sell_form(){
	
	xmlhttprequest();
	var file = 'checkall.php?action=submitsell'+
			   '&a='+Math.random();
	 //alert(file);
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = function (){
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
				q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
				$(".loading").fadeOut();
				$("#accesscontent").html(q);
			}else{
				$("#accesscontent").html('');
				$(".ajaxtext").fadeIn()
			}
	}
	xmlHttp.send(null);

}

/*买卖游戏币end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


/*在线调查~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

function survey_sub(){

    var surveyvalue = $("input[name='survey']:checked").val();
	var file='include/survey_do.php?action=sub&value='+surveyvalue+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			say(xmlHttp.responseText);
		}
	}
	xmlHttp.send(null);
}

function survey_show(){

	Obj("graybg").style.display = "block";
	Obj("survey_window").style.display = "block";
	$('#survey_window' ).scrollFollow();
	
	var file='include/survey_do.php?action=show&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 1){
		    $('.survey_loading').fadeIn();
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			$('.survey_loading').fadeOut();
			a=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			var q=a.split(',');
			var imgwith=330;
			qcount=parseInt(q[0])+parseInt(q[1])+parseInt(q[2])+parseInt(q[3])
			q0=Math.round( parseInt(q[0]) / qcount *100);
			q1=Math.round( parseInt(q[1]) / qcount *100);
			q2=Math.round( parseInt(q[2]) / qcount *100);
			q3=Math.round( parseInt(q[3]) / qcount *100);
			
			$('#survey_list #a0').animate({width:parseInt(imgwith*(q0/100)+1)},"slow");
			$('#survey_list #a1').html(q[0]);
			$('#survey_list #a2').html(q0+'%');
			
			$('#survey_list #b0').animate({width:parseInt(imgwith*(q1/100)+1)},"slow");
			$('#survey_list #b1').html(q[1]);
			$('#survey_list #b2').html(q1+'%');
			
			$('#survey_list #c0').animate({width:parseInt(imgwith*(q2/100)+1)},"slow");
			$('#survey_list #c1').html(q[2]);
			$('#survey_list #c2').html(q2+'%');
			
			$('#survey_list #d0').animate({width:parseInt(imgwith*(q3/100)+1)},"slow");
			$('#survey_list #d1').html(q[3]);
			$('#survey_list #d2').html(q3+'%');
		}
	}
	xmlHttp.send(null);	
}

function survey_hidden(){
	Obj("graybg").style.display = "none";
	Obj("survey_window").style.display = "none";
}
/*在线调查end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


//卡查询 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

function show_card_list(id){
	var file='server_do.php?action=list&card_number='+id+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = show_card_done;
	xmlHttp.send(null);	
}
function show_card_done(){
	if(xmlHttp.readyState == 1){
		Obj('card_list').innerHTML="<div class='loading'><img src='manage/templets/images/loading.gif'>读取列表中...</div>";
	}
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
		Obj('card_list').innerHTML=xmlHttp.responseText;
		$(".qaa").click(function(){
			$(this).parent("li").find(".text").toggle(200);
		});
	}
}

function pagelist(page, tid, attr, keyword,urlstring){
	var url = 'server_do.php?'+'id='+tid+'&attr='+attr+'&page='+page+'&keyword='+keyword+'&a='+Math.random()+'&'+urlstring;
	xmlhttprequest();
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = show_card_done;
	xmlHttp.send(null);
}


function subtime(id){

	var y=$("select[name='y'] option:selected").val();
	var y1=$("select[name='y1'] option:selected").val();
	var m=$("select[name='m'] option:selected").val();
	var m1=$("select[name='m1'] option:selected").val();
	var d=$("select[name='d'] option:selected").val();
	var d1=$("select[name='d1'] option:selected").val();

	xmlhttprequest();
	var file = 'server_do.php?card_number='+id+'&y='+y+'&d='+d+'&m='+m+'&y1='+y1+'&d1='+d1+'&m1='+m1+'&a='+Math.random();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = show_card_done;
	xmlHttp.send(null);

}
/*卡查询End~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/



/*头像自定义~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function show_window(div,para){
	h=$(document.body).height();
	$("#graybg").height(h);
	$('#graybg' ).css("display","block");
	var file='window.php?div='+div+'&'+para+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 1){
			center($("#list_load"));
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			un_center($("#list_load"));
			$("#window_content").css("display","block");
			$("#window_content").html(q);
			center($('#'+div+'_window'));
		}
	}
	xmlHttp.send(null);	
}

function hidden_window(){
	$('#graybg' ).css("display","none");
	$('#graybga' ).css("display","none");
	$('#window_content' ).css("display","none");
}

function headpic_change(id,type){
	var file='checkall.php?action=change_headpic&id='+id+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 1){
		    $('#now_picurl').attr("src",'manage/templets/images/loading.gif');
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			if(type==0){
				q=xmlHttp.responseText;
			}else{
				q=xmlHttp.responseText.replace(/small/g,"big");
			}
			$('#now_picurl').attr("src",q);
		}
	}
	xmlHttp.send(null);	
}
/*在线调查end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/



/*在线订课*/

function add_class(uid,classtime,type){
	hidden_window();
	var file='teacher_class_do.php?action=add&uid='+uid+'&class_time='+classtime+'&status='+type+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 1){
			$("#a"+classtime+"").removeClass();
			$("#a"+classtime+"").addClass('load');
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			switch(q){
				//available unavailable  reserved  ljbutton  ybbutton needlogin
								
				case "available":
				    $("#a"+classtime+"").removeClass();
					$("#a"+classtime+"").addClass(q);
					$("#a"+classtime+"").attr('onclick','').click(function(){
					add_class(uid,classtime,q)
					});
				break
				
				case "unavailable":
				    $("#a"+classtime+"").removeClass();
					$("#a"+classtime+"").addClass(q);
					$("#a"+classtime+"").attr('onclick','').click(function(){
					add_class(uid,classtime,q)
					});
				break
				
				case "not_time_15":
				    $("#a"+classtime+"").removeClass();
					$("#a"+classtime+"").addClass(type);
				    say('Please allow 15 minutes on an appointment');
				break
				
				case "reserved":
				    $("#a"+classtime+"").removeClass();
					$("#a"+classtime+"").addClass(type);
					say('Has ended');
				break
				
				case "needlogin":
				    $("#a"+classtime+"").removeClass();
					$("#a"+classtime+"").addClass(type);
					say('请先登陆');
				break
				
				case "ybbutton":
				    $("#a"+classtime+"").removeClass();
					$("#a"+classtime+"").addClass(q);
					$("#a"+classtime+"").attr('onclick','').click(function(){
					say('该老师已经被预约了');
					});
				break

			}
		}
	}
	xmlHttp.send(null);	
}

function listenway1(i){
	var text=new Array('1|电话','2|QQ','3|Skype');
	var moren='<option value="">请选择</option>';
	$("select[name='listenway2']").html(moren);
	$("select[name='listenway3']").html(moren);
	text=text.del(i-1);
	for(var i=0;i<text.length;i++){
		var new_text=text[i];
		new_text=new_text.split('|');
		$("select[name='listenway2']").append('<option value="'+new_text[0]+'">'+new_text[1]+'</option>');
	}
}
function listenway2(i){
	var l1=$("select[name='listenway1'] option:selected").val();
	var text=new Array('1|电话','2|QQ','3|Skype');
	var moren='<option value="">请选择</option>';
	$("select[name='listenway3']").html(moren);
	if(l1>i){
	text=text.del(l1-1);
	text=text.del(i-1);
	}else{
	text=text.del(i-1);
	text=text.del(l1-1);
	}
	for(var i=0;i<text.length;i++){
		var new_text=text[i];
		new_text=new_text.split('|');
		$("select[name='listenway3']").append('<option value="'+new_text[0]+'">'+new_text[1]+'</option>');
	}
}

function do_buy_class(uid,classtime,type){
	var listenway1=$("select[name='listenway1'] option:selected").val();
	var listenway=listenway1+','+$("select[name='listenway2'] option:selected").val()+','+$("select[name='listenway3'] option:selected").val();
	var user_content=$("#user_content").val();
	var classid=$("#classid").val();
	
	if(listenway1==''){
	say('最少选择一样上课方式');
	return false;
	}
	if(classid==''){
	say('请选择课程类型');
	return false;
	}
	
	var file='teacher_class_do.php?action=buy&uid='+uid+'&class_time='+classtime+'&status='+type+'&listenway='+listenway+'&user_content='+user_content+'&classid='+classid+'&a='+Math.random();
	
	//alert(file);
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 1){
			center($("#list_load"));
			h=$(document.body).height();
			$("#graybga").height(h);
			$('#graybga' ).css("display","block");
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			switch(q){
								
				case "not_enough":
				    say('余额不足,请先充课时!');
					hidden_window();
					un_center($("#list_load"));
				break
				
				case "not_time_15":
				    say('请在课程开始前15分预约!');
					hidden_window();
					un_center($("#list_load"));
				break
				
				case "ybbutton":
				    say('订课成功,如要退订请在提前4小时前退订');
				    hidden_window();
					un_center($("#list_load"));
				    $("#"+uid+"_"+classtime+"").removeClass();
					$("#"+uid+"_"+classtime+"").addClass(q);
					$("#"+uid+"_"+classtime+"").attr('onclick','').click(function(){
					say('该老师已经被预约了');
					});
				break
				
				case "unavailable":
				    $("#"+uid+"_"+classtime+"").removeClass();
					$("#"+uid+"_"+classtime+"").addClass(q);
					$("#"+uid+"_"+classtime+"").attr('onclick','').click(function(){
					add_class(uid,classtime,q)
					});
				break
				
				default:
				say(q);
				break
				
			}
		}
	}
	xmlHttp.send(null);	
}


function needlogin(username){
	var file='teacher_class_do.php?action=checklogin&username='+username+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange =function(){
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			q=xmlHttp.responseText.replace(/^\s*|\s*$/g,"");
			return q;
		}
	}
	xmlHttp.send(null);	
}


function show_class_list(id){
	var file='user-class-do.php?uid='+id+'&a='+Math.random();
    xmlhttprequest();
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = show_class_done;
	xmlHttp.send(null);	
}
function show_class_done(){
	if(xmlHttp.readyState == 1){
		h=$(document.body).height();
		$("#graybg").height(h);
		$('#graybg' ).css("display","block");
		center($("#list_load"));
	}
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
		$('#graybg' ).css("display","none");
		un_center($("#list_load"));
		Obj('class_list').innerHTML=xmlHttp.responseText;
		$(".qaa").click(function(){
			$(this).parents(".qa-li").find(".text").toggle(200);
		});
		$(".qab").click(function(){
			$(this).parents(".qa-li").find(".upload").toggle(200);
		})

	}
}

function pagelist_class(page, tid, attr, keyword,urlstring){
	var url = 'user-class-do.php?'+'id='+tid+'&attr='+attr+'&page='+page+'&keyword='+keyword+'&'+urlstring+'&a='+Math.random();
	xmlhttprequest();
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = show_class_done;
	xmlHttp.send(null);
}
function class_search(id){

	var y=$("select[name='y'] option:selected").val();
	var y1=$("select[name='y1'] option:selected").val();
	var m=$("select[name='m'] option:selected").val();
	var m1=$("select[name='m1'] option:selected").val();
	var d=$("select[name='d'] option:selected").val();
	var d1=$("select[name='d1'] option:selected").val();

	xmlhttprequest();
	var file = 'user-class-do.php?uid='+id+'&y='+y+'&d='+d+'&m='+m+'&y1='+y1+'&d1='+d1+'&m1='+m1+'&a='+Math.random();
	//say(file);
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = show_class_done;
	xmlHttp.send(null);

}
function class_search_one(id){

	var status=$("input[name='status']:checked").val();
	xmlhttprequest();
	var file = 'user-class-do.php?uid='+id+'&status='+status+'&a='+Math.random();
	//say(file);
	xmlHttp.open("GET", file, true);
	xmlHttp.onreadystatechange = show_class_done;
	xmlHttp.send(null);

}

//学生评论
function send_comment(id){
	var msg = document.form.msg.value;
	var class_level=$("select[name='class_level'] option:selected").val();
	if(msg == ''){
		$('#length').html('<p style="color:red;">Write your review here, thank you</p>');
		return;
	}
	if(class_level == ''){
		$('#length').html('<p style="color:red;">Please select a suitable material</p>');
		return;
	}
	xmlhttprequest();
	var msgstring = "msg="+msg+"&class_level="+class_level+"";
	var url = "teacher_class_do.php?action=comment&id="+id+"&a="+parseInt(Math.random()*(15271)+1);
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange = function(){
	    if(xmlHttp.readyState == 1){
			$('#comment_list').html('<br /><div align="center"><img src="manage/templets/images/loading.gif">Sending...</div>');
		}
		if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			$('#comment_list').html(xmlHttp.responseText);
			setInterval('hidden_window()',3000);
		}
	};
	xmlHttp.send(msgstring);
}

function checklength(txt){
	$("#length").html('You have entered ： '+txt.value.length+' characters');
}

/*在线订课end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

