function switchEngBig5() {

	//var hosturl = "//localhost:8080/myit-school2/qef/eng";
	//var selfUrl = self.location.pathname;

/*
	var myobject = new Array(2);
	myobject[0] = parent.a;
	myobject[1] = parent.b;
*/

	var myobject = new Array(3);
	myobject[0] = parent.topFrame;
	myobject[1] = parent.leftFrame;
	myobject[2] = parent.content;

	var selfUrl;
	var urlquery;
	var urlterms;

	for (i=0; i<=2; i++) {
		selfUrl = myobject[i].location.pathname;

		//var selfUrl = parent.location.pathname;
		urlquery=myobject[i].location.href.split("?");
		urlterms=urlquery[1];

		if (selfUrl.indexOf('eng', 0) > 0) {
			pos = selfUrl.indexOf('eng', 0);
			targetUrl = selfUrl.substring(0, pos)+'big5'+selfUrl.substring(pos+3,selfUrl.length);
			if (!urlterms)
				//self.location.href = targetUrl;
				//parent.location.href = targetUrl;
				myobject[i].location.href = targetUrl;
			else 
				//self.location.href = targetUrl+"?"+urlterms;
				//parent.location.href = targetUrl+"?"+urlterms;
				myobject[i].location.href = targetUrl+"?"+urlterms;
		} else if (selfUrl.indexOf('big5', 0) > 0) {
			pos = selfUrl.indexOf('big5', 0);
			//targetUrl = hosturl+selfUrl.substring(pos+4,selfUrl.length);
			targetUrl = selfUrl.substring(0, pos)+'eng'+selfUrl.substring(pos+4,selfUrl.length);
			if (!urlterms)
				//self.location.href = targetUrl;
				//parent.location.href = targetUrl;
				myobject[i].location.href = targetUrl;
			else 
				//parent.location.href = targetUrl+"?"+urlterms;
				myobject[i].location.href = targetUrl+"?"+urlterms;
		} else if (selfUrl.indexOf('gb', 0) > 0) {
			pos = selfUrl.indexOf('gb', 0);
			//targetUrl = hosturl+selfUrl.substring(pos+2,selfUrl.length);
			targetUrl = selfUrl.substring(0, pos)+'eng'+selfUrl.substring(pos+2,selfUrl.length);
			if (!urlterms)
				//self.location.href = targetUrl;
				//parent.location.href = targetUrl;
				myobject[i].location.href = targetUrl;
			else
				//parent.location.href = targetUrl+"?"+urlterms;
				myobject[i].location.href = targetUrl+"?"+urlterms;
		} else {
			if (!urlterms)
				//self.location.href = selfUrl;
				//parent.location.href = selfUrl;
				myobject[i].location.href = selfUrl;
			else
				//self.location.href = selfUrl+"?"+urlterms;
				//parent.location.href = selfUrl+"?"+urlterms;
				myobject[i].location.href = selfUrl+"?"+urlterms;
		}
	}
}

function switchGbBig5() {

	//var hosturl = "//localhost:8080/myit-school2/qef/eng";
	//var selfUrl = self.location.pathname;

/*
	var myobject = new Array(2);
	myobject[0] = parent.a;
	myobject[1] = parent.b;
*/
	var myobject = new Array(3);
	myobject[0] = parent.topFrame;
	myobject[1] = parent.leftFrame;
	myobject[2] = parent.content;

	var selfUrl;
	var urlquery;
	var urlterms;


	for (i=0; i<=2; i++) {

		selfUrl = myobject[i].location.pathname;

		urlquery=myobject[i].location.href.split("?");
		urlterms=urlquery[1];

		if (selfUrl.indexOf('gb', 0) > 0) {
			pos = selfUrl.indexOf('gb', 0);
			targetUrl = selfUrl.substring(0, pos)+'big5'+selfUrl.substring(pos+2,selfUrl.length);
			if (!urlterms)
				//self.location.href = targetUrl;
				//parent.location.href = targetUrl;
				myobject[i].location.href = targetUrl;
			else 
				//parent.location.href = targetUrl+"?"+urlterms;
				myobject[i].location.href = targetUrl+"?"+urlterms;
		} else if (selfUrl.indexOf('big5', 0) > 0) {
			pos = selfUrl.indexOf('big5', 0);
			//targetUrl = hosturl+selfUrl.substring(pos+4,selfUrl.length);
			targetUrl = selfUrl.substring(0, pos)+'gb'+selfUrl.substring(pos+4,selfUrl.length);
			if (!urlterms)
				//self.location.href = targetUrl;
				//parent.location.href = targetUrl;
				myobject[i].location.href = targetUrl;
			else 
				//self.location.href = targetUrl+"?"+urlterms;
				//parent.location.href = targetUrl+"?"+urlterms;
				myobject[i].location.href = targetUrl+"?"+urlterms;
		} else if (selfUrl.indexOf('eng', 0) > 0) {
			pos = selfUrl.indexOf('eng', 0);
			//targetUrl = hosturl+selfUrl.substring(pos+2,selfUrl.length);
			targetUrl = selfUrl.substring(0, pos)+'gb'+selfUrl.substring(pos+3,selfUrl.length);
			if (!urlterms)
				//self.location.href = targetUrl;
				//parent.location.href = targetUrl;
				myobject[i].location.href = targetUrl;
			else
				//self.location.href = targetUrl+"?"+urlterms;
				//parent.location.href = targetUrl+"?"+urlterms;
				myobject[i].location.href = targetUrl+"?"+urlterms;
		} else {
			if (!urlterms)
				//self.location.href = selfUrl;
				//parent.location.href = selfUrl;
				myobject[i].location.href = selfUrl;
			else
				//self.location.href = selfUrl+"?"+urlterms;
				myobject[i].location.href = selfUrl+"?"+urlterms;
		}
	}
}


/*
function switchGbBig5() {

	var selfUrl = "";
	selfUrl = self.location.toString();

	var urlquery;
	var urlterms;
	urlquery=location.href.split("?");
	urlterms=urlquery[1];

	if (selfUrl.indexOf('gb', 0) > 0) {	//-1 not found
		pos = selfUrl.indexOf('localhost:8080/myit-school2/qef', 0);
		tempUrl = "//"+selfUrl.substring(pos,selfUrl.length);
		if (tempUrl.indexOf('gb', 0) > 0) {	//-1 not found
			pos1 = tempUrl.indexOf('gb', 0);
			targetUrl = tempUrl.substring(0, pos1)+'big5'+tempUrl.substring(pos1+2,tempUrl.length);
				self.location.href = targetUrl;
		} else {
				self.location.href = tempUrl;
		}
	} else if (selfUrl.indexOf('big5', 0) > 0) {	//-1 not found
		pos = selfUrl.indexOf('big5', 0);
		targetUrl = "http://localhost:8080/myit-school2/qef/gb"+selfUrl.substring(pos+4,selfUrl.length);
		self.location.href = targetUrl;
	} else if (selfUrl.indexOf('eng', 0) > 0) {	//-1 not found
		pos = selfUrl.indexOf('eng', 0);
		targetUrl = "http://localhost:8080/myit-school2/qef/gb"+selfUrl.substring(pos+3,selfUrl.length);
		self.location.href = targetUrl;
	} else {
		self.location.href = selfUrl;
	}
}
*/
