
/* Default PopUp */
function pop_default(url, w, h) {
    window.open(url, "newWin", "noresizable,scrollbars=no," + "width=" + w + ",height=" + h + ",resizable=no");
}

function pop_scroll(url, w, h) {
    window.open(url, "newWin", "noresizable,scrollbars=yes," + "width=" + w + ",height=" + h + ",resizable=no");
}

/* Dreamweaver MouseOver Event */
function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.0
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && document.getElementById) x = document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}

//function initsize(domain, ifrm)
function initsize(_strUrl, addSize, addHeight) {
    if (addSize == null || addSize == "")
        addSize = 0;

    if (addHeight == null || addHeight == "")
        addHeight = -100;

    //common logic   
    if (_strUrl == null || _strUrl == "") {
        //parent.self.resizeTo(document.body.scrollWidth,document.body.scrollHeight);
        try {
            parent.parent.frames("BicoSyncIframe").resizeTo(document.body.scrollWidth, document.body.scrollHeight);
        }
        catch (ex) {
        }

        try {
            parent.frames("BicoSyncIframe").resizeTo(document.body.scrollWidth, document.body.scrollHeight);
        }
        catch (ex) {
        }

        try {
            parent.parent.parent.frames("BicoSyncIframe").resizeTo(document.body.scrollWidth - addSize, document.body.scrollHeight - addHeight);
        }
        catch (ex) {
        }

        var Domain = document.URL;
        Domain = Domain.split("//");

        if (Domain[1].substr(0, Domain[1].indexOf("/")) == "justgo1.jejuair.net") {
            doIfr();
        }
    }
    else {
        try {
            //_strUrl='http://www.bico.jp/SyncControler.htm'
            window.ifrSyncControler.location.href = _strUrl + '?height=' + document.body.scrollHeight;
        }
        catch (ex) { }
    }
}

var OBJ_DELAY = null;

function div_img_control(divId, imgId, allcnt, Id, selectImg, selectedid) {
    clearTimeout(OBJ_DELAY);

    for (i = 1; i < allcnt + 1; i++) {
        var ImgSize = selectImg.length;

        if (document.getElementById(imgId + "_" + i) != null) {
            var Img = document.getElementById(imgId + "_" + i);
            var ImgArray = Img.src.split(".");
            var ImgSrc = "";

            for (j = 0; j < ImgArray.length - 1; j++) {
                ImgSrc += ImgArray[j] + ".";
            }
        }

        if (i == Id) {
            if ((ImgArray[ImgArray.length - 2].substring(ImgArray[ImgArray.length - 2].length, ImgArray[ImgArray.length - 2].length - ImgSize)) != selectImg) {
                Img.src = ImgSrc.substring(0, ImgSrc.length - 1) + selectImg + "." + ImgArray[ImgArray.length - 1];
            }

            if (document.getElementById(divId + "_" + i) != null)
                document.getElementById(divId + "_" + i).style.display = "";
        }
        else {

            if ((ImgArray[ImgArray.length - 2].substring(ImgArray[ImgArray.length - 2].length, ImgArray[ImgArray.length - 2].length - ImgSize)) == selectImg) {
                Img.src = ImgSrc.substring(0, ImgSrc.length - (selectImg.length + 1)) + "." + ImgArray[ImgArray.length - 1];
            }

            if (selectedid != null && i == selectedid) {
            } else {
                if (document.getElementById(divId + "_" + i) != null)
                    document.getElementById(divId + "_" + i).style.display = "none";
            }
        }
    }
}

