// Copyright(c) 2003-2010 Leadware Co., Ltd. All Rights Reserved.

if(self.jvsRunway) jvsRunway();

// 維護時隱藏左區塊
if(self.underopsms) {
	document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+
		(opsms_dochref.match(/^http:\/\/www\.hsinwuhr\.gov\.tw\/eng\/\w+\.html/) ? ".":"..")+
		"/css/underopsms.css\" media=\"screen\">");
	}

// show 圖
function com_main() {
	top_main();
	}

// top.html
var top_demos= 12;
var top_maininitialized= false;
var top_indemofunc= false;
var top_timedemo;

function top_timedemonext() {
	if(top_maininitialized) {
		if(!top_indemofunc) {
			top_indemofunc= true;
			if(top_timedemo) clearTimeout(top_timedemo);
			if(++top_pdemono>= top_demos) top_pdemono= 0;
			switch(jvsRunway()) {
				case 1:
					top_pdemo.src= top_pdemos[top_pdemono].src;
					break;

				case 2:
					top_pdemo.filters.blendTrans.Apply();
					top_pdemo.src= top_pdemos[top_pdemono].src;
					top_pdemo.filters.blendTrans.Play();
					break;
				}

			top_timedemo= setTimeout("top_timedemonext()", 10000);
			top_indemofunc= false;
			}
		}
	}

function top_main() {
	var u;

	top_pdemono= 1;
	top_pdemo= document["top_idemo"];
	u= top_pdemo.src.replace(/^(.*?\/)?(\w*\.(jpg|gif|png))$/, "$1");

	top_pdemos= new Array();
	for(i=0; i<top_demos; i++) {
		top_pdemos[i]= new Image();
		top_pdemos[i].src= u+ "topdemo"+ (i+1)+ ".jpg";
		}
	top_maininitialized= true;

	top_timedemo= setTimeout("top_timedemonext()", 5000);
	}



// Print
function print_all() {	// func
	document.body.className= "printall";
	window.print();
	}

function print_part() {	// func
	document.body.className= "printpart";
	window.print();
	}



// Search
function remove_keyword1() {
	if(document.xhtmlsearch1.keyword.value== "* Keyword *") document.xhtmlsearch1.keyword.value= "";
	}

function clear_keyword1() {
	remove_keyword1();

	return true;
	}



// pulldown menu
//var hosmenu= 157+ 4;
//var hsmenu= new Array(0, 13, 39, 65, 91, 117, 143, 169, 195, 221, 247, 273, 299, 325, 351, 377, 403);
//var smenus= hsmenu.length-1;
var smenus= 5;
var smenusel= 0;

var timeclearwait= 200;
var timeclear= null;
var osmenu= null;

//function smenublock2(n, t) {
//	var o;
//
//	o= objElementById("smenu"+ n);
//	if(o) {
//		o.className= (t ? "smenushow":"smenuhide");
//		}
//	}

function smenublock(n, t) {
	var o;

	o= objLayer("smenu"+ n);
	if(o) if(t== null) return (o.display== "");
	else {
		o.display= (t ? "":"none");
		}
	}

function cleartimeclear() {
	if(timeclear) {
		clearTimeout(timeclear);
		timeclear= null;
		}
	}

function smenublockover(n, t) {
	osmenu= objLayer("lysmenu"+ n);
	if(!osmenu) return;

//	osmenu.top= jvspx(hosmenu+ hsmenu[n]);

	if(smenusel==n) {
		cleartimeclear();
		}
	else {
		if(smenusel==0) {}
		else if((smenusel>0) && (smenusel<= smenus)) {
			cleartimeclear();
			smenublock(smenusel, 0);
			smenusel= 0;
			}

		smenublock(n, 1);
		smenusel= n;
		}
	}

function hidesmenu(n) {
	if((smenusel>0) && (smenusel<= smenus) && (smenusel== n)) {
		smenublock(smenusel, 0);
		smenusel= 0;
		}
	}

function smenublockout(n) {
	osmenu= objLayer("lysmenu"+ n);
	if(!osmenu) return;
	timeclear= setTimeout("hidesmenu("+ n+ ")", timeclearwait);
	}



// general library
function iddisplay(n, t) {
	var i;

	if(t== null) return (eval(n+ ".style.display")== "");
	else {
		eval(n).style.display= (t ? "":"none");
		}
	}

function ShowUpdate(d) {	// func
	document.write("Last updated "+ d)
	}

function ShowUpdateDoc() {	// func
	ShowUpdate(cDateDoc())
	}

function cStrZ2(n) {	// func
	var s;

	s= ""+ n;
	if(s.length< 2) {
		s= zeroletters.substring(0, 2-s.length)+ s;
		}

	return s;
	}

function cROCDate(dt) {	// func
	var y;

	y= dt.getFullYear();
	return cStrZ2(((y<2000) ? (y+2000- 1911):(y- 1911)))+ "/"+ cStrZ2(dt.getMonth()+1)+ "/"+ cStrZ2(dt.getDate());
	}

function cDate(dt) {	// func
	var y;

	y= dt.getFullYear();
	return "JanFebMarAprMayJunJulAugSepOctNovDec".substr(dt.getMonth()* 3, 3)+ " "+ cStrZ2(dt.getDate()+ ", "+ cStrZ2(((y<2000) ? (y+2000):(y))));
	}

function cROCDateDoc() {	// func
	return cROCDate(new Date(document.lastModified));
	}

function cDateDoc() {	// func
	return cDate(new Date(document.lastModified));
	}

function replacebasego(sn) {	// func
	var publicbase= "http://hsinwuhr2.leadware.com";
	var securebase= jvsdocsubcookie2("hsinwuhr", "securebase");
	var targeturl;

	if(sn== null) sn= ".asp";
	targeturl= ((securebase== "") ? publicbase:securebase)+ document.location.pathname.replace(/.html$/, sn)+ document.location.search;
//	alert("轉換網域: "+ targeturl);
	window.location.replace(targeturl);
	}
