
function showPop(no) {
    document.getElementById("popLayer" + no).style.display = "block";
}
function closePop(no) {
    document.getElementById("popLayer" + no).style.display = "none";
}

function tabSwap(num) {
    for (i = 1; i <= 2; i++) {
        document.getElementById("ipxShowBox" + i).style.display = "none";
        document.getElementById("multi" + i).src = "/Images/member/tab_check_id0" + i + "_off.gif";
    }
    document.getElementById("ipxShowBox" + num).style.display = "block";
    document.getElementById("multi" + num).src = "/Images/member/tab_check_id0" + num + "_on.gif";
}

$(function () {
    function btnMore() {
        $(".moreBtWrap").each(function () {
            var btImgWidth = $(this).find(".btnMore img").outerWidth();
            $(this).find("> .pullDown").css({ 'margin-right': btImgWidth });
        })
    }
    $('.moreBtWrap > .btnMore img').load(btnMore);
    btnMore();
});

function areaMap(id) {
    for (i = 1; i < 8; i++) {
        if (i == id) {
            document.getElementById("tabArea0" + i).style.display = "block";
            document.getElementById("btn" + i).src = "/Images/theater/tab_area0" + i + "_on.gif";
        } else {
            document.getElementById("tabArea0" + i).style.display = "none";
            document.getElementById("btn" + i).src = "/Images/theater/tab_area0" + i + "_off.gif";
        }
    }
}

function mSch(id) {
    for (i = 1; i < 3; i++) {
        if (i == id) {
            document.getElementById("schTab0" + i).style.display = "block";
            document.getElementById("sbtn" + i).src = "/Images/theater/tab_schedule0" + i + "_on.gif";
        } else {
            document.getElementById("schTab0" + i).style.display = "none";
            document.getElementById("sbtn" + i).src = "/Images/theater/tab_schedule0" + i + "_off.gif";
        }
    }
}

$.fn.imageSwap = function (before, after) {
    this.attr({ "src": this.attr("src").replace(before, after) });
};

function memInfo(id) {
    $("#container .sectionA:visible").each(function () {
        var $section = $(this);
        if ($section.find("#memTab0" + id).length > 0) {
            $section.find("ul.tab").children().each(function (i) {
                var index = i + 1;
                if (index == id) {
                    $section.find("#memTab0" + index, $section).show();
                    $(this).find("#btn" + index, $section).imageSwap("_off", "_on");
                } else {
                    $section.find("#memTab0" + index, $section).hide();
                    $(this).find("#btn" + index, $section).imageSwap("_on", "_off");
                }
            });
        }
    });
}

function cardInfo(id) {
    $("#container .sectionA:visible").each(function () {
        var $section = $(this);
        if ($section.find("#cardTab0" + id).length > 0) {
            $section.find("ul.tab").children().each(function (i) {
                var index = i + 1;
                if (index == id) {
                    $section.find("#cardTab0" + index, $section).show();
                    $(this).find("#cbtn" + index, $section).imageSwap("_off", "_on");
                } else {
                    $section.find("#cardTab0" + index, $section).hide();
                    $(this).find("#cbtn" + index, $section).imageSwap("_on", "_off");
                }
            });
        }
    });
}

function storyScore(id) {
    $("#container .sectionA:visible").each(function () {
        var $section = $(this);
        if ($section.find("#sTab0" + id).length > 0) {
            $section.find("ul.tab").children().each(function (i) {
                var index = i + 1;
                if (index == id) {
                    $section.find("#sTab0" + index, $section).show();
                    $(this).find("#sBtn" + index, $section).imageSwap("_off", "_on");
                } else {
                    $section.find("#sTab0" + index, $section).hide();
                    $(this).find("#sBtn" + index, $section).imageSwap("_on", "_off");
                }
            });
        }
    });
}

function movieTab(id) {
    $("#container .sectionA:visible").each(function () {
        var $section = $(this);
        if ($section.find("#mTab0" + id).length > 0) {
            $section.find("ul.tab").children().each(function (i) {
                var index = i + 1;
                if (index == id) {
                    $section.find("#mTab0" + index, $section).show();
                    $(this).find("#mBtn" + index, $section).imageSwap("_off", "_on");
                } else {
                    $section.find("#mTab0" + index, $section).hide();
                    $(this).find("#mBtn" + index, $section).imageSwap("_on", "_off");
                }
            });
        }
    });
}

