﻿var Trailer =
{
    hide: function() {
        var conTrailer = $("trailBox");
        var descBox = $("descBox");
        var showTrailerLnk = $("showTrailerLnk");
        conTrailer.isVisible = false;
        descBox.style.display = "block";
        showTrailerLnk.style.display = "block";
        conTrailer.style.display = "none";
        var FO = { movie: "trailer.swf", width: "100%", height: "1", majorversion: "8", build: "0", bgcolor: "#000000", allowfullscreen: "true", flashvars: "trl=1.flv&showdigits=false&autostart=false&showfsbutton=false", id: "fullscreen_flash" };
        UFO.create(FO, "player1");
    },

    show: function(tPath) {
        var showTrailerLnk = $("showTrailerLnk");
        conTrailer = $("trailBox");
        conTrailer.isVisible = true;
        showTrailerLnk.style.display = "none";
        //$("descBox").style.display = "none";
        conTrailer.style.display = "block";
        var FO = { movie: "/trailers/trailer.swf", width: "100%", height: "1", majorversion: "8", build: "0", bgcolor: "#000000", allowfullscreen: "true", flashvars: "trl=" + tPath + "&showdigits=false&autostart=true&showfsbutton=false", id: "fullscreen_flash" };
        UFO.create(FO, "player1");
    },

    shareIt: function(tID) {
        var txtFrom = $("txtFrom");
        var txtTo = $("txtTo");
        var txtComment = $("txtMessage");
        var txtSubject = $("txtSubject");
        if (txtFrom.value && txtTo.value && txtSubject.value) {
            if (AjaxMethods.ShareTrailer(tID, txtFrom.value, txtTo.value, txtComment.value, txtSubject.value, ShareTrailer_CallBack)) {

            }
            else {
                return false;
            }
        } else {
            alert("Please check you have entered all required fields!")
            return false
        }
        function ShareTrailer_CallBack(response) {
            if (response.error != null) {
                alert(response.error);
                window.status = ''
                return false;
            }
            if (response.value == "") {
                alert("Action Failed");
                window.status = ''
                return false;
            }
            $("msgShareIt").innerHTML = response.value
            return true;
        }
    },
    showShare: function() {
        var effectSlideDown = Effect.SlideDown('divShareIT', { duration: 0.7 });
        $("showTrailerLnk").style.display = "none";
    },
    closeShare: function() {
        var effectSlideDown = Effect.SlideUp('divShareIT', { duration: 0.7 });
        if ($("trailBox").style.display != "block") {
            $("showTrailerLnk").style.display = "block";
        }

        $("msgShareIt").innerHTML = "";
    }


}
	