﻿var brwsr = $.browser;


$(document).ready(function() {
    if (brwsr = 'msie') {
        $('#footerlvig').css({ display: 'none' });
        $('#footerrvig').css({ display: 'none' });
    }

    adjuster();

    //Main Media Template 
    $("#slidefeature").animate({ opacity: 0.0, height: "580px" }, 0);
    $("#slidefeatureOver").animate({ opacity: 0.0, height: "580px" }, 0);

    $("#slidefeature").css({ display: "none" });
    $("#slidefeatureOver").css({ display: "none" });

    //Free-Form Template
    $("#slidefree").animate({ opacity: 0.0, height: "580px" }, 0);
    $("#slidefreeOver").animate({ opacity: 0.0, height: "580px" }, 0);

    $("#slidefree").css({ display: "none" });
    $("#slidefreeOver").css({ display: "none" });

    //Main Media Template  Closer
    $('#modalclose').click(function() {
        $("#slidefeatureOver").animate({ opacity: 0 }, 500, function() {
            $("#media").css({ display: "none" });
            $('#slidefeature').animate({ opacity: 0 }, 1000, function() {
                $("#slidefeature").css({ display: "none" });
                $("#slidefeatureOver").css({ display: "none" });
                $('#media').html("");
                $('#title').html("");
                $('#copy').html("");

                var flashvars = {};
                flashvars.flvToPlay = "";
                flashvars.hiddenGui = "true";
                flashvars.showScaleModes = "false";
                flashvars.autoStart = "true";
                flashvars.allowFullScreen = "false";

                var params = {};
                params.bgcolor = "#102032";
                swfobject.embedSWF("flvPlayer.swf", "media", "445", "266", "8", "fla/expressInstall.swf", flashvars, params);
            });
        });
    });

    //Free-Form Template Closer
    $('#freemodalclose').click(function() {
    $("#slidefreeOver").animate({ opacity: 0 }, 500, function() {            
            $('#freediv').css({ display: "none" });
            $('#slidefree').animate({ opacity: 0 }, 1000, function() {
                $("#slidefree").css({ display: "none" });
                $("#slidefreeOver").css({ display: "none" });
                $('#freediv').html("");
            });
        });
    });

});




window.onresize = function() {
    adjuster();
}

function adjuster() {
    var cHeight = $(window).height();
    var cWidth = $(window).width();
    var oMargin = 0;

    if (cWidth < 1920) {
        oMargin = (cWidth - 1920) / 2;
    }

    //fla = 586px high
    //smlogo = 24px + 8px high
    //logo = 48px + 30px high

    if (cHeight < 630) {
        $('#tagline').css({ display: 'none' });
        $('#taglinesm').css({ display: 'inline' });
        $('#logosm').css({ display: 'inline' });
        $('#logo').css({ display: 'none' });

        //Minimum Height Check for footer
        if ((cHeight - 500) > 111) {
            $('#footer').css({ height: (cHeight - 478) });
        }
        else {
            $('#footer').css({ height: '110px' });
        }



        //Minimum Top Margin Check for copyright
        if ((cHeight - 580) > 6) {
            $('#footerover').css({ marginTop: (cHeight - 580) });
        }
        else {
            $('#footerover').css({ marginTop: '7px' });
        }


    }
    if (cHeight > 630) {
        $('#taglinesm').css({ display: 'none' });
        $('#tagline').css({ display: 'inline' });
        $('#logosm').css({ display: 'none' });
        $('#logo').css({ display: 'inline' });

        //Minimum Height Check for footer
        if ((cHeight - 664) > 127) {
            $('#footer').css({ height: (cHeight - 664) });
        }
        else {
            $('#footer').css({ height: '127px' });
        }


        //Minimum Top Margin Check for copyright
        if ((cHeight - 768) > 6) {
            $('#footerover').css({ marginTop: (cHeight - 769) });
        }
        else {
            $('#footerover').css({ marginTop: '22px' });
        }

        //alert(cHeight - 768);
    }



    $('#footerlvig').css({ bottom: '0px', opacity: '1.00' });
    $('#footerrvig').css({ bottom: '0px', opacity: '1.00' });
    $('#wtgcandy').css({ width: '1920px', marginLeft: oMargin });
}

