imgArray = new Array();
nMenuHigh = 0;
arrProdName = new Array();

arrProdName[6] = "classic";
arrProdName[5] = "compact";
arrProdName[4] = "plus";
arrProdName[3] = "promotor";
arrProdName[2] = "prospektor";
arrProdName[1] = "sprinter";
arrProdName[0] = "variant";

function ShowText(strText)
{
	document.all["IDfullText"].innerText = strText;
}

function SwapImageXX(strID, strNewImage, strPre)
{	
	if(strPre != undefined)
		strID = strPre+strID;
	var aImg = null;
	for(i=0; i < document.images.length;i++)
	{
		if(document.images[i].id == strID)
			aImg = document.images[i];
	}		
	
	if(window.selProd == aImg)
		return;
		
	window.strRestoreMenu = aImg.src;
	aImg.src = strNewImage;
}

function SwapImage(strID, strNewImage, strPre)
{	
	if(strPre != undefined)
		strID = strPre+strID;

	var aImg = null;
	if(document.layers && document.layers[0])
		aImg = document.layers[0].document.images[strID];
	else		
		aImg = document.images[strID];
	window.strRestoreMenu = aImg.src;
	aImg.src = strNewImage;
}

function restoreMenu(strID)
{
	var aImg = null;
	if(document.layers)
		aImg = document.layers[0].document.images[strID];
	else		
		aImg = document.images[strID];
	aImg.src = window.strRestoreMenu;
}

function ShowLayer(strID)
{
	aElement = document.all["LR_"+strID];
	if(typeof(aElement) == "object")
	{
		if(aElement.style.display == "block")
			aElement.style.display = "none";
		else		
			aElement.style.display = "block";
	}		
	window.event.returnValue = false;
}

function PreLoadImages()
{
	for(i=0; i<=8; i++)
		imgArray[i] = new Image; 
		
	imgArray[0].src = "images/menu/novinky_o.gif";
	imgArray[1].src = "images/menu/profil_o.gif";
	imgArray[2].src = "images/menu/vyrobky_o.gif";
	imgArray[3].src = "images/menu/povrchy_o.gif";
	imgArray[4].src = "images/menu/sluzby_o.gif";
	imgArray[5].src = "images/menu/ceniky_o.gif";
	imgArray[6].src = "images/menu/kontakt_o.gif";
	imgArray[7].src = "images/menu/odkazy_o.gif";
	imgArray[8].src = "images/menu/info_o.gif";
}

function ShowHideSubmenu(strID, URL)
{
	if(typeof(document.opened) != 'undefined' && document.opened != strID)
	{
		eval(document.opened).style.display = "none";
	}		
	document.opened = strID;
	if(eval(strID).style.display == "block")
		eval(strID).style.display = "none";
	else		
		eval(strID).style.display = "block";

}

function InitScroll()
{
	if(document.layers)
		return;
		
	nValue = 0;
	if(window.screen.width == 1024)
		nValue = 137;
		
	if(window.screen.width == 800)
		nValue = 137;
		
	nTemp = window.document.documentElement.offsetHeight-nValue-nMenuHigh;
		IDscroll.style.height = nTemp;
}

function InitPage(nPage, nSubPage, fSubPage, nSubLevel, fSubLevel)
{
	if(fSubLevel == true)
	{	
		document.opened = "sub"+nSubPage; 
	}		
	if(nSubPage != 0)
	{	
		nMenuHigh = 33; 
	}		
}

function SelectProduct(nProducts)
{
	for(i = 0; i < 7; i++ )
	{
		strID = "id_img_"+arrProdName[i];
		aImg = eval(strID);
		if((nProducts & 0x1) == 0x1)
			aImg.src = "images/arrows.gif";
		else
			aImg.src = "images/no_arrows.gif";
		nProducts >>= 0x1;			
	}			
}

