$(document).ready(function() {
    var k = true;
    function c() {
        $("#panel").animate({
            bottom: "-395px"
        }, 500, function() {})
        }
    window.setTimeout(c, 1000, true);
    if (navigator.platform == "iPad" || navigator.platform == "iPhone" || navigator.platform == "iPod") {
        k = false;
        $("#panel").css("display", "none")
        }
    if (k) {
        if (window.location.pathname == "/") {
            var e = false;
            var g = window.setInterval(d, 10000)
            }
    }
    function d() {
        if (!e) {
            /*$("#panel").effect("bounce", {
                times: 1,
                distance: 80,
                direction: "up"
            }, 1000);*/
            window.clearInterval(g)
            }
    }
    $("#panel").click(function() {
        e = true
    });
    var h = -40;
	var flag = 0;
	var flag2 = 0;

    $("#panel-tab-btn").click(function(m) {
        e = true;
        m.preventDefault();

		if(flag == 0){
			$('.slideFooter').css('overflow','visible');
			flag2 = 1;
			flag = 1;
		}else{
			//$('.slideFooter').css('overflow','hidden');
			flag = 0;
			flag2 = 0;
		}

        $("#panel").animate({
            bottom: h
        }, 800, "linear", function() {
            if (h == -40) {
                h = -400;
                $("#panel-tab-img").attr("src", $("#panel-tab-img").attr("src").replace("open", "close"))
                } else {
                h = -40;
                $("#panel-tab-img").attr("src", $("#panel-tab-img").attr("src").replace("close", "open"))
                }
			
				if(flag2 == 0){
					//$('.slideFooter').css('overflow','hidden');	
				}

        })
        });
    var b = {
        over: l,
        timeout: 50,
        out: i
    };
   
     //$('#panel .panel_sm').hoverIntent(b);

    function l() {
        var o = $(this);
        var m = o.position();
        var n = m.left - 28;
        $("#panelsm_tooltip").css("left", n);
        $("#panelsm_tooltip #tooltext").html('<img src="/utilities/fntimg.php?t=ms&s=12&c=dfd1b9&str=' + $(this).attr("id") + '">');
        $("#panelsm_tooltip").animate({
            opacity: "show",
            filter: "",
            top: "-30"
        }, "fast")
        }
    function i() {
        $("#panelsm_tooltip").animate({
            opacity: "hide",
            filter: "",
            top: "-40"
        }, "fast")
        }
    var j = $("#panel #panelzip").val();
    $("#panel #panelzip").click(function() {
        if ($(this).val() == j) {
            $(this).val("")
            }
    });
    $("#panel #panelzipsubmit").click(function() {
        if ($("#panel #panelzip").val() != "") {
            window.location = "/locations/search.php?a=" + $("#panel #panelzip").val()
            }
    });
    $(".hovervideo").click(function() {
        $("#dialog-message").empty();
        var m = $(this).parents(".hover_video_holder").attr("id");
        f(m)
        });
    function f(n) {
        $("html, body").animate({
            scrollTop: 0
        }, "slow");
        $.ajaxSetup({
            cache: false
        });
        var m = "/cinema/cinema.php";
        $.post(m, {
            id: n
        }, function(o) {
            $("#dialog-message").html(o);
            a()
            }, "html")
        }
    $("#dialog-overlay, #closebtn").click(function() {
        $("#dialog-overlay, #dialog-box").hide();
        $("#dialog-message").empty();
        return false
    });
    $(window).resize(function() {
        if (!$("#dialog-box").is(":hidden")) {
            a()
            }
    });
    function a() {
        var o = $(document).height();
        var p = $(window).width();
        var n = 50;
        var m = (p / 2) - ($("#dialog-box").width() / 2);
        $("#dialog-overlay").css({
            height: o,
            width: p
        }).show();
        $("#dialog-box").css({
            top: n,
            left: m
        }).show()
        }
});
