function checkteareg(){
   var patrn=/^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$/;
   if (patrn.test(document.formteareg.email.value)==false){
	   alert('Please specify E-mail！');
	   document.formteareg.email.focus();
	   return false;
   }
   if (document.formteareg.skypename.value==''){
	   alert('Please specify Skype-Name！');
	   document.formteareg.skypename.focus();
	   return false;
   }
   if (document.formteareg.password.value==''){
	   alert('Please specify PassWord.！');
	   document.formteareg.password.focus();
	   return false;
   }  
   if (document.formteareg.affirmpassword.value==''){
	   alert('Please specify ConFirm PassWord.！');
	   document.formteareg.affirmpassword.focus();
	   return false;
   }
   if (document.formteareg.affirmpassword.value!=document.formteareg.password.value){
	   alert('The password twice differs extremely！');
	   document.formteareg.password.focus();
	   return false;
   } 
   if (document.formteareg.firstname.value==''){
	   alert('Please specify First name！');
	   document.formteareg.firstname.focus();
	   return false;
   }
   if (document.formteareg.lastname.value==''){
	   alert('Please specify Last name！');
	   document.formteareg.lastname.focus();
	   return false;
   }  
   if (document.formteareg.byear.value==''){
	   alert('Please select Year！');
	   document.formteareg.byear.focus();
	   return false;
   }   
   if (document.formteareg.bmonth.value==''){
	   alert('Please select Month！');
	   document.formteareg.bmonth.focus();
	   return false;
   }   
   if (document.formteareg.bday.value==''){
	   alert('Please select Day！');
	   document.formteareg.bday.focus();
	   return false;
   }     
   if (document.formteareg.country.value==''){
	   alert('Please select Country！');
	   document.formteareg.country.focus();
	   return false;
   } 
   if (document.formteareg.address.value==''){
	   alert('Please specify address！');
	   document.formteareg.address.focus();
	   return false;
   }    
   if (document.formteareg.zip.value==''){
	   alert('Please specify zip！');
	   document.formteareg.zip.focus();
	   return false;
   }    
   
//	var reg=/(^[0-9]{10,12}$)|(^0{0,1}13[0-9]{9}$)|(^0{0,1}15[0-9]{9}$)|(^0{0,1}18[0-9]{9}$)/; 
//	
//	if (reg.test(document.formteareg.Phone.value)==false){
//	alert("Please specify Phone Number!");
//	document.formteareg.Phone.focus();
//	return false;
//	}  
	if (document.formteareg.Phone.value==''){
	alert("Please specify Phone Number!");
	document.formteareg.Phone.focus();
	return false;
	} 
   if (document.formteareg.course.value==''){
	   alert('Please select course！');
	   document.formteareg.course.focus();
	   return false;
   } 
   document.formteareg.submit();
}
function checklogin()
{  
   if (document.formlogin.skypename.value==''){
	   alert('Please specify Skype-Name！');
	   document.formlogin.skypename.focus();
	   return false;
   } 
    if (document.formlogin.password.value==''){
	   alert('Please specify PassWord！');
	   document.formlogin.password.focus();
	   return false;
   }   
	 document.formlogin.submit();
}
function checkchangeinfo(){
   var patrn=/^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$/;
   if (patrn.test(document.formchangeinfo.email.value)==false){
	   alert('Please specify E-mail！');
	   document.formchangeinfo.email.focus();
	   return false;
   }
   if (document.formchangeinfo.firstname.value==''){
	   alert('Please specify First name！');
	   document.formchangeinfo.firstname.focus();
	   return false;
   }
   
   if (document.formchangeinfo.lastname.value==''){
	   alert('Please specify Last name！');
	   document.formchangeinfo.lastname.focus();
	   return false;
   }  
   if (document.formchangeinfo.byear.value==''){
	   alert('Please select Year！');
	   document.formchangeinfo.byear.focus();
	   return false;
   }   
   if (document.formchangeinfo.bmonth.value==''){
	   alert('Please select Month！');
	   document.formchangeinfo.bmonth.focus();
	   return false;
   }   
   if (document.formchangeinfo.bday.value==''){
	   alert('Please select Day！');
	   document.formchangeinfo.bday.focus();
	   return false;
   } 
   if (document.formchangeinfo.country.value==''){
	   alert('Please select Country！');
	   document.formchangeinfo.country.focus();
	   return false;
   } 
   if (document.formchangeinfo.address.value==''){
	   alert('Please specify address！');
	   document.formchangeinfo.address.focus();
	   return false;
   }    
   if (document.formchangeinfo.zip.value==''){
	   alert('Please specify zip！');
	   document.formchangeinfo.zip.focus();
	   return false;
   }    
   
//	var reg=/(^[0-9]{10,12}$)|(^0{0,1}13[0-9]{9}$)|(^0{0,1}15[0-9]{9}$)|(^0{0,1}18[0-9]{9}$)/; 
//	
//	if (reg.test(document.formchangeinfo.Phone.value)==false){
//	alert("Please specify Phone Number!");
//	document.formchangeinfo.Phone.focus();
//	return false;
//	}  
	if (document.formchangeinfo.Phone.value==''){
	alert("Please specify Phone Number!");
	document.formchangeinfo.Phone.focus();
	return false;
	}
   //if (document.formchangeinfo.course.value==''){
	  // alert('Please select course！');
	   //document.formchangeinfo.course.focus();
	   //return false;
  // } 
   changeinfo();
}
function checkchangepass(){
   
     if (document.formchangepass.oldpassword.value==''){
	   alert('Please specify Your old Password.！');
	   document.formchangepass.oldpassword.focus();
	   return false;
   } 
   if (document.formchangepass.password.value==''){
	   alert('Please specify New Password.！');
	   document.formchangepass.password.focus();
	   return false;
   }  
   if (document.formchangepass.affirmpassword.value==''){
	   alert('Please specify Confirm New Password.！');
	   document.formchangepass.affirmpassword.focus();
	   return false;
   }
   if (document.formchangepass.affirmpassword.value!=document.formchangepass.password.value){
	   alert('The New password twice differs extremely！');
	   document.formchangepass.password.value="";
	   document.formchangepass.affirmpassword.value="";
	   document.formchangepass.password.focus();
	   return false;
   } 
  changepass();
}
function GetO()
 {
  var ajax=false;
   try{
    ajax = new ActiveXObject("Msxml2.XMLHTTP");
   }catch (e){
     try{
      ajax = new ActiveXObject("Microsoft.XMLHTTP");
     }catch (E){
      ajax = false;
     }
   }
   if (!ajax && typeof XMLHttpRequest!='undefined')
   {
    ajax = new XMLHttpRequest();
   }
   return ajax;
 }
