var wcommon = {
	D_MAX_POINT_COUNT: 	100,
	D_MAX_ROUTE_COUNT: 	10,
	D_STEP_INIT: 		0,
	D_STEP_START:		1,
	D_STEP_VIA:			2,
	D_STEP_GOAL:		3,
	D_STEP_JOUKEN:		4,
	D_STEP_NAME:		5,
	D_STEP_CALC:		6,
	D_MAX_SISETU_CNT:	50,
	D_DETAIL_SCALE:		12,
	D_MIDDLE_SCALE:		9,
	D_WIDE_SCALE:		7,
	D_ICON_WIDTH:		16,
	D_ICON_HEIGHT:		16,
	D_MAX_PRINT_MAP:	3,
	D_ICON_FONT_COLOR: 	0,
	D_ICON_BGCOLOR:		214,
	D_ICON_START:		"start_icon.bmp",
	D_ICON_GOAL:		"goal_icon.bmp",
	D_ICON_VIA:			"via_icon.bmp",
	D_ICON_CROSS:		"cross.bmp",
	D_ICON_WARIKYO:		"warikyo.bmp",
	D_ICON_WARIKYO1:	"warikyo1_pc.bmp",
	D_ICON_WARIKYO2:	"warikyo2_pc.bmp",
	D_ICON_WARIKYO3:	"warikyo3_pc.bmp",
	D_ICON_WARIKYO4:	"warikyo4_pc.bmp",
	D_ICON_WARIKYO5:	"warikyo5_pc.bmp",
	D_ICON_KANKOU:		"kankou.bmp",
	D_ICON_SIBU:		"sibu.bmp",
	D_ICON_GS:			"gs.bmp",
	D_ICON_PARKING:		"parking.bmp",
	D_ICON_CROSS_VMAP:	"cross.jpg",
	D_ICON_ACC_VMAP:	"accident.jpg",
	D_ICON_PARKING_VMAP:"parking.gif",
	D_ICON_GS_VMAP:		"gsstand.gif",
	D_ICON_WARIKYO_VMAP:"warikyo.gif",
	D_ICON_WARIKYO1_VMAP:"warikyo1.gif",
	D_ICON_WARIKYO2_VMAP:"warikyo2.gif",
	D_ICON_WARIKYO3_VMAP:"warikyo3.gif",
	D_ICON_WARIKYO4_VMAP:"warikyo4.gif",
	D_ICON_WARIKYO5_VMAP:"warikyo5.gif",
	D_ICON_MOVIE_VMAP:	"icon_camera.gif",
	D_ICON_DATA_LIMIT:	100,
	D_ICON_DISP_RECT:	0.5,
	mapurl:				"../map/mapimg.php",
	allmapurl:			"../map/allmap.php",
	mappointurl:		"../map/getMapPoint.php",
	mapimgdir:			"../map/images/",
	surl: 				"sis_info.php",
	sdurl: 				"facility.php",
	murl: 				"movie.php",
	iurl: 				"./php/get_icondata.php",
	wicon:				new Array(),
	micon:				new Array(),
	z_index:			1001,
	escapeHtmlEx: function(str, noesp) {		//#11	#20
		var regExp = new RegExp("◆start◆(\n|.)*?◆end◆", "g");
		var aryMatch = str.match(regExp);
		if(!aryMatch) aryMatch = new Array();
		var strEsp = str;
		var i;
		var strFrom;
		var strTo;
		for(i = 0; i < aryMatch.length; i++) {
			strFrom = aryMatch[i];
			strTo = "◆start◆" + String(i + 1) + "◆end◆";
			strEsp = strEsp.replace(strFrom, strTo);
		}
		
		if(!noesp) strEsp = strEsp.escapeHTML();
		
		for(i = 0; i < aryMatch.length; i++) {
			strFrom = "◆start◆" + String(i + 1) + "◆end◆";
			strTo = aryMatch[i];
			strTo = strTo.replace(/^◆start◆/g, "");
			strTo = strTo.replace(/◆end◆$/g, "");
			strEsp = strEsp.replace(strFrom, strTo);
		}
		
		return strEsp;
	},
	fillCombobox: function(selectId, aryOption, selectedIndex) {
		if(selectId == "" || typeof aryOption != 'object' || aryOption.length <= 0) return;
		var select = $(selectId);
		var option;
		this.clearCombobox(selectId);
		for(var idx = 0; idx < aryOption.length; idx++) {
			option = document.createElement("option");
			option.value = (aryOption[idx].id) ? aryOption[idx].id : idx;
			if(idx == selectedIndex) option.selected = true;
			option.appendChild(document.createTextNode(aryOption[idx].name));
			select.appendChild(option);
		}
		select.selectedIndex = selectedIndex;
	},
	
	clearCombobox: function(selectId) {
		var select = $(selectId);
		var cnt = select.options.length;
		for(var idx = cnt - 1; idx >= 0; idx--) {
			select.removeChild(select.options[idx]);
		}
	},
	createCombobox: function(parentId, selectId, aryOption, selectedIndex, className) {
		if(parentId == "" || selectId == "" || typeof aryOption != 'object' || aryOption.length <= 0) return;
		this.root = $(parentId);
		this.select = document.createElement("select");
		this.select.id = selectId;
		if(className != "") {
			this.select.className = className;
		}
		this.root.appendChild(this.select);
		this.fillCombobox(selectId, aryOption, selectedIndex);
	},
	showRequestError: function(request) {
		$("msg").innerHTML = "サーバからデータ取得中にエラーが発生しました。";	//#08
	},
	closeWindow: function() {
		
	},
	simpleSprintf: function(format, num) {
		var number = parseInt(num, 10);
		var prefix = format.substr(0, 1);
		var len = parseInt(format.substr(1), 10);
		var suffix = number.toString();
		var suflen = suffix.length;
		var prelen = len - suflen;
		var rtn = "";
		for(var i = 0; i < prelen; i++) {
			rtn += prefix;
		}
		rtn += suffix;
		return rtn;
	},
	getCookie: function(key,  tmp1, tmp2, xx1, xx2, xx3) {
		tmp1 = " " + document.cookie + ";";
		xx1 = xx2 = 0;
		len = tmp1.length;
		while (xx1 < len) {
			xx2 = tmp1.indexOf(";", xx1);
			tmp2 = tmp1.substring(xx1 + 1, xx2);
			xx3 = tmp2.indexOf("=");
			if (tmp2.substring(0, xx3) == key) {
				return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
			}
			xx1 = xx2 + 1;
		}
		return("");
	},
	setCookie: function(key, val,exdays) {
		var d = new Date();
		d.setDate(d.getDate() + exdays);
		var s = key + "=" + escape(val);
		s += (exdays == undefined) ? "" : ";expires=" + d.toGMTString();
		document.cookie = s;
	},
	clearCookie: function(key) {
		document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
	},
	initCourseData: function() {
		var data = {
			course_id:			"",
			user_type:			"",
			user_id:			"",
			course_name:		"",
			course_type:		"",
			input_phase:		0,
			start_point_save:	"0",
			date_time:			"",
			yosoku_type:		"1",
			rte_type:			"1",
			ferry:				"0",
			via_ju1_cd:			"",
			via_region_id:		"",
			map_scale:			0,
			map_lon:			"",
			map_lat:			"",
			icon_cnt:			0,
			route_cnt:			0,
			total_kyori:		0,
			total_time:			0,
			ryokin:				"",
			print_map1:			"0",
			print_map_name1:	"",
			print_map_scale1:	0,
			print_map_lon1:		"",
			print_map_lat1:		"",
			print_map2:			"0",
			print_map_name2:	"",
			print_map_scale2:	0,
			print_map_lon2:		"",
			print_map_lat2:		"",
			print_map3:			"0",
			print_map_name3:	"",
			print_map_scale3:	0,
			print_map_lon3:		"",
			print_map_lat3:		"",
			photo_id1:			0,
			photo_id2:			0,
			photo_title_1:		"",
			photo_title_2:		"",
			guide:				"",
			benefits:			"",
			theme_id:			"",
			reference:			"",
			road_service:		"",
			biko:				"",
			show_crossing:		"",
			show_accident:		"",
			recalc:				""
		};	//#14,#16,#17 2009/08/05
		return data;
	},
	initRouteData: function(routeIdx) {
		var data = {
			route_index:	routeIdx,
			rt_suffix:		"",
			route_id:		0,
			course_id:		"",
			route_name:		"",
			route_order:	0,
			date_time:		"",
			yosoku_type:	"1",
			rte_type:		"1",
			ferry:			"0",
			via_point_cnt:	0,
			total_point_cnt:0,
			kyori:			0,
			time:			0,
			ryokin:			"",
			finish_flg:		"0",
			del_flg:		"0",
			recalc:			"",
			course_point: 	new Array(),
			hwygid:			new Array(),
			accident:		new Array(),
			rain:			new Array(),
			jutai:			new Array()
		};
		return data;
	},
	initPointData: function(routeIdx, pointIdx) {
		var data = {
			route_index:		routeIdx,
			point_index:		pointIdx,
			pt_suffix:			"",
			course_point_id:	0,
			course_id:			"",
			route_id:			0,
			jaf_sss:			"",
			sss_genre_cd:		"",
			point_type:			"",
			point_name:			"",
			order_in_course:	0,
			order_in_route:		0,
			via_point_order:	"",
			mark:				"0",
			stay_time:			0,
			syukuhaku:			"0",
			genre_cd:			"",
			subgenre_cd:		"",
			ju1_cd:				"",
			ju2_name:			"",
			address:			"",
			sisetu_id:			"",
			lon:				"",
			lat:				"",
			road_type:			"",
			road_name:			"",
			kyori:				0,
			time:				0,
			via_total_order:	"",
			jutai:				"0",
			hwygid:				"0",
			show_icon:			"1",
			info_winx:			"",
			info_winy:			"",
			del_flg:			"0"
		};	//#02,#14
		return data;
	},
	initAccidentData: function(routeIdx, accidentIdx) {	//#14
		var data = {
			route_index:		routeIdx,
			accident_index:		accidentIdx,
			accident_id:		0,
			course_id:			"",
			route_id:			0,
			lon:				"",
			lat:				"",
			road:				"",
			name:				"",
			show_icon:			"1",
			info_winx:			"",
			info_winy:			"",
			del_flg:			"0"
		};
		return data;
	},
	initSisetuData: function() {
		var data = {
			sisetu_id:		"",
			sisetu_name:	"",
			sisetu_kana:	"",
			genre_cd:		"",
			subgenre_cd:	"",
			yutai_flg:		"",
			image1_id:		"",
			image1_cap:		"",
			comment:		"",
			postcode:		"",
			address:		"",
			tel:			"",
			url:			"",
			open_time:		"",
			close_days:		"",
			parking:		"",
			time_required:	"",
			barrier_free:	"",
			attest_type:	"",
			attest_sonota:	"",
			disc_taisho:	"",
			disc_contents1:	"",
			disc_hani1:		"",
			discount1:		"",
			disc_kbn1:		"",
			disc_contents2:	"",
			disc_hani2:		"",
			discount2:		"",
			disc_kbn2:		"",
			disc_contents3:	"",
			disc_hani3:		"",
			discount3:		"",
			disc_kbn3:		"",
			disc_contents4:	"",
			disc_hani4:		"",
			discount4:		"",
			disc_kbn4:		"",
			disc_contents5:	"",
			disc_hani5:		"",
			discount5:		"",
			disc_kbn5:		"",
			disc_sonota:	"",
			lat:			"",
			lon:			"",
			sisetu_type:		"",
			img_src:		"",
			img_width:		"",
			img_height:		""
		};	//#13
		return data;
	},
	initIconData: function(cid, idx) {
		var data = {
			index:		idx,
			icon_id:	String(idx + 1),
			course_id:	cid,
			icon_type:	"01",
			comment:	"",
			flag_on:	"1",
			lon:		"",
			lat:		"",
			winx: 		"",
			winy: 		"",
			info_winx: 	"",
			info_winy: 	""
		};	//#06
		return data;
	},
	addDays: function(dt, days) {
		var y = parseInt(dt.substr(0, 4), 10);		//#03
		var m = parseInt(dt.substr(4, 2), 10) - 1;	//#03
		var d = parseInt(dt.substr(6, 2), 10);		//#03
		var hms = dt.substr(8);
		d += days;
		var date = new Date(y, m, d, 0, 0, 0);
		var newDate = wcommon.simpleSprintf("04", date.getFullYear());
		newDate += wcommon.simpleSprintf("02", date.getMonth() + 1);
		newDate += wcommon.simpleSprintf("02", date.getDate());
		newDate += hms;
		return newDate;
	},
	copyHash: function(i) {
		var o={};
		for(var k in i) {
			o[k] = i[k];
		}
		return o;
	},
	formatTime: function(min, mode) {
		
		var ret 	= "";
		var hour 	= 0;
		
		if(min > 60) {
			hour = Math.floor(min / 60);
			min  = Math.floor(min - (hour * 60 ));
		}
		switch(mode){
			case 1:	//ex) 5時間23分
				if(hour > 0){
					ret = hour + "時間" + min + "分";
				}else{
					ret = min + "分";
				}
				break;
			case 2:	//ex) 5:23
				ret = hour + ":" + this.simpleSprintf("02", min);
				break;
		}
		return ret;
	},
	formatKyori: function(m, tani) {
		var ret = Math.floor(m / 100 + 0.5) / 10;
		if(tani) ret += tani;
		return ret;
	},
	formatNittei: function(n) {
		if(n == 1) 	return "日帰り";
		var ret = "";
		if(n > 1) {
			m = n - 1;
			ret = m.toString() + "泊";
			ret += n.toString() + "日";
		}
		return ret;
	},
	formatDate: function(d, y) {
		var ret = d.substr(0, 4) + "年";
		ret += d.substr(4, 2) + "月";
		ret += d.substr(6, 2) + "日";
		ret += "　" + this.simpleSprintf("02", d.substr(8, 2));
		ret += ":" + this.simpleSprintf("02", d.substr(10, 2));
		if(y == "1") ret += "　出発"
		if(y == "2") ret += "　到着"
		return ret;
	},
	formatRteType: function(r, f) {
		var ret = "";
		if(r == "1") ret = "時間優先";
		if(r == "2") ret = "一般道優先";
		if(f == "1") ret += "　フェリー使用";
		return ret;
	},
	selectItem: function(elm, value) {
		var cnt = elm.options.length;
		elm.selectedIndex = -1;
		for(var idx = 0; idx < cnt; idx++) {
			if(elm.options[idx].value == value) {
				elm.selectedIndex = idx;
				break;
			}
		}
		if(elm.selectedIndex == -1) elm.selectedIndex = 0;
	},
	initMap: function(container, imgOnly){
		
		VMDefine.MAPPROC 	= wcommon.mapurl;
		VMDefine.POINTPROC 	= wcommon.mappointurl;	//#15
		VMDefine.ImgDir		= wcommon.mapimgdir;	//#15
		var vmap;//#06 = new VMap(container);
		if(imgOnly) {
			vmap = new VMap(container, true);	//#06
			vmap.disableDragging();
			vmap.hideCrossMark();		//#06
			vmap.disableDoubleClickCenter();
		}
		if(imgOnly == undefined || !imgOnly) {
			vmap = new VMap(container, false);	//#06
			var zoomCntrl 	= new VMZoomControl();
			var dircCntrl 	= new VMDirectionControl();
			vmap.addControl(dircCntrl);
			vmap.addControl(zoomCntrl);
		}
		
		return vmap;
	},
	getImage: function(image_id) {
		return "";
	},
	getMapUrl: function(param) {
		var url = wcommon.mapurl + "?";
		url += "USER=" + param.USER;
		url += "&CENTER_LAT=" + param.CENTER_LAT;
		url += "&CENTER_LON=" + param.CENTER_LON;
		url += "&SCALE=" + param.SCALE;
		url += "&SX=" + param.SX;
		url += "&SY=" + param.SY;
		url += "&ROUTE=" + param.ROUTE;
		url += "&MARK=" + param.MARK;
		url += "&MARKPATH=" + param.MARKPATH;
		url += "&FMT=1";
		url += "&JAM_E=0000&JAM_C=0000&JAM_G=0000&JAM_O=0000&JAM_FS_E=0000&JAM_FS_C=0000&JAM_FS_G=0000&JAM_FS_O=0000";
		url += "&ACCIDENT=0000&CIRCLE=&POLYLINE=&POLYGON=&MARKFILE=&FIGFILE=&ATE=&OFF_X=&OFF_Y=";
		return url;
	},
	initIcon: function(idx, type) {	//#06
		var data = {
			index:		idx,
			icon_type:	type,
			comment:	"",
			flag_on:	"1",
			winx: 		"",
			winy: 		"",
			info_winx: 	"",
			info_winy: 	""
		};
		return data;
	},
	showIcon: function(vmap, iconData, image, padding){	//#06
		if(!iconData.lat || !iconData.lon) return null;
		var size 			= new VMSize(this.D_ICON_WIDTH, this.D_ICON_HEIGHT);
		var iconAnchor 		= new VMPoint(size.height / 2, size.width / 2);
		var icon, pos;
		var html, com;
		VMEvent.enableAddIcon();
		pos = new VMLatLng(iconData.lat, iconData.lon);
		icon = new VMIcon(pos, size, iconAnchor, image);
		vmap.addIcon(icon);
		var winxy = icon.getPoint();
		var x = Math.round(winxy.x);
		var y = Math.round(winxy.y);
		var x1 = 0;
		var y1 = 0;
		var x2 = Math.round(vmap.oOutSize.width);
		var y2 = Math.round(vmap.oOutSize.height);
		if(x < x1 || y < y1 || x > x2 || y > y2) {
			iconData.flag_on = "0";
		}
		
		if(iconData.comment != "") {	//#09
			com = iconData.comment.escapeHTML();
			com = com.replace(/\n/g, "<br />");
	
			if(padding) {
				html = "<div style=\"border: 1px solid gray; padding: 3px; background-color: #ccccff;\">";
				html += "<div style=\"white-space: nowrap; font-size: 8pt; background-color: #ffffcc; padding: 3px;\">";
			} else {
				html = "<div style=\"border: 1px solid gray;\">";
				html += "<div style=\"white-space: nowrap; font-size: 8pt; background-color: #ffffcc;\">";
			}
			html += com;
			html += "</div>";
			html += "</div>";
	
			icon.flag_on = "1";
			icon.openInfoWindow(vmap, html);
			if(iconData.flag_on != "1") {
				icon.flag_on = "0";
				icon.closeInfoWindow();
			}
		}	//#09
		VMEvent.disableAddIcon();
		if(iconData.icon_type == "01") {
			VMEvent.addEventListener(icon, 	"click", this.iconClick.bindAsEventListener(this, icon));
		} else if(iconData.icon_type == "CROSS" || iconData.icon_type == "ACCIDENT") {					//#14
			VMEvent.addEventListener(icon, 	"click", this.hideIcon.bindAsEventListener(this, icon));	//#14
		}
		return icon;
	},
	showIconEx: function(vmap, iconData, aid, clk, dtl, via){	//#22
		iconData.flag_on = "0";
		var icon = this.createIconEx(vmap, iconData, aid, clk, dtl, via);
		if(icon == null) return icon;
		switch(iconData.icon_type) {
			case "WARIKYO1":
			case "WARIKYO2":
			case "WARIKYO3":
			case "WARIKYO4":
			case "WARIKYO5":
			case "MOVIE":
				if(clk == undefined || clk == true) {
					VMEvent.addEventListener(icon, 	"click", this.iconClickEx.bindAsEventListener(this, iconData, aid, dtl, via));
				}
				VMEvent.addEventListener(icon, 	"mouseover", this.flag_on_ex.bindAsEventListener(this, icon));
				VMEvent.addEventListener(icon, 	"mouseout", this.flag_off.bindAsEventListener(this, icon));
				break;
			default:
		}
		return icon;
	},
	createIconEx: function(vmap, iconData, aid, clk, dtl, via) {	//#22
		if(!iconData.lat || !iconData.lon) return null;
		var size 			= new VMSize(this.D_ICON_WIDTH, this.D_ICON_HEIGHT);
		var iconAnchor 		= new VMPoint(size.height / 2, size.width / 2);
		var icon, pos;
		var html, com, image, title;
		if(iconData.icon_type == "WARIKYO1") image = this.D_ICON_WARIKYO1_VMAP;
		if(iconData.icon_type == "WARIKYO2") image = this.D_ICON_WARIKYO2_VMAP;
		if(iconData.icon_type == "WARIKYO3") image = this.D_ICON_WARIKYO3_VMAP;
		if(iconData.icon_type == "WARIKYO4") image = this.D_ICON_WARIKYO4_VMAP;
		if(iconData.icon_type == "WARIKYO5") image = this.D_ICON_WARIKYO5_VMAP;
		if(iconData.icon_type == "KANKOU") image = this.D_ICON_KANKOU_VMAP;
		if(iconData.icon_type == "MOVIE") image = this.D_ICON_MOVIE_VMAP;
		VMEvent.enableAddIcon();
		pos = new VMLatLng(iconData.lat, iconData.lon);
		icon = new VMIcon(pos, size, iconAnchor, image);
		vmap.addIcon(icon);
		if(iconData.comment != "") {
			com = iconData.comment.escapeHTML();
			com = com.replace(/\n/g, "<br />");
			html = "<div style=\"border: 1px solid gray; padding: 1px; background-color: #ccccff; z-index:2000;\">";
			html += "<div style=\"width:120px; font-size: 8pt; background-color: #ffffdd; padding: 3px;\">";
			if(iconData.title != undefined && iconData.title != "") {
				title = iconData.title.escapeHTML();
				html += "<b>" + title + "</b><br />";
			}
			html += com;
			html += "</div>";
			html += "</div>";
			icon.flag_on = "1";
			icon.openInfoWindow(vmap, html);
			if(iconData.flag_on != "1") {
				icon.flag_on = "0";
				icon.closeInfoWindow();
			}
		}
		VMEvent.disableAddIcon();
		return icon;
	},
	iconClickEx: function(e, iconData, aid, dtl, via) {	//#22
		switch(iconData.icon_type) {
			case "WARIKYO1":
			case "WARIKYO2":
			case "WARIKYO3":
			case "WARIKYO4":
			case "WARIKYO5":
			case "KANKOU":
				var url = this.surl;
				if(dtl != undefined && dtl == true) url = this.sdurl;
				url += "?AID=" + aid + "&sisetu_id=" + iconData.id;
				if(via != undefined) url += "&via_flg=" + via;
				var option = "width=960, height=800, menubar=no, toolbar=no, scrollbars=yes";
				dpss.common.MM_openBrWindow(url, "_blank", option);
				break;
			case "MOVIE":
				var url = this.murl + "?AID=" + aid + "&file_no=" + iconData.id;
				var option = "width=450, height=560, menubar=no, toolbar=no, scrollbars=yes";
				dpss.common.MM_openBrWindow(url, "_blank", option);
				break;
			default:
		}
	},
	hideIcon: function(e, icon) {		//#14
		icon.hide();
	},
	flag_on_ex: function(e, icon) {	//#22
		icon.elemIcon.style.zIndex = this.z_index++; 	//#22
		icon.openInfoWindow(icon.map);
		icon.flag_on = "1";
	},
	flag_on: function(e, icon) {	//#06
		icon.openInfoWindow(icon.map);
		icon.flag_on = "1";
	},
	flag_off: function(e, icon) {	//#06
		icon.closeInfoWindow();
		icon.flag_on = "0";
	},
	iconClick: function(e, icon) {	//#06
		if(icon.flag_on == "1") {
			this.flag_off(e, icon);
		} else {
			this.flag_on(e, icon);
		}
	},
	showAllMap: function(map, doc) {
		if(!doc.route[0]) return;
		var src = this.allmapurl + "?AID=" + doc.AID;
		src += "&course_id=" + doc.course.course_id;
		var now = new Date();
		src += "&n=" + String(now.getTime());
		map.src = src;
		return;
	},
	initFormData: function() {	//#07
		if($("func")) $("func").value = "";
		if($("course_id")) $("course_id").value = "";
		if($("back_func")) $("back_func").value = "";
		if($("back_ap")) $("back_ap").value = "";
		if($("back_region_id")) $("back_region_id").value = "";
		if($("back_ju1_cd")) $("back_ju1_cd").value = "";
		if($("back_sibu_id")) $("back_sibu_id").value = "";
		if($("back_current_page")) $("back_current_page").value = "";
		if($("back_stays")) $("back_stays").value = "";
		if($("back_kyori")) $("back_kyori").value = "";
		if($("back_theme_id")) $("back_theme_id").value = "";	//2009/08/05
		if($("back_course_name")) $("back_course_name").value = "";
		if($("back_course_id")) $("back_course_id").value = "";
		if($("back_key_word")) $("back_key_word").value = "";
		if($("back_model_course")) $("back_model_course").value = "";
		if($("back_self_course")) $("back_self_course").value = "";
		if($("back_sort")) $("back_sort").value = "";
		if($("back_kaiin_open")) $("back_kaiin_open").value = "";//
		if($("back_genre_cd")) $("back_genre_cd").value = "";//#19
		if($("back_subgenre_cd")) $("back_subgenre_cd").value = "";//#19
		if($("back_ju2_name")) $("back_ju2_name").value = "";//#19
		if($("back_warikyo_id")) $("back_warikyo_id").value = "";//#19
		if($("user_id")) $("user_id").value = "";	//#24
	},
	calcDateTime: function(date_time, total_time, yosoku_type){	//#12
		
		var year = date_time.substr(0, 4);
		var mon = date_time.substr(4, 2);
		var day = date_time.substr(6, 2);
		var hour = date_time.substr(8, 2);
		var min = date_time.substr(10, 2);
		
		var dt = new Date(year, parseInt(mon, 10) - 1, parseInt(day, 10), parseInt(hour, 10), parseInt(min, 10), 0);	//#23
		var tm = dt.getTime();
		if(yosoku_type == "1") tm = tm + total_time * 60 * 1000;
		if(yosoku_type == "2") tm = tm - total_time * 60 * 1000;
		dt.setTime(tm);
		year = dt.getFullYear();
		mon = wcommon.simpleSprintf("02", dt.getMonth() + 1);
		day = wcommon.simpleSprintf("02", dt.getDate());
		hour = wcommon.simpleSprintf("02", dt.getHours());
		min = wcommon.simpleSprintf("02", dt.getMinutes());
		
		var new_date_time = year + mon + day + hour + min;
		if(yosoku_type == "1") {
			var start_goal = new Array(date_time, new_date_time);
		}
		if(yosoku_type == "2") {
			var start_goal = new Array(new_date_time, date_time);
		}
		
		return start_goal;
		
	},
	
	clearWarikyoIcon: function() {	//#22
		for(var i = 0; i < this.wicon.length; i++) {
			if(this.wicon[i].map) {
				this.wicon[i].map.removeIcon(this.wicon[i]);
			}
		}
		this.wicon = new Array();
	},
	clearMovieIcon: function() {	//#22
		for(var i = 0; i < this.micon.length; i++) {
			if(this.micon[i].map) {
				this.micon[i].map.removeIcon(this.micon[i]);
			}
		}
		this.micon = new Array();
	},
	getSrchRectLT: function(vmap) {	//#22
		var oCenter = vmap.getCenter();
		var lat_sec = oCenter.lat_sec;
		var lng_sec = oCenter.lng_sec;
		lat_sec = lat_sec + (vmap.lat_per_pix * (vmap.oOutSize.height * this.D_ICON_DISP_RECT));
		lng_sec = lng_sec - (vmap.lng_per_pix * (vmap.oOutSize.width * this.D_ICON_DISP_RECT));
		return new VMLatLng(lat_sec,lng_sec);
	},
	getWarikyoIconData: function(aid, vmap, genre, pg, ap, via) {	//#22
		if(!aid) return;
		if(typeof(vmap)  != "object") return;
		if(typeof(genre) != "object") return;
		if(genre.length < 5) return;
		if(pg == undefined) pg = 0;
		if(pg == 0) this.clearWarikyoIcon();
		var flg = false;
		var zoom = vmap.getZoom();
		if(zoom < 9) genre[0] = "0";	//300～50
		if(zoom < 9) genre[1] = "0";	//300～50
		if(zoom < 11) genre[2] = "0";	//100～50
		if(zoom < 9) genre[3] = "0";	//300～50
		if(zoom < 11) genre[4] = "0";	//100～50
		if(genre[0] == "1") flg = true;
		if(genre[1] == "1") flg = true;
		if(genre[2] == "1") flg = true;
		if(genre[3] == "1") flg = true;
		if(genre[4] == "1") flg = true;
		if(!flg) return;
		var latlng = vmap.getCenter();
		var latlngLT = this.getSrchRectLT(vmap);
		var y = latlngLT.lat_sec - Math.abs((latlng.lat_sec - latlngLT.lat_sec) * 2);
		var x = latlngLT.lng_sec + Math.abs((latlng.lng_sec - latlngLT.lng_sec) * 2);
		var latlngRB = new VMLatLng(y, x);
		var req = {};
		req.AID = aid;
		req.func = "warikyo";
		req.genre1 = genre[0];
		req.genre2 = genre[1];
		req.genre3 = genre[2];
		req.genre4 = genre[3];
		req.genre5 = genre[4];
		req.lat = latlng.lat_sec;
		req.lon = latlng.lng_sec;
		req.lat1 = latlngLT.lat_sec;
		req.lon1 = latlngLT.lng_sec;
		req.lat2 = latlngRB.lat_sec;
		req.lon2 = latlngRB.lng_sec;
		req.region_id = "";
		req.ju1_cd = "";
		req.ju2_name = "";
		req.limit = this.D_ICON_DATA_LIMIT;
		req.offset = pg * this.D_ICON_DATA_LIMIT + 1;
		var xotree = new XML.ObjTree();
		var reqDoc = {dpss: {request: req}};
		var param = xotree.writeXML(reqDoc);
		dpss.common.ajaxPostData(this.iurl, param, this.showWarikyoIcon.bindAsEventListener(this, aid, vmap, genre, pg, ap, via, this.holdWarikyoSrchLatlon), wcommon.showRequestError, null);
		
	},
	showWarikyoIcon: function(e, aid, vmap, genre, pg, ap, via) {	//#22
		var xotree = new XML.ObjTree();
		var dt = xotree.parseXML(e.responseText);
		if(dt.dpss == undefined || dt.dpss.status != "0") {
			wcommon.showRequestError();
			return;
		}
		var dtl = false;
		if(dt.dpss.auth == "1" && ap != undefined && ap == "w_search") dtl = true;
		var warikyo = new Array();
		if(dt.dpss.wcnt == 1) {
			warikyo[0] = dt.dpss.warikyo;
		} else if(dt.dpss.wcnt > 1) {
			warikyo = dt.dpss.warikyo;
		}
		var icon;
		var tp;
		var icon_data;
		for(var i = 0; i < warikyo.length; i++) {
			tp = "";
			if(warikyo[i].genre_cd == "1") tp = "WARIKYO1";
			if(warikyo[i].genre_cd == "2") tp = "WARIKYO2";
			if(warikyo[i].genre_cd == "3") tp = "WARIKYO3";
			if(warikyo[i].genre_cd == "4") tp = "WARIKYO4";
			if(warikyo[i].genre_cd == "5") tp = "WARIKYO5";
			if(tp == "") continue;
			var icon_data = wcommon.initIcon(i, tp);
			icon_data.id = warikyo[i].sisetu_id;
			icon_data.lat = warikyo[i].lat;
			icon_data.lon = warikyo[i].lon;
			icon_data.comment = warikyo[i].sisetu_name;
			icon = this.showIconEx(vmap, icon_data, aid, true, dtl, via);
			this.wicon.push(icon);
		}
		if(pg == 0) {
			var pgs = Math.ceil(dt.dpss.sum / this.D_ICON_DATA_LIMIT);
			for(var i = 1; i < pgs; i++) {
				this.getWarikyoIconData(aid, vmap, genre, i, ap, via);
			}
		}
	},
	getMovieIconData: function(aid, vmap, pg, ap) {	//#22
		if(!aid) return;
		if(typeof(vmap)  != "object") return;
		if(pg == undefined) pg = 0;
		if(pg == 0) this.clearMovieIcon();
		var zoom = vmap.getZoom();
		if(zoom < 9) return;	//300～50
		var latlng = vmap.getCenter();
		var latlngLT = this.getSrchRectLT(vmap);
		var y = latlngLT.lat_sec - Math.abs((latlng.lat_sec - latlngLT.lat_sec) * 2);
		var x = latlngLT.lng_sec + Math.abs((latlng.lng_sec - latlngLT.lng_sec) * 2);
		var latlngRB = new VMLatLng(y, x);
		var req = {};
		req.AID = aid;
		req.func = "movie";
		req.lat = latlng.lat_sec;
		req.lon = latlng.lng_sec;
		req.lat1 = latlngLT.lat_sec;
		req.lon1 = latlngLT.lng_sec;
		req.lat2 = latlngRB.lat_sec;
		req.lon2 = latlngRB.lng_sec;
		req.region_id = "";
		req.ju1_cd = "";
		req.ju2_name = "";
		req.limit = this.D_ICON_DATA_LIMIT;
		req.offset = pg * this.D_ICON_DATA_LIMIT + 1;
		var xotree = new XML.ObjTree();
		var reqDoc = {dpss: {request: req}};
		var param = xotree.writeXML(reqDoc);
		dpss.common.ajaxPostData(this.iurl, param, this.showMovieIcon.bindAsEventListener(this, aid, vmap, pg, ap, this.holdMovieSrchLatlon), wcommon.showRequestError, null);
		return true;
	},
	showMovieIcon: function(e, aid, vmap, pg, ap) {	//#22
		var xotree = new XML.ObjTree();
		var dt = xotree.parseXML(e.responseText);
		if(dt.dpss == undefined || dt.dpss.status != "0") {
			wcommon.showRequestError();
			return;
		}
		var clk = true;
		if(dt.dpss.auth != "1" && ap != undefined && ap == "w_search") clk = false;
		var movie = new Array();
		if(dt.dpss == undefined || dt.dpss.mcnt == 1) {
			movie[0] = dt.dpss.movie;
		} else if(dt.dpss.mcnt > 1) {
			movie = dt.dpss.movie;
		}
		var icon, icon_data; 
		for(var i = 0; i < movie.length; i++) {
			icon_data = wcommon.initIcon(i, "MOVIE");
			icon_data.id = movie[i].file_no;
			icon_data.lat = movie[i].lat;
			icon_data.lon = movie[i].lon;
			icon_data.title = movie[i].sisetu_name;
			icon_data.comment = movie[i].description;
			icon = this.showIconEx(vmap, icon_data, aid, clk);
			this.micon.push(icon);
		}
		if(pg == 0) {
			var pgs = Math.ceil(dt.dpss.sum / this.D_ICON_DATA_LIMIT);
			for(var i = 1; i < pgs; i++) {
				this.getMovieIconData(aid, vmap, i, ap);
			}
		}
	}
};

