/**
 * @history 2010/11/22 V1.0新規作成
 * @author yang wenxuan
 * @version V1.0
 */
var isIE = (navigator.appName == "Microsoft Internet Explorer");
var hasFocus = false;

$(document).ready(function(e){
//	var focusFlg = "0";
//	$("#txtKeywordInput").keydown(function(e){
//		    if (e.which == 13)
//		    {
//		    	alert("focus");
//		    	$("#doSearch").click();
//		    }
//		});
    //alert();
//	  $("#txtKeywordInput").focus(function(){
//		  focusFlg = "1";
//	  });
//	  $("#txtKeywordInput").blur(function(){
//		  focusFlg = "0";
//	  });
	var element = document.getElementById("txtKeywordInput");
	if (null != element)
	{
		if (isIE) {
			element.onfocusout = function() { hasFocus = false;}
			element.onfocusin = function() { hasFocus = true;}
	    }
		else
		{
			element.onblur = function()   { hasFocus = false;}
			element.onfocus  = function() { hasFocus = true;}
		}
	}
});

$(document).keydown(function(e) {
    if (e.which == 13 && hasFocus)
    {
    	$("#doSearch").click();
    	return false;
    }
});
