<!--
var romajiWindow = null;
var transWindow  = null;
var audioWindow  = null;
var newWordsWindow = null;
var grammarWindow  = null;
var answerWindow   = null;
var content = "Please logon to access this page<br>If you have not register yet, <br>please click the button to register";
window.name="maind";
function generateHeader(object, title) {
	object.document.write('<html><head><title>' + title + '</title>');
	object.document.write('<link rel="StyleSheet" href="style.css" type="text/css" /></head><body><form>');
	object.document.write('<table width="100%" border="0" cellpadding="10"><tr><td>');
}

function generateFooter(object) {
	object.document.write('</td></tr></table>');
	object.document.write('<p><div align="center">');
	object.document.write('<input type="button" value="Close" onClick="window.close()"></div>');
	object.document.write('</form></body></html>');
}

function generateFooter2(object) {
	object.document.write('</td></tr></table>');
	object.document.write('<p><div align="center">');
	object.document.write('<input type="button" value="Enrol" onClick="self.opener.location=\'modules.php?op=modload&name=course&file=index&cat=public&id=enrolment\';window.close()"></div>');
	object.document.write('</form></body></html>');
}

function showRoMaJi(options) {

	if (romajiWindow)
  	romajiWindow.close();
	romajiWindow = window.open("","romaji","scrollbars=1,width=300,height=200");
	generateHeader(romajiWindow, "Ro Ma Ji");
	
	// Building Content
	
        romajiWindow.document.write(content);
	
	generateFooter(romajiWindow);
	romajiWindow.focus();
}

function translate(options) {
	if (transWindow)
  	transWindow.close();
  	if(options <=4){
		transWindow = window.open("","translate","scrollbars=1,width=500,height=100");
	}
	else{
		transWindow = window.open("","translate","scrollbars=1,width=300,height=200");
	}  	
	generateHeader(transWindow, "English Translation");
	
	// Building Content
	if(options == "01")
		transWindow.document.write("I am Lee.");
	else if(options == "02")
		transWindow.document.write("Mr. Lee is not a Japanese.");
	else if(options == "03")
		transWindow.document.write("Is Mr. Lee a Japanese?");
	else if(options == "04")
		transWindow.document.write("Mr. Lee is a Japanese too.");
	else
		transWindow.document.write(content);
	
	if(options <=4){
		generateFooter(transWindow);
	}
	else{
		generateFooter2(transWindow);
	}
	
	transWindow.focus();
}

function listen(options) {
	if (audioWindow)
  	audioWindow.close();           
	// Building Content
	if(options > 4){
		audioWindow = window.open("","audio","scrollbars=1,width=300,height=200");
		generateHeader(audioWindow, "Audio");
		audioWindow.document.write(content);
		generateFooter2(audioWindow);
	}
	else{	
		audioWindow = window.open("audio/playback.html?filename=Elementary-1."+options+".mp3","audio","scrollbars=1,width=350,height=150");
  	}
	
	audioWindow.focus();
}

function register(options) {
	if (audioWindow)
  	audioWindow.close();
	audioWindow = window.open("","audio","scrollbars=1,width=300,height=200");
	generateHeader(audioWindow, "Register");
	
	// Building Content
	
	audioWindow.document.write(content);
	
	generateFooter(audioWindow);
	audioWindow.focus();
}

function showNewWords() {
	if (newWordsWindow)
  	newWordsWindow.close();
	newWordsWindow = window.open("modules.php?op=modload&name=course&file=index&cat=public&plain=1&id=ele01newWords","newWords","scrollbars=1,width=500,height=500");
	newWordsWindow.focus();
}

function showGrammar() {
	if (grammarWindow)
  	grammarWindow.close();
	grammarWindow = window.open("modules.php?op=modload&name=course&file=index&cat=public&plain=1&id=ele01grammar","grammar","scrollbars=1,width=600,height=500");
	grammarWindow.focus();
}

function showAnswer() {
	if (answerWindow)
  	answerWindow.close();
	answerWindow = window.open("modules.php?op=modload&name=course&file=index&cat=public&plain=1&id=ele01answer","answer","scrollbars=1,width=500,height=500");
	answerWindow.focus();
}
//-->