function snsTab(id) {
    $("#container .sectionA:visible").each(function () {
        var $section = $(this);
        if ($section.find("#sTab0" + id).length > 0) {
            $section.find("ul.tab").children().each(function (i) {
                var index = i + 1;
                if (index == id) {
                    $section.find("#sTab0" + index, $section).show();
                    $(this).find("#sBtn" + index, $section).imageSwap("_off", "_on");
                } else {
                    $section.find("#sTab0" + index, $section).hide();
                    $(this).find("#sBtn" + index, $section).imageSwap("_on", "_off");
                }
            });
        }
    });
}

function rsvList(id) {
    for (i = 1; i < 3; i++) {
        if (i == id) {
            document.getElementById("rsvTab0" + i).style.display = "block";
            document.getElementById("rsvbtn" + i).src = "/Images/member/tab_rsv0" + i + "_on.gif";
        } else {
            document.getElementById("rsvTab0" + i).style.display = "none";
            document.getElementById("rsvbtn" + i).src = "/Images/member/tab_rsv0" + i + "_off.gif";
        }
    }
}


function mNotice(id) {
    for (i = 1; i < 3; i++) {
        if (i == id) {
            document.getElementById("tabNo0" + i).style.display = "block";
            document.getElementById("mbtn" + i).src = "/Images/main/tab_notice0" + i + "_on.gif";
        } else {
            document.getElementById("tabNo0" + i).style.display = "none";
            document.getElementById("mbtn" + i).src = "/Images/main/tab_notice0" + i + "_off.gif";
        }
    }
}

function pointTab(id) {
    for (i = 1; i < 5; i++) {
        if (i == id) {
            document.getElementById("ptTab0" + i).style.display = "block";
            document.getElementById("ptbtn" + i).src = "/Images/member/tab_point0" + i + "_on.gif";
        } else {
            document.getElementById("ptTab0" + i).style.display = "none";
            document.getElementById("ptbtn" + i).src = "/Images/member/tab_point0" + i + "_off.gif";
        }
    }
}

function memCard(id) {
    for (i = 1; i < 3; i++) {
        if (i == id) {
            document.getElementById("memCardTab0" + i).style.display = "block";
            document.getElementById("memCardbtn" + i).src = "/Images/member/tab_memcard0" + i + "_on.gif";
        } else {
            document.getElementById("memCardTab0" + i).style.display = "none";
            document.getElementById("memCardbtn" + i).src = "/Images/member/tab_memcard0" + i + "_off.gif";
        }
    }
}

function yearCnt(id) {
    for (i = 1; i < 3; i++) {
        if (i == id) {
            $("#yearCntTab0" + i, "div.sectionA:visible").each(function () { this.style.display = "block"; })
            $("#yearCntbtn" + i, "div.sectionA:visible").each(function () { this.src = "/Images/member/tab_count0" + i + "_on.gif"; });
        } else {
            $("#yearCntTab0" + i, "div.sectionA:visible").each(function () { this.style.display = "none"; });
            $("#yearCntbtn" + i, "div.sectionA:visible").each(function () { this.src = "/Images/member/tab_count0" + i + "_off.gif"; });
        }
    }
}

function recruitTabs(id) {
    for (i = 1; i < 3; i++) {
        if (i == id) {
            document.getElementById("recruitTab0" + i).style.display = "block";
            document.getElementById("recruitbtn" + i).src = "/Images/company/tab_recruit0" + i + "_on.gif";
        } else {
            document.getElementById("recruitTab0" + i).style.display = "none";
            document.getElementById("recruitbtn" + i).src = "/Images/company/tab_recruit0" + i + "_off.gif";
        }
    }
}

