jQuery("#txtKeyw").focus(function(){if(this.value=='Nhập từ cần tìm'){this.value=''}});jQuery("#txtKeyw").blur(function(){if(this.value==''){this.value='Nhập từ cần tìm'}});jQuery("#txtKeyw").keydown(function(event){if(event.keyCode==13){var kw=(this.value)?encodeURIComponent(this.value):'';searchContent(kw)}});jQuery("#btnSearch").click(function(event){var kw=(jQuery("#txtKeyw").attr("value"))?encodeURIComponent(jQuery("#txtKeyw").attr("value")):'';if(kw=='')return;searchContent(kw)});function searchContent(kw){jQuery.getJSON(SITE_PATH+"/ajax.php?mod=f_content&act=addKeywordSearch&keyw="+kw,function(json){if(!json.intReturn||json.intReturn<0){alert('System Error')}else{location.href=SITE_PATH+'/'+LANGUAGE+'/Search/All/'+json.keyw}})}jQuery("#btnLogin").click(function(event){var u=jQuery("#username").attr("value");var p=jQuery("#password").attr("value");if(u==''||p==''){alert("Bạn hãy nhập tên đăng nhập và mật khẩu.");return}login(u,p)});jQuery("#btnLogout").click(function(event){logout()});function login(u,p){jQuery.getJSON(SITE_PATH+"/ajax.php?mod=member&act=login&u="+u+"&p="+p,function(json){if(!json.intReturn||json.intReturn<0){alert(json.msg);}else{location.href=location.href}})}function logout(){jQuery.getJSON(SITE_PATH+"/ajax.php?mod=member&act=logout",function(json){if(!json.intReturn||json.intReturn<0){alert('System Error')}else{location.href=location.href}})}
