// JavaScript Document
function ResetForm(which){
var pass=true
var first=-1
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
 if (tempobj.type=="text"){
  eval(tempobj.value="")
  if (first==-1) {first=i}
 }
 else if (tempobj.type=="checkbox") {
  eval(tempobj.checked=0)
  if (first==-1) {first=i}
 }
 else if (tempobj.col!="") {
  eval(tempobj.value="")
  if (first==-1) {first=i}
 }
}
}
which.elements[first].focus()
return false
}

function verifyMe(){
//document.getElementById("u_domain").value=window.location.host;

if(document.getElementById('pref_loc'))
	{
		var pref_loc=document.getElementById('pref_loc').value;
		if(pref_loc=="0")
		{
			alert("Please select course location.");
			return false;
		}
	}

var coursedatelocation=document.getElementById('coursedatelocation').value;
if(coursedatelocation=="0")
{
	alert("Please select course date location.");
	return false;
}

var firstname=document.getElementById('FirstName').value;
if(firstname=="")
{
	alert("Please Enter first name.");
	return false;
}

var familyname=document.getElementById('familyname').value;
if(familyname=="")
{
	alert("Please Enter Last name.");
	return false;
}

var phonenumber=document.getElementById('phonenumber').value;
if(phonenumber=="")
{
	alert("Please Enter your phone number.");
	return false;
}

var address=document.getElementById('address').value;
if(address=="")
{
	alert("Please Enter your address.");
	return false;
}

var city=document.getElementById('city').value;
if(city=="")
{
	alert("Please Enter your city.");
	return false;
}

var yourcountry=document.getElementById('yourcountry').value;
if(yourcountry=="")
{
	alert("Please Enter your country.");
	return false;
}

var email=document.getElementById('email').value;
if(email=="")
{
alert("Please Enter your email.");
return false;
}else{
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    if(reg.test(email) == false) {
				alert('Invalid Email Address please Enter vaild email address');
				return false;
             }
     }
	 
var ReEmail=document.getElementById('ReEmail').value;
if(ReEmail=="")
{
alert("Please Reconfirm Email.");
return false;
}else{
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    if(reg.test(ReEmail) == false) {
				alert('Invalid Email Address please Enter vaild email address');
				return false;
             }
     }
	 
if(ReEmail!=email){
	alert("Please Emails are not the same.");
	return false;	
}

if(!document.getElementById('nativespeaker0').checked && !document.getElementById('nativespeaker1').checked)
{
alert("Please select your native speaker.");
return false;
}

var nationality=document.getElementById('nationality').value;
if(nationality=="")
{
alert("Please Enter your nationality.");
return false;
}

if(!document.getElementById('gender0').checked && !document.getElementById('gender1').checked)
{
alert("Please select your gender.");
return false;
}

var emergencycontact=document.getElementById('emergencycontact').value;
if(emergencycontact=="")
{
alert("Please Enter your emergency contact number.");
return false;
}

if(!document.getElementById('education0').checked && !document.getElementById('education1').checked && !document.getElementById('education2').checked &&!document.getElementById('education3').checked)
{
alert("Please select your education.");
return false;
}

if(!document.getElementById('accommodation0').checked && !document.getElementById('accommodation1').checked)
{
alert("Please select your accommodation.");
return false;
}

var briefly=document.getElementById('briefly').value;
if(briefly=="")
{
alert("Please Enter why you wish to take TEFL course.");
return false;
}

var heard=document.getElementById('heard').value;
if(heard=="")
{
alert("Please Enter Where did you hear about us?.");
return false;
}

if(!document.getElementById('termsandcondition0').checked){
	alert('You did not check the Terms and Conditions\n\n')
	return false;
}

}

