
document.write('<script type="text/javascript" src="/script/openWindow.js"></script>');




$(function(){
		   	
	$("#searchForm").bind("submit", function() {
									  
		return false;
		
	})
	
	$("#searchForm").submit(function() {
		
		showSearchResult();
		
	});
	

	
	$("#searchBtn").click(function() {
		
		showSearchResult();
		
	});
	
	
	
	//同じページか調べる
/*	
	document.referrer.match(/\?page/);
	var str1 = RegExp.leftContext;

	document.URL.match(/\?page/);
	var str2 = RegExp.leftContext;
	
	if(document.URL.indexOf("page=") != -1 && document.URL.indexOf("large") == -1 && str1 == str2) {
		var timerID = setTimeout(scrollToShopItems, 500);
	}
*/	


});


function showSearchResult(){
	
	var directory;
	
	if (document.URL.indexOf("/large/") != -1) {
		directory = "/large/";
	}
	else {
		directory = "/items/";
	}
	
	//%2Fで404問題解決
	var keyword = encodeURIComponent($("#searchKeyword").val());
//	keyword = keyword.replace('%2F', '%252F');
	//正規表現で全置換
	keyword = keyword.replace(/%2F/g, '%252F');
	
	var _url = directory + keyword + '/';
	location.href = _url;
	
}



function scrollToShopItems() {

	$("html,body").animate({ scrollTop: $("#summary").offset().top }, "fast");		


}








