function doSubmit() {
	var	key = document.seaForm.oq.value;

	if(key.length == 0){
		alert('請勿輸入空白');
//		return false;
	} else if(key=='請輸入關鍵字'){
		alert('請輸入關鍵字');
//		return false;
	} else if(key=='關鍵字查詢'){
		alert('請輸入關鍵字');
//		return false;
	} else {
	var val = encodeURIComponent(key);
	document.seaForm.q.value = process(val); 
	document.seaForm.action ="http://sea.ttv.com.tw/search/doSearch.jsp";
	document.seaForm.submit();
	}
}


  function process(str){
   str=str.replace(/\:+/g,"\":\"");
   str=str.replace(/\*+/g,"\"*\"");

   return str.replace(/^\s+|\s+$/g,"");
  }


 function encode_utf8(s) {
           return encodeURIComponent(s);
       }

function execSearch(keyword)
{
    var val=process(encodeURIComponent(keyword));
    var url='http://sea.ttv.com.tw/search/doSearch.jsp?oq=&q=' + val + '&qt=dismax&en=utf-8';
    //var url='http://sea.ttv.com.tw/search/doSearch.jsp?oq=&q=' + val + '&qt=dismax&en=big5';
    window.open(url,'_blank');
}

function coreSearch(keyword,coreId)
{
    var val=process(encodeURIComponent(keyword));
    var url='http://sea.ttv.com.tw/search/doSearch.jsp?oq=&q=' + val + '&qt=dismax&en=utf-8' + "&coreId=" + coreId;
    //var url='http://sea.ttv.com.tw/search/doSearch.jsp?oq=&q=' + val + '&qt=dismax&en=big5';
    window.open(url,'_blank');
}

function googleSearch(qval) {
    qval = qval.replace(/^[\s　]+/g, ""); //從前面去除
    qval = qval.replace(/[\s　]+$/g, ""); //從後面去除
    if (qval != "") {
        location.href = "http://www.ttv.com.tw/group/search/SearchElement.asp?q=" + encodeURIComponent(qval);
    }
}

function googleSearch2(qval, type) {
    googleSearch(qval);
}
