﻿
$(window).load(function () {
    if (window.location.href.indexOf('bastard.aspx') != -1) {
        $('#container').easyTabs({ defaultContent: 1 });
    }
    var isiPad = navigator.userAgent.match(/iPad/i) != null;
    if (isiPad) {
        $('div.playContainer').show();

    }
    else {
        $('div.playContainer').fadeIn(500);
    }

    if ($('div.playContainer').is(':visible')) {

        $('div.movieContainer').show();
    }
    else {
        $('div.movieContainer').fadeIn(500);
    }
    $(document).keyup(function (e) {

        if (e.keyCode == 27) { closeMovieWindow(); }   // esc
    });
    $("#coverUp").click(function () {
        closeMovieWindow();
    });

    $("#closeWindow").click(function (event) {
        closeMovieWindow();
    });
    $("#closeWindow").addClass("pointerCursor");

    $(function () {
        $('.imgThumb').each(function () {
            $(this).hover(
                    function () {
                        $(this).stop().animate({ opacity: 1.0 }, 300);
                    },
                   function () {
                       $(this).stop().animate({ opacity: 0.7 }, 300);
                   })
        });
    });

    function closeMovieWindow() {
        if (isiPad) {
            $("#playContainer").remove();
            if (window.location.href.indexOf('bastard') != -1) {
                window.location = 'http://www.bstflms.nl/bastard.aspx' + window.location.hash;
            }
        }
        else {
            $("#playContainer").fadeOut(500, function () {
                $(this).remove();
                if (window.location.href.indexOf('bastard') != -1) {
                    window.location = 'http://www.bstflms.nl/bastard.aspx' + window.location.hash;
                }
            });
        }
        $("#coverUp").fadeOut();
        // $("#playContainer").delay(1000).remove();
    }
});
$(function() {
    $(".drag-image").draggable();
    
});



