var index = 0;
var xmlhttp = new Array();

function change_banner(){
	if(window.XMLHttpRequest){
     	xmlhttp.push(new XMLHttpRequest());
	}
	else if(window.ActiveXObject){
	     xmlhttp.push(new ActiveXObject("Microsoft.XMLHTTP"));
	}
	index = xmlhttp.length - 1;
     if(xmlhttp[index]){
     	var obj = document.getElementById("banner_place");
          xmlhttp[index].open("GET", "./inc/main_banner.inc?ajax=true", true);
          xmlhttp[index].onreadystatechange = function() {
               if(xmlhttp[index].readyState == 4 && xmlhttp[index].status == 200){
                    obj.innerHTML = xmlhttp[index].responseText;
               }
          }
          xmlhttp[index].send(null);
     }
}

/*====================================AJAX==========================================*/

function writeEmbedFlash(file, width, height)
{
  document.write('<embed src="'+file+'" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent"></embed>');
}

var countMenu = 7;

function menu_on(id)
{
	for(i=1;i<=countMenu;i++) {
	if(i!=id) {
		document.getElementById('menu'+String(i)).style.visibility="hidden";
		}
	}
	document.getElementById('menu'+String(id)).style.visibility="visible";
}

function menu_off(id)
{
	document.getElementById('menu'+String(id)).style.visibility="hidden";
}

function menu_off_all(id)
{
	for(i=1;i<=countMenu;i++){
		if(i!=id) {
			document.getElementById('menu'+String(i)).style.visibility="hidden";
		}
	}
}

function formatAsMoney(mnt) {
    mnt -= 0;
    mnt = (Math.round(mnt*100))/100;
    return (mnt == Math.floor(mnt)) ? mnt + '.00' 
              : ( (mnt*10 == Math.floor(mnt*10)) ? 
                       mnt + '0' : mnt);
}

function recalcAmountPrice()
{
	var currency = 'Kč';

	var amountPrice = (document.getElementById('unitPrice').value)*(document.getElementById('amount').value);
	document.getElementById('globalPrice').value = formatAsMoney(amountPrice)+currency;
}

