var day	=	1;
var cookieName		=	'virtagonMovie';

function playerReady(obj)
{
	player = document.getElementsByName(obj.id)[0];
	/*
	if(parseInt($.cookie(cookieName)) != 1){
		setTimeout('stop_player()', 1000);
	}
	*/
};

function loadNplay(file, type, author, title, description, image)
{
	if (day=='1') day=0; else day=1;
	player.sendEvent('LOAD', {file:file, type:type, author:author, title:title, description:description, image:image});
	player.sendEvent('PLAY', 'true');
};

var curdate 	= new Date();

var utc_hour 	= curdate.getUTCHours();
var utc_min 	= curdate.getUTCMinutes();
var utc_sec 	= curdate.getUTCSeconds();
var offset 		= curdate.getTimezoneOffset();

//var tlo = '/background.flv';

var tlo='/new_york_night_1.flv';
if ((hour >= 6 && ante == 'am') || (hour < 6 && ante == 'pm')) {
	tlo = '/new_york_day_1a.flv';
	day=0;
}

var flashvars =
{
	autostart:             'true',
	fullscreen:            'true',
	controlbar:            'none',
	playlist:              'none',
	file:                  tlo,
	mute:				   'true',
	icons: 				   'true',
	repeat:				   'always',
	stretching:			   'exactfit',
	plugins: {
	'viral-2': {
	'onpause': 'false',
	'oncomplete': 'false',
	'callout': 'none'
	}
	}
};

var params =
{
	allowscriptaccess:     'always',
	allowfullscreen:       'true',
	wmode: 				   'opaque'
};

var attributes =
{
	name:                  'mediaplayer',
	id:                    'mediaplayer',
	screencolor: '0x000000',
	wmode:					'transparent'
};
$(document).ready(function(){
	height=$(window).height();
	width=$(window).width();
	height_body=$(document).height();
	// obliczyc ile powinna wynosic wysokosc
	swfobject.embedSWF('/unmanifested/player.swf', 'player', width, height_body, '9.0.124', false, flashvars, params, attributes);
});
var currheight;
var currwidth;
window.onresize = function(){
	if(currheight != document.documentElement.clientHeight || currwidth != document.documentElement.clientWidth)
	{
		swfobject.removeSWF("player");
		$('#playercontainer').html('');
		$('#playercontainer').html('<a id="player" class="player" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Flash Plugin to see this video.</a>');
		height=$(window).height();
		width=$(window).width();
		height_body=$(document).height();
		swfobject.embedSWF('/unmanifested/player.swf', 'player', width, height_body, '9.0.124', false, flashvars, params, attributes);
	}
	currheight = document.documentElement.clientHeight;
	currwidth = document.documentElement.clientWidth;
}
