//將縣市序號轉換為代碼
function getCityName(cityid) {
	if(cityid==1 || cityid=='039') return "宜蘭";
	else if(cityid==2 || cityid=='038') return "花蓮";
	else if(cityid==3 || cityid=='089') return "台東";
	else if(cityid==4 || cityid=='022') return "台北";
	else if(cityid==5 || cityid=='024') return "基隆";
	else if(cityid==6 || cityid=='034') return "桃園";
	else if(cityid==7 || cityid=='035') return "新竹";
	else if(cityid==8 || cityid=='037') return "苗栗";
	else if(cityid==9 || cityid=='042') return "台中";
	else if(cityid==10 || cityid=='047') return "彰化";
	else if(cityid==11 || cityid=='049') return "南投";
	else if(cityid==12 || cityid=='055') return "雲林";
	else if(cityid==13 || cityid=='052') return "嘉義";
	else if(cityid==14 || cityid=='062') return "台南";
	else if(cityid==15 || cityid=='072') return "高雄";
	else if(cityid==16 || cityid=='087') return "屏東";
	else if(cityid==17 || cityid=='069') return "澎湖";
	else if(cityid==18 || cityid=='082') return "金門";
	else return "全國";
}


function slideLeftRight(ul, delay, speed, lh) {
	var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
	var delay = delay||100;
	var speed=speed||5;
	var lh = lh||5;
	var tid = null;
	var pause = false;
	var start = function() {
		tid=setInterval(slide, speed);
	}
	var slide = function() {
		if (pause) return;
		slideBox.scrollLeft += 1;
		if (slideBox.scrollLeft  % lh == 0) {
			clearInterval(tid);
			slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
			slideBox.scrollLeft  = 0;
			setTimeout(start, delay);
		}
	}
	slideBox.onmouseover=function(){pause=true;}
	slideBox.onmouseout=function(){pause=false;}
	setTimeout(start, delay);
}

function slideLine(ul, delay, speed, lh) {
	var slideBox = (typeof ul == 'string')?document.getElementById(ul):ul;
	var delay = delay||1000;
	var speed=speed||20;
	var lh = lh||20;
	var tid = null;
	var 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 (notinputstr(HP05.value,"\'",'主題') == false){
			HP05.focus();
			return false;
		}
		if (isEmpty(HP07.value,'姓名') == false){
			HP07.focus();
			return false;
		}		
		if (notinputstr(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;
		}

		var url = "/house/pressmsgservice.php";
		var para = "?RA="+RA.value+"&objtype="+objType.value+"&objNumber="+objNumber.value+"&HP02="+HP02.value+"&HP03="+HP03.value+"&HP04="+HP04.value+"&HP05="+escape(HP05.value)+"&HP06="+escape(HP06.value)+"&HP07="+escape(HP07.value)+"&HP08="+HP08.value+"&HP09="+HP09.value+"&HP10="+HP10.value+"&mail="+mail.value+"&HRA="+HRA.value;
		// alert(url+para);
		runfile(url,para);
		if(cookie.isEnabled()) {
			cookie.set('senderservice',HP06.value+"+++"+HP07.value+"+++"+HP08.value+"+++"+HP09.value+"+++"+HP10.value,getCookieTime(9000));
		}

	} // 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,'朋友Email 至少要輸入一個!') == false){
			P4.focus();
			return false;
		}
//alert('ok');

		var url = "/house/pressmsgFriend.php";
		var para = "?A1="+A1.value+"&A2="+A2.value+"&A3="+A3.value+"&A4="+A4.value+"&P1="+escape(P1.value)+"&P2="+escape(P2.value)+"&P3="+escape(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;
		}
		
		var url = "/house/pressqa.php";
		var para = "?QA="+QA.value+"&mail="+mail.value+"&objType="+objType.value+"&objName="+escape(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="+escape(KB17.value)+"&HQA="+HQA.value;
		// alert(url+para);
		runfile(url,para);
	} // with
	return false;
}  // function


function readMember(){
	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) {
	$('#quickinfodiv').show('fast');		
	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>';
		if(obj3!="") 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>';
	}
	$('#quickinfodivdata').html(str);
}

function hideQuickInfo() {
	$('#quickinfodiv').hide();
}

function clearslist(a1,a2,a3,a4) {
	var temp = a1+a2+a3+a4;
	aa = Array();
	j = 0;
	
	for(i=0;i<slist.length;i++) {
		if(slist[i]!= null ) {
			a = slist[i].split('--');
			if(temp!=a[0]+a[1]+a[2]+a[3]) {
				aa[j++]= slist[i];
			}
		}
	}
	slist = aa;
	reShowList('tracebox',20);
	
	
	aa = Array();
	j = 0;
	for(i=0;i<slove.length;i++) {
		if(slove[i]!=null) {
			a = slove[i].split('--');
			if(temp!=a[0]+a[1]+a[2]+a[3]) {
				aa[j++]= slove[i];
			}
		}
	}
	slove = aa;
	reShowMyLove('tracebox',20);
	
	return true;
}

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';
	$('#'+id).css('top',top);
	$('#'+id).css('left',left);
}

function clearInnerHTML(id) {
	$('#'+id).html('');
}

