var BBAKE = (function() {
    return {
        init : function() {
            BBAKE.Ticker.init();
            BBAKE.Calendar.init();
            
            if (document.getElementById('login_name')) {
    	        document.getElementById('login_name').focus();
            }
			
			flowplayer("player", "swf/flowplayer-3.1.5.swf", {
				clip : {
					autoBuffering : true,
					autoPlay : false
				}
			});
        }
    };
}()); 

BBAKE.Calendar = function() {
    return {
        init : function() {
            if ($('.js-calendar').length > 0) {
                Calendar.setup({
                    inputField  : "StartDate",         // ID of the input field
                    ifFormat    : "%Y-%m-%d",    // the date format
                    button      : "StartDateBtn",       // ID of the button
                    onClose     : function() {
                        $('EndDate').val($('StartDate').value);
                        this.hide();
                    }
                });
    
                Calendar.setup({
                    inputField  : "EndDate",         // ID of the input field
                    ifFormat    : "%Y-%m-%d",    // the date format
                    button      : "EndDateBtn"       // ID of the button
                });
            }
        }
    }
}();

$(document).ready(BBAKE.init);