 var tmrCountdown;

    $(document).ready(function() {
        var triggers = $(".modalInput").overlay({
            mask: {
                color: '#D6E9E0',
                loadSpeed: 200,
                opacity: 0.9
            },
            closeOnClick: false,
            onLoad: function(e) { tmrCountdown = setTimeout("updateCounter();", 1000); },
            onClose: function(e) { clearTimeout(tmrCountdown); $("#modalcareers span").html('5');}

        });

        $("#modalcareers form").submit(function(e) {
			
            var redirect = $('.modalInput').attr('href');
			$(window.location).attr('href', redirect);
            return false;

        });
		//Text affect for Group Stats
		$(".stats").css("color", "#fff"); 
		$(".stats").FontEffect({ 
				outline:true,
				outlineWeight :1,
				outlineColor1 :"#00B6DD"
		})	
    });


    $(function() {
        // Home page Slides for bmt.org
        //Initialize Slides
        // Set starting slide to 1
        var startSlide = 1; var intPlay = 15000;
        if (window.location.href.toLowerCase().indexOf("sigma") > 0) intPlay = 6000;
        // Get slide number if it exists
        if (window.location.hash) {
            startSlide = window.location.hash.replace('#', '');
        }
        $('#slides').slides({
            preload: true,
            preloadImage: 'http://media.bmt.org/bmt_media/bmt_images/1/homeslider/loading.gif',
            generatePagination: true,
            play: intPlay,
            pause: 1000,
            hoverPause: true,
            start: startSlide,
            animationComplete: function(current) {
                window.location.hash = '#' + current;
            }
        });
    });

    function updateCounter() {
        var intSeconds = parseInt($("#modalcareers span").html());
        intSeconds--;
        if (intSeconds > 0) {
            $("#modalcareers span").html(intSeconds);
            tmrCountdown = setTimeout("updateCounter();", 1000);
        }
        else {
			$(".modalInput").overlay().close();
			var redirect = $('.modalInput').attr('href');
			$(window.location).attr('href', redirect);
        	return false;
		}
    } 

function initflowplayer(videosize) {
		if(videosize)
		{
			var selectedVideoSize = true;
		}
		else
		{
			var selectedVideoSize = false;
		}
		
		flowplayer("player", "http://www.bmt.org/BMT/bmt_lib/flowplayer-3.2.2.swf", {
			"clip":  
				{
				autoPlay: false,
				autoBuffering: true
				},
			"plugins": 
			{
			"controls": 
				{
		
				"fullscreen": false,
				"buttonOffColor":"rgba(026/189/201)",
				"borderRadius":"0px",
				"timeColor":"#ffffff",
				"bufferGradient":"none",
				"sliderColor":"#d4d00f",
				"zIndex":1,
				"backgroundColor":"rgba(0, 0, 0, 0)",
				"scrubberHeightRatio":0.6,
				"volumeSliderGradient":"none",
				"tooltipTextColor":"#ffffff",
				"time": selectedVideoSize,
				"spacing":
				{
				"time":6,"volume":8,"all":2
				},
				"sliderGradient":"none",
				"timeBorderRadius":20,
				"timeBgHeightRatio":0.8,
				"volumeSliderHeightRatio":0.6,
				"progressGradient":"none",
				"height":26,
				"volumeColor":"#d4d00f",
				"timeSeparator":" ",
				"name":"controls",			
				"tooltips":
				{
				"marginBottom":5,"buttons":false
				},
				"volumeBarHeightRatio":0.2,
				"opacity":1,
				"timeFontSize":10,
				"left":"50pct",
				"tooltipColor":"rgba(0, 0, 0, 0)",
				"volumeSliderColor":"#1abdc9",
				"border":"0px",
				"bufferColor":"#1abdc9",
				"buttonColor":"#ffffff",
				"durationColor":"#1abdc9",
				"autoHide":
				{
				"enabled":true,
				"hideDelay":500,
				"mouseOutDelay":500,
				"hideStyle":"fade",
				"hideDuration":400,
				"fullscreenOnly":true
				},
				"backgroundGradient":"none",
				"width":"100pct",
				"sliderBorder":"1px solid rgba(128, 128, 128, 0.7)",
				"display":"block",
				"buttonOverColor":"#d4d00f",
				"timeBorder":"0px solid rgba(0, 0, 0, 0.3)",
				"progressColor":"#d4d00f",
				"timeBgColor":"rgb(0, 0, 0, 0)",
				"scrubberBarHeightRatio":0.2,
				"bottom":0,
				"volumeBorder":"1px solid rgba(128, 128, 128, 0.7)",
				"builtIn":false,
				"margins":[2,12,2,12]
				}
			}
		}
		);
	}
