function addBookmark(title, url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url, "");
	} else if (document.all) {
		window.external.AddFavorite(url, title);
	} else if (window.opera && window.print) {
		return true;
	}
}

function changeImage(filename, width, height) {
	var img = $("main_pic");
	var src = "http://" + location.hostname + "/updir/suite/" + filename;
	if (img.src != src) {
		img.src = src;
		img.style.width = width + "px";
		img.style.height = height + "px";
	}
}

function changeImageDs(url, code, number) {
	var img = $("main_pic");
	var src = url + code + "/" + number + "/l.jpg";
	if (img.src != src) {
		img.src = src;
	}
}

function decQty(id) {
	var qty = $("qty_" + id);
	if (!isNaN(qty.value)) {
		if (qty.value > 0) {
			qty.value--;
		}
	} else {
		qty.value = 0;
	}
	drawBackground(id);
}

function doSearch() {
	var keyword = $("keyword");
	if (!keyword) return;
	location.href = "http://" + location.hostname + "/search/listname/KW/" + encodeURI(keyword.value);
}

function doSearchDs(action) {
	var keyword = $("keyword");
	if (!keyword) return;
	$("view_page").value = 1;
	location.href = "http://" + location.hostname + "/ds/" + action + "/w/" + encodeURI(keyword.value);
}

function doSearchByMap(pref) {
	$("pref").options[pref].selected = true;
	document.forms[0].submit();
}

function drawBackground(id) {
	var qty = $("qty_" + id);
	if (isNaN(qty.value) || qty.value < 1) {
		qty.style.cssText = "";
	} else {
		qty.style.cssText = "background-color: #FFFACD";
	}
}

function incQty(id) {
	var qty = $("qty_" + id);
	if (!isNaN(qty.value)) {
		qty.value++;
	} else {
		qty.value = 0;
	}
	drawBackground(id);
}

function getAddressJSONP() {
	var z1 = $("zipcode1").value;
	var z2 = $("zipcode2").value;
	if (z1 == "" || z2 == "") {
		alert("郵便番号が入力されていません。");
	} else {
		//var url = location.protocol + "//" + location.hostname + "/zipcode/search/ZC/" + z1 + z2;
		var url = location.protocol + "//www.shift-net.co.jp/zipcode/search/ZC/" + z1 + z2;
		var sc = document.createElement("script");
		sc.setAttribute("type", "text/javascript");
		sc.setAttribute("src", url);
		document.getElementsByTagName("body").item(0).appendChild(sc);
	}
}

function setAddressJSONP(data) {
	if (!data.pref) {
		alert("見つかりません。");
	} else {
		$("pref").selectedIndex = data.pref;
		$("city").value = data.city + data.town;
	}
}

function showGuideDialog(id) {
	var w;
	w = window.open("http://" + location.hostname + "/guide/index/id/" + id,
			"guide",
			"width=800,height=720");
	if (w && !w.closed) {
		w.focus();
	}
}

function swapImage(obj, filename) {
	obj.src = "http://" + location.hostname + "/image/" + filename;
}