function setSearchVehavior(){
	document.getElementById("search").onsubmit = function(){
		var keyword = trim(document.getElementById("keyword").value);
		if(! keyword){
			alert("検索文字列が未入力です。");
			document.getElementById("keyword").focus();
			return false;
		}
	}
}
function setGetIntoCart(){
	for(var i = 0; (obj = document.getElementsByTagName("a")[i]); i ++){
		if(obj.getAttribute("class") == "get-into-cart" || obj.getAttribute("className") == "get-into-cart"){
			obj.onclick = function(){
				var code = this.getAttribute("title");
				var cookies = document.cookie + ";";
				var from = cookies.indexOf("jicoCart=");
				if(from == -1){
					document.cookie = "jicoCart=" + code + "*1; path=/; expires=Tue, 1-Jan-2030 00:00:00;";
				}else{
					var to = cookies.indexOf(";", from + 1);
					var currentCart = cookies.substring(from + 9, to);
					if(currentCart){
						if(currentCart.indexOf(code + "*") == -1){
							document.cookie = "jicoCart=" + currentCart + "," + code + "*1; path=/; expires=Tue, 1-Jan-2030 00:00:00;";
						}
					}else{
						document.cookie = "jicoCart=" + code + "*1; path=/; expires=Tue, 1-Jan-2030 00:00:00;";
					}
				}
			}
		}
	}
}
function setNewWin(){
	for(var i = 0; (obj = document.getElementsByTagName("a")[i]); i ++){
		if(obj.getAttribute("class") == "new-win" || obj.getAttribute("className") == "new-win"){
			obj.target = "_blank";
		}
	}
}
function trim(str){
	return str.replace(/^[\s　]+|[\s　]+$/g,"");
}