function ShowSelect1(nValue)
{
	aArray = 0;
	iPos = 1;
	iMax = 4;
	nProducts = 0;
	strArray = "arr"+nValue;
	idSelection = document.all.IDSel2;
	idSelection.selectedIndex = 0;		
	ShowText(arr1[document.all.IDSel1.selectedIndex*2]);
	if(document.all.IDSel1.selectedIndex != 0)
	{
		strProducts = arr1[document.all.IDSel1.selectedIndex*2-1].substr(0,7);
		nProducts = parseInt(strProducts, 2);
	}		
	SelectProduct(nProducts);
	
	if(eval("typeof("+strArray+")") == "object")
	{
		idSelection.disabled = false;		
		eval("aArray="+strArray);
		for(i=1; i < aArray.length; i++, iPos++)
		{
			eval("document.all.IDOpt2"+iPos+".text=\""+aArray[i].substr(7)+"\"");
			eval("document.all.IDOpt2"+iPos+".value=\""+nValue+"0"+iPos+"\"");
			i++;
		}			
	}
	else
		idSelection.disabled = true;		
		
	for(;iPos < iMax; iPos++)
		eval("document.all.IDOpt2"+iPos+".text=\"\"");
		
	idSelection = document.all.IDSel3;
	idSelection.selectedIndex = 0;		
	idSelection.disabled = true;		
}

function ShowSelect2(nValue)
{
	aArray = 0;
	iPos = 1;
	iMax = 4;
	nProducts = 0;
	strArray1 = ""+nValue;
	strArray1 = "arr"+strArray1.substr(0, 3);
	if(eval("typeof("+strArray1+")") == "object")
	{
		eval("aArray="+strArray1);	
		iSelIndex = document.all.IDSel2.selectedIndex;
		if(iSelIndex > 0 && iSelIndex*2 <= aArray.length)
		{
			ShowText(aArray[document.all.IDSel2.selectedIndex*2]);
			if(document.all.IDSel2.selectedIndex != 0)
			{
				strProducts = aArray[document.all.IDSel2.selectedIndex*2-1].substr(0,7);
				nProducts = parseInt(strProducts, 2);
			}				
			SelectProduct(nProducts);
		}			
	}		
	else
	{
			ShowText("");
			SelectProduct(0);
	}			
	
	strArray = "arr"+nValue;
	idSelection = document.all.IDSel3;
	idSelection.selectedIndex = 0;		
	
	if(eval("typeof("+strArray+")") == "object")
	{
		idSelection.disabled = false;		
		eval("aArray="+strArray);
		for(i=1; i < aArray.length; i++, iPos++)
		{
			eval("document.all.IDOpt3"+iPos+".text=\""+aArray[i].substr(7)+"\"");
//			eval("document.all.IDOpt3"+iPos+".text=\""+aArray[i]+"\"");
			eval("document.all.IDOpt3"+iPos+".value=\""+nValue+"0"+iPos+"\"");
			i++;
		}			
	}
	else
		idSelection.disabled = true;		
		
	for(;iPos < iMax; iPos++)
		eval("document.all.IDOpt3"+iPos+".text=\"\"");
	
}

function ShowSelect3(nValue)
{
	aArray = 0;
	iPos = 1;
	iMax = 5;
	nProducts = 0;
	strArray1 = ""+nValue;
	strArray1 = "arr"+strArray1.substr(0, 5);
	if(eval("typeof("+strArray1+")") == "object")
	{
		eval("aArray="+strArray1);	
		iSelIndex = document.all.IDSel2.selectedIndex;
		if(iSelIndex > 0 && iSelIndex*2 <= aArray.length)
		{
			ShowText(aArray[document.all.IDSel3.selectedIndex*2]);
			if(document.all.IDSel3.selectedIndex != 0)
			{
				strProducts = aArray[document.all.IDSel3.selectedIndex*2-1].substr(0,7);
				nProducts = parseInt(strProducts, 2);
			}			
			SelectProduct(nProducts);
		}			
	}		
	else
	{
			ShowText("");
			SelectProduct(0);
	}			
}

function WindowOpen(strHTML, nWidth, nHeight)
{
	strParam = "width="+nWidth+" height="+nHeight+" toolbar=no, scrollbars=no, resizable=no";
	window.open(strHTML, 'tooltip', strParam);
}