wcommon.SisetuInfo = Class.create();
wcommon.SisetuInfo.prototype = {
	initialize: function(container, sisetuData, no, aid) {
		this.container 			= container;
		this.sisetuData 		= sisetuData;
		this.no 				= wcommon.simpleSprintf("02", no);
		this.aid				= aid;
		this.scale 				= wcommon.D_MIDDLE_SCALE;
		var sisetu_proto 		= $("sisetu_proto");
		var sisetu_title_proto 		= $("sisetu_title_proto");
		var sisetu_no_proto 	= $("sisetu_no_proto");
		var sisetu_name_proto 	= $("sisetu_name_proto");
		var sisetu_kana_proto 	= $("sisetu_kana_proto");
		var chk_print_proto 	= $("chk_print_proto");
		var image_proto 		= $("image_proto");
		var image_cap_proto 	= $("image_cap_proto");
		var comment_proto 		= $("comment_proto");
		var yutai_mark_proto	= $("yutai_mark_proto");
		var address_proto 		= $("address_proto");
		var tel_proto 			= $("tel_proto");
		var url_proto 			= $("url_proto");
		var open_time_proto 	= $("open_time_proto");
		var close_days_proto 	= $("close_days_proto");
		var parking_proto 		= $("parking_proto");
		var time_required_proto = $("time_required_proto");
		var barrier_free_proto 	= $("barrier_free_proto");
		var sisetu_ul_proto 	= $("sisetu_ul_proto");		//#13
		var sisetu_map_w_proto 	= $("sisetu_map_w_proto");
		var sisetu_map_m_proto 	= $("sisetu_map_m_proto");
		var sisetu_map_d_proto 	= $("sisetu_map_d_proto");
		var scale_wide_proto 	= $("scale_wide_proto");
		var scale_middle_proto 	= $("scale_middle_proto");
		var scale_detail_proto 	= $("scale_detail_proto");
		sisetu_proto.id 		= "sisetu" + this.no;
		sisetu_title_proto.id 		= "sisetu_title" + this.no;
		sisetu_no_proto.id 		= "sisetu_no" + this.no;
		sisetu_name_proto.id 	= "sisetu_name" + this.no;
		sisetu_kana_proto.id 	= "sisetu_kana" + this.no;
		chk_print_proto.id 		= "chk_print" + this.no;
		image_cap_proto.id		= "image_cap" + this.no;
		image_proto.id 			= "image" + this.no;
		comment_proto.id 		= "comment" + this.no;
		yutai_mark_proto.id 	= "yutai_mark" + this.no;
		address_proto.id 		= "address" + this.no;
		tel_proto.id 			= "tel" + this.no;
		url_proto.id 			= "url" + this.no;
		open_time_proto.id 		= "open_time" + this.no;
		close_days_proto.id 	= "close_days" + this.no;
		parking_proto.id 		= "parking" + this.no;
		time_required_proto.id 	= "time_required" + this.no;
		barrier_free_proto.id 	= "barrier_free" + this.no;
		sisetu_ul_proto.id 		= "sisetu_ul" + this.no;		//#13
		sisetu_map_w_proto.id 	= "sisetu_w_map" + this.no;
		sisetu_map_m_proto.id 	= "sisetu_m_map" + this.no;
		sisetu_map_d_proto.id 	= "sisetu_d_map" + this.no;
		scale_wide_proto.id 	= "scale_wide" + this.no;
		scale_middle_proto.id 	= "scale_middle" + this.no;
		scale_detail_proto.id 	= "scale_detail" + this.no;

		this.sisetu = sisetu_proto.cloneNode(true);
		sisetu_proto.id 		= "sisetu_proto";
		sisetu_title_proto.id 	= "sisetu_title_proto";
		sisetu_no_proto.id 		= "sisetu_no_proto";
		sisetu_name_proto.id 	= "sisetu_name_proto";
		sisetu_kana_proto.id 	= "sisetu_kana_proto";
		chk_print_proto.id 		= "chk_print_proto";
		image_cap_proto.id		= "image_cap_proto";
		image_proto.id 			= "image_proto";
		comment_proto.id 		= "comment_proto";
		yutai_mark_proto.id 	= "yutai_mark_proto";
		address_proto.id 		= "address_proto";
		tel_proto.id 			= "tel_proto";
		url_proto.id 			= "url_proto";
		open_time_proto.id 		= "open_time_proto";
		close_days_proto.id 	= "close_days_proto";
		parking_proto.id 		= "parking_proto";
		time_required_proto.id 	= "time_required_proto";
		barrier_free_proto.id 	= "barrier_free_proto";
		sisetu_ul_proto.id 		= "sisetu_ul_proto";		//#13
		sisetu_map_w_proto.id 	= "sisetu_map_w_proto";
		sisetu_map_m_proto.id 	= "sisetu_map_m_proto";
		sisetu_map_d_proto.id 	= "sisetu_map_d_proto";
		scale_wide_proto.id 	= "scale_wide_proto";
		scale_middle_proto.id 	= "scale_middle_proto";
		scale_detail_proto.id 	= "scale_detail_proto";

		this.container.appendChild(this.sisetu);
		this.sisetu_title	= $("sisetu_title" + this.no);
		this.sisetu_no 		= $("sisetu_no" + this.no);
		this.sisetu_name 	= $("sisetu_name" + this.no);
		this.sisetu_kana 	= $("sisetu_kana" + this.no);
		this.chk_print 		= $("chk_print" + this.no);
		this.image_cap		= $("image_cap" + this.no);
		this.image 			= $("image" + this.no);
		this.comment 		= $("comment" + this.no);
		this.yutai_mark 	= $("yutai_mark" + this.no);
		this.address 		= $("address" + this.no);
		this.tel 			= $("tel" + this.no);
		this.url 			= $("url" + this.no);
		this.open_time 		= $("open_time" + this.no);
		this.close_days 	= $("close_days" + this.no);
		this.parking 		= $("parking" + this.no);
		this.time_required 	= $("time_required" + this.no);
		this.barrier_free 	= $("barrier_free" + this.no);
		this.sisetu_ul 		= $("sisetu_ul" + this.no);		//#13
		this.sisetu_w_map 	= $("sisetu_w_map" + this.no);
		this.sisetu_m_map 	= $("sisetu_m_map" + this.no);
		this.sisetu_d_map 	= $("sisetu_d_map" + this.no);
		//var map_container 	= $("sisetu_map" + this.no);
		//this.sisetu_map 	= this.initMap(map_container);
		this.scale_wide 	= $("scale_wide" + this.no);
		this.scale_middle 	= $("scale_middle" + this.no);
		this.scale_detail 	= $("scale_detail" + this.no);
		this.show();
		Event.observe(this.url, "click", this.openUrl.bindAsEventListener(this), false);
		Event.observe(this.scale_wide, "click", this.scaleWide.bindAsEventListener(this), false);
		Event.observe(this.scale_middle, "click", this.scaleMiddle.bindAsEventListener(this), false);
		Event.observe(this.scale_detail, "click", this.scaleDetail.bindAsEventListener(this), false);
		Element.show(this.sisetu);
	},
	scaleWide: function() {
		this.scale = wcommon.D_WIDE_SCALE;
		Element.show(this.sisetu_w_map);
		Element.hide(this.sisetu_m_map);
		Element.hide(this.sisetu_d_map);
	},
	scaleMiddle: function() {
		this.scale = wcommon.D_MIDDLE_SCALE;
		Element.show(this.sisetu_m_map);
		Element.hide(this.sisetu_w_map);
		Element.hide(this.sisetu_d_map);
	},
	scaleDetail: function() {
		this.scale = wcommon.D_DETAIL_SCALE;
		Element.show(this.sisetu_d_map);
		Element.hide(this.sisetu_w_map);
		Element.hide(this.sisetu_m_map);
	},
	show: function() {
		this.sisetu_no.innerHTML	= this.no;
		this.sisetu_name.innerHTML 	= this.sisetuData.sisetu_name;
		this.sisetu_kana.innerHTML 	= this.sisetuData.sisetu_kana;
		this.chk_print.checked 		= false;
		this.image_cap.innerHTML	= this.sisetuData.image1_cap;
		if(parseInt(this.sisetuData.image1_id, 10) > 0) {
			this.image.innerHTML	= "<img src=\"" + this.sisetuData.img_src + "\" alt=\"" + this.sisetuData.image1_cap + "\" style=\"width:" + this.sisetuData.img_width + "px;height:" + this.sisetuData.img_height + "px;margin-bottom:3px\" />";
		} else {
			Element.hide(this.image);
		}
		//#18-->	2009/08/31
		var html = wcommon.escapeHtmlEx(this.sisetuData.comment);
		this.comment.innerHTML = html.replace(/\n/g, "<br />");
		//#18<--
		if (this.sisetuData.sisetu_type == "1") {	//#10
			Element.show(this.yutai_mark);
		} else {
			Element.hide(this.yutai_mark);
		}
		this.address.innerHTML 		= "〒" + this.sisetuData.postcode + "　" + this.sisetuData.address;
		this.tel.innerHTML 			= "TEL：" + this.sisetuData.tel;
		this.url.innerHTML 			= "<a href=\"" + this.sisetuData.url + "\" target=\"_blank\">" + this.sisetuData.url + "</a>";
		this.open_time.innerHTML 	= "営業時間：" + this.sisetuData.open_time;
		this.close_days.innerHTML 	= "定休日：" + this.sisetuData.close_days;
		this.parking.innerHTML 		= "駐車場：" + this.sisetuData.parking;
		this.time_required.innerHTML 	= "観光所要時間：" + this.sisetuData.time_required;
		//#13-->	2008/11/17
		this.barrier_free.innerHTML 	= "バリアフリーメモ：" + this.sisetuData.barrier_free;
		if(this.sisetuData.sisetu_type == "1") {
			var attest = document.createElement('li');
			attest.id = "attest" + this.no;
			this.sisetu_ul.appendChild(attest);
			var disc_taisho = document.createElement('li');
			disc_taisho.id = "disc_taisho" + this.no;
			this.sisetu_ul.appendChild(disc_taisho);
			var disc = document.createElement('li');
			disc.id = "disc" + this.no;
			this.sisetu_ul.appendChild(disc);
			var attest_html = "会員割引方法：";
			if(this.sisetuData.attest_type == "1") attest_html += "会員証提示";
			if(this.sisetuData.attest_type == "2") attest_html += this.sisetuData.attest_sonota;
			attest.innerHTML 	= attest_html;
			disc_taisho.innerHTML 	= "割引対象：" + this.sisetuData.disc_taisho;
			if(this.sisetuData.disc_kbn1 == "1")this.sisetuData.disc_kbn1 = "％";
			if(this.sisetuData.disc_kbn1 == "2")this.sisetuData.disc_kbn1 = "円";
			if(this.sisetuData.disc_kbn2 == "1")this.sisetuData.disc_kbn2 = "％";
			if(this.sisetuData.disc_kbn2 == "2")this.sisetuData.disc_kbn2 = "円";
			if(this.sisetuData.disc_kbn3 == "1")this.sisetuData.disc_kbn3 = "％";
			if(this.sisetuData.disc_kbn3 == "2")this.sisetuData.disc_kbn3 = "円";
			if(this.sisetuData.disc_kbn4 == "1")this.sisetuData.disc_kbn4 = "％";
			if(this.sisetuData.disc_kbn4 == "2")this.sisetuData.disc_kbn4 = "円";
			if(this.sisetuData.disc_kbn5 == "1")this.sisetuData.disc_kbn5 = "％";
			if(this.sisetuData.disc_kbn5 == "2")this.sisetuData.disc_kbn5 = "円";
			var disc_html = "割引内容：";
			if(this.sisetuData.disc_contents1 || this.sisetuData.disc_contents2 || this.sisetuData.disc_contents3 || this.sisetuData.disc_contents4 || this.sisetuData.disc_contents5 || this.sisetuData.disc_sonota) {
				disc_html = "<table style=\"font-size:98%;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
				disc_html += "<tr>";
				disc_html += "<td valign=\"top\">割引内容：</td>";
				disc_html += "<td>";
				disc_html += "<table style=\"font-size:98%;\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">";
				disc_html += "<tr>";
				disc_html += "<td align=\"center\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";
				disc_html += "<td align=\"center\">割引内容</td>";
				disc_html += "<td align=\"center\">割引範囲</td>";
				disc_html += "<td align=\"center\">割引率／額</td>";
				disc_html += "<td align=\"center\">単位</td>";
				disc_html += "</tr>";
				if(this.sisetuData.disc_contents1) {
					disc_html += "<tr>";
					disc_html += "<td align=\"center\">1</td>";
					disc_html += "<td>" + this.sisetuData.disc_contents1 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_hani1 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.discount1 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_kbn1 + "&nbsp;</td>";
					disc_html += "</tr>";
				}
				if(this.sisetuData.disc_contents2) {
					disc_html += "<tr>";
					disc_html += "<td align=\"center\">2</td>";
					disc_html += "<td>" + this.sisetuData.disc_contents2 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_hani2 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.discount2 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_kbn2 + "&nbsp;</td>";
					disc_html += "</tr>";
				}
				if(this.sisetuData.disc_contents3) {
					disc_html += "<tr>";
					disc_html += "<td align=\"center\">3</td>";
					disc_html += "<td>" + this.sisetuData.disc_contents3 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_hani3 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.discount3 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_kbn3 + "&nbsp;</td>";
					disc_html += "</tr>";
				}
				if(this.sisetuData.disc_contents4) {
					disc_html += "<tr>";
					disc_html += "<td align=\"center\">4</td>";
					disc_html += "<td>" + this.sisetuData.disc_contents4 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_hani4 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.discount4 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_kbn4 + "&nbsp;</td>";
					disc_html += "</tr>";
				}
				if(this.sisetuData.disc_contents5) {
					disc_html += "<tr>";
					disc_html += "<td align=\"center\">5</td>";
					disc_html += "<td>" + this.sisetuData.disc_contents5 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_hani5 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.discount5 + "&nbsp;</td>";
					disc_html += "<td>" + this.sisetuData.disc_kbn5 + "&nbsp;</td>";
					disc_html += "</tr>";
				}
				
				if(this.sisetuData.disc_sonota) {
					disc_html += "<tr>";
					disc_html += "<td>その他</td>";
					disc_html += "<td colspan=\"4\">" + this.sisetuData.disc_sonota + "&nbsp;</td>";
					disc_html += "</tr>";
				}
				disc_html += "</table>";
			}
			disc_html += "</td>";
			disc_html += "</tr>";
			disc_html += "</table>";
			disc.innerHTML 	= disc_html;
		}
		//#13<--	2008/11/17
		if(this.sisetuData.lat && this.sisetuData.lon) {
			this.showMap(this.sisetu_w_map, wcommon.D_WIDE_SCALE);
			this.showMap(this.sisetu_m_map, wcommon.D_MIDDLE_SCALE);
			this.showMap(this.sisetu_d_map, wcommon.D_DETAIL_SCALE);
		}
		return true;
	},
	remove: function() {
		Element.hide(this.sisetu);
		this.container.removeChild(this.sisetu);
	},
	showMap: function(map, scale) {
		var latlng = new VMLatLng(this.sisetuData.lat, this.sisetuData.lon);
		var params = {
			USER: 		this.aid,
			ROUTE:		"1",
			CENTER_LAT:	latlng.lat_padms,
			CENTER_LON:	latlng.lng_padms,
			SCALE:		scale,
			SX:			"275",
			SY:			"275",
			MARK:		"",
			MARKPATH:	""
		};
		//#04,#05-->
		if(this.sisetuData.sisetu_type == "1") {	//#10
			//#22-->
			switch(this.sisetuData.genre_cd) {
				case "1": var icon = wcommon.D_ICON_WARIKYO1; break;
				case "2": var icon = wcommon.D_ICON_WARIKYO2; break;
				case "3": var icon = wcommon.D_ICON_WARIKYO3; break;
				case "4": var icon = wcommon.D_ICON_WARIKYO4; break;
				case "5": var icon = wcommon.D_ICON_WARIKYO5; break;
				default: var icon = wcommon.D_ICON_WARIKYO; break;
			}
			//#22<--
			params.MARK = encodeURIComponent("1/" + icon + ":" + latlng.lat_padms + ":" + latlng.lng_padms + ":::/");
			params.MARKPATH = encodeURIComponent("/");
		} else if(this.sisetuData.subgenre_cd == "jf") {
			params.MARK = encodeURIComponent("1/" + wcommon.D_ICON_SIBU + ":" + latlng.lat_padms + ":" + latlng.lng_padms + ":::/");
			params.MARKPATH = encodeURIComponent("/");
		} else {
			params.MARK = encodeURIComponent("1/" + wcommon.D_ICON_KANKOU + ":" + latlng.lat_padms + ":" + latlng.lng_padms + ":::/");
			params.MARKPATH = encodeURIComponent("/");
		}
		//#04,#05<--
		var src = wcommon.getMapUrl(params);
		var html = "<img src=\"" + src;
		html += "\" alt=\"\" class=\"mapimg\" style=\"width:275px; height:275px;\"/>";
		map.innerHTML = html;
	},
	openUrl: function(url) {
		return true;
	}
};

