﻿var tsearch=false;
function Checksearch(txtsearch){
 var search=trim(document.getElementById(txtsearch).value);  
	if (search==""||search=="Search"){
	alert("Please Enter Search");
	document.getElementById(txtsearch).focus();     
	return false;
	}
		
	 window.location.href='search.aspx?search='+encodeURI(search);
}

function testNu2m(){
if ( !(window.event.keyCode>=48 && window.event.keyCode<=57 ))
      window.event.keyCode = 0;
}

function trim(instr){
  return instr.replace(/^[\s]*/gi,"").replace(/[\s]*$/gi,"");
}

function beginsearch() {
   //var cid=document.getElementById("ddlC").value;
   var y1 = document.getElementById("ddlyear1").value;
   var m1 = document.getElementById("ddlmonth1").value;
   //var y2 = document.getElementById("ddlyear2").value;
   //var m2 = document.getElementById("ddlmonth2").value;
	
  window.location.href='news.aspx?y1='+encodeURI(y1)+'&m1='+encodeURI(m1);
	
}

function products_beginsearch() {
   var search=document.getElementById("Products_search1_txtsearch").value;  
if (search==""){
alert("請輸入關鍵字");
return false;
}
  window.location.href='products_list.aspx?search='+encodeURI(search);
	
}

function beginsearch_media() {
   var y1 = document.getElementById("ddlyear").value;
   var m1 = document.getElementById("ddlmonth").value;
	
  window.location.href='media.aspx?y1='+encodeURI(y1)+'&m1='+encodeURI(m1);
	
}