﻿$(function () {


    $('#images').exposure({ carouselControls: true,
        imageControls: true,
        pageSize: 6,
        autostartSlideshow: true,
        showExtraData: false,
        slideshowControlsTarget: '#slideshow',
        onThumb: function (thumb) {
            var li = thumb.parents('li');
            var fadeTo = li.hasClass('active') ? 1 : 0.3;

            thumb.css({ display: 'none', opacity: fadeTo }).stop().fadeIn(200);

            thumb.hover(function () {
                thumb.fadeTo('fast', 1);
                $.exposure.pauseSlideshow();
            }, function () {
                li.not('.active').children('img').fadeTo('fast', 0.3);
                $.exposure.playSlideshow();
            }
                    );
        },
        onImage: function (image, imageData, thumb) {
            // Check if wrapper is hovered.
            var hovered = $('.exposureWrapper').hasClass('exposureHover');
            $('.exposureTarget').hover(function () {
                var offset = image.offset();

                if ($('#playvideo').attr('rel') == "" || $('#playvideo').attr('rel') == "0") {

                    $('.Buttons').css({ 'display': 'block', 'width': image[0].width, 'height': image[0].height }).offset({ top: offset.top, left: offset.left });

                }
                $.exposure.pauseSlideshow();
            }, function () {
                $('.Buttons').css('display', 'none');
                if ($('#playvideo').attr('rel') == "" || $('#playvideo').attr('rel') == "0") {

                    $.exposure.playSlideshow();
                }
                else {
                    $.exposure.pauseSlideshow();
                }
            }
                    );
            // Fade out the previous image.
            $('.exposureWrapper > .exposureLastImage').stop().fadeOut(500, function () {
                $(this).remove();
            });

            // Fade in the current image.
            image.hide().stop().fadeIn(1000);

            if ($.exposure.showThumbs && thumb && thumb.length) {
                thumb.fadeTo('fast', 1).addClass('selected');
            }
        },
        onCarousel: function (firstImage, lastImage) {
            $('.exposureThumbs li').hide().children('img.selected').stop().css('opacity', 0.3).removeClass('selected');
        },
        onSlideshowPlayed: function () {
            $('.exposurePauseSlideshow').css('display', 'inline');
        }
    });
    $('.play').click(function () {
        $('.exposureCurrentImage').hide();
        $('.Buttons').css('display', 'none');
        $('#playvideo').attr('rel', '1');
        $('#player').attr('href', '/Video/' + $('#playvideo').val());
        $('#videodiv').css('display', 'block');

        player = $f("player", "/js/flowplayer-3.2.7.swf", {
            clip: {
                autoPlay: false,
                autoBuffering: true,
                stop: true,
                mute: true,
                time: true
            },
            plugins: {
                controls: {
                    autoHide: 'never'
                }
            },
            showErrors: true,
            onError: function () { },
            onPause: function (clip) {
                this.stop();
            },
            onResume: function (clip) {
                this.play();
            }

        });
        $.exposure.pauseSlideshow();

    });
    var ratingStars = $('#movie1').raty({
        size: 24,
        start: $('#movie1rating').val(),
        path: '../images/',
        starHalf: 'star-half-big.png',
        starOff: 'star-off-big.png',
        starOn: 'star-on-big.png',
        readOnly: true
    });
    var ratingStars = $('#movie2').raty({
        size: 24,
        start: $('#movie2rating').val(),
        path: '../images/',
        starHalf: 'star-half-big.png',
        starOff: 'star-off-big.png',
        starOn: 'star-on-big.png',
        readOnly: true
    });
    var ratingStars = $('#movie3').raty({
        size: 24,
        start: $('#movie3rating').val(),
        path: 'images/',
        starHalf: 'star-half-big.png',
        starOff: 'star-off-big.png',
        starOn: 'star-on-big.png',
        readOnly: true
    });
    var ratingStars = $('#movie4').raty({
        size: 24,
        start: $('#movie4rating').val(),
        path: 'images/',
        starHalf: 'star-half-big.png',
        starOff: 'star-off-big.png',
        starOn: 'star-on-big.png',
        readOnly: true
    });

    $('#yes').click(function () {
        $.ajax({
            type: "POST",
            url: "ajax.aspx",
            data: "action=like&answer=Yes",
            success: function (ret) {
                $("#Message2").css('display', 'block');
                $("#Message2").css('width', '230px');
                $("#Message2").css('text-align', 'left');
                $("#Message2").html("Thank you for your Suggestion.");
            }
        });
    });
    $('#no').click(function () {

        $.ajax({
            type: "POST",
            url: "ajax.aspx",
            data: "action=like&answer=No",
            success: function (ret) {
                $("#Message2").css('display', 'block');
                $("#Message2").css('width', '230px');
                $("#Message2").css('text-align', 'left');
                $("#Message2").html("Thank you for your Suggestion.");
            }
        });
    });

});


function initialize() {
    var latlng = new google.maps.LatLng(31.4503, 74.310798);
    var myOptions = {
        zoom: 12,
        center: latlng,
        zoomControl: true,
        mapTypeControl: false,
        zoomControlOptions: {
            style: google.maps.ZoomControlStyle.LARGE,
            position: google.maps.ControlPosition.LEFT_CENTER
        },

        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
    var Marker = new google.maps.Marker({
        position: latlng,
        map: map
    });

    var infowindow = new google.maps.InfoWindow(
    { content: 'Plot # 13, 2 Civic Center Township <br />CineStar Cinema Lahore. <br />'
                + '+ 92-42-351 574 60-2'
                + '<br /> 111-246-362'
                + '<br /> <a href="mailto:info@cinestar.com.pk" class="block">info@cinestar.com.pk</a>',
        size: new google.maps.Size(20, 50),
        position: latlng
    });
    infowindow.open(map, Marker);

    google.maps.event.addListener(Marker, 'click', function () {
        infowindow.open(map, Marker);
    });
}
window.onload = initialize;
