var videoPath = '/touramericarv_com/Tour400july2011.flv';
var playlist = [{
    url: 'http://p.video.interactrv.netdna-cdn.com/vod/video.interactrv' + videoPath
}];
var firstTimeVisitor;
if ($.cookie('videoplayerhome') == null) {
    firstTimeVisitor = null;
    $.cookie('videoplayerhome', "Video Loaded", {
        path: "/",
        expires: 30
    });
} else {
    firstTimeVisitor = function () {
        this.seek(12).pause();	
		$.cookie('playedOnce', "User Pressed Play"); 
    };
}

var playedOnce;
    playedOnce = function () {
		if ($.cookie('playedOnce') == null) {
			playedOnce = null; 	 
		} else {
			this.seek(0).play();
			$.cookie('playedOnce', null);
			}
    };


$(function () {
    $f("videoplayerhome", "http://common.interactrv.com/common/assets/flash/flowplayer/flowplayer.commercial-3.2.7.swf", {
        key: fpkey,
        playlist: playlist,
        plugins: {
            controls: {
                autoHide: false,
                background: '#223D85',
                backgroundGradient: 'none'
            },
            lighttpd: {
                url: 'http://common.interactrv.com/common/assets/flash/flowplayer/flowplayer.pseudostreaming-3.2.7.swf'
            }
        },
        clip: {
            provider: 'lighttpd',
            ipadUrl: 'http://d.video.interactrv.netdna-cdn.com/play/_definst_/flv:vod/video.interactrv' + videoPath + '/playlist.m3u8',
            autoPlay: true,
            autoBuffering: true,
            onStart: firstTimeVisitor,
			onResume: playedOnce
        },
        canvas: {
            background: '#000000',
            backgroundGradient: 'none'
        }
    }).ipad();
});
