if(!wpage) var wpage = {};
wpage.CourseDetail = {
	Ctrl: {
		icon: 			new Array(),
		printIcon1:		new Array(),
		printIcon2:		new Array(),
		printIcon3:		new Array(),
		allMapIcon:		new Array(),
		mainMapIcon:	new Array()
	},
	Doc: {
		back_ap:		"",
		AID:			"",
		ap:				"",
		func:			"init",
		status:			"",
		user_type:		"",
		user_id:		"",
		rcnt: 			0,
		scnt:			0,
		course: 		wcommon.initCourseData(),
		route: 			new Array(),
		sisetu:			new Array(),
		icon:			new Array(),
		warikyo:		new Array(),
		allmap_scale:	5,
		allmap_lat:		"",
		allmap_lon:		"",
		print_icon1:	new Array(),
		print_icon2:	new Array(),
		print_icon3:	new Array(),
		all_map_icon:	new Array(),
		main_map_icon:	new Array()
	},
	Req: {
		AID: 			"",
		ap:				"course_detail",
		func: 			"init",
		picnt1:			0,
		picnt2:			0,
		picnt3:			0,
		aicnt:			0,
		micnt:			0,
		print_icon1:	new Array(),
		print_icon2:	new Array(),
		print_icon3:	new Array(),
		all_map_icon:	new Array(),
		main_map_icon:	new Array()
	},
	eFun: {
		li_route:		new Array()
	},
	activeRouteNo:	0,
	printMapCnt:	0,
	url: 				"./php/course_detail.php",
	ccurl: 				"./php/edit_course.php",
	exurl:				"./php/extra_info.php",
	xotree: new XML.ObjTree(),
	main: function() {
		this.Doc.AID = $("AID").value;
		if($("back_ap")) this.Doc.back_ap = $("back_ap").value;	//#11
		if($("this_page_title")) {
			$("this_page_title").innerHTML = "ドライブコースの詳細";
			this.Ctrl.to_webtop = $("to_webtop");
			this.Ctrl.new_course = $('gn-newcourse');
			this.Ctrl.create_course = $('gn-drawup');
			this.Ctrl.my_course = $('gn-mypage');
			this.Ctrl.search_course = $('gn-search');
			Event.observe(this.Ctrl.to_webtop, 			'click', this.next_page1.bindAsEventListener(this), false);
			Event.observe(this.Ctrl.new_course, 		'click', this.next_page2.bindAsEventListener(this), false);
			Event.observe(this.Ctrl.create_course, 		'click', this.next_page3.bindAsEventListener(this), false);
			Event.observe(this.Ctrl.my_course, 			'click', this.next_page4.bindAsEventListener(this), false);
			Event.observe(this.Ctrl.search_course, 		'click', this.next_page5.bindAsEventListener(this), false);
		}
		
		this.Ctrl.btn_close = $('btn_close');	//#03
		this.Ctrl.btn_close1 = $('btn_close1');	//#22
		Event.observe(this.Ctrl.btn_close, 			'click', this.next_page6.bindAsEventListener(this), false);
		Event.observe(this.Ctrl.btn_close1, 		'click', this.next_page6.bindAsEventListener(this), false);	//#22
		this.Req.course_id = $("course_id").value;
		var param 	= this.getReqParam();
		dpss.common.ajaxPostData(this.url, param, this.initForm.bindAsEventListener(this), wcommon.showRequestError, null);
	},
	next_page1: function() { this.next_page("webtop"); },
	next_page2: function() { this.next_page("new_course"); },
	next_page3: function() { this.next_page("create_course"); },
	next_page4: function() { this.next_page("my_course"); },
	next_page5: function() { this.next_page("search_course"); },
	next_page6: function() { this.next_page("close"); },
	next_page: function(page_id) {
		if(page_id == "close") {
			window.close();
			return;
		}
		wcommon.initFormData();	//#11
		$('ap').value = page_id;
		$('func').value = "init";
		$('frm').submit();
	},
	initForm: function(request) {
		var responseData = this.getResData(request);
		//#26-->
		if(this.Doc.status == "12") {
			document.location.href = "closed_course.html";
			return;
		}
		//#26<--
		if(this.Doc.status != "0") {
			wcommon.showRequestError();
			return;
		}
		this.getDocData(responseData.dpss);
		//if(!this.Doc.rcnt || !this.Doc.route) return;
		this.getControl();
		this.showForm();
		this.declareEvent();
	},
	getDocData: function(resHash) {
		this.Doc.user_type = resHash.user_type;
		this.Doc.user_id = resHash.user_id;
		var rcnt = parseInt(resHash.rcnt, 10);
		var icnt = parseInt(resHash.icnt, 10);
		//#10-->
		this.Doc.allmap_scale = resHash.allmap_scale;
		this.Doc.allmap_lat = resHash.allmap_lat;
		this.Doc.allmap_lon = resHash.allmap_lon;
		var icnt	= parseInt(resHash.icnt, 10);
		if(icnt == 1) this.Doc.icon[0]				= resHash.icon;
		if(icnt > 1)  this.Doc.icon					= resHash.icon;
		//#10<--
		var buf;
		this.Doc.course		= resHash.course;
		if(rcnt == 1) this.Doc.route[0]		= resHash.route;
		if(rcnt > 1)  this.Doc.route		= resHash.route;
		var course = wcommon.initCourseData();
		var route = wcommon.initRouteData(0);
		var point = wcommon.initPointData(0, 0);
		for(var key in course) {
			if(this.Doc.course[key] == undefined) this.Doc.course[key] = course[key];
		}
		for(var i = 0; i < this.Doc.route.length; i++) {
			for(key in route) {
				if(this.Doc.route[i][key] == undefined) this.Doc.route[i][key] = route[key];
			}
			if(this.Doc.route[i].pcnt == 1) {
				buf = this.Doc.route[i].course_point;
				this.Doc.route[i].course_point = new Array();
				this.Doc.route[i].course_point[0] = buf;
			}
			if(this.Doc.route[i].hwycnt == 1) {
				buf = this.Doc.route[i].hwygid;
				this.Doc.route[i].hwygid = new Array();
				this.Doc.route[i].hwygid[0] = buf;
			}
			if(this.Doc.route[i].acccnt == 1) {
				buf = this.Doc.route[i].accident;
				this.Doc.route[i].accident = new Array();
				this.Doc.route[i].accident[0] = buf;
			}
			if(this.Doc.route[i].raincnt == 1) {
				buf = this.Doc.route[i].rain;
				this.Doc.route[i].rain = new Array();
				this.Doc.route[i].rain[0] = buf;
			}
			if(this.Doc.route[i].jutaicnt == 1) {
				buf = this.Doc.route[i].jutai;
				this.Doc.route[i].jutai = new Array();
				this.Doc.route[i].jutai[0] = buf;
			}
			for(var j = 0; j < this.Doc.route[i].course_point.length; j++) {
				for(key in point) {
					if(this.Doc.route[i].course_point[j][key] == undefined) this.Doc.route[i].course_point[j][key] = point[key];
				}
			}
			//#24-->
			var start_goal = wcommon.calcDateTime(this.Doc.route[i].date_time, this.Doc.route[i].time, this.Doc.route[i].yosoku_type);
			this.Doc.route[i].date_time_start = start_goal[0];
			this.Doc.route[i].date_time_goal = start_goal[1];
			if(i == 0) this.Doc.course.date_time_start = start_goal[0];
			if(i == this.Doc.route.length - 1) this.Doc.course.date_time_goal = start_goal[1];
			//#24<--
		}
		if(icnt == 1) this.Doc.icon[0]	= resHash.icon;
		if(icnt > 1)  this.Doc.icon		= resHash.icon;
		//#10-->
		var icon = wcommon.initIconData();
		for(var i = 0; i < this.Doc.icon.length; i++) {
			for(key in icon) {
				if(this.Doc.icon[i][key] == undefined) this.Doc.icon[i][key] = icon[key];
			}
		}
		//#10<--
		
	},
	getControl: function() {
		//#11-->
		this.Ctrl.btn_back = $("btn_back");
		this.Ctrl.btn_back1 = $("btn_back1");	//#22
		this.Ctrl.btn_close = $("btn_close");
		this.Ctrl.btn_close1 = $("btn_close1");	//#22
		if(this.Doc.back_ap) {
			Element.show(this.Ctrl.btn_back);
			Element.show(this.Ctrl.btn_back1);	//#22
		} else {
			Element.show(this.Ctrl.btn_close);
			Element.show(this.Ctrl.btn_close1);	//#22
		}
		//#11<--
		this.Ctrl.sisetu = new Array();
		this.Ctrl.course_name	=	$("course_name");
		this.Ctrl.course_image1	=	$("course_image1");
		this.Ctrl.course_image2	=	$("course_image2");
		this.Ctrl.course_photo_title_1 = $("course_photo_title_1");	//#13
		this.Ctrl.course_photo_title_2 = $("course_photo_title_2");	//#13
		this.Ctrl.allmap		=	$("allmap");
		this.Ctrl.vallmap		= wcommon.initMap(this.Ctrl.allmap, true);	//#10
		this.Ctrl.print_map1	=	$("print_map1");
		this.Ctrl.print_map2	=	$("print_map2");
		this.Ctrl.print_map3	=	$("print_map3");
		this.Ctrl.print_vmap1	= wcommon.initMap(this.Ctrl.print_map1, true);	//#10
		this.Ctrl.print_vmap2	= wcommon.initMap(this.Ctrl.print_map2, true);	//#10
		this.Ctrl.print_vmap3	= wcommon.initMap(this.Ctrl.print_map3, true);	//#10
		this.Ctrl.print_map_name1	=	$("print_map_name1");
		this.Ctrl.print_map_name2	=	$("print_map_name2");
		this.Ctrl.print_map_name3	=	$("print_map_name3");
		this.Ctrl.course_nittei	=	$("course_nittei");
		this.Ctrl.date_time_start	=	$("date_time_start");	//#24
		this.Ctrl.date_time_goal	=	$("date_time_goal");	//#24
		this.Ctrl.total_kyori	=	$("total_kyori");
		this.Ctrl.total_time	=	$("total_time");
		this.Ctrl.total_time_move	=	$("total_time_move");	//#20
		this.Ctrl.guide_img		=	$("guide_img");
		this.Ctrl.guide			=	$("guide");
		if(this.Doc.course.user_type == "1") {
			Element.show(this.Ctrl.guide_img);
			Element.show(this.Ctrl.guide);
		}
		//#27-->
		this.Ctrl.benefits_box = $("benefits_box");
		this.Ctrl.benefits = $("benefits");
		//#27<--
		this.Ctrl.li_route		= new Array();
		for(var i = 0; i < this.Doc.route.length; i++) {
			this.Ctrl.li_route[i] = $("li_route" + String(i));
			if(i == this.activeRouteNo) {
				this.Ctrl.li_route[i].className = "dayOn";
			} else {
				this.Ctrl.li_route[i].className = "dayOff";
			}
			Element.show(this.Ctrl.li_route[i]);
		}
		this.Ctrl.route_print_title	=	$("route_print_title");
		this.Ctrl.btn_route_print	=	$("btn_route_print");
		this.Ctrl.route_date_time_start	=	$("route_date_time_start");	//#24
		this.Ctrl.route_date_time_goal	=	$("route_date_time_goal");	//#24
		this.Ctrl.route_kyori	=	$("route_kyori");
		this.Ctrl.route_time	=	$("route_time");
		this.Ctrl.route_time_move	=	$("route_time_move");	//#20
		this.Ctrl.drive_route	=	$("drive_route");
		this.Ctrl.route_map		=	$("route_map");
		this.Ctrl.sisetu_box	=	$("sisetu_box");
		this.Ctrl.btn_hwygid	=	$("btn_hwygid");
		this.Ctrl.hwygid_cnt	=	$("hwygid_cnt");
		this.Ctrl.btn_accident	=	$("btn_accident");
		this.Ctrl.accident_cnt	=	$("accident_cnt");
		this.Ctrl.btn_rain		=	$("btn_rain");
		this.Ctrl.rain_cnt		=	$("rain_cnt");
		this.Ctrl.btn_jutai		=	$("btn_jutai");
		this.Ctrl.jutai_cnt		=	$("jutai_cnt");
		this.Ctrl.common_info	=	$("common_info");
		this.Ctrl.btn_print		=	$("btn_print");
		this.Ctrl.btn_print1	=	$("btn_print1");	//#22
		Element.show(this.Ctrl.btn_print1);				//#22
		this.Ctrl.btn_edit		=	$("btn_edit");
		//#21-->
		this.Ctrl.btn_touroku	=	$("btn_touroku");
		this.Ctrl.btn_touroku1	=	$("btn_touroku1");	//#22
		if(this.Doc.user_type == '1') {
			Element.show(this.Ctrl.btn_touroku);
			Element.show(this.Ctrl.btn_touroku1);	//#22
		} else {
			Element.hide(this.Ctrl.btn_touroku);
			Element.hide(this.Ctrl.btn_touroku1);	//#22
		}
		//#21<--
		if(this.Doc.user_type != '1' && this.Doc.user_type != '9') {	//#04
			Element.hide(this.Ctrl.btn_edit);
		}
		Element.hide(this.Ctrl.print_map1);
		Element.hide(this.Ctrl.print_map2);
		Element.hide(this.Ctrl.print_map3);
		Element.hide(this.Ctrl.print_map_name1);
		Element.hide(this.Ctrl.print_map_name2);
		Element.hide(this.Ctrl.print_map_name3);
		this.Ctrl.vm_route_map	= wcommon.initMap(this.Ctrl.route_map);
		//#10-->
		this.Ctrl.btn_show_cross = $("btn_show_cross");			//#23
		this.Ctrl.btn_hide_cross = $("btn_hide_cross");			//#23
		this.Ctrl.btn_show_accident = $("btn_show_accident");	//#23
		this.Ctrl.btn_hide_accident = $("btn_hide_accident");	//#23
		//#10<--
	},
	showForm: function() {
		this.createCourse();
		this.showAllMap();	//#10
		if(this.Doc.course.print_map1 == "1") this.showPrintMap(1);
		if(this.Doc.course.print_map2 == "1") this.showPrintMap(2);
		if(this.Doc.course.print_map3 == "1") this.showPrintMap(3);
		this.createRoute(this.activeRouteNo);
		this.showExtroInfo();
		var sisetu_id = new Array();
		for(var i = 0; i < this.Doc.route.length; i++) {
			for(j = 0; j < this.Doc.route[i].course_point.length; j++) {
				if(this.Doc.route[i].course_point[j].sisetu_id != "" && this.Doc.route[i].course_point[j].point_type == "s") {	//#19
					sisetu_id.push(this.Doc.route[i].course_point[j].sisetu_id);
				}
			}
		}
		//#19-->
		this.Doc.sisetu_id = sisetu_id.uniq();	
		var sisetu_container = null;
		for(var i = 0; i < this.Doc.sisetu_id.length; i++) {
			sisetu_container = document.createElement('div');
			this.Ctrl.sisetu_box.appendChild(sisetu_container);
			this.reqSisetu(this.Doc.sisetu_id[i], sisetu_container, i);
		}
		//#19<--
		//this.debug();
		
	},
	changeRoute: function(e, no) {
		this.activeRouteNo = no;
		for(var i = 0; i < this.Ctrl.li_route.length; i++) {
			if(this.Ctrl.li_route[i]) {
				Event.stopObserving(this.Ctrl.li_route[i], 'click', this.eFun.li_route[i]);
			}
			if(i == this.activeRouteNo) {
				this.Ctrl.li_route[i].className = "dayOn";
			} else {
				this.Ctrl.li_route[i].className = "dayOff";
				this.eFun.li_route[i] = this.changeRoute.bindAsEventListener(this, i);
				Event.observe(this.Ctrl.li_route[i], 	'click', this.eFun.li_route[i], false);
			}
		}
		this.createRoute(this.activeRouteNo);
	},
	showPhoto: function(request, container) {
		container.innerHTML = request.responseText;
	},
	createCourse: function() {
		var img_url = "php/show_photo.php";
		var param = "AID=" + this.Doc.AID;
		param += "&w=420&h=315";
		this.Ctrl.course_name.innerHTML = "<div style=\"font-weight:bold; font-size:70%; color:#0000FF;\">(コースID:" + this.Doc.course.course_id + ")</div>" + this.Doc.course.course_name;	//#22
		if(parseInt(this.Doc.course.photo_id1, 10) > 0) {
			param += "&pno=1";
			param += "&pid=" + this.Doc.course.photo_id1;
			param += "&title=" + this.Doc.course.photo_title_1;
			dpss.common.ajaxPostData(img_url, param, this.showPhoto.bindAsEventListener(this, this.Ctrl.course_image1));
			Element.show(this.Ctrl.course_image1);
			this.Ctrl.course_photo_title_1.innerHTML = this.Doc.course.photo_title_1;	//#13
			Element.show(this.Ctrl.course_photo_title_1);	//#13
		}
		if(parseInt(this.Doc.course.photo_id2, 10) > 0) {
			param += "&pno=2";
			param += "&pid=" + this.Doc.course.photo_id2;
			param += "&title=" + this.Doc.course.photo_title_2;
			dpss.common.ajaxPostData(img_url, param, this.showPhoto.bindAsEventListener(this, this.Ctrl.course_image2));
			Element.show(this.Ctrl.course_image2);
			this.Ctrl.course_photo_title_2.innerHTML = this.Doc.course.photo_title_2;	//#13
			Element.show(this.Ctrl.course_photo_title_2);	//#13
		}
		var html = wcommon.escapeHtmlEx(this.Doc.course.guide);				//#14	#17
		this.Ctrl.guide.innerHTML = html.replace(/\n/g, "<br />");	//#14
		//#27-->
		if(this.Doc.course.user_type == "1" && this.Doc.course.benefits != "") {
			var html = wcommon.escapeHtmlEx(this.Doc.course.benefits);
			this.Ctrl.benefits.innerHTML = html.replace(/\n/g, "<br />");
			Element.show(this.Ctrl.benefits_box);
		}
		//#27<--
		this.Ctrl.course_nittei.innerHTML = wcommon.formatNittei(this.Doc.course.route_cnt);
		this.Ctrl.date_time_start.innerHTML = wcommon.formatDate(this.Doc.course.date_time_start, "");	//#24
		this.Ctrl.date_time_goal.innerHTML = wcommon.formatDate(this.Doc.course.date_time_goal, "");	//#24
		this.Ctrl.total_kyori.innerHTML = wcommon.formatKyori(this.Doc.course.total_kyori) + "km";
		this.Ctrl.total_time.innerHTML = wcommon.formatTime(this.Doc.course.total_time, 1);
		//#20-->
		var total_time_move = 0;
		for(var i = 0; i < this.Doc.route.length; i++) {
			for(var j = 0; j < this.Doc.route[i].course_point.length - 1; j++) {
				if(!isNaN(this.Doc.route[i].course_point[j].time) && Number(this.Doc.route[i].course_point[j].time) > 0) total_time_move += Number(this.Doc.route[i].course_point[j].time);
			}
		}
		this.Ctrl.total_time_move.innerHTML = wcommon.formatTime(total_time_move, 1);
		//#20<--
		var html = "";
		if(this.Doc.course.road_service != "") {
			html += "■JAFロードサービス・救援コール：" + this.Doc.course.road_service.escapeHTML();	//#14
		}
		if(this.Doc.course.reference != "") {
			html += "<br />■問い合わせ先：" + this.Doc.course.reference.escapeHTML();			//#14
		}
		this.Ctrl.common_info.innerHTML = html.replace(/\n/g, "<br />");	//#14
	},
	createRoute: function(routeNo) {
		if(!this.Doc.route[routeNo]) return;
		this.Ctrl.route_print_title.innerHTML = this.Doc.route[routeNo].route_name;
		this.Ctrl.route_date_time_start.innerHTML = wcommon.formatDate(this.Doc.route[routeNo].date_time_start, "");	//#24
		this.Ctrl.route_date_time_goal.innerHTML = wcommon.formatDate(this.Doc.route[routeNo].date_time_goal, "");		//#24
		this.Ctrl.route_kyori.innerHTML = wcommon.formatKyori(this.Doc.route[routeNo].kyori) + "km";//#05
		this.Ctrl.route_time.innerHTML = wcommon.formatTime(this.Doc.route[routeNo].time, 1);
		//#20-->
		var time_move = 0;
		for(var j = 0; j < this.Doc.route[routeNo].course_point.length - 1; j++) {
			if(!isNaN(this.Doc.route[routeNo].course_point[j].time) && Number(this.Doc.route[routeNo].course_point[j].time) > 0) time_move += Number(this.Doc.route[routeNo].course_point[j].time);
		}
		this.Ctrl.route_time_move.innerHTML = wcommon.formatTime(time_move, 1);
		//#20<--
		var html = "";
		for(var j = 0; j < this.Doc.route[routeNo].course_point.length; j++) {
			//#08-->
			if(this.Doc.route[routeNo].course_point[j].point_type == "s") {
				html += "<span style=\"color:#0000FF\">" + this.Doc.route[routeNo].course_point[j].point_name + "</span>";
			} else {
				html += this.Doc.route[routeNo].course_point[j].point_name;
			}
			if(this.Doc.route[routeNo].course_point[j].stay_time > 0) html += "（" + wcommon.formatTime(this.Doc.route[routeNo].course_point[j].stay_time, 1) + "）";	//#20
			//#08<--
			if(j < this.Doc.route[routeNo].course_point.length - 1) {
				//#09-->
				//#25-->
				if(this.Doc.route[routeNo].course_point[j].road_type == "02") {
					html += "====";
				} else {
					html += "――";
				}
				//#20-->
				var buf = "";
				if(this.Doc.route[routeNo].course_point[j].road_name != "" && this.Doc.route[routeNo].course_point[j].road_name != "-") {
					buf += "（";	
					buf += this.Doc.route[routeNo].course_point[j].road_name;		//#07
				}
				if(!isNaN(this.Doc.route[routeNo].course_point[j].kyori) && this.Doc.route[routeNo].course_point[j].kyori > 0) {
					if(buf == "") buf += "（";
					if(this.Doc.route[routeNo].course_point[j].road_name != "" && this.Doc.route[routeNo].course_point[j].road_name != "-") {
						buf += "：";
					}
					buf += wcommon.formatKyori(this.Doc.route[routeNo].course_point[j].kyori) + "km";
					buf += "・" + wcommon.formatTime(this.Doc.route[routeNo].course_point[j].time, 1);
				}
				//#20<--
				if(buf != "") {
					if(this.Doc.route[routeNo].course_point[j].road_type == "02") {
						buf += "）====";
					} else {
						buf += "）――";
					}
				}
				html += buf;
				//#25<--
				//#09<--
			}
		}
		this.Ctrl.drive_route.innerHTML = html;
		this.showRouteMap(routeNo);
		//this.showIcon();	//#10
	},
	declareEvent: function() {
		
		for(var i = 1; i < this.Ctrl.li_route.length; i++) {
			if(i != this.activeRouteNo) {
				this.eFun.li_route[i] = this.changeRoute.bindAsEventListener(this, i);
				Event.observe(this.Ctrl.li_route[i], 	'click', this.eFun.li_route[i], false);
			}
		}
		
		Event.observe(this.Ctrl.btn_route_print, 	'click', this.reqPrintRoute.bindAsEventListener(this), false);	//#10
		Event.observe(this.Ctrl.btn_print, 			'click', this.reqPrintCourse.bindAsEventListener(this), false);	//#10
		Event.observe(this.Ctrl.btn_print1, 		'click', this.reqPrintCourse.bindAsEventListener(this), false);	//#22
		Event.observe(this.Ctrl.btn_edit, 			'click', this.editCourse.bindAsEventListener(this), false);
		//#10-->
		Event.observe(this.Ctrl.btn_show_cross, 	'click', this.showCrossIcon.bindAsEventListener(this), false);	//#23
		Event.observe(this.Ctrl.btn_hide_cross, 	'click', this.hideCrossIcon.bindAsEventListener(this), false);	//#23
		Event.observe(this.Ctrl.btn_show_accident, 	'click', this.showAccidentIcon.bindAsEventListener(this), false);//#23
		Event.observe(this.Ctrl.btn_hide_accident, 	'click', this.hideAccidentIcon.bindAsEventListener(this), false);//#23
		//#10<--
		//#11-->
		if(this.Doc.back_ap) {
			Event.observe(this.Ctrl.btn_back, 			'click', this.back.bindAsEventListener(this), false);
			Event.observe(this.Ctrl.btn_back1, 			'click', this.back.bindAsEventListener(this), false);	//#22
		}
		//#11<--
		//#21-->
		if(this.Doc.user_type == '1') {
			Event.observe(this.Ctrl.btn_touroku, 		'click', this.tourokuCourse.bindAsEventListener(this), false);
			Event.observe(this.Ctrl.btn_touroku1, 		'click', this.tourokuCourse.bindAsEventListener(this), false);	//#22
		}
		//#21<--
	},
	back: function() {	//#11
		$('ap').value = $('back_ap').value;
		$('func').value = $('back_func').value;
		$('frm').submit();
	},
	showRouteMap: function(routeNo) {
		if(!this.Doc.route[routeNo]) return;
		//#18-->
		for (var i = 0; i < this.Ctrl.mainMapIcon.length; i++) {
			this.Ctrl.vm_route_map.removeIcon(this.Ctrl.mainMapIcon[i]);
		}
		this.Doc.main_map_icon = new Array();
		this.Ctrl.mainMapIcon = new Array();
		//#18<--
		//#06-->
		var lat = this.Doc.route[routeNo].allmap_lat;
		var lon = this.Doc.route[routeNo].allmap_lon;
		var scale = this.Doc.route[routeNo].allmap_scale;
		//#06<--
		if(!lat || !lon || !scale) {
			return;
		}
		var latlng, img, pname, str = "";
		var pcnt = 0;
		for(var j = 0; j < this.Doc.route[routeNo].course_point.length; j++) {
			if(this.Doc.route[routeNo].course_point[j].lat && this.Doc.route[routeNo].course_point[j].lon) {
				pname = "";
				img = "";
				latlng = new VMLatLng(this.Doc.route[routeNo].course_point[j].lat, this.Doc.route[routeNo].course_point[j].lon);
				if(j == 0) {
					img = wcommon.D_ICON_START;
					pcnt++;
				} else if(j == this.Doc.route[routeNo].course_point.length - 1) {
					img = wcommon.D_ICON_GOAL;
					pcnt++;
				} else if(this.Doc.route[routeNo].course_point[j].via_point_order != "") {
					img = wcommon.D_ICON_VIA;
					pcnt++;
				}
				if(img != "") {
					str += img + ":" + latlng.lat_padms + ":" + latlng.lng_padms;
					str += ":" + pname + ":" + wcommon.D_ICON_FONT_COLOR + ":" + wcommon.D_ICON_BGCOLOR +"/";
				}
			}
		}
		var oParams = this.Ctrl.vm_route_map.getReqParams();
		oParams.USER = this.Doc.AID + "_" + String(routeNo + 1);
		oParams.ROUTE = "1";
		oParams.FMT = "1";	//gif
		oParams.MARK = "";
		if(pcnt > 0) {
			oParams.DRAWMARK = "1";	//#12
			//oParams.MARK = encodeURIComponent(pcnt + "/" + str);	#12
			//oParams.MARKPATH = encodeURIComponent("/");	#12
		}
		this.Ctrl.vm_route_map.setReqParams(oParams);
		this.Ctrl.vm_route_map.setCenter(new VMLatLng(lat, lon), scale);
		//#10-->
		var icon, icon_data;
		VMEvent.enableAddIcon();
		for (var i = 0; i < this.Doc.icon.length; i++) {
			icon_data = wcommon.initIcon(i, "01");
			icon_data.flag_on = this.Doc.icon[i].flag_on;
			icon_data.lat = this.Doc.icon[i].lat;
			icon_data.lon = this.Doc.icon[i].lon;
			icon_data.comment = this.Doc.icon[i].comment;
			icon = wcommon.showIcon(this.Ctrl.vm_route_map, icon_data, VMDefine.DEFAULT_ICON, true);
			this.Doc.main_map_icon.push(icon_data);
			this.Ctrl.mainMapIcon.push(icon);
		}
		VMEvent.disableAddIcon();
		//#10<--
	},
	showAllMap: function() {	//#10
		if(!this.Doc.allmap_lat || !this.Doc.allmap_lon || !this.Doc.allmap_scale) {
			return;
		}
		var latlng, img, pname, str = "";
		var pcnt = 0;
		var usr = "";
		for(var i = 0; i < this.Doc.route.length; i++) {
			if(usr != "") usr += "/";
			usr += this.Doc.AID + "_" + String(i + 1);
			for(var j = 0; j < this.Doc.route[i].course_point.length; j++) {
				if(this.Doc.route[i].course_point[j].lat && this.Doc.route[i].course_point[j].lon) {
					pname = "";
					img = "";
					latlng = new VMLatLng(this.Doc.route[i].course_point[j].lat, this.Doc.route[i].course_point[j].lon);
					if(i == 0 && j == 0) {
						img = wcommon.D_ICON_START;
						pcnt++;
					} else if(i == this.Doc.route.length - 1 && j == this.Doc.route[i].course_point.length - 1) {
						img = wcommon.D_ICON_GOAL;
						pcnt++;
					} else if(this.Doc.route[i].course_point[j].via_point_order != "") {
						img = wcommon.D_ICON_VIA;
						pcnt++;
					} else {
					}
					if(img != "") {
						str += img + ":" + latlng.lat_padms + ":" + latlng.lng_padms;
						str += ":" + pname + ":" + wcommon.D_ICON_FONT_COLOR + ":" + wcommon.D_ICON_BGCOLOR +"/";
					}
				}
			}
		}
		latlng = new VMLatLng(this.Doc.allmap_lat, this.Doc.allmap_lon);
		var oParams = this.Ctrl.vallmap.getReqParams();
		oParams.ROUTE = "1";
		oParams.FMT = 1;
		oParams.USER = encodeURIComponent(usr);
		oParams.SX = "590";
		oParams.SY = "480";
		oParams.MARK = "";
		oParams.MARKPATH = "";
		if(pcnt > 0) {
			oParams.DRAWMARK = "1";	//#12
		//	oParams.MARK = encodeURIComponent(pcnt + "/" + str);	#12
		//	oParams.MARKPATH = encodeURIComponent("/");	#12
		}
		
		this.Ctrl.vallmap.setReqParams(oParams);
		this.Ctrl.vallmap.setCenter(latlng, this.Doc.allmap_scale);

		var icon;
		for(var i = 0; i < this.Doc.route.length; i++) {
			//#23-->
			for(var j = 0; j < this.Doc.route[i].course_point.length; j++) {
				if(this.Doc.route[i].course_point[j].lat && this.Doc.route[i].course_point[j].lon) {
					if(i == 0 && j == 0) {
					} else if(i == this.Doc.route.length - 1 && j == this.Doc.route[i].course_point.length - 1) {
					} else if(this.Doc.route[i].course_point[j].via_point_order != "") {
					} else {
						if(this.Doc.route[i].course_point[j].point_name != undefined && this.Doc.route[i].course_point[j].point_name != "") {
							latlng = new VMLatLng(this.Doc.route[i].course_point[j].lat, this.Doc.route[i].course_point[j].lon);
							var icon_data = wcommon.initIcon(i * 100 + j, "CROSS");
							icon_data.lat = this.Doc.route[i].course_point[j].lat;
							icon_data.lon = this.Doc.route[i].course_point[j].lon;
							icon_data.comment = this.Doc.route[i].course_point[j].point_name;
							icon = wcommon.showIcon(this.Ctrl.vallmap, icon_data, wcommon.D_ICON_CROSS_VMAP, false);
							if(this.Doc.route[i].course_point[j].info_winx != "" && this.Doc.route[i].course_point[j].info_winy != "") {
								icon.setInfoWinPos(this.Doc.route[i].course_point[j].info_winx, this.Doc.route[i].course_point[j].info_winy);
							}
							if(icon) {
								this.Doc.all_map_icon.push(icon_data);
								this.Ctrl.allMapIcon.push(icon);
							}
							if(this.Doc.course.show_crossing == "1" && this.Doc.route[i].course_point[j].show_icon == "1") {
								icon.show();
							} else {
								icon.hide();
							}
						}
					}
				}
			}
			for(var j = 0; j < this.Doc.route[i].accident.length; j++) {
				if(this.Doc.route[i].accident[j].lat && this.Doc.route[i].accident[j].lon) {
					latlng = new VMLatLng(this.Doc.route[i].accident[j].lat, this.Doc.route[i].accident[j].lon);
					var icon_data = wcommon.initIcon(i * 100 + j, "ACCIDENT");
					icon_data.lat = this.Doc.route[i].accident[j].lat;
					icon_data.lon = this.Doc.route[i].accident[j].lon;
					if(this.Doc.route[i].accident[j].road) icon_data.comment = this.Doc.route[i].accident[j].road;
					if(this.Doc.route[i].accident[j].name) icon_data.comment += this.Doc.route[i].accident[j].name;
					icon = wcommon.showIcon(this.Ctrl.vallmap, icon_data, wcommon.D_ICON_ACC_VMAP, false);
					if(this.Doc.route[i].accident[j].info_winx != "" && this.Doc.route[i].accident[j].info_winy != "") {
						icon.setInfoWinPos(this.Doc.route[i].accident[j].info_winx, this.Doc.route[i].accident[j].info_winy);
					}
					if(icon) {
						this.Doc.all_map_icon.push(icon_data);
						this.Ctrl.allMapIcon.push(icon);
					}
					if(this.Doc.course.show_accident == "1" && this.Doc.route[i].accident[j].show_icon == "1") {
						icon.show();
					} else {
						icon.hide();
					}
				}
			}
			//#23<--
		}
	},
	showPrintMap: function(no) {
		switch(no) {
			case 1:
				var lat = this.Doc.course.print_map_lat1;
				var lon = this.Doc.course.print_map_lon1;
				var scale = this.Doc.course.print_map_scale1;
				var map = this.Ctrl.print_map1;
				var vmap = this.Ctrl.print_vmap1;			//#10
				var nm = this.Doc.course.print_map_name1;
				this.Ctrl.print_map_name1.innerHTML = nm.escapeHTML();	//#16
				Element.show(this.Ctrl.print_map_name1);	//#16
				break;
			case 2:
				var lat = this.Doc.course.print_map_lat2;
				var lon = this.Doc.course.print_map_lon2;
				var scale = this.Doc.course.print_map_scale2;
				var map = this.Ctrl.print_map2;
				var vmap = this.Ctrl.print_vmap2;			//#10
				var nm = this.Doc.course.print_map_name2;
				this.Ctrl.print_map_name2.innerHTML = nm.escapeHTML();	//#16
				Element.show(this.Ctrl.print_map_name2);	//#16
				break;
			case 3:
				var lat = this.Doc.course.print_map_lat3;
				var lon = this.Doc.course.print_map_lon3;
				var scale = this.Doc.course.print_map_scale3;
				var map = this.Ctrl.print_map3;
				var vmap = this.Ctrl.print_vmap3;			//#10
				var nm = this.Doc.course.print_map_name3;
				this.Ctrl.print_map_name3.innerHTML = nm.escapeHTML();	//#16
				Element.show(this.Ctrl.print_map_name3);	//#16
				break;
			default:
				return;
		}
		if(!lat || !lon || !scale) {
			return;
		}
		var center_latlng = new VMLatLng(lat, lon);
		var latlng, img, pname, str = "";
		var pcnt = 0;
		var usr = "";
		for(var i = 0; i < this.Doc.route.length; i++) {
			if(usr != "") usr += "/";
			usr += this.Doc.AID + "_" + String(i + 1);
			for(var j = 0; j < this.Doc.route[i].course_point.length; j++) {
				if(this.Doc.route[i].course_point[j].lat && this.Doc.route[i].course_point[j].lon) {
					pname = "";
					img = "";
					latlng = new VMLatLng(this.Doc.route[i].course_point[j].lat, this.Doc.route[i].course_point[j].lon);
					if(i == 0 && j == 0) {
						img = wcommon.D_ICON_START;
						pcnt++;
					} else if(i == this.Doc.route.length - 1 && j == this.Doc.route[i].course_point.length - 1) {
						img = wcommon.D_ICON_GOAL;
						pcnt++;
					} else if(this.Doc.route[i].course_point[j].via_point_order != "") {
						img = wcommon.D_ICON_VIA;
						pcnt++;
					}
					if(img != "") {
						str += img + ":" + latlng.lat_padms + ":" + latlng.lng_padms;
						str += ":" + pname + ":" + wcommon.D_ICON_FONT_COLOR + ":" + wcommon.D_ICON_BGCOLOR +"/";
					}
				}
			}
		}
		Element.show(map);
		//#10-->
		var oParams = vmap.getReqParams();
		oParams.ROUTE = "1";
		oParams.FMT = 1;
		oParams.DATE = this.Doc.course.date_time;
		oParams.JAM_E = "1100";
		oParams.JAM_C = "1100";
		oParams.JAM_G = "1100";
		oParams.JAM_O = "1100";
		oParams.USER = encodeURIComponent(usr);
		oParams.SX = "275";
		oParams.SY = "275";
		oParams.MARK = "";
		oParams.MARKPATH = "";
		if(pcnt > 0) {
			oParams.DRAWMARK = "1";	//#12
			//oParams.MARK = encodeURIComponent(pcnt + "/" + str);	#12
			//oParams.MARKPATH = encodeURIComponent("/");	#12
		}
		
		vmap.setReqParams(oParams);
		vmap.setCenter(center_latlng, scale);
		var aryDocIcon = new Array();
		var aryCtrlIcon = new Array();
		var icon, icon_data;
		for (var i = 0; i < this.Doc.icon.length; i++) {
			icon_data = wcommon.initIcon(i, "01");
			icon_data.flag_on = this.Doc.icon[i].flag_on;
			icon_data.lat = this.Doc.icon[i].lat;
			icon_data.lon = this.Doc.icon[i].lon;
			icon_data.comment = this.Doc.icon[i].comment;
			icon = wcommon.showIcon(vmap, icon_data, VMDefine.DEFAULT_ICON, true);
			if(icon) {
				aryDocIcon.push(icon_data);
				aryCtrlIcon.push(icon);
			}
		}
		switch(no) {
			case 1:
				this.Ctrl.printIcon1 = aryCtrlIcon;
				this.Doc.print_icon1 = aryDocIcon;
				break;
			case 2:
				this.Ctrl.printIcon2 = aryCtrlIcon;
				this.Doc.print_icon2 = aryDocIcon;
				break;
			case 3:
				this.Ctrl.printIcon3 = aryCtrlIcon;
				this.Doc.print_icon3 = aryDocIcon;
				break;
		}
		//#10
	},
	showIcon: function(){

		for(var i = 0; i < this.Ctrl.icon.length; i++) {
			this.Ctrl.vm_route_map.removeIcon(this.Ctrl.icon[i]);
		}
		if(this.Doc.icon.length < 1) return;
		var size 			= new VMSize(wcommon.D_ICON_WIDTH, wcommon.D_ICON_HEIGHT);
		var iconAnchor 		= new VMPoint(size.height / 2, size.width / 2);
		var image			= VMDefine.DEFAULT_ICON;
		var icon, pos;
		var html, com, btn_flag_off;
		VMEvent.enableAddIcon();
		this.Ctrl.icon = new Array();
		for(var i = 0; i < this.Doc.icon.length; i++) {
			pos = new VMLatLng(this.Doc.icon[i].lat, this.Doc.icon[i].lon);
			icon = new VMIcon(pos, size, iconAnchor, image);
			this.Ctrl.vm_route_map.addIcon(icon);
			this.Ctrl.icon.push(icon);
			btn_flag_off = "btn_flag_off" + String(this.Doc.icon[i].icon_id);
			html = "<div style=\"width:200px; border: 1px solid gray; padding: 5px 5px 5px 5px; background-color: #ccccff;\">";
			html += "<div style=\"white-space: nowrap; font-size: 8pt;\">コメント</div>";
			html += "<div style=\"white-space: nowrap; font-size: 8pt; background-color: #ffffcc; padding: 5px 5px 5px 5px;\">";
			com = this.Doc.icon[i].comment.escapeHTML();
			com = com.replace(/\n/g, "<br />");
			html += com;
			html += "</div>";
			html += "</div>";
			icon.openInfoWindow(this.Ctrl.vm_route_map, html);
			VMEvent.addEventListener(icon, 	"click", this.iconClick.bindAsEventListener(this, icon));
		}
		VMEvent.disableAddIcon();

	},
	flag_on: function(e, icon) {
		icon.openInfoWindow(this.vm_route_map);
		this.icon_flag = true;
	},
	flag_off: function(e, icon) {
		icon.closeInfoWindow();
		this.icon_flag = false;
	},
	iconClick: function(e, icon) {
		if(this.icon_flag) {
			this.flag_off(e, icon);
		} else {
			this.flag_on(e, icon);
		}
	},
	reqSisetu: function(sisetu_id, sisetu_container, idx) {	//#19
		this.Req.func = "sisetu";
		this.Req.sisetu_id = sisetu_id;
		var param 	= this.getReqParam();
		dpss.common.ajaxPostData(this.url, param, this.showSisetu.bindAsEventListener(this, sisetu_container, idx), wcommon.showRequestError, null);	//#19
	},
	showSisetu: function(request, sisetu_container, idx) {	//#19
		var responseData = this.getResData(request);
		if(this.Doc.status != "0") {
			wcommon.showRequestError();
			return;
		}
		if(responseData.dpss.scnt > 0) {
			var sisetu_data = wcommon.initSisetuData();
			for(key in sisetu_data) {
				if(responseData.dpss.sisetu_data[key] != undefined) sisetu_data[key] = responseData.dpss.sisetu_data[key];
			}
			var usr = "";
			for(var i = 0; i < this.Doc.route.length; i++) {
				if(usr != "") usr += "/";
				usr += this.Doc.AID + "_" + String(i + 1);
			}
			usr = encodeURIComponent(usr);
			var sisetu = new wcommon.SisetuInfo(sisetu_container, sisetu_data, idx + 1, usr);	//#19
			this.Ctrl.sisetu.push(sisetu);
		}
		//#19--> no arrange
		var no = 0;
		for(var i = 0; i < this.Doc.sisetu_id.length; i++) {
			for(var j = 0; j < this.Ctrl.sisetu.length; j++) {
				if(this.Ctrl.sisetu[j].sisetuData.sisetu_id == this.Doc.sisetu_id[i]) {
					no++;
					this.Ctrl.sisetu[j].sisetu_no.innerHTML	= wcommon.simpleSprintf("02", no);
					break;
				}
			}
		}
		//#19<--
	},
	showExtroInfo: function() {
		var hwygid_cnt 		= 0;
		var accident_cnt 	= 0;
		var rain_cnt 		= 0;
		var jutai_cnt 		= 0;
		for(var i = 0; i < this.Doc.route.length; i++) {
			hwygid_cnt += this.Doc.route[i].hwygid.length;
			accident_cnt += this.Doc.route[i].accident.length;
			rain_cnt += this.Doc.route[i].rain.length;
			jutai_cnt += this.Doc.route[i].jutai.length;
		}
		if(hwygid_cnt > 0) {
			this.Ctrl.hwygid_cnt.innerHTML = String(hwygid_cnt) + "箇所";
			Event.observe(this.Ctrl.btn_hwygid, "click", this.showHwygid.bindAsEventListener(this), false);
		} else {
			this.Ctrl.hwygid_cnt.innerHTML = "情報ありません";
		}
		if(accident_cnt > 0) {
			this.Ctrl.accident_cnt.innerHTML = String(accident_cnt) + "箇所";
			Event.observe(this.Ctrl.btn_accident, "click", this.showAccident.bindAsEventListener(this), false);
		} else {
			this.Ctrl.accident_cnt.innerHTML = "情報ありません";
		}
		if(rain_cnt > 0) {
			this.Ctrl.rain_cnt.innerHTML = String(rain_cnt) + "箇所";
			Event.observe(this.Ctrl.btn_rain, "click", this.showRain.bindAsEventListener(this), false);
		} else {
			this.Ctrl.rain_cnt.innerHTML = "情報ありません";
		}
		if(jutai_cnt > 0) {
			this.Ctrl.jutai_cnt.innerHTML = String(jutai_cnt) + "箇所";
			Event.observe(this.Ctrl.btn_jutai, "click", this.showJutai.bindAsEventListener(this), false);
		} else {
			this.Ctrl.jutai_cnt.innerHTML = "情報ありません";
		}
	},
	showHwygid: function() {
		this.activeExtra = "hwygid";
		var url = this.exurl + "?AID="+ this.Doc.AID + "&func=hwygid";
		dpss.common.MM_openBrWindow(url,'printselect','scrollbars=yes, resizable=yes,width=940,height=650');	//#15
	},
	showAccident: function() {
		this.activeExtra = "accident";
		//var url = this.exurl + "?AID="+ this.Doc.AID + "&func=accident";
		var url = "./php/accident.php?AID="+ this.Doc.AID + "&func=accident";	//#10
		dpss.common.MM_openBrWindow(url,'printselect','scrollbars=yes, resizable=yes,width=940,height=650');	//#15
	},
	showRain: function() {
		this.activeExtra = "rain";
		var url = this.exurl + "?AID="+ this.Doc.AID + "&func=rain";
		dpss.common.MM_openBrWindow(url,'printselect','scrollbars=yes, resizable=yes,width=940,height=650');	//#15
	},
	showJutai: function() {
		this.activeExtra = "jutai";
		var url = this.exurl + "?AID="+ this.Doc.AID + "&func=jutai";
		dpss.common.MM_openBrWindow(url,'printselect','scrollbars=yes, resizable=yes,width=940,height=650');	//#15
	},
	showCrossIcon: function() {	//#23
		for(var i = 0; i < this.Ctrl.allMapIcon.length; i++) {
			if(this.Doc.all_map_icon[i].icon_type == "CROSS") {
				this.Doc.all_map_icon[i].show_icon = "1";
				this.Ctrl.allMapIcon[i].show();
			}
		}
		this.Doc.course.show_crossing = "1";
	},
	hideCrossIcon: function() {	//#23
		for(var i = 0; i < this.Ctrl.allMapIcon.length; i++) {
			if(this.Doc.all_map_icon[i].icon_type == "CROSS") {
				this.Doc.all_map_icon[i].show_icon = "0";
				this.Ctrl.allMapIcon[i].hide();
			}
		}
		this.Doc.course.show_crossing = "0";
	},
	showAccidentIcon: function() {	//#23
		for(var i = 0; i < this.Ctrl.allMapIcon.length; i++) {
			if(this.Doc.all_map_icon[i].icon_type == "ACCIDENT") {
				this.Doc.all_map_icon[i].show_icon = "1";
				this.Ctrl.allMapIcon[i].show();
			}
		}
		this.Doc.course.show_accident = "1";
	},
	hideAccidentIcon: function() {	//#23
		for(var i = 0; i < this.Ctrl.allMapIcon.length; i++) {
			if(this.Doc.all_map_icon[i].icon_type == "ACCIDENT") {
				this.Doc.all_map_icon[i].show_icon = "0";
				this.Ctrl.allMapIcon[i].hide();
			}
		}
		this.Doc.course.show_accident = "0";
	},
	flagOnCross: function(idx) {	//#10,#23
		if(this.Doc.all_map_icon[idx].icon_type == "CROSS") {
			this.Ctrl.allMapIcon[idx].flag_on = "1";
			this.Doc.all_map_icon[idx].flag_on = "1";
			this.Ctrl.allMapIcon[idx].openInfoWindow();
		}
	},
	flagOffCross: function(idx) {	//#10,#23
		if(this.Doc.all_map_icon[idx].icon_type == "CROSS") {
			this.Ctrl.allMapIcon[idx].flag_on = "0";
			this.Doc.all_map_icon[idx].flag_on = "0";
			this.Ctrl.allMapIcon[idx].closeInfoWindow();
		}
	},
	flagOnAccident: function(idx) {	//#10,#23
		if(this.Doc.all_map_icon[idx].icon_type == "ACCIDENT") {
			this.Ctrl.allMapIcon[idx].flag_on = "1";
			this.Doc.all_map_icon[idx].flag_on = "1";
			this.Ctrl.allMapIcon[idx].openInfoWindow();
		}
	},
	flagOffAccident: function(idx) {	//#10,#23
		if(this.Doc.all_map_icon[idx].icon_type == "ACCIDENT") {
			this.Ctrl.allMapIcon[idx].flag_on = "0";
			this.Doc.all_map_icon[idx].flag_on = "0";
			this.Ctrl.allMapIcon[idx].closeInfoWindow();
		}
	},
	getIconData: function() {	//#10
		var i;
		var icon, winxy, info_winxy;
		for(i = 0; i < this.Ctrl.allMapIcon.length; i++) {
			winxy 			= this.Ctrl.allMapIcon[i].getPoint();
			this.Doc.all_map_icon[i].winx 		= winxy.x;
			this.Doc.all_map_icon[i].winy 		= winxy.y;
			info_winxy 		= this.Ctrl.allMapIcon[i].getInfoWinPos();
			this.Doc.all_map_icon[i].info_winx 	= info_winxy.x;
			this.Doc.all_map_icon[i].info_winy 	= info_winxy.y;
			this.Doc.all_map_icon[i].show_icon = (this.Ctrl.allMapIcon[i].bHidden) ? "0" : "1";		//#23
		}
		for(i = 0; i < this.Ctrl.mainMapIcon.length; i++) {
			winxy 			= this.Ctrl.mainMapIcon[i].getPoint();
			this.Doc.main_map_icon[i].winx 		= winxy.x;
			this.Doc.main_map_icon[i].winy 		= winxy.y;
			this.Doc.main_map_icon[i].flag_on 	= this.Ctrl.mainMapIcon[i].flag_on;
			if(this.Doc.main_map_icon[i].flag_on == "1") {
				info_winxy 		= this.Ctrl.mainMapIcon[i].getInfoWinPos();
				this.Doc.main_map_icon[i].info_winx = info_winxy.x;
				this.Doc.main_map_icon[i].info_winy = info_winxy.y;
			}
		}
		if(this.Doc.course.print_map1 == "1") {
			for(i = 0; i < this.Ctrl.printIcon1.length; i++) {
				winxy 			= this.Ctrl.printIcon1[i].getPoint();
				this.Doc.print_icon1[i].winx 		= winxy.x;
				this.Doc.print_icon1[i].winy 		= winxy.y;
				this.Doc.print_icon1[i].flag_on 	= this.Ctrl.printIcon1[i].flag_on;
				if(this.Doc.print_icon1[i].flag_on == "1") {
					info_winxy 		= this.Ctrl.printIcon1[i].getInfoWinPos();
					this.Doc.print_icon1[i].info_winx 	= info_winxy.x;
					this.Doc.print_icon1[i].info_winy 	= info_winxy.y;
				}
			}
		}
		if(this.Doc.course.print_map2 == "1") {
			for(i = 0; i < this.Ctrl.printIcon2.length; i++) {
				winxy 			= this.Ctrl.printIcon2[i].getPoint();
				this.Doc.print_icon2[i].winx 		= winxy.x;
				this.Doc.print_icon2[i].winy 		= winxy.y;
				this.Doc.print_icon2[i].flag_on 	= this.Ctrl.printIcon2[i].flag_on;
				if(this.Doc.print_icon2[i].flag_on == "1") {
					info_winxy 		= this.Ctrl.printIcon2[i].getInfoWinPos();
					this.Doc.print_icon2[i].info_winx 	= info_winxy.x;
					this.Doc.print_icon2[i].info_winy 	= info_winxy.y;
				}
			}
		}
		if(this.Doc.course.print_map3 == "1") {
			for(i = 0; i < this.Ctrl.printIcon3.length; i++) {
				winxy 			= this.Ctrl.printIcon3[i].getPoint();
				this.Doc.print_icon3[i].winx 		= winxy.x;
				this.Doc.print_icon3[i].winy 		= winxy.y;
				this.Doc.print_icon3[i].flag_on 	= this.Ctrl.printIcon3[i].flag_on;
				if(this.Doc.print_icon3[i].flag_on == "1") {
					info_winxy 		= this.Ctrl.printIcon3[i].getInfoWinPos();
					this.Doc.print_icon3[i].info_winx 	= info_winxy.x;
					this.Doc.print_icon3[i].info_winy 	= info_winxy.y;
				}
			}
		}
		
	},
	reqPrintCourse: function() {	//#10
		this.reqPrint("course");
	},
	reqPrintRoute: function() {		//#10
		this.reqPrint("route");
	},
	reqPrint: function(type) {		//#10
		this.getIconData();
		this.Req.func = "print";
		this.Req.picnt1	= this.Doc.print_icon1.length;
		this.Req.picnt2	= this.Doc.print_icon2.length;
		this.Req.picnt3	= this.Doc.print_icon3.length;
		this.Req.aicnt	= this.Doc.all_map_icon.length;
		this.Req.micnt	= this.Doc.main_map_icon.length;
		this.Req.print_icon1 = this.Doc.print_icon1;
		this.Req.print_icon2 = this.Doc.print_icon2;
		this.Req.print_icon3 = this.Doc.print_icon3;
		this.Req.all_map_icon = this.Doc.all_map_icon;
		this.Req.main_map_icon = this.Doc.main_map_icon;
		var param = this.getReqParam();
		if(type == "course") dpss.common.ajaxPostData(this.url, param, this.printCourse.bindAsEventListener(this), wcommon.showRequestError, null);
		if(type == "route") dpss.common.ajaxPostData(this.url, param, this.printRoute.bindAsEventListener(this), wcommon.showRequestError, null);
	},
	printCourse: function(request) {
		var sid = "";
		var sc = "";
		//#19-->
		var chk_id = new Array();
		var chk_scale = new Array();
		for(var i = 0; i < this.Ctrl.sisetu.length; i++) {
			if(this.Ctrl.sisetu[i].chk_print.checked) {
				chk_id.push(this.Ctrl.sisetu[i].sisetuData.sisetu_id);
				chk_scale.push(String(this.Ctrl.sisetu[i].scale));
			}
		}
		for(var i = 0; i < this.Doc.sisetu_id.length; i++) {
			for(var j = 0; j < chk_id.length; j++) {
				if(chk_id[j] == this.Doc.sisetu_id[i]) {
					if(sid != "") sid += "/";
					if(sc != "") sc += "/";
					sid += chk_id[j];
					sc += chk_scale[j];
					break;
				}
			}
		}
		//#19<--
		var url = "course_print.php";
		url += "?AID=" + this.Doc.AID
		url += "&sid=" + sid;
		url += "&sc=" + sc;
		var nm = "print" + this.Doc.course.course_id;
		w=window.open(url, nm,'width=940, height=650, menubar=no, toolbar=no, scrollbars=yes, resizable=yes');	//#15
	},
	printRoute: function(request) {
		var url = "course_day_print.php?AID=" + this.Doc.AID + "&routeNo=" + this.activeRouteNo;
		url += "&sc=" + this.Ctrl.vm_route_map.getZoom();
		var latlng = this.Ctrl.vm_route_map.getCenter();
		url += "&cx=" + latlng.lng;
		url += "&cy=" + latlng.lat;
		var nm = "print" + this.Doc.course.course_id;
		w=window.open(url,nm,'width=940, height=650, menubar=no, toolbar=no, scrollbars=yes, resizable=yes');	//#15
	},
	editCourse: function() {
		$('ap').value = "create_course";
		$('func').value = "reset";
		$('frm').submit();
	},
	tourokuCourse: function() {		//#21
		if(this.Doc.user_type != "1") return;
		$("back_func").value = this.Doc.func;
		$("back_ap").value = "course_detail/" + this.Doc.back_ap;
		$("course_id").value = this.Doc.course.course_id;
		$('ap').value = "course_touroku";
		$('func').value = "init";
		$('frm').submit();
	},
	getReqParam: function() {
		this.Req.AID = this.Doc.AID;
		var reqDoc = {dpss: {request: this.Req}};
		var param = this.xotree.writeXML(reqDoc);
		return param;
	},
	getResData: function(request) {
		var responseData = this.xotree.parseXML(request.responseText);
		this.Doc.status 	= responseData.dpss.status;
		return responseData;
	},
	msg: function(msg) {
		this.Ctrl.msg.innerHTML = msg;
	},
	debug: function() {
		var html = "";
		$("result").innerHTML = html;
		
	}
};

function setExtraPrintIndex (idx_str) {
	var ary = idx_str.split(",");
	var str, extraData;
	var ridx, didx;
	
	for(var i = 0; i < wpage.CourseDetail.Doc.route.length; i++) {
		str = "wpage.CourseDetail.Doc.route[" + String(i) + "]." + wpage.CourseDetail.activeExtra;
		extraData = eval(str);
		for(j = 0; j < extraData.length; j++) {
			extraData[j].print_flg = "0";
		}
	}
	for(var i = 0; i < ary.length; i++) {
		ridx = parseInt(ary[i].substr(0, 2), 10);
		didx = parseInt(ary[i].substr(2, 2), 10);
		str = "wpage.CourseDetail.Doc.route[" + String(ridx) + "]." + wpage.CourseDetail.activeExtra;
		extraData = eval(str);
		extraData[didx].print_flg = "1";
	}
}
	

Event.observe(window, 'load', function() {
	wpage.CourseDetail.main();
}, false);

					
