﻿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) {
	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) {
	document.getElementById(id_frame).src = ddnayoGetCalendarUrl(ddnayo_id_hotel) + "&iframe=True&masterPage=../Common/Popup.master";
}




/* 가평넷 전용 */
function ddnayoAmsIframe(id_frame) {

	//하늘숲 사장 요청에 의해 달력으로 바로 이동
	if (ddnayo_id_hotel == "203") {
		location.href = ddnayoGetCalendarUrl(ddnayo_id_hotel);
	}
	else {
		location.href = ddnayoGetAmsUrl(ddnayo_id_hotel);
	}

	try {
		window.resizeTo(810, 640);
	}
	catch (e) {
	}
	
	
	
	//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;
}