// 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 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 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';
	}
}