
//-------------- START : MM_jumpMenu -------------------------------------//
/* 
<select onChange="jumpMenu('parent',this,0)">
<option value="http://www.yahoo.com">yahoo</option>
<option value="http://www.goggle.com">goggle</option>
</select>
*/ 
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-------------- END : MM_jumpMenu -------------------------------------//

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_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_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);


// (eg) <a href="javascript:MM_openBrWindow('pic.jpg','popup','width=400,height=300');">popup link</a>
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features+',scrollbars=yes');
}
function MM_openBrWindow2(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}







//**************** Passage a week - top chart function

function showTopChart() {

	document.if1.document.location="passage_topchart.php";
	var lyobj = document.all.topchartLayer;
	lyobj.style.visibility = "visible";
}

function closeTopChart() {

	var lyobj = document.all.topchartLayer;
	lyobj.style.visibility = "hidden";
}

function playSound(soundid,wavFile)
{
	document.all[soundid].src=wavFile;

	//return false;
}

// for stident site - edict
var isShowKeyboard = false;

function showKeyboard(pos,x)
{
	var layoutTop = 0;
	var starttop = 560;
	var eachHeight = 130;
	switch (pos)
	{
		case 1:
			layoutLeft = 200;
			layoutTop = starttop+ (pos-1)*eachHeight +x;
			break;
		case 2:
			layoutLeft = 200;
			layoutTop = starttop+ (pos-1)*eachHeight +x;
			break;
		case 3:
			layoutLeft = 200;
			layoutTop = starttop+ (pos-1)*eachHeight +x;
			break;
		case 4:
			layoutLeft = 200;
			layoutTop = starttop+ (pos-1)*eachHeight +x;
			break;
		case 5:
			layoutLeft = 200;
			layoutTop = starttop+ (pos-1)*eachHeight +x;
			break;
		case 6:
			layoutLeft = 200;
			layoutTop = starttop+ (pos-1)*eachHeight +x;
			break;
	}

	var k = document.all.keyboard;
	k.style.pixelTop = layoutTop;
	k.style.left = layoutLeft;


	if (!isShowKeyboard) {
		k.style.visibility = "visible";
		isShowKeyboard = true;
	} else {
		k.style.visibility = "hidden";
		isShowKeyboard = false;
	}

	//return false;

}
function PopWin(url,page,x,y)
{
	eval("nw = window.open(url, page,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,pageXOffset=300,pageYOffset=500,top=80,left=150,width=" + x + ",height=" + y + "')");

	        if ( nw.focus != null)
			{
	        	nw.focus();
			}
}
// student - eHomework
function ehomeGo()
{
	var chapter = document.form1.chapter;
	top.location = chapter.value;
}

function geteDictChapter(locationid){
	var subcat = new Array();
	subcat[0] = new Array('1','4     More about animals ','edict_main1B4.php')
	subcat[1] = new Array('2','2     About me','edict_main2A2.php')
	subcat[2] = new Array('3','1     Open Day','edict_main3B1.php')

	document.form1.chapter.length = 0;

	for (i=0; i<subcat.length; i++)
	{
		if (subcat[i][0] == locationid)
		{
			document.form1.chapter.options[document.form1.chapter.length] = new Option(subcat[i][1], subcat[i][2]);
		}
	}
}

function getPhonicChapter(locationid){
	var subcat = new Array();
	subcat[0] = new Array('1','4     More about animals ','phonic_main.php?chapterID=1')
	subcat[1] = new Array('2','2     About me','phonic_main.php?chapterID=2')
	subcat[2] = new Array('3','1     Open Day','phonic_main.php?chapterID=3')

	document.RecordForm.chapter.length = 0;

	for (i=0; i<subcat.length; i++)
	{
		if (subcat[i][0] == locationid)
		{
			document.RecordForm.chapter.options[document.RecordForm.chapter.length] = new Option(subcat[i][1], subcat[i][2]);
		}
	}
}

function getPhonicMiniChapter(locationid){
	var subcat = new Array();
	// for demo link
	subcat[0] = new Array('1','4     More about animals ','phonic_mini_2.php?chapterID=1')
	subcat[1] = new Array('2','2     About me','phonic_mini_2.php?chapterID=2')

	document.RecordForm.chapter.length = 0;

	for (i=0; i<subcat.length; i++)
	{
		if (subcat[i][0] == locationid)
		{
			document.RecordForm.chapter.options[document.RecordForm.chapter.length] = new Option(subcat[i][1], subcat[i][2]);
		}
	}
}

function geteHomeChapter(locationid){

	var subcat = new Array();
	subcat[0] = new Array('1','4     More about animals ','ehome_main1B4.php')
	subcat[1] = new Array('2','2     About me','ehome_main2A2.php')
	subcat[2] = new Array('3','1     Open Day','ehome_main3B1.php')

	document.form1.chapter.length = 0;

	for (i=0; i<subcat.length; i++)
	{
		if (subcat[i][0] == locationid)
		{
			document.form1.chapter.options[document.form1.chapter.length] = new Option(subcat[i][1], subcat[i][2]);
		}
	}

}

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}

function trim(str) {
	return str.replace(/^\s*(\S*)\s*/, "$1");
}

function notNullText(obj, alertmsg) {
	if (trim(obj.value) == "") {
		alert(alertmsg);
		return false;
	} else {
		return true;
	}
}

function resetForm(formname) {
	var obj = eval("document." + formname);
	obj.reset();
}

function goPage(no) {
	var d = document.form2;
	d.Page.value = no;
	d.submit();
}

function popup_applet(){
	window.open('applet.html','applet','width=552,height=414');
}