function changepass(){
//var str=s;
var password=document.formchangepass.password.value;
var oldpassword=document.formchangepass.oldpassword.value;
var ajax = GetO();

url="changepassajax.asp?password="+password+"&oldpassword="+oldpassword+"&time="+new Date().getTime();
 ajax.open("post", url, true);
 ajax.onreadystatechange = function()
 {
   if (ajax.readyState == 4 && ajax.status == 200)
   {
        if(ajax.responseText==1){
			
			document.formchangepass.oldpassword.value="";
			document.formchangepass.password.value="";
			document.formchangepass.affirmpassword.value="";
			
			alert('Password change successful！');
			
		}else if(ajax.responseText==2){
			document.formchangepass.oldpassword.select();
			alert('Enter your old password wrong！');
		}else{
			document.formchangepass.oldpassword.value="";
			document.formchangepass.password.value="";
			document.formchangepass.affirmpassword.value="";
			alert('Error！');
		}
   }
  }
   //发送请求
 ajax.send(null);
}

function changeinfo(){
//var str=s;
var skypename=document.formchangeinfo.skypename.value;
var email=document.formchangeinfo.email.value;
var firstname=document.formchangeinfo.firstname.value;
var lastname=document.formchangeinfo.lastname.value;
var country=document.formchangeinfo.country.value;
var address=document.formchangeinfo.address.value;
var zip=document.formchangeinfo.zip.value;
var phone=document.formchangeinfo.Phone.value;
//var course=document.formchangeinfo.course.value;
var byear=document.formchangeinfo.byear.value;
var bmonth=document.formchangeinfo.bmonth.value;
var bday=document.formchangeinfo.bday.value;

var ajax = GetO();

url='changeinfoajax.asp?skypename='+skypename+'&email='+email+'&firstname='+firstname+'&lastname='+lastname+'&country='+country+'&address='+address+'&zip='+zip+'&phone='+phone+'&byear='+byear+'&bmonth='+bmonth+'&bday='+bday+'&time='+new Date().getTime();
 ajax.open("post", url, true);
 
 ajax.onreadystatechange = function()
 {
   if (ajax.readyState == 4 && ajax.status == 200)
   {
        
		if(ajax.responseText==1){
			alert('Member information has been modified successfully！');
			
		}else{
			alert('Error！');
		}
		
   }
  }
   //发送请求
 ajax.send(null);
}
function   currencycheck()   
      {     
          for(var   i=0;i<document.formchangeprofile.currencyid.length;i++)   
          {   
                  if (document.formchangeprofile.currencyid[i].checked)   
                  {         
                       return   true;  
                  }   
    }         
}
function checkchangeprofile(){
   
   if (document.formchangeprofile.turename.value==''){
	   alert('Please specify Your Name.');
	   document.formchangeprofile.turename.focus();
	   return false;
   } 
   if (document.formchangeprofile.p_time1.value==''){
	   alert('Lesson Point can not be empty,Please specify Lesson Point .');
	   document.formchangeprofile.p_time1.focus();
	   return false;
   } 
   if (document.formchangeprofile.p_time2.value==''){
	   alert('Lesson Point can not be empty,Please specify Lesson Point .');
	   document.formchangeprofile.p_time2.focus();
	   return false;
   } 
   if (document.formchangeprofile.p_time3.value==''){
	   alert('Lesson Point can not be empty,Please specify Lesson Point .');
	   document.formchangeprofile.p_time3.focus();
	   return false;
   } 
   if (document.formchangeprofile.p_time4.value==''){
	   alert('Lesson Point can not be empty,Please specify Lesson Point .');
	   document.formchangeprofile.p_time4.focus();
	   return false;
   }   
   if(!currencycheck())
    {
	   alert("Please Select your billing currency.")
	    return false;
	}  
    if (document.formchangeprofile.bank.value==''){
	   alert('Please specify Bank.');
	   document.formchangeprofile.bank.focus();
	   return false;
   }
    if (document.formchangeprofile.bankaddress.value==''){
	   alert('Please specify Bank Address.');
	   document.formchangeprofile.bankaddress.focus();
	   return false;
   }  
    if (document.formchangeprofile.cardaccount.value==''){
	   alert('Please specify Bank Card.');
	   document.formchangeprofile.cardaccount.focus();
	   return false;
   }    
   document.formchangeprofile.submit();
}
function onstate(datestr,timeid,linkstr){

var ajax = GetO();

url="onstate.asp?datestr="+datestr+"&timeid="+timeid+"&time="+new Date().getTime();
 ajax.open("post", url, true);
 ajax.onreadystatechange = function()
 {
   if (ajax.readyState == 4 && ajax.status == 200)
   {
        if(ajax.responseText==1){
			document.getElementById(linkstr).src='/images/open.gif';
		}else if(ajax.responseText==2){
		    document.getElementById(linkstr).src='/images/opened.gif';
		}else{
			alert('Error！');
		}
   }
  }
   //发送请求
 ajax.send(null);
}
function getorderlist(page){
	var ajax = GetO();
ydtime1=document.orderskype.ydtime1.value;
ydtime2=document.orderskype.ydtime2.value;
stuskype=document.orderskype.stuskype.value;
url="/ajaxorderlist.asp?page="+page+"&stuskype="+stuskype+"&ydtime1="+ydtime1+"&ydtime2="+ydtime2+"&time="+new Date().getTime();
 ajax.open("post", url, true);
 ajax.onreadystatechange = function()
 {
   if (ajax.readyState == 4 && ajax.status == 200)
   {
			document.getElementById("orderlist").innerHTML=ajax.responseText;	
   }
  }
   //发送请求
 ajax.send(null);
}