function setHeight(id,height) {
	if($('#'+id)!=null) $('#'+id).css('height',height+'px');
}
	
	
function choiceOver(obj,id) {
	obj.style.backgroundColor='#DDDDDD';
	$('#'+id).attr('src','/images/left/'+id+'over.gif');
}

function choiceOut(obj,id) {
	obj.style.backgroundColor='#FFFFFF';
	$('#'+id).attr('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');
	show1.html("<iframe src="+src+" id='showVideo' name='showVideo' width='"+width+"' height='"+height+"' marginheight='0' marginheight='0' frameborder='0' scrolling='no'></iframe>");
	
	if(show1.css('display') == 'none') {
		$('#show2').hide();
		$('#show1').show('fast');
	}
}

function changeImage(src,width,height) {
	if(width==null) width=600;
	if(height==null) height=450;
	
	$('#show2').html("<img id=showimg src=\""+src+"\">"); // width='"+width+"'  height='"+height+"' 
	
	var showVideo = $('#showVideo');
	if(showVideo!=null) showVideo.src = '';
	
	if($('#show2').css('display') == 'none') {
		$('#show1').hide('normal');
		$('#show2').show('normal');
	}
}



function doChoiceA(id){
	choiceAvalue = '';
	if(id<0) {
		for(i=0;i<choiceAQty;i++) {
			$('#ChoiceA'+i).attr('checked',false);
		}
		$('#ChoiceA').attr('checked',true);
	} else {
		$('#ChoiceA').attr('checked',false);
		qty = 0;
		for(i=0;i<choiceAQty;i++) {
			temp = $('#ChoiceA'+i);
			if(temp.attr('checked')) {
				qty++;
				choiceAvalue = choiceAvalue +"*"+ temp.val()+"*,";
			}
		}
		if(qty == choiceAQty || qty == 0) {
			$('#ChoiceA').attr('checked',true);
			doChoiceA(-1);
		} else choiceAvalue = choiceAvalue.substring(0,choiceAvalue.length-1);
	}
	
	$('#choiceAvalue').attr('value',choiceAvalue);
}

function doTaipei(a,b){
	
	$('#area').show('normal');
	$('#showall').show('normal');
	doChoiceA(-1);
	if(tf) {
		for(x=a;x<=b;x++){
			$('#ChoiceA'+x).attr('checked',true);
			doChoiceA(x);
		}
		$('#ChoiceA').attr('checked',false);
	}
}


function doB0(id){
	B0Qty = 18 ;
	if(id<0) {
		for(i=0;i<=B0Qty;i++) {
			if(i<10) $('#B0'+i).attr('checked',false);
			else $('#B'+i).attr('checked',false);
		}
		$('#B0').attr('checked',true);
	} else {
		$('#B0').attr('checked',false);
		
		qty = 0;
		for(i=0;i<=B0Qty;i++) {
			
			if(i<10) temp = $('#B0'+i);
			else temp = $('#B'+i);
			if(temp.attr('checked')) {
				qty++;
			}
		}
		//alert(qty);
		if(qty == B0Qty || qty == 0) { 
			doB0(-1);
		} 
	}	
}

function doH0(id){
	H0Qty = 7;
	if(id<0) {
		for(i=0;i<H0Qty;i++) {
			$('#H0'+i).attr('checked',false);
		}
		$('#H0').attr('checked',true);
	} else {
		$('#H0').attr('checked',false);
		qty = 0;
		for(i=0;i<H0Qty;i++) {
			temp = $('#H0'+i);
			if(temp.attr('checked')) {
				qty++;
			}
		}
		if(qty == H0Qty  || qty == 0) { 
			$('#H0').attr('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/del.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.html(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/del.gif' title='刪除本筆追蹤清單物件資料!' width=14 height=13>";
			str1 += "</div>";
		}
	}
	var list1 = $('#'+id);
	if(list1!=null)	list1.html(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>";
	}
	
	if($('#'+id)!=null)	$('#'+id).html(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').html(timeValue+timeValue2); 
		}
		if($('#smallclock')!=null) {
			$('#smallclock').html(timeValue2); 
		}
		setTimeout("showTime()",1000); 
	} 
	
//	alert(document.body.scrollTop);
}

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,vtype,vdataType) {
	if(vtype==null) vtype='GET';
	if(vdataType==null) vdataType = 'html';
	
	$.ajax({
		url:pn+para,
		type:vtype,
		dataType:vdataType,
		timeout:5000,
		error:function () {
			$('#'+Container).html("loading 動作失敗!");
		},
		success: function (ret) {
			$('#'+Container).html(ret);
		}
	});
}

function runfile(pn,para) {
	$.ajax({
		url:pn+para,
		type:'POST',
		dataType:'html',
		timeout:5000,
		error:function () {
			alert("runfile 動作失敗!");
		},
		success: function (ret) {
			$('#debug').html(ret);
		}
	});
	
		
}

function changeTab(id,tablist,imgsrc) { 
	for(i=0;i< tablist.length;i++) {
		$('#'+tablist[i]).css('background',imgsrc[1]);
	}
	$('#'+tablist[id]).css('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);
}

function saveCooike(id,value) {
	if(cookie.isEnabled()) {
		cookie.set(id,value,getCookieTime(9000));
	}
}
