function openWin(htmlFile,sizeX,sizeY){
	var newWindow =  window.open(htmlFile,'file','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,width='+sizeX+',height='+sizeY);
}
function CloseWin(){
 window.close();
}

// 住所検索(お客様)
function Zip2Add(){
	var url;
	var zip = document.SHOP.zip.value;
	if( zip.length != 7 ){
		alert("郵便番号はハイフンなしの7桁で入力してください");
		return;
	}
	url = "cgi-bin/op_shop.cgi?mode=zip2add&zip=" + zip;
	window.open(url,"住所検索中","width=300","height=100");
}

// 住所検索(お届け先)
function Zip2Add_del(){
	var url;
	var del_zip = document.SHOP.del_zip.value;
	if( del_zip.length != 7 ){
		alert("郵便番号はハイフンなしの7桁で入力してください");
		return;
	}
	url = "cgi-bin/op_shop.cgi?mode=zip2add_del&del_zip=" + del_zip;
	window.open(url,"住所検索中","width=300","height=100");
}

// Cookie一括保存
function set_cookie_all(){
	set_data = document.SHOP.name_kanji.value    + "<>" +
	           document.SHOP.name_furigana.value + "<>" +
                   document.SHOP.zip.value           + "<>" +
                   document.SHOP.address_a.value     + "<>" +
                   document.SHOP.address_b.value     + "<>" +
                   document.SHOP.address_c.value     + "<>" +
                   document.SHOP.tel.value           + "<>" +
                   document.SHOP.email.value         + "<>" ;

	set_cookie("CK_SHOP"       ,escape(set_data));
}

// Cookie一括取得
function get_cookie_all(){
	get_data = unescape(get_cookie("CK_SHOP")).split("<>");

	if( get_data.length != 1 ){
		document.SHOP.name_kanji.value    = get_data[0];
		document.SHOP.name_furigana.value = get_data[1];
		document.SHOP.zip.value           = get_data[2];
		document.SHOP.address_a.value     = get_data[3];
		document.SHOP.address_b.value     = get_data[4];
		document.SHOP.address_c.value     = get_data[5];
		document.SHOP.tel.value           = get_data[6];
		document.SHOP.email.value         = get_data[7];
	}
}

// Cookie取得
function get_cookie(cn) {
	var get_data;
	var cv;
	var gd;
	var i;
	var a;
	get_data = document.cookie;
	cv = new Array();
	gd = get_data.split(";");
	for (i in gd) {
		a = gd[i].split("=");
		a[0] = a[0].replace(" ","");
		cv[a[0]] = a[1];
	}
	if (cv[cn]) return cv[cn];
	else return "";
}

// Cookie保存
function set_cookie(cn,val) {
	var days;
	var ex;
	var y;
	var hms;
	var p;
	days = 365;
	ex = new Date();
	ex = new Date(ex.getTime() + (1000 * 60 * 60 * 24 * days));
	y = ex.getYear(); if (y < 1900) y += 1900;
	hms = ex.getHours() + ":" + ex.getMinutes() + ":" + ex.getSeconds();
	p = String(ex).split(" ");
	ex = p[0] + ", " + p[2] + "-" + p[1] + "-" + y + " " + hms + " GMT;";
	document.cookie = cn + "=" + val +"; expires=" + ex;
}

