function goPage( pageNum ) {
	window.document.forms[ "frmBookList" ].method.value = "getBookList";
	window.document.forms[ "frmBookList" ].prmPagingNum.value = pageNum;
	window.document.forms[ "frmBookList" ].submit();
}

function viewContent( seq ) {
	window.document.forms[ "frmBookList" ].method.value = "getBookInfo";
	window.document.forms[ "frmBookList" ].prmSeq.value = seq;
	window.document.forms[ "frmBookList" ].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[ "frmBookList" ].method.value = "getBookList";
		window.document.forms[ "frmBookList" ].prmKeyword.value = xssReplace(window.document.getElementById( "txtSearch" ).value);
		window.document.forms[ "frmBookList" ].prmSearchKind.value = window.document.getElementById( "selSearch" ).value;
		window.document.forms[ "frmBookList" ].submit();
		
	}).css( "cursor", "pointer" );	
	
	$( "#txtSearch" ).keydown( function() {
		if( window.event.keyCode == 13 ) {
			window.document.forms[ "frmBookList" ].method.value = "getBookList";
			window.document.forms[ "frmBookList" ].prmKeyword.value = xssReplace(window.document.getElementById( "txtSearch" ).value);
			window.document.forms[ "frmBookList" ].prmSearchKind.value = window.document.getElementById( "selSearch" ).value;
			window.document.forms[ "frmBookList" ].submit();
		}
	});
	
	$( "#btnLaw" ).click( function () {
		window.location.href = "info0401.do";		
	});	
	
	$( "#btnBook" ).click( function () {
		window.location.href = "info0402.do";		
	});	
	
});
