$(function() {
    var theater_id = $("#theater_id").attr("value");
    var userName = "";
    var userEmail = "";
    //southglen promo
    if ((theater_id != "11" && theater_id != "29" && theater_id != "12") && $("body").attr("id") === "home") {
        var html = "<div id=\"promo_2\">" +
			        "<a href=\"/gifts-and-events/\" class=\"promo_gift_cards\">" +
			        "The perfect gift for any occasion! Go...." +
        //"<img src=\"/img/ironman_promo.png\" width=\"336\" height=\"165\" alt=\"Meet the Heroes of Iron Man 2 - Friday &amp; Saturday May 7-8 From 6pm - 10pm\" />" +
			        "</a>" +
		        "</div>";
        $("#right").append(html);
    }

    //    if ((
    //        theater_id == "17" ||
    //        theater_id == "28" ||
    //        theater_id == "2" ||
    //        theater_id == "4" ||
    //        theater_id == "5" ||
    //        theater_id == "6" ||
    //        theater_id == "13" ||
    //        theater_id == "14" ||
    //        theater_id == "25" ||
    //        theater_id == "19" ||
    //        theater_id == "20" ||
    //        theater_id == "21" ||
    //        theater_id == "22" ||
    //        theater_id == "25" ||
    //        theater_id == "11" ||
    //        theater_id == "23" ||
    //        theater_id == "24" ||
    //        theater_id == "26" ||
    //        theater_id == "29" ||
    //        theater_id == "30" ||
    //        theater_id == "31" ||
    //        theater_id == "32" ||
    //        theater_id == "33" ||
    //        theater_id == "36" ||
    //        theater_id == "40" ||
    //        theater_id == "44" ||
    //        theater_id == "46" ||
    //        theater_id == "47" ||
    //        theater_id == "50" || 
    //        
    //        theater_id == null) && $("body").attr("id") === "home") {
    //    }
    //    else if ((theater_id != "48" && theater_id != "3" && theater_id != "18" && theater_id != "37") && $("body").attr("id") === "home") {
    //        var html = "<div id=\"promo_2\">" +
    //			        "<a href=\"/tickets-and-showtimes/\">" +
    //                    "<img src=\"/img/promos-sidebar_TOY-STORY_3D.jpg\" width=\"336\" height=\"478\" alt=\"Toy Story 3D!\" />" +
    //			        "</a>" +
    //		        "</div>";
    //        $("#right").append(html);
    //    } else if ($("body").attr("id") === "home") {
    //        var html = "<div id=\"promo_2\">" +
    //			        "<a href=\"/tickets-and-showtimes/\">" +
    //                    "<img src=\"/img/promos-sidebar_TOY-STORY.jpg\" width=\"336\" height=\"478\" alt=\"Toy Story!\" />" +
    //			        "</a>" +
    //		            "</div>";
    //        $("#right").append(html);
    //    }

    $.preloadCssImages();

    $(".wrap label").inFieldLabels({
        fadeOpacity: 0,
        fadeDuration: 100
    });

    $('input.date').DatePicker({
        format: 'A, B d, Y',
        date: $('input.date').val(),
        current: $('input.date').val(),
        starts: 0,
        position: 'bottom',
        onBeforeShow: function() {
            $('input.date').DatePickerSetDate($('input.date').val(), true);
        },
        onChange: function(formated, dates) {
            $('input.date').val(formated);
            $('input.date').DatePickerHide();
            __doPostBack($('input.date').attr("id"), 'ChangeDate|' + $('input.date').val());
        }
    });

    $("#location_search .change_locaiton").keypress(function(e) {
        if (e.keyCode == 13 || e.keyCode == 10) {
            var getBtnId = $("#location_search .go").attr("id");
            __doPostBack(getBtnId, 'ChangeLocation|' + $("#location_search .change_locaiton").val());
            return false;
        }
    });

    $("#find_location .change_locaiton").keypress(function(e) {
        if (e.keyCode == 13 || e.keyCode == 10) {
            var getBtnId = $("#find_location .go").attr("id");
            __doPostBack(getBtnId, 'ChangeLocation|' + $("#find_location .change_locaiton").val());
            return false;
        }
    });

    $("#your_showtimes .movie:first,#home #coming_attractions .attraction:first").css("border-top", "1px dotted #434343");
    $("#footer ul li:last").css("background", "none");
    $(".movie dl").each(function() {
        $("dd:last", this).css("background", "none");
    });

    $(".calendar").click(function() {
        $(".date").click();
    });

    $('a[rel="external"]').click(function() {
        window.open($(this).attr("href"));
        return false;
    });

    if ($(".change_theater").length) {
        var current_date = $("#currentdate").attr("value").split(" ");
        //var current_date = $(".showtime_dates option:selected").attr("value").split(" ");
        current_date = current_date[0].replace("/", "-").replace("/", "-");

        $("#home a.change_theater").click(function() {
            var h = $("#find_theater").outerHeight() + 40;
            $("#left .inner").animate({ height: h }, 800);
            $("#location_set").fadeOut(function() {
                $("#find_theater").fadeIn();
            });
            return false;
        });

        $("#tickets_and_showtimes .change_theater").click(function() {
            $("#theater_showtimes").animate({ height: 0, opacity: 0 }, 800, function() {
                $(this).css("display", "none");
            });
            $("#location_set").animate({ height: 108, opacity: 0 }, 800, function() {
                $(this).css("display", "none");
                $("#find_theater").fadeIn();
            });
            return false;
        });
    }
    $("a.info_prices").click(function() {
        $("#basic-modal-content").modal({
            maxWidth: 620,
            minHeight: 550,
            positiontype: "absolute",
            overlayClose: true, onShow: function() {
                $("#simplemodal-container").append("<div class=\"loading\"></div>");
                $("#simplemodal-container").addClass("theater_info");
                var theaterId = $("#theater_id").attr("value");
                $.ajax({
                    type: "GET",
                    url: "/api/theater.svc/gettheater/" + theater_id + "",
                    dataType: "json",
                    success: function(theater) {
                        var contentString = '<div id="theater_content">' +
						'<h2>' + theater.Name + '</h2><p>' + theater.Description + '</p>' +
						'<div id=\"price_list\">' +
						'<h2>Ticket Prices</h2>' +
						'<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" width=\"560\">' +
						'</table>' +
						'<p style=\"margin-top:10px;\">A $1 service fee will be charged per ticket purchased online.</p>' +
						'</div>' +
	                '</div>';
                        $("#basic-modal-content").append(contentString);
                        $.each(theater.Prices, function(i, item) {
                            $('<tr><td width=\"520\" style=\"padding:5px 0px 5px 0px;\">' + item.Description + '</td><td align=\"right\">' + item.Price + '</td></tr><tr><td style=\"border-bottom:solid 1px #808080;\" colspan=\"2\"><img src=\"/img/spacer.gif\" alt=\"\" border=\"0\" width=\"1\" height=\"1\" /></td></tr>').appendTo("#price_list table");
                        });
                        //$("#price_list ul li:odd").addClass("odd");
                        $(".loading").remove();
                        $("#simplemodal-container").animate({ height: $('#theater_content').outerHeight() }, 500, function() {
                            $(".simplemodal-close").show();
                            $("#basic-modal-content").css("display", "block");
                        });
                    }
                });
            }
        });
        return false;
    });

    $("a.prices").click(function() {
        $("#basic-modal-content").modal({
            maxWidth: 620,
            minHeight: 200,
            positiontype: "absolute",
            overlayClose: true, onShow: function() {
                $("#simplemodal-container").append("<div class=\"loading\"></div>");
                $("#simplemodal-container").addClass("price_info");
                var theaterId = $("#theater_id").attr("value");
                $.ajax({
                    type: "GET",
                    url: "/api/theater.svc/gettheater/" + theater_id + "",
                    dataType: "json",
                    success: function(theater) {
                        var contentString = '<div id="theater_content">' +
						'<div id=\"price_list\">' +
						'<h2>Ticket Prices</h2>' +
						'<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" width=\"560\">' +
						'</table>' +
						'<p style=\"margin-top:10px;\">A $1 service fee will be charged per ticket purchased online.</p>' +
						'</div>' +
	                '</div>';
                        $("#basic-modal-content").append(contentString);
                        $.each(theater.Prices, function(i, item) {
                            $('<tr><td width=\"520\" style=\"padding:5px 0px 5px 0px;\">' + item.Description + '</td><td align=\"right\">' + item.Price + '</td></tr><tr><td style=\"border-bottom:solid 1px #808080;\" colspan=\"2\"><img src=\"/img/spacer.gif\" alt=\"\" border=\"0\" width=\"1\" height=\"1\" /></td></tr>').appendTo("#price_list table");
                        });
                        //$("#price_list ul li:odd").addClass("odd");					
                        $(".loading").remove();
                        $("#simplemodal-container").animate({ height: $('#theater_content').outerHeight() }, 500, function() {
                            $(".simplemodal-close").show();
                            $("#basic-modal-content").css("display", "block");
                        });

                    }
                });
            }
        });
        return false;
    });

    $("a.show_on_map").click(function() {
        $("#basic-modal-content").modal({
            minHeight: 450,
            positiontype: "absolute",
            overlayClose: true, onShow: function() {
                $("#simplemodal-container").addClass("map");
                var theaterId = $("#theater_id").attr("value");
                $.ajax({
                    type: "GET",
                    url: "/api/theater.svc/gettheater/" + theater_id + "",
                    dataType: "json",
                    success: function(theater) {
                        $(".loading").remove();
                        $("#basic-modal-content").append("<div id=\"map\"></div>");
                        function initialize() {
                            var myLatlng = new google.maps.LatLng(theater.Latitude, theater.Longitude);
                            var myOptions = {
                                zoom: 14,
                                center: myLatlng,
                                mapTypeId: google.maps.MapTypeId.ROADMAP,
                                mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU },
                                backgroundColor: "#000000"
                            }
                            var map = new google.maps.Map(document.getElementById("map"), myOptions);
                            var contentString = '<div id="map_content">' +
					'<div class="left_col">' +
	                '<img src="' + theater.ImageUrl + '" alt="' + theater.Name + '" class="theater" />' +
					'</div>' +
					'<div class="right_col">' +
	                '<h1>' + theater.Name + '</h1>' +
	                '<p>' + theater.Address + '<br/>' + theater.Phone + '</p>' +
	                '<p><a href="/tickets/' + theater.Permalink + '">Showtimes</a>' +
	                '<form action="http://maps.google.com/maps" method="get" target="_blank">' +
	                '<p>Start address: <input type="text" size=30 maxlength=40 name="saddr" id="saddr" value="" /><br>' +
	                '<INPUT value="Get Directions" TYPE="SUBMIT">' +
	                '<input type="hidden" name="daddr" value="' + +'"/>' +
	                '</p>' +
					'</div>' +
	                '</div>';
                            var infowindow = new google.maps.InfoWindow({
                                content: contentString
                            });
                            var marker = new google.maps.Marker({
                                position: myLatlng,
                                map: map,
                                title: 'Uluru (Ayers Rock)'
                            });
                            google.maps.event.addListener(marker, 'click', function() {
                                infowindow.open(map, marker);
                            });
                        }
                        initialize();
                    }
                });
            }
        });
        return false;
    });

    $("#tickets_and_showtimes a.tickets").click(function() {
        var movie_name = $(this).parent().find("h3").html();
        var movie_data = $(this).parent().find(".times").html();
        var disclaimer = "";
        if (theater_id == "7") {
            disclaimer = "<p><small>Premiere balcony seating is available for SELECT showtimes. If you do not see an option to select “Premiere Seating” when purchasing tickets, that showtime is all general seating.</small></p>";
        }
        $("#basic-modal-content").modal({
            maxWidth: 640,
            maxHeight: 150,
            overlayClose: true,
            positiontype: "absolute",
            onShow: function() {
                $("#simplemodal-container").addClass("movie");
                var html = "<div id=\"movie_showtimes\" class=\"clearfix\">" +
			"<div class=\"inner clearfix\">" +
			"<h1 id=\"click_showtimes\" class=\"title\">Click Showtimes for Tickets</h1>" +
			"<div class=\"section clearfix\">" +
			"<h3>" + movie_name + "</h3>" +
			"<dl class='times'>" + movie_data + "</dl>" +
			disclaimer +
			"</div>" +
			"</div>" +
			"</div>";
                $("#basic-modal-content").append(html);
            }
        });
        return false;
    });

    $("a.print_showtimes").click(function() {
        var getHref = $(this).attr("href");
        window.open(getHref, 'print', 'width=700,height=600,screenX=100,screenY=200,top=100,left=200,scrollbars=yes,toolbar=no,location=no');
        return false;
    });

    /* 	replaced with movie detail page

    $("a.movie_title").click(function() {
    var movie_id = $(this).attr("rel");
    var trailerPath = $(this).attr("href");
    $("#basic-modal-content").modal({
    overlayClose: true,
    positiontype: "absolute",
    onShow: function() {
    $("#simplemodal-container").append("<div class=\"loading\"></div>");
    $(".simplemodal-close").hide();
    var contentHeight = $("#basic-modal-content").outerHeight();
    var theater_id = $("#theater_id").attr("value");
    var current_date = $("#currentdate").attr("value").split(" ");
    current_date = current_date[0].replace("/", "-").replace("/", "-");
    var videoPlayer = "";
    if (trailerPath != "#") {
    videoPlayer = "<div id=\"video_player\">" +
    "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"640\" height=\"302\" id=\"myFlashContent\">" +
    "<param name=\"movie\" value=\"/swf/video-player.swf\" />" +
    "<param value=\"noscale\" name=\"scale\">" +
    "<param value=\"true\" name=\"allowfullscreen\">" +
    "<param value=\"tl\" name=\"salign\">" +
    "<param value=\"000000\" name=\"bgcolor\">" +
    "<param value=\"imagePath=&amp;videoPath=" + trailerPath + "&amp;title=&amp;description=&amp;viewInfoButton=false&amp;viewFullscreenButton=false&amp;viewScaleButton=false&amp;viewVolumeControls=true&amp;viewTime=false&amp;viewBigPlayButton=true&amp;viewRightClickMenu=true&amp;mouseHide=true&amp;mouseHideTime=3&amp;doubleClick=false&amp;oneClick=true&amp;spaceKey=true&amp;videoLoop=false&amp;videoAutoPlay=false&amp;videoBufferTime=0.1&amp;tlInterval=100000&amp;soundVolume=0.8&amp;fullSizeView=2&amp;spacing=10&amp;controlHeight=25&amp;volumeLengthW=50&amp;color1=0x2e2e2e&amp;color2=0x000000&amp;alpha1=1&amp;alpha2=1&amp;borderColor=0x555555&amp;borderAlpha=1&amp;timeColor1=0x333333&amp;timeColor2=0x111111&amp;timeAlpha1=1&amp;timeAlpha2=1&amp;timeTextColor1=0xffffff&amp;timeTextColor2=0x888888&amp;scrubberHeight=3&amp;scrubberColor1=0x333333&amp;scrubberAlpha1=1&amp;scrubberColor2=0x88acc4&amp;scrubberAlpha2=1&amp;filterColor=0x0066ff&amp;filterAlpha=1&amp;titleColor=0x88acc4&amp;descriptionColor=0xD3D3D3&amp;infoBackgroundColor=0x000000&amp;infoBackgroundAlpha=0.5\" name=\"flashvars\">" +
    "<!--[if !IE]>-->" +
    "<object type=\"application/x-shockwave-flash\" data=\"/swf/video-player.swf\" width=\"640\" height=\"302\">" +
    "<param value=\"noscale\" name=\"scale\">" +
    "<param value=\"true\" name=\"allowfullscreen\">" +
    "<param value=\"tl\" name=\"salign\">" +
    "<param value=\"000000\" name=\"bgcolor\">" +
    "<param value=\"imagePath=&amp;videoPath=" + trailerPath + "&amp;title=&amp;description=&amp;viewInfoButton=false&amp;viewFullscreenButton=false&amp;viewScaleButton=false&amp;viewVolumeControls=true&amp;viewTime=false&amp;viewBigPlayButton=true&amp;viewRightClickMenu=true&amp;mouseHide=true&amp;mouseHideTime=3&amp;doubleClick=false&amp;oneClick=true&amp;spaceKey=true&amp;videoLoop=false&amp;videoAutoPlay=false&amp;videoBufferTime=0.1&amp;tlInterval=100000&amp;soundVolume=0.8&amp;fullSizeView=2&amp;spacing=10&amp;controlHeight=25&amp;volumeLengthW=50&amp;color1=0x2e2e2e&amp;color2=0x000000&amp;alpha1=1&amp;alpha2=1&amp;borderColor=0x555555&amp;borderAlpha=1&amp;timeColor1=0x333333&amp;timeColor2=0x111111&amp;timeAlpha1=1&amp;timeAlpha2=1&amp;timeTextColor1=0xffffff&amp;timeTextColor2=0x888888&amp;scrubberHeight=3&amp;scrubberColor1=0x333333&amp;scrubberAlpha1=1&amp;scrubberColor2=0x88acc4&amp;scrubberAlpha2=1&amp;filterColor=0x0066ff&amp;filterAlpha=1&amp;titleColor=0x88acc4&amp;descriptionColor=0xD3D3D3&amp;infoBackgroundColor=0x000000&amp;infoBackgroundAlpha=0.5\" name=\"flashvars\">" +
    "<!--<![endif]-->" +
    "<a href=\"http://www.adobe.com/go/getflashplayer\">" +
    "<img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" />" +
    "</a>" +
    "<!--[if !IE]>-->" +
    "</object>" +
    "<!--<![endif]-->" +
    "</object>" +
    "</div>"
    }
    var disclaimer = "";
    if (theater_id == "7") {
    disclaimer = "<p><small>Premiere balcony seating is available for SELECT showtimes. If you do not see an option to select “Premiere Seating” when purchasing tickets, that showtime is all general seating.</small></p>";
    }
    $.ajax({
    type: "GET",
    url: "/api/theater.svc/gettheaterwithmovie/" + theater_id + "/" + movie_id + "/" + current_date + "",
    dataType: "json",
    success: function(theater) {
    var getShowTimes = $("#your_showtimes").find("a[rel=" + movie_id + "]").parents(".movie-block").html(); // Peter edit here 03.23.2010
    var html = videoPlayer +
    "<h2>" + theater.Movies[0].Movie.Title + " <em>(" + theater.Movies[0].Movie.Rating + ")</em></h2>" +
    "<p>" + theater.Movies[0].Movie.SynopsisLong + "</p>" +
    "<div id=\"movie_showtimes\" class=\"movie clearfix\">" +
    "<div class=\"inner clearfix\">" +
    "<h1 id=\"click_showtimes\" class=\"title\">Click Showtimes for Tickets</h1>" +
    "<div class=\"section clearfix\">" +
    "<dl class=\"clearfix\">" +
    getShowTimes +
    "</dl>" +
    disclaimer +
    "</div>" +
    "</div>" +
    "</div>";
    $("#basic-modal-content").css("display", "none").append(html);
    $("#movie_showtimes h3").html(theater.Name); // Peter edit here 03.23.2010
    $("#movie_showtimes h3.new").removeClass("new");
    var contentHeight = $("#basic-modal-content").outerHeight();
    $("#simplemodal-container").animate({ height: contentHeight }, 300, function() {
    $(".simplemodal-close").show();
    $(".loading").remove();
    $("#basic-modal-content").css("display", "block");
    });
    }
    });
    },
    minHeight: 500
    });
    return false;
    });
    */


    $("a.trailer").click(function() {
        var trailerPath = $(this).attr("href");
        $("#basic-modal-content").modal({
            overlayClose: true,
            containerId: "trailer-container",
            positiontype: "absolute",
            onShow: function() {
                $("#trailer-container").append("<div class=\"loading\"></div>");
                $(".simplemodal-close").hide();
                var html = "<div id=\"video_player\">" +
					"<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"640\" height=\"302\" id=\"myFlashContent\">" +
						"<param name=\"movie\" value=\"/swf/video-player.swf\" />" +
						"<param value=\"noscale\" name=\"scale\">" +
						"<param value=\"true\" name=\"allowfullscreen\">" +
						"<param value=\"tl\" name=\"salign\">" +
						"<param value=\"000000\" name=\"bgcolor\">" +
						"<param value=\"imagePath=&amp;videoPath=" + trailerPath + "&amp;title=&amp;description=&amp;viewInfoButton=false&amp;viewFullscreenButton=false&amp;viewScaleButton=false&amp;viewVolumeControls=true&amp;viewTime=false&amp;viewBigPlayButton=true&amp;viewRightClickMenu=true&amp;mouseHide=true&amp;mouseHideTime=3&amp;doubleClick=false&amp;oneClick=true&amp;spaceKey=true&amp;videoLoop=false&amp;videoAutoPlay=false&amp;videoBufferTime=0.1&amp;tlInterval=100000&amp;soundVolume=0.8&amp;fullSizeView=2&amp;spacing=10&amp;controlHeight=25&amp;volumeLengthW=50&amp;color1=0x2e2e2e&amp;color2=0x000000&amp;alpha1=1&amp;alpha2=1&amp;borderColor=0x555555&amp;borderAlpha=1&amp;timeColor1=0x333333&amp;timeColor2=0x111111&amp;timeAlpha1=1&amp;timeAlpha2=1&amp;timeTextColor1=0xffffff&amp;timeTextColor2=0x888888&amp;scrubberHeight=3&amp;scrubberColor1=0x333333&amp;scrubberAlpha1=1&amp;scrubberColor2=0x88acc4&amp;scrubberAlpha2=1&amp;filterColor=0x0066ff&amp;filterAlpha=1&amp;titleColor=0x88acc4&amp;descriptionColor=0xD3D3D3&amp;infoBackgroundColor=0x000000&amp;infoBackgroundAlpha=0.5\" name=\"flashvars\">" +
						"<!--[if !IE]>-->" +
						"<object type=\"application/x-shockwave-flash\" data=\"/swf/video-player.swf\" width=\"640\" height=\"302\">" +
						"<param value=\"noscale\" name=\"scale\">" +
						"<param value=\"true\" name=\"allowfullscreen\">" +
						"<param value=\"tl\" name=\"salign\">" +
						"<param value=\"000000\" name=\"bgcolor\">" +
						"<param value=\"imagePath=&amp;videoPath=" + trailerPath + "&amp;title=&amp;description=&amp;viewInfoButton=false&amp;viewFullscreenButton=false&amp;viewScaleButton=false&amp;viewVolumeControls=true&amp;viewTime=false&amp;viewBigPlayButton=true&amp;viewRightClickMenu=true&amp;mouseHide=true&amp;mouseHideTime=3&amp;doubleClick=false&amp;oneClick=true&amp;spaceKey=true&amp;videoLoop=false&amp;videoAutoPlay=false&amp;videoBufferTime=0.1&amp;tlInterval=100000&amp;soundVolume=0.8&amp;fullSizeView=2&amp;spacing=10&amp;controlHeight=25&amp;volumeLengthW=50&amp;color1=0x2e2e2e&amp;color2=0x000000&amp;alpha1=1&amp;alpha2=1&amp;borderColor=0x555555&amp;borderAlpha=1&amp;timeColor1=0x333333&amp;timeColor2=0x111111&amp;timeAlpha1=1&amp;timeAlpha2=1&amp;timeTextColor1=0xffffff&amp;timeTextColor2=0x888888&amp;scrubberHeight=3&amp;scrubberColor1=0x333333&amp;scrubberAlpha1=1&amp;scrubberColor2=0x88acc4&amp;scrubberAlpha2=1&amp;filterColor=0x0066ff&amp;filterAlpha=1&amp;titleColor=0x88acc4&amp;descriptionColor=0xD3D3D3&amp;infoBackgroundColor=0x000000&amp;infoBackgroundAlpha=0.5\" name=\"flashvars\">" +
						"<!--<![endif]-->" +
							"<a href=\"http://www.adobe.com/go/getflashplayer\">" +
								"<img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" />" +
							"</a>" +
						"<!--[if !IE]>-->" +
						"</object>" +
						    "<!--<![endif]-->" +
					    "</object>" +
					"</div>";
                $("#basic-modal-content").css("display", "none").append(html);
                $(".simplemodal-close").show();
                $(".loading").remove();
                $("#basic-modal-content").css("display", "block");
            },
            minHeight: 302
        });
        return false;
    });

    /*
    $("a.view_trailer,a.view_synopsis,.movie_poster").click(function() {
    $(this).parents(".movie").find(".movie_title").click();
    return false;
    });
    */


    if (theater_id == "7") {
        $(".movie dl.times dd a").click(function() {
            var href = $(this).attr("href");
            $("#basic-modal-content").modal({
                maxWidth: 300,
                maxHeight: 100,
                overlayClose: true,
                positiontype: "absolute",
                onShow: function() {
                    $("#simplemodal-container").addClass("disclaimer");
                    var html = "<p>Premiere balcony seating is available for SELECT showtimes. If you do not see an option to select &ldquo;Premiere Seating&rdquo; when purchasing tickets, that showtime is all general seating.</p><p><a href=" + href + " class=\"btn continue\">Continue</a></p>";
                    $("#basic-modal-content").append(html);
                }
            });
            return false;
        });
    }

    $("#showtimes .changetheater").click(function() {
        $("#changetheater").slideDown(300);
    });

    $('.PrintAtHome').qtip({
        content: 'Print Tickets At Home',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.Kiosk').qtip({
        content: 'Ticket Kiosk',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.GameRoom').qtip({
        content: 'Gaming Room',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.WheelChair').qtip({
        content: 'Wheelchair Accessible',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.WheelChair').qtip({
        content: 'Wheelchair Accessible',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.ListeningDevices').qtip({
        content: 'Listening Devices Available',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.PartyRoom').qtip({
        content: 'Party Room!',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.AllStadiumSeating').qtip({
        content: 'All Stadium Seating',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });

    $('.G').qtip({
        content: 'General Audiences - All ages admitted',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.PG').qtip({
        content: 'Parental Guidance Suggested - Some material may not be suitable for children',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.PG-13').qtip({
        content: 'Parents Strongly Cautioned - Some material may not be suitable for children under 13',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $('.R').qtip({
        content: 'Restricted - Under 17 requires accompanying parent or adult guardian',
        show: 'mouseover',
        hide: 'mouseout',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            padding: 2,
            background: '#121212',
            color: '#fff',
            textAlign: 'center',
            border: {
                width: 0,
                radius: 3,
                color: '#121212'
            },
            tip: true
        }
    });
    $("#promo_email .sign_up").click(function() {
        var userName = $("#promo_email #name").val();
        var userEmail = $("#promo_email #email").val();
        if (userName && userEmail) {
            window.location = "/hollywood-insider/?u=" + userName + "&e=" + userEmail + "";
        }
        return false;
    });
    $("input.email").keypress(function(e) {
        if (e.keyCode == 13 || e.keyCode == 10) {
            var userName = $("#promo_email .name").val();
            var userEmail = $("#promo_email .email").val();
            if (userName && userEmail) {
                window.location = "/hollywood-insider/?u=" + userName + "&e=" + userEmail + "";
            }
            return false;
        }
    });
    if ($("body#hollywood-insider").length) {
        userName = getQuery("u");
        if (userName) {
            userName = userName.replace("%20", " ");
            $(".name").val(userName);
            $(".email").val(getQuery("e"));
        }
    }
});