//////////////////////////////////////////////////////////////////////////////////
function select_from()
{
var course_id=document.getElementById('Cour').value;
if(course_id=="TESOL Certificate Course"){
  GetInfo('1.php');
}
if(course_id=="Special Thai Project"){
  GetInfo('2.php');
}
if(course_id=="Virtual TESOL Course Option One"){
  GetInfo('3.php');
}
if(course_id=="TESOL Diploma Course"){
  GetInfo('3.php');
}
/*if(course_id==5){
  GetInfo('2.php');
}*/
if(course_id=="Special Beijing Project"){
  GetInfo('4.php');
}
if(course_id=="Special China Project"){
  GetInfo('5.php');
}
if(course_id=="Special Korea Project"){
  GetInfo('6.php');
}
}
//////////////////////////////////////////////////////////////////////////////////
function select_loc()
{
var course_id=document.getElementById('pref_loc').value;
if(course_id==1){GetInfo('1_1.php');}
if(course_id==2){GetInfo('1_2.php');}
if(course_id==3){GetInfo('1_3.php');}
if(course_id==4){GetInfo('1_4.php');}
if(course_id==5){GetInfo('1_6.php');}
if(course_id==6){GetInfo('1_7.php');}
if(course_id==7){GetInfo('1_8.php');}
if(course_id==8){GetInfo('1_9.php');}
if(course_id==9){GetInfo('1_10.php');}
if(course_id==10){GetInfo('1_11.php');}
if(course_id==11){GetInfo('1_12.php');}
if(course_id==12){GetInfo('1_13.php');}
if(course_id==13){GetInfo('1_14.php');}
if(course_id==14){GetInfo('1_15.php');}
if(course_id==15){GetInfo('1_16.php');}
if(course_id==16){GetInfo('1_17.php');}
if(course_id==17){GetInfo('1_18.php');}
if(course_id==18){GetInfo('1_19.php');}
if(course_id==19){GetInfo('1_20.php');}
if(course_id==20){GetInfo('1_21.php');}
if(course_id==21){GetInfo('1_22.php');}
if(course_id==22){GetInfo('1_23.php');}
if(course_id==23){GetInfo('1_24.php');}
if(course_id==24){GetInfo('1_25.php');}
if(course_id==25){GetInfo('1_26.php');}
if(course_id==26){GetInfo('1_27.php');}
if(course_id==27){GetInfo('1_28.php');}
if(course_id==28){GetInfo('1_29.php');}
if(course_id==29){GetInfo('1_30.php');}
if(course_id==30){GetInfo('1_5.php');}
if(course_id==31){GetInfo('1_31.php');}
if(course_id==32){GetInfo('1_32.php');}
}
//////////////////////////////////////////////////////////////////////////////////

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
var xmlHttpCL
function GetInfo(w)
{
xmlHttpCL=GetXmlHttpObject()
if (xmlHttpCL==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }

var url=w
//url=url+"?PreId="+PreId;
xmlHttpCL.onreadystatechange=stateChangedCL;
xmlHttpCL.open("POST",url,true);
xmlHttpCL.send(null);
}
////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\
function stateChangedCL() 
{ 
//hideDiv();
if(xmlHttpCL.readyState == 0)
	{document.getElementById("ShowAjax").innerHTML ="<img src='ajax_small.gif' alt='loading..please wait'>";	}
if(xmlHttpCL.readyState == 1)
	{document.getElementById("ShowAjax").innerHTML = "<img src='ajax_small.gif' alt='loading..please wait'>";	}
if(xmlHttpCL.readyState == 2)
	{document.getElementById("ShowAjax").innerHTML= "<img src='ajax_small.gif' alt='loading..please wait'>";	}
if(xmlHttpCL.readyState == 3)
	{document.getElementById("ShowAjax").innerHTML= "<img src='ajax_small.gif' alt='loading..please wait'>";	}
if (xmlHttpCL.readyState == 4 || xmlHttpCL.readyState=="complete")
if (xmlHttpCL.status==200)
 	{
		document.getElementById("ShowAjax").innerHTML=xmlHttpCL.responseText;
		
	}
 }
////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\////////\\\\\\\\
function GetXmlHttpObject()
{
var xmlHttp=null;
try {
	xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
 }
catch (e)
 {
 //Internet Explorer
 try  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}