 
function slideLine(ul, delay, speed, lh) {
			var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
			var delay = delay||1000, speed=speed||20, lh = lh||20;
			var tid = null, pause = false;
			var start = function() {
				tid=setInterval(slide, speed);
			}
			var slide = function() {
				if (pause) return;
				slideBox.scrollTop += 2;
				if (slideBox.scrollTop % lh == 0) {
					clearInterval(tid);
					slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
					slideBox.scrollTop = 0;
					setTimeout(start, delay);
				}
			}
			slideBox.onmouseover=function(){pause=true;}
			slideBox.onmouseout=function(){pause=false;}
			setTimeout(start, delay);
}

function deleteImage(a1,a2,a3,a4,t) {
	str = prompt("此功能為管理者才可以執行功能,請輸入密碼", "");
	if( str == '123321' ) {
		runfile('/house/deleteObjectImage.php','A1='+a1+'&A2='+a2+'&A3='+a3+'&A4='+a4+'&t='+t);
	}
}

function formCheck() {
	with(document.FORM1) {
		if (isEmpty(HP05.value,'主題') == false){
			HP05.focus();
			return false;
		}
		if (isEmpty(HP06.value,'內容') == false){
			HP06.focus();
			return false;
		}
		if (isEmpty(HP07.value,'姓名') == false){
			HP07.focus();
			return false;
		}		
		if (isEmpty(HP08.value+HP09.value,'電話,手機 至少要輸入一項!') == false){
			HP08.focus();
			return false;
		}
		if (isEmpty(RA.value,'檢查碼') == false){
			RA.focus();
			return false;
		}

		if(confirm("資料確認！\n\n您傳送資料為：\n主題："+HP05.value+
							"\n姓名："+HP07.value+
							"\n電話："+HP08.value+
							"\n手機："+HP09.value+
							"\n\n要開始傳送請按『確定』，放棄傳送請按『取消』。") == false) {
	  			return false;
		}
		
		var url = "/house/pressmsgservice.php?";
		var para = "host="+host.value+"&RA="+RA.value+"&objtype="+objType.value+"&objNumber="+objNumber.value+"&HP02="+HP02.value+"&HP03="+HP03.value+"&HP04="+HP04.value+"&HP05="+HP05.value+"&HP06="+escape(HP06.value)+"&HP07="+HP07.value+"&HP08="+HP08.value+"&HP09="+HP09.value+"&HP10="+HP10.value+"&mail="+mail.value+"&HRA="+HRA.value+"&userObjNumber="+userObjNumber.value;
//		 alert(url+para);
		runfile(url,para);


	} // with
	return false;
}  // function



function formCheck2() {
	with(document.FORM2) {
		if (isEmpty(P1.value,'信的內容') == false){
			P1.focus();
			return false;
		}
		if (isEmpty(P2.value,'自已姓名') == false){
			P2.focus();
			return false;
		}
		if (isEmpty(P3.value,'朋友姓名') == false){
			P3.focus();
			return false;
		}
		if (isEmpty(P4.value+P5.value+P6.value+P7.value,'朋友Email 至少要輸入一個!') == false){
			P4.focus();
			return false;
		}

		if(confirm("資料確認！\n\n您傳送資料為：\n您的姓名："+P2.value+
							"\n朋友姓名："+P3.value+
							"\n朋友Email："+P4.value+","+P5.value+
							"\n\n要開始傳送請按『確定』，放棄傳送請按『取消』。") == false) {
	  			return false;
		}
		
		var url = "/house/pressmsgFriend.php?";
		var para = "host="+host.value+"&A1="+A1.value+"&A2="+A2.value+"&A3="+A3.value+"&A4="+A4.value+"&P1="+escape(P1.value)+"&P2="+P2.value+"&P3="+P3.value+"&P4="+P4.value+"&P5="+P5.value+"&P6="+P6.value+"&P7="+P7.value+"&A92="+A92.value+"&A93="+A93.value+"&objtype="+objtype.value;
//			alert(url+para);

		runfile(url,para);
		if(cookie.isEnabled()) {
			cookie.set('senderfirend',P2.value+"+"+P3.value+"+"+P4.value+"+"+P5.value,getCookieTime(9000));
		}
	} // with
	
	return false;
}  // function

