// JavaScript Document
function showSub(menuID) {
	if (!document.getElementById(menuID)) return;
	for (x = 1; x <= 4; x++) {
		m = 'menu' + x;
		if (m != menuID) {
				var menu = document.getElementById('menu' + x).style;
				menu.display = 'none';
		}
	}
	menu = document.getElementById(menuID).style;
	menu.display = (menu.display == 'block')?'none': 'block';
}


// TEXT CONVERSION SCRIPT BEGINS HERE
// ONLY EDIT THE FOLLOWING PARAMETERS FOR ADJUSTMENTS

var folderpath_en = "http://www.kttsang.com/ssld/"; // What is the folder path for English documents? Encase in quotation marks.
var folderpath_ch = "http://www.kttsang.com/ch_ssld/"; // What is the folder path for Chinese documents? Encase in quotation marks.

var prefix_en = ""; // How are English documents prefixed? (e.g. "en_") Encase in quotation marks. Leave blank for none.
var prefix_ch = "ch_"; // How are Chinese documents prefixed? (e.g. "ch_") Encase in quotation marks. Leave blank for none.

// ONLY EDIT THE PARAMETERS ABOVE FOR ADJUSTMENTS


// DO NOT EDIT BELOW

// Ugly implementaton of translation switch
// To fix, use regular expressions

// Get full file path
var f_URL = document.location.href;

// Generate English file name; SLICE from LAST INDEX OF ch_ to end of, APPEND prefix_en (in this case, null)
var ch_last = f_URL.lastIndexOf("ch_") + 3;
var en_name = f_URL.slice(ch_last);

// Generate Chinese file name; SLICE from LAST INDEX OF / to end of string, APPEND prefix_ch
var en_last = f_URL.lastIndexOf("/") + 1;
var ch_name = prefix_ch + f_URL.slice(en_last);

// Functions, onClick
function GoToEnglish() {
window.location = folderpath_en + en_name;
}

function GoToChinese() {
window.location = folderpath_ch + ch_name;
}

// Functions, onHover
function ShowEnglish() {
window.status = folderpath_en + en_name;
}

function ShowChinese() {
window.status = folderpath_ch + ch_name;
}