function div_img_control_hit_main(divId, imgId, allcnt, Id, selectImg, selectedid, type) {
    clearTimeout(OBJ_DELAY);
    for (i = 1; i < allcnt + 1; i++) {
        var ImgSize = selectImg.length;

        if (document.getElementById(imgId + "_" + i) != null) {
            var Img = document.getElementById(imgId + "_" + i);
            var ImgArray = Img.src.split(".");
            var ImgSrc = "";

            for (j = 0; j < ImgArray.length - 1; j++) {
                ImgSrc += ImgArray[j] + ".";
            }
        }

        if (i == Id) {
            if ((ImgArray[ImgArray.length - 2].substring(ImgArray[ImgArray.length - 2].length, ImgArray[ImgArray.length - 2].length - ImgSize)) != selectImg) {
                Img.src = ImgSrc.substring(0, ImgSrc.length - 1) + selectImg + "." + ImgArray[ImgArray.length - 1];
            }

            if (document.getElementById(divId + "_" + i) != null)
                document.getElementById(divId + "_" + i).style.display = "";

            if (document.getElementById("hidHit_h_code_" + type)) {
                var h_code = document.getElementById("hidHit_h_code_" + type).value;
                var h_name = document.getElementById("hidHit_h_name_" + type).value;
                var st_name = document.getElementById("hidHit_st_name_" + type).value;
                var h_img = document.getElementById("hidHit_h_img_" + type).value;
                var tot_price = document.getElementById("hidHit_tot_price_" + type).value;
                switch (type) {
                    case "Seoul":
                    case "Kyunggi":
                    case "Kangwon":
                    case "Chungchung":
                    case "Gyeongsang":
                    case "Jeonra":
                    case "JejuA": document.getElementById("hit_img1").innerHTML =
					"<p id='img'><a href='../reservation/reservation_input.aspx?h_code=" + h_code + "'><img src='" + h_img + "' /></a></p>" +
					"<p id='zone'>[" + st_name + "]</p>" +
					"<p id='name'>" + h_name + "</p>" +
					"<p id='pri'><img src='http://image.bico.jp/Site/100010/ko/v2/img/won_org.gif' />" + tot_price + "</p>";
                        break;

                    case "Busan":
                    case "Kyungju":
                    case "Seolak":
                    case "Kangreung":
                    case "Inchen":
                    case "JejuT": document.getElementById("hit_img2").innerHTML =
					"<p id='img'><a href='../reservation/reservation_input.aspx?h_code=" + h_code + "'><img src='" + h_img + "' /></a></p>" +
					"<p id='zone'>[" + st_name + "]</p>" +
					"<p id='name'>" + h_name + "</p>" +
					"<p id='pri'><img src='http://image.bico.jp/Site/100010/ko/v2/img/won_org.gif' />" + tot_price + "</p>";
                        break;
                }
            }
        }
        else {

            if ((ImgArray[ImgArray.length - 2].substring(ImgArray[ImgArray.length - 2].length, ImgArray[ImgArray.length - 2].length - ImgSize)) == selectImg) {
                Img.src = ImgSrc.substring(0, ImgSrc.length - (selectImg.length + 1)) + "." + ImgArray[ImgArray.length - 1];
            }

            if (selectedid != null && i == selectedid) {
            } else {
                if (document.getElementById(divId + "_" + i) != null)
                    document.getElementById(divId + "_" + i).style.display = "none";
            }
        }
    }
}

function div_img_hidden_control_delay(divId, imgId, selectImg) {
    OBJ_DELAY = setTimeout("div_img_hidden_control('" + divId + "','" + imgId + "','" + selectImg + "')", 100);
}

function div_img_hidden_control(divId, imgId, selectImg) {
    var ImgSize = selectImg.length;

    document.getElementById(divId).style.display = "none";

    if (document.getElementById(imgId) != null) {
        var Img = document.getElementById(imgId);
        var ImgArray = Img.src.split(".");
        var ImgSrc = "";

        for (j = 0; j < ImgArray.length - 1; j++) {
            ImgSrc += ImgArray[j] + ".";
        }

        document.getElementById(imgId).src = ImgSrc.substring(0, ImgSrc.length - (selectImg.length + 1)) + "." + ImgArray[ImgArray.length - 1];
    }
}

function doIfr() {
    try {
        document.getElementById('ifr_body2').src = 'http://www.jejuair.net/jejuair/tourinfo/iframe.jsp?' + document.body.scrollHeight + "&" + document.body.scrollWidth;
    }
    catch (ex) {
    }
    try {
        parent.document.getElementById('ifr_body2').src = 'http://www.jejuair.net/jejuair/tourinfo/iframe.jsp?' + (document.body.scrollHeight + 150) + "&" + document.body.scrollWidth;
    }
    catch (ex) {
    }
}