function formCheck3() {
	with(document.FORM3) {
		if (isEmpty(KB11.value,'我的問題') == false){
			KB11.focus();
			return false;
		}
		if (checkLength(KB11.value,400,'我的問題') == false){
			KB11.focus();		
			return false;
		}
		if (isEmpty(KB17.value,'我的姓名') == false){
			KB17.focus();
			return false;
		}
		if (isEmpty(KB06.value,'我的Email') == false){
			KB06.focus();
			return false;
		}
		if (isEmail(KB06.value,'我的Email') == false){
			KB06.focus();
			return false;
		}
		if (isEmpty(QA.value,'檢查碼必須輸入!') == false){
			QA.focus();
			return false;
		}
		
		if(confirm("資料確認！\n\n您傳送資料為：\n您的姓名："+KB17.value+
							"\n您的Email："+KB06.value+
							"\n\n要開始傳送請按『確定』，放棄傳送請按『取消』。") == false) {
	  			return false;
		}
		
		var url = "/house/pressqa.php?";
		var para = "QA="+QA.value+"&mail="+mail.value+"&objType="+objType.value+"&objName="+objName.value+"&AA1="+AA1.value+"&AA2="+AA2.value+"&AA3="+AA3.value+"&AA4="+AA4.value+"&KB08="+KB08.value+"&KB09="+KB09.value+"&host="+host.value+"&KB06="+KB06.value+"&KB07="+KB07.value+"&KB11="+escape(KB11.value)+"&KB17="+KB17.value+"&HQA="+HQA.value;
		// alert(url+para);
		runfile(url,para);
	} // with
	return false;
}  // function


function readMember(){
//	$('googleadsense2frame').scrolling = "auto";
	loading("/house/readmember.php",'cityid='+cityNumber,'memberlist');
}

function right(e) {
	var msg = "不可使用Mouse右鍵功能!";
	if (navigator.appName == 'Netscape' && e.which == 3) {
	 alert(msg); return false;}
	else 
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
	 alert(msg); return false; }
	return true; 
}

function setMouseXY(evt) {
	if (document.all)	{
		x = event.clientX;
		y = event.clientY+document.body.scrollTop;
	} else{
		x = evt.pageX;
		y = evt.pageY;
	}
	if(document.getElementById('quickinfodiv')!=null)  setPosition('quickinfodiv',y+10,x+10);
}
document.onmousemove = setMouseXY;

