
// MENU

var showingSubmenu = 0;
var timeinterval=0;

function hoverMenu(num, active)
{
    elm = document.getElementById('menuimg'+num);
    for (i=1;i<=6;i++) 
    {
        if (i!=num) {
            if (document.getElementById('submenu'+i)) document.getElementById('submenu'+i).style.display = 'none';
            if (document.getElementById('menuimg'+i)) document.getElementById('menuimg'+i).src = 'images/menu/menu'+i+((i==activeMenuItem)?'_active':'')+'.gif';;
        }
    }
    if (timeinterval) clearInterval(timeinterval);

    if (document.getElementById('submenu'+num)) 
        if (document.getElementById('submenu'+num).style.display=='block') return;

    elm.src='images/menu/menu'+num+(active?'_active':'_hover')+'.gif'
}
function showMenu(num, active) 
{
    elm = document.getElementById('menuimg'+num);
    elm.blur(); 
    for (i=1;i<=6;i++) 
    {
        if (i!=num) 
            if (document.getElementById('submenu'+i)) document.getElementById('submenu'+i).style.display = 'none';
    }
    if (document.getElementById('submenu'+num)) 
    {
        elm.src = 'images/menu/menu'+num+'_active.gif'; //document.getElementById('submenu'+num).style.display=='block'?('images/menu/menu'+num+(active?'_active':'')+'.gif'):('images/menu/menu'+num+'_active.gif'); 
        document.getElementById('submenu'+num).style.display = 'block'; //document.getElementById('submenu'+num).style.display=='block'?'none':'block';
        showingSubmenu = num;
        return false;
    } else {
        return true;
    }
}
function hideMenu(num, active) 
{
    setin = false;
    if (document.getElementById('submenu'+num)) 
        if (document.getElementById('submenu'+num).style.display=='block') setin=true;

    if (setin) {
        timeinterval = setInterval('hideMenuReallyHide('+num+','+active+')', 1000);
    } else {
        elm = document.getElementById('menuimg'+num);
        elm.src='images/menu/menu'+num+(active?'_active':'')+'.gif';
    }
}
function hideMenuReallyHide(num, active)
{    
    if (!showingSubmenu) {
        if (document.getElementById('submenu'+num)) 
            document.getElementById('submenu'+num).style.display='none';
        if (timeinterval) clearInterval(timeinterval);
        
       elm = document.getElementById('menuimg'+num);
       elm.src='images/menu/menu'+num+(active?'_active':'')+'.gif';
    }
}



// H1
/*
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}
*/
 
function writeFlash2(sSrc,nWidth,nHeight, id)	{
	flash =  '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+nWidth+'" height="'+nHeight+'">';
	flash +=  '<param name="allowscriptaccess" value="always" />';
	flash +=  '<param name="movie" value="'+sSrc+'" />';
	flash +=  '<param name="wmode" value="transparent" />';
	flash +=  '<param name="bgcolor" value="#A6CE39" />';
	flash +=  '<embed src="'+sSrc+'" width="'+nWidth+'" height="'+nHeight+'" bgcolor="#A6CE39" name="'+id+'" wmode="transparent" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	flash +=  '</object>';
	return(flash);
}

function replaceH1(){

    if (!MM_FlashCanPlay) return false;
    
	var array = document.getElementsByTagName('h1');
	//document.write(array.length);
	for (var i=(array.length-1); i>=0; i--) {
		var h1 = array[i];
		var width = getElementWidth(array[i]);
		var height = getElementHeight(array[i])+18; // tu treba domyslet akym sposobom vyzistit vysku a sirku flashu
		var flashURL = "/flash/main.swf?txt="+h1.innerHTML.toUpperCase().replace(/%/g, "%25")+"&size="+22+"&width="+width+"&height="+height;
		var c = document.createElement('div');
		array[i].parentNode.replaceChild(c,h1);
		c.innerHTML = writeFlash2(flashURL,width,height);
	}

}
 
function getElementWidth(e) {
	if (typeof e.clip !== "undefined") {
		return e.clip.width;
	} else {
		if (e.style.pixelWidth) {
			return e.style.pixelWidth;
		} else {
			return e.offsetWidth;
		}
	}
}
function getElementHeight(e) {
	if (typeof e.clip !== "undefined") {
		return e.clip.height;
	} else {
		if (e.style.pixelHeight) {
			return e.style.pixelHeight;
		} else {
			return e.offsetHeight;
		}
	}
}

// window.onload = replaceH1;