function Text_Split(text, split_txt, id, num) {
    for (var i = 0; i < num; i++) {
        document.getElementById(id + (i + 1)).value = text.split(split_txt)[i];
    }
}


function mm_over(obj) {
    var ImgArray = obj.src.split('.');
    var ImgSrc = "";
    for (i = 0; i < ImgArray.length - 1; i++) {
        ImgSrc += ImgArray[i];

        if (i != ImgArray.length - 2)
            ImgSrc = ImgSrc + ".";
    }
    obj.src = ImgSrc + "_o." + ImgArray[ImgArray.length - 1];
}
function mm_out(obj) {
    var ImgArray = obj.src.split('.');
    var ImgSrc = "";
    for (i = 0; i < ImgArray.length - 1; i++) {
        ImgSrc += ImgArray[i];

        if (i != ImgArray.length - 2)
            ImgSrc = ImgSrc + ".";
    }
    obj.src = ImgSrc.substring(0, ImgSrc.length - 2) + "." + ImgArray[ImgArray.length - 1];
}

function image_click(id, img, id2, id3) {
    document.getElementById(id).src = img;

    if (id2 != null) {
        if (id2.substring(0, 10) == "hidMainStr") {
            document.getElementById(id).width = 335;
            document.getElementById(id).height = 423;
            document.getElementById("trExplanation").style.display = "none";
        }
        else {
            document.getElementById(id).width = 455;
            document.getElementById(id).height = 290;
            document.getElementById("trExplanation").style.display = "block";
        }
    }

    if (id3 != null && id3 != "")
        document.getElementById("spnExplanation").innerHTML = document.getElementById(id3).value.replace('<br/>', '').replace('<br/>', '');

    if (id2 != null && id2 != "")
        document.getElementById("spnExplanation1").innerHTML = document.getElementById(id2).value.replace('<br/>', '').replace('<br/>', '');
}

function weekend_search(week, weekend, location1) {
    if (week == null)
        week = 0;

    if (weekend == null)
        weekend = 5;

    if (location1 == null)
        location1 = "112";

    var now = new Date();
    var day = now.getDay(); //ÀÏ¿äÀÏ=0,¿ù¿äÀÏ=1,...,Åä¿äÀÏ=6   
    var year = now.getFullYear();
    var month = now.getMonth() + 1; // 1¿ù=0,12¿ù=11ÀÌ¹Ç·Î 1 ´õÇÔ

    if (("" + month).length == 1)
        month = "0" + month;

    week = week * 7;

    //var date = now.getDate() + (week + weekend - day);
    var checkinDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + week + weekend - day);
    year = String(checkinDate.getFullYear());
    month = "0" + String(checkinDate.getMonth() + 1);
    date = "0" + String(checkinDate.getDate());
    month = month.substr(month.length - 2, 2);
    date = date.substr(date.length - 2, 2);
    //    var date1 = now.getDate() + (week + weekend - day + 1);

    //    if (("" + date).length== 1)
    //        date = "0" + date;
    //        
    //    if (("" + date1).length == 1)
    //        date1 = "0" + date1;

    var checkin = year + "-" + month + "-" + date;

    //var checkout = year + "-" + month + "-" + date1;

    var checkoutDate = new Date(Number(year), Number(month) - 1, Number(date) + 1);
    month = "0" + String(checkoutDate.getMonth() + 1);
    date = "0" + String(checkoutDate.getDate());
    month = month.substr(month.length - 2, 2);
    date = date.substr(date.length - 2, 2);
    var checkout = String(checkoutDate.getFullYear()) + "-" + month + "-" + date;

    top.location.href = "../reservation/hotel_search_list.aspx?checkindate=" + checkin + "&checkoutdate=" + checkout + "&OnlyBlock=1&no_room_type=1&type=today&location1=" + location1 + "&PgSize=10000&week=" + (week / 7) + "&weekend=" + weekend;
}