function showQuickInfo(objtype,obj1,obj2,obj3,obj4,obj5,obj6,obj7,obj8) {
	Element.show('quickinfodiv');
	if(objtype=='HD') {
		str = '案名:<span class=f5>'+obj1+'</span><br>';
		str += '格局:<span class=f5>'+obj2+'</span><br>';
		str += '坪數:<span class=f5>'+obj3+'</span><br>';
		if(obj4!='') str += '社區:<span class=f5>'+obj4+'</span><br>';
		str += '樓高:<span class=f5>'+obj5+'</span><br>';
		str += '屋齡:<span class=f5>'+obj6+'</span><br>';
		//str += '法拍:<span class=f5>'+obj7+'</span><br>';
		if(obj8!='') str += '地坪:<span class=f5>'+obj8+'</span><br>';
	} else if(objtype=='HF') {
		str = '案名:<span class=f5>'+obj1+'</span><br>';
		str += '地目:<span class=f5>'+obj2+'</span><br>';
		if(obj3!='') str += '坪數:<span class=f5>'+obj3+'</span><br>';
		if(obj6!='') str += '位置:<span class=f5>'+obj6+'</span><br>';
		if(obj5!='') str += '訴求:<span class=f5>'+obj5+'</span><br>';
		if(obj7!='') str += '公告:<span class=f5>'+obj7+'</span><br>';
		if(obj8!='') str += '現況:<span class=f5>'+obj8+'</span><br>';
		if(obj4!='' && obj4!='0') str += '面寬:<span class=f5>'+obj4+'米</span><br>';
	} else {
		str = '案名:<span class=f5>'+obj1+'</span><br>';
		str += '類型:<span class=f5>'+obj2+'</span><br>';
		str += '格局:<span class=f5>'+obj3+'</span><br>';
		str += '坪數:<span class=f5>'+obj4+'</span><br>';
		if(obj5!='') str += '社區:<span class=f5>'+obj5+'</span><br>';
		str += '押金:<span class=f5>'+obj6+'</span><br>';
		if(obj7!='') str += '樓高:<span class=f5>'+obj7+'</span><br>';
		if(obj8!='') str += '屋齡:<span class=f5>'+obj8+'</span><br>';
	}
	Element.update('quickinfodivdata',str);

}

function hideQuickInfo() {
	if($('quickinfodiv')!=null) Element.hide('quickinfodiv');
}


function clearslist(a1,a2,a3,a4) {
	var temp = a1+a2+a3+a4;
	for(i=0;i<slist.length;i++) {
		a = slist[i].split('--');
		if(temp==a[0]+a[1]+a[2]+a[3]) {
			slist[i] = null;
			slist = slist.compact();
			reShowList('tracebox',20);
		}
	}
	for(i=0;i<slove.length;i++) {
		a = slove[i].split('--');
		if(temp==a[0]+a[1]+a[2]+a[3]) {
			slove[i] = null;
			slove = slove.compact();
			reShowMyLove('tracebox',20);
			return 'slove';
		}
	}
	return 'slist';
}

function doup(a,color){
	if(color==null) color = '#DDEEEE'
	a.style.backgroundColor= color ;
}
function dodown(a,color){
	if(color==null) color = '#FFFFFF'
	a.style.backgroundColor=color;
}

function getBodyWidth() {
	if (document.all){
		w = document.body.clientWidth;
	}else{
		w = window.innerWidth;
	}
	return w;
}
function getBodyHeight() {
	if (document.all){
		h = document.body.clientHeight;
	}else{
		h = window.innerHeight;
	}
	return h;
}

function setPosition(id,top,left) {
	top = top + 'px';
	left = left + 'px';
	Element.setStyle(id,{'top':top});
	Element.setStyle(id,{'left':left});
}

function clearInnerHTML(id) {
	$(id).innerHTML = '';
}

function setHeight(id,height) {
	var temp = document.getElementById(id);
	if(temp!=null) $(id).style.height = height+'px';
}
	
	
function choiceOver(obj,id) {
	obj.style.backgroundColor='#DDDDDD';
	$(id).src='/images/left/'+id+'over.gif';
}

function choiceOut(obj,id) {
	obj.style.backgroundColor='#FFFFFF';
	$(id).src='/images/left/'+id+'.gif';
}