$(document).ready(function () {
    $(".pngOver a").each(function () {
        var _self = $(this);
        var image = _self.children("img");
        var imgsrc = $(image).attr("src");

        // add mouseover
        _self.mouseover(function () {
            var on = imgsrc.replace(/_off.png/, "_on.png");
            $(image).attr("src", on);
        });

        // add mouseout
        _self.mouseout(function () {
            $(image).attr("src", imgsrc);
        });
    });
    $(".gifOver a").each(function () {
        var image = $(this).children("img");
        var imgsrc = $(image).attr("src");

        // add mouseover
        $(this).mouseover(function () {
            var on = imgsrc.replace(/_off.gif/, "_on.gif");
            $(image).attr("src", on);
        });

        // add mouseout
        $(this).mouseout(function () {
            $(image).attr("src", imgsrc);
        });
    });

    // location Active
    $('.locTrigger').click(function () {
        $(this).parent().parent().children('.locDepth').show();
        /*
        $('.locDepth li').click(function() {
        $(this).parent().hide();
        });
        */
        return false;
    });

    // total view
    var on = function () { this.src = this.src.replace("_off", "_on"); }
    var off = function () { this.src = this.src.replace("_on", "_off"); }

    $('.allViewTrigger').click(function () {
        var totalWrap = $(this).siblings('.viewerWrap');
        if (totalWrap.css("display") == "block") {
            $(this).find("img").each(off)
        } else {
            $(this).find("img").each(on)
        }
        $(totalWrap).toggle();
        $('.activeDepth').hover(function () {
            $(this).find(".detailWrap").toggle();
        });
    });

    $('.showTimeWrap li a').click(function () {
        $(this).siblings('.localWrap').toggle();
        //		$(this).parent("li").siblings('li').find('.localWrap').hide().siblings("a").removeClass('current');
        $(this).parent("li").siblings('li').find('.localWrap').hide().end().find("a").removeClass('current');
        $(this).toggleClass('current');
        return false;
    });

    $('.cardList li a').click(function () {
        $(this).siblings('.cardView').toggle();
        $(this).siblings('.cardView').children('.close').click(function () {
            $(this).parent().hide();
        });
        return false;
    });

    $('.depth01 a').live("click", function () {
        var $item = $(this);
        if ($item.parent().is(".depth01")) {
            if ($item.is(".current")) {
                $item.removeClass("current");
                $('.theater .depth01').children("ul").hide();
            } else {
                $('.theater .depth01').children("a").removeClass("current");
                $('.theater .depth01').children("ul").hide();
                $item.addClass("current");
                $item.parent().children("ul").show();
            }
            $('.depth01 .depth02').find("a").removeClass("current");
        } else {
            $('.theater .depth02').find("a").removeClass("current");
            $item.addClass("current");
        }
        $("#movie_list2").data("tsb").update();

        return false;
    });

    //	$('.depth01 a').live("click", function() {
    //		
    //		$(".theater").children(".depth01").children("a").removeClass("current");
    //		$('.theater .depth01 .depth02').children("li").find("a").removeClass("current");
    //		$(this).siblings('.depth02').toggle();
    //		$(this).parent(".depth01").siblings('li').find('.depth02').hide().end().find("a").removeClass('current');
    //		$(this).toggleClass('current');
    //		// 추가된 부분입니다.
    //		$("#movie_list2").data("tsb").update();
    //		return false;
    //	}); 

});

$(".storeList tr").mouseover(function () { $(this).css("background", "#f9f9f9") }).mouseout(function () { $(this).css("background", "#fff") });


$(document).ready(function () {
    $(".btnView").click(function () {
        $(".storeView").css("display", "block");
        $(".btnView").css("color", "#662d91");
    });

    $(".btnClose").click(function () {
        $(".storeView").css("display", "none");
        $(".btnView").css("color", "#4f4d4d");
    });

    $("#additional_comment").children("p").click(function () {
        $(this).hide();
    });

    // poster button Active
    $('.posterList li, .movieDetail .thumb, .poster .thumb, .scoreTip').hover(function () {
        $(this).children('.ovWrap, .overBtn, .txt').show();
    },
		function () {
		    $(this).children('.ovWrap, .overBtn, .txt').hide();
		}
	);

});


$(function ($) {
    // Input Clear
    var iText = $('.labelBox>.iLabel').next('.iText');
    $('.labelBox>.iLabel').css('position', 'absolute').css('margin-top', '5' + "px").css('margin-left', '6' + "px");
    iText
		.focus(function () {
		    $(this).prev('.iLabel').css('visibility', 'hidden');
		})
		.blur(function () {
		    if ($(this).val() == '') {
		        $(this).prev('.iLabel').css('visibility', 'visible');
		    } else {
		        $(this).prev('.iLabel').css('visibility', 'hidden');
		    }
		})
		.change(function () {
		    if ($(this).val() == '') {
		        $(this).prev('.iLabel').css('visibility', 'visible');
		    } else {
		        $(this).prev('.iLabel').css('visibility', 'hidden');
		    }
		})
		.blur();
});


