//*************************************
function ChkShowSbjForm(inForm){
//*************************************
var valid=false;

if (typeof inForm.selectedSbj.length == "number"){

	for(i=0;i<inForm.selectedSbj.length;i++) {
		if (inForm.selectedSbj[i].checked == true)
			valid=true;
	}
	if (valid == false) {
		alert('Please choose one subject at least!');
		return false;
	}
}
else{
	if (inForm.selectedSbj.checked == false){
		alert('Please choose one subject at least!');
		return false;
	}
}
return true;
}
//*************************************
function trigger(chkbox){
//*************************************
	if (chkbox.checked == true)
		chkbox.checked = false;
	else
		chkbox.checked = true;
}
//*************************************
function ChkShowCrsForm(inForm){
//*************************************
var valid=false;

if (typeof inForm.ChkClass.length == "number"){

	for(i=0;i<inForm.ChkClass.length;i++) {
		if (inForm.ChkClass[i].checked == true)
			valid=true;
	}
	if (valid == false) {
		alert('Please choose one subject at least!');
		return false;
	}
}
else{
	if (inForm.ChkClass.checked == false){
		alert('Please choose one subject at least!');
		return false;
	}
}
return true;
}
//*************************************
function ChkDelCrsForm(inForm){
//*************************************
var valid=false;

if (typeof inForm.delclass.length == "number"){

	for(i=0;i<inForm.delclass.length;i++) {
		if (inForm.delclass[i].checked == true)
			valid=true;
	}
	if (valid == false) {
		alert('Please choose one subject at least!');
		return false;
	}
}
else{
	if (inForm.delclass.checked == false){
		alert('Please choose one subject at least!');
		return false;
	}
}
return confirm("Are you sure to delete selected class(s)?");
}
//*************************************
function DisplayCreditCard(cardType){
//*************************************
switch(cardType) {
	case "n/a":
	cardnumber.innerHTML = "<input type=\"text\" name=\"set1\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set2\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set3\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set4\" size=\"8\" maxlength=\"4\" class=\"content\">";
	document.personalform.set1.value = "";
	document.personalform.set2.value = "";
	document.personalform.set3.value = "";
	document.personalform.set4.value = "";
	document.personalform.expiry1.value = "";
	document.personalform.expiry2.value = "";
	document.personalform.cholder.value = "";
	break;
	case "Visa":
	cardnumber.innerHTML = "<input type=\"text\" name=\"set1\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set2\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set3\" size=\"8\" maxlength=\"4\" class=\"content\"> " + 
                           "<input type=\"text\" name=\"set4\" size=\"8\" maxlength=\"4\" class=\"content\">";
	break;
	case "Master":
	cardnumber.innerHTML = "<input type=\"text\" name=\"set1\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set2\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set3\" size=\"8\" maxlength=\"4\" class=\"content\"> " + 
                           "<input type=\"text\" name=\"set4\" size=\"8\" maxlength=\"4\" class=\"content\">";
	break;
	case "American Express":
	cardnumber.innerHTML = "<input type=\"text\" name=\"set1\" size=\"8\" maxlength=\"4\" class=\"content\"> " +
                           "<input type=\"text\" name=\"set2\" size=\"8\" maxlength=\"6\" class=\"content\"> " + 
                           "<input type=\"text\" name=\"set3\" size=\"8\" maxlength=\"5\" class=\"content\">"
                         
	break;
}

}
//*************************************
function isWhiteSpace(ch){
//*************************************
	
	if (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\b')
		return true;
	
	return false;     
}
//*************************************
function checkValidString(str){
//*************************************
	var validChar = false;
	var i=0;

	while (i < str.length){
	
		if (!isWhiteSpace(str.charAt(i))){
			validChar = true;
			i=str.length+1;
		}	
		else	
		i++;
	}

	return validChar;
}

//*************************************
function CheckNum(str){
//*************************************

len = str.length;
checking = 0
for(i=0;i<len;i++){
    charat0 = str.charAt(i);
    if (!(charat0 >= '0' && charat0 <= '9'))
	checking = checking + 1;
		
}


if (checking > 0)
	return false;
	
else
	
	return true;  
                	
}

//*************************************
function CheckPersonalForm(inForm){
//*************************************

	if (inForm.fname.value == '' || !checkValidString(inForm.fname.value)){
        alert("Please provide your family name.");
        inForm.fname.focus(); 
		return false;
	}
	if (inForm.gname.value == '' || !checkValidString(inForm.gname.value)){
		alert("Please provide your given name.");
        inForm.gname.focus();
		return false;
	}
    if (inForm.htel.value == '' || !checkValidString(inForm.htel.value) || !CheckNum(inForm.htel.value)){
 		alert("Please provide a valid home telephone number.");
 		inForm.htel.focus();
		return false;
	}

    if (!inForm.otel.value == ''){
		if (!CheckNum(inForm.otel.value)){
			alert("Please provide a valid office telephone number.");
			inForm.otel.focus();
			return false;
		}
	}
	if (!inForm.fax.value == ''){
		if (!CheckNum(inForm.fax.value)){
			alert("Please provide a valid fax number.");
			inForm.fax.focus();
			return false;
		}
	}
    if (!inForm.mobile.value == ''){
		if (!CheckNum(inForm.mobile.value)){
			alert("Please provide a valid mobile/pager number.");
			inForm.mobile.focus();
			return false;
		}
	}
	if (inForm.email.value.length<5 || (inForm.email.value.indexOf("@") == -1 || inForm.email.value.indexOf(".") == -1 || inForm.email.value.indexOf("@") == 0 || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "@" || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "." || inForm.email.value.indexOf(".") == 0)) {
		alert("Please provide a valid email address.");
        inForm.email.focus();
		return false;
	}
    if (inForm.pmethod.options[0].selected == false){
		if (inForm.pmethod.options[inForm.pmethod.selectedIndex].value == "Visa" || inForm.pmethod.options[inForm.pmethod.selectedIndex].value == "Master"){
			if (!CheckNum(inForm.set1.value) || inForm.set1.value.length < 4){
				alert("Please provide a valid credit card number.");
 	            inForm.set1.focus();
				return false;
			}	
			if (!CheckNum(inForm.set2.value) || inForm.set2.value.length < 4){
				alert("Please provide a valid credit card number.");
 	            inForm.set2.focus();
				return false;
			}
			if (!CheckNum(inForm.set3.value) || inForm.set3.value.length < 4){
				alert("Please provide a valid credit card number.");
 	            inForm.set3.focus();
				return false;
			}
			if (!CheckNum(inForm.set4.value) || inForm.set4.value.length < 4){
				alert("Please provide a valid credit card number.");
 	            inForm.set4.focus();
				return false;
			}
		}
		if (inForm.pmethod.options[inForm.pmethod.selectedIndex].value == "American Express"){
			if (!CheckNum(inForm.set1.value) || inForm.set1.value.length < 4){
				alert("Please provide a valid credit card number.");
 	            inForm.set1.focus();
				return false;
			}
			if (!CheckNum(inForm.set2.value) || inForm.set2.value.length < 6){
				alert("Please provide a valid credit card number.");
 	            inForm.set2.focus();
				return false;
			}
			if (!CheckNum(inForm.set3.value) || inForm.set3.value.length < 5){
				alert("Please provide a valid credit card number.");
 	            inForm.set3.focus();
				return false;
			}
		}
		if (inForm.expiry1.value == '' || !checkValidString(inForm.expiry1.value) || !CheckNum(inForm.expiry1.value)){
			alert("Please provide a valid expiry date.");
            inForm.expiry1.focus();
			return false;
		}
		if (inForm.expiry2.value == '' || !checkValidString(inForm.expiry2.value) || !CheckNum(inForm.expiry2.value)){
			alert("Please provide a valid expiry date.");
            inForm.expiry2.focus();
			return false;
		}
		if (inForm.cholder.value == '' || !checkValidString(inForm.cholder.value)){
   		alert("Please provide a valid credit card holder name.");
        inForm.cholder.focus(); 
		return false;
		}
    }
return true;

}
//*************************************
function AddExtraInfo(inForm){
 	cControl = inForm.extrainfo;
    if (!cControl.value == ''){
		if (!CheckNum(cControl.value)){
			alert("Please provide a valid unit(s).");
			cControl.focus();
			return false;
		}
	}
return true;
}
//*************************************
function CheckBookForm(inForm){

	if ((inForm.exam1.value == '' || !checkValidString(inForm.exam1.value)) && (inForm.exam2.value == '' || !checkValidString(inForm.exam2.value)) && (inForm.exam3.value == '' || !checkValidString(inForm.exam3.value)) && (inForm.exam4.value == '' || !checkValidString(inForm.exam4.value)) && (inForm.exam5.value == '' || !checkValidString(inForm.exam5.value))){
        alert("Please specify at least one examination");
		inForm.exam1.value = "";
		inForm.exam2.value = "";
		inForm.exam3.value = "";
		inForm.exam4.value = "";
		inForm.exam5.value = "";
		inForm.dd1.value = "";
		inForm.dd2.value = "";
		inForm.dd3.value = "";
		inForm.dd4.value = "";
		inForm.dd5.value = "";
		inForm.m1.value = "";
		inForm.m2.value = "";
		inForm.m3.value = "";
		inForm.m4.value = "";
		inForm.m5.value = "";
		inForm.y1.value = "";
		inForm.y2.value = "";
		inForm.y3.value = "";
		inForm.y4.value = "";
		inForm.y5.value = "";
		inForm.h1.value = "";
		inForm.h2.value = "";
		inForm.h3.value = "";
		inForm.h4.value = "";
		inForm.h5.value = "";
		inForm.min1.value = "";
		inForm.min2.value = "";
		inForm.min3.value = "";
		inForm.min4.value = "";
		inForm.min5.value = "";
        inForm.exam1.focus(); 
		return false;
	}
	if (inForm.exam1.value != "" || checkValidString(inForm.exam1.value)){
		if (!CheckBookDateTime("document.bookform","1"))
			return false;
	}
	if (inForm.exam2.value != "" || checkValidString(inForm.exam2.value)){
		if (!CheckBookDateTime("document.bookform","2"))
			return false;
	}
	if (inForm.exam3.value != "" || checkValidString(inForm.exam3.value)){
		if (!CheckBookDateTime("document.bookform","3"))
			return false;
	}
	if (inForm.exam4.value != "" || checkValidString(inForm.exam4.value)){
		if (!CheckBookDateTime("document.bookform","4"))
			return false;
	}
	if (inForm.exam5.value != "" || checkValidString(inForm.exam5.value)){
		if (!CheckBookDateTime("document.bookform","5"))
			return false;
	}
	if (inForm.voucher.value == '' || !checkValidString(inForm.voucher.value)){
		alert("Please enter total exam fee/voucher no.");
        inForm.voucher.focus();
		return false;
	}
	if (inForm.email.value.length<5 || (inForm.email.value.indexOf("@") == -1 || inForm.email.value.indexOf(".") == -1 || inForm.email.value.indexOf("@") == 0 || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "@" || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "." || inForm.email.value.indexOf(".") == 0)) {
		alert("Please provide a valid email address.");
        inForm.email.focus();
		return false;
	}
	if (inForm.ename.value == '' || !checkValidString(inForm.ename.value)){
		alert("Please enter your english name.");
        inForm.ename.focus();
		return false;
	}
    if (inForm.htel.value == '' || !checkValidString(inForm.htel.value) || !CheckNum(inForm.htel.value)){
 		alert("Please provide a valid home telephone number.");
 		inForm.htel.focus();
		return false;
	}
	var centreValid = false;
	for (i=0; i<inForm.centre.length; i++){
		if (inForm.centre[i].checked == true)
			centreValid = true;
	}
	if (centreValid == false){
		alert("Please select examination centre.");
		return false;
	}
    if (!inForm.otel.value == ''){
		if (!CheckNum(inForm.otel.value)){
			alert("Please provide a valid office telephone number.");
			inForm.otel.focus();
			return false;
		}
	}
	if (!inForm.fax.value == ''){
		if (!CheckNum(inForm.fax.value)){
			alert("Please provide a valid fax number.");
			inForm.fax.focus();
			return false;
		}
	}
    if (!inForm.mobile.value == ''){
		if (!CheckNum(inForm.mobile.value)){
			alert("Please provide a valid mobile/pager number.");
			inForm.mobile.focus();
			return false;
		}
	}
return true;
}

//*************************************
function CheckMOSForm(inForm){
//*************************************
	var register = false;
	var examno = 15;
	var i=1;
	
	for (i=1; i<=examno;i++){
		oControl = eval("inForm.e"+i);
		if (typeof oControl.length == "number"){
			for (j=0; j<oControl.length; j++){
				if (oControl[j].checked == true){
					register = true;
				}	
			}
		}	
		else{
			if (oControl.checked == true)
				register = true;
		}					
	}
	if (register == false){
		alert("Please specify at least one examination.");
		inForm.e1[0].focus();
		return false;
	}		
	
	for (i=1; i<=examno; i++){
		oControl = eval("inForm.e"+i);	
		register = false;
		if (typeof oControl.length == "number"){
			for (j=0; j<oControl.length; j++){
				if (oControl[j].checked == true)
					register = true;
			}
			if (register == true){
				if (!CheckBookDateTime("document.bookform",i))
					return false;
			}
		}			
		else{
			if (oControl.checked == true){
				if (!CheckBookDateTime("document.bookform",i))
					return false;
			}		
		}		
	}				

	if (inForm.voucher.value == '' || !checkValidString(inForm.voucher.value)){
		alert("Please enter total exam fee.");
        inForm.voucher.focus();
		return false;
	}
	if (inForm.email.value.length<5 || (inForm.email.value.indexOf("@") == -1 || inForm.email.value.indexOf(".") == -1 || inForm.email.value.indexOf("@") == 0 || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "@" || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "." || inForm.email.value.indexOf(".") == 0)) {
		alert("Please provide a valid email address.");
        inForm.email.focus();
		return false;
	}
	if (inForm.ename.value == '' || !checkValidString(inForm.ename.value)){
		alert("Please enter your english name.");
        inForm.ename.focus();
		return false;
	}
    if (inForm.htel.value == '' || !checkValidString(inForm.htel.value) || !CheckNum(inForm.htel.value)){
 		alert("Please provide a valid home telephone number.");
 		inForm.htel.focus();
		return false;
	}
	var centreValid = false;
	for (i=0; i<inForm.centre.length; i++){
		if (inForm.centre[i].checked == true)
			centreValid = true;
	}
	if (centreValid == false){
		alert("Please select examination centre.");
		return false;
	}
    if (!inForm.otel.value == ''){
		if (!CheckNum(inForm.otel.value)){
			alert("Please provide a valid office telephone number.");
			inForm.otel.focus();
			return false;
		}
	}
	if (!inForm.fax.value == ''){
		if (!CheckNum(inForm.fax.value)){
			alert("Please provide a valid fax number.");
			inForm.fax.focus();
			return false;
		}
	}
    if (!inForm.mobile.value == ''){
		if (!CheckNum(inForm.mobile.value)){
			alert("Please provide a valid mobile/pager number.");
			inForm.mobile.focus();
			return false;
		}
	}
return true;
}


function CheckBookDateTime(inForm, examno){
	var ddCon = eval(inForm+".dd"+examno);
	var mCon = eval(inForm+".m"+examno);
	var yCon = eval(inForm+".y"+examno);
	var hCon = eval(inForm+".h"+examno);
	var minCon = eval(inForm+".min"+examno);

	if (ddCon.value == '' || !checkValidString(ddCon.value) || !CheckNum(ddCon.value)){
		alert("Please provide a valid examination date.");
		ddCon.focus();
		return false;
	}
	if (mCon.value == '' || !checkValidString(mCon.value) || !CheckNum(mCon.value)){
		alert("Please provide a valid examination date.");
		mCon.focus();
		return false;
	}
	if (yCon.value == '' || !checkValidString(yCon.value) || !CheckNum(yCon.value)){
		alert("Please provide a valid examination date.");
		yCon.focus();
		return false;
	}
	if (hCon.value == '' || !checkValidString(hCon.value) || !CheckNum(hCon.value)){
		alert("Please provide a valid examination time.");
		hCon.focus();
		return false;
	}
	if (minCon.value == '' || !checkValidString(minCon.value) || !CheckNum(minCon.value)){
		alert("Please provide a valid examination time.");
		minCon.focus();
		return false;
	}
return true;
}

//*************************************
function CheckCorpForm(inForm){
//*************************************

	if (inForm.company.value == '' || !checkValidString(inForm.company.value)){
        alert("Please provide company name.");
        inForm.company.focus(); 
		return false;
	}
	if (inForm.address.value == '' || !checkValidString(inForm.address.value)){
		alert("Please provide company address.");
        inForm.address.focus();
		return false;
	}
	if (inForm.url.value == '' || !checkValidString(inForm.url.value)){
        alert("Please provide URL.");
        inForm.url.focus(); 
		return false;
	}
    if (!inForm.otel.value == ''){
		if (!CheckNum(inForm.otel.value)){
			alert("Please provide a valid company telephone number.");
			inForm.otel.focus();
			return false;
		}
	}
	if (!inForm.ofax.value == ''){
		if (!CheckNum(inForm.ofax.value)){
			alert("Please provide a valid company fax number.");
			inForm.ofax.focus();
			return false;
		}
	}
    if (inForm.employee.selectedIndex == 0){
		alert("What is the number of employees?");
		inForm.employee.focus();
		return false;
	}
	if (inForm.name.value == '' || !checkValidString(inForm.name.value)){
        alert("Please provide your name.");
        inForm.name.focus(); 
		return false;
	}
	if (inForm.title.value == '' || !checkValidString(inForm.title.value)){
        alert("Please provide your title.");
        inForm.title.focus(); 
		return false;
	}
	if (inForm.email.value.length<5 || (inForm.email.value.indexOf("@") == -1 || inForm.email.value.indexOf(".") == -1 || inForm.email.value.indexOf("@") == 0 || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "@" || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "." || inForm.email.value.indexOf(".") == 0)) {
		alert("Please provide a valid email address.");
        inForm.email.focus();
		return false;
	}
    if (inForm.ptel.value == '' || !checkValidString(inForm.ptel.value) || !CheckNum(inForm.ptel.value)){
 		alert("Please provide your valid telephone number.");
 		inForm.ptel.focus();
		return false;
	}
    if (inForm.pfax.value == '' || !checkValidString(inForm.pfax.value) || !CheckNum(inForm.pfax.value)){
 		alert("Please provide your valid fax number.");
 		inForm.pfax.focus();
		return false;
	}
	
return true;

}

//*************************************
function CheckQForm(inForm){
//*************************************

	if (inForm.course.selectedIndex == 0){
		alert("Please select training course.");
		return false;
	}

	if (inForm.level.selectedIndex == 0){
		alert("Please select level.");
		return false;
	}
	
	if (inForm.language.selectedIndex == 0){
		alert("Please select conduction language.");
		return false;
	}

	if (inForm.trainee.selectedIndex == 0){
		alert("Please select number of trainees per class.");
		return false;
	}
	
	if (!inForm.totaltrainee.value == ''){
		if (!CheckNum(inForm.totaltrainee.value)){
			alert("Please provide a valid total number of trainees.");
			inForm.totaltrainee.focus();
			return false;
		}
	}
	
	if (!inForm.duration.value == ''){
		if (!CheckNum(inForm.duration.value)){
			alert("Please provide a valid preferred duration of course (hours).");
			inForm.duration.focus();
			return false;
		}
	}

	if (inForm.venue.selectedIndex == 0){
		alert("Please select training venue.");
		return false;
	}


	if (inForm.name.value == '' || !checkValidString(inForm.name.value)){
		alert("Please provide your name.");
        inForm.name.focus();
		return false;
	}

	if (inForm.company.value == '' || !checkValidString(inForm.company.value)){
		alert("Please provide your company name.");
        inForm.company.focus();
		return false;
	}

	if (inForm.location.value == '' || !checkValidString(inForm.location.value)){
		alert("Please provide your office location - district.");
        inForm.location.focus();
		return false;
	}

	if (inForm.tel.value == '' || !checkValidString(inForm.tel.value) || !CheckNum(inForm.tel.value)){
 		alert("Please provide your valid telephone number.");
 		inForm.tel.focus();
		return false;
	}

	if (inForm.email.value.length<5 || (inForm.email.value.indexOf("@") == -1 || inForm.email.value.indexOf(".") == -1 || inForm.email.value.indexOf("@") == 0 || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "@" || inForm.email.value.substring(inForm.email.value.length-1,inForm.email.value.length) == "." || inForm.email.value.indexOf(".") == 0)) {
		alert("Please provide a valid email address.");
        inForm.email.focus();
		return false;
	}
	
return true;

}

function SwapVer(btn){
	chiobject = eval("chinese");
	engobject = eval("english");
	if (btn == "chinese") {
		if (chiobject.src.indexOf("chi_ver2.gif") == -1){
			filepath = parent.frames[2].location.pathname.substr(0,parent.frames[2].location.pathname.lastIndexOf("/")+1);
			filename = parent.frames[2].location.pathname.substr(parent.frames[2].location.pathname.lastIndexOf("/")+1);
			querystr = parent.frames[2].location.search;
			ver = "chi";
			if (parent.frames[2].location.pathname != "/swap.asp"){
				if (filepath.indexOf("/chi/") == -1)
					parent.frames[2].location.href = "/swap.asp";
			}		
//			alert("filepath="+filepath);
//			alert("filename="+filename);
//			alert("querystring="+parent.frames[2].location.search);
//			alert("full path="+parent.frames[2].location.href);
//				engobject.src = "/images/eng_ver.gif"
//				chiobject.src = "/images/chi_ver2.gif"
//				parent.frames[1].location.href = "/cleft.asp";
		}	
	}	
	else {
		if (engobject.src.indexOf("eng_ver2.gif") == -1){
			filepath = parent.frames[2].location.pathname.substr(0,parent.frames[2].location.pathname.lastIndexOf("/")+1);
			filename = parent.frames[2].location.pathname.substr(parent.frames[2].location.pathname.lastIndexOf("/")+1);
			querystr = parent.frames[2].location.search;
			ver = "eng";
			if (parent.frames[2].location.pathname != "/swap.asp"){
				if (filepath.indexOf("/chi/") != -1)
					parent.frames[2].location.href = "/swap.asp";
			}		
//			alert("filepath="+filepath);
//			alert("filename="+filename);
//			alert("querystring="+parent.frames[2].location.search);
//			alert("full path="+parent.frames[2].location.href);
//			parent.frames[2].location.href = filepath + filename.substr(1) + querystr;
//			chiobject.src = "/images/chi_ver.gif"
//			engobject.src = "/images/eng_ver2.gif"
//			parent.frames[1].location.href = "/left.asp";
		}	
	}
}

function InitVer(version){
	if (version == "eng"){
		chinese.src = "/images/chi_ver.gif";
		english.src = "/images/eng_ver2.gif";
		parent.frames[1].location.href = "/left.asp";
	}
	else{
		english.src = "/images/eng_ver.gif";
		chinese.src = "/images/chi_ver2.gif";
		parent.frames[1].location.href = "/chi/left.asp";
	}	
}		

function Top_Reload(version){
	if (version == "eng")
		parent.frames[2].location.href="/content.asp";
	else
		parent.frames[2].location.href="/chi/content.asp";	
}

function e_InitVer(version){
	if (version == "eng"){
		parent.frames[1].location.href = "/e_left_training2.asp";
	}
	else{
		parent.frames[1].location.href = "/chi/e_left_training2.asp";
	}	
}	


function e_SwapVer(btn){
	chiobject = eval("chinese");
	engobject = eval("english");
	if (btn == "chinese") {
		if (chiobject.src.indexOf("chi_ver2.gif") == -1){
			filepath = parent.frames[2].location.pathname.substr(0,parent.frames[2].location.pathname.lastIndexOf("/")+1);
			filename = parent.frames[2].location.pathname.substr(parent.frames[2].location.pathname.lastIndexOf("/")+1);
			querystr = parent.frames[2].location.search;
			ver = "chi";
			if (parent.frames[2].location.pathname != "/e_swap.asp"){
				if (filepath.indexOf("/chi/") == -1)
					parent.frames[2].location.href = "/e_swap.asp";
			}		
		}	
	}	
	else {
		if (engobject.src.indexOf("eng_ver2.gif") == -1){
			filepath = parent.frames[2].location.pathname.substr(0,parent.frames[2].location.pathname.lastIndexOf("/")+1);
			filename = parent.frames[2].location.pathname.substr(parent.frames[2].location.pathname.lastIndexOf("/")+1);
			querystr = parent.frames[2].location.search;
			ver = "eng";
			if (parent.frames[2].location.pathname != "/e_swap.asp"){
				if (filepath.indexOf("/chi/") != -1)
					parent.frames[2].location.href = "/e_swap.asp";
			}		
		}	
	}
}

function e_train_to_sys(){
	this.location.href = "/e_inside_top_system.asp";
	parent.frames[1].location.href = "/e_left_system.asp";
	parent.frames[2].location.href = "/e_system_content.asp";
}

function e_sys_to_train(){
	this.location.href = "../e_inside_top_training.asp?ver=eng";
//	parent.frames[1].location.href = "../e_left_training2.asp";
//	parent.frames[2].location.href = "content.asp";
}

function e_back_to_index(){
	if ( this.top != this.window ){
		top.location.href="http://www.welkin.com.hk/home.htm";
	}
}

function e_go_to_aboutus(){
	if ( this.top != this.window ){
		top.location.href="http://www.welkin.com.hk/aboutus.htm";
	}
}

function e_go_to_partners(){
	if ( this.top != this.window ){
		top.location.href="http://www.welkin.com.hk/partners.htm";
	}
}

function e_go_to_news(){
	if ( this.top != this.window ){
		top.location.href="http://www.welkin.com.hk/news.htm";
	}
}

function e_go_to_contactus(){
	if ( this.top != this.window ){
		top.location.href="http://www.welkin.com.hk/contactus.htm";
	}
}
//*************************************
function goBack(){
//*************************************
	window.history.back()
}