function showObjDataVideo(src,width,height) {
	if(width==null) width=400;
	if(height==null) height=300;
	var showVideo = $('showVideo');
	var show1=$('show1');
//	var va=$(a);
	show1.innerHTML = "<iframe src="+src+" id='showVideo' name='showVideo' width='"+width+"' height='"+height+"' marginheight='0' marginheight='0' frameborder='0' scrolling='no'></iframe>";
	if(show1.style.display == 'none') {
		var show2=$('show2');
		show1.style.display = 'block';
		show2.style.display = 'none';
	}
//	va.href = "javascript:void(0);return false;";
//	alert(va.href);
//	window.parent.frames['showVideo'].src = src;
//	alert( window.parent.frames['showVideo'].document);

	// showVideo.src = src;
	//alert(show1.style.display);
	 // showVideo.window.history.replace(src);
//	alert(src);
//	loading(src,'','show2');
}
function changeImage(src,width,height) {
	if(width==null) width=600;
	if(height==null) height=450;
	
	var showVideo = $('showVideo');
//	var img = $('showimg');
	var show2=$('show2');
	
	if(show2.style.display == 'none') {
		var show1=$('show1');
		show2.style.display = 'block';
		show1.style.display = 'none';
//		show1.innerHTML = "";
	}
	if(showVideo!=null) showVideo.src = '';
	show2.innerHTML = "<img id=showimg src=\""+src+"\"  height='"+height+"'>"; // width='"+width+"'
//	img.src = src;
}



function doChoiceA(id){
	choiceAvalue = '';
	if(id<0) {
		for(i=0;i<choiceAQty;i++) {
			$('ChoiceA'+i).checked = false;
		}
		$('ChoiceA').checked = true;
	} else {
		$('ChoiceA').checked = false;
		qty = 0;
		for(i=0;i<choiceAQty;i++) {
			temp = $('ChoiceA'+i);
			if(temp.checked) {
				qty++;
				choiceAvalue = choiceAvalue +"*"+ temp.value+"*,";
			}
		}
		if(qty == choiceAQty || qty == 0) {
			$('ChoiceA').checked = true;
			doChoiceA(-1);
		} else choiceAvalue = choiceAvalue.substring(0,choiceAvalue.length-1);
	}
	
	$('choiceAvalue').value = choiceAvalue;
}

function doTaipei(a,b){
	
	Element.show('area');
	Element.hide('showall');
	doChoiceA(-1);
	if(tf) {
		for(x=a;x<=b;x++){
			$('ChoiceA'+x).checked = true;
			doChoiceA(x);
		}
		$('ChoiceA').checked = false;
	}
}


function doB0(id){
	B0Qty = 18 ;
	if(id<0) {
		for(i=0;i<=B0Qty;i++) {
			if(i<10) $('B0'+i).checked = false;
			else $('B'+i).checked = false;
		}
		$('B0').checked = true;
	} else {
		$('B0').checked = false;
		
		qty = 0;
		for(i=0;i<=B0Qty;i++) {
			
			if(i<10) temp = $('B0'+i);
			else temp = $('B'+i);
			if(temp.checked) {
				qty++;
			}
		}
		//alert(qty);
		if(qty == B0Qty || qty == 0) { 
			doB0(-1);
		} 
	}	
}

function doH0(id){
	H0Qty = 5;
	if(id<0) {
		for(i=0;i<H0Qty;i++) {
			$('H0'+i).checked = false;
		}
		$('H0').checked = true;
	} else {
		$('H0').checked = false;
		qty = 0;
		for(i=0;i<H0Qty;i++) {
			temp = $('H0'+i);
			if(temp.checked) {
				qty++;
			}
		}
		if(qty == H0Qty  || qty == 0) { 
			$('H0').checked = true;
			doH0(-1);
		} 
	}
}

function doChoiceS(value){
	if(value!=userDefautSort) {
		setCookie('userDefautSort',value);
	}
}

function setCookie(name,value,time) {
	if(cookie.isEnabled()) {
		if(time==null) time = 99999;
		cookie.set(name,value,getCookieTime(time));
	}
}
//讀取cookie,如無cookie時.傳回null
function getCookie(name,defaultvalue) {
	var t_name = defaultvalue;
	if(cookie.isEnabled()) {
		t_name = cookie.get(name,defaultvalue);
	}
	return t_name; 
}

function doChoiceK(th){
	if(th.checked) choiceKvalue = 'Y';
	else choiceKvalue = 'N';
	setCookie('choiceKvalue',choiceKvalue);
}



