// JavaScript Document
function showObjDataVideo(src,a,b) {
	var show1=$('show1');
	show1.innerHTML = "<iframe src="+src+" id='showVideo' name='showVideo' width='"+a+"' height='"+b+"' marginheight='0' marginheight='0' frameborder='0' scrolling='no'></iframe>";
	if(show1.style.display == 'none') {
		show1.style.display = 'block';
	}
}

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){
	doChoiceA(-1);
	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);
		} 
	}
}

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 ) {
		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; 
		}
		setTimeout("showTime()",1000); 
	} 	
}

function setPosition(id,top,left) {
	top = top + 'px';
	left = left + 'px';
	Element.setStyle(id,{'top':top});
	Element.setStyle(id,{'left':left});
}

function setMouseXY(evt) {
	if (document.all)	{
		x = event.clientX;
		y = event.clientY+document.body.scrollTop;
//		y = event.clientY+document.documentElement.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) {
//	if (document.all) return;
	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>';
		if(obj5!="")  str += '樓高:<span class=f5>'+obj5+'</span><br>';
		if(obj6!="")  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>';
	} else if(objtype=='HF') {
		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>';
		if(obj5!="")  str += '座落:<span class=f5>'+obj5+'</span><br>';
		if(obj6!="")  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>';
	} else {
		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>';
		if(obj5!="")  str += '社區:<span class=f5>'+obj5+'</span><br>';
		if(obj6!="")  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() {
	Element.hide('quickinfodiv');
}

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 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 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+"\"  width='"+width+"'>"; // height='"+height+"'
//	img.src = src;
}


function showObjDataVideo(src,a,b) {
	var showVideo = $('showVideo');
	var show1=$('show1');
	show1.innerHTML = "<iframe src="+src+" id='showVideo' name='showVideo' width='"+a+"' height='"+b+"' 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';
	}
}