var menuState = false;
var maxVisibleItems = 5;
var visibleItems = 0;
var itemsCount = 0;
var currentItem = 1;
var from = currentItem;
var to = visibleItems;

var imgPath, imdDownloadPath;
var arrItems = new Array();

function writeHPFlash()
{
	var videos = ["DogComp", "MrHappy", "Bottle", "Bubbles", "RingTone"];

	var dtBegin = new Date(2006,7,21);
	var dtNow = new Date();
	var period = 7*24*60*60*1000; // ostry provoz = 7 dny
	//var period = 5*1000; // test = 5 vterin
	var diff = dtNow.valueOf() - dtBegin.valueOf();
	var periods = parseInt(diff / period);
	//var rest = diff % period;
	periods = periods % videos.length;
	//if ( periods > videos.length ) periods = periods % videos.length;
	
	document.write('			<div class="flash">');
	document.write('					<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="234" height="186" id="flwPlayer">');
	document.write('						<param name="movie" value="/swf/u/flvPlayer.swf?flv_file=/swf/u/clips/Cocacola_' + videos[periods] + '.flv&amp;buffer=10&autoStart=1&border=1">');
	document.write('						<param name="quality" value="high">');
	document.write('						<param name="wmode" value="transparent">');
	document.write('						<embed src="/swf/u/flvPlayer.swf?flv_file=/swf/u/clips/Cocacola_' + videos[periods] + '.flv&amp;buffer=10&autoStart=1&border=1" quality="high" width="234" height="186" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="flwPlayer" swLiveConnect="true" wmode="transparent"></embed>');
	document.write('					</object>');
	document.write('				<span><span>Ďalšie cool mini-filmy nájdeš v sekcii Videá</span></span>');
	document.write('				</div>');
}

/*function switchMenu()
{
	if ( menuState == true )
	{
	  document.getElementById("btnMenu").title = "Kliknutím zobrazíte menu";
	  document.getElementById("bgMenu").style.visibility = "hidden";
	  document.getElementById("menu").style.visibility = "hidden";
	  menuState = false;
	}
	else
	{
	  document.getElementById("btnMenu").title = "Kliknutím skryjete menu";
	  document.getElementById("bgMenu").style.visibility = "visible";
	  document.getElementById("menu").style.visibility = "visible";
	  menuState = true;
	}
}*/

var lastSelectedItem = null;

function mailStatus(status)
{
	alert(getMailStatusText(status));
}

function InitButtons()
{
	if ( visibleItems > maxVisibleItems ) visibleItems = maxVisibleItems;
	to = visibleItems;
	denyNextItem();
	denyPrevItem();

	if ( itemsCount > visibleItems && currentItem != itemsCount )allowNextItem();
	for ( i=from;i<=to;i++ ) showItem(i);
}
function prevItem()
{
	if ( from == 1 ) return;
	hideItem(to);
	from--;
	to--;
	showItem(from);
	allowNextItem();
	if ( from == 1 ) denyPrevItem();
	else allowPrevItem();

}
function nextItem()
{
	if ( to == itemsCount ) return;
	hideItem(from);
	from++;
	to++;
	showItem(to);
	allowPrevItem();
	if ( to == itemsCount ) denyNextItem();
	else allowNextItem();
}
function allowNextItem() { document.getElementById("btnNext").style.visibility = "visible"; }
function denyNextItem() { document.getElementById("btnNext").style.visibility = "hidden"; }
function allowPrevItem() { document.getElementById("btnPrev").style.visibility = "visible"; }
function denyPrevItem() { document.getElementById("btnPrev").style.visibility = "hidden"; }

function hideItem(no) { getItem(no).style.display = "none"; }
function showItem(no) { getItem(no).style.display = "block"; }
function getItem(no) { return document.getElementById("item" + no); }