function doQueryKeyDown(e) {
	
	var keynum;
	if(window.event) { // IE
		keynum = e.keyCode;
	}else if(e.which){ // Netscape/Firefox/Opera	
		keynum = e.which;
	}
	if(keynum==13) 	doQuery();
}

function reShowList(id,qty) {
	
	var str1 = "";
	var list2 = $(id);

	for(i=0;i<slist.length;i++) {
		if(i>qty-1) break;
		a = slist[i].split('--');
		if(a[1]!='undefined' && a[1]!='' && a[1]!=null){ 
			if(a[4]=='HD') b = "房屋";
			else if(a[4]=='HF') b = "土地";
			else b = "租屋";
			openInfoUrl = "/"+a[0]+"/showobj.php?t="+a[4]+"&A1="+a[0]+"&A2="+a[1]+"&A3="+a[2]+"&A4="+a[3];
			// openInfoUrl = "javascript:showObjectData('/house/showobjdataone.php?t="+a[4]+"&A1="+a[0]+"&A2="+a[1]+"&A3="+a[2]+"&A4="+a[3]+"','"+a[4]+"');";
			str1 += "<div>";
			// <img src=\"/images/icon/item03.gif\"/>
			str1 += "<a href=\"javascript:clearslist('"+a[0]+"','"+a[1]+"','"+a[2]+"','"+a[3]+"');reShowList('"+id+"',20);saveCookie();\"><img src='/images/icon/delete.gif' title='刪除本筆瀏覽清單物件資料!' width=14 height=13></a>";
			str1 +="<a href=\""+openInfoUrl+"\" class='link1' title='聯結觀看更詳細的『"+b+"』資訊!'>"+a[5]+"</a>";
			str1 += "</div>";
		}
		//alert(str1);
	}
	if(list2!=null)	 list2.innerHTML = str1;
}

function reShowMyLove(id,qty) {
	var str1 = "";
	//alert(slove.length);
	if(slove.length==0) {
		str1 = "目前追蹤清單為空白，增加追蹤清單的方法為，點選物件時，再點選『加入追蹤』即可!";
	}
	for(i=0;i<slove.length;i++) {
		if(i>qty-1) break;
		a = slove[i].split('--');
		if(a[1]!='undefined' && a[1]!='' && a[1]!=null){ 	
			if(a[4]=='HD') b = "房屋";
			else if(a[4]=='HF') b = "土地";
			else b = "租屋";
		//	http://localhost/039/showobj.php?t=HD&A1=039&A2=CUEC&A3=CUEC&A4=714
			openInfoUrl = "/"+a[0]+"/showobj.php?t="+a[4]+"&A1="+a[0]+"&A2="+a[1]+"&A3="+a[2]+"&A4="+a[3];
			str1 += "<div><img src=\"/images/icon/item03.gif\"/><a href=\""+openInfoUrl+"\" class='link1' title='聯結觀看更詳細的『"+b+"』資訊!'>"+a[5]+"</a>";
			str1 += "<a href=\"javascript:clearslist('"+a[0]+"','"+a[1]+"','"+a[2]+"','"+a[3]+"');reShowMyLove('"+id+"',20);saveCookie();\"><img src='/images/icon/delete.gif' title='刪除本筆追蹤清單物件資料!' width=14 height=13>";
			str1 += "</div>";
		}
	}
	var list1 = $(id);
	if(list1!=null)	list1.innerHTML = str1;
}