function checkcancel(obj,id,orderdate,timeid,teacherid,page,point,t_point,stu_skypename){
	
 if (confirm("Are you sure you want to cancel this section of courses?")){
	 obj.disabled =true;
	var ajax = GetO();

url="/ajaxordercancel.asp?id="+id+"&orderdate="+orderdate+"&timeid="+timeid+"&teacherid="+teacherid+"&point="+point+"&stu_skypename="+stu_skypename+"&t_point="+t_point+"&time="+new Date().getTime();
 ajax.open("post", url, true);
 ajax.onreadystatechange = function()
 {
   if (ajax.readyState == 4 && ajax.status == 200)
   {
	  if (ajax.responseText==1){
	    getorderlist(page);
	  }else{
		 alert("From the class time is less than 15 minutes, can not be removed!");
		 obj.disabled =false;
	  }
   }
  }
   //发送请求
 ajax.send(null);
 }
}
function checkfinish(id,orderdate,teacherid,page,t_point){
//下面只能点一次

 if (confirm("If you do not teach, please click Cancel!")){
	var ajax = GetO();

url="/ajaxorderfinish.asp?id="+id+"&orderdate="+orderdate+"&teacherid="+teacherid+"&t_point="+t_point+"&time="+new Date().getTime();
 ajax.open("post", url, true);
 ajax.onreadystatechange = function()
 {
   if (ajax.readyState == 4 && ajax.status == 200)
   {
	  if (ajax.responseText==1){
	    getorderlist(page);
	  }
   }
  }
   //发送请求
 ajax.send(null);
 }
}

