<!--
var hostn = document.location.hostname;
var rootdir;
var var_year = "not_selected";
var var_level = "not_selected";

switch (hostn) {
	case "www.ilongman.com":
		rootdir = "/eng/";
		break;
	case "ilongman.com":
		rootdir = "/eng/";
		break;
	default:
		rootdir = "/ilongman2003/eng/";
}

window.name = "mainwin";
xmlfile = "/ilongman2003/companionsite.xml"

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value.indexOf("http://") != -1)
	{
		window.open(selObj.options[selObj.selectedIndex].value, "", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=500");
	}
	else
	{
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}
}

function Change_year(selObj){
	var_year = selObj.options[selObj.selectedIndex].value;
}

function Change_level(selObj){
	var_level = selObj.options[selObj.selectedIndex].value;
}

function bee_jumpMenu(targ,restore){ 

	if(var_year == "not_selected" || var_level == "not_selected" )
	{
		alert("please select class and level first");
	}
	else
	{
			  eval(targ+".location='../../eng/teach/"+var_year+"_"+var_level+".asp"+"'");
	//window.open(var_year+"_"+var_level+".asp", "", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=500");
	}	

}

// Change Language Function
function changelang() {

	var loc, tloc;
	loc = document.location.pathname.toString();

// If the current is eng version, It will change to b5 version
	if (loc.indexOf("/eng/") != -1) {
		tloc = loc.replace("/eng/", "/b5/");
	}

// If the current is b5 version, It will change to eng version
	if (loc.indexOf("/b5/") != -1) {
		tloc = loc.replace("/b5/", "/eng/");
	}
	window.location = tloc;
//	alert(tloc);

}

var winpopup;
function MM_openBrWindow(theURL,winName,features) { //v2.0
	winpopup = window.open(theURL,winName,features);
	if (winpopup != null) {
  		winpopup.focus();
	}
}

function enlarge(no) {
	var d = document.location.pathname;
	var filen = d.substring(d.lastIndexOf("/")+1, d.length);
	filen = filen.replace(".asp", "");

	MM_openBrWindow(filen + '_popup.asp?no=' + no,'winphoto','left=0,top=0,width=700,height=550,scrollbars=yes,resizable=yes');
}

function keycontacts(files) {

	MM_openBrWindow(files,'contactuspop','left=0,top=0,width=500,height=450');

}

function benefits(files) {

	MM_openBrWindow(files,'benefitpop','left=0,top=0,width=500,height=450');

}

function newsletter() {

	MM_openBrWindow('popup_newsletter.asp', 'newsletterpop','left=0,top=0,width=500,height=450');

}

function newslettersurfto(obj) {

	var selectedvalue;
	var selectobj;

	selectobj = eval("document.form1." + obj);
	selectedvalue = selectobj.options[selectobj.selectedIndex].value;

	if (selectedvalue == "0") {
		return;
	}

	window.opener.location = selectedvalue;

}

function newsletterhref(loc) {

//	window.opener.location = loc;
	MM_openBrWindow(loc, 'newsletterarhive','width=500,height=450');

}

function submitGroupLinks() {

	document.form1.action = "grouplinks.asp"
	document.form1.submit();

}

function trim(str) {

	return str.replace(/^\s*(\S*)\s*$/, "$1");
}

function isNull(obj, msg) {

	if (trim(obj.value) == "") {
		alert(msg);
		obj.focus();
		return false;
	} else {
		return true;
	}

}

function isInteger(str) {

	re = /^[0-9]*$/;
	if (!re.test(str)) {
		return false;
	} else {
		return true;
	}

}

function isEmailFormat(str) {

	re = /^\S*\@\S*\.\S*$/;

	if (!re.test(str)) {
		return false;
	} else {
		return true;
	}

}

function bulletinsurfto(obj) {

	var selectedvalue;
	var selectobj;

	selectobj = eval("document.form1." + obj);
	selectedvalue = selectobj.options[selectobj.selectedIndex].value;

	if (selectedvalue == "0") {
		return;
	}

	window.opener.location = selectedvalue;

}

function bulletin() {

	MM_openBrWindow('popup_bulletin.asp', 'bulletinpop','left=0,top=0,width=500,height=450');

}

function submitOnlieRegform() {

	document.form1.action = "submit.asp";
	document.form1.submit();

}

function goToLocation(loc) {

	rootd = "/ilongman2003/";
	window.opener.location = rootd+ loc;

}

function popupPDF(str) {
	MM_openBrWindow(str,'pdf','left=0,top=0,width=650,height=500');
}

function dl(no) {
	var d = document.location.pathname;
	var filen = d.substring(d.lastIndexOf("/")+1, d.length);
	filen = filen.replace(".asp", "");
	document.location = downloadfolder+"details"+downloadprefix+"_"+no+".zip";

//	MM_openBrWindow(filen + '_popup.asp?no=' + no,'winphoto','left=0,top=0,width=700,height=550,scrollbars=yes,resizable=yes');
}

function enlargeFull(no) {
	var d = document.location.pathname;
	var filen = d.substring(d.lastIndexOf("/")+1, d.length);
	filen = filen.replace(".asp", "");

	MM_openBrWindow(filen + '_popup.asp?no=' + no,'winphoto','left=0,top=0,width=930,height=620,scrollbars=yes,resizable=yes');
}

function enlargeFull44(dir, no) {
	MM_openBrWindow('details44_pop.asp?no=' + no +'&dir='+dir,'winphoto','left=0,top=0,width=800,height=600,scrollbars=no,resizable=no');
}

function db_full_view(imgname) {
	MM_openBrWindow('db_photo_pop.asp?im=' + imgname,'fullview','left=0,top=0,width=800,height=600,toolbar=0,location=0,statusbar=0,menubar=0,scrollbars=0,resizable=0');
}
function db_full_view2(imgname) {
	MM_openBrWindow('db_photo_pop.asp?im=' + imgname,'fullview2','left=0,top=0,width=800,height=600,toolbar=0,location=0,statusbar=0,menubar=0,scrollbars=1,resizable=0');
}

// Image auto resize
var arImages=new Array();
function Preload() {
	var temp = Preload.arguments; 
	for(x=0; x < temp.length; x++) {
		arImages[x]=new Image();
		arImages[x].src=Preload.arguments[x];
	}
	DetectImageSize(image_1);
}

function DetectImageSize(picName){
	width=picName.width+10;
	height=picName.height+55;
	resizeOuterTo(width, height);
}

function resizeOuterTo(w,h) {
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			top.outerWidth=w-2;
			top.outerHeight=h-3;
	}
	else top.resizeTo(w,h);
	}
}

function change_version(version){
	var version=version;
	var eng_version=document.getElementById("eng");
	var chn_version=document.getElementById("chn");
	if (version=="eng")
	{
		eng_version.style.display="none";
		chn_version.style.display="";
	}
	else
	{
		eng_version.style.display="";
		chn_version.style.display="none";
	}
	
}

//-->
