
// ----------------------------------------
// Detectind user browser
// ----------------------------------------
var Nav = navigator, Ag = Nav.userAgent;
var bIE = (Ag.indexOf('MSIE') >= 0), bMacIE = false;
var bNC = (navigator.appName == "Netscape");
var bOpera = (Ag.indexOf('Opera') >= 0);
var nVer = 0, sTmp = "";
if (bIE) {
	sTmp = Ag.substring(Ag.indexOf("MSIE") + 5, Ag.length);
	nVer = Math.floor (sTmp.substring(0, sTmp.indexOf(";")));
	if (nVer >= 4 && !document.all)
		nVer = 0;
	if (Ag.indexOf("Mac") >= 0)
		bMacIE = true;
}
if (bNC)
	nVer = Math.floor (Nav.appVersion.substring (0, Nav.appVersion.indexOf (" ") ) );

bDynamic = (document.all || document.layers) ? true : false;
	
// ----------------------------------------
// Menu moving functions
// ----------------------------------------
nMenuYPos = 20;
nYDelta = 10;
nPrevScrollPos = 0;

function pryc(){
onClick=document.getElementById("floatingmenu").style.display = "none" ;
}


function Spy () {
    if (bNC && nVer >= 4) {
		if (window.pageYOffset < nMenuYPos - nYDelta)
			nNeededPos = nMenuYPos;
		else	
			nNeededPos = window.pageYOffset + nYDelta;
		nCurrentPos = document.getElementById("floatingmenu").top;


		if (nNeededPos == nCurrentPos)
			return;

		nCurrentPos += Math.round ( (nNeededPos - nCurrentPos) / 4);
		document.getElementById("floatingmenu").top = nCurrentPos;

	}

	if (bIE && nVer >= 4 && !bMacIE) {
		if (document.body.scrollTop < nMenuYPos - nYDelta)
			nNeededPos = nMenuYPos;
		else
			nNeededPos = document.body.scrollTop + nYDelta;
		nCurrentPos = document.all["floatingmenu"].offsetTop;

		if (nNeededPos == nCurrentPos)
			return;

		nDelta = (nNeededPos - nCurrentPos) / 25;
		if (nDelta > 0 && nDelta < 0.5)
			nCurrentPos += nNeededPos - nCurrentPos;
		else
			if (nDelta < 0 && nDelta >= -0.5)
				nCurrentPos --;
			else
				nCurrentPos += Math.round (nDelta);
		
		pnt = document.all["floatingmenu"].style;
		pnt.top = nCurrentPos;
	}
}

function spustit () {
    ScriptStart();
}

function ScriptStart () {
    if (bNC && nVer >= 4)
		setInterval ("Spy ()", 25);
	if (bIE && nVer >= 4 && !bMacIE)
		setInterval ("Spy ()", 25);
}

bScriptLoaded = true;

document.write("<div onClick='pryc();' id='floatingmenu' style='Z-INDEX: 999; WIDTH: 160px; POSITION: absolute; left:10px; bottom: -10px; background-color: #EEEEEE; border:1px solid silver '>");
document.write("<p style='cursor:pointer; dispaly:block'>&nbsp;<br />&nbsp;<b> [X] zavøít</b><br />&nbsp;<br />");
//document.write("<img src='http://www.pizzerie-marco.cz/m-akce-pizza.jpg' border='1' style='BORDER:4px solid black; width:500px' />");
document.write("<A href='http://www.pizzerie-marco.cz/akce-pizza.jpg' target='_blank'><img src='http://www.pizzerie-marco.cz/m-akce-pizza.jpg' border='1' style='BORDER:4px solid black; width:500px' /></a>");
document.write("</div>");

spustit();
