// JavaScript Document
function Trim(s) {
  // Remove leading spaces and carriage returns
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
  {
    s = s.substring(1,s.length);
  }
  // Remove trailing spaces and carriage returns
  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  {
    s = s.substring(0,s.length-1);
  }
  return s;
};
function right(obj, msg) {
obj.style.display = '';
obj.innerHTML = ''+ msg;
obj.className = "warning";
}
function warning(obj, msg) {
obj.style.display = '';
obj.innerHTML = '<img src="images/icon_attention.gif" alt="注意" align="absmiddle" /> '+ msg;
obj.className = "warning";
}
function checksearch() {
	document.getElementById('checkerror').style.visibility = 'hidden';
	
	var f = document.form_search;
	var cp = eval(document.getElementById('checkverifysearch')); //disply div object

	if (f.txtSearch.value=='') {
		warning(cp, "請填寫姓氏");
		return false;
	}

	right(cp, "");
}
function checkdata_search()
{
	ErrMsg="";
	if (Trim(document.form_search.txtSearch.value)=="") {
	alert("請輸入搜尋文字");
	document.form_search.txtSearch.focus();
	document.form_search.txtSearch.select();
	return;
	}
	else
	{
	document.form_search.submit();
	};
	
		
		

}
function checkdata_upload()
{
	ErrMsg="";
	error = "no";
	if (Trim(document.form_upload.txtDescription.value)=="") {
	alert("請輸入文字");
	document.form_upload.txtDescription.focus();
	document.form_upload.txtDescription.select();
	error = "yes";
	return;
	}
	if (Trim(document.form_upload.thumbpic.value)=="") {
	alert("請選擇照片");
	document.form_upload.thumbpic.focus();
	document.form_upload.thumbpic.select();
	error = "yes";
	return;
	}
	if (error == "no")
	{
	document.form_upload.submit();
	};
}

function checkdata_uploadconfirm()
{
	/*
	ErrMsg="";
	error = "no";
	if (Trim(document.form_upload.txtDescription.value)=="") {
	alert("請輸入文字");
	document.form_upload.txtDescription.focus();
	document.form_upload.txtDescription.select();
	error = "yes";
	return;
	}
	if (Trim(document.form_upload.thumbpic.value)=="") {
	alert("請選擇照片");
	document.form_upload.thumbpic.focus();
	document.form_upload.thumbpic.select();
	error = "yes";
	return;
	}
	if (error == "no")
	{
	document.form_upload.submit();
	};
	*/
	document.form_upload.action="to_vote_upload_confirm.php"
	document.form_upload.submit();
		
		

}


function checkdata_pending()
{
	/*
	ErrMsg="";
	error = "no";
	if (Trim(document.form_upload.txtDescription.value)=="") {
	alert("請輸入文字");
	document.form_upload.txtDescription.focus();
	document.form_upload.txtDescription.select();
	error = "yes";
	return;
	}
	if (Trim(document.form_upload.thumbpic.value)=="") {
	alert("請選擇照片");
	document.form_upload.thumbpic.focus();
	document.form_upload.thumbpic.select();
	error = "yes";
	return;
	}
	if (error == "no")
	{
	document.form_upload.submit();
	};
	*/
	document.form_upload.action="vote_upload.php"
	document.form_upload.submit();
		
		

}


function checkdata_comment()
{
	ErrMsg="";
	error = "no";
	if (Trim(document.form_comment.txtComment.value)=="") {
	alert("請輸入留言");
	document.form_comment.txtComment.focus();
	document.form_comment.txtComment.select();
	error = "yes";
	return;
	}	
	if (error == "no")
	{
	document.form_comment.submit();
	};
	
		
		

}
function checkdata_vote()
{
	/*
	ErrMsg="";
	if (Trim(document.form_search.txtSearch.value)=="") {
	alert("請輸入搜尋文字");
	document.form_search.txtSearch.focus();
	document.form_search.txtSearch.select();
	return;
	}
	else
	{
		*/
	document.form_vote.submit();
	//};
	
		
		

}