var mallowStreet = {
    videoPlayer: {
        init: function(playerId) {

            /* get the path to the video from the anchor */
            var videoURL = $("#" + playerId).attr("href");

            flowPlayer = flowplayer(playerId, "assets/js/libs/flowplayer/flowplayer.commercial-3.1.4.swf", {
                log: {
                    level: 'debug', filter: 'org.flowplayer.akamai.*, org.flowplayer.rtmp.*'
                },                
                clip: {
                    url: escape(videoURL),
                    provider: 'rtmp',
                    autoPlay: true,
					scaling: 'fit'
                },
                key: '#$38e5490304db2da2475',
                canvas: { backgroundColor: "#293134" },
                plugins: {
                    akamai: {
                        url: 'assets/flowplayer/flowplayer.akamai/flowplayer.akamai-3.1.3.swf'
                    },
                    rtmp: {
                        url: 'assets/flowplayer/flowplayer.rtmp-3.1.3.swf'
                    },
                    controls: {
                        all: true,
                        bufferColor: '#333333',
                        progressColor: '#0084D7',
                        buttonColor: '#0084D7',
                        buttonOverColor: '#52BCFF',
                        tooltipColor: '#0084D7',
                        height: 20,
                        autoHide: 'always',
                        bottom: 0,
                        borderRadius: 0
                    }
                }
            });

            flowPlayer.onStart(function(clip) {
                // send clip's URL to Google Analytics
                pageTracker._trackPageview(clip.url);
            });
        }
    },
    init: function(appPath) {

        $("#tab_navigator li").hoverIntent(
			function() {
			    var sectionToShow = $('div.intro-section-box div.' + $(this).attr('class'));
			    if (!sectionToShow.hasClass("selected")) {
			        $('div.intro-section-box div.intro-section').hide();
			        $('div.intro-section-box div.intro-section').removeClass("selected");
			        sectionToShow.fadeIn("slow");
			        sectionToShow.addClass("selected");
			    }
			},
			function() { }
		)

        $('#tweets').tweetable({ username: 'mallowstreet', time: true, limit: 3 });
        mallowStreet.videoPlayer.init('what_is_ms_player');
        mallowStreet.videoPlayer.init('shout_about_it');
    }
}