function checkmessform()
{  
   if (document.messform.SubjectA.value==''){
	   alert('Textbook & Subject Can not be empty！');
	   document.messform.SubjectA.focus();
	   return false;
   } 
   if (document.messform.Suggestion.value==''){
	   alert('Textbook & Suggestion Can not be empty！');
	   document.messform.Suggestion.focus();
	   return false;
   } 
   if (document.messform.course.value==''){
	   alert('Textbook & course Can not be empty！');
	   document.messform.course.focus();
	   return false;
   } 
    if (document.messform.student.value==''){
	   alert('Please enter the name of the teacher！');
	   document.messform.student.focus();
	   return false;
   }   
	 document.messform.submit();
}

function withdrawcheck(teapoint)
{  
   if (document.wdform.point.value==''){
	   alert('Please enter the point！');
	   document.wdform.point.focus();
	   return false;
   } 
  if (confirm("You need to submit being settlement's turn to apply for what for sure？")){
   if (parseInt(document.wdform.point.value)>parseInt(teapoint)){
	   alert("Points you've entered is greater than your remaining points！");
	   document.wdform.point.focus();
	   return false;
   }  
	 document.wdform.submit();
  }
}


function openwin(dizi,classpass,classnum) { 
　　window.open ('loginmess.asp?dizi='+dizi+'&classpass='+classpass+'&classnum='+classnum, 'newwindow', 'height=120, width=400, top=300, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')
　　} 

function R_START(dizi,classpass,classnum,Cs) { 
	//alert(classnum);
　　window.open ('/Materials/R_index.asp?dizi='+dizi+'&classpass='+classpass+'&classnum='+classnum+'&'+Cs, 'newwindow', 'height=660, width=1280, top=10, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=n o, status=no')
　　} 

function Op_START(dizi) { 
	//alert(classnum);
　　window.open (dizi, 'nameeiiyang', 'height=660, width=770, top=10, left=240, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')
　　} 

function checkgetpass()
{  
   var patrn=/^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$/;
   if (patrn.test(document.getpass.email.value)==false){
	   alert('Please enter the correct e-mail registration！');
	   document.getpass.email.focus();
	   return false;
   }
    if (document.getpass.skypename.value==''){
	   alert('Please enter a SKYPE account registration！');
	   document.getpass.skypename.focus();
	   return false;
   }   
	 document.getpass.submit();
}
