﻿var ddnayo_id_hotel;

function WindowOpen(url, nm, width, height, scroll, resize) {
	if (scroll == null) scroll = "auto";
	if (resize == null) resize = "no";

	var left = (window.screen.width - width) / 2;
	var top = (window.screen.height - height) / 2;
	var status = "height=" + height + ",width=" + width + ",left=" + left + ",top=" + top + ",resizable=" + resize + ",scrollbars=" + scroll + ",status=yes";

	var winAppm = window.open(url, nm, status);
	winAppm.focus();
}


function ddnayoAmsOpen(id_hotel) {
	
	if(
		id_hotel == 277			//산장의아침
	)
		var url = ddnayoGetCalendarUrl(id_hotel);
	else
		var url = ddnayoGetAmsUrl(id_hotel);
	
	
	WindowOpen(url, "ddnayoAms", 810, 580, "yes", "yes");
}

function ddnayoCalendarOpen(id_hotel) {
	var url = ddnayoGetCalendarUrl(id_hotel);
	WindowOpen(url, "ddnayoAms", 810, 580, "yes", "yes");
}

function ddnayoAmsIframeOpen(id_frame) {
    document.getElementById(id_frame).src = ddnayoGetAmsUrl(ddnayo_id_hotel) + "&iframe=True";
}

function ddnayoCalendarIframeOpen(id_frame) {

	if (
		ddnayo_id_hotel == "30"		//누리봄
		||
		ddnayo_id_hotel == "6"		//별빛언덕
		||
		ddnayo_id_hotel == "14"		//풍경좋은
	) {
		location.href = ddnayoGetCalendarUrl(ddnayo_id_hotel);
		window.resizeTo(820, 640);
	}
	else {
		/*현황에 예약조회기능없다하여 변경함*/
		//document.getElementById(id_frame).src = ddnayoGetCalendarUrl(ddnayo_id_hotel) + "&iframe=True&masterPage=../Common/Popup.master";

		if (
			ddnayo_id_hotel == "268"		//럭스제이
		) {
			//location.href = ddnayoGetCalendarUrl(ddnayo_id_hotel) + "&iframe=True&masterPage=../Common/Popup.master";
			location.href = ddnayoGetCalendarUrl(ddnayo_id_hotel);
		}
		else if (
			ddnayo_id_hotel == "28"			//가평별장
			||
			ddnayo_id_hotel == "39"			//멀리가는향기
		) {
			document.getElementById(id_frame).src = ddnayoGetCalendarUrl(ddnayo_id_hotel) + "&iframe=True&masterPage=../Common/Popup.master";
		}
		else {
			document.getElementById(id_frame).src = ddnayoGetCalendarUrl(ddnayo_id_hotel);
		}
	}
}




/* 가평넷 전용 */
function ddnayoAmsIframe(id_frame) {

	if (
		ddnayo_id_hotel == "271"	//하늘그린
		||
		ddnayo_id_hotel == "272"	//하늘그린
	) {
		location.href = ddnayoGetCalendarUrl(ddnayo_id_hotel);
		window.resizeTo(1000, 700);
	}
	else {
		location.href = ddnayoGetCalendarUrl(ddnayo_id_hotel);
		window.resizeTo(820, 640);
	}

	
	//document.getElementById(id_frame).src = ddnayoGetAmsUrl(ddnayo_id_hotel) + "&iframe=True";
}

/* 가평넷 전용 */
function ddnayoAmsStateOnlyIframe(id_frame) {

	location.href = ddnayoAmsStateOnlyUrl(ddnayo_id_hotel);

	try {
		window.resizeTo(810, 640);
	}
	catch (e) {
	}

	//document.getElementById(id_frame).src = ddnayoGetAmsUrl(ddnayo_id_hotel) + "&iframe=True";
}


/* 요금표 바로 예약가능 */
function ddnayoAmsRateIframe(id_frame) {
	document.getElementById(id_frame).src = ddnayoAmsRateIframeUrl(ddnayo_id_hotel);	
}

/* 객실이미지 */
function ddnayoRoomImgIframe(id_frame, id_room) {
	var url = ddnayoRoomImgframeUrl(ddnayo_id_hotel);
	if(id_room != null)
		url += "&id_room="+id_room;
	document.getElementById(id_frame).src = url;
}


function ddnayoGetAmsUrl(id_hotel) {
	var url = "http://www.ddnayo.com/Page/AppmRoom.aspx?id_hotel=" + id_hotel + "&mi=1&cd_req=0030"
	return url;
}

function ddnayoGetCalendarUrl(id_hotel) {
	var url = "http://www.ddnayo.com/Page/AppmCalendar.aspx?id_hotel=" + id_hotel + "&mi=2&cd_req=0030"
	return url;
}

function ddnayoAmsStateOnlyUrl(id_hotel) {
	var url = "http://www.ddnayo.com/Page/AppmCalendar.aspx?id_hotel=" + id_hotel + "&is_state_only=True"
	return url;
}

function ddnayoAmsRateIframeUrl(id_hotel) {
	var url = "http://www.ddnayo.com/Page/iFrmRoomList.aspx?id_hotel=" + id_hotel + "&cd_req=0030"
	return url;
}

function ddnayoRoomImgframeUrl(id_hotel) {
	var url = "http://www.ddnayo.com/Page/iFrmRoomImage.aspx?id_hotel=" + id_hotel + "&cd_req=0030"
	return url;
}