wcommon.LBox = {	//#21
	create: function(dir, nxt) {
		if(!dir) dir 		= "../"
		this.offsetY 		= 100;
		this.boxWidth		= 310;
		this.btnCaller		= null;
		this.cookie_name	= "save_kaiin_id";
		this.lurl			= dir + "login.php";
		this.curl			= dir + "web/php/authchk.php";
		if(this.root) {
			this.root.removeChild(this.root.childNodes.item(0));
		}
		this.root 			= document.createElement("div");
		document.body.appendChild(this.root);
		var html = '<div id="lbox_overlay" style="visibility:hidden; left:600px; top:320px;">';
		html += '<div style="width:310px; background-color:#EBEBEB; padding:10px 0; position:relative;text-align: center;';
		html += '	color: #fff;font-family:"Lucida Grande", "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, "メイリオ", Meiryo, "Verdana", "MS P ゴシック";font-size: 13px;">';
		html += '	<div style="position: absolute; left: 280px; top: 7px;"><a id="lbox_btn_close" href="javascript:void(0);"><img src="' + dir + 'images/closebtn.gif" alt="閉じる" width="23" height="23" border="0" style="background-color:#398700" /></a></div>';
		html += '	<div style="width:290px; background-color: #5EC700;margin:0 10px; padding:10px 0 0px 0">';
		html += '		<div><img src="' + dir + 'images/login_title.gif" alt="JAF会員の方はここからログイン！" width="225" height="64" /></div>';
		html += '		<div style="font-size:13px; margin:10px auto; font-weight: bold; width:230px">JAF会員証に書かれている数字12桁の会員番号を入力してください。</div>';
		html += '		<div id="lbox_login_msg"></div>';
		html += '		<form id="lbox_frm" method="post" action="" style="margin:0; padding: 0;">';
		html += '			<div>';
		html += '				<input id="lbox_id1" type="text" maxlength="4" size="5" style="font-size: 130%; font-weight: bold;width:55px; color:#555;" />';
		html += '				&nbsp;-&nbsp;';
		html += '				<input id="lbox_id2" type="text" maxlength="4" size="5" style="font-size: 130%; font-weight: bold;width:55px; color:#555;" />';
		html += '				&nbsp;-&nbsp;';
		html += '				<input id="lbox_id3" type="text" maxlength="4" size="5" style="font-size: 130%; font-weight: bold;width:55px; color:#555;" />';
		html += '			</div>';
		html += '			<div style="padding:8px 0 0 0">';
		html += '				<input id="lbox_chk_save" type="checkbox" value="1" />';
		html += '				<span style="font-size:12px; font-weight:bold">次回から会員番号の入力を省略</span>';
		html += '			</div>';
		html += '		</form>';
		html += '		<div style="padding:5px 0 12px 0">';
		html += '			<input id="lbox_btn_login" type="image" src="' + dir + 'images/login_btnex.gif" alt="ログイン" class="loginbtn" />';
		html += '		</div>';
		if(nxt) {
			html += '		<div style="width: 232px; margin: 0 auto; background-color: #C3F894; background-image: url(' + dir + 'images/nextflame_top.gif); background-repeat: no-repeat;">';
			html += '			<div style="background: url(' + dir + 'images/nextflame_bottom.gif) no-repeat left bottom; padding: 8px 8px 5px 15px; text-align: left; font-size: 12px; font-weight: bold; color: #227800; line-height:150%;">';
			html += '				<div style="float:left; width:150px">JAF会員ではない方はこちらから進んでください</div>';
			html += '				<div style="float:right"><a id="lbox_btn_next" href="#"><img src="' + dir + 'images/next_btn.gif" alt="" border="0" /></a></div>';
			html += '				<div style="clear:both"></div>';
			html += '			</div>';
			html += '		</div>';
		}
		html += '		<div style="font-size:12px; font-weight:bold; margin-top:10px">まだJAF会員ではありませんか？</div>';
		html += '		<div style="padding:5px 0 12px 0"><a href="http://www.jaf.or.jp/proceed/join/index.htm" target="_blank"><img src="' + dir + 'images/nyukai_btn.gif" alt="" border="0" /></a></div>';
		html += '	</div>';
		html += '</div>';
		html += '</div>';
		this.root.innerHTML = html;
		this.btn_close 		= $('lbox_btn_close');
		this.btn_login 		= $('lbox_btn_login');
		this.btn_next 		= $('lbox_btn_next');
		this.login_msg 		= $("lbox_login_msg");
		this.frm 			= $("lbox_frm");
		this.save_id 		= $("lbox_chk_save");
		this.id1 			= $("lbox_id1");
		this.id2 			= $("lbox_id2");
		this.id3 			= $("lbox_id3");
		this.fill_id();
		var xy = this.get_xy();
		this.overlay = new YAHOO.widget.Overlay("lbox_overlay", {visible:false, xy:xy, width:(this.boxWidth + "px")});
		this.overlay.render();
		Event.observe(this.btn_login, 	"click", this.login.bindAsEventListener(this), false);
		Event.observe(this.id1, "keyup", this.csor.bindAsEventListener(this, this.id1, this.id2), false);
		Event.observe(this.id2, "keyup", this.csor.bindAsEventListener(this, this.id2, this.id3), false);
		Event.observe(this.id3, "keyup", this.csor.bindAsEventListener(this, this.id3, this.btn_login), false);
		Event.observe(this.btn_close, 	"click", this.hide.bindAsEventListener(this), false);
		if(nxt) {
			Event.observe(this.btn_next, 	"click", this.next.bindAsEventListener(this), false);
		}
	},
	auth: function(aid, btn) {
		this.btnCaller = btn;
		this.AID = aid;
		var pars 	= "AID=" + this.AID;
		dpss.common.ajaxPostData(this.curl, pars, this.authrslt.bindAsEventListener(this));
	},
	authrslt: function(e) {
		var a = e.responseText.split(",");
		if(a[0] == "0") {
			this.AID = a[1];
			this.complete("0", this.AID);
		} else {
			this.show(this.btnCaller, this.offsetY);
		}
	},
	login: function() {
		if(!this.chk()) return false;
		this.id = this.id1.value + this.id2.value + this.id3.value;
		var pars = "uid=" + this.id + "&utype=9";
		dpss.common.ajaxPostData(this.lurl, pars, this.logon.bindAsEventListener(this));
	},
	logon: function(request) {
		var xotree = new XML.ObjTree();
		var responseData = xotree.parseXML(request.responseText);
		switch(responseData.dpss.status) {
			case "0": break;
			case "1": this.login_msg.innerHTML = "<div style=\"color:red;\">有効期限が切れています。</div>"; return false; break;
			case "2": this.login_msg.innerHTML = "<div style=\"color:red;\">ログイン情報に誤りがあります。</div>"; return false; break;
			default:  this.login_msg.innerHTML = "<div style=\"color:red;\">システム不安定です。<br />しばらくお待ちください。</div>"; return false;
		}
		if(this.save_id.checked) {
			dpss.common.setCookie(this.cookie_name, "1/" + this.id, 180);
		} else {
			dpss.common.clearCookie(this.cookie_name);
		}
		this.overlay.hide();
		this.complete("0", responseData.dpss.AID);
	},
	csor: function(e, prev, next) {
		if(prev.value.length == 4) next.focus();
	},
	fill_id: function() {
		var id = "";
		var chk_save = "";
		var buf = dpss.common.getCookie(this.cookie_name);
		var ary = buf.split("/");
		if(ary.length > 0) chk_save = ary[0];
		if(chk_save == "1" && ary.length > 1) id = ary[1];
		var param = window.location.search.substring(1, window.location.search.length);
		var ary = param.split('&');
		for(var i = 0; i < ary.length; i++) {
			var a = ary[i].split('=');
			if(a.length == 2 && a[0] == "no") {
				id = a[1];
				break;
			}
		}
		this.id1.value = id.substr(0, 4);
		this.id2.value = id.substr(4, 4);
		this.id3.value = id.substr(8, 4);
		this.save_id.checked = (chk_save == "1") ? true : false;
	},
	chk: function() {
		if(this.id1.value.length != 4 || !this.id1.value.match(/\d{4}/)) return this.msg(this.id1);
		if(this.id2.value.length != 4 || !this.id2.value.match(/\d{4}/)) return this.msg(this.id2);
		if(this.id3.value.length != 4 || !this.id3.value.match(/\d{4}/)) return this.msg(this.id3);
		return true;
	},
	msg: function(input) {
		this.login_msg.innerHTML = "<div style=\"color:red;\">会員番号は１２桁の数字です。</div>";
		input.focus();
		return false;
	},
	show: function(btn, y) {
		this.btnCaller = btn;
		this.offsetY = (y == undefined) ? 100 : y;
		var xy = this.get_xy();
		this.overlay.moveTo(xy[0], xy[1]);
		this.overlay.show();
		window.scrollTo(xy[0], xy[1] - this.offsetY - 10);
	},
	hide: function() { this.overlay.hide(); this.complete("1", "")},
	next: function() { this.overlay.hide(); this.complete("2", "")},
	get_xy: function() {
		if(!this.btnCaller)  return new Array(0, window.innerHeight + 20);
		var xy = YAHOO.util.Dom.getXY(this.btnCaller);
		var w = window.innerWidth;
		var w = document.body.clientWidth;
		var r = Math.floor((w - 944) / 2 + 944);
		if (r > w) r = w;
		var r1 = xy[0] + this.boxWidth;
		if(r1 > r) r1 = r;
		xy[0] = r1 - this.boxWidth;
		xy[1] += this.offsetY;
		return xy;
	}
};
