function que() {	
	if (document.y.flg.value=="add"){
		if (checkempty(document.y.item.value)==false) {
			document.y.item.focus();
			alert("請填上答案!");
			return false;
		}
		var tno = document.y.tno.value;
		var t = document.y.item.value;
		open("vote/que_add.asp?item="+t+"&tno="+tno,"que_add","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=1,width=550,height=500,titlebar=0,channelmode=0,fullscreen=0,left=0,top=0");		
	} else if (document.y.flg.value=="output"){		
		var t = document.y.tno.value;
		open("vote/queans.asp?tno="+t,"queans","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=1,width=550,height=500,titlebar=0,channelmode=0,fullscreen=0,left=0,top=0");
		return false;
	} else if (document.y.flg.value=="input"){
		if (checkempty(document.y.name.value)==false) {
			//document.y.name.focus();
			//alert("請輸姓名!");
			//return false;
		}
		if (!(checkempty(document.y.email.value))){
			//document.y.email.focus();
			//alert ("請輸入Email!");
			//return false;		
		} else {
			var address = document.y.email.value;
			crucial1 = address.indexOf ("@");
			crucial2 = address.indexOf (".");
			if (crucial1 == -1 || crucial2 == -1) { 
				document.y.email.focus();
				alert("你所輸入的Email格式錯誤!!");
				return false;
			}	
		}
		if (checkempty(document.y.zip.value)==false) {
			//document.y.zip.focus();
			//alert("請輸入聯絡電話區域號碼!");
			//return false;
		} else {
			if (isNaN(document.y.zip.value)){
				document.y.zip.focus();
				alert ("聯絡電話區域號碼請輸入數字!");
				return false;				
			}			
		}
		if (checkempty(document.y.tel.value)==false) {
			//document.y.tel.focus();
			//alert("請輸入聯絡電話!");
			//return false;
		} else {
			if (isNaN(document.y.tel.value)){
				document.y.tel.focus();
				alert ("聯絡電話請輸入數字!");
				return false;				
			}			
		}
		if (checkempty(document.y.area.value)==false) {
			//document.y.area.focus();
			//alert("請輸入聯絡地址郵遞區號!");
			//return false;
		} else {
			if (isNaN(document.y.area.value)){
				document.y.zip.focus();
				alert ("聯絡地址區域號碼請輸入數字!");
				return false;				
			}			
		}
		if (checkempty(document.y.addr.value)==false) {
			//document.y.addr.focus();
			//alert("請輸入聯絡地址!");
			//return false;
		}		
	}
	return true;
}
function checkempty(txt){
	if (txt.length==0) {
	   return false;
	}
	var i=0;
	while (i<txt.length) {
	   if (txt.substring(i,i+1) != ' ') {
	      return true;
	   }
	   i=i+1;
	}
	return false;
}
document.write; 