function reShowMyKey(id,qty) {
	var str1 = "";
	//alert(slove.length);
	if(skey.length==0) {
		str1 = "目前常用關鍵字為空白!";
	}
	for(i=0;i<skey.length;i++) {
		if(i>qty-1) break;
		a = skey[i].split('--');
		if(a[4]=='HD') b = "房屋";
		else if(a[4]=='HF') b = "土地";
		else b = "租屋";
		openInfoUrl = "/"+a[0]+"/showobj.php?t="+a[4]+"&A1="+a[0]+"&A2="+a[1]+"&A3="+a[2]+"&A4="+a[3]+"','"+a[4]+"');";
		// openInfoUrl = "javascript:showObjectData('/house/showobjdataone.php?t="+a[4]+"&A1="+a[0]+"&A2="+a[1]+"&A3="+a[2]+"&A4="+a[3]+"','"+a[4]+"');";
		str1 += "<div><img src=\"/images/icon/item03.gif\"/><a href=\""+openInfoUrl+"\" class='link1' title='聯結觀看更詳細的『"+b+"』資訊!'>"+a[5]+"</a></div>";
	}
	var list1 = $(id);
	if(list1!=null)	list1.innerHTML = str1;
}

var now,hours,minutes,seconds,timeValue; 
var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
function showTime(){ 
	if($('clock')!=null || $('smallclock')!=null) {
		var some=1900;
		if(document.all) some = 0;
		now = new Date(); 
		hours = now.getHours(); 
		minutes = now.getMinutes(); 
		seconds = now.getSeconds(); 

		timeValue = (now.getYear() + some) + "年" ;
		timeValue += monthNames[now.getMonth()];
		timeValue += now.getDate() + "日 " 
		
		timeValue2 = (hours >= 12) ? "下午 " : "上午 "; 
		timeValue2 += ((hours > 12) ? hours - 12 : hours) + " 點"; 
		timeValue2 += ((minutes < 10) ? " 0" : " ") + minutes + " 分"; 
		//timeValue2 += ((seconds < 10) ? " 0" : " ") + seconds + " 秒"; 
		if($('clock')!=null) {
			$('clock').innerHTML = timeValue+timeValue2; 
		}
		if($('smallclock')!=null) {
			$('smallclock').innerHTML = timeValue2; 
		}
		setTimeout("showTime()",1000); 
	} 
	
	changeLoadingDivPositon();
//	alert(document.body.scrollTop);
}

function changeLoadingDivPositon() {
	var tv;
	var lv;
	tv = getBodyHeight() / 2 - 50 + document.body.scrollTop;
	lv = getBodyWidth() / 2 - 160  ;
//	alert(t);
//	alert(l);
	
	$('loadingdiv').style.top =  tv + 'px';
	$('loadingdiv').style.left =  lv + 'px';

}

function getCookieTime(hour) {
	if(hour == null || hour =='') hour = 1;
	now=new Date( );
	now.setTime(now.getTime( ) + 1000 * 60 * 60 * hour);
	return now;
}

function loadCookie() {
	if(cookie.isEnabled()) {
		var slist_v = cookie.get('slist',null);
		var slove_v = cookie.get('slove',null);
		var page_v = cookie.get('page',null);
		if(slist_v!=null) {
			slist = slist_v.split('+');
		} 
		if(slove_v!=null) {
			slove = slove_v.split('+');
		} 
		if(page_v!=null) {
			page = page_v;
		} 
	}
}

function addMyLove(a1,a2,a3,a4,a5,a6) {
	var ar = a1+"--"+a2+"--"+a3+"--"+a4+"--"+a5+"--"+a6;
	for(i=0;i<slove.length;i++) {
		if(ar == slove[i]) {
			alert(a6+' 已存在我的追蹤清單中，不可重覆新增!');
			return;
		}
	}
	slove.reverse();
	slove.push(ar);
	slove.reverse();
	if(slove.length>20) {
		slove.pop();
	}
	reShowMyLove('tracebox');
	saveCookie();
	alert(a6+' 加入我的追蹤清單中，已完成!');
}

function addList(a1,a2,a3,a4,a5,a6) {
	var ar = a1+"--"+a2+"--"+a3+"--"+a4+"--"+a5+"--"+a6;
	
	
	//檢查如果有記錄過了，就不再記錄了
	for(i=0;i<slist.length;i++) {
		if(ar == slist[i]) {
			return;
		}
	}	

	slist.reverse();
	slist.push(ar);
	slist.reverse();
	if(slist.length>20) {
		slist.pop();
	}

//	reShowList();
	saveCookie();
}

