/*subnav js function*/

var nowbtn = "";

function ulshows_fun(show) {

	if (typeof(nshow)!='undefined'){

		clearTimeout(nshow); 

	}

	var shownav = document.getElementById("sub_nav"+show);

	var showul = document.getElementById("sub_nav_ul"+show);

	var showbtn = document.getElementById("btn"+show);		

	for(i=0;i<=8;i++) {

		var hiddennav = document.getElementById("sub_nav"+i);

		hiddennav.style.display = "none";

		var hiddenbtn = document.getElementById("btn"+i);

		if(hiddenbtn.className == "now") {

			nowbtn = hiddenbtn;

			}

		if (showbtn.className != "now") {

			hiddenbtn.className = "";

		}

	}	

	if (showbtn.id == "btn0" && showbtn.className ==0) {

		showbtn.className = "hover";

	}

/*	if (showbtn.className != "now" && showbtn.id != "btn0") {

	shownav.style.display = "block";

	shownav.className = "sub_nav_div_bd";

	showbtn.className = "hover";

	}*/

//if (showbtn.className == "now" && showbtn.id != "btn0") {

	shownav.style.display = "block";

	shownav.className = "sub_nav_div_bd";

	showbtn.className = "hover";

//}

}

var   nshow;

var   ushow;

function ulshows(show) {

//	setInterval('ulshows_fun('+show+')',1000)

	ushow=setTimeout('ulshows_fun('+show+')',600);

	clearTimeout(nshow);

}

function subout() {

	nshow=setTimeout('delaysubout()',1000);

	clearTimeout(ushow);

}





function delaysubout(){

	nowbtn.className = "now";	

	for(i=0;i<=8;i++) {

		var shownav = document.getElementById("sub_nav"+i);

		var currentbtn = document.getElementById("btn"+i);

		var hiddenbtn = document.getElementById("btn"+i);

		var showul = document.getElementById("sub_nav_ul"+i);

		if(currentbtn.className != "now") {

			shownav.style.display = "none";	

			hiddenbtn.className = "";

		}

		if(currentbtn.className == "now") {

			shownav.style.display = "block";

			showul.style.display = "block";

			hiddenbtn.className = "now";

		}			

	}

}





function show_exam_answer(maxid){

	document.getElementById('exam_answer').style.display="block";

	for(i=0;i<maxid;i++){

		document.getElementById('showresult'+i).style.display="block";

	}

}



function shownextphoto(spelltplno,spelltplid){

	var the_spelltplid_name = "document.form_data.data_spelltplid"+spelltplno;

	var the_spelltplid = eval(the_spelltplid_name);

	curphoto_no=the_spelltplid.value;

	if (curphoto_no<=3){

		nextphoto_no=parseInt(curphoto_no)+1;

	}else{

		nextphoto_no=0;

	}

	the_spelltplid.value=nextphoto_no;

	document.getElementById('spellphoto'+spelltplno).src="/upload/spelltplfile/spelltplphoto"+spelltplid+"_p"+nextphoto_no+".gif";

	var the_answer_name = "document.form_data.data_answer"+spelltplno;

	var the_answer = eval(the_answer_name);

	if(nextphoto_no==the_answer.value){

		the_result_str='<span class="test-green1">&Omicron;</span>';

	}else{

		the_result_str='<span class="test-red1">&times;</span>';

	}

	document.getElementById('showresult'+spelltplno).innerHTML=the_result_str;

}



function menu(a,b,c,d){

	for(var i=1;i<=c;i++){

		if (a==i){

			document.getElementById(b+i).style.backgroundImage="url(common/images/top/mon.gif)";

			document.getElementById(d+i).style.display="";

			document.getElementById(b+i).style.color="#333";

		}else{

			document.getElementById(b+i).style.backgroundImage="";

			document.getElementById(d+i).style.display="none";

			document.getElementById(b+i).style.color="#fff";

		}

	}

}