function getQuery(obj) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == obj) {
            return pair[1];
        }
    }
}

/*
CSS Browser Selector v0.3.4 (Sep 29, 2009)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u) { var ua = u.toLowerCase(), is = function(t) { return ua.indexOf(t) > -1; }, g = 'gecko', w = 'webkit', s = 'safari', o = 'opera', h = document.getElementsByTagName('html')[0], b = [(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ('ie ie' + RegExp.$1) : is('firefox/2') ? g + ' ff2' : is('firefox/3.5') ? g + ' ff3 ff3_5' : is('firefox/3') ? g + ' ff3' : is('gecko/') ? g : is('opera') ? o + (/version\/(\d+)/.test(ua) ? ' ' + o + RegExp.$1 : (/opera(\s|\/)(\d+)/.test(ua) ? ' ' + o + RegExp.$2 : '')) : is('konqueror') ? 'konqueror' : is('chrome') ? w + ' chrome' : is('iron') ? w + ' iron' : is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.$1 : '') : is('mozilla/') ? g : '', is('j2me') ? 'mobile' : is('iphone') ? 'iphone' : is('ipod') ? 'ipod' : is('mac') ? 'mac' : is('darwin') ? 'mac' : is('webtv') ? 'webtv' : is('win') ? 'win' : is('freebsd') ? 'freebsd' : (is('x11') || is('linux')) ? 'linux' : '', 'js']; c = b.join(' '); h.className += ' ' + c; return c; }; css_browser_selector(navigator.userAgent);