//將cookie儲檔
function saveCookie() {
	if(cookie.isEnabled()) {
		cookie.set('slove',slove.join("+"),getCookieTime(99999));
		cookie.set('slist',slist.join("+"),getCookieTime(99999));
	}
}


//加入我的最愛
function myfavor(url,title) {
   if( window.sidebar && window.sidebar.addPanel ) {     // Gecko (Netscape 6)
      window.sidebar.addPanel( title, url, '' );
   }
   else if( window.external ) {     // IE
      window.external.AddFavorite( url, title );
   }
   else if( document.layers ) {     // NS4
      alert( '請按 OK 後,再按鍵盤按鈕 Ctrl+D 建立一個新的 bookmark' );
   }
   else {     // Other browsers
      window.alert( '無法為您的瀏覽器中加入最愛功能,自行新增一個 最愛聯結!' );
   }
}

function homePage (obj,url) {
	if(document.all) {
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(url);
	} else {
		alert('請使用您的瀏覽器所屬功能進行設為首頁的功能!');
	}
}
	
function loading(pn,para,Container,asyn) {
	show();
	if(asyn==null) asyn=true;
	//if(para=='') { alert('少傳入para參數'); return false;}
	var ajax = new Ajax.Request ( pn , {
		method:'post',
		parameters:para,
		evalScripts:true,
		asynchronous:asyn,
		onException : function (reqObj) {
			hide();
		} ,
		onComplete : function (reqObj) {
			Element.update('debug',reqObj.responseText.escapeHTML()); // debug 用
			Element.update(Container,reqObj.responseText);
			hide();	
		} 
		
	});
}

function show() {
	changeLoadingDivPositon();
	Element.show('loadingdiv');
	ps++;
	$('ps').innerHTML = "目前有 "+ ps + " 作業處理中...";
	if(ps>=4) {
		Element.show('psblockback');
	}
}
function hide() {
	ps--;
	$('ps').innerHTML = "目前有 "+ ps + " 作業處理中...";
	if(ps<4) {
		Element.hide('psblockback');
	}
	if(ps<=0) {
		ps=0;
		Element.hide('loadingdiv');
	}
}

//呼叫一個URL動作,傳回值執行其中的javascript程式碼
function runfile(pn,para,asyn) {
	if(asyn==null) asyn=true;
	//if(para=='') { alert('少傳入para參數'); return false;}
	var ajax = new Ajax.Request ( pn , {
		method:'post',
		parameters:para,
		evalScripts:true,
		asynchronous:asyn,
		onComplete : function (reqObj) {
	//		Element.update('debug',reqObj.responseText.escapeHTML()); // debug 用
			reqObj.responseText.evalScripts();
		}
	});
}

function changeTab(id,tablist,imgsrc) { 
	for(i=0;i< tablist.length;i++) {
		$(tablist[i]).style.background = imgsrc[1];
	}
	$(tablist[id]).style.background = imgsrc[0];
}

function doQuery(ty) {
	var qs = document.getElementById('qs').value;
	var t = document.getElementById('t').value;
	if(qs=='請輸入您要查詢的關鍵字..') qs = '';
//	alert("search.php?t="+t+"&qs="+escape(qs));
	if(ty=='') window.location.href = "/search.php?t="+t+"&qs="+escape(qs);
	else window.location.href = "search.php?t="+t+"&qs="+escape(qs);
}



//切換 header 的Tab 圖及 t 的值
function changeHeaderTabl(id,tablist,imgsrc) { 
	changeTab(id,tablist,imgsrc);
	if(id==0) $('t').value = 'HD';
	else if(id==1) $('t').value = 'HF';
	else $('t').value = 'HI';
//	alert($('t').value);
//	if(id=='3') {
	doQuery();
//	}
}