function ntw_swap(titleid) {

	var navi = new Array('navi1','navi2','navi3','navi4','navi5','navi6');

	var tab = new Array('tab1','tab2','tab3','tab4','tab5','tab6');

//	var pause = document.getElementById('pause1')

	// change the synopsis 

	for (var i = 0; i < navi.length; i++) {

		if (navi[i]== 'navi'+titleid) {

		document.getElementById(navi[0]).style.background = 'url(/common/images/top/moff.jpg)';

		document.getElementById(navi[1]).style.background = 'url(/common/images/top/moff.jpg)';

		document.getElementById(navi[2]).style.background = 'url(/common/images/top/moff.jpg)';

		document.getElementById(navi[3]).style.background = 'url(/common/images/top/moff.jpg)';

		document.getElementById(navi[4]).style.background = 'url(/common/images/top/moff.jpg)';

		document.getElementById(navi[5]).style.background = 'url(/common/images/top/moff.jpg)';

		document.getElementById(navi[0]).style.color="#fff";

		document.getElementById(navi[1]).style.color="#fff";

		document.getElementById(navi[2]).style.color="#fff";

		document.getElementById(navi[3]).style.color="#fff";

		document.getElementById(navi[4]).style.color="#fff";

		document.getElementById(navi[5]).style.color="#fff";

		document.getElementById(navi[i]).style.background = 'url(/common/images/top/mon.gif)';

		document.getElementById(navi[i]).style.color="#333";

		}

	}

		for (var i = 0; i < tab.length; i++) {

		if (tab[i]== 'tab'+titleid) document.getElementById(tab[i]).style.display = '';

		else document.getElementById(tab[i]).style.display = 'none';

	}

	

}

function pause(vid){

	var auto1 = document.stu_form.stu_form1.value;

	var pause1 = document.getElementById('pause1');

	var pause2 = document.getElementById('pause2');

	var pause3 = document.getElementById('pause3');

	var pause4 = document.getElementById('pause4');

	var pause5 = document.getElementById('pause5');

	var pause6 = document.getElementById('pause6');

	if (auto1 == 0){

	document.stu_form.stu_form1.value=1;

	//alert(document.stu_form.stu_form1.value);

	make_ntw_timers();

	pause1.src = "/common/images/student/pctrl.gif";

	pause2.src = "/common/images/student/pctrl.gif";

	pause3.src = "/common/images/student/pctrl.gif";

	pause4.src = "/common/images/student/pctrl.gif";

	pause5.src = "/common/images/student/pctrl.gif"

	pause6.src = "/common/images/student/pctrl.gif"

	} else {

	document.stu_form.stu_form1.value=0;

	//alert(document.stu_form.stu_form1.value);

	clear_ntw_timers();

	pause1.src = "/common/images/student/pctrl_off.gif";

	pause2.src = "/common/images/student/pctrl_off.gif";

	pause3.src = "/common/images/student/pctrl_off.gif";

	pause4.src = "/common/images/student/pctrl_off.gif";

	pause5.src = "/common/images/student/pctrl_off.gif";

	pause6.src = "/common/images/student/pctrl_off.gif";

	}

}

function make_ntw_timers() {

	ntw_timer_2 = setTimeout("ntw_swap(1);", 10000);

	ntw_timer_3 = setTimeout("ntw_swap(2);", 20000);

	ntw_timer_4 = setTimeout("ntw_swap(3);", 30000);

	ntw_timer_5 = setTimeout("ntw_swap(4);", 40000);

	ntw_timer_6 = setTimeout("ntw_swap(5);", 50000);

	ntw_timer_7 = setTimeout("ntw_swap(6);", 60000);

	ntw_timer_repeater = setTimeout("make_ntw_timers();", 60000);

	

}

function clear_ntw_timers() {

	clearTimeout(ntw_timer_2);

	clearTimeout(ntw_timer_3);

	clearTimeout(ntw_timer_4);

	clearTimeout(ntw_timer_5);

	clearTimeout(ntw_timer_6);

	clearTimeout(ntw_timer_7);

	clearTimeout(ntw_timer_repeater);

}

function clear_ntw(auto){

	if (auto == 0)

	{

	clear_ntw_timers();

	}

}	



function fanyi(a){

	document.getElementById(a).style.display="";

}



new Image().src = "/common/images/top/close.gif";

op="/common/images/top/close.gif";

cl="/common/images/top/open.gif";

function dd(obj){

	if(document.getElementById){

		document.getElementById(obj).style.display=='none'?document.getElementById(obj).style.display='':document.getElementById(obj).style.display='none';

		document.getElementById(obj+"i").src.indexOf('/common/images/top/open')>0?document.getElementById(obj+"i").src=op:document.getElementById(obj+"i").src=cl;

	}else if(document.all){

		document.all(obj).style.display=='none'?document.all(obj).style.display='':document.all(obj).style.display='none';

		document.all(obj+"i").src.indexOf('/common/images/top/open')>0?document.all(obj+"i").src=op:document.all(obj+"i").src=cl;

		}

	else if(document.layers){

		document.layers[obj].display=='none'?document.layers[obj].display='':document.layers[obj].display='none';

		document.layers[obj+"i"].src.indexOf('/common/images/top/open')>0?document.layers[obj+"i"].src=op:document.layers[obj+"i"].src=cl;

	}

}


