function goPage( pageNum ) {
	var title = window.document.getElementById( "strTitle" ).value;
	if( title != undefined && title != "" ) {
		window.document.forms[ "frmNewsList" ].prmTitle.value = title;
	}
	window.document.forms[ "frmNewsList" ].method.value = "getNewsList";
	window.document.forms[ "frmNewsList" ].prmPagingNum.value = pageNum;
	window.document.forms[ "frmNewsList" ].submit();
}

function xssReplace(a){
	var limit_char = /[~!\#$^&%*\=+|:;?"<,.>']/;
	var tmp_str="";
	for(var i=0; i<a.length; i++) {
		var data1=a.charAt(i);
		tmp_str+=data1.replace(limit_char,"");
	}
	return tmp_str;
}

$( function() {
	$( "#btnSearch" ).click( function () {
		window.document.forms[ "frmNewsList" ].method.value = "getNewsList";
		window.document.forms[ "frmNewsList" ].prmTitle.value = xssReplace(window.document.getElementById( "txtSearch" ).value);
		window.document.forms[ "frmNewsList" ].submit();
		
	}).css( "cursor", "pointer" );	
	
	$( "#txtSearch" ).keydown( function() {
		if( window.event.keyCode == 13 ) {
			window.document.forms[ "frmNewsList" ].method.value = "getNewsList";
			window.document.forms[ "frmNewsList" ].prmTitle.value = xssReplace(window.document.getElementById( "txtSearch" ).value);
			window.document.forms[ "frmNewsList" ].submit();
		}